Added the stoichSolidKinetics test from the extendedCXXTestSuite

This commit is contained in:
Ray Speth 2012-08-02 15:48:43 +00:00
parent 85070e1d30
commit 39f1c15c8a
6 changed files with 756 additions and 0 deletions

View file

@ -267,6 +267,8 @@ CompileAndTest('rankine_democxx', 'rankine_democxx', 'rankine', 'output_blessed.
artifacts=['liquidvapor.xml'])
CompileAndTest('silane_equil', 'silane_equil', 'silane_equi', 'output_blessed.txt')
# spectroscopy is incomplete
CompileAndTest('stoichSolidKinetics', 'stoichSolidKinetics',
'stoichSolidKinetics', 'output_blessed.txt')
CompileAndTest('surfkin', 'surfkin', 'surfdemo', 'output_blessed.txt')
CompileAndTest('surfSolver', 'surfSolverTest', 'surfaceSolver', None,
arguments='haca2.xml',

View file

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<phase dim="2" id="reaction_surface">
<elementArray datasrc="elements.xml"> Ca C O Fe N </elementArray>
<speciesArray datasrc="#species_ReactingSurf"> empty_site </speciesArray>
<state>
<temperature units="K"> 1500.0 </temperature>
<coverages> empty_site:1.0 </coverages>
</state>
<thermo model="Surface">
<site_density units="mol/cm2"> 3e-09 </site_density>
</thermo>
<kinetics model="Interface"/>
<reactionArray datasrc="#data_StoichRxns"/>
<transport model="None"/>
<phaseArray> CaCO3(S) air CaO(S) Fe3O4(S) FeO(S) Fe(S) </phaseArray>
</phase>
<!-- species definitions -->
<speciesData id="species_ReactingSurf">
<species name="empty_site">
<atomArray> </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.15</t0>
<h0 units="kJ/mol">0.0</h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
</speciesData>
<reactionData id="data_StoichRxns">
<!--
Lumped reaction within the anode turning one phase of LiSi into another
phase of LiSi, ejecting a Li ion into the molten salt.
This may be considered a lumped mechanism because processes probably occur
via several smaller steps. The first step is the ejection of Li from one phase
into an institial Li species in the other phase. Then the Li(i) diffuses through
that phase to the surface where it loses an electron an then gets ejected into
salt phase.
-->
<reaction reversible="yes" type="surface" id="0001">
<equation> CaCO3(S) [=] CaO(S) + CO2 </equation>
<rateCoeff>
<Arrhenius>
<A>1.0E-5</A>
<b>0.0</b>
<E units="kJ/mol"> 20.000000 </E>
</Arrhenius>
</rateCoeff>
<reactants> CaCO3(S):1.0 </reactants>
<products> CaO(S):1.0 CO2:1.0 </products>
</reaction>
</reactionData>
</ctml>

View file

@ -0,0 +1,252 @@
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<!-- phase gas -->
<phase dim="3" id="air">
<elementArray datasrc="elements.xml">
O H C Fe Ca N
</elementArray>
<speciesArray datasrc="#species_data">
O2 H2 H CH2O CHO OH CO2 H2O CH4 CO N2
</speciesArray>
<reactionArray datasrc="#reaction_data"/>
<state>
<temperature units="K">1500.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="IdealGas"/>
<kinetics model="GasKinetics"/>
<transport model="Mix"/>
</phase>
<!-- species definitions -->
<speciesData id="species_data">
<!-- species O2 -->
<species name="O2">
<atomArray>O:2 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> 0.0 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="H2">
<atomArray>H:2 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> 0.0 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="H">
<atomArray>H:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> 1.0E6 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="CH2O">
<atomArray>C:1 H:2 O:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> -8.611E4 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="CHO">
<atomArray>C:1 H:1 O:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> -6.255E4 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="OH">
<atomArray> H:1 O:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> 2.259E4 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="CO2">
<atomArray> C:1 O:2 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> -3.9597E5 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="H2O">
<atomArray> H:2 O:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> -1.8987E5 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="CH4">
<atomArray> C:1 H:4 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> 2.485E4 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<species name="CO">
<atomArray> C:1 O:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> -2.0464E5 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">107.400</LJ_welldepth>
<LJ_diameter units="A">3.460</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.600</polarizability>
<rotRelax>3.800</rotRelax>
</transport>
</species>
<!-- species N2 -->
<species name="N2">
<atomArray>N:2 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K"> 1500.0 </t0>
<h0 units="J/mol"> 0.0 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
<transport model="gas_transport">
<string title="geometry">linear</string>
<LJ_welldepth units="K">97.530</LJ_welldepth>
<LJ_diameter units="A">3.620</LJ_diameter>
<dipoleMoment units="Debye">0.000</dipoleMoment>
<polarizability units="A3">1.760</polarizability>
<rotRelax>4.000</rotRelax>
</transport>
</species>
</speciesData>
</ctml>

View file

@ -0,0 +1,96 @@
*** StoichSolidKinetics Test ***
Tests for the proper behavior of heterogeneous reactions
when phases may or may not exist:
CaCO3(s) = CO2(g) + CaO(s)
deltaGSS = 1.729E+07
deltaG = 3.908E+06
mu_CO2(g) = -4.094E+08
mu_cao(s) = -5.292E+08
mu_caco3 = -9.424E+08
deltaG_calc = 3.908E+06
act_CO2 = 2.000E-01
act_cao(s) = 1.000E+00
act_caco3(s) = 1.000E+00
*** Base problem assuming that all phases exist:
ROP_net = -5.414E-07
ROP_forward = 9.023E-07
ROP_reverse = 1.444E-06
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting CaO(S) phase to nonexistent:
ROP_net = 0.000E+00
ROP_forward = 9.023E-07
ROP_reverse = 9.023E-07
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting CaCO3(S) phase to nonexistent:
ROP_net = 0.000E+00
ROP_forward = 0.000E+00
ROP_reverse = 0.000E+00
kfwd = 9.023E-07
krev = 5.923E-04
*** OK Setting CaO(S) phase to existent, CaCO3 nonexistent:
ROP_net = -5.414E-07
ROP_forward = 9.023E-07
ROP_reverse = 1.444E-06
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting Gas phase to nonexistent, CaCO3 nonexistent:
ROP_net = 0.000E+00
ROP_forward = 0.000E+00
ROP_reverse = 0.000E+00
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting to all phases existing:
ROP_net = -5.414E-07
ROP_forward = 9.023E-07
ROP_reverse = 1.444E-06
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting so that forward rate if faster:
deltaGSS = 1.729E+07
deltaG = -3.438E+07
mu_CO2(g) = -4.476E+08
mu_cao(s) = -5.292E+08
mu_caco3 = -9.424E+08
deltaG_calc = -3.438E+07
act_CO2 = 2.000E-03
act_cao(s) = 1.000E+00
act_caco3(s) = 1.000E+00
*** Base problem assuming that all phases exist:
ROP_net = 8.878E-07
ROP_forward = 9.023E-07
ROP_reverse = 1.444E-08
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting CaO(S) phase to nonexistent:
ROP_net = 8.878E-07
ROP_forward = 9.023E-07
ROP_reverse = 1.444E-08
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting CaCO3(S) phase to nonexistent:
ROP_net = 0.000E+00
ROP_forward = 0.000E+00
ROP_reverse = 0.000E+00
kfwd = 9.023E-07
krev = 5.923E-04
*** OK Setting CaO(S) phase to existent, CaCO3 nonexistent:
ROP_net = 0.000E+00
ROP_forward = 1.444E-08
ROP_reverse = 1.444E-08
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting Gas phase to nonexistent, CaCO3 nonexistent:
ROP_net = 0.000E+00
ROP_forward = 0.000E+00
ROP_reverse = 0.000E+00
kfwd = 9.023E-07
krev = 5.923E-04
*** Setting to all phases existing:
ROP_net = 8.878E-07
ROP_forward = 9.023E-07
ROP_reverse = 1.444E-08
kfwd = 9.023E-07
krev = 5.923E-04

View file

@ -0,0 +1,155 @@
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<!-- phase definitions -->
<phase dim="3" id="CaO(S)">
<elementArray datasrc="elements.xml">
O H C Fe Ca N
</elementArray>
<speciesArray datasrc="#species_data"> CaO(S) </speciesArray>
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<phase dim="3" id="CaCO3(S)">
<elementArray datasrc="elements.xml">
O H C Fe Ca N
</elementArray>
<speciesArray datasrc="#species_data">CaCO3(S)</speciesArray>
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<phase dim="3" id="C(S)">
<elementArray datasrc="elements.xml">
O H C Fe Ca N
</elementArray>
<speciesArray datasrc="#species_data">C(d)</speciesArray>
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<phase dim="3" id="Fe3O4(S)">
<elementArray datasrc="elements.xml">
O H C Fe Ca N
</elementArray>
<speciesArray datasrc="#species_data"> Fe3O4(S)</speciesArray>
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<phase dim="3" id="FeO(S)">
<elementArray datasrc="elements.xml">
O H C Fe Ca N
</elementArray>
<speciesArray datasrc="#species_data">FeO_Solid</speciesArray>
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<phase dim="3" id="Fe(S)">
<elementArray datasrc="elements.xml">
O H C Fe Ca N
</elementArray>
<speciesArray datasrc="#species_data">Fe_Solid</speciesArray>
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<!-- species definitions -->
<speciesData id="species_data">
<species name="CaO(S)">
<atomArray> O:1 Ca:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="J/mol"> -5.2919E5 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<species name="CaCO3(S)">
<atomArray>Ca:1 C:1 O:3 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="J/mol"> -9.4245E5 </h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<species name="C(d)">
<atomArray>C:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="J/mol">0.0</h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<species name="Fe3O4(S)">
<atomArray>O:4 Fe:3 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="J/mol"> -7.6266E5</h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<species name="FeO_Solid">
<atomArray>Fe:1 O:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="J/mol">-1.9393E5</h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
<species name="Fe_Solid">
<atomArray> Fe:1 </atomArray>
<thermo>
<const_cp Tmax="5000.0" Tmin="100.0">
<t0 units="K">298.14999999999998</t0>
<h0 units="J/mol">0.0</h0>
<s0 units="J/mol/K">0.0</s0>
<cp0 units="J/mol/K">0.0</cp0>
</const_cp>
</thermo>
</species>
</speciesData>
</ctml>

View file

@ -0,0 +1,180 @@
#include "cantera/electrolyteThermo.h"
#include "cantera/kinetics.h"
#include "cantera/thermo/MargulesVPSSTP.h"
#include "cantera/thermo/IonsFromNeutralVPSSTP.h"
#include "cantera/IdealGasMix.h"
#include "cantera/base/PrintCtrl.h"
#include <memory>
using namespace Cantera;
using namespace std;
Cantera::PrintCtrl pc;
void printValue(const std::string& label, double value)
{
std::cout << label;
pc.pr_de(value, 4, 13);
std::cout << std::endl;
}
void printRates(InterfaceKinetics& iKin)
{
vector_fp work(iKin.nReactions(), 0.0);
iKin.getNetRatesOfProgress(&work[0]);
printValue("ROP_net = ", work[0]);
iKin.getFwdRatesOfProgress(&work[0]);
printValue("ROP_forward = ", work[0]);
iKin.getRevRatesOfProgress(&work[0]);
printValue("ROP_reverse = ", work[0]);
iKin.getFwdRateConstants(&work[0]);
printValue(" kfwd = ", work[0]);
iKin.getRevRateConstants(&work[0]);
printValue(" krev = ", work[0]);
}
void testProblem()
{
XML_Node xc;
ctml::get_CTML_Tree(&xc, "ReactionSurf.xml");
XML_Node* xg = xc.findNameID("phase", "reaction_surface");
if (!xg) {
throw CanteraError("couldn't find file", "");
}
std::auto_ptr<ThermoPhase> surfTP(newPhase(*xg));
std::auto_ptr<ThermoPhase> gasTP(newPhase("gas.xml", ""));
std::auto_ptr<ThermoPhase> cao_s(newPhase("solidPhases.xml", "CaO(S)"));
std::auto_ptr<ThermoPhase> caco3_s(newPhase("solidPhases.xml", "CaCO3(S)"));
std::auto_ptr<ThermoPhase> c_s(newPhase("solidPhases.xml", "C(S)"));
std::auto_ptr<ThermoPhase> fe3o4_s(newPhase("solidPhases.xml", "Fe3O4(S)"));
std::auto_ptr<ThermoPhase> feo_s(newPhase("solidPhases.xml", "FeO(S)"));
std::auto_ptr<ThermoPhase> fe_s(newPhase("solidPhases.xml", "Fe(S)"));
vector<ThermoPhase*> phaseList;
phaseList.push_back(gasTP.get());
phaseList.push_back(cao_s.get());
phaseList.push_back(caco3_s.get());
phaseList.push_back(c_s.get());
phaseList.push_back(fe3o4_s.get());
phaseList.push_back(feo_s.get());
phaseList.push_back(fe_s.get());
phaseList.push_back(surfTP.get());
InterfaceKinetics iKin;
importKinetics(*xg, phaseList, &iKin);
vector_fp mll(gasTP->nSpecies(), 0.0);
int igco2 = gasTP->speciesIndex("CO2");
int igo2 = gasTP->speciesIndex("O2");
int ign2 = gasTP->speciesIndex("N2");
mll[igco2] = 0.2;
mll[igo2] = 0.1;
mll[ign2] = 0.7;
// Set the bath gas of 1000 K and 1 atm
double Temp = 1000.;
gasTP->setState_TPX(Temp, OneAtm, &mll[0]);
cao_s->setState_TP(Temp, OneAtm);
caco3_s->setState_TP(Temp, OneAtm);
c_s->setState_TP(Temp, OneAtm);
fe3o4_s->setState_TP(Temp, OneAtm);
surfTP->setState_TP(Temp, OneAtm);
vector_fp work(gasTP->nSpecies(), 0.0);
cout << "*** StoichSolidKinetics Test ***" << endl;
cout << "Tests for the proper behavior of heterogeneous reactions\n"
<< "when phases may or may not exist:\n"
<< " CaCO3(s) = CO2(g) + CaO(s) \n" << endl;
for (int ktrials = 0; ktrials < 2; ktrials++) {
iKin.getDeltaSSGibbs(&work[0]);
printValue(" deltaGSS = ", work[0]);
iKin.getDeltaGibbs(&work[0]);
printValue(" deltaG = ", work[0]);
gasTP->getChemPotentials(&work[0]);
double mu_CO2 = work[igco2];
printValue(" mu_CO2(g) = ", mu_CO2);
cao_s->getGibbs_RT(&work[0]);
double mu_cao = work[0] * GasConstant * Temp;
printValue(" mu_cao(s) = ", mu_cao);
caco3_s->getChemPotentials(&work[0]);
double mu_caco3 = work[0];
printValue(" mu_caco3 = ", mu_caco3);
double deltaG_calc = mu_CO2 + mu_cao - mu_caco3;
printValue(" deltaG_calc = ", deltaG_calc);
gasTP->getActivities(&work[0]);
double act_CO2 = work[igco2];
printValue(" act_CO2 = ", act_CO2);
cao_s->getActivities(&work[0]);
printValue(" act_cao(s) = ", work[0]);
caco3_s->getActivities(&work[0]);
printValue(" act_caco3(s) = ", work[0]);
cout << "*** Base problem assuming that all phases exist:" << endl;
printRates(iKin);
cout << "*** Setting CaO(S) phase to nonexistent:" << endl;
int ip_cao = iKin.phaseIndex("CaO(S)");
iKin.setPhaseExistence(ip_cao, false);
iKin.setPhaseStability(ip_cao, true);
printRates(iKin);
cout << "*** Setting CaCO3(S) phase to nonexistent:" << endl;
int ip_caco3 = iKin.phaseIndex("CaCO3(S)");
iKin.setPhaseExistence(ip_caco3, false);
iKin.setPhaseStability(ip_caco3, true);
printRates(iKin);
cout << "*** OK Setting CaO(S) phase to existent, CaCO3 nonexistent:" << endl;
iKin.setPhaseExistence(ip_cao, true);
printRates(iKin);
cout << "*** Setting Gas phase to nonexistent, CaCO3 nonexistent:" << endl;
int ip_gas = iKin.phaseIndex("air");
iKin.setPhaseExistence(ip_gas, false);
iKin.setPhaseStability(ip_gas, true);
printRates(iKin);
cout << "*** Setting to all phases existing:" << endl;
iKin.setPhaseExistence(ip_gas, true);
iKin.setPhaseExistence(ip_cao, true);
iKin.setPhaseExistence(ip_caco3, true);
printRates(iKin);
if (ktrials == 0) {
cout << "*** Setting so that forward rate if faster:" << endl;
mll[igco2] = 0.002;
mll[igo2] = 0.1;
mll[ign2] = 0.898;
gasTP->setState_TPX(Temp, OneAtm, &mll[0]);
}
}
}
int main(int argc, char** argv)
{
try {
testProblem();
return 0;
} catch (CanteraError& err) {
std::cout << err.what() << std::endl;
return 0;
}
}