Cantera 2.6.0

MultiRateBase.h
Go to the documentation of this file.
1/**
2 * @file MultiRateBase.h
3 */
4
5// This file is part of Cantera. See License.txt in the top-level directory or
6// at https://cantera.org/license.txt for license and copyright information.
7
8#ifndef CT_MULTIRATEBASE_H
9#define CT_MULTIRATEBASE_H
10
11#include "cantera/base/ct_defs.h"
12
13 namespace Cantera
14{
15
16 class ReactionRate;
17 class ThermoPhase;
18 class Kinetics;
19
20//! An abstract base class for evaluating all reactions of a particular type.
21/**
22 * Because this class has no template parameters, the Kinetics object can store all of
23 * these rate coefficient evaluators as a `vector<shared_ptr<MultiRateBase>>`. All of
24 * the actual implementation for this capability is done in the MultiRate class.
25 */
26 class MultiRateBase
27{
28 public:
29 virtual ~MultiRateBase() {}
30
31 //! Identifier of reaction rate type
32 virtual std::string type() = 0;
33
34 //! Add reaction rate object to the evaluator
35 //! @param rxn_index index of reaction
36 //! @param rate reaction rate object
37 virtual void add(size_t rxn_index, ReactionRate& rate) = 0;
38
39 //! Replace reaction rate object handled by the evaluator
40 //! @param rxn_index index of reaction
41 //! @param rate reaction rate object
42 virtual bool replace(size_t rxn_index, ReactionRate& rate) = 0;
43
44 //! Update number of species and reactions
45 //! @param nSpecies number of species
46 //! @param nReactions number of reactions
47 //! @param nPhases number of phases
48 virtual void resize(size_t nSpecies, size_t nReactions, size_t nPhases) = 0;
49
50 //! Evaluate all rate constants handled by the evaluator
51 //! @param kf array of rate constants
52 virtual void getRateConstants(double* kf) = 0;
53
54 //! Evaluate all rate constant temperature derivatives handled by the evaluator;
55 //! which are multiplied with the array of rate-of-progress variables.
56 //! Depending on the implementation of a rate object, either an exact derivative or
57 //! a numerical approximation may be used.
58 //! @param[in,out] rop array of rop, which is modified by the method;
59 //! contains rop on input, and d(rop)/dT on output
60 //! @param kf array of forward rate constants (numerical derivative only)
61 //! @param deltaT relative temperature perturbation (numerical derivative only)
62 virtual void processRateConstants_ddT(double* rop,
63 const double* kf,
64 double deltaT) = 0;
65
66 //! Evaluate all rate constant pressure derivatives handled by the evaluator;
67 //! which are multiplied with the array of rate-of-progress variables.
68 //! @param[in,out] rop array of rop, which is modified by the method;
69 //! contains rop on input, and d(rop)/dP on output
70 //! @param kf array of forward rate constants
71 //! @param deltaP relative pressure perturbation
72 virtual void processRateConstants_ddP(double* rop,
73 const double* kf,
74 double deltaP) = 0;
75
76 //! Evaluate all rate constant third-body derivatives handled by the evaluator;
77 //! which are multiplied with the array of rate-of-progress variables.
78 //! @param[in,out] rop array of rop, which is modified by the method;
79 //! contains rop on input, and d(rop)/dM on output
80 //! @param kf array of forward rate constants
81 //! @param deltaM relative perturbation of third-body concentrations
82 //! @param overwrite if `true`, rop entries not affected by M are set to zero
83 virtual void processRateConstants_ddM(double* rop,
84 const double* kf,
85 double deltaM,
86 bool overwrite=true) = 0;
87
88 //! Update common reaction rate data based on temperature.
89 //! Only used in conjunction with evalSingle and ReactionRate::eval
90 //! @param T temperature [K]
91 virtual void update(double T) = 0;
92
93 //! Update common reaction rate data based on temperature and extra parameter.
94 //! Only used in conjunction with evalSingle and ReactionRate::eval
95 //! @param T temperature [K]
96 //! @param extra extra parameter (depends on parameterization)
97 virtual void update(double T, double extra) = 0;
98
99 //! Update common reaction rate data based on temperature and extra parameter.
100 //! Only used in conjunction with evalSingle and ReactionRate::eval
101 //! @param T temperature [K]
102 //! @param extra extra vector parameter (depends on parameterization)
103 //! @warning This method is an experimental part of the %Cantera API and
104 //! may be changed or removed without notice.
105 virtual void update(double T, const vector_fp& extra) = 0;
106
107 //! Update data common to reaction rates of a specific type.
108 //! This update mechanism is used by Kinetics reaction rate evaluators.
109 //! @param phase object representing reacting phase
110 //! @param kin object representing kinetics
111 //! @returns flag indicating whether reaction rates need to be re-evaluated
112 virtual bool update(const ThermoPhase& phase, const Kinetics& kin) = 0;
113
114 //! Get the rate for a single reaction. Used to implement ReactionRate::eval,
115 //! which allows for the evaluation of a reaction rate expression outside of
116 //! Kinetics reaction rate evaluators. Mainly used for testing purposes.
117 virtual double evalSingle(ReactionRate& rate) = 0;
118};
119
120} // end namespace Cantera
121
122#endif
Cantera::Kinetics
Public interface for kinetics managers.
Definition: Kinetics.h:114
Cantera::MultiRateBase
An abstract base class for evaluating all reactions of a particular type.
Definition: MultiRateBase.h:27
Cantera::MultiRateBase::processRateConstants_ddM
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...
Cantera::MultiRateBase::processRateConstants_ddP
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 t...
Cantera::MultiRateBase::processRateConstants_ddT
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 wit...
Cantera::MultiRateBase::update
virtual void update(double T, const vector_fp &extra)=0
Update common reaction rate data based on temperature and extra parameter.
Cantera::MultiRateBase::update
virtual bool update(const ThermoPhase &phase, const Kinetics &kin)=0
Update data common to reaction rates of a specific type.
Cantera::MultiRateBase::evalSingle
virtual double evalSingle(ReactionRate &rate)=0
Get the rate for a single reaction.
Cantera::MultiRateBase::getRateConstants
virtual void getRateConstants(double *kf)=0
Evaluate all rate constants handled by the evaluator.
Cantera::MultiRateBase::replace
virtual bool replace(size_t rxn_index, ReactionRate &rate)=0
Replace reaction rate object handled by the evaluator.
Cantera::MultiRateBase::update
virtual void update(double T)=0
Update common reaction rate data based on temperature.
Cantera::MultiRateBase::add
virtual void add(size_t rxn_index, ReactionRate &rate)=0
Add reaction rate object to the evaluator.
Cantera::MultiRateBase::type
virtual std::string type()=0
Identifier of reaction rate type.
Cantera::MultiRateBase::update
virtual void update(double T, double extra)=0
Update common reaction rate data based on temperature and extra parameter.
Cantera::MultiRateBase::resize
virtual void resize(size_t nSpecies, size_t nReactions, size_t nPhases)=0
Update number of species and reactions.
Cantera::ReactionRate
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
Definition: ReactionRate.h:45
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
ct_defs.h
This file contains definitions of constants, types and terms that are used in internal routines and a...
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::vector_fp
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:184