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