Cantera 2.6.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Reaction Class Reference

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]
Collaboration diagram for Reaction:
[legend]

Public Member Functions

 Reaction (const Composition &reactants, const Composition &products, shared_ptr< ReactionRate > rate={})
 
 Reaction (const AnyMap &node, const Kinetics &kin)
 Construct a Reaction and it's corresponding ReactionRate based on AnyMap (YAML) input. More...
 
 Reaction (int type)
 
 Reaction (int type, const Composition &reactants, const Composition &products)
 
virtual std::string reactantString () const
 The reactant side of the chemical equation for this reaction. More...
 
virtual std::string productString () const
 The product side of the chemical equation for this reaction. More...
 
std::string equation () const
 The chemical equation for this reaction. More...
 
virtual void setEquation (const std::string &equation, const Kinetics *kin=0)
 Set the reactants and products based on the reaction equation. More...
 
virtual std::string type () const
 The type of reaction. More...
 
virtual void calculateRateCoeffUnits (const Kinetics &kin)
 Calculate the units of the rate constant. More...
 
UnitStack calculateRateCoeffUnits3 (const Kinetics &kin)
 Calculate the units of the rate constant. More...
 
virtual void validate ()
 Ensure that the rate constant and other parameters for this reaction are valid. More...
 
virtual void validate (Kinetics &kin)
 Perform validation checks that need access to a complete Kinetics objects, for. More...
 
AnyMap parameters (bool withInput=true) const
 Return the parameters such that an identical Reaction could be reconstructed using the newReaction() function. More...
 
virtual void setParameters (const AnyMap &node, const Kinetics &kin)
 Set up reaction based on AnyMap node More...
 
bool valid () const
 Get validity flag of reaction. More...
 
void setValid (bool valid)
 Set validity flag of reaction. More...
 
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). More...
 
bool checkSpecies (const Kinetics &kin) const
 Verify that all species involved in the reaction are defined in the Kinetics object. More...
 
bool usesElectrochemistry (const Kinetics &kin) const
 Check whether reaction uses electrochemistry. More...
 
shared_ptr< ReactionRaterate ()
 Get reaction rate pointer. More...
 
void setRate (shared_ptr< ReactionRate > rate)
 Set reaction rate pointer. More...
 
shared_ptr< ThirdBodythirdBody ()
 Get pointer to third-body. More...
 
bool usesLegacy () const
 Indicate whether object uses legacy framework. More...
 

Public Attributes

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

Protected Member Functions

virtual void getParameters (AnyMap &reactionNode) const
 Store the parameters of a Reaction needed to reconstruct an identical object using the newReaction(AnyMap&, Kinetics&) function. More...
 
virtual std::pair< std::vector< std::string >, bool > undeclaredThirdBodies (const Kinetics &kin) const
 

Protected Attributes

bool m_valid
 Flag indicating whether reaction is set up correctly. More...
 
shared_ptr< ReactionRatem_rate
 Reaction rate used by generic reactions. More...
 
shared_ptr< ThirdBodym_third_body
 Relative efficiencies of third-body species in enhancing the reaction rate (if applicable) More...
 

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 32 of file Reaction.h.

Constructor & Destructor Documentation

◆ Reaction() [1/5]

Reaction ( )

Definition at line 31 of file Reaction.cpp.

◆ Reaction() [2/5]

Reaction ( const Composition reactants,
const Composition products,
shared_ptr< ReactionRate rate = {} 
)

Definition at line 42 of file Reaction.cpp.

◆ Reaction() [3/5]

Reaction ( const AnyMap node,
const Kinetics kin 
)

◆ Reaction() [4/5]

Reaction ( int  type)
explicit
Deprecated:
To be removed after Cantera 2.6.

Definition at line 93 of file Reaction.cpp.

◆ Reaction() [5/5]

Reaction ( int  type,
const Composition reactants,
const Composition products 
)
Deprecated:
To be removed after Cantera 2.6.

Definition at line 107 of file Reaction.cpp.

◆ ~Reaction()

virtual ~Reaction ( )
inlinevirtual

Definition at line 48 of file Reaction.h.

Member Function Documentation

◆ reactantString()

std::string reactantString ( ) const
virtual

◆ productString()

std::string productString ( ) const
virtual

◆ equation()

std::string equation ( ) const

◆ setEquation()

void setEquation ( const std::string &  equation,
const Kinetics kin = 0 
)
virtual

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.

Reimplemented in FalloffReaction3, and ThreeBodyReaction3.

Definition at line 305 of file Reaction.cpp.

References Reaction::equation(), Reaction::input, and Cantera::parseReactionEquation().

Referenced by FalloffReaction3::setEquation(), ThreeBodyReaction3::setEquation(), and Reaction::setParameters().

◆ type()

std::string type ( ) const
virtual

◆ calculateRateCoeffUnits()

void calculateRateCoeffUnits ( const Kinetics kin)
virtual

◆ calculateRateCoeffUnits3()

