Cantera  3.1.0
Loading...
Searching...
No Matches
ReactionRate Class Referenceabstract

Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to access reaction rate objects. More...

#include <ReactionRate.h>

Inheritance diagram for ReactionRate:
[legend]

Detailed Description

Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to access reaction rate objects.

In addition to the pure virtual methods declared in this class, complete derived classes must implement the method evalFromStruct(const DataType& shared_data), where DataType is a container for parameters needed to evaluate reactions of that type. In addition, derived classes may also implement the method updateFromStruct(const DataType& shared_data) to update buffered data that is specific to a given reaction rate.

The calculation of derivatives (or Jacobians) relies on the following methods:

  • Derived classes may implement the method ddTScaledFromStruct(const DataType& shared_data) for an analytical derivative with respect to temperature.
  • Associated DataType containers may overload the method perturbTemperature(double deltaT), which is used for the calculation of numerical derivatives with respect to temperature if an analytic implementation is not available.
  • For reaction rate constants that depend on pressure or third-body collision partners, associated DataType containers should implement the methods perturbPressure(double deltaP) and/or perturbThirdBodies(double deltaM), which allow for the calculation of numerical derivatives.
  • For additional information, refer to the Kinetics Derivatives documentation.

Definition at line 48 of file ReactionRate.h.

Public Member Functions

 ReactionRate (const ReactionRate &other)
 
ReactionRateoperator= (const ReactionRate &other)
 
virtual unique_ptr< MultiRateBasenewMultiRate () const
 Create a rate evaluator for reactions of a particular derived type.
 
virtual const string type () const =0
 String identifying reaction rate specialization.
 
virtual const string subType () const
 String identifying sub-type of reaction rate specialization.
 
virtual void setParameters (const AnyMap &node, const UnitStack &units)
 Set parameters.
 
AnyMap parameters () const
 Return the parameters such that an identical Reaction could be reconstructed using the newReaction() function.
 
const UnitsconversionUnits () const
 Get the units for converting the leading term in the reaction rate expression.
 
virtual void setRateUnits (const UnitStack &rate_units)
 Set the units of the reaction rate expression.
 
virtual void check (const string &equation)
 Check basic syntax and settings of reaction rate expression.
 
virtual void validate (const string &equation, const Kinetics &kin)
 Validate the reaction rate expression.
 
size_t rateIndex () const
 Reaction rate index within kinetics evaluator.
 
void setRateIndex (size_t idx)
 Set reaction rate index within kinetics evaluator.
 
virtual void setContext (const Reaction &rxn, const Kinetics &kin)
 Set context of reaction rate evaluation.
 
double eval (double T)
 Evaluate reaction rate based on temperature.
 
double eval (double T, double extra)
 Evaluate reaction rate based on temperature and an extra parameter.
 
double eval (double T, const vector< double > &extra)
 Evaluate reaction rate based on temperature and an extra vector parameter.
 
bool valid () const
 Get flag indicating whether reaction rate is set up correctly.
 
bool compositionDependent ()
 Boolean indicating whether rate has compositional dependence.
 
void setCompositionDependence (bool comp_dep)
 Set rate compositional dependence.
 

Protected Member Functions

virtual void getParameters (AnyMap &node) const
 Get parameters.
 

Protected Attributes

AnyMap m_input
 Input data used for specific models.
 
size_t m_rate_index = npos
 Index of reaction rate within kinetics evaluator.
 
bool m_valid = false
 Flag indicating whether reaction rate is set up correctly.
 
bool m_composition_dependent_rate = false
 Flag indicating composition dependent rate.
 
Units m_conversion_units {0.}
 Units of the leading term in the reaction rate expression.
 

Private Member Functions

MultiRateBase_evaluator ()
 Return an object that be used to evaluate the rate by converting general input such as temperature and pressure into the DataType struct that is particular to the rate model.
 

Private Attributes

unique_ptr< MultiRateBasem_evaluator
 

Constructor & Destructor Documentation

◆ ReactionRate() [1/2]

ReactionRate ( )
inline

Definition at line 51 of file ReactionRate.h.

◆ ReactionRate() [2/2]

