Cantera  3.2.0a2
Loading...
Searching...
No Matches
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
12
13namespace Cantera
14{
15
16class ReactionRate;
17class ThermoPhase;
18class 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 * @ingroup rateEvaluators
26 */
28{
29public:
30 virtual ~MultiRateBase() {}
31
32 //! Identifier of reaction rate type
33 virtual string type() = 0;
34
35 //! Add reaction rate object to the evaluator
36 //! @param rxn_index index of reaction
37 //! @param rate reaction rate object
38 virtual void add(size_t rxn_index, ReactionRate& rate) = 0;
39
40 //! Replace reaction rate object handled by the evaluator
41 //! @param rxn_index index of reaction
42 //! @param rate reaction rate object
43 virtual bool replace(size_t rxn_index, ReactionRate& rate) = 0;
44
45 //! Update number of species and reactions
46 //! @param nSpecies number of species
47 //! @param nReactions number of reactions
48 //! @param nPhases number of phases
49 virtual void resize(size_t nSpecies, size_t nReactions, size_t nPhases) = 0;
50
51 //! Evaluate all rate constants handled by the evaluator
52 //! @param kf array of rate constants
53 virtual void getRateConstants(double* kf) = 0;
54
55 //! For certain reaction types that do not follow mass action kinetics (for example,
56 //! Butler-Volmer), calculate modifications to the forward and reverse rate
57 //! constants.
58 //! @param[in, out] kf On input, contains the rate constants as computed by
59 //! getRateConstants(). The output value is updated by the reactant
60 //! StoichManagerN to determine the forward rates of progress.
61 //! @param[in, out] kr On input, contains the reverse rate constants computed from
62 //! the forward rate constants and the equilibrium constants. The output value
63 //! is updated by the product StoichManagerN to determine the reverse rates of
64 //! progress.
65 //! @since New in %Cantera 3.2
66 virtual void modifyRateConstants(double* kf, double* kr) = 0;
67
68 //! Evaluate all rate constant temperature derivatives handled by the evaluator;
69 //! which are multiplied with the array of rate-of-progress variables.
70 //! Depending on the implementation of a rate object, either an exact derivative or
71 //! a numerical approximation may be used.
72 //! @param[in,out] rop array of rop, which is modified by the method;
73 //! contains rop on input, and d(rop)/dT on output
74 //! @param kf array of forward rate constants (numerical derivative only)
75 //! @param deltaT relative temperature perturbation (numerical derivative only)
76 virtual void processRateConstants_ddT(double* rop,
77 const double* kf,
78 double deltaT) = 0;
79
80 //! Evaluate all rate constant pressure derivatives handled by the evaluator;
81 //! which are multiplied with the array of rate-of-progress variables.
82 //! @param[in,out] rop array of rop, which is modified by the method;
83 //! contains rop on input, and d(rop)/dP on output
84 //! @param kf array of forward rate constants
85 //! @param deltaP relative pressure perturbation
86 virtual void processRateConstants_ddP(double* rop,
87 const double* kf,
88 double deltaP) = 0;
89
90 //! Evaluate all rate constant third-body derivatives handled by the evaluator;
91 //! which are multiplied with the array of rate-of-progress variables.
92 //! @param[in,out] rop array of rop, which is modified by the method;
93 //! contains rop on input, and d(rop)/dM on output
94 //! @param kf array of forward rate constants
95 //! @param deltaM relative perturbation of third-body concentrations
96 //! @param overwrite if `true`, rop entries not affected by M are set to zero
97 virtual void processRateConstants_ddM(double* rop,
98 const double* kf,
99 double deltaM,
100 bool overwrite=true) = 0;
101
102 //! Update common reaction rate data based on temperature.
103 //! Only used in conjunction with evalSingle and ReactionRate::eval
104 //! @param T temperature [K]
105 virtual void update(double T) = 0;
106
107 //! Update common reaction rate data based on temperature and extra parameter.
108 //! Only used in conjunction with evalSingle and ReactionRate::eval
109 //! @param T temperature [K]
110 //! @param extra extra parameter (depends on parameterization)
111 virtual void update(double T, double extra) = 0;
112
113 //! Update common reaction rate data based on temperature and extra parameter.
114 //! Only used in conjunction with evalSingle and ReactionRate::eval
115 //! @param T temperature [K]
116 //! @param extra extra vector parameter (depends on parameterization)
117 //! @warning This method is an experimental part of the %Cantera API and
118 //! may be changed or removed without notice.
119 virtual void update(double T, const vector<double>& extra) = 0;
120
121 //! Update data common to reaction rates of a specific type.
122 //! This update mechanism is used by Kinetics reaction rate evaluators.
123 //! @param phase object representing reacting phase
124 //! @param kin object representing kinetics
125 //! @returns flag indicating whether reaction rates need to be re-evaluated
126 virtual bool update(const ThermoPhase& phase, const Kinetics& kin) = 0;
127
128 //! Get the rate for a single reaction. Used to implement ReactionRate::eval,
129 //! which allows for the evaluation of a reaction rate expression outside of
130 //! Kinetics reaction rate evaluators. Mainly used for testing purposes.
131 virtual double evalSingle(ReactionRate& rate) = 0;
132};
133
134} // end namespace Cantera
135
136#endif
Public interface for kinetics managers.
Definition Kinetics.h:126
An abstract base class for evaluating all reactions of a particular type.
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...
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...
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...
virtual bool update(const ThermoPhase &phase, const Kinetics &kin)=0
Update data common to reaction rates of a specific type.
virtual double evalSingle(ReactionRate &rate)=0
Get the rate for a single reaction.
virtual void update(double T, const vector< double > &extra)=0
Update common reaction rate data based on temperature and extra parameter.
virtual void getRateConstants(double *kf)=0
Evaluate all rate constants handled by the evaluator.
virtual string type()=0
Identifier of reaction rate type.
virtual bool replace(size_t rxn_index, ReactionRate &rate)=0
Replace reaction rate object handled by the evaluator.
virtual void update(double T)=0
Update common reaction rate data based on temperature.
virtual void modifyRateConstants(double *kf, double *kr)=0
For certain reaction types that do not follow mass action kinetics (for example, Butler-Volmer),...
virtual void add(size_t rxn_index, ReactionRate &rate)=0
Add reaction rate object to the evaluator.
virtual void update(double T, double extra)=0
Update common reaction rate data based on temperature and extra parameter.
virtual void resize(size_t nSpecies, size_t nReactions, size_t nPhases)=0
Update number of species and reactions.
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
Base class for a phase with thermodynamic properties.
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595