[Input] Create Metal objects from YAML definitions

This commit is contained in:
Ray Speth 2019-02-05 15:53:05 -05:00
parent 088e0031fd
commit b1273301cc
4 changed files with 26 additions and 0 deletions

View file

@ -94,6 +94,12 @@ public:
return 0.0;
}
virtual void initThermo() {
if (m_input.hasKey("density")) {
setDensity(m_input.convert("density", "kg/m^3"));
}
}
virtual void setParametersFromXML(const XML_Node& eosdata) {
eosdata._require("model","Metal");
doublereal rho = getFloat(eosdata, "density", "density");

View file

@ -58,6 +58,7 @@ ThermoFactory::ThermoFactory()
reg("Edge", []() { return new EdgePhase(); });
m_synonyms["edge"] = "Edge";
reg("Metal", []() { return new MetalPhase(); });
m_synonyms["electron-cloud"] = "Metal";
reg("StoichSubstance", []() { return new StoichSubstance(); });
m_synonyms["fixed-stoichiometry"] = "StoichSubstance";
reg("PureFluid", []() { return new PureFluidPhase(); });

View file

@ -204,6 +204,13 @@ phases:
composition: {Li7Si3(s): 1.0, Li7Si3-interstitial: 1.0}
state: {T: 725 K, P: 10 atm}
- name: Metal
thermo: electron-cloud
species: ["electron"]
density: 9 kg/m^3
state: {T: 1073.15, P: 1 atm}
species:
- name: NaCl(s)
composition: {Na: 1, Cl: 1}
@ -316,6 +323,11 @@ species:
- [2.92664, 0.0014879768, -5.68476e-07, 1.0097038e-10, -6.753351e-15,
-922.7977, 5.980528]
- name: electron
composition: {E: 1}
thermo:
model: constant-cp
ideal-molal-fake-species:
# Fake thermo data (GRI 3.0 coefficients for H2)

View file

@ -367,3 +367,10 @@ TEST(ThermoFromYaml, Lattice)
EXPECT_NEAR(vol[k], vol_ref[k], 1e-7);
}
}
TEST(ThermoFromYaml, Metal)
{
auto thermo = newThermo("thermo-models.yaml", "Metal");
EXPECT_DOUBLE_EQ(thermo->density(), 9.0);
EXPECT_DOUBLE_EQ(thermo->gibbs_mass(), 0.0);
}