[Input] Create MaskellSolidSoln objects from YAML definitions
This commit is contained in:
parent
d8a1337933
commit
7d964dae47
5 changed files with 51 additions and 0 deletions
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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_) {
|
||||
|
|
|
|||
|
|
@ -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(); });
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue