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

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 ( )
inlineoverridevirtual

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 
)
inlineoverridevirtual

Add reaction rate object to the evaluator.

Parameters
rxn_indexindex of reaction
ratereaction 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 
)
inlineoverridevirtual

Replace reaction rate object handled by the evaluator.

Parameters
rxn_indexindex of reaction
ratereaction 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 
)
inlineoverridevirtual

Update number of species and reactions.

Parameters
nSpeciesnumber of species
nReactionsnumber of reactions
nPhasesnumber of phases

Implements MultiRateBase.

Definition at line 62 of file MultiRate.h.

References MultiRate< RateType, DataType >::m_shared.

◆ getRateConstants()

virtual void getRateConstants ( double *  kf)
inlineoverridevirtual

Evaluate all rate constants handled by the evaluator.

Parameters
kfarray 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 
)
inlineoverridevirtual

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]roparray of rop, which is modified by the method; contains rop on input, and d(rop)/dT on output
kfarray of forward rate constants (numerical derivative only)
deltaTrelative 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 
)
inlineoverridevirtual

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

Parameters
[in,out]roparray of rop, which is modified by the method; contains rop on input, and d(rop)/dP on output
kfarray of forward rate constants
deltaPrelative 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 
)
inlineoverridevirtual

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]roparray of rop, which is modified by the method; contains rop on input, and d(rop)/dM on output
kfarray of forward rate constants
deltaMrelative perturbation of third-body concentrations
overwriteif 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)
inlineoverridevirtual

Update common reaction rate data based on temperature.

Only used in conjunction with evalSingle and ReactionRate::eval

Parameters
Ttemperature [K]

Implements MultiRateBase.

Definition at line 101 of file MultiRate.h.

◆ update() [2/4]

virtual void update ( double  T,
double  extra 
)
inlineoverridevirtual

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

Only used in conjunction with evalSingle and ReactionRate::eval

Parameters
Ttemperature [K]
extraextra 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 
)
inlineoverridevirtual

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

Only used in conjunction with evalSingle and ReactionRate::eval

Parameters
Ttemperature [K]
extraextra 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 
)
inlineoverridevirtual

Update data common to reaction rates of a specific type.

This update mechanism is used by Kinetics reaction rate evaluators.

Parameters
phaseobject representing reacting phase
kinobject 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)
inlineoverridevirtual

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 ( )
inlineprotected

◆ _update() [2/2]

void _update ( )
inlineprotected

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)
inlineprotected

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)
inlineprotected

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 
)
inlineprotected

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 
)
inlineprotected

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 
)
inlineprotected

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 
)
inlineprotected

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 
)
inlineprotected

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 
)
inlineprotected

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

◆ 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

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