Cantera  3.1.0a1
Loading...
Searching...
No Matches

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>

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 24 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.
 
void check ()
 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< ReactionRaterate ()
 Get reaction rate pointer.
 
void setRate (shared_ptr< ReactionRate > rate)
 Set reaction rate pointer.
 
shared_ptr< ThirdBodythirdBody ()
 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< ReactionRatem_rate
 Reaction rate used by generic reactions.
 
shared_ptr< ThirdBodym_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 27 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 27 of file Reaction.cpp.

◆ Reaction() [3/4]

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

Definition at line 69 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 81 of file Reaction.cpp.

◆ ~Reaction()

virtual ~Reaction ( )
inlinevirtual

Definition at line 37 of file Reaction.h.

Member Function Documentation

◆ reactantString()

string reactantString ( ) const

The reactant side of the chemical equation for this reaction.

Definition at line 309 of file Reaction.cpp.

◆ productString()

string productString ( ) const

The product side of the chemical equation for this reaction.

Definition at line 327 of file Reaction.cpp.

◆ equation()

string equation ( ) const

The chemical equation for this reaction.

Definition at line 345 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 354 of file Reaction.cpp.

◆ type()

string type ( ) const

The type of reaction, including reaction rate information.

Definition at line 504 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 523 of file Reaction.cpp.

◆ 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 123 of file Reaction.cpp.

◆ validate()

void validate ( Kinetics kin)
inline

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

Definition at line 66 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
withInputIf 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 159 of file Reaction.cpp.

◆ setParameters()

void setParameters ( const AnyMap node,
const Kinetics kin 
)

Set up reaction based on AnyMap node

Definition at line 229 of file Reaction.cpp.

◆ valid()

bool valid ( ) const
inline

Get validity flag of reaction.

Definition at line 84 of file Reaction.h.

◆ setValid()

void setValid ( bool  valid)
inline

Set validity flag of reaction.

Definition at line 89 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
kinKinetics object

Definition at line 576 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
kinKinetics object

Definition at line 643 of file Reaction.cpp.

◆ usesElectrochemistry()

bool usesElectrochemistry ( const Kinetics kin) const

Check whether reaction uses electrochemistry.

Parameters
kinKinetics object

Definition at line 687 of file Reaction.cpp.

◆ rate()

shared_ptr< ReactionRate > rate ( )
inline

Get reaction rate pointer.

Definition at line 147 of file Reaction.h.

◆ setRate()

void setRate ( shared_ptr< ReactionRate rate)

Set reaction rate pointer.

Definition at line 267 of file Reaction.cpp.

◆ thirdBody()

shared_ptr< ThirdBody > thirdBody ( )
inline

Get pointer to third-body handler.

Definition at line 155 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 161 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 181 of file Reaction.cpp.

Member Data Documentation

◆ reactants

Composition reactants

Reactant species and stoichiometric coefficients.

Definition at line 111 of file Reaction.h.

◆ products

Composition products

Product species and stoichiometric coefficients.

Definition at line 114 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 119 of file Reaction.h.

◆ id

string id

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

Definition at line 123 of file Reaction.h.

◆ reversible

bool reversible = true

True if the current reaction is reversible. False otherwise.

Definition at line 126 of file Reaction.h.

◆ duplicate

bool duplicate = false

True if the current reaction is marked as duplicate.

Definition at line 129 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 133 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 136 of file Reaction.h.

◆ input

AnyMap input

Input data used for specific models.

Definition at line 139 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 144 of file Reaction.h.

◆ m_valid

bool m_valid = true
protected

Flag indicating whether reaction is set up correctly.

Definition at line 172 of file Reaction.h.

◆ m_explicit_type

bool m_explicit_type = false
protected

Flag indicating that serialization uses explicit type.

Definition at line 175 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 178 of file Reaction.h.

◆ m_rate

shared_ptr<ReactionRate> m_rate
protected

Reaction rate used by generic reactions.

Definition at line 181 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 185 of file Reaction.h.


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