Cantera  2.4.0
Reaction.h
Go to the documentation of this file.
1 /**
2  * @file Reaction.h
3  */
4 
5 // This file is part of Cantera. See License.txt in the top-level directory or
6 // at http://www.cantera.org/license.txt for license and copyright information.
7 
8 #ifndef CT_REACTION_H
9 #define CT_REACTION_H
10 
11 #include "cantera/base/utilities.h"
13 #include "cantera/kinetics/Falloff.h"
14 
15 namespace Cantera
16 {
17 
18 class Kinetics;
19 
20 //! Intermediate class which stores data about a reaction and its rate
21 //! parameterization so that it can be added to a Kinetics object.
22 class Reaction
23 {
24 public:
25  explicit Reaction(int type);
26  Reaction(int type, const Composition& reactants,
27  const Composition& products);
28  virtual ~Reaction() {}
29 
30  //! The reactant side of the chemical equation for this reaction
31  virtual std::string reactantString() const;
32 
33  //! The product side of the chemical equation for this reaction
34  virtual std::string productString() const;
35 
36  //! The chemical equation for this reaction
37  std::string equation() const;
38 
39  //! Ensure that the rate constant and other parameters for this reaction are
40  //! valid.
41  virtual void validate();
42 
43  //! Type of the reaction. The valid types are listed in the file,
44  //! reaction_defs.h, with constants ending in `RXN`.
46 
47  //! Reactant species and stoichiometric coefficients
49 
50  //! Product species and stoichiometric coefficients
52 
53  //! Forward reaction order with respect to specific species. By default,
54  //! mass-action kinetics is assumed, with the reaction order equal to each
55  //! reactant's stoichiometric coefficient.
57 
58  //! An identification string for the reaction, used in some filtering
59  //! operations
60  std::string id;
61 
62  //! True if the current reaction is reversible. False otherwise
63  bool reversible;
64 
65  //! True if the current reaction is marked as duplicate
66  bool duplicate;
67 
68  //! True if reaction orders can be specified for non-reactant species.
69  //! Default is `false`.
71 
72  //! True if negative reaction orders are allowed. Default is `false`.
74 };
75 
76 
77 //! A reaction which follows mass-action kinetics with a modified Arrhenius
78 //! reaction rate.
80 {
81 public:
84  const Arrhenius& rate);
85  virtual void validate();
86 
87  Arrhenius rate;
88  bool allow_negative_pre_exponential_factor;
89 };
90 
91 //! A class for managing third-body efficiencies, including default values
92 class ThirdBody
93 {
94 public:
95  explicit ThirdBody(double default_efficiency=1.0);
96 
97  //! Get the third-body efficiency for species *k*
98  double efficiency(const std::string& k) const {
100  }
101 
102  //! Map of species to third body efficiency
104 
105  //! The default third body efficiency for species not listed in
106  //! #efficiencies.
108 };
109 
110 //! A reaction with a non-reacting third body "M" that acts to add or remove
111 //! energy from the reacting species
113 {
114 public:
117  const Arrhenius& rate, const ThirdBody& tbody);
118  virtual std::string reactantString() const;
119  virtual std::string productString() const;
120 
121  //! Relative efficiencies of third-body species in enhancing the reaction
122  //! rate.
124 };
125 
126 //! A reaction that is first-order in [M] at low pressure, like a third-body
127 //! reaction, but zeroth-order in [M] as pressure increases.
128 class FalloffReaction : public Reaction
129 {
130 public:
131  FalloffReaction();
133  const Arrhenius& low_rate, const Arrhenius& high_rate,
134  const ThirdBody& tbody);
135  virtual std::string reactantString() const;
136  virtual std::string productString() const;
137  virtual void validate();
138 
139  //! The rate constant in the low-pressure limit
141 
142  //! The rate constant in the high-pressure limit
144 
145  //! Relative efficiencies of third-body species in enhancing the reaction rate
147 
148  //! Falloff function which determines how low_rate and high_rate are
149  //! combined to determine the rate constant for the reaction.
150  shared_ptr<Falloff> falloff;
151 };
152 
153 //! A reaction where the rate decreases as pressure increases due to collisional
154 //! stabilization of a reaction intermediate. Like a FalloffReaction, except
155 //! that the forward rate constant is written as being proportional to the low-
156 //! pressure rate constant.
158 {
159 public:
162  const Composition& products, const Arrhenius& low_rate,
163  const Arrhenius& high_rate, const ThirdBody& tbody);
164 };
165 
166 //! A pressure-dependent reaction parameterized by logarithmically interpolating
167 //! between Arrhenius rate expressions at various pressures.
168 class PlogReaction : public Reaction
169 {
170 public:
171  PlogReaction();
173  const Plog& rate);
174  virtual void validate();
175  Plog rate;
176 };
177 
178 //! A pressure-dependent reaction parameterized by a bi-variate Chebyshev
179 //! polynomial in temperature and pressure
181 {
182 public:
185  const ChebyshevRate& rate);
186 
187  ChebyshevRate rate;
188 };
189 
190 //! Modifications to an InterfaceReaction rate based on a surface species
191 //! coverage.
193 {
194  //! Constructor
195  //! @param a_ modification to the pre-exponential factor [m, kmol, s units]
196  //! @param E_ modification to the activation energy [K]
197  //! @param m_ modification to the temperature exponent
198  CoverageDependency(double a_, double E_, double m_) : a(a_), E(E_), m(m_) {}
199  CoverageDependency() {}
200  double a; //!< modification to the pre-exponential factor [m, kmol, s units]
201  double E; //!< modification to the activation energy [K]
202  double m; //!< modification to the temperature exponent
203 };
204 
205 //! A reaction occurring on an interface (i.e. a SurfPhase or an EdgePhase)
207 {
208 public:
211  const Arrhenius& rate, bool isStick=false);
212 
213  //! Adjustments to the Arrhenius rate expression dependent on surface
214  //! species coverages. Three coverage parameters (a, E, m) are used for each
215  //! species on which the rate depends. See SurfaceArrhenius for details on
216  //! the parameterization.
217  std::map<std::string, CoverageDependency> coverage_deps;
218 
219  //! Set to true if `rate` is a parameterization of the sticking coefficient
220  //! rather than the forward rate constant
222 
223  //! Set to true if `rate` is a sticking coefficient which should be
224  //! translated into a rate coefficient using the correction factor developed
225  //! by Motz & Wise for reactions with high (near-unity) sticking
226  //! coefficients. Defaults to 'false'.
228 
229  //! For reactions with multiple non-surface species, the sticking species
230  //! needs to be explicitly identified.
231  std::string sticking_species;
232 };
233 
234 //! An interface reaction which involves charged species
236 {
237 public:
240  const Composition& products, const Arrhenius& rate);
241 
242  //! Film Resistivity value
243  /*!
244  * For Butler Volmer reactions, a common addition to the formulation is to
245  * add an electrical resistance to the formulation. The resistance modifies
246  * the electrical current flow in both directions. Only valid for Butler-
247  * Volmer formulations. Units are in ohms m2. Default = 0.0 ohms m2.
248  */
249  doublereal film_resistivity;
250 
251  //! Forward value of the apparent Electrochemical transfer coefficient
252  doublereal beta;
253 
254  bool exchange_current_density_formulation;
255 };
256 
257 //! Create a new Reaction object for the reaction defined in `rxn_node`
258 shared_ptr<Reaction> newReaction(const XML_Node& rxn_node);
259 
260 //! Create Reaction objects for all `<reaction>` nodes in an XML document.
261 //!
262 //! The `<reaction>` nodes are assumed to be children of the `<reactionData>`
263 //! node in an XML document with a `<ctml>` root node, as in the case of XML
264 //! files produced by conversion from CTI files.
265 //!
266 //! This function can be used in combination with get_XML_File() and
267 //! get_XML_from_string() to get Reaction objects from either a file or a
268 //! string, respectively, where the string or file is formatted as either CTI
269 //! or XML.
270 //!
271 //! If Reaction objects are being created from a CTI definition that does not
272 //! contain corresponding phase definitions, then one of the following must be
273 //! true, or the resulting rate constants will be incorrect:
274 //!
275 //! - The rate constants are expressed in (kmol, meter, second) units
276 //! - A `units` directive is included **and** all reactions take place in
277 //! bulk (e.g. gas) phases
278 std::vector<shared_ptr<Reaction> > getReactions(const XML_Node& node);
279 
280 }
281 
282 #endif
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:170
std::string sticking_species
For reactions with multiple non-surface species, the sticking species needs to be explicitly identifi...
Definition: Reaction.h:231
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:148
bool allow_nonreactant_orders
True if reaction orders can be specified for non-reactant species.
Definition: Reaction.h:70
bool is_sticking_coefficient
Set to true if rate is a parameterization of the sticking coefficient rather than the forward rate co...
Definition: Reaction.h:221
int reaction_type
Type of the reaction.
Definition: Reaction.h:45
A reaction which follows mass-action kinetics with a modified Arrhenius reaction rate.
Definition: Reaction.h:79
A pressure-dependent reaction parameterized by a bi-variate Chebyshev polynomial in temperature and p...
Definition: Reaction.h:180
Pressure-dependent rate expression where the rate coefficient is expressed as a bivariate Chebyshev p...
Definition: RxnRates.h:340
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:190
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:113
Composition orders
Forward reaction order with respect to specific species.
Definition: Reaction.h:56
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
A class for managing third-body efficiencies, including default values.
Definition: Reaction.h:92
double m
modification to the temperature exponent
Definition: Reaction.h:202
A pressure-dependent reaction parameterized by logarithmically interpolating between Arrhenius rate e...
Definition: Reaction.h:168
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:59
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:180
CoverageDependency(double a_, double E_, double m_)
Constructor.
Definition: Reaction.h:198
double E
modification to the activation energy [K]
Definition: Reaction.h:201
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:450
std::map< std::string, CoverageDependency > coverage_deps
Adjustments to the Arrhenius rate expression dependent on surface species coverages.
Definition: Reaction.h:217
shared_ptr< Falloff > falloff
Falloff function which determines how low_rate and high_rate are combined to determine the rate const...
Definition: Reaction.h:150
std::string id
An identification string for the reaction, used in some filtering operations.
Definition: Reaction.h:60
bool reversible
True if the current reaction is reversible. False otherwise.
Definition: Reaction.h:63
bool duplicate
True if the current reaction is marked as duplicate.
Definition: Reaction.h:66
std::map< std::string, doublereal > Composition
Map from string names to doubles.
Definition: ct_defs.h:153
bool allow_negative_orders
True if negative reaction orders are allowed. Default is false.
Definition: Reaction.h:73
A reaction occurring on an interface (i.e. a SurfPhase or an EdgePhase)
Definition: Reaction.h:206
A reaction that is first-order in [M] at low pressure, like a third-body reaction, but zeroth-order in [M] as pressure increases.
Definition: Reaction.h:128
const U & getValue(const std::map< T, U > &m, const T &key, const U &default_val)
Const accessor for a value in a std::map.
Definition: utilities.h:504
shared_ptr< Reaction > newReaction(const XML_Node &rxn_node)
Create a new Reaction object for the reaction defined in rxn_node
Definition: Reaction.cpp:603
Composition reactants
Reactant species and stoichiometric coefficients.
Definition: Reaction.h:48
Intermediate class which stores data about a reaction and its rate parameterization so that it can be...
Definition: Reaction.h:22
Pressure-dependent reaction rate expressed by logarithmically interpolating between Arrhenius rate ex...
Definition: RxnRates.h:211
double efficiency(const std::string &k) const
Get the third-body efficiency for species k
Definition: Reaction.h:98
Arrhenius reaction rate type depends only on temperature.
Definition: RxnRates.h:30
doublereal film_resistivity
Film Resistivity value.
Definition: Reaction.h:249
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:74
Composition efficiencies
Map of species to third body efficiency.
Definition: Reaction.h:103
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:38
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:144
bool use_motz_wise_correction
Set to true if rate is a sticking coefficient which should be translated into a rate coefficient usin...
Definition: Reaction.h:227
doublereal beta
Forward value of the apparent Electrochemical transfer coefficient.
Definition: Reaction.h:252
A reaction with a non-reacting third body "M" that acts to add or remove energy from the reacting spe...
Definition: Reaction.h:112
Modifications to an InterfaceReaction rate based on a surface species coverage.
Definition: Reaction.h:192
Arrhenius high_rate
The rate constant in the high-pressure limit.
Definition: Reaction.h:143
Arrhenius low_rate
The rate constant in the low-pressure limit.
Definition: Reaction.h:140
Composition products
Product species and stoichiometric coefficients.
Definition: Reaction.h:51
std::vector< shared_ptr< Reaction > > getReactions(const XML_Node &node)
Create Reaction objects for all <reaction> nodes in an XML document.
Definition: Reaction.cpp:657
double a
modification to the pre-exponential factor [m, kmol, s units]
Definition: Reaction.h:200
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
double default_efficiency
The default third body efficiency for species not listed in efficiencies.
Definition: Reaction.h:107
An interface reaction which involves charged species.
Definition: Reaction.h:235
ThirdBody third_body
Relative efficiencies of third-body species in enhancing the reaction rate.
Definition: Reaction.h:146
A reaction where the rate decreases as pressure increases due to collisional stabilization of a react...
Definition: Reaction.h:157
ThirdBody third_body
Relative efficiencies of third-body species in enhancing the reaction rate.
Definition: Reaction.h:123
std::string equation() const
The chemical equation for this reaction.
Definition: Reaction.cpp:89