UnitStack calculateRateCoeffUnits3 ( 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 345 of file Reaction.cpp.

References Reaction::m_third_body, Reaction::orders, Reaction::rate_units, Reaction::reactants, Kinetics::reactionPhaseIndex(), Kinetics::speciesPhase(), Kinetics::thermo(), and Reaction::valid().

Referenced by Reaction::Reaction().

◆ validate() [1/2]

void validate ( )
virtual

◆ validate() [2/2]

virtual void validate ( Kinetics kin)
inlinevirtual

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

Reimplemented in ElementaryReaction2, FalloffReaction2, PlogReaction2, InterfaceReaction2, and InterfaceReaction2.

Definition at line 82 of file Reaction.h.

References Reaction::equation(), and Reaction::m_rate.

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

References AnyMap::addOrderingRules(), Reaction::getParameters(), Reaction::input, and AnyMap::update().

◆ setParameters()

void setParameters ( const AnyMap node,
const Kinetics kin 
)
virtual

◆ valid()

bool valid ( ) const
inline

Get validity flag of reaction.

Definition at line 100 of file Reaction.h.

References Reaction::m_valid.

Referenced by Reaction::calculateRateCoeffUnits(), Reaction::calculateRateCoeffUnits3(), and Reaction::setValid().

◆ setValid()

void setValid ( bool  valid)
inline

Set validity flag of reaction.

Definition at line 105 of file Reaction.h.

References Reaction::m_valid, and Reaction::valid().

Referenced by Reaction::setParameters().

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

References Phase::elementName(), Reaction::equation(), Reaction::input, Phase::nAtoms(), Phase::nDim(), Phase::nElements(), Cantera::npos, Reaction::products, Reaction::reactants, Kinetics::reactionPhaseIndex(), Phase::speciesIndex(), Kinetics::speciesPhase(), Kinetics::surfacePhaseIndex(), and Kinetics::thermo().

Referenced by Reaction::checkSpecies().

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

References Reaction::checkBalance(), Reaction::equation(), AnyMap::hasKey(), Reaction::input, Reaction::orders, Reaction::products, Reaction::reactants, Kinetics::skipUndeclaredSpecies(), Kinetics::skipUndeclaredThirdBodies(), and Reaction::undeclaredThirdBodies().

◆ usesElectrochemistry()

bool usesElectrochemistry ( const Kinetics kin) const

◆ rate()

shared_ptr< ReactionRate > rate ( )
inline

Get reaction rate pointer.

Definition at line 171 of file Reaction.h.

References Reaction::m_rate.

Referenced by Reaction::setRate().

◆ setRate()

void setRate ( shared_ptr< ReactionRate rate)

Set reaction rate pointer.

Definition at line 243 of file Reaction.cpp.

References Reaction::input, Reaction::m_rate, Reaction::products, Reaction::rate(), Reaction::reactants, and Cantera::warn_deprecated().

Referenced by Reaction::Reaction().

◆ thirdBody()

shared_ptr< ThirdBody > thirdBody ( )
inline

Get pointer to third-body.

Definition at line 179 of file Reaction.h.

References Reaction::m_third_body.

◆ usesLegacy()

bool usesLegacy ( ) const
inline

Indicate whether object uses legacy framework.

Definition at line 184 of file Reaction.h.

References Reaction::m_rate.

Referenced by Reaction::validate().

◆ getParameters()

void getParameters ( AnyMap reactionNode) const
protectedvirtual

◆ undeclaredThirdBodies()

std::pair< std::vector< std::string >, bool > undeclaredThirdBodies ( const Kinetics kin) const
protectedvirtual

Helper function returning vector of undeclared third body species and a boolean expression indicating whether the third body is specified. The function is used by the checkSpecies method and only needed as long as there is no unified approach to handle third body collision partners.

Parameters
kinKinetics object

Reimplemented in ThreeBodyReaction2, and FalloffReaction2.

Definition at line 398 of file Reaction.cpp.

References Reaction::m_third_body.

Referenced by Reaction::checkSpecies().

Member Data Documentation

◆ reaction_type

int reaction_type

Type of the reaction.

The valid types are listed in the file, reaction_defs.h, with constants ending in RXN.

Deprecated:
To be removed in Cantera 2.6. Superseded by Reaction::type().

Definition at line 132 of file Reaction.h.

◆ reactants

Composition reactants

◆ products

Composition products

◆ 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 143 of file Reaction.h.

Referenced by InterfaceKinetics::buildSurfaceArrhenius(), Reaction::calculateRateCoeffUnits(), Reaction::calculateRateCoeffUnits3(), Reaction::checkSpecies(), Reaction::getParameters(), StickingCoverage::setContext(), Reaction::setParameters(), and Reaction::validate().

◆ id

std::string id

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

Definition at line 147 of file Reaction.h.

◆ reversible

bool reversible

True if the current reaction is reversible. False otherwise.

Definition at line 150 of file Reaction.h.

Referenced by Reaction::equation(), TwoTempPlasmaRate::setContext(), and Reaction::validate().

◆ duplicate

bool duplicate

True if the current reaction is marked as duplicate.

Definition at line 153 of file Reaction.h.

Referenced by Reaction::getParameters(), and Reaction::setParameters().

◆ allow_nonreactant_orders

bool allow_nonreactant_orders

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

Default is false.

Definition at line 157 of file Reaction.h.

Referenced by Reaction::getParameters(), Reaction::setParameters(), and Reaction::validate().

◆ allow_negative_orders

bool allow_negative_orders

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

Definition at line 160 of file Reaction.h.

Referenced by Reaction::getParameters(), Reaction::setParameters(), and Reaction::validate().

◆ input

AnyMap input

◆ rate_units

Units rate_units

◆ m_valid

bool m_valid
protected

Flag indicating whether reaction is set up correctly.

Definition at line 195 of file Reaction.h.

Referenced by Reaction::setValid(), and Reaction::valid().

◆ m_rate

shared_ptr<ReactionRate> m_rate
protected

◆ m_third_body

shared_ptr<ThirdBody> m_third_body
protected

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