[Test] Added outline for tests of ThermoPhase constructors
This commit is contained in:
parent
83097b3860
commit
ecb6c75cc8
2 changed files with 80 additions and 0 deletions
49
test/data/LiFixed.xml
Normal file
49
test/data/LiFixed.xml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0"?>
|
||||
<ctml>
|
||||
<validate reactions="yes" species="yes"/>
|
||||
|
||||
<phase dim="3" id="LiFixed">
|
||||
<elementArray datasrc="elements.xml">
|
||||
Li
|
||||
</elementArray>
|
||||
<speciesArray datasrc="#species_Li(Fixed)">
|
||||
LiFixed
|
||||
</speciesArray>
|
||||
<thermo model="FixedChemPot">
|
||||
<chemicalPotential units="J/kmol"> -2.3E7 </chemicalPotential>
|
||||
</thermo>
|
||||
<transport model="None"/>
|
||||
<kinetics model="none"/>
|
||||
</phase>
|
||||
|
||||
<phase dim="3" id="mismatch">
|
||||
<elementArray datasrc="elements.xml">
|
||||
Li
|
||||
</elementArray>
|
||||
<speciesArray datasrc="#species_Li(Fixed)">
|
||||
LiFixed
|
||||
</speciesArray>
|
||||
<thermo model="StoichSubstance">
|
||||
<chemicalPotential units="J/kmol"> -2.3E7 </chemicalPotential>
|
||||
</thermo>
|
||||
<transport model="None"/>
|
||||
<kinetics model="none"/>
|
||||
</phase>
|
||||
|
||||
<!-- species definitions -->
|
||||
<speciesData id="species_Li(Fixed)">
|
||||
|
||||
<species name="LiFixed">
|
||||
<atomArray> Li:1 </atomArray>
|
||||
<thermo>
|
||||
<Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
|
||||
<floatArray size="7">
|
||||
50.72389, 6.672267, -2.517167,
|
||||
10.15934, -0.200675, -427.2115,
|
||||
130.3973
|
||||
</floatArray>
|
||||
</Shomate>
|
||||
</thermo>
|
||||
</species>
|
||||
</speciesData>
|
||||
</ctml>
|
||||
31
test/thermo/phaseConstructors.cpp
Normal file
31
test/thermo/phaseConstructors.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include "gtest/gtest.h"
|
||||
#include "cantera/thermo/FixedChemPotSSTP.h"
|
||||
#include "cantera/thermo/ThermoFactory.h"
|
||||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
class FixedChemPotSstpConstructorTest : public testing::Test
|
||||
{
|
||||
};
|
||||
|
||||
TEST_F(FixedChemPotSstpConstructorTest, fromXML)
|
||||
{
|
||||
ThermoPhase* p = newPhase("../data/LiFixed.xml", "");
|
||||
ASSERT_EQ((int) p->nSpecies(), 1);
|
||||
double mu;
|
||||
p->getChemPotentials(&mu);
|
||||
ASSERT_FLOAT_EQ(-2.3e7, mu);
|
||||
delete p;
|
||||
}
|
||||
|
||||
TEST_F(FixedChemPotSstpConstructorTest, SimpleConstructor)
|
||||
{
|
||||
FixedChemPotSSTP p("Li", -2.3e7);
|
||||
ASSERT_EQ((int) p.nSpecies(), 1);
|
||||
double mu;
|
||||
p.getChemPotentials(&mu);
|
||||
ASSERT_FLOAT_EQ(-2.3e7, mu);
|
||||
}
|
||||
|
||||
} // namespace Cantera
|
||||
Loading…
Add table
Reference in a new issue