std::string MakeResultJSON(const std::string& answer, const std::string& file_id, const std::string& error_code, const std::string& seq, const PT::ptree& data) { PT::ptree root; root.put(JSON_TAG_ANS, answer); root.put(JSON_TAG_FILEID, file_id); root.put_child(JSON_TAG_DATA, data); root.put(JSON_TAG_ERROR_CODE, error_code); root.put(JSON_TAG_SEQ, seq); std::stringstream ss; PT::write_json(ss, root, false); return ss.str(); }
void saveTurbulenceParameters(const IOdictionary& RASProperties, pt::ptree& settings) { std::string dictName = "kOmegaSSTCoeffs"; dictionary kOmegaSSTCoeffsDict (RASProperties.subOrEmptyDict(dictName)); scalar alphaK1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaK1", 0.85034); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_K1, alphaK1); scalar alphaK2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaK2", 1.0); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_K2, alphaK2); scalar alphaOmega1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaOmega1", 0.5); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_OMEGA1, alphaOmega1); scalar alphaOmega2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaOmega2", 0.85616); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_OMEGA2, alphaOmega2); scalar gamma1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("gamma1", 0.5532); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_GAMMA1, gamma1); scalar gamma2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("gamma2", 0.4403); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_GAMMA2, gamma2); scalar beta1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("beta1", 0.0750); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETA1, beta1); scalar beta2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("beta2", 0.0828); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETA2, beta2); scalar betaStar = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("betaStar", 0.09); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETASTAR, betaStar); scalar a1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("a1", 0.31); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_A1, a1); scalar c1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("c1", 10); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_C1, c1); scalar Cmu = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("Cmu", 0.09); settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_CMU, Cmu); scalar kappa = 0.41; settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_KAPPA, kappa); scalar E = 9.8; settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_E, E); scalar ypl = 11.0; for (int i = 0; i < 10; i++) { ypl = ::log(E*ypl)/kappa; } scalar yPlusLam = ypl; settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_YPLUS_LAM, yPlusLam); }