Cantera  2.4.0
RateCoeffMgr.h
Go to the documentation of this file.
1 /**
2  * @file RateCoeffMgr.h
3  */
4 
5 // This file is part of Cantera. See License.txt in the top-level directory or
6 // at http://www.cantera.org/license.txt for license and copyright information.
7 
8 #ifndef CT_RATECOEFF_MGR_H
9 #define CT_RATECOEFF_MGR_H
10 
11 #include "RxnRates.h"
12 
13 namespace Cantera
14 {
15 
16 /**
17  * This rate coefficient manager supports one parameterization of
18  * the rate constant of any type.
19  */
20 template<class R>
21 class Rate1
22 {
23 public:
24  Rate1() {}
25  virtual ~Rate1() {}
26 
27  /**
28  * Install a rate coefficient calculator.
29  * @param rxnNumber the reaction number
30  * @param rate rate coefficient specification for the reaction
31  */
32  void install(size_t rxnNumber, const R& rate) {
33  m_rxn.push_back(rxnNumber);
34  m_rates.push_back(rate);
35  m_indices[rxnNumber] = m_rxn.size() - 1;
36  }
37 
38  //! Replace an existing rate coefficient calculator
39  void replace(size_t rxnNumber, const R& rate) {
40  size_t i = m_indices[rxnNumber];
41  m_rates[i] = rate;
42  }
43 
44  /**
45  * Update the concentration-dependent parts of the rate coefficient, if any.
46  * Used by class SurfaceArrhenius to compute coverage-dependent *
47  * modifications to the Arrhenius parameters. The array c should contain
48  * whatever data the particular rate coefficient class needs to update its
49  * rates. Note that this method does not return anything. To get the
50  * updated rates, method update must be called after the call to update_C.
51  */
52  void update_C(const doublereal* c) {
53  for (size_t i = 0; i != m_rates.size(); i++) {
54  m_rates[i].update_C(c);
55  }
56  }
57 
58  /**
59  * Write the rate coefficients into array values. Each calculator writes one
60  * entry in values, at the location specified by the reaction number when it
61  * was installed. Note that nothing will be done for reactions that have
62  * constant rates. The array values should be preloaded with the constant
63  * rate coefficients.
64  */
65  void update(doublereal T, doublereal logT, doublereal* values) {
66  doublereal recipT = 1.0/T;
67  for (size_t i = 0; i != m_rates.size(); i++) {
68  values[m_rxn[i]] = m_rates[i].updateRC(logT, recipT);
69  }
70  }
71 
72  size_t nReactions() const {
73  return m_rates.size();
74  }
75 
76  //! Return effective preexponent for the specified reaction.
77  /*!
78  * Returns effective preexponent, accounting for surface coverage
79  * dependencies. Used in InterfaceKinetics.
80  *
81  * @param irxn Reaction number in the kinetics mechanism
82  * @return Effective preexponent
83  */
84  double effectivePreExponentialFactor(size_t irxn) {
85  return m_rates[irxn].preExponentialFactor();
86  }
87 
88  //! Return effective activation energy for the specified reaction.
89  /*!
90  * Returns effective activation energy, accounting for surface coverage
91  * dependencies. Used in InterfaceKinetics.
92  *
93  * @param irxn Reaction number in the kinetics mechanism
94  * @return Effective activation energy divided by the gas constant
95  */
96  double effectiveActivationEnergy_R(size_t irxn) {
97  return m_rates[irxn].activationEnergy_R();
98  }
99 
100  //! Return effective temperature exponent for the specified reaction.
101  /*!
102  * Returns effective temperature exponent, accounting for surface coverage
103  * dependencies. Used in InterfaceKinetics. Current parameterization in
104  * SurfaceArrhenius does not change this parameter with the change in
105  * surface coverages.
106  *
107  * @param irxn Reaction number in the kinetics mechanism
108  * @return Effective temperature exponent
109  */
110  double effectiveTemperatureExponent(size_t irxn) {
111  return m_rates[irxn].temperatureExponent();
112  }
113 
114 protected:
115  std::vector<R> m_rates;
116  std::vector<size_t> m_rxn;
117 
118  //! map reaction number to index in m_rxn / m_rates
119  std::map<size_t, size_t> m_indices;
120 };
121 
122 }
123 
124 #endif
void install(size_t rxnNumber, const R &rate)
Install a rate coefficient calculator.
Definition: RateCoeffMgr.h:32
std::map< size_t, size_t > m_indices
map reaction number to index in m_rxn / m_rates
Definition: RateCoeffMgr.h:119
This rate coefficient manager supports one parameterization of the rate constant of any type...
Definition: RateCoeffMgr.h:21
void update_C(const doublereal *c)
Update the concentration-dependent parts of the rate coefficient, if any.
Definition: RateCoeffMgr.h:52
double effectiveActivationEnergy_R(size_t irxn)
Return effective activation energy for the specified reaction.
Definition: RateCoeffMgr.h:96
void update(doublereal T, doublereal logT, doublereal *values)
Write the rate coefficients into array values.
Definition: RateCoeffMgr.h:65
double effectiveTemperatureExponent(size_t irxn)
Return effective temperature exponent for the specified reaction.
Definition: RateCoeffMgr.h:110
void replace(size_t rxnNumber, const R &rate)
Replace an existing rate coefficient calculator.
Definition: RateCoeffMgr.h:39
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
double effectivePreExponentialFactor(size_t irxn)
Return effective preexponent for the specified reaction.
Definition: RateCoeffMgr.h:84