diff --git a/src/thermo/PureFluidPhase.cpp b/src/thermo/PureFluidPhase.cpp index a51ca4928..4d7cb31d4 100644 --- a/src/thermo/PureFluidPhase.cpp +++ b/src/thermo/PureFluidPhase.cpp @@ -31,6 +31,10 @@ PureFluidPhase::PureFluidPhase() : void PureFluidPhase::initThermo() { + if (m_input.hasKey("pure-fluid-name")) { + setSubstance(m_input["pure-fluid-name"].asString()); + } + if (m_tpx_name != "") { m_sub.reset(tpx::newSubstance(m_tpx_name)); } else { diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index fdb359b72..6323392c6 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -60,6 +60,7 @@ ThermoFactory::ThermoFactory() reg("StoichSubstance", []() { return new StoichSubstance(); }); m_synonyms["fixed-stoichiometry"] = "StoichSubstance"; reg("PureFluid", []() { return new PureFluidPhase(); }); + m_synonyms["pure-fluid"] = "PureFluid"; reg("LatticeSolid", []() { return new LatticeSolidPhase(); }); reg("Lattice", []() { return new LatticePhase(); }); reg("HMW", []() { return new HMWSoln(); }); diff --git a/test/data/thermo-models.yaml b/test/data/thermo-models.yaml index 792a8f82c..9e1223e39 100644 --- a/test/data/thermo-models.yaml +++ b/test/data/thermo-models.yaml @@ -174,6 +174,10 @@ phases: thermo: Redlich-Kwong state: {T: 300, P: 200 atm, mole-fractions: {CO2: 0.9998, H2O: 0.0002}} +- name: nitrogen + species: [N2] + thermo: pure-fluid + pure-fluid-name: nitrogen species: - name: NaCl(s) @@ -276,6 +280,17 @@ species: model: constant-volume molar-volume: 0.01 m^3/kmol +- name: N2 + composition: {N: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.298677, 0.0014082404, -3.963222e-06, 5.641515e-09, -2.444854e-12, + -1020.8999, 3.950372] + - [2.92664, 0.0014879768, -5.68476e-07, 1.0097038e-10, -6.753351e-15, + -922.7977, 5.980528] + 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 b5667313f..6b39b5c7c 100644 --- a/test/thermo/thermoFromYaml.cpp +++ b/test/thermo/thermoFromYaml.cpp @@ -324,3 +324,11 @@ TEST(ThermoFromYaml, RedlichKwong_CO2) EXPECT_NEAR(thermo->enthalpy_mass(), -8872890.9496462, 1e-6); EXPECT_NEAR(thermo->cp_mass(), 3358.439021094, 1e-8); } + +TEST(ThermoFromYaml, PureFluid_nitrogen) +{ + auto thermo = newThermo("thermo-models.yaml", "nitrogen"); + thermo->setState_TP(70, 2*OneAtm); + EXPECT_NEAR(thermo->density(), 841.0420151, 1e-6); + EXPECT_NEAR(thermo->gibbs_mole(), -17654452.8821914, 1e-6); +}