Added a routine to return the elctrochemical beta for a reaction.

Fixed an error in a debug printout routine that tests when
the BV factor may overwhelm the activation energy, and I moved
the printout to DEBUG_MODE.
This commit is contained in:
Harry Moffat 2007-06-04 23:02:48 +00:00
parent 810c6ee6d2
commit 30e41a0354
2 changed files with 48 additions and 16 deletions

View file

@ -325,15 +325,18 @@ namespace Cantera {
// modify the reaction rates. Only modify those with a
// non-zero activation energy, and do not decrease the
// activation energy below zero.
doublereal ea, eamod;
doublereal eamod;
#ifdef DEBUG_MODE
double ea;
#endif
int nct = m_beta.size();
int irxn;
for (i = 0; i < nct; i++) {
irxn = m_ctrxn[i];
eamod = m_beta[i]*m_rwork[irxn];
if (eamod != 0.0 && m_E[i] != 0.0) {
ea = GasConstant * m_E[i];
if (eamod != 0.0 && m_E[irxn] != 0.0) {
#ifdef DEBUG_MODE
ea = GasConstant * m_E[irxn];
if (eamod + ea < 0.0) {
writelog("Warning: act energy mod too large!\n");
writelog(" Delta phi = "+fp2str(m_rwork[irxn]/Faraday)+"\n");
@ -344,7 +347,7 @@ namespace Cantera {
+fp2str(m_phi[n])+"\n");
}
}
//eamod = -ea;
#endif
kf[irxn] *= exp(-eamod*rrt);
}
}
@ -677,8 +680,8 @@ namespace Cantera {
for (int m = 0; m < ncov; m++) rp.push_back(r.cov[m]);
iloc = m_rates.install( reactionNumber(),
r.rateCoeffType, rp.size(),
DATA_PTR(rp) );
r.rateCoeffType, rp.size(),
DATA_PTR(rp) );
// store activation energy
m_E.push_back(r.rateCoeffParameters[2]);
@ -862,6 +865,17 @@ namespace Cantera {
}
doublereal InterfaceKinetics::electrochem_beta(int irxn) const{
int n = m_ctrxn.size();
for (int i = 0; i < n; i++) {
if (m_ctrxn[i] == irxn) {
return m_beta[i];
}
}
return 0.0;
}
bool InterfaceKinetics::ready() const {
return (m_finalized);
}

View file

@ -274,6 +274,24 @@ namespace Cantera {
return m_index[i].first;
}
//! Return the charge transfer rxn Beta parameter for the ith reaction
/*!
* Returns the beta parameter for a charge transfer reaction. This
* parameter is not important for non-charge transfer reactions.
* Note, the parameter defaults to zero. However, a value of 0.5
* should be supplied for every charge transfer reaction if
* no information is known, as a value of 0.5 pertains to a
* symmetric transition state. The value can vary between 0 to 1.
*
*
* @param irxn Reaction number in the kinetics mechanism
*
* @return
* Beta parameter. This defaults to zero, even for charge transfer
* reactions.
*/
doublereal electrochem_beta(int irxn) const;
/**
* True if reaction i has been declared to be reversible. If
* isReversible(i) is false, then the reverse rate of progress
@ -340,13 +358,13 @@ namespace Cantera {
void _update_rates_T();
void _update_rates_phi();
void _update_rates_C();
void advanceCoverages(doublereal tstep);
void checkPartialEquil();
void _update_rates_T();
void _update_rates_phi();
void _update_rates_C();
void advanceCoverages(doublereal tstep);
void checkPartialEquil();
//! Temporary work vector of length m_kk
vector_fp m_grt;
@ -500,8 +518,8 @@ namespace Cantera {
//! Pointer to the surface solver
ImplicitSurfChem* m_integrator;
vector_fp m_beta;
vector_int m_ctrxn;
vector_fp m_beta;
vector_int m_ctrxn;
int reactionNumber(){ return m_ii;}