Cantera  2.5.1
Falloff.h
1 // This file is part of Cantera. See License.txt in the top-level directory or
2 // at https://cantera.org/license.txt for license and copyright information.
3 
4 #ifndef CT_FALLOFF_H
5 #define CT_FALLOFF_H
6 
8 #include "cantera/base/global.h"
9 
10 namespace Cantera
11 {
12 
13 /**
14  * @defgroup falloffGroup Falloff Parameterizations
15  *
16  * This section describes the parameterizations used to describe
17  * the fall-off in reaction rate constants due to intermolecular
18  * energy transfer.
19  * @ingroup chemkinetics
20  */
21 
22 /**
23  * Base class for falloff function calculators. Each instance of a subclass of
24  * Falloff computes one falloff function. This base class implements the
25  * trivial falloff function F = 1.0.
26  *
27  * @ingroup falloffGroup
28  */
29 class Falloff
30 {
31 public:
32  Falloff() {}
33  virtual ~Falloff() {}
34 
35  /**
36  * Initialize. Must be called before any other method is invoked.
37  *
38  * @param c Vector of coefficients of the parameterization. The number and
39  * meaning of these coefficients is subclass-dependent.
40  */
41  virtual void init(const vector_fp& c);
42 
43  /**
44  * Update the temperature-dependent portions of the falloff function, if
45  * any, and store them in the 'work' array. If not overloaded, the default
46  * behavior is to do nothing.
47  * @param T Temperature [K].
48  * @param work storage space for intermediate results.
49  */
50  virtual void updateTemp(doublereal T, doublereal* work) const {}
51 
52  /**
53  * The falloff function. This is defined so that the rate coefficient is
54  *
55  * \f[ k = F(Pr)\frac{Pr}{1 + Pr}. \f]
56  *
57  * Here \f$ Pr \f$ is the reduced pressure, defined by
58  *
59  * \f[
60  * Pr = \frac{k_0 [M]}{k_\infty}.
61  * \f]
62  *
63  * @param pr reduced pressure (dimensionless).
64  * @param work array of size workSize() containing cached
65  * temperature-dependent intermediate results from a prior call
66  * to updateTemp.
67  * @returns the value of the falloff function \f$ F \f$ defined above
68  */
69  virtual doublereal F(doublereal pr, const doublereal* work) const {
70  return 1.0;
71  }
72 
73  //! The size of the work array required.
74  virtual size_t workSize() {
75  return 0;
76  }
77 
78  //! Return a string representing the type of the Falloff parameterization.
79  virtual std::string type() const {
80  return "Lindemann";
81  }
82 
83  //! Return an integer representing the type of the Falloff parameterization.
84  /*!
85  * @deprecated To be removed after Cantera 2.5.
86  */
87  virtual int getType() const {
88  warn_deprecated("Falloff::getType()",
89  "Replaced by Falloff::type(). To be removed after Cantera 2.5.");
90  return SIMPLE_FALLOFF;
91  }
92 
93  //! Returns the number of parameters used by this parameterization. The
94  //! values of these parameters can be obtained from getParameters().
95  virtual size_t nParameters() const {
96  return 0;
97  }
98 
99  //! Get the values of the parameters for this object. *params* must be an
100  //! array of at least nParameters() elements.
101  virtual void getParameters(double* params) const {}
102 };
103 
104 
105 //! The 3- or 4-parameter Troe falloff parameterization.
106 /*!
107  * The falloff function defines the value of \f$ F \f$ in the following
108  * rate expression
109  *
110  * \f[ k = k_{\infty} \left( \frac{P_r}{1 + P_r} \right) F \f]
111  * where
112  * \f[ P_r = \frac{k_0 [M]}{k_{\infty}} \f]
113  *
114  * This parameterization is defined by
115  *
116  * \f[ F = F_{cent}^{1/(1 + f_1^2)} \f]
117  * where
118  * \f[ F_{cent} = (1 - A)\exp(-T/T_3) + A \exp(-T/T_1) + \exp(-T_2/T) \f]
119  *
120  * \f[ f_1 = (\log_{10} P_r + C) /
121  * \left(N - 0.14 (\log_{10} P_r + C)\right) \f]
122  *
123  * \f[ C = -0.4 - 0.67 \log_{10} F_{cent} \f]
124  *
125  * \f[ N = 0.75 - 1.27 \log_{10} F_{cent} \f]
126  *
127  * - If \f$ T_3 \f$ is zero, then the corresponding term is set to zero.
128  * - If \f$ T_1 \f$ is zero, then the corresponding term is set to zero.
129  * - If \f$ T_2 \f$ is zero, then the corresponding term is set to zero.
130  *
131  * @ingroup falloffGroup
132  */
133 class Troe : public Falloff
134 {
135 public:
136  //! Constructor
137  Troe() : m_a(0.0), m_rt3(0.0), m_rt1(0.0), m_t2(0.0) {}
138 
139  //! Initialization of the object
140  /*!
141  * @param c Vector of three or four doubles: The doubles are the parameters,
142  * a, T_3, T_1, and (optionally) T_2 of the Troe parameterization
143  */
144  virtual void init(const vector_fp& c);
145 
146  //! Update the temperature parameters in the representation
147  /*!
148  * @param T Temperature (Kelvin)
149  * @param work Vector of working space, length 1, representing the
150  * temperature-dependent part of the parameterization.
151  */
152  virtual void updateTemp(doublereal T, doublereal* work) const;
153 
154  virtual doublereal F(doublereal pr, const doublereal* work) const;
155 
156  virtual size_t workSize() {
157  return 1;
158  }
159 
160  virtual std::string type() const {
161  return "Troe";
162  }
163 
164  virtual int getType() const {
165  warn_deprecated("Troe::getType()",
166  "Replaced by Troe::type(). To be removed after Cantera 2.5.");
167  return TROE_FALLOFF;
168  }
169 
170  virtual size_t nParameters() const {
171  return 4;
172  }
173 
174  //! Sets params to contain, in order, \f[ (A, T_3, T_1, T_2) \f]
175  virtual void getParameters(double* params) const;
176 
177 protected:
178  //! parameter a in the 4-parameter Troe falloff function. Dimensionless
179  doublereal m_a;
180 
181  //! parameter 1/T_3 in the 4-parameter Troe falloff function. [K^-1]
182  doublereal m_rt3;
183 
184  //! parameter 1/T_1 in the 4-parameter Troe falloff function. [K^-1]
185  doublereal m_rt1;
186 
187  //! parameter T_2 in the 4-parameter Troe falloff function. [K]
188  doublereal m_t2;
189 };
190 
191 //! The SRI falloff function
192 /*!
193  * The falloff function defines the value of \f$ F \f$ in the following
194  * rate expression
195  *
196  * \f[ k = k_{\infty} \left( \frac{P_r}{1 + P_r} \right) F \f]
197  * where
198  * \f[ P_r = \frac{k_0 [M]}{k_{\infty}} \f]
199  *
200  * \f[ F = {\left( a \; exp(\frac{-b}{T}) + exp(\frac{-T}{c})\right)}^n
201  * \; d \; T^e \f]
202  * where
203  * \f[ n = \frac{1.0}{1.0 + (\log_{10} P_r)^2} \f]
204  *
205  * \f$ c \f$ s required to greater than or equal to zero. If it is zero, then
206  * the corresponding term is set to zero.
207  *
208  * \f$ d \f$ is required to be greater than zero.
209  *
210  * @ingroup falloffGroup
211  */
212 class SRI : public Falloff
213 {
214 public:
215  //! Constructor
216  SRI() : m_a(-1.0), m_b(-1.0), m_c(-1.0), m_d(-1.0), m_e(-1.0) {}
217 
218  //! Initialization of the object
219  /*!
220  * @param c Vector of three or five doubles: The doubles are the parameters,
221  * a, b, c, d (optional; default 1.0), and e (optional; default
222  * 0.0) of the SRI parameterization
223  */
224  virtual void init(const vector_fp& c);
225 
226  //! Update the temperature parameters in the representation
227  /*!
228  * @param T Temperature (Kelvin)
229  * @param work Vector of working space, length 2, representing the
230  * temperature-dependent part of the parameterization.
231  */
232  virtual void updateTemp(doublereal T, doublereal* work) const;
233 
234  virtual doublereal F(doublereal pr, const doublereal* work) const;
235 
236  virtual size_t workSize() {
237  return 2;
238  }
239 
240  virtual std::string type() const {
241  return "SRI";
242  }
243 
244  virtual int getType() const {
245  warn_deprecated("SRI::getType()",
246  "Replaced by SRI::type(). To be removed after Cantera 2.5.");
247  return SRI_FALLOFF;
248  }
249 
250  virtual size_t nParameters() const {
251  return 5;
252  }
253 
254  //! Sets params to contain, in order, \f[ (a, b, c, d, e) \f]
255  virtual void getParameters(double* params) const;
256 
257 protected:
258  //! parameter a in the 5-parameter SRI falloff function. Dimensionless.
259  doublereal m_a;
260 
261  //! parameter b in the 5-parameter SRI falloff function. [K]
262  doublereal m_b;
263 
264  //! parameter c in the 5-parameter SRI falloff function. [K]
265  doublereal m_c;
266 
267  //! parameter d in the 5-parameter SRI falloff function. Dimensionless.
268  doublereal m_d;
269 
270  //! parameter d in the 5-parameter SRI falloff function. Dimensionless.
271  doublereal m_e;
272 };
273 
274 }
275 
276 #endif
Base class for falloff function calculators.
Definition: Falloff.h:30
virtual size_t nParameters() const
Returns the number of parameters used by this parameterization.
Definition: Falloff.h:95
virtual void updateTemp(doublereal T, doublereal *work) const
Update the temperature-dependent portions of the falloff function, if any, and store them in the 'wor...
Definition: Falloff.h:50
virtual void getParameters(double *params) const
Get the values of the parameters for this object.
Definition: Falloff.h:101
virtual doublereal F(doublereal pr, const doublereal *work) const
The falloff function.
Definition: Falloff.h:69
virtual void init(const vector_fp &c)
Initialize.
Definition: Falloff.cpp:17
virtual int getType() const
Return an integer representing the type of the Falloff parameterization.
Definition: Falloff.h:87
virtual std::string type() const
Return a string representing the type of the Falloff parameterization.
Definition: Falloff.h:79
virtual size_t workSize()
The size of the work array required.
Definition: Falloff.h:74
The SRI falloff function.
Definition: Falloff.h:213
virtual size_t nParameters() const
Returns the number of parameters used by this parameterization.
Definition: Falloff.h:250
doublereal m_c
parameter c in the 5-parameter SRI falloff function. [K]
Definition: Falloff.h:265
virtual void updateTemp(doublereal T, doublereal *work) const
Update the temperature parameters in the representation.
Definition: Falloff.cpp:115
doublereal m_b
parameter b in the 5-parameter SRI falloff function. [K]
Definition: Falloff.h:262
doublereal m_d
parameter d in the 5-parameter SRI falloff function. Dimensionless.
Definition: Falloff.h:268
virtual void getParameters(double *params) const
Sets params to contain, in order,.
Definition: Falloff.cpp:131
virtual void init(const vector_fp &c)
Initialization of the object.
Definition: Falloff.cpp:86
virtual int getType() const
Return an integer representing the type of the Falloff parameterization.
Definition: Falloff.h:244
virtual std::string type() const
Return a string representing the type of the Falloff parameterization.
Definition: Falloff.h:240
virtual doublereal F(doublereal pr, const doublereal *work) const
The falloff function.
Definition: Falloff.cpp:124
virtual size_t workSize()
The size of the work array required.
Definition: Falloff.h:236
doublereal m_e
parameter d in the 5-parameter SRI falloff function. Dimensionless.
Definition: Falloff.h:271
SRI()
Constructor.
Definition: Falloff.h:216
doublereal m_a
parameter a in the 5-parameter SRI falloff function. Dimensionless.
Definition: Falloff.h:259
The 3- or 4-parameter Troe falloff parameterization.
Definition: Falloff.h:134
virtual size_t nParameters() const
Returns the number of parameters used by this parameterization.
Definition: Falloff.h:170
virtual void updateTemp(doublereal T, doublereal *work) const
Update the temperature parameters in the representation.
Definition: Falloff.cpp:60
virtual void getParameters(double *params) const
Sets params to contain, in order,.
Definition: Falloff.cpp:79
virtual void init(const vector_fp &c)
Initialization of the object.
Definition: Falloff.cpp:26
doublereal m_t2
parameter T_2 in the 4-parameter Troe falloff function. [K]
Definition: Falloff.h:188
virtual int getType() const
Return an integer representing the type of the Falloff parameterization.
Definition: Falloff.h:164
virtual std::string type() const
Return a string representing the type of the Falloff parameterization.
Definition: Falloff.h:160
virtual doublereal F(doublereal pr, const doublereal *work) const
The falloff function.
Definition: Falloff.cpp:69
virtual size_t workSize()
The size of the work array required.
Definition: Falloff.h:156
doublereal m_rt3
parameter 1/T_3 in the 4-parameter Troe falloff function. [K^-1]
Definition: Falloff.h:182
Troe()
Constructor.
Definition: Falloff.h:137
doublereal m_rt1
parameter 1/T_1 in the 4-parameter Troe falloff function. [K^-1]
Definition: Falloff.h:185
doublereal m_a
parameter a in the 4-parameter Troe falloff function. Dimensionless
Definition: Falloff.h:179
This file contains definitions for utility functions and text for modules, inputfiles,...
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
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:180
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
This file defines some constants used to specify reaction types.