Cantera 2.6.0

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MultiRate< RateType, DataType > Class Template Referencefinal

A class template handling ReactionRate specializations. More...

`#include <MultiRate.h>`

Inheritance diagram for MultiRate< RateType, DataType >:
[legend]
Collaboration diagram for MultiRate< RateType, DataType >:
[legend]

## Public Member Functions
virtual std::string | type () override
| Identifier of reaction rate type. More...
virtual void | add (size_t rxn_index, ReactionRate &rate) override
| Add reaction rate object to the evaluator. More...
virtual bool | replace (size_t rxn_index, ReactionRate &rate) override
| Replace reaction rate object handled by the evaluator. More...
virtual void | resize (size_t nSpecies, size_t nReactions, size_t nPhases) override
| Update number of species and reactions. More...
virtual void | getRateConstants (double *kf) override
| Evaluate all rate constants handled by the evaluator. More...
virtual void | processRateConstants_ddT (double *rop, const double *kf, double deltaT) override
| Evaluate all rate constant temperature derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables. More...
virtual void | processRateConstants_ddP (double *rop, const double *kf, double deltaP) override
| Evaluate all rate constant pressure derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables. More...
virtual void | processRateConstants_ddM (double *rop, const double *kf, double deltaM, bool overwrite=true) override
| Evaluate all rate constant third-body derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables. More...
virtual void | update (double T) override
| Update common reaction rate data based on temperature. More...
virtual void | update (double T, double extra) override
| Update common reaction rate data based on temperature and extra parameter. More...
virtual void | update (double T, const vector_fp &extra) override
| Update common reaction rate data based on temperature and extra parameter. More...
virtual bool | update (const ThermoPhase &phase, const Kinetics &kin) override
| Update data common to reaction rates of a specific type. More...
virtual double | evalSingle (ReactionRate &rate) override
| Get the rate for a single reaction. More...
virtual std::string | type ()=0
| Identifier of reaction rate type. More...
virtual void | add (size_t rxn_index, ReactionRate &rate)=0
| Add reaction rate object to the evaluator. More...
virtual bool | replace (size_t rxn_index, ReactionRate &rate)=0
| Replace reaction rate object handled by the evaluator. More...
virtual void | resize (size_t nSpecies, size_t nReactions, size_t nPhases)=0
| Update number of species and reactions. More...
virtual void | getRateConstants (double *kf)=0
| Evaluate all rate constants handled by the evaluator. More...
virtual void | processRateConstants_ddT (double *rop, const double *kf, double deltaT)=0
| Evaluate all rate constant temperature derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables. More...
virtual void | processRateConstants_ddP (double *rop, const double *kf, double deltaP)=0
| Evaluate all rate constant pressure derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables. More...
virtual void | processRateConstants_ddM (double *rop, const double *kf, double deltaM, bool overwrite=true)=0
| Evaluate all rate constant third-body derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables. More...
virtual void | update (double T)=0
| Update common reaction rate data based on temperature. More...
virtual void | update (double T, double extra)=0
| Update common reaction rate data based on temperature and extra parameter. More...
virtual void | update (double T, const vector_fp &extra)=0
| Update common reaction rate data based on temperature and extra parameter. More...
virtual bool | update (const ThermoPhase &phase, const Kinetics &kin)=0
| Update data common to reaction rates of a specific type. More...
virtual double | evalSingle (ReactionRate &rate)=0
| Get the rate for a single reaction. More...

