Cantera 2.6.0
|
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>
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< ReactionRate > | rate () |
Get reaction rate pointer. More... | |
void | setRate (shared_ptr< ReactionRate > rate) |
Set reaction rate pointer. More... | |
shared_ptr< ThirdBody > | thirdBody () |
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< ReactionRate > | m_rate |
Reaction rate used by generic reactions. More... | |
shared_ptr< ThirdBody > | m_third_body |
Relative efficiencies of third-body species in enhancing the reaction rate (if applicable) More... | |
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.
Reaction | ( | ) |
Definition at line 31 of file Reaction.cpp.
Reaction | ( | const Composition & | reactants, |
const Composition & | products, | ||
shared_ptr< ReactionRate > | rate = {} |
||
) |
Definition at line 42 of file Reaction.cpp.
Construct a Reaction and it's corresponding ReactionRate based on AnyMap (YAML) input.
Definition at line 58 of file Reaction.cpp.
References Reaction::calculateRateCoeffUnits3(), AnyMap::hasKey(), Phase::nDim(), Cantera::newReactionRate(), Kinetics::nPhases(), Kinetics::reactionPhaseIndex(), Reaction::setParameters(), Reaction::setRate(), Kinetics::thermo(), and Reaction::type().
|
explicit |
Definition at line 93 of file Reaction.cpp.
Reaction | ( | int | type, |
const Composition & | reactants, | ||
const Composition & | products | ||
) |
Definition at line 107 of file Reaction.cpp.
|
inlinevirtual |
Definition at line 48 of file Reaction.h.
|
virtual |
The reactant side of the chemical equation for this reaction.
Reimplemented in ThreeBodyReaction2, FalloffReaction2, ThreeBodyReaction3, and FalloffReaction3.
Definition at line 266 of file Reaction.cpp.
References Reaction::reactants.
Referenced by Reaction::equation(), ThreeBodyReaction2::reactantString(), FalloffReaction2::reactantString(), ThreeBodyReaction3::reactantString(), and FalloffReaction3::reactantString().
|
virtual |
The product side of the chemical equation for this reaction.
Reimplemented in ThreeBodyReaction2, FalloffReaction2, ThreeBodyReaction3, and FalloffReaction3.
Definition at line 281 of file Reaction.cpp.
References Reaction::products.
Referenced by Reaction::equation(), ThreeBodyReaction2::productString(), FalloffReaction2::productString(), ThreeBodyReaction3::productString(), and FalloffReaction3::productString().
std::string equation | ( | ) | const |
The chemical equation for this reaction.
Definition at line 296 of file Reaction.cpp.
References Reaction::productString(), Reaction::reactantString(), and Reaction::reversible.
Referenced by InterfaceKinetics::buildSurfaceArrhenius(), Reaction::checkBalance(), Reaction::checkSpecies(), Reaction::getParameters(), StickingCoverage::setContext(), FalloffReaction3::setEquation(), Reaction::setEquation(), ThreeBodyReaction3::setEquation(), ElementaryReaction2::validate(), FalloffReaction2::validate(), PlogReaction2::validate(), and Reaction::validate().
|
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().
|
virtual |
The type of reaction.
Reimplemented in ElementaryReaction2, ThreeBodyReaction2, FalloffReaction2, ChemicallyActivatedReaction2, PlogReaction2, ChebyshevReaction2, InterfaceReaction2, ThreeBodyReaction3, FalloffReaction3, and CustomFunc1Reaction.
Definition at line 310 of file Reaction.cpp.
Referenced by Reaction::getParameters(), Reaction::Reaction(), and ElementaryReaction2::validate().
|
virtual |
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.
Reimplemented in ThreeBodyReaction2, FalloffReaction2, ChemicallyActivatedReaction2, and InterfaceReaction2.
Definition at line 315 of file Reaction.cpp.
References Reaction::orders, Units::pow(), Reaction::rate_units, Reaction::reactants, Kinetics::reactionPhaseIndex(), Kinetics::speciesPhase(), ThermoPhase::standardConcentrationUnits(), Kinetics::thermo(), and Reaction::valid().
Referenced by ThreeBodyReaction2::calculateRateCoeffUnits(), FalloffReaction2::calculateRateCoeffUnits(), ChemicallyActivatedReaction2::calculateRateCoeffUnits(), and InterfaceReaction2::calculateRateCoeffUnits().
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().
|
virtual |
Ensure that the rate constant and other parameters for this reaction are valid.
Reimplemented in ElementaryReaction2, ElementaryReaction2, FalloffReaction2, FalloffReaction2, PlogReaction2, PlogReaction2, and InterfaceReaction2.
Definition at line 124 of file Reaction.cpp.
References Reaction::allow_negative_orders, Reaction::allow_nonreactant_orders, Reaction::equation(), Reaction::input, Reaction::m_rate, Reaction::orders, Reaction::reactants, Reaction::reversible, and Reaction::usesLegacy().
Referenced by ElementaryReaction2::validate(), FalloffReaction2::validate(), and PlogReaction2::validate().
|
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.
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.
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 162 of file Reaction.cpp.
References AnyMap::addOrderingRules(), Reaction::getParameters(), Reaction::input, and AnyMap::update().
Set up reaction based on AnyMap node
Reimplemented in ThreeBodyReaction3, and FalloffReaction3.
Definition at line 216 of file Reaction.cpp.
References Reaction::allow_negative_orders, Reaction::allow_nonreactant_orders, AnyMap::copyMetadata(), Reaction::duplicate, AnyMap::empty(), AnyMap::getBool(), AnyMap::getString(), AnyMap::hasKey(), Reaction::input, Kinetics::kineticsSpeciesIndex(), Cantera::npos, Reaction::orders, Reaction::setEquation(), and Reaction::setValid().
Referenced by Reaction::Reaction(), ThreeBodyReaction3::setParameters(), and FalloffReaction3::setParameters().
|
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().
|
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().
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.
kin | Kinetics 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().
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.
kin | Kinetics 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().
bool usesElectrochemistry | ( | const Kinetics & | kin | ) | const |
Check whether reaction uses electrochemistry.
kin | Kinetics object |
Definition at line 540 of file Reaction.cpp.
References Phase::charge(), Kinetics::kineticsSpeciesIndex(), Kinetics::nPhases(), Reaction::products, Reaction::reactants, Phase::speciesIndex(), Kinetics::speciesPhaseIndex(), and Kinetics::thermo().
Referenced by InterfaceRateBase::setContext().
|
inline |
Get reaction rate pointer.
Definition at line 171 of file Reaction.h.
References Reaction::m_rate.
Referenced by Reaction::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().
|
inline |
Get pointer to third-body.
Definition at line 179 of file Reaction.h.
References Reaction::m_third_body.
|
inline |
Indicate whether object uses legacy framework.
Definition at line 184 of file Reaction.h.
References Reaction::m_rate.
Referenced by Reaction::validate().
|
protectedvirtual |
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.
Reimplemented in ElementaryReaction2, ThreeBodyReaction2, FalloffReaction2, ChemicallyActivatedReaction2, PlogReaction2, ChebyshevReaction2, InterfaceReaction2, ElectrochemicalReaction2, ThreeBodyReaction3, and FalloffReaction3.
Definition at line 184 of file Reaction.cpp.
References Reaction::allow_negative_orders, Reaction::allow_nonreactant_orders, Reaction::duplicate, Reaction::equation(), AnyMap::erase(), AnyMap::hasKey(), Reaction::m_rate, Reaction::orders, Reaction::type(), and AnyMap::update().
Referenced by ElementaryReaction2::getParameters(), FalloffReaction2::getParameters(), PlogReaction2::getParameters(), ChebyshevReaction2::getParameters(), ThreeBodyReaction3::getParameters(), FalloffReaction3::getParameters(), and Reaction::parameters().
|
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.
kin | Kinetics object |
Reimplemented in ThreeBodyReaction2, and FalloffReaction2.
Definition at line 398 of file Reaction.cpp.
References Reaction::m_third_body.
Referenced by Reaction::checkSpecies().
int reaction_type |
Type of the reaction.
The valid types are listed in the file, reaction_defs.h, with constants ending in RXN
.
Definition at line 132 of file Reaction.h.
Composition reactants |
Reactant species and stoichiometric coefficients.
Definition at line 135 of file Reaction.h.
Referenced by InterfaceKinetics::buildSurfaceArrhenius(), Reaction::calculateRateCoeffUnits(), ThreeBodyReaction2::calculateRateCoeffUnits(), Reaction::calculateRateCoeffUnits3(), Reaction::checkBalance(), Reaction::checkSpecies(), Reaction::reactantString(), InterfaceRateBase::setContext(), StickingCoverage::setContext(), BlowersMaselRate::setContext(), FalloffReaction3::setEquation(), ThreeBodyReaction3::setEquation(), Reaction::setRate(), Reaction::usesElectrochemistry(), and Reaction::validate().
Composition products |
Product species and stoichiometric coefficients.
Definition at line 138 of file Reaction.h.
Referenced by ThreeBodyReaction2::calculateRateCoeffUnits(), Reaction::checkBalance(), Reaction::checkSpecies(), Reaction::productString(), InterfaceRateBase::setContext(), BlowersMaselRate::setContext(), FalloffReaction3::setEquation(), ThreeBodyReaction3::setEquation(), Reaction::setRate(), and Reaction::usesElectrochemistry().
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().
std::string id |
An identification string for the reaction, used in some filtering operations.
Definition at line 147 of file Reaction.h.
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().
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().
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().
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().
AnyMap input |
Input data used for specific models.
Definition at line 163 of file Reaction.h.
Referenced by InterfaceKinetics::buildSurfaceArrhenius(), InterfaceReaction2::calculateRateCoeffUnits(), Reaction::checkBalance(), Reaction::checkSpecies(), Reaction::parameters(), StickingCoverage::setContext(), TwoTempPlasmaRate::setContext(), FalloffReaction3::setEquation(), Reaction::setEquation(), ThreeBodyReaction3::setEquation(), Reaction::setParameters(), Reaction::setRate(), Reaction::validate(), ElementaryReaction2::validate(), and FalloffReaction2::validate().
Units rate_units |
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 168 of file Reaction.h.
Referenced by Reaction::calculateRateCoeffUnits(), ThreeBodyReaction2::calculateRateCoeffUnits(), FalloffReaction2::calculateRateCoeffUnits(), ChemicallyActivatedReaction2::calculateRateCoeffUnits(), InterfaceReaction2::calculateRateCoeffUnits(), Reaction::calculateRateCoeffUnits3(), ElementaryReaction2::getParameters(), FalloffReaction2::getParameters(), PlogReaction2::getParameters(), and ChebyshevReaction2::getParameters().
|
protected |
Flag indicating whether reaction is set up correctly.
Definition at line 195 of file Reaction.h.
Referenced by Reaction::setValid(), and Reaction::valid().
|
protected |
Reaction rate used by generic reactions.
Definition at line 206 of file Reaction.h.
Referenced by Reaction::getParameters(), Reaction::rate(), Reaction::setRate(), FalloffReaction3::type(), Reaction::usesLegacy(), and Reaction::validate().
|
protected |
Relative efficiencies of third-body species in enhancing the reaction rate (if applicable)
Definition at line 210 of file Reaction.h.
Referenced by Reaction::calculateRateCoeffUnits3(), ThreeBodyReaction3::getParameters(), FalloffReaction3::getParameters(), ThreeBodyReaction3::productString(), FalloffReaction3::productString(), ThreeBodyReaction3::reactantString(), FalloffReaction3::reactantString(), FalloffReaction3::setEquation(), ThreeBodyReaction3::setParameters(), FalloffReaction3::setParameters(), Reaction::thirdBody(), and Reaction::undeclaredThirdBodies().