Cantera 2.6.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 https://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/AnyMap.h"
14#include "cantera/base/Units.h"
15#include "ChebyshevRate.h"
16#include "InterfaceRate.h"
17#include "Custom.h"
18
19namespace Cantera
20{
21
22class Kinetics;
23class FalloffRate;
24class XML_Node;
25class ThirdBody;
26
27//! @defgroup reactionGroup Reactions and reaction rates
28
29//! Abstract base class which stores data about a reaction and its rate
30//! parameterization so that it can be added to a Kinetics object.
31//! @ingroup reactionGroup
33{
34public:
35 Reaction();
37 shared_ptr<ReactionRate> rate={});
38
39 //! Construct a Reaction and it's corresponding ReactionRate based on AnyMap (YAML)
40 //! input.
41 Reaction(const AnyMap& node, const Kinetics& kin);
42
43 //! @deprecated To be removed after Cantera 2.6.
44 explicit Reaction(int type);
45 //! @deprecated To be removed after Cantera 2.6.
47 const Composition& products);
48 virtual ~Reaction() {}
49
50 //! The reactant side of the chemical equation for this reaction
51 virtual std::string reactantString() const;
52
53 //! The product side of the chemical equation for this reaction
54 virtual std::string productString() const;
55
56 //! The chemical equation for this reaction
57 std::string equation() const;
58
59 //! Set the reactants and products based on the reaction equation. If a Kinetics
60 //! object is provided, it is used to check that all reactants and products exist.
61 virtual void setEquation(const std::string& equation, const Kinetics* kin=0);
62
63 //! The type of reaction
64 virtual std::string type() const;
65
66 //! Calculate the units of the rate constant. These are determined by the units
67 //! of the standard concentration of the reactant species' phases and the phase
68 //! where the reaction occurs. Sets the value of #rate_units.
69 virtual void calculateRateCoeffUnits(const Kinetics& kin);
70
71 //! Calculate the units of the rate constant. These are determined by the units
72 //! of the standard concentration of the reactant species' phases and the phase
73 //! where the reaction occurs. Sets the value of #rate_units.
75
76 //! Ensure that the rate constant and other parameters for this reaction are
77 //! valid.
78 virtual void validate();
79
80 //! Perform validation checks that need access to a complete Kinetics objects, for
81 // example to retrieve information about reactant / product species.
82 virtual void validate(Kinetics& kin) {
83 if (m_rate) {
84 m_rate->validate(equation(), kin);
85 }
86 }
87
88 //! Return the parameters such that an identical Reaction could be reconstructed
89 //! using the newReaction() function. Behavior specific to derived classes is
90 //! handled by the getParameters() method.
91 //! @param withInput If true, include additional input data fields associated
92 //! with the object, such as user-defined fields from a YAML input file, as
93 //! contained in the #input attribute.
94 AnyMap parameters(bool withInput=true) const;
95
96 //! Set up reaction based on AnyMap *node*
97 virtual void setParameters(const AnyMap& node, const Kinetics& kin);
98
99 //! Get validity flag of reaction
100 bool valid() const {
101 return m_valid;
102 }
103
104 //! Set validity flag of reaction
105 void setValid(bool valid) {
106 m_valid = valid;
107 }
108
109 //! Check that the specified reaction is balanced (same number of atoms for
110 //! each element in the reactants and products). Raises an exception if the
111 //! reaction is not balanced. Used by checkSpecies.
112 //! @param kin Kinetics object
113 void checkBalance(const Kinetics& kin) const;
114
115 //! Verify that all species involved in the reaction are defined in the Kinetics
116 //! object. The function returns true if all species are found, and raises an
117 //! exception unless the kinetics object is configured to skip undeclared species,
118 //! in which case false is returned.
119 //! @param kin Kinetics object
120 bool checkSpecies(const Kinetics& kin) const;
121
122 //! Check whether reaction uses electrochemistry
123 //! @param kin Kinetics object
124 bool usesElectrochemistry(const Kinetics& kin) const;
125
126 //! Type of the reaction. The valid types are listed in the file,
127 //! reaction_defs.h, with constants ending in `RXN`.
128 /*!
129 * @deprecated To be removed in Cantera 2.6.
130 * Superseded by Reaction::type().
131 */
133
134 //! Reactant species and stoichiometric coefficients
136
137 //! Product species and stoichiometric coefficients
139
140 //! Forward reaction order with respect to specific species. By default,
141 //! mass-action kinetics is assumed, with the reaction order equal to each
142 //! reactant's stoichiometric coefficient.
144
145 //! An identification string for the reaction, used in some filtering
146 //! operations
147 std::string id;
148
149 //! True if the current reaction is reversible. False otherwise
151
152 //! True if the current reaction is marked as duplicate
154
155 //! True if reaction orders can be specified for non-reactant species.
156 //! Default is `false`.
158
159 //! True if negative reaction orders are allowed. Default is `false`.
161
162 //! Input data used for specific models
164
165 //! The units of the rate constant. These are determined by the units of the
166 //! standard concentration of the reactant species' phases of the phase
167 //! where the reaction occurs.
169
170 //! Get reaction rate pointer
171 shared_ptr<ReactionRate> rate() {
172 return m_rate;
173 }
174
175 //! Set reaction rate pointer
176 void setRate(shared_ptr<ReactionRate> rate);
177
178 //! Get pointer to third-body
179 shared_ptr<ThirdBody> thirdBody() {
180 return m_third_body;
181 }
182
183 //! Indicate whether object uses legacy framework
184 bool usesLegacy() const {
185 return !m_rate;
186 }
187
188protected:
189 //! Store the parameters of a Reaction needed to reconstruct an identical
190 //! object using the newReaction(AnyMap&, Kinetics&) function. Does not
191 //! include user-defined fields available in the #input map.
192 virtual void getParameters(AnyMap& reactionNode) const;
193
194 //! Flag indicating whether reaction is set up correctly
196
197 //! @internal Helper function returning vector of undeclared third body species
198 //! and a boolean expression indicating whether the third body is specified.
199 //! The function is used by the checkSpecies method and only needed as long as
200 //! there is no unified approach to handle third body collision partners.
201 //! @param kin Kinetics object
202 virtual std::pair<std::vector<std::string>, bool>
203 undeclaredThirdBodies(const Kinetics& kin) const;
204
205 //! Reaction rate used by generic reactions
206 shared_ptr<ReactionRate> m_rate;
207
208 //! Relative efficiencies of third-body species in enhancing the reaction
209 //! rate (if applicable)
210 shared_ptr<ThirdBody> m_third_body;
211};
212
213
214//! A reaction which follows mass-action kinetics with a modified Arrhenius
215//! reaction rate.
217{
218public:
221 const Arrhenius2& rate);
222
223 virtual void validate();
224 using Reaction::validate;
225 virtual void getParameters(AnyMap& reactionNode) const;
226
227 virtual std::string type() const {
228 return "elementary-legacy";
229 }
230
231 Arrhenius2 rate;
232 bool allow_negative_pre_exponential_factor;
233};
234
235
236//! A class for managing third-body efficiencies, including default values
238{
239public:
240 explicit ThirdBody(double default_efficiency=1.0);
241
242 ThirdBody(const AnyMap& node);
243
244 //! Set third-body efficiencies from AnyMap *node*
245 void setEfficiencies(const AnyMap& node);
246
247 //! Get the third-body efficiency for species *k*
248 double efficiency(const std::string& k) const;
249
250 //! Map of species to third body efficiency
252
253 //! The default third body efficiency for species not listed in
254 //! #efficiencies.
256
257 //! Input explicitly specifies collision partner
259
260 //! Third body is used by law of mass action
261 //! (`true` for three-body reactions, `false` for falloff reactions)
263};
264
265
266//! A reaction with a non-reacting third body "M" that acts to add or remove
267//! energy from the reacting species
269{
270public:
273 const Arrhenius2& rate, const ThirdBody& tbody);
274
275 virtual std::string type() const {
276 return "three-body-legacy";
277 }
278
279 virtual std::string reactantString() const;
280 virtual std::string productString() const;
281 virtual void calculateRateCoeffUnits(const Kinetics& kin);
282 virtual void getParameters(AnyMap& reactionNode) const;
283
284 //! Relative efficiencies of third-body species in enhancing the reaction
285 //! rate.
287
288protected:
289 virtual std::pair<std::vector<std::string>, bool>
290 undeclaredThirdBodies(const Kinetics& kin) const;
291};
292
293
294//! A reaction that is first-order in [M] at low pressure, like a third-body
295//! reaction, but zeroth-order in [M] as pressure increases.
297{
298public:
302 const ThirdBody& tbody);
303
304 virtual std::string type() const {
305 return "falloff-legacy";
306 }
307
308 virtual std::string reactantString() const;
309 virtual std::string productString() const;
310
311 virtual void validate();
312 using Reaction::validate;
313 virtual void calculateRateCoeffUnits(const Kinetics& kin);
314 virtual void getParameters(AnyMap& reactionNode) const;
315
316 //! The rate constant in the low-pressure limit
318
319 //! The rate constant in the high-pressure limit
321
322 //! Relative efficiencies of third-body species in enhancing the reaction rate
324
325 //! Falloff function which determines how low_rate and high_rate are
326 //! combined to determine the rate constant for the reaction.
327 shared_ptr<FalloffRate> falloff;
328
329 bool allow_negative_pre_exponential_factor;
330
331 //! The units of the low-pressure rate constant. The units of the
332 //! high-pressure rate constant are stored in #rate_units.
334
335protected:
336 virtual std::pair<std::vector<std::string>, bool> undeclaredThirdBodies(
337 const Kinetics& kin) const;
338};
339
340
341//! A reaction where the rate decreases as pressure increases due to collisional
342//! stabilization of a reaction intermediate. Like a FalloffReaction2, except
343//! that the forward rate constant is written as being proportional to the low-
344//! pressure rate constant.
346{
347public:
351 const Arrhenius2& high_rate, const ThirdBody& tbody);
352
353 virtual std::string type() const {
354 return "chemically-activated-legacy";
355 }
356
357 virtual void calculateRateCoeffUnits(const Kinetics& kin);
358 virtual void getParameters(AnyMap& reactionNode) const;
359};
360
361
362//! A pressure-dependent reaction parameterized by logarithmically interpolating
363//! between Arrhenius rate expressions at various pressures.
365{
366public:
369 const Plog& rate);
370
371 virtual std::string type() const {
372 return "pressure-dependent-Arrhenius-legacy";
373 }
374
375 virtual void validate();
376 using Reaction::validate;
377 virtual void getParameters(AnyMap& reactionNode) const;
378
379 Plog rate;
380};
381
382
383//! A pressure-dependent reaction parameterized by a bi-variate Chebyshev
384//! polynomial in temperature and pressure
386{
387public:
390 const ChebyshevRate& rate);
391 virtual void getParameters(AnyMap& reactionNode) const;
392
393 virtual std::string type() const {
394 return "Chebyshev-legacy";
395 }
396
397 ChebyshevRate rate;
398};
399
400
401//! Modifications to an InterfaceReaction2 rate based on a surface species
402//! coverage.
404{
405 //! Constructor
406 //! @param a_ coefficient for exponential dependence on coverage [dimensionless]
407 //! @param E_ modification to the activation energy [K]
408 //! @param m_ exponent for power law dependence on coverage [dimensionless]
409 CoverageDependency(double a_, double E_, double m_) : a(a_), E(E_), m(m_) {}
411 double a; //!< coefficient for exponential dependence on coverage [dimensionless]
412 double E; //!< modification to the activation energy [K]
413 double m; //!< exponent for power law dependence on coverage [dimensionless]
414};
415
416
417//! A reaction occurring on an interface (for example, a SurfPhase or an EdgePhase)
419{
420public:
423 const Arrhenius2& rate, bool isStick=false);
424 virtual void calculateRateCoeffUnits(const Kinetics& kin);
425 virtual void getParameters(AnyMap& reactionNode) const;
426
427 virtual void validate(Kinetics& kin);
428 using Reaction::validate;
429
430 virtual std::string type() const {
431 return "interface-legacy";
432 }
433
434 //! Adjustments to the Arrhenius rate expression dependent on surface
435 //! species coverages. Three coverage parameters (a, E, m) are used for each
436 //! species on which the rate depends. See SurfaceArrhenius for details on
437 //! the parameterization.
438 std::map<std::string, CoverageDependency> coverage_deps;
439
440 //! Set to true if `rate` is a parameterization of the sticking coefficient
441 //! rather than the forward rate constant
443
444 //! Set to true if `rate` is a sticking coefficient which should be
445 //! translated into a rate coefficient using the correction factor developed
446 //! by Motz & Wise for reactions with high (near-unity) sticking
447 //! coefficients. Defaults to 'false'.
449
450 //! For reactions with multiple non-surface species, the sticking species
451 //! needs to be explicitly identified.
452 std::string sticking_species;
453};
454
455
456//! An interface reaction which involves charged species
458{
459public:
462 const Composition& products, const Arrhenius2& rate);
463 virtual void getParameters(AnyMap& reactionNode) const;
464
465 //! Forward value of the apparent Electrochemical transfer coefficient
466 doublereal beta;
467
468 bool exchange_current_density_formulation;
469};
470
471
472//! A reaction with a non-reacting third body "M" that acts to add or remove
473//! energy from the reacting species
475{
476public:
479 const ArrheniusRate& rate, const ThirdBody& tbody);
480
481 ThreeBodyReaction3(const AnyMap& node, const Kinetics& kin);
482
483 virtual std::string type() const {
484 return "three-body";
485 }
486
487 virtual void setEquation(const std::string& equation, const Kinetics* kin=0);
488 bool detectEfficiencies();
489 virtual void setParameters(const AnyMap& node, const Kinetics& kin);
490 virtual void getParameters(AnyMap& reactionNode) const;
491
492 virtual std::string reactantString() const;
493 virtual std::string productString() const;
494};
495
496
497//! A falloff reaction that is first-order in [M] at low pressure, like a third-body
498//! reaction, but zeroth-order in [M] as pressure increases.
499//! In addition, the class supports chemically-activated reactions where the rate
500//! decreases as pressure increases due to collisional stabilization of a reaction
501//! intermediate; in this case, the forward rate constant is written as being
502//! proportional to the low-pressure rate constant.
504{
505public:
508 const ReactionRate& rate, const ThirdBody& tbody);
509
510 FalloffReaction3(const AnyMap& node, const Kinetics& kin);
511
512 virtual std::string type() const;
513
514 virtual void setEquation(const std::string& equation, const Kinetics* kin);
515 virtual void setParameters(const AnyMap& node, const Kinetics& kin);
516 virtual void getParameters(AnyMap& reactionNode) const;
517
518 virtual std::string reactantString() const;
519 virtual std::string productString() const;
520};
521
522
523//! A reaction which follows mass-action kinetics with a custom reaction rate
524//! defined in Python.
525/**
526 * @warning This class is an experimental part of the %Cantera API and
527 * may be changed or removed without notice.
528 */
530{
531public:
534 const CustomFunc1Rate& rate);
535
536 CustomFunc1Reaction(const AnyMap& node, const Kinetics& kin);
537
538 virtual std::string type() const {
539 return "custom-rate-function";
540 }
541};
542
543
544#ifdef CT_NO_LEGACY_REACTIONS_26
545typedef ThreeBodyReaction3 ThreeBodyReaction;
546typedef FalloffReaction3 FalloffReaction;
547#else
548typedef ElementaryReaction2 ElementaryReaction;
549typedef ThreeBodyReaction2 ThreeBodyReaction;
550typedef FalloffReaction2 FalloffReaction;
551typedef ChemicallyActivatedReaction2 ChemicallyActivatedReaction;
552typedef PlogReaction2 PlogReaction;
553typedef ChebyshevReaction2 ChebyshevReaction;
554typedef InterfaceReaction2 InterfaceReaction;
555typedef ElectrochemicalReaction2 ElectrochemicalReaction;
556#endif
557
558//! Create a new empty Reaction object
559/*!
560 * @param type string identifying type of reaction.
561 * @deprecated To be removed after Cantera 2.6. Only used for legacy reaction types.
562 */
563unique_ptr<Reaction> newReaction(const std::string& type);
564
565//! Create a new Reaction object for the reaction defined in `rxn_node`
566/*!
567 * @param rxn_node XML node describing reaction.
568 */
569unique_ptr<Reaction> newReaction(const XML_Node& rxn_node);
570
571//! Create a new Reaction object using the specified parameters
572/*!
573 * @param rxn_node AnyMap node describing reaction.
574 * @param kin kinetics manager
575 */
576unique_ptr<Reaction> newReaction(const AnyMap& rxn_node,
577 const Kinetics& kin);
578
579//! Create Reaction objects for all `<reaction>` nodes in an XML document.
580//!
581//! The `<reaction>` nodes are assumed to be children of the `<reactionData>`
582//! node in an XML document with a `<ctml>` root node, as in the case of XML
583//! files produced by conversion from CTI files.
584//!
585//! This function can be used in combination with get_XML_File() and
586//! get_XML_from_string() to get Reaction objects from either a file or a
587//! string, respectively, where the string or file is formatted as either CTI
588//! or XML.
589//!
590//! If Reaction objects are being created from a CTI definition that does not
591//! contain corresponding phase definitions, then one of the following must be
592//! true, or the resulting rate constants will be incorrect:
593//!
594//! - The rate constants are expressed in (kmol, meter, second) units
595//! - A `units` directive is included **and** all reactions take place in
596//! bulk (for example, gas) phases
597//!
598//! @deprecated The XML input format is deprecated and will be removed in
599//! Cantera 3.0.
600std::vector<shared_ptr<Reaction> > getReactions(const XML_Node& node);
601
602//! Create Reaction objects for each item (an AnyMap) in `items`. The species
603//! involved in these reactions must exist in the phases associated with the
604//! Kinetics object `kinetics`.
605std::vector<shared_ptr<Reaction>> getReactions(const AnyValue& items,
606 Kinetics& kinetics);
607
608//! Parse reaction equation
609void parseReactionEquation(Reaction& R, const std::string& equation,
610 const AnyBase& reactionNode, const Kinetics* kin);
611
612// declarations of setup functions
613void setupReaction(Reaction& R, const XML_Node& rxn_node);
614
615void setupElementaryReaction(ElementaryReaction2&, const XML_Node&);
616//! @internal May be changed without notice in future versions
617void setupElementaryReaction(ElementaryReaction2&, const AnyMap&,
618 const Kinetics&);
619
620void setupThreeBodyReaction(ThreeBodyReaction2&, const XML_Node&);
621//! @deprecated Cantera 2.6 (replaced by setParameters)
622void setupThreeBodyReaction(ThreeBodyReaction2&, const AnyMap&,
623 const Kinetics&);
624
625void setupFalloffReaction(FalloffReaction2&, const XML_Node&);
626//! @deprecated Cantera 2.6 (replaced by setParameters)
627void setupFalloffReaction(FalloffReaction2&, const AnyMap&,
628 const Kinetics&);
629
630//! @deprecated Cantera 2.6 (replaced by setParameters)
631void setupChemicallyActivatedReaction(ChemicallyActivatedReaction2&,
632 const XML_Node&);
633
634void setupPlogReaction(PlogReaction2&, const XML_Node&);
635//! @deprecated Cantera 2.6 (replaced by setParameters)
636void setupPlogReaction(PlogReaction2&, const AnyMap&, const Kinetics&);
637
638void setupChebyshevReaction(ChebyshevReaction2&, const XML_Node&);
639//! @deprecated Cantera 2.6 (replaced by setParameters)
640void setupChebyshevReaction(ChebyshevReaction2&, const AnyMap&,
641 const Kinetics&);
642
643void setupInterfaceReaction(InterfaceReaction2&, const XML_Node&);
644//! @internal May be changed without notice in future versions
645void setupInterfaceReaction(InterfaceReaction2&, const AnyMap&,
646 const Kinetics&);
647
648void setupElectrochemicalReaction(ElectrochemicalReaction2&,
649 const XML_Node&);
650//! @internal May be changed without notice in future versions
651void setupElectrochemicalReaction(ElectrochemicalReaction2&,
652 const AnyMap&, const Kinetics&);
653}
654#endif
Header for reaction rates that occur at interfaces.
Header for unit conversion utilities, which are used to translate user input from input files (See In...
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Arrhenius reaction rate type depends only on temperature.
Definition: RxnRates.h:42
Arrhenius reaction rate type depends only on temperature.
Definition: Arrhenius.h:192
Pressure-dependent rate expression where the rate coefficient is expressed as a bivariate Chebyshev p...
Definition: ChebyshevRate.h:90
A pressure-dependent reaction parameterized by a bi-variate Chebyshev polynomial in temperature and p...
Definition: Reaction.h:386
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:393
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:875
A reaction where the rate decreases as pressure increases due to collisional stabilization of a react...
Definition: Reaction.h:346
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
Definition: Reaction.cpp:825
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:353
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:833
Custom reaction rate depending only on temperature.
Definition: Custom.h:37
A reaction which follows mass-action kinetics with a custom reaction rate defined in Python.
Definition: Reaction.h:530
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:538
An interface reaction which involves charged species.
Definition: Reaction.h:458
doublereal beta
Forward value of the apparent Electrochemical transfer coefficient.
Definition: Reaction.h:466
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:969
A reaction which follows mass-action kinetics with a modified Arrhenius reaction rate.
Definition: Reaction.h:217
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:588
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:227
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:599
A reaction that is first-order in [M] at low pressure, like a third-body reaction,...
Definition: Reaction.h:297
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:738
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
Definition: Reaction.cpp:776
shared_ptr< FalloffRate > falloff
Falloff function which determines how low_rate and high_rate are combined to determine the rate const...
Definition: Reaction.h:327
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:760
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:749
Units low_rate_units
The units of the low-pressure rate constant.
Definition: Reaction.h:333
Arrhenius2 high_rate
The rate constant in the high-pressure limit.
Definition: Reaction.h:320
ThirdBody third_body
Relative efficiencies of third-body species in enhancing the reaction rate.
Definition: Reaction.h:323
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:304
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:784
Arrhenius2 low_rate
The rate constant in the low-pressure limit.
Definition: Reaction.h:317
virtual std::pair< std::vector< std::string >, bool > undeclaredThirdBodies(const Kinetics &kin) const
Definition: Reaction.cpp:803
A falloff reaction that is first-order in [M] at low pressure, like a third-body reaction,...
Definition: Reaction.h:504
virtual void setParameters(const AnyMap &node, const Kinetics &kin)
Set up reaction based on AnyMap node
Definition: Reaction.cpp:1176
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:1156
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:1166
virtual std::string type() const
The type of reaction.
Definition: Reaction.cpp:1146
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:1232
virtual void setEquation(const std::string &equation, const Kinetics *kin)
Set the reactants and products based on the reaction equation.
Definition: Reaction.cpp:1189
A reaction occurring on an interface (for example, a SurfPhase or an EdgePhase)
Definition: Reaction.h:419
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:442
std::map< std::string, CoverageDependency > coverage_deps
Adjustments to the Arrhenius rate expression dependent on surface species coverages.
Definition: Reaction.h:438
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
Definition: Reaction.cpp:900
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:124
std::string sticking_species
For reactions with multiple non-surface species, the sticking species needs to be explicitly identifi...
Definition: Reaction.h:452
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:430
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:448
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:908
Public interface for kinetics managers.
Definition: Kinetics.h:114
Pressure-dependent reaction rate expressed by logarithmically interpolating between Arrhenius rate ex...
Definition: PlogRate.h:78
A pressure-dependent reaction parameterized by logarithmically interpolating between Arrhenius rate e...
Definition: Reaction.h:365
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:1835
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:371
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:853
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
Definition: ReactionRate.h:45
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
Definition: Reaction.h:33
virtual void setParameters(const AnyMap &node, const Kinetics &kin)
Set up reaction based on AnyMap node
Definition: Reaction.cpp:216
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:266
void checkBalance(const Kinetics &kin) const
Check that the specified reaction is balanced (same number of atoms for each element in the reactants...
Definition: Reaction.cpp:409
Units rate_units
The units of the rate constant.
Definition: Reaction.h:168
bool valid() const
Get validity flag of reaction.
Definition: Reaction.h:100
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
Definition: Reaction.cpp:315
shared_ptr< ReactionRate > rate()
Get reaction rate pointer.
Definition: Reaction.h:171
Composition orders
Forward reaction order with respect to specific species.
Definition: Reaction.h:143
virtual void validate()
Ensure that the rate constant and other parameters for this reaction are valid.
Definition: Reaction.cpp:124
bool checkSpecies(const Kinetics &kin) const
Verify that all species involved in the reaction are defined in the Kinetics object.
Definition: Reaction.cpp:479
void setRate(shared_ptr< ReactionRate > rate)
Set reaction rate pointer.
Definition: Reaction.cpp:243
shared_ptr< ThirdBody > m_third_body
Relative efficiencies of third-body species in enhancing the reaction rate (if applicable)
Definition: Reaction.h:210
AnyMap parameters(bool withInput=true) const
Return the parameters such that an identical Reaction could be reconstructed using the newReaction() ...
Definition: Reaction.cpp:162
virtual void validate(Kinetics &kin)
Perform validation checks that need access to a complete Kinetics objects, for.
Definition: Reaction.h:82
virtual void setEquation(const std::string &equation, const Kinetics *kin=0)
Set the reactants and products based on the reaction equation.
Definition: Reaction.cpp:305
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:281
shared_ptr< ThirdBody > thirdBody()
Get pointer to third-body.
Definition: Reaction.h:179
bool m_valid
Flag indicating whether reaction is set up correctly.
Definition: Reaction.h:195
bool reversible
True if the current reaction is reversible. False otherwise.
Definition: Reaction.h:150
bool allow_nonreactant_orders
True if reaction orders can be specified for non-reactant species.
Definition: Reaction.h:157
virtual std::string type() const
The type of reaction.
Definition: Reaction.cpp:310
shared_ptr< ReactionRate > m_rate
Reaction rate used by generic reactions.
Definition: Reaction.h:206
bool usesLegacy() const
Indicate whether object uses legacy framework.
Definition: Reaction.h:184
bool usesElectrochemistry(const Kinetics &kin) const
Check whether reaction uses electrochemistry.
Definition: Reaction.cpp:540
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:184
bool allow_negative_orders
True if negative reaction orders are allowed. Default is false.
Definition: Reaction.h:160
Composition products
Product species and stoichiometric coefficients.
Definition: Reaction.h:138
Composition reactants
Reactant species and stoichiometric coefficients.
Definition: Reaction.h:135
AnyMap input
Input data used for specific models.
Definition: Reaction.h:163
bool duplicate
True if the current reaction is marked as duplicate.
Definition: Reaction.h:153
UnitStack calculateRateCoeffUnits3(const Kinetics &kin)
Calculate the units of the rate constant.
Definition: Reaction.cpp:345
int reaction_type
Type of the reaction.
Definition: Reaction.h:132
std::string equation() const
The chemical equation for this reaction.
Definition: Reaction.cpp:296
virtual std::pair< std::vector< std::string >, bool > undeclaredThirdBodies(const Kinetics &kin) const
Definition: Reaction.cpp:398
std::string id
An identification string for the reaction, used in some filtering operations.
Definition: Reaction.h:147
void setValid(bool valid)
Set validity flag of reaction.
Definition: Reaction.h:105
A class for managing third-body efficiencies, including default values.
Definition: Reaction.h:238
bool specified_collision_partner
Input explicitly specifies collision partner.
Definition: Reaction.h:258
void setEfficiencies(const AnyMap &node)
Set third-body efficiencies from AnyMap node
Definition: Reaction.cpp:624
double default_efficiency
The default third body efficiency for species not listed in efficiencies.
Definition: Reaction.h:255
double efficiency(const std::string &k) const
Get the third-body efficiency for species k
Definition: Reaction.cpp:632
Composition efficiencies
Map of species to third body efficiency.
Definition: Reaction.h:251
bool mass_action
Third body is used by law of mass action (true for three-body reactions, false for falloff reactions)
Definition: Reaction.h:262
A reaction with a non-reacting third body "M" that acts to add or remove energy from the reacting spe...
Definition: Reaction.h:269
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:652
virtual void calculateRateCoeffUnits(const Kinetics &kin)
Calculate the units of the rate constant.
Definition: Reaction.cpp:672
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:662
ThirdBody third_body
Relative efficiencies of third-body species in enhancing the reaction rate.
Definition: Reaction.h:286
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:275
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:693
virtual std::pair< std::vector< std::string >, bool > undeclaredThirdBodies(const Kinetics &kin) const
Definition: Reaction.cpp:706
A reaction with a non-reacting third body "M" that acts to add or remove energy from the reacting spe...
Definition: Reaction.h:475
virtual void setParameters(const AnyMap &node, const Kinetics &kin)
Set up reaction based on AnyMap node
Definition: Reaction.cpp:1062
virtual std::string reactantString() const
The reactant side of the chemical equation for this reaction.
Definition: Reaction.cpp:1087
virtual void setEquation(const std::string &equation, const Kinetics *kin=0)
Set the reactants and products based on the reaction equation.
Definition: Reaction.cpp:1046
virtual std::string productString() const
The product side of the chemical equation for this reaction.
Definition: Reaction.cpp:1097
virtual std::string type() const
The type of reaction.
Definition: Reaction.h:483
virtual void getParameters(AnyMap &reactionNode) const
Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(An...
Definition: Reaction.cpp:1074
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
void parseReactionEquation(Reaction &R, const std::string &equation, const AnyBase &reactionNode, const Kinetics *kin)
Parse reaction equation.
Definition: Reaction.cpp:1560
std::vector< shared_ptr< Reaction > > getReactions(const XML_Node &node)
Create Reaction objects for all <reaction> nodes in an XML document.
Definition: Reaction.cpp:2000
std::map< std::string, double > Composition
Map from string names to doubles.
Definition: ct_defs.h:180
void setupChemicallyActivatedReaction(ChemicallyActivatedReaction2 &, const XML_Node &)
Definition: Reaction.cpp:1783
unique_ptr< Reaction > newReaction(const std::string &type)
Create a new empty Reaction object.
Definition: Reaction.cpp:1307
Modifications to an InterfaceReaction2 rate based on a surface species coverage.
Definition: Reaction.h:404
double a
coefficient for exponential dependence on coverage [dimensionless]
Definition: Reaction.h:411
double E
modification to the activation energy [K]
Definition: Reaction.h:412
double m
exponent for power law dependence on coverage [dimensionless]
Definition: Reaction.h:413
CoverageDependency(double a_, double E_, double m_)
Constructor.
Definition: Reaction.h:409
Unit aggregation utility.
Definition: Units.h:99