## Protected Member Functions
template<typename T = RateType, typename std::enable_if< has_update< T >::value, bool >::type = true>
void | _update ()
| Helper function to process updates for rate types that implement the `updateFromStruct` method. More...
template<typename T = RateType, typename std::enable_if<!has_update< T >::value, bool >::type = true>
void | _update ()
| Helper function for rate types that do not implement `updateFromStruct`. More...
template<typename T = RateType, typename std::enable_if< has_update< T >::value, bool >::type = true>
void | _updateRate (RateType &rate)
| Helper function to update a single rate that has an `updateFromStruct` method`. More...
template<typename T = RateType, typename std::enable_if<!has_update< T >::value, bool >::type = true>
void | _updateRate (RateType &rate)
| Helper function for single rate that does not implement `updateFromStruct`. More...
template<typename T = RateType, typename std::enable_if< has_ddT< T >::value, bool >::type = true>
void | _process_ddT (double *rop, const double *kf, double deltaT)
| Helper function to process temperature derivatives for rate types that implement the `ddTScaledFromStruct` method. More...
template<typename T = RateType, typename std::enable_if<!has_ddT< T >::value, bool >::type = true>
void | _process_ddT (double *rop, const double *kf, double deltaT)
| Helper function for rate types that do not implement `ddTScaledFromStruct` More...
template<typename T = RateType, typename D = DataType, typename std::enable_if< has_ddM< D >::value, bool >::type = true>
void | _process_ddM (double *rop, const double *kf, double deltaM, bool overwrite)
| Helper function to process third-body derivatives for rate data that implement the `perturbThirdBodies` method. More...
template<typename T = RateType, typename D = DataType, typename std::enable_if<!has_ddM< D >::value, bool >::type = true>
void | _process_ddM (double *rop, const double *kf, double deltaM, bool overwrite)
| Helper function for rate data that do not implement `perturbThirdBodies` More...
template<typename T = RateType, typename D = DataType, typename std::enable_if< has_ddP< D >::value, bool >::type = true>
void | _process_ddP (double *rop, const double *kf, double deltaP)
| Helper function to process pressure derivatives for rate data that implement the `perturbPressure` method. More...
template<typename T = RateType, typename D = DataType, typename std::enable_if<!has_ddP< D >::value, bool >::type = true>
void | _process_ddP (double *rop, const double *kf, double deltaP)
| Helper function for rate data that do not implement `perturbPressure` More...

## Protected Attributes
std::vector< std::pair< size_t, RateType > > | m_rxn_rates
| Vector of pairs of reaction rates indices and reaction rates. More...
std::map< size_t, size_t > | m_indices
DataType | m_shared
| Mapping of indices. More...

## Detailed Description

template<class RateType, class DataType>
class Cantera::MultiRate< RateType, DataType >

A class template handling ReactionRate specializations.

Definition at line 20 of file MultiRate.h.

## Member Function Documentation

## ◆ type()

virtual std::string type | ( |  | ) |
| inline override virtual

Identifier of reaction rate type.

Implements MultiRateBase.

Definition at line 28 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates.

Referenced by MultiRate< RateType, DataType >::replace().

## ◆ add()

virtual void add | ( | size_t | rxn_index,
|  | ReactionRate & | rate
| ) |  |
| inline override virtual

Add reaction rate object to the evaluator.

Parameters

  rxn_index | index of reaction
  rate | reaction rate object

Implements MultiRateBase.

Definition at line 36 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates, and MultiRate< RateType, DataType >::m_shared.

## ◆ replace()

virtual bool replace | ( | size_t | rxn_index,
|  | ReactionRate & | rate
| ) |  |
| inline override virtual

Replace reaction rate object handled by the evaluator.

Parameters

  rxn_index | index of reaction
  rate | reaction rate object

Implements MultiRateBase.

Definition at line 42 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates, MultiRate< RateType, DataType >::m_shared, ReactionRate::type(), and MultiRate< RateType, DataType >::type().

## ◆ resize()

virtual void resize | ( | size_t | nSpecies,
|  | size_t | nReactions,
|  | size_t | nPhases
| ) |  |
| inline override virtual

Update number of species and reactions.

Parameters

  nSpecies | number of species
  nReactions | number of reactions
  nPhases | number of phases

Implements MultiRateBase.

Definition at line 62 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_shared.

## ◆ getRateConstants()

virtual void getRateConstants | ( | double * | kf | ) |
| inline override virtual

Evaluate all rate constants handled by the evaluator.

Parameters

  kf | array of rate constants

Implements MultiRateBase.

Definition at line 67 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates, and MultiRate< RateType, DataType >::m_shared.

## ◆ processRateConstants_ddT()

virtual void processRateConstants_ddT | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaT
| ) |  |
| inline override virtual

Evaluate all rate constant temperature derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables.

Depending on the implementation of a rate object, either an exact derivative or a numerical approximation may be used.

Parameters

  [in,out] | rop | array of rop, which is modified by the method; contains rop on input, and d(rop)/dT on output
  | kf | array of forward rate constants (numerical derivative only)
  | deltaT | relative temperature perturbation (numerical derivative only)

Implements MultiRateBase.

Definition at line 73 of file MultiRate.h.

References MultiRate< RateType, DataType >::_process_ddT().

## ◆ processRateConstants_ddP()

virtual void processRateConstants_ddP | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaP
| ) |  |
| inline override virtual

Evaluate all rate constant pressure derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables.

Parameters

  [in,out] | rop | array of rop, which is modified by the method; contains rop on input, and d(rop)/dP on output
  | kf | array of forward rate constants
  | deltaP | relative pressure perturbation

Implements MultiRateBase.

Definition at line 82 of file MultiRate.h.

References MultiRate< RateType, DataType >::_process_ddP().

## ◆ processRateConstants_ddM()

virtual void processRateConstants_ddM | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaM,
|  | bool | overwrite = `true`
| ) |  |
| inline override virtual

Evaluate all rate constant third-body derivatives handled by the evaluator; which are multiplied with the array of rate-of-progress variables.

Parameters

  [in,out] | rop | array of rop, which is modified by the method; contains rop on input, and d(rop)/dM on output
  | kf | array of forward rate constants
  | deltaM | relative perturbation of third-body concentrations
  | overwrite | if `true`, rop entries not affected by M are set to zero

Implements MultiRateBase.

Definition at line 91 of file MultiRate.h.

References MultiRate< RateType, DataType >::_process_ddM().

## ◆ update() [1/4]

virtual void update | ( | double | T | ) |
| inline override virtual

Update common reaction rate data based on temperature.

Only used in conjunction with evalSingle and ReactionRate::eval

Parameters

  T | temperature [K]

Implements MultiRateBase.

Definition at line 101 of file MultiRate.h.

## ◆ update() [2/4]

virtual void update | ( | double | T,
|  | double | extra
| ) |  |
| inline override virtual

Update common reaction rate data based on temperature and extra parameter.

Only used in conjunction with evalSingle and ReactionRate::eval

Parameters

  T | temperature [K]
  extra | extra parameter (depends on parameterization)

Implements MultiRateBase.

Definition at line 106 of file MultiRate.h.

## ◆ update() [3/4]

virtual void update | ( | double | T,
|  | const vector_fp & | extra
| ) |  |
| inline override virtual

Update common reaction rate data based on temperature and extra parameter.

Only used in conjunction with evalSingle and ReactionRate::eval

Parameters

  T | temperature [K]
  extra | extra vector parameter (depends on parameterization)

Warning
  This method is an experimental part of the Cantera API and may be changed or removed without notice.

Implements MultiRateBase.

Definition at line 111 of file MultiRate.h.

## ◆ update() [4/4]

virtual bool update | ( | const ThermoPhase & | phase,
|  | const Kinetics & | kin
| ) |  |
| inline override virtual

Update data common to reaction rates of a specific type.

This update mechanism is used by Kinetics reaction rate evaluators.

Parameters

  phase | object representing reacting phase
  kin | object representing kinetics

Returns
  flag indicating whether reaction rates need to be re-evaluated

Implements MultiRateBase.

Definition at line 116 of file MultiRate.h.

References MultiRate< RateType, DataType >::_update(), and MultiRate< RateType, DataType >::m_shared.

## ◆ evalSingle()

virtual double evalSingle | ( | ReactionRate & | rate | ) |
| inline override virtual

Get the rate for a single reaction.

Used to implement ReactionRate::eval, which allows for the evaluation of a reaction rate expression outside of Kinetics reaction rate evaluators. Mainly used for testing purposes.

Implements MultiRateBase.

Definition at line 126 of file MultiRate.h.

## ◆ _update() [1/2]

void _update | ( |  | ) |
| inline protected

Helper function to process updates for rate types that implement the `updateFromStruct` method.

Definition at line 137 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates, and MultiRate< RateType, DataType >::m_shared.

Referenced by MultiRate< RateType, DataType >::_process_ddM(), MultiRate< RateType, DataType >::_process_ddP(), MultiRate< RateType, DataType >::_process_ddT(), and MultiRate< RateType, DataType >::update().

## ◆ _update() [2/2]

void _update | ( |  | ) |
| inline protected

Helper function for rate types that do not implement `updateFromStruct`.

Does nothing, but exists to allow generic implementations of update().

Definition at line 147 of file MultiRate.h.

## ◆ _updateRate() [1/2]

void _updateRate | ( | RateType & | rate | ) |
| inline protected

Helper function to update a single rate that has an `updateFromStruct` method`.

