[Input] Parse YAML entries for constant cp species thermo
This commit is contained in:
parent
74eec731f1
commit
86c73dad20
2 changed files with 30 additions and 0 deletions
|
|
@ -294,6 +294,16 @@ static SpeciesThermoInterpType* newConstCpThermoFromXML(XML_Node& f)
|
|||
return newSpeciesThermoInterpType(CONSTANT_CP, tmin, tmax, p0, &c[0]);
|
||||
}
|
||||
|
||||
void setupConstCp(ConstCpPoly& thermo, const AnyMap& node,
|
||||
const UnitSystem& units)
|
||||
{
|
||||
double T0 = units.convert(node.at("T0"), "K");
|
||||
double h0 = units.convert(node, "h0", "J/kmol", 0.0);
|
||||
double s0 = units.convert(node, "s0", "J/kmol/K", 0.0);
|
||||
double cp0 = units.convert(node, "cp0", "J/kmol/K", 0.0);
|
||||
thermo.setParameters(T0, h0, s0, cp0);
|
||||
}
|
||||
|
||||
//! Create a NASA9 polynomial thermodynamic property parameterization for a
|
||||
//! species
|
||||
/*!
|
||||
|
|
@ -432,6 +442,10 @@ unique_ptr<SpeciesThermoInterpType> newSpeciesThermo(
|
|||
unique_ptr<Nasa9PolyMultiTempRegion> thermo(new Nasa9PolyMultiTempRegion());
|
||||
setupNasa9Poly(*thermo, node, units);
|
||||
return unique_ptr<SpeciesThermoInterpType>(move(thermo));
|
||||
} else if (model == "constant-cp") {
|
||||
unique_ptr<ConstCpPoly> thermo(new ConstCpPoly());
|
||||
setupConstCp(*thermo, node, units);
|
||||
return unique_ptr<SpeciesThermoInterpType>(move(thermo));
|
||||
} else {
|
||||
throw CanteraError("newSpeciesThermo",
|
||||
"Uknown thermo model '{}'", model);
|
||||
|
|
|
|||
|
|
@ -206,3 +206,19 @@ TEST(SpeciesThermo, Nasa9PolyFromYaml) {
|
|||
EXPECT_DOUBLE_EQ(h_RT, 3.3757914517886856);
|
||||
EXPECT_DOUBLE_EQ(s_R, 30.31743870437559);
|
||||
}
|
||||
|
||||
TEST(SpeciesThermo, ConstCpPolyFromYaml) {
|
||||
AnyMap data = AnyMap::fromYamlString(
|
||||
"model: constant-cp # was 'const_cp'\n"
|
||||
"T0: 1000 K\n"
|
||||
"h0: 9.22 kcal/mol\n"
|
||||
"s0: -3.02 cal/mol/K\n"
|
||||
"cp0: 5.95 cal/mol/K\n");
|
||||
UnitSystem U;
|
||||
double cp_R, h_RT, s_R;
|
||||
auto st = newSpeciesThermo(data, U);
|
||||
st->updatePropertiesTemp(1100, &cp_R, &h_RT, &s_R);
|
||||
EXPECT_DOUBLE_EQ(cp_R * GasConst_cal_mol_K, 5.95);
|
||||
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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue