| Cantera 3.0.0

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Reaction Class Reference
Chemical Kinetics » Reactions and Reaction Rates

Abstract base class which stores data about a reaction and its rate parameterization so that it can be added to a Kinetics object. More...

`#include <Reaction.h>`

Inheritance diagram for Reaction:
[legend]

## Detailed Description

Abstract base class which stores data about a reaction and its rate parameterization so that it can be added to a Kinetics object.

Definition at line 26 of file Reaction.h.

## Public Member Functions
| Reaction (const Composition &reactants, const Composition &products, shared_ptr< ReactionRate > rate, shared_ptr< ThirdBody > tbody=nullptr)
| Reaction (const string &equation, shared_ptr< ReactionRate > rate, shared_ptr< ThirdBody > tbody=nullptr)
| Reaction (const AnyMap &node, const Kinetics &kin)
| Construct a Reaction and corresponding ReactionRate based on AnyMap (YAML) input.
string | reactantString () const
| The reactant side of the chemical equation for this reaction.
string | productString () const
| The product side of the chemical equation for this reaction.
string | equation () const
| The chemical equation for this reaction.
void | setEquation (const string &equation, const Kinetics *kin=0)
| Set the reactants and products based on the reaction equation.
string | type () const
| The type of reaction, including reaction rate information.
UnitStack | calculateRateCoeffUnits (const Kinetics &kin)
| Calculate the units of the rate constant.
UnitStack | calculateRateCoeffUnits3 (const Kinetics &kin)
| Calculate the units of the rate constant.
void | check ()
| Ensure that the rate constant and other parameters for this reaction are valid.
void | validate ()
| Ensure that the rate constant and other parameters for this reaction are valid.
void | validate (Kinetics &kin)
| Perform validation checks that need access to a complete Kinetics objects, for.
AnyMap | parameters (bool withInput=true) const
| Return the parameters such that an identical Reaction could be reconstructed using the newReaction() function.
void | setParameters (const AnyMap &node, const Kinetics &kin)
| Set up reaction based on AnyMap node
bool | valid () const
| Get validity flag of reaction.
void | setValid (bool valid)
| Set validity flag of reaction.
void | checkBalance (const Kinetics &kin) const
| Check that the specified reaction is balanced (same number of atoms for each element in the reactants and products).
bool | checkSpecies (const Kinetics &kin) const
| Verify that all species involved in the reaction are defined in the Kinetics object.
bool | usesElectrochemistry (const Kinetics &kin) const
| Check whether reaction uses electrochemistry.
shared_ptr< ReactionRate > | rate ()
| Get reaction rate pointer.
void | setRate (shared_ptr< ReactionRate > rate)
| Set reaction rate pointer.
shared_ptr< ThirdBody > | thirdBody ()
| Get pointer to third-body handler.
bool | usesThirdBody () const
| Check whether reaction involves third body collider.

## Public Attributes
Composition | reactants
| Reactant species and stoichiometric coefficients.
Composition | products
| Product species and stoichiometric coefficients.
Composition | orders
| Forward reaction order with respect to specific species.
string | id
| An identification string for the reaction, used in some filtering operations.
bool | reversible = true
| True if the current reaction is reversible. False otherwise.
bool | duplicate = false
| True if the current reaction is marked as duplicate.
bool | allow_nonreactant_orders = false
| True if reaction orders can be specified for non-reactant species.
bool | allow_negative_orders = false
| True if negative reaction orders are allowed. Default is `false`.
AnyMap | input
| Input data used for specific models.
Units | rate_units {0.0}
| The units of the rate constant.

## Protected Member Functions
void | getParameters (AnyMap &reactionNode) const
| Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(AnyMap&, Kinetics&) function.

## Protected Attributes
bool | m_valid = true
| Flag indicating whether reaction is set up correctly.
bool | m_explicit_type = false
| Flag indicating that serialization uses explicit type.
bool | m_from_composition = false
| Flag indicating that object was instantiated from reactant/product compositions.
shared_ptr< ReactionRate > | m_rate
| Reaction rate used by generic reactions.
shared_ptr< ThirdBody > | m_third_body
| Relative efficiencies of third-body species in enhancing the reaction rate (if applicable)

## Constructor & Destructor Documentation

## ◆ Reaction() [1/4]

Reaction | ( |  | ) |
| inline

Definition at line 29 of file Reaction.h.

## ◆ Reaction() [2/4]

Reaction | ( | const Composition & | reactants,
|  | const Composition & | products,
|  | shared_ptr< ReactionRate > | rate,
|  | shared_ptr< ThirdBody > | tbody = `nullptr`
| ) |  |

Definition at line 29 of file Reaction.cpp.

## ◆ Reaction() [3/4]

Reaction | ( | const string & | equation,
|  | shared_ptr< ReactionRate > | rate,
|  | shared_ptr< ThirdBody > | tbody = `nullptr`
| ) |  |

Definition at line 71 of file Reaction.cpp.

## ◆ Reaction() [4/4]

Reaction | ( | const AnyMap & | node,
|  | const Kinetics & | kin
| ) |  |

Construct a Reaction and corresponding ReactionRate based on AnyMap (YAML) input.

Definition at line 83 of file Reaction.cpp.

## ◆ ~Reaction()

virtual ~Reaction | ( |  | ) |
| inline virtual

Definition at line 39 of file Reaction.h.

## Member Function Documentation

## ◆ reactantString()

string reactantString | ( |  | ) | const

The reactant side of the chemical equation for this reaction.

Definition at line 311 of file Reaction.cpp.

## ◆ productString()

string productString | ( |  | ) | const

The product side of the chemical equation for this reaction.

Definition at line 329 of file Reaction.cpp.

## ◆ equation()

string equation | ( |  | ) | const

The chemical equation for this reaction.

Definition at line 347 of file Reaction.cpp.

## ◆ setEquation()

void setEquation | ( | const string & | equation,
|  | const Kinetics * | kin = `0`
| ) |  |

Set the reactants and products based on the reaction equation.

If a Kinetics object is provided, it is used to check that all reactants and products exist.

Definition at line 356 of file Reaction.cpp.

## ◆ type()

string type | ( |  | ) | const

The type of reaction, including reaction rate information.

Definition at line 506 of file Reaction.cpp.

## ◆ calculateRateCoeffUnits()

UnitStack calculateRateCoeffUnits | ( | const Kinetics & | kin | ) |

Calculate the units of the rate constant.

These are determined by the units of the standard concentration of the reactant species' phases and the phase where the reaction occurs. Sets the value of rate_units.

Definition at line 525 of file Reaction.cpp.

## ◆ calculateRateCoeffUnits3()

UnitStack calculateRateCoeffUnits3 | ( | const Kinetics & | kin | ) |
| inline

Calculate the units of the rate constant.

Deprecated:
  To be removed after Cantera 3.0. Replaceable by calculateRateCoeffUnits.

Definition at line 65 of file Reaction.h.

## ◆ check()

void check | ( |  | ) |

Ensure that the rate constant and other parameters for this reaction are valid.

Since
  New in Cantera 3.0.

Definition at line 125 of file Reaction.cpp.

## ◆ validate() [1/2]

void validate | ( |  | ) |
| inline

Ensure that the rate constant and other parameters for this reaction are valid.

Deprecated:
  To be removed after Cantera 3.0. Replaceable by check.

Definition at line 78 of file Reaction.h.

## ◆ validate() [2/2]

void validate | ( | Kinetics & | kin | ) |
| inline

Perform validation checks that need access to a complete Kinetics objects, for.

Definition at line 87 of file Reaction.h.

## ◆ parameters()

AnyMap parameters | ( | bool | withInput = `true` | ) | const

Return the parameters such that an identical Reaction could be reconstructed using the newReaction() function.

Behavior specific to derived classes is handled by the getParameters() method.

Parameters

  withInput | If true, include additional input data fields associated with the object, such as user-defined fields from a YAML input file, as contained in the input attribute.

Definition at line 161 of file Reaction.cpp.

## ◆ setParameters()

void setParameters | ( | const AnyMap & | node,
|  | const Kinetics & | kin
| ) |  |

Set up reaction based on AnyMap node

Definition at line 231 of file Reaction.cpp.

## ◆ valid()

bool valid | ( |  | ) | const
| inline

Get validity flag of reaction.

Definition at line 105 of file Reaction.h.

## ◆ setValid()

void setValid | ( | bool | valid | ) |
| inline

Set validity flag of reaction.

Definition at line 110 of file Reaction.h.

## ◆ checkBalance()

void checkBalance | ( | const Kinetics & | kin | ) | const

Check that the specified reaction is balanced (same number of atoms for each element in the reactants and products).

Raises an exception if the reaction is not balanced. Used by checkSpecies.

Parameters

  kin | Kinetics object

Definition at line 579 of file Reaction.cpp.

## ◆ checkSpecies()

bool checkSpecies | ( | const Kinetics & | kin | ) | const

Verify that all species involved in the reaction are defined in the Kinetics object.

The function returns true if all species are found, and raises an exception unless the kinetics object is configured to skip undeclared species, in which case false is returned.

Parameters

  kin | Kinetics object

Definition at line 646 of file Reaction.cpp.

## ◆ usesElectrochemistry()

bool usesElectrochemistry | ( | const Kinetics & | kin | ) | const

Check whether reaction uses electrochemistry.

Parameters

  kin | Kinetics object

Definition at line 690 of file Reaction.cpp.

## ◆ rate()

shared_ptr< ReactionRate > rate | ( |  | ) |
| inline

Get reaction rate pointer.

Definition at line 168 of file Reaction.h.

## ◆ setRate()

void setRate | ( | shared_ptr< ReactionRate > | rate | ) |

Set reaction rate pointer.

Definition at line 269 of file Reaction.cpp.

## ◆ thirdBody()

shared_ptr< ThirdBody > thirdBody | ( |  | ) |
| inline

Get pointer to third-body handler.

Definition at line 176 of file Reaction.h.

## ◆ usesThirdBody()

bool usesThirdBody | ( |  | ) | const
| inline

Check whether reaction involves third body collider.

Since
  New in Cantera 3.0.

Definition at line 182 of file Reaction.h.

## ◆ getParameters()

void getParameters | ( | AnyMap & | reactionNode | ) | const
| protected

Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(AnyMap&, Kinetics&) function.

Does not include user-defined fields available in the input map.

Definition at line 183 of file Reaction.cpp.

## Member Data Documentation

## ◆ reactants

Composition reactants

Reactant species and stoichiometric coefficients.

Definition at line 132 of file Reaction.h.

## ◆ products

Composition products

Product species and stoichiometric coefficients.

Definition at line 135 of file Reaction.h.

## ◆ orders

Composition orders

Forward reaction order with respect to specific species.

By default, mass-action kinetics is assumed, with the reaction order equal to each reactant's stoichiometric coefficient.

Definition at line 140 of file Reaction.h.

## ◆ id

string id

An identification string for the reaction, used in some filtering operations.

Definition at line 144 of file Reaction.h.

## ◆ reversible

bool reversible = true

True if the current reaction is reversible. False otherwise.

Definition at line 147 of file Reaction.h.

## ◆ duplicate

bool duplicate = false

True if the current reaction is marked as duplicate.

Definition at line 150 of file Reaction.h.

## ◆ allow_nonreactant_orders

bool allow_nonreactant_orders = false

True if reaction orders can be specified for non-reactant species.

Default is `false`.

Definition at line 154 of file Reaction.h.

## ◆ allow_negative_orders

bool allow_negative_orders = false

True if negative reaction orders are allowed. Default is `false`.

Definition at line 157 of file Reaction.h.

## ◆ input

AnyMap input

Input data used for specific models.

Definition at line 160 of file Reaction.h.

## ◆ rate_units

Units rate_units {0.0}

The units of the rate constant.

These are determined by the units of the standard concentration of the reactant species' phases of the phase where the reaction occurs.

Definition at line 165 of file Reaction.h.

## ◆ m_valid

bool m_valid = true
| protected

Flag indicating whether reaction is set up correctly.

Definition at line 193 of file Reaction.h.

## ◆ m_explicit_type

bool m_explicit_type = false
| protected

Flag indicating that serialization uses explicit type.

Definition at line 196 of file Reaction.h.

## ◆ m_from_composition

bool m_from_composition = false
| protected

Flag indicating that object was instantiated from reactant/product compositions.

Definition at line 199 of file Reaction.h.

## ◆ m_rate

shared_ptr<ReactionRate> m_rate
| protected

Reaction rate used by generic reactions.

Definition at line 202 of file Reaction.h.

## ◆ m_third_body

shared_ptr<ThirdBody> m_third_body
| protected

Relative efficiencies of third-body species in enhancing the reaction rate (if applicable)

Definition at line 206 of file Reaction.h.

The documentation for this class was generated from the following files:

- Reaction.h
- Reaction.cpp