diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 50397f02d..b9dcf8413 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -371,6 +371,23 @@ void setupNasa9Poly(Nasa9PolyMultiTempRegion& thermo, const AnyMap& node, } +void setupMu0(Mu0Poly& thermo, const AnyMap& node, const UnitSystem& units) +{ + setupSpeciesThermo(thermo, node, units); + bool dimensionless = node.getBool("dimensionless", false); + double h0 = units.convertMolarEnergy(node, "h0", "J/kmol", 0.0); + map T_mu; + for (const auto& item : node.at("data")) { + double T = units.convert(fpValueCheck(item.first), "K"); + if (dimensionless) { + T_mu[T] = item.second.asDouble() * GasConstant * T; + } else { + T_mu[T] = units.convertMolarEnergy(item.second, "J/kmol"); + } + } + thermo.setParameters(h0, T_mu); +} + SpeciesThermoInterpType* newSpeciesThermoInterpType(const XML_Node& thermo) { std::string model = toLowerCopy(thermo["model"]); @@ -446,6 +463,10 @@ unique_ptr newSpeciesThermo( unique_ptr thermo(new ConstCpPoly()); setupConstCp(*thermo, node, units); return unique_ptr(move(thermo)); + } else if (model == "piecewise-Gibbs") { + unique_ptr thermo(new Mu0Poly()); + setupMu0(*thermo, node, units); + return unique_ptr(move(thermo)); } else { throw CanteraError("newSpeciesThermo", "Uknown thermo model '{}'", model); diff --git a/test/thermo/thermoParameterizations.cpp b/test/thermo/thermoParameterizations.cpp index 1bbbb9afa..a6b05a8fa 100644 --- a/test/thermo/thermoParameterizations.cpp +++ b/test/thermo/thermoParameterizations.cpp @@ -222,3 +222,18 @@ TEST(SpeciesThermo, ConstCpPolyFromYaml) { EXPECT_DOUBLE_EQ(h_RT * GasConst_cal_mol_K * 1100, 9.22e3 + 100 * 5.95); EXPECT_DOUBLE_EQ(s_R * GasConst_cal_mol_K, -3.02 + 5.95 * log(1100.0/1000.0)); } + +TEST(SpeciesThermo, Mu0PolyFromYaml) { + AnyMap data = AnyMap::fromYamlString( + "{model: piecewise-Gibbs," + " h0: -890 kJ/mol," + " dimensionless: true," + " data: {298.15: -363.2104, 323.15: -300}}"); + UnitSystem U; + auto st = newSpeciesThermo(data, U); + double cp_R, h_RT, s_R; + st->updatePropertiesTemp(310, &cp_R, &h_RT, &s_R); + EXPECT_DOUBLE_EQ(cp_R, -11226.315195362145); + EXPECT_DOUBLE_EQ(h_RT, -774.4330249157999); + EXPECT_DOUBLE_EQ(s_R, -433.36374517067503); +}