Definition at line 153 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_shared.

## ◆ _updateRate() [2/2]

void _updateRate | ( | RateType & | rate | ) |
| inline protected

Helper function for single rate that does not implement `updateFromStruct`.

Exists to allow generic implementations of `evalSingle` and `ddTSingle`.

Definition at line 161 of file MultiRate.h.

## ◆ _process_ddT() [1/2]

void _process_ddT | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaT
| ) |  |
| inline protected

Helper function to process temperature derivatives for rate types that implement the `ddTScaledFromStruct` method.

Definition at line 168 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates, and MultiRate< RateType, DataType >::m_shared.

Referenced by MultiRate< RateType, DataType >::processRateConstants_ddT().

## ◆ _process_ddT() [2/2]

void _process_ddT | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaT
| ) |  |
| inline protected

Helper function for rate types that do not implement `ddTScaledFromStruct`

Definition at line 177 of file MultiRate.h.

References MultiRate< RateType, DataType >::_update(), MultiRate< RateType, DataType >::m_rxn_rates, and MultiRate< RateType, DataType >::m_shared.

## ◆ _process_ddM() [1/2]

void _process_ddM | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaM,
|  | bool | overwrite
| ) |  |
| inline protected

Helper function to process third-body derivatives for rate data that implement the `perturbThirdBodies` method.

