Skip to content

Commit

Permalink
[Kinetics] Always use temperature of "reacting" phase
Browse files Browse the repository at this point in the history
This is always the lowest-dimensional phase, e.g. surface or edge for
heterogeneous systems.
  • Loading branch information
speth committed Mar 5, 2019
1 parent 5601ee9 commit 6c82b61
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/kinetics/ImplicitSurfChem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void ImplicitSurfChem::solvePseudoSteadyStateProblem(int ifuncOverride,
// 2) Temperature and pressure
getConcSpecies(m_concSpecies.data());
InterfaceKinetics* ik = m_vecKinPtrs[0];
ThermoPhase& tp = ik->thermo(0);
ThermoPhase& tp = ik->thermo(ik->reactionPhaseIndex());
doublereal TKelvin = tp.temperature();
doublereal PGas = tp.pressure();

Expand Down
17 changes: 10 additions & 7 deletions src/kinetics/InterfaceKinetics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void InterfaceKinetics::updateKc()
* and m_mu0_Kc[]
*/
updateMu0();
doublereal rrt = 1.0 / thermo(0).RT();
doublereal rrt = 1.0 / thermo(reactionPhaseIndex()).RT();

// compute Delta mu^0 for all reversible reactions
getRevReactionDelta(m_mu0_Kc.data(), m_rkcn.data());
Expand Down Expand Up @@ -159,7 +159,8 @@ void InterfaceKinetics::updateMu0()
thermo(n).getStandardChemPotentials(m_mu0.data() + m_start[n]);
for (size_t k = 0; k < thermo(n).nSpecies(); k++) {
m_mu0_Kc[ik] = m_mu0[ik] + Faraday * m_phi[n] * thermo(n).charge(k);
m_mu0_Kc[ik] -= thermo(0).RT() * thermo(n).logStandardConc(k);
m_mu0_Kc[ik] -= thermo(reactionPhaseIndex()).RT()
* thermo(n).logStandardConc(k);
ik++;
}
}
Expand All @@ -168,7 +169,7 @@ void InterfaceKinetics::updateMu0()
void InterfaceKinetics::getEquilibriumConstants(doublereal* kc)
{
updateMu0();
doublereal rrt = 1.0 / thermo(0).RT();
doublereal rrt = 1.0 / thermo(reactionPhaseIndex()).RT();
std::fill(kc, kc + nReactions(), 0.0);
getReactionDelta(m_mu0_Kc.data(), kc);
for (size_t i = 0; i < nReactions(); i++) {
Expand Down Expand Up @@ -239,7 +240,7 @@ void InterfaceKinetics::applyVoltageKfwdCorrection(doublereal* const kf)
if (m_ctrxn_BVform[i] == 0) {
double eamod = m_beta[i] * deltaElectricEnergy_[irxn];
if (eamod != 0.0) {
kf[irxn] *= exp(-eamod/thermo(0).RT());
kf[irxn] *= exp(-eamod/thermo(reactionPhaseIndex()).RT());
}
}
}
Expand All @@ -265,7 +266,8 @@ void InterfaceKinetics::convertExchangeCurrentDensityFormulation(doublereal* con
// come out of this calculation.
if (m_ctrxn_BVform[i] == 0) {
// Calculate the term and modify the forward reaction
double tmp = exp(- m_beta[i] * m_deltaG0[irxn] / thermo(0).RT());
double tmp = exp(- m_beta[i] * m_deltaG0[irxn]
/ thermo(reactionPhaseIndex()).RT());
tmp *= 1.0 / m_ProdStanConcReac[irxn] / Faraday;
kfwd[irxn] *= tmp;
}
Expand All @@ -280,7 +282,8 @@ void InterfaceKinetics::convertExchangeCurrentDensityFormulation(doublereal* con
// Calculate the term and modify the forward reaction rate
// constant so that it's in the exchange current density
// formulation format
double tmp = exp(m_beta[i] * m_deltaG0[irxn] * thermo(0).RT());
double tmp = exp(m_beta[i] * m_deltaG0[irxn]
* thermo(reactionPhaseIndex()).RT());
tmp *= Faraday * m_ProdStanConcReac[irxn];
kfwd[irxn] *= tmp;
}
Expand Down Expand Up @@ -468,7 +471,7 @@ void InterfaceKinetics::getDeltaSSEnthalpy(doublereal* deltaH)
thermo(n).getEnthalpy_RT(m_grt.data() + m_start[n]);
}
for (size_t k = 0; k < m_kk; k++) {
m_grt[k] *= thermo(0).RT();
m_grt[k] *= thermo(reactionPhaseIndex()).RT();
}

// Use the stoichiometric manager to find deltaH for each reaction.
Expand Down
4 changes: 2 additions & 2 deletions test_problems/surfSolverTest/haca2.cti
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ units(length = 'cm', quantity = 'mol', act_energy = 'kcal/mol')
ideal_gas(name = 'gas',
elements = 'O H C N Ar',
species = 'gri30: H N2 CH3 CH4 C2H2 H2 OH H2O CO O2',
initial_state = state(temperature = 1400.0,
initial_state = state(temperature = 1100.0,
pressure = OneAtm,
mole_fractions = 'H:0.01, N2:0.8899, H2:0.04, CH4:0.01 C2H2:0.01 \
OH:0.0001 H2O:0.04 O2:0.001'))
Expand Down Expand Up @@ -53,7 +53,7 @@ ideal_interface(name = 'soot_interface',
reactions = 'all',
phases = 'gas soot',
site_density = (3.8E-9, 'mol/cm2'),
initial_state = state(temperature= 1000.0,
initial_state = state(temperature= 1400.0,
coverages = 'Csoot-*:0.1, Csoot-H:0.9'))

# HKM -> Note, thermo from the following source:
Expand Down
17 changes: 4 additions & 13 deletions test_problems/surfSolverTest/surfaceSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,10 @@ int main(int argc, char** argv)
/* Now Tweak the inputs and do a quick calculation */
/****************************************************************************/

/*
* Set the Gas State:
* -> note that the states are set in the XML files too
*/

/*
* Set the Gas State:
* -> note that the states are set in the XML files too
*/
pres = gasTP->pressure();
double temp = gasTP->temperature();
pres = surfPhaseTP->pressure();
double temp = surfPhaseTP->temperature();
temp += 95;
gasTP->setState_TP(temp, pres);
surfPhaseTP->setState_TP(temp, pres);

iKin_ptr->solvePseudoSteadyStateProblem();
iKin_ptr->getNetProductionRates(src);
Expand All @@ -399,7 +390,7 @@ int main(int argc, char** argv)
/*****************************************************************************/
/* Now Don't Tweak the inputs at all */
/****************************************************************************/
gasTP->setState_TP(temp, pres);
surfPhaseTP->setState_TP(temp, pres);

iKin_ptr->solvePseudoSteadyStateProblem();
iKin_ptr->getNetProductionRates(src);
Expand Down
15 changes: 3 additions & 12 deletions test_problems/surfSolverTest/surfaceSolver2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,19 +399,10 @@ int main(int argc, char** argv)
/* Now Tweak the inputs and do a quick calculation */
/****************************************************************************/

/*
* Set the Gas State:
* -> note that the states are set in the XML files too
*/

/*
* Set the Gas State:
* -> note that the states are set in the XML files too
*/
pres = gasTP->pressure();
double temp = gasTP->temperature();
pres = surfPhaseTP->pressure();
double temp = surfPhaseTP->temperature();
temp += 95;
gasTP->setState_TP(temp, pres);
surfPhaseTP->setState_TP(temp, pres);

surfaceProb->solvePseudoSteadyStateProblem();
iKin_ptr->getNetProductionRates(src);
Expand Down

0 comments on commit 6c82b61

Please sign in to comment.