[Input] Create Surface and Edge phases from YAML definitions
This commit is contained in:
parent
9ffab53a17
commit
26bd71af53
5 changed files with 79 additions and 0 deletions
|
|
@ -284,6 +284,7 @@ public:
|
|||
* @endcode
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& thermoData);
|
||||
virtual void initThermo();
|
||||
|
||||
virtual bool addSpecies(shared_ptr<Species> spec);
|
||||
|
||||
|
|
|
|||
|
|
@ -323,6 +323,15 @@ void SurfPhase::setParametersFromXML(const XML_Node& eosdata)
|
|||
setSiteDensity(n);
|
||||
}
|
||||
|
||||
void SurfPhase::initThermo()
|
||||
{
|
||||
if (m_input.hasKey("site-density")) {
|
||||
// Units are kmol/m^2 for surface phases or kmol/m for edge phases
|
||||
setSiteDensity(m_input.convert("site-density",
|
||||
Units(1.0, 0, -static_cast<double>(m_ndim), 0, 0, 0, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
void SurfPhase::setStateFromXML(const XML_Node& state)
|
||||
{
|
||||
double t;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ ThermoFactory::ThermoFactory()
|
|||
m_synonyms["ideal-gas"] = "IdealGas";
|
||||
reg("Incompressible", []() { return new ConstDensityThermo(); });
|
||||
reg("Surface", []() { return new SurfPhase(); });
|
||||
m_synonyms["ideal-surface"] = "Surface";
|
||||
reg("Edge", []() { return new EdgePhase(); });
|
||||
m_synonyms["edge"] = "Edge";
|
||||
reg("Metal", []() { return new MetalPhase(); });
|
||||
reg("StoichSubstance", []() { return new StoichSubstance(); });
|
||||
m_synonyms["fixed-stoichiometry"] = "StoichSubstance";
|
||||
|
|
|
|||
44
test/data/surface-phases.yaml
Normal file
44
test/data/surface-phases.yaml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
phases:
|
||||
- name: Pt-surf
|
||||
thermo: ideal-surface
|
||||
species: [{Pt-surf-species: all}]
|
||||
site-density: 2.7063e-9 mol/cm^2
|
||||
state: {T: 900 K, P: 1 atm, coverages: {Pt(s): 0.5, H(s): 0.4, O(s): 0.1}}
|
||||
|
||||
- name: TPB
|
||||
thermo: edge
|
||||
species: [(tpb)]
|
||||
site-density: 5e-17 mol/cm
|
||||
state: {T: 1073.15 K, P: 1 atm, coverages: {(tpb): 1.0}}
|
||||
|
||||
species:
|
||||
- name: (tpb)
|
||||
composition: {}
|
||||
thermo:
|
||||
model: constant-cp
|
||||
|
||||
Pt-surf-species:
|
||||
- name: Pt(s)
|
||||
composition: {Pt: 1}
|
||||
thermo:
|
||||
model: constant-cp
|
||||
- name: H(s)
|
||||
composition: {H: 1, Pt: 1}
|
||||
thermo:
|
||||
model: NASA7
|
||||
temperature-ranges: [300, 1000, 3000]
|
||||
data:
|
||||
- [-1.3029877E+00, 5.4173199E-03, 3.1277972E-07, -3.2328533E-09,
|
||||
1.1362820E-12, -4.2277075E+03, 5.8743238E+00]
|
||||
- [1.0696996E+00, 1.5432230E-03, -1.5500922E-07, -1.6573165E-10,
|
||||
3.8359347E-14, -5.0546128E+03, -7.1555238E+00]
|
||||
- name: O(s)
|
||||
composition: {O: 1, Pt: 1}
|
||||
thermo:
|
||||
model: NASA7
|
||||
temperature-ranges: [300, 1000, 3000]
|
||||
data:
|
||||
- [-9.4986904E-01, 7.4042305E-03, -1.0451424E-06, -6.1120420E-09,
|
||||
3.3787992E-12, -1.3209912E+04, 3.6137905E+00]
|
||||
- [1.9454180E+00, 9.1761647E-04, -1.1226719E-07, -9.9099624E-11,
|
||||
2.4307699E-14, -1.4005187E+04, -1.1531663E+01]
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#include "cantera/thermo/Elements.h"
|
||||
#include "cantera/thermo/MolalityVPSSTP.h"
|
||||
#include "cantera/thermo/IdealGasPhase.h"
|
||||
#include "cantera/thermo/SurfPhase.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
|
|
@ -86,6 +87,28 @@ TEST(ThermoFromYaml, StoichSubstance2)
|
|||
EXPECT_NEAR(thermo->density(), 1980, 0.1);
|
||||
}
|
||||
|
||||
TEST(ThermoFromYaml, SurfPhase)
|
||||
{
|
||||
auto thermo = newThermo("surface-phases.yaml", "Pt-surf");
|
||||
EXPECT_EQ(thermo->type(), "Surf");
|
||||
EXPECT_EQ(thermo->nSpecies(), (size_t) 3);
|
||||
auto surf = std::dynamic_pointer_cast<SurfPhase>(thermo);
|
||||
EXPECT_DOUBLE_EQ(surf->siteDensity(), 2.7063e-8);
|
||||
vector_fp cov(surf->nSpecies());
|
||||
surf->getCoverages(cov.data());
|
||||
EXPECT_DOUBLE_EQ(cov[surf->speciesIndex("Pt(s)")], 0.5);
|
||||
EXPECT_DOUBLE_EQ(cov[surf->speciesIndex("H(s)")], 0.4);
|
||||
}
|
||||
|
||||
TEST(ThermoFromYaml, EdgePhase)
|
||||
{
|
||||
auto thermo = newThermo("surface-phases.yaml", "TPB");
|
||||
EXPECT_EQ(thermo->type(), "Edge");
|
||||
EXPECT_EQ(thermo->nSpecies(), (size_t) 1);
|
||||
auto edge = std::dynamic_pointer_cast<SurfPhase>(thermo);
|
||||
EXPECT_DOUBLE_EQ(edge->siteDensity(), 5e-18);
|
||||
}
|
||||
|
||||
TEST(ThermoFromYaml, WaterSSTP)
|
||||
{
|
||||
auto thermo = newThermo("thermo-models.yaml", "liquid-water");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue