[Input] Create WaterSSTP objects from YAML definitions

This commit is contained in:
Ray Speth 2019-01-10 22:45:09 -05:00
parent 98a9566fc4
commit cae5c498ca
3 changed files with 18 additions and 0 deletions

View file

@ -74,6 +74,7 @@ ThermoFactory::ThermoFactory()
m_synonyms["RedlichKwongMFTP"] = "RedlichKwong";
reg("MaskellSolidSolnPhase", []() { return new MaskellSolidSolnPhase(); });
reg("PureLiquidWater", []() { return new WaterSSTP(); });
m_synonyms["water-IAPWS95"] = "PureLiquidWater";
reg("BinarySolutionTabulatedThermo", []() { return new BinarySolutionTabulatedThermo(); });
}

View file

@ -10,6 +10,9 @@ phases:
species: [KCl(s)]
state: {T: 300.0, P: 1 atm}
- name: liquid-water
thermo: water-IAPWS95
species: [H2O(l)]
species:
- name: NaCl(s)
@ -37,3 +40,5 @@ species:
model: constant-volume
molar-volume: 0.0376521717 L/mol
- name: H2O(l)
composition: {H: 2, O: 1}

View file

@ -90,3 +90,15 @@ TEST(ThermoFromYaml, StoichSubstance2)
EXPECT_EQ(thermo->nElements(), (size_t) 2);
EXPECT_NEAR(thermo->density(), 1980, 0.1);
}
TEST(ThermoFromYaml, WaterSSTP)
{
AnyMap infile = AnyMap::fromYamlFile("thermo-models.yaml");
auto phaseNodes = infile["phases"].asMap("name");
auto thermo = newPhase(*phaseNodes.at("liquid-water"), infile);
EXPECT_EQ(thermo->nSpecies(), (size_t) 1);
thermo->setState_TP(350, 2*OneAtm);
// Regression tests based on XML
EXPECT_NEAR(thermo->density(), 973.7736331, 1e-6);
EXPECT_NEAR(thermo->enthalpy_mass(), -15649442.2898854, 1e-6);
}