diff --git a/include/cantera/thermo/MetalPhase.h b/include/cantera/thermo/MetalPhase.h index 2cad63efb..25b618a94 100644 --- a/include/cantera/thermo/MetalPhase.h +++ b/include/cantera/thermo/MetalPhase.h @@ -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"); diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index aeeb44b6c..fb545936f 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -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(); }); diff --git a/test/data/thermo-models.yaml b/test/data/thermo-models.yaml index 5a2ae0efc..51fb3620a 100644 --- a/test/data/thermo-models.yaml +++ b/test/data/thermo-models.yaml @@ -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) diff --git a/test/thermo/thermoFromYaml.cpp b/test/thermo/thermoFromYaml.cpp index 4ba1a710d..fb71534a3 100644 --- a/test/thermo/thermoFromYaml.cpp +++ b/test/thermo/thermoFromYaml.cpp @@ -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); +}