Definition at line 201 of file MultiRate.h.

References MultiRate< RateType, DataType >::_update(), MultiRate< RateType, DataType >::m_rxn_rates, and MultiRate< RateType, DataType >::m_shared.

Referenced by MultiRate< RateType, DataType >::processRateConstants_ddM().

## ◆ _process_ddM() [2/2]

void _process_ddM | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaM,
|  | bool | overwrite
| ) |  |
| inline protected

Helper function for rate data that do not implement `perturbThirdBodies`

Definition at line 224 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates.

## ◆ _process_ddP() [1/2]

void _process_ddP | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaP
| ) |  |
| inline protected

Helper function to process pressure derivatives for rate data that implement the `perturbPressure` method.

Definition at line 238 of file MultiRate.h.

References MultiRate< RateType, DataType >::_update(), MultiRate< RateType, DataType >::m_rxn_rates, and MultiRate< RateType, DataType >::m_shared.

Referenced by MultiRate< RateType, DataType >::processRateConstants_ddP().

## ◆ _process_ddP() [2/2]

void _process_ddP | ( | double * | rop,
|  | const double * | kf,
|  | double | deltaP
| ) |  |
| inline protected

Helper function for rate data that do not implement `perturbPressure`

Definition at line 258 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_rxn_rates.

## Member Data Documentation

## ◆ m_rxn_rates

std::vector<std::pair<size_t, RateType> > m_rxn_rates
| protected

Vector of pairs of reaction rates indices and reaction rates.

Definition at line 265 of file MultiRate.h.

Referenced by MultiRate< RateType, DataType >::_process_ddM(), MultiRate< RateType, DataType >::_process_ddP(), MultiRate< RateType, DataType >::_process_ddT(), MultiRate< RateType, DataType >::_update(), MultiRate< RateType, DataType >::add(), MultiRate< RateType, DataType >::getRateConstants(), MultiRate< RateType, DataType >::replace(), and MultiRate< RateType, DataType >::type().

## ◆ m_indices

std::map<size_t, size_t> m_indices
| protected

Definition at line 266 of file MultiRate.h.

## ◆ m_shared

DataType m_shared
| protected

Mapping of indices.

Definition at line 267 of file MultiRate.h.

Referenced by MultiRate< RateType, DataType >::_process_ddM(), MultiRate< RateType, DataType >::_process_ddP(), MultiRate< RateType, DataType >::_process_ddT(), MultiRate< RateType, DataType >::_update(), MultiRate< RateType, DataType >::_updateRate(), MultiRate< RateType, DataType >::add(), MultiRate< RateType, DataType >::getRateConstants(), MultiRate< RateType, DataType >::replace(), MultiRate< RateType, DataType >::resize(), and MultiRate< RateType, DataType >::update().

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

- MultiRate.h