Cantera 2.6.0

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
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]
Collaboration diagram for ReactionRate:
[legend]

## Public Member Functions
| ReactionRate (const ReactionRate &other)
ReactionRate & | operator= (const ReactionRate &other)
virtual unique_ptr< MultiRateBase > | newMultiRate () const
| Create a rate evaluator for reactions of a particular derived type. More...
virtual const std::string | type () const =0
| String identifying reaction rate specialization. More...
virtual void | setParameters (const AnyMap &node, const UnitStack &units)
| Set parameters. More...
AnyMap | parameters () const
| Return the parameters such that an identical Reaction could be reconstructed using the newReaction() function. More...
virtual void | check (const std::string &equation, const AnyMap &node)
| Check basic syntax and settings of reaction rate expression. More...
virtual void | validate (const std::string &equation, const Kinetics &kin)
| Validate the reaction rate expression. More...
virtual void | validate (const std::string &equation)
| Validate the reaction rate expression (legacy call) More...
size_t | rateIndex () const
| Reaction rate index within kinetics evaluator. More...
void | setRateIndex (size_t idx)
| Set reaction rate index within kinetics evaluator. More...
virtual void | setContext (const Reaction &rxn, const Kinetics &kin)
| Set context of reaction rate evaluation. More...
double | eval (double T)
| Evaluate reaction rate based on temperature. More...
double | eval (double T, double extra)
| Evaluate reaction rate based on temperature and an extra parameter. More...
double | eval (double T, const std::vector< double > &extra)
| Evaluate reaction rate based on temperature and an extra vector parameter. More...

## Protected Member Functions
virtual void | getParameters (AnyMap &node) const
| Get parameters. More...

## Protected Attributes
AnyMap | m_input
| Input data used for specific models. More...
size_t | m_rate_index
| Index of reaction rate within kinetics evaluator. More...

## 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. More...

## Private Attributes
unique_ptr< MultiRateBase > | m_evaluator

## 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.

Definition at line 44 of file ReactionRate.h.

## Constructor & Destructor Documentation

## ◆ ReactionRate() [1/2]

ReactionRate | ( |  | ) |
| inline

Definition at line 47 of file ReactionRate.h.

## ◆ ReactionRate() [2/2]

ReactionRate | ( | const ReactionRate & | other | ) |
| inline

Definition at line 51 of file ReactionRate.h.

## Member Function Documentation

## ◆ operator=()

ReactionRate & operator= | ( | const ReactionRate & | other | ) |
| inline

Definition at line 56 of file ReactionRate.h.

## ◆ newMultiRate()

virtual unique_ptr< MultiRateBase > newMultiRate | ( |  | ) | const
| inline virtual

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

Derived classes usually implement this as:

unique_ptr<MultiRateBase> newMultiRate() const override {
return unique_ptr<MultiRateBase>(new MultiRate<RateType, DataType>);
Cantera::MultiRate
A class template handling ReactionRate specializations.
Definition: MultiRate.h:21
Cantera::ReactionRate::newMultiRate
virtual unique_ptr< MultiRateBase > newMultiRate() const
Create a rate evaluator for reactions of a particular derived type.
Definition: ReactionRate.h:77

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

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

Definition at line 77 of file ReactionRate.h.

References ReactionRate::type().

Referenced by ReactionRate::_evaluator().

## ◆ type()

virtual const std::string type | ( |  | ) | const
| pure virtual

String identifying reaction rate specialization.

Implemented in ChebyshevRate, FalloffRate, LindemannRate, TroeRate, SriRate, TsangRate, PlogRate, ArrheniusRate, BlowersMaselRate, CustomFunc1Rate, Arrhenius2, and TwoTempPlasmaRate.

Referenced by ReactionRate::getParameters(), ArrheniusBase::getParameters(), ReactionRate::newMultiRate(), and MultiRate< RateType, DataType >::replace().

## ◆ setParameters()

virtual void setParameters | ( | const AnyMap & | node,
|  | const UnitStack & | units
| ) |  |
| inline virtual

Set parameters.

Parameters

  node | AnyMap object containing reaction rate specification
  units | unit definitions specific to rate information

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

Definition at line 88 of file ReactionRate.h.

References ReactionRate::m_input.

Referenced by ArrheniusBase::setParameters().

## ◆ 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 95 of file ReactionRate.h.

References ReactionRate::getParameters().

## ◆ check()

virtual void check | ( | const std::string & | equation,
|  | const AnyMap & | node
| ) |  |
| inline virtual

Check basic syntax and settings of reaction rate expression.

Reimplemented in FalloffRate, and ArrheniusBase.

Definition at line 102 of file ReactionRate.h.

## ◆ validate() [1/2]

virtual void validate | ( | const std::string & | equation,
|  | const Kinetics & | kin
| ) |  |
| inline virtual

Validate the reaction rate expression.

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

Definition at line 105 of file ReactionRate.h.

## ◆ validate() [2/2]

virtual void validate | ( | const std::string & | equation | ) |
| inline virtual

Validate the reaction rate expression (legacy call)

Todo:
  deprecate in favor of two-parameter version

Reimplemented in PlogRate.

Definition at line 109 of file ReactionRate.h.

## ◆ rateIndex()

size_t rateIndex | ( |  | ) | const
| inline

Reaction rate index within kinetics evaluator.

Definition at line 112 of file ReactionRate.h.

References ReactionRate::m_rate_index.

## ◆ setRateIndex()

void setRateIndex | ( | size_t | idx | ) |
| inline

Set reaction rate index within kinetics evaluator.

Definition at line 117 of file ReactionRate.h.

References ReactionRate::m_rate_index.

## ◆ setContext()

virtual void setContext | ( | const Reaction & | rxn,
|  | const Kinetics & | kin
| ) |  |
| inline virtual

Set context of reaction rate evaluation.

Parameters

  rxn | Reaction object associated with rate
  kin | Kinetics 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, and TwoTempPlasmaRate.

Definition at line 126 of file ReactionRate.h.

## ◆ eval() [1/3]

double eval | ( | double | T | ) |
| inline

Evaluate reaction rate based on temperature.

Parameters

  T | temperature [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 134 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

  T | temperature [K]
  extra | extra 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 147 of file ReactionRate.h.

## ◆ eval() [3/3]

double eval | ( | double | T,
|  | const std::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

  T | temperature [K]
  extra | extra 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 162 of file ReactionRate.h.

## ◆ getParameters()

virtual void getParameters | ( | AnyMap & | node | ) | const
| inline protected virtual

Get parameters.

Parameters

  node | AnyMap 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, FalloffRate, TroeRate, SriRate, TsangRate, ArrheniusBase, ChebyshevRate, and PlogRate.

Definition at line 172 of file ReactionRate.h.

References ReactionRate::type().

Referenced by ReactionRate::parameters().

## ◆ _evaluator()

MultiRateBase & _evaluator | ( |  | ) |
| inline private

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 187 of file ReactionRate.h.

References ReactionRate::newMultiRate().

## Member Data Documentation

## ◆ m_input

AnyMap m_input
| protected

Input data used for specific models.

Definition at line 178 of file ReactionRate.h.

Referenced by ReactionRate::setParameters().

## ◆ m_rate_index

size_t m_rate_index
| protected

Index of reaction rate within kinetics evaluator.

Definition at line 181 of file ReactionRate.h.

Referenced by FalloffRate::evalFromStruct(), ReactionRate::rateIndex(), and ReactionRate::setRateIndex().

## ◆ m_evaluator

unique_ptr<MultiRateBase> m_evaluator
| private

Definition at line 194 of file ReactionRate.h.

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

- ReactionRate.h