From d366f9c92c756da5239585963e1eb0695798e0d1 Mon Sep 17 00:00:00 2001 From: imitrichev Date: Wed, 14 Oct 2015 15:15:42 +0400 Subject: [PATCH] [kinetics] Added some non-virtual methods to get effective rate parameters from SurfaceArrhenius throug InterfaceKinetics. --- include/cantera/kinetics/InterfaceKinetics.h | 12 ++++++ include/cantera/kinetics/RateCoeffMgr.h | 12 ++++++ include/cantera/kinetics/RxnRates.h | 39 ++++++++++++++++---- src/kinetics/RxnRates.cpp | 10 +++-- 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/include/cantera/kinetics/InterfaceKinetics.h b/include/cantera/kinetics/InterfaceKinetics.h index 4e6ede1bff2..f93979e46e9 100644 --- a/include/cantera/kinetics/InterfaceKinetics.h +++ b/include/cantera/kinetics/InterfaceKinetics.h @@ -161,6 +161,18 @@ class InterfaceKinetics : public Kinetics virtual void getRevRateConstants(doublereal* krev, bool doIrreversible = false); + doublereal getEffectivePreExponentialFactor(int rnum) { + return m_rates.getEffectivePreExponentialFactor(rnum); + } + + doublereal getEffectiveActivationEnergy_R(int rnum) { + return m_rates.getEffectiveActivationEnergy_R(rnum); + } + + doublereal getEffectiveTemperatureExponent(int rnum) { + return m_rates.getEffectiveTemperatureExponent(rnum); + } + //! @} //! @name Reaction Mechanism Construction //! @{ diff --git a/include/cantera/kinetics/RateCoeffMgr.h b/include/cantera/kinetics/RateCoeffMgr.h index 1a01e5dce93..ecc330d7ec8 100644 --- a/include/cantera/kinetics/RateCoeffMgr.h +++ b/include/cantera/kinetics/RateCoeffMgr.h @@ -75,6 +75,18 @@ class Rate1 return m_rates.size(); } + doublereal getEffectivePreExponentialFactor(int rnum) { + return m_rates[rnum].preExponentialFactor(); + } + + doublereal getEffectiveTemperatureExponent(int rnum) { + return m_rates[rnum].temperatureExponent(); + } + + doublereal getEffectiveActivationEnergy_R(int rnum) { + return m_rates[rnum].activationEnergy_R(); + } + protected: std::vector m_rates; std::vector m_rxn; diff --git a/include/cantera/kinetics/RxnRates.h b/include/cantera/kinetics/RxnRates.h index 53c3cb910fc..6a14154b76b 100644 --- a/include/cantera/kinetics/RxnRates.h +++ b/include/cantera/kinetics/RxnRates.h @@ -49,7 +49,7 @@ class Arrhenius * For this class, there are no * concentration-dependent parts, so this method does nothing. */ - void update_C(const doublereal* c) { + void update_C(const doublereal* theta) { } /** @@ -72,18 +72,18 @@ class Arrhenius //! Return the pre-exponential factor *A* (in m, kmol, s to powers depending //! on the reaction order) - double preExponentialFactor() const { + doublereal preExponentialFactor() const { return m_A; } //! Return the temperature exponent *b* - double temperatureExponent() const { + doublereal temperatureExponent() const { return m_b; } //! Return the activation energy divided by the gas constant (i.e. the //! activation temperature) [K] - doublereal activationEnergy_R() const { + virtual doublereal activationEnergy_R() const { return m_E; } @@ -118,9 +118,9 @@ class SurfaceArrhenius explicit SurfaceArrhenius(double A, double b, double Ta); //! Add a coverage dependency for species *k*, with pre-exponential - //! dependence *a*, temperature exponent dependence *m* and activation - //! energy dependence *e*, where *e* is in Kelvin, i.e. energy divided by - //! the molar gas constant. + //! dependence *a*, rate constant exponential dependency *m* on coverage + //! and activation energy dependence *e*, where *e* is in Kelvin, + //! i.e. energy divided by the molar gas constant. void addCoverageDependence(size_t k, doublereal a, doublereal m, doublereal e); @@ -142,6 +142,14 @@ class SurfaceArrhenius } } + /** + * Update the value of the natural logarithm of the rate constant. + */ + doublereal updateLog(doublereal logT, doublereal recipT) const { + return m_logA + std::log(10.0)*m_acov + m_b*logT - + (m_E + m_ecov)*recipT + m_mcov; + } + /** * Update the value the rate constant. * @@ -153,6 +161,23 @@ class SurfaceArrhenius (m_E + m_ecov)*recipT + m_mcov); } + //! Return the pre-exponential factor *A* (in m, kmol, s to powers depending + //! on the reaction order) accounting coverage dependence + /*! Returns reaction prexponent accounting for both *a* and *m*, + * since *m* is not temperature-dependent and shouldn't be included in + * temperature exponent + */ + doublereal preExponentialFactor() const { + return m_A * std::exp(std::log(10.0)*m_acov + m_mcov); + } + + //! Return effective temperature exponent + doublereal temperatureExponent() const { + return m_b; + } + + //! Return the activation energy divided by the gas constant (i.e. the + //! activation temperature) [K], accounting coverage dependence doublereal activationEnergy_R() const { return m_E + m_ecov; } diff --git a/src/kinetics/RxnRates.cpp b/src/kinetics/RxnRates.cpp index cd04e7783fd..686fe499239 100644 --- a/src/kinetics/RxnRates.cpp +++ b/src/kinetics/RxnRates.cpp @@ -21,7 +21,7 @@ Arrhenius::Arrhenius(doublereal A, doublereal b, doublereal E) if (m_A <= 0.0) { m_logA = -1.0E300; } else { - m_logA = log(m_A); + m_logA = std::log(m_A); } } @@ -39,8 +39,7 @@ SurfaceArrhenius::SurfaceArrhenius() } SurfaceArrhenius::SurfaceArrhenius(double A, double b, double Ta) - : m_logA(std::log(A)) - , m_b(b) + : m_b(b) , m_E(Ta) , m_A(A) , m_acov(0.0) @@ -49,6 +48,11 @@ SurfaceArrhenius::SurfaceArrhenius(double A, double b, double Ta) , m_ncov(0) , m_nmcov(0) { + if (m_A <= 0.0) { + m_logA = -1.0E300; + } else { + m_logA = std::log(m_A); + } } void SurfaceArrhenius::addCoverageDependence(size_t k, doublereal a,