Cantera 2.6.0

RxnRates.h
Go to the documentation of this file.
1/**
2 * @file RxnRates.h
3 * @deprecated To be removed after Cantera 2.6. See class Cantera::ReactionRate and
4 * derived classes for new reaction rate handlers.
5 */
6
7// This file is part of Cantera. See License.txt in the top-level directory or
8// at https://cantera.org/license.txt for license and copyright information.
9
10#ifndef CT_RXNRATES_H
11#define CT_RXNRATES_H
12
13#include "cantera/kinetics/reaction_defs.h"
14#include "cantera/kinetics/Arrhenius.h"
15#include "cantera/kinetics/PlogRate.h"
16#include "MultiRate.h"
17#include "cantera/base/Array.h"
18#include "cantera/base/ctexceptions.h"
19#include "cantera/base/global.h"
20
21 namespace Cantera
22{
23
24 class Array2D;
25 class AnyValue;
26 class AnyMap;
27 class UnitSystem;
28 class Units;
29 class Func1;
30
31//! Arrhenius reaction rate type depends only on temperature
32/**
33 * A reaction rate coefficient of the following form.
34 *
35 * \f[
36 * k_f = A T^b \exp (-E/RT)
37 * \f]
38 *
39 * @deprecated To be removed after Cantera 2.6. See ArrheniusRate.
40 */
41 class Arrhenius2 final : public ArrheniusRate
42{
43 public:
44 //! Default constructor.
45 Arrhenius2();
46
47 /// Constructor.
48 /// @param A pre-exponential. The unit system is
49 /// (kmol, m, s). The actual units depend on the reaction
50 /// order and the dimensionality (surface or bulk).
51 /// @param b Temperature exponent. Non-dimensional.
52 /// @param E Activation energy in temperature units. Kelvin.
53 ///
54 /// @todo Add deprecation warning pointing out change of activation
55 /// energy units.
56 Arrhenius2(doublereal A, doublereal b, doublereal E);
57
58 //! Constructor based on AnyMap content
59 Arrhenius2(const AnyValue& rate,
60 const UnitSystem& units, const Units& rate_units);
61
62 //! Converting constructor (to facilitate back-ward compatibility)
63 Arrhenius2(const ArrheniusRate& other);
64
65 void setRateParameters(const AnyValue& rate,
66 const UnitSystem& units, const Units& rate_units);
67 using ArrheniusRate::setRateParameters;
68
69 //! Return parameters - two-parameter version
70 void getParameters(AnyMap& node, const Units& rate_units) const;
71 using ArrheniusRate::getParameters;
72
73 //! Update concentration-dependent parts of the rate coefficient.
74 /*!
75 * For this class, there are no concentration-dependent parts, so this
76 * method does nothing.
77 */
78 void update_C(const doublereal* c) {
79 }
80
81 /**
82 * Update the value of the natural logarithm of the rate constant.
83 */
84 doublereal updateLog(doublereal logT, doublereal recipT) const {
85 return m_logA + m_b*logT - m_Ea_R*recipT;
86 }
87
88 /**
89 * Update the value the rate constant.
90 *
91 * This function returns the actual value of the rate constant. It can be
92 * safely called for negative values of the pre-exponential factor.
93 */
94 doublereal updateRC(doublereal logT, doublereal recipT) const {
95 return m_A * std::exp(m_b*logT - m_Ea_R*recipT);
96 }
97
98 virtual const std::string type() const override {
99 return "Arrhenius2";
100 }
101
102 //! Return the activation energy divided by the gas constant (that is, the
103 //! activation temperature) [K]
104 double activationEnergy_R() const {
105 return m_Ea_R;
106 }
107};
108
109
110/**
111 * An Arrhenius rate with coverage-dependent terms.
112 *
113 * The rate expression is given by [Kee, R. J., Coltrin, M. E., & Glarborg, P.
114 * (2005). Chemically reacting flow: theory and practice. John Wiley & Sons.
115 * Eq 11.113]:
116 * \f[
117 * k_f = A T^b \exp \left(
118 * \ln 10 \sum a_k \theta_k
119 * - \frac{1}{RT} \left( E_a + \sum E_k\theta_k \right)
120 * + \sum m_k \ln \theta_k
121 * \right)
122 * \f]
123 * or, equivalently, and as implemented in Cantera,
124 * \f[
125 * k_f = A T^b \exp \left( - \frac{E_a}{RT} \right)
126 * \prod_k 10^{a_k \theta_k} \theta_k^{m_k}
127 * \exp \left( \frac{- E_k \theta_k}{RT} \right)
128 * \f]
129 * where the parameters \f$ (a_k, E_k, m_k) \f$ describe the dependency on the
130 * surface coverage of species \f$k, \theta_k \f$.
131 *
132 * @deprecated To be removed after Cantera 2.6. See InterfaceRate and StickingRate.
133 */
134 class SurfaceArrhenius
135{
136
137 public:
138 SurfaceArrhenius();
139 explicit SurfaceArrhenius(double A, double b, double Ta);
140
141 //! Add a coverage dependency for species *k*, with exponential dependence
142 //! *a*, power-law exponent *m*, and activation energy dependence *e*,
143 //! where *e* is in Kelvin, that is, energy divided by the molar gas constant.
144 void addCoverageDependence(size_t k, doublereal a,
145 doublereal m, doublereal e);
146
147 void update_C(const doublereal* theta) {
148 m_acov = 0.0;
149 m_ecov = 0.0;
150 m_mcov = 0.0;
151 size_t k;
152 doublereal th;
153 for (size_t n = 0; n < m_ac.size(); n++) {
154 k = m_sp[n];
155 m_acov += m_ac[n] * theta[k];
156 m_ecov += m_ec[n] * theta[k];
157 }
158 for (size_t n = 0; n < m_mc.size(); n++) {
159 k = m_msp[n];
160 th = std::max(theta[k], Tiny);
161 m_mcov += m_mc[n]*std::log(th);
162 }
163 }
164
165 /**
166 * Update the value of the rate constant.
167 *
168 * This function returns the actual value of the rate constant. It can be
169 * safely called for negative values of the pre-exponential factor.
170 */
171 doublereal updateRC(doublereal logT, doublereal recipT) const {
172 return m_A * std::exp(std::log(10.0)*m_acov + m_b*logT -
173 (m_E + m_ecov)*recipT + m_mcov);
174 }
175
176 //! Return the pre-exponential factor *A* (in m, kmol, s to powers depending
177 //! on the reaction order) accounting coverage dependence.
178 /*!
179 * Returns reaction pre-exponent accounting for both *a* and *m*.
180 */
181 doublereal preExponentialFactor() const {
182 return m_A * std::exp(std::log(10.0)*m_acov + m_mcov);
183 }
184
185 //! Return effective temperature exponent
186 doublereal temperatureExponent() const {
187 return m_b;
188 }
189
190 //! Return the activation energy divided by the gas constant (that is, the
191 //! activation temperature) [K], accounting coverage dependence.
192 doublereal activationEnergy_R() const {
193 return m_E + m_ecov;
194 }
195
196 protected:
197 doublereal m_b, m_E, m_A;
198 doublereal m_acov, m_ecov, m_mcov;
199 std::vector<size_t> m_sp, m_msp;
200 vector_fp m_ac, m_ec, m_mc;
201};
202
203
204#ifdef CT_NO_LEGACY_REACTIONS_26
205 typedef ArrheniusRate Arrhenius;
206#else
207 typedef Arrhenius2 Arrhenius;
208#endif
209
210 typedef PlogRate Plog;
211
212}
213
214#endif
Array.h
Header file for class Cantera::Array2D.
Arrhenius.h
Header for reaction rates that involve Arrhenius-type kinetics.
MultiRate.h
PlogRate.h
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::AnyValue
A wrapper for a variable whose type is determined at runtime.
Definition: AnyMap.h:84
Cantera::Arrhenius2
Arrhenius reaction rate type depends only on temperature.
Definition: RxnRates.h:42
Cantera::Arrhenius2::activationEnergy_R
double activationEnergy_R() const
Return the activation energy divided by the gas constant (that is, the activation temperature) [K].
Definition: RxnRates.h:104
Cantera::Arrhenius2::update_C
void update_C(const doublereal *c)
Update concentration-dependent parts of the rate coefficient.
Definition: RxnRates.h:78
Cantera::Arrhenius2::updateRC
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value the rate constant.
Definition: RxnRates.h:94
Cantera::Arrhenius2::updateLog
doublereal updateLog(doublereal logT, doublereal recipT) const
Update the value of the natural logarithm of the rate constant.
Definition: RxnRates.h:84
Cantera::Arrhenius2::getParameters
void getParameters(AnyMap &node, const Units &rate_units) const
Return parameters - two-parameter version.
Definition: RxnRates.cpp:50
Cantera::Arrhenius2::type
virtual const std::string type() const override
String identifying reaction rate specialization.
Definition: RxnRates.h:98
Cantera::Arrhenius2::Arrhenius2
Arrhenius2()
Default constructor.
Definition: RxnRates.cpp:11
Cantera::ArrheniusBase::getParameters
virtual void getParameters(AnyMap &node) const override
Get parameters.
Definition: Arrhenius.cpp:124
Cantera::ArrheniusBase::m_A
double m_A
Pre-exponential factor.
Definition: Arrhenius.h:164
Cantera::ArrheniusBase::setRateParameters
void setRateParameters(const AnyValue &rate, const UnitSystem &units, const UnitStack &rate_units)
Perform object setup based on AnyValue node information.
Definition: Arrhenius.cpp:38
Cantera::ArrheniusBase::m_b
double m_b
Temperature exponent.
Definition: Arrhenius.h:165
Cantera::ArrheniusBase::m_logA
double m_logA
Logarithm of pre-exponential factor.
Definition: Arrhenius.h:168
Cantera::ArrheniusBase::m_Ea_R
double m_Ea_R
Activation energy (in temperature units)
Definition: Arrhenius.h:166
Cantera::ArrheniusRate
Arrhenius reaction rate type depends only on temperature.
Definition: Arrhenius.h:192
Cantera::SurfaceArrhenius
An Arrhenius rate with coverage-dependent terms.
Definition: RxnRates.h:135
Cantera::SurfaceArrhenius::updateRC
doublereal updateRC(doublereal logT, doublereal recipT) const
Update the value of the rate constant.
Definition: RxnRates.h:171
Cantera::SurfaceArrhenius::temperatureExponent
doublereal temperatureExponent() const
Return effective temperature exponent.
Definition: RxnRates.h:186
Cantera::SurfaceArrhenius::activationEnergy_R
doublereal activationEnergy_R() const
Return the activation energy divided by the gas constant (that is, the activation temperature) [K],...
Definition: RxnRates.h:192
Cantera::SurfaceArrhenius::preExponentialFactor
doublereal preExponentialFactor() const
Return the pre-exponential factor A (in m, kmol, s to powers depending on the reaction order) account...
Definition: RxnRates.h:181
Cantera::SurfaceArrhenius::addCoverageDependence
void addCoverageDependence(size_t k, doublereal a, doublereal m, doublereal e)
Add a coverage dependency for species k, with exponential dependence a, power-law exponent m,...
Definition: RxnRates.cpp:86
Cantera::UnitSystem
Unit conversion utility.
Definition: Units.h:161
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
ctexceptions.h
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
global.h
This file contains definitions for utility functions and text for modules, inputfiles,...
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::Tiny
const double Tiny
Small number to compare differences of mole fractions against.
Definition: ct_defs.h:170
Cantera::vector_fp
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:184
reaction_defs.h
This file defines some constants used to specify reaction types.