Skip to content

Commit

Permalink
[Kinetics] switch ArrheniusRate to customary activation energy units
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Mar 22, 2021
1 parent 7142322 commit 8f1f036
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
15 changes: 15 additions & 0 deletions include/cantera/kinetics/ReactionRate.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,20 @@ class ReactionRate : public ReactionRateBase
class ArrheniusRate final : public ReactionRate<ArrheniusData>, public Arrhenius
{
public:
//! Default constructor.
ArrheniusRate();

/// Constructor.
/// @param A pre-exponential. The unit system is
/// (kmol, m, s). The actual units depend on the reaction
/// order and the dimensionality (surface or bulk).
/// @param b Temperature exponent. Non-dimensional.
/// @param E Activation energy. J/kmol.
ArrheniusRate(double A, double b, double E);

//! AnyMap constructor.
/// @param node AnyMap containing rate information
/// @param rate_units unit definitions used for rate information
ArrheniusRate(const AnyMap& node, const Units& rate_units);

virtual bool setParameters(const AnyMap& node,
Expand All @@ -163,6 +173,11 @@ class ArrheniusRate final : public ReactionRate<ArrheniusData>, public Arrhenius
return updateRC(shared_data.m_logT, shared_data.m_recipT) *
(m_b + m_E * shared_data.m_recipT) * shared_data.m_recipT;
}

//! Return the activation energy [J/kmol]
double activationEnergy() const {
return m_E * GasConstant;
}
};


Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/_cantera.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ cdef extern from "cantera/kinetics/Reaction.h" namespace "Cantera":
CxxArrheniusRate(double, double, double)
double preExponentialFactor()
double temperatureExponent()
double activationEnergy_R()
double activationEnergy()

cdef cppclass CxxReaction "Cantera::Reaction":
CxxReaction()
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/reaction.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ cdef class ArrheniusRate(_ReactionRate):
def __cinit__(self, A=0, b=0, E=0, init=True):

if init:
self._base.reset(new CxxArrheniusRate(A, b, E / gas_constant))
self._base.reset(new CxxArrheniusRate(A, b, E))
self.base = self._base.get()
self.rate = <CxxArrheniusRate*>(self.base)

Expand Down Expand Up @@ -509,7 +509,7 @@ cdef class ArrheniusRate(_ReactionRate):
The activation energy *E* [J/kmol].
"""
def __get__(self):
return self.rate.activationEnergy_R() * gas_constant
return self.rate.activationEnergy()


cdef class ElementaryReaction(Reaction):
Expand Down
2 changes: 1 addition & 1 deletion src/kinetics/ReactionRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ArrheniusRate::ArrheniusRate()
}

ArrheniusRate::ArrheniusRate(double A, double b, double E)
: Arrhenius(A, b, E) {
: Arrhenius(A, b, E / GasConstant) {
}

ArrheniusRate::ArrheniusRate(const AnyMap& node, const Units& rate_units) {
Expand Down

0 comments on commit 8f1f036

Please sign in to comment.