diff --git a/include/cantera/thermo/MaskellSolidSolnPhase.h b/include/cantera/thermo/MaskellSolidSolnPhase.h index 83bf9b26a..4935e1a5a 100644 --- a/include/cantera/thermo/MaskellSolidSolnPhase.h +++ b/include/cantera/thermo/MaskellSolidSolnPhase.h @@ -120,6 +120,7 @@ public: /// @name Utility Functions //@{ + virtual void initThermo(); virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); void set_h_mix(const doublereal hmix) { h_mixing = hmix; } diff --git a/src/thermo/MaskellSolidSolnPhase.cpp b/src/thermo/MaskellSolidSolnPhase.cpp index cc4bd6245..47db0c596 100644 --- a/src/thermo/MaskellSolidSolnPhase.cpp +++ b/src/thermo/MaskellSolidSolnPhase.cpp @@ -175,6 +175,18 @@ void MaskellSolidSolnPhase::getStandardChemPotentials(doublereal* mu) const // Utility Functions +void MaskellSolidSolnPhase::initThermo() +{ + if (m_input.hasKey("excess-enthalpy")) { + set_h_mix(m_input.convert("excess-enthalpy", "J/kmol")); + } + if (m_input.hasKey("product-species")) { + setProductSpecies(m_input["product-species"].asString()); + } + VPStandardStateTP::initThermo(); +} + + void MaskellSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string& id_) { if (id_.size() > 0 && phaseNode.id() != id_) { diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 2dd7afc79..cd7df820c 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -79,6 +79,7 @@ ThermoFactory::ThermoFactory() reg("RedlichKwong", []() { return new RedlichKwongMFTP(); }); m_synonyms["RedlichKwongMFTP"] = "RedlichKwong"; reg("MaskellSolidSolnPhase", []() { return new MaskellSolidSolnPhase(); }); + m_synonyms["Maskell-solid-solution"] = "MaskellSolidSolnPhase"; reg("PureLiquidWater", []() { return new WaterSSTP(); }); m_synonyms["water-IAPWS95"] = "PureLiquidWater"; reg("BinarySolutionTabulatedThermo", []() { return new BinarySolutionTabulatedThermo(); }); diff --git a/test/data/thermo-models.yaml b/test/data/thermo-models.yaml index 48c739edc..b97b0495c 100644 --- a/test/data/thermo-models.yaml +++ b/test/data/thermo-models.yaml @@ -112,6 +112,14 @@ phases: -2.129e+07, -1.722e+08, 3.956e+07, 9.302e+07, -3.280e+07] excess-entropy: [0.0] +- name: MaskellSolidSoln + thermo: Maskell-solid-solution + species: [H(s), He(s)] + excess-enthalpy: 5 J/mol + state: {T: 298, P: 1 atm, X: {H(s): 0.3, He(s): 0.7}} + product-species: H(s) + + species: - name: NaCl(s) composition: {Na: 1, Cl: 1} @@ -196,6 +204,23 @@ species: model: constant-volume molar-volume: 0.036 m^3/kmol +- name: H(s) + composition: {H: 1, He: 2} + thermo: + model: constant-cp + equation-of-state: + model: constant-volume + molar-volume: 0.005 m^3/kmol + +- name: He(s) + composition: {He: 1} + thermo: + model: constant-cp + h0: 1000 + equation-of-state: + model: constant-volume + molar-volume: 0.01 m^3/kmol + ideal-molal-fake-species: # Fake thermo data (GRI 3.0 coefficients for H2) diff --git a/test/thermo/thermoFromYaml.cpp b/test/thermo/thermoFromYaml.cpp index f7c71b185..879fdaad0 100644 --- a/test/thermo/thermoFromYaml.cpp +++ b/test/thermo/thermoFromYaml.cpp @@ -260,3 +260,15 @@ TEST(ThermoFromYaml, RedlichKister) EXPECT_NEAR(chemPotentials[0], -1.1792994839484975e+07, 1e-6); EXPECT_NEAR(dlnActCoeffdx[0], -0.309379, 1e-6); } + +TEST(ThermoFromYaml, MaskellSolidSoln) +{ + AnyMap infile = AnyMap::fromYamlFile("thermo-models.yaml"); + auto phaseNodes = infile["phases"].asMap("name"); + auto thermo = newPhase(*phaseNodes.at("MaskellSolidSoln"), infile); + + vector_fp chemPotentials(2); + thermo->getChemPotentials(chemPotentials.data()); + EXPECT_NEAR(chemPotentials[0], -4.989677478024063e6, 1e-6); + EXPECT_NEAR(chemPotentials[1], 4.989677478024063e6 + 1000, 1e-6); +}