Fixed an error with the instanteation of electrode reactions using

the exchange current density formulation.
Electrode object test problems now all work.
This commit is contained in:
Harry Moffat 2012-04-05 22:50:51 +00:00
parent e11281477e
commit 9c06d1e07c
5 changed files with 38 additions and 4 deletions

View file

@ -654,7 +654,13 @@ protected:
*/ */
std::vector<size_t> m_revindex; std::vector<size_t> m_revindex;
Rate1<SurfaceArrhenius> m_rates; //! Templated class containing the vector of reactions for this interface
/*!
* The templated class is described in RateCoeffMgr.h
* The class SurfaceArrhenius is described in RxnRates.h
*/
Rate1<SurfaceArrhenius> m_rates;
bool m_redo_rates; bool m_redo_rates;
/** /**

View file

@ -44,7 +44,7 @@ public:
*/ */
if (rdata.rateCoeffType != R::type()) if (rdata.rateCoeffType != R::type())
throw CanteraError("Rate1::install", throw CanteraError("Rate1::install",
"incorrect rate coefficient type: "+int2str(rdata.rateCoeffType)); "incorrect rate coefficient type: "+int2str(rdata.rateCoeffType) + ". Was Expecting type: "+ int2str(R::type()));
// Install a rate calculator and return the index of the calculator. // Install a rate calculator and return the index of the calculator.
m_rxn.push_back(rxnNumber); m_rxn.push_back(rxnNumber);

View file

@ -16,6 +16,7 @@ namespace Cantera
class ReactionData class ReactionData
{ {
public: public:
//! Default constructor
ReactionData() { ReactionData() {
reactionType = ELEMENTARY_RXN; reactionType = ELEMENTARY_RXN;
number = 0; number = 0;
@ -30,6 +31,8 @@ public:
isReversibleWithFrac = false; isReversibleWithFrac = false;
beta = 0.0; beta = 0.0;
} }
//! Destructor
virtual ~ReactionData() {} virtual ~ReactionData() {}
//! type of the reaction //! type of the reaction
@ -53,15 +56,19 @@ public:
//! True if the current reaction is reversible. False otherwise //! True if the current reaction is reversible. False otherwise
bool reversible; bool reversible;
//! type of the rate coefficient for the forward rate constant //! Type of the rate coefficient for the forward rate constant
/*! /*!
* The valid types are listed in the file, reaction_defs.h and they * The valid types are listed in the file, reaction_defs.h and they
* all end in RATECOEFF_TYPE * all end in RATECOEFF_TYPE
*/ */
int rateCoeffType; int rateCoeffType;
//! Vector of rate coefficient parameters
vector_fp rateCoeffParameters; vector_fp rateCoeffParameters;
//! Vector of auxillary rate coefficient parameters
vector_fp auxRateCoeffParameters; vector_fp auxRateCoeffParameters;
int falloffType; int falloffType;
vector_fp falloffParameters; vector_fp falloffParameters;
int error; int error;

View file

@ -203,7 +203,7 @@ class SurfaceArrhenius
public: public:
static int type() { static int type() {
return ARRHENIUS_REACTION_RATECOEFF_TYPE; return SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
} }
SurfaceArrhenius() : SurfaceArrhenius() :

View file

@ -1114,7 +1114,28 @@ void InterfaceKinetics::addElementaryReaction(ReactionData& r)
for (size_t m = 0; m < ncov; m++) { for (size_t m = 0; m < ncov; m++) {
rp.push_back(r.cov[m]); rp.push_back(r.cov[m]);
} }
/*
* Temporarily change the reaction rate coefficient type to surface arrhenius.
* This is what is expected. We'll handle exchange current types below by hand.
*/
int reactionRateCoeffType_orig = r.rateCoeffType;
if (r.rateCoeffType == EXCHANGE_CURRENT_REACTION_RATECOEFF_TYPE) {
r.rateCoeffType = SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
}
if (r.rateCoeffType == ARRHENIUS_REACTION_RATECOEFF_TYPE) {
r.rateCoeffType = SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
}
/*
* Install the reaction rate into the vector of reactions handled by this class
*/
size_t iloc = m_rates.install(reactionNumber(), r); size_t iloc = m_rates.install(reactionNumber(), r);
/*
* Change the reaction rate coefficient type back to its original value
*/
r.rateCoeffType = reactionRateCoeffType_orig;
// store activation energy // store activation energy
m_E.push_back(r.rateCoeffParameters[2]); m_E.push_back(r.rateCoeffParameters[2]);