ReactionRate ( const ReactionRate other)
inline

Definition at line 55 of file ReactionRate.h.

Member Function Documentation

◆ operator=()

ReactionRate & operator= ( const ReactionRate other)
inline

Definition at line 62 of file ReactionRate.h.

◆ newMultiRate()

virtual unique_ptr< MultiRateBase > newMultiRate ( ) const
inlinevirtual

Create a rate evaluator for reactions of a particular derived type.

Derived classes usually implement this as:

unique_ptr<MultiRateBase> newMultiRate() const override {
return make_unique<MultiRate<RateType, DataType>>();
virtual unique_ptr< MultiRateBase > newMultiRate() const
Create a rate evaluator for reactions of a particular derived type.

where RateType is the derived class name and DataType is the corresponding container for parameters needed to evaluate reactions of that type.

Reimplemented in ArrheniusRate, BlowersMaselRate, ChebyshevRate, CustomFunc1Rate, ElectronCollisionPlasmaRate, LindemannRate, TroeRate, SriRate, TsangRate, LinearBurkeRate, PlogRate, ReactionRateDelegator, and TwoTempPlasmaRate.

Definition at line 85 of file ReactionRate.h.

◆ type()

virtual const string type ( ) const
pure virtual

◆ subType()

virtual const string subType ( ) const
inlinevirtual

String identifying sub-type of reaction rate specialization.

Reimplemented in LindemannRate, TroeRate, SriRate, and TsangRate.

Definition at line 94 of file ReactionRate.h.

◆ setParameters()

virtual void setParameters ( const AnyMap node,
const UnitStack units 
)
inlinevirtual

Set parameters.

Parameters
nodeAnyMap object containing reaction rate specification
unitsunit definitions specific to rate information

Reimplemented in ArrheniusBase, ChebyshevRate, FalloffRate, TroeRate, SriRate, TsangRate, LinearBurkeRate, PlogRate, ElectronCollisionPlasmaRate, and ReactionRateDelegator.

Definition at line 101 of file ReactionRate.h.

◆ parameters()

AnyMap parameters ( ) const
inline

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.

Definition at line 109 of file ReactionRate.h.

◆ conversionUnits()

const Units & conversionUnits ( ) const
inline

Get the units for converting the leading term in the reaction rate expression.

These units are often the same as the units of the rate expression itself, but not always; sticking coefficients are a notable exception.

Since
New in Cantera 3.0

Definition at line 121 of file ReactionRate.h.

◆ setRateUnits()

virtual void setRateUnits ( const UnitStack rate_units)
inlinevirtual

Set the units of the reaction rate expression.

Used to determine the units that should be used for converting terms in the reaction rate expression, which often have the same units (for example, the Arrhenius pre-exponential) but may also be different (for example, sticking coefficients).

Since
New in Cantera 3.0

Reimplemented in ArrheniusBase.

Definition at line 132 of file ReactionRate.h.

◆ check()

virtual void check ( const string &  equation)
inlinevirtual

Check basic syntax and settings of reaction rate expression.

Reimplemented in ArrheniusBase, and FalloffRate.

Definition at line 141 of file ReactionRate.h.

◆ validate()

virtual void validate ( const string &  equation,
const Kinetics kin 
)
inlinevirtual

Validate the reaction rate expression.

Reimplemented in ArrheniusBase, ChebyshevRate, CustomFunc1Rate, FalloffRate, LinearBurkeRate, PlogRate, and ReactionRateDelegator.

Definition at line 144 of file ReactionRate.h.

◆ rateIndex()

size_t rateIndex ( ) const
inline

Reaction rate index within kinetics evaluator.

Definition at line 147 of file ReactionRate.h.

◆ setRateIndex()

void setRateIndex ( size_t  idx)
inline

Set reaction rate index within kinetics evaluator.

Definition at line 152 of file ReactionRate.h.

◆ setContext()

virtual void setContext ( const Reaction rxn,
const Kinetics kin 
)
inlinevirtual

Set context of reaction rate evaluation.

Parameters
rxnReaction object associated with rate
kinKinetics object used for rate evaluation This method allows for passing of information specific to the associated reaction when a ReactionRate object is added a MultiRate reaction evaluator.

Reimplemented in BlowersMaselRate, ElectronCollisionPlasmaRate, LinearBurkeRate, and TwoTempPlasmaRate.

Definition at line 161 of file ReactionRate.h.

◆ eval() [1/3]

double eval ( double  T)
inline

Evaluate reaction rate based on temperature.

Parameters
Ttemperature [K] Used in conjunction with MultiRateBase::evalSingle / ReactionRate::eval. This method allows for testing of a reaction rate expression outside of Kinetics reaction rate evaluators.

Definition at line 169 of file ReactionRate.h.

◆ eval() [2/3]

double eval ( double  T,
double  extra 
)
inline

Evaluate reaction rate based on temperature and an extra parameter.

Specific rate parameterizations may require an additional parameter, which is specific to the derived ReactionRate object.

Parameters
Ttemperature [K]
extraextra parameter used by parameterization Used in conjunction with MultiRateBase::evalSingle / ReactionRate::eval. This method allows for testing of a reaction rate expression outside of Kinetics reaction rate evaluators.

Definition at line 182 of file ReactionRate.h.

◆ eval() [3/3]

double eval ( double  T,
const vector< double > &  extra 
)
inline

Evaluate reaction rate based on temperature and an extra vector parameter.

Specific rate parameterizations may require additional parameters, which are specific to the derived ReactionRate object.

Parameters
Ttemperature [K]
extraextra vector parameter used by parameterization Used in conjunction with MultiRateBase::evalSingle / ReactionRate::eval. This method allows for testing of a reaction rate expression outside of Kinetics reaction rate evaluators.
Warning
This method is an experimental part of the Cantera API and may be changed or removed without notice.

Definition at line 197 of file ReactionRate.h.

◆ valid()

bool valid ( ) const
inline

Get flag indicating whether reaction rate is set up correctly.

Definition at line 203 of file ReactionRate.h.

◆ compositionDependent()

bool compositionDependent ( )
inline

Boolean indicating whether rate has compositional dependence.

Since
New in Cantera 3.0

Definition at line 209 of file ReactionRate.h.

◆ setCompositionDependence()

void setCompositionDependence ( bool  comp_dep)
inline

Set rate compositional dependence.

Since
New in Cantera 3.0

Definition at line 215 of file ReactionRate.h.

◆ getParameters()

virtual void getParameters ( AnyMap node) const
inlineprotectedvirtual

Get parameters.

Parameters
nodeAnyMap containing rate information Store the parameters of a ReactionRate needed to reconstruct an identical object. Does not include user-defined fields available in the m_input map.

Reimplemented in CustomFunc1Rate, ArrheniusBase, ElectronCollisionPlasmaRate, FalloffRate, TroeRate, SriRate, TsangRate, ReactionRateDelegator, ChebyshevRate, LinearBurkeRate, and PlogRate.

Definition at line 224 of file ReactionRate.h.

◆ _evaluator()

MultiRateBase & _evaluator ( )
inlineprivate

Return an object that be used to evaluate the rate by converting general input such as temperature and pressure into the DataType struct that is particular to the rate model.

Definition at line 248 of file ReactionRate.h.

Member Data Documentation

◆ m_input

AnyMap m_input
protected

Input data used for specific models.

Definition at line 230 of file ReactionRate.h.

◆ m_rate_index

size_t m_rate_index = npos
protected

Index of reaction rate within kinetics evaluator.

Definition at line 233 of file ReactionRate.h.

◆ m_valid

bool m_valid = false
protected

Flag indicating whether reaction rate is set up correctly.

Definition at line 236 of file ReactionRate.h.

◆ m_composition_dependent_rate

bool m_composition_dependent_rate = false
protected

Flag indicating composition dependent rate.

Definition at line 239 of file ReactionRate.h.

◆ m_conversion_units

Units m_conversion_units {0.}
protected

Units of the leading term in the reaction rate expression.

Definition at line 242 of file ReactionRate.h.

◆ m_evaluator

unique_ptr<MultiRateBase> m_evaluator
private

Definition at line 255 of file ReactionRate.h.


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