Cantera  3.1.0a1
BlowersMaselRate.cpp
Go to the documentation of this file.
1 //! @file BlowersMaselRate.cpp
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at https://cantera.org/license.txt for license and copyright information.
5 
10 
11 namespace Cantera
12 {
13 
14 void BlowersMaselData::update(double T) {
15  warn_user("BlowersMaselData::update",
16  "This method does not update the change of reaction enthalpy.");
18 }
19 
20 bool BlowersMaselData::update(const ThermoPhase& phase, const Kinetics& kin)
21 {
22  double rho = phase.density();
23  int mf = phase.stateMFNumber();
24  double T = phase.temperature();
25  bool changed = false;
26  if (T != temperature) {
28  changed = true;
29  }
30  if (changed || rho != density || mf != m_state_mf_number) {
31  density = rho;
32  m_state_mf_number = mf;
34  changed = true;
35  }
36  return changed;
37 }
38 
40 {
41  m_Ea_str = "Ea0";
42  m_E4_str = "w";
43 }
44 
45 BlowersMaselRate::BlowersMaselRate(double A, double b, double Ea0, double w)
46  : ArrheniusBase(A, b, Ea0)
47 {
48  m_Ea_str = "Ea0";
49  m_E4_str = "w";
50  m_E4_R = w / GasConstant;
51 }
52 
53 BlowersMaselRate::BlowersMaselRate(const AnyMap& node, const UnitStack& rate_units)
55 {
56  setParameters(node, rate_units);
57 }
58 
60 {
61  warn_user("BlowersMaselRate::ddTScaledFromStruct",
62  "Temperature derivative does not consider changes of reaction enthalpy.");
64  return (Ea_R * shared_data.recipT + m_b) * shared_data.recipT;
65 }
66 
67 void BlowersMaselRate::setContext(const Reaction& rxn, const Kinetics& kin)
68 {
69  m_stoich_coeffs.clear();
70  for (const auto& [name, stoich] : rxn.reactants) {
71  m_stoich_coeffs.emplace_back(kin.kineticsSpeciesIndex(name), -stoich);
72  }
73  for (const auto& [name, stoich] : rxn.products) {
74  m_stoich_coeffs.emplace_back(kin.kineticsSpeciesIndex(name), stoich);
75  }
76 }
77 
78 }
Header for Blowers-Masel reaction rates.
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:427
Base class for Arrhenius-type Parameterizations.
Definition: Arrhenius.h:44
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Set parameters.
Definition: Arrhenius.cpp:100
string m_E4_str
The string for an optional 4th parameter.
Definition: Arrhenius.h:156
double m_E4_R
Optional 4th energy parameter (in temperature units)
Definition: Arrhenius.h:150
string m_Ea_str
The string for activation energy.
Definition: Arrhenius.h:155
double m_b
Temperature exponent.
Definition: Arrhenius.h:148
Blowers Masel reaction rate type depends on the enthalpy of reaction.
void setContext(const Reaction &rxn, const Kinetics &kin) override
Set context of reaction rate evaluation.
vector< pair< size_t, double > > m_stoich_coeffs
Pairs of species indices and multipliers to calculate enthalpy change.
BlowersMaselRate()
Default constructor.
double effectiveActivationEnergy_R(double deltaH_R) const
Return the effective activation energy (a function of the delta H of reaction) divided by the gas con...
double m_deltaH_R
enthalpy change of reaction (in temperature units)
double ddTScaledFromStruct(const BlowersMaselData &shared_data) const
Evaluate derivative of reaction rate with respect to temperature divided by reaction rate.
Public interface for kinetics managers.
Definition: Kinetics.h:125
size_t kineticsSpeciesIndex(size_t k, size_t n) const
The location of species k of phase n in species arrays.
Definition: Kinetics.h:276
double temperature() const
Temperature (K).
Definition: Phase.h:562
virtual double density() const
Density (kg/m^3).
Definition: Phase.h:587
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition: Phase.h:761
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
Definition: Reaction.h:25
Composition products
Product species and stoichiometric coefficients.
Definition: Reaction.h:114
Composition reactants
Reactant species and stoichiometric coefficients.
Definition: Reaction.h:111
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:390
virtual void getPartialMolarEnthalpies(double *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: ThermoPhase.h:801
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:120
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Definition: global.h:267
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564
Data container holding shared data specific to BlowersMaselRate.
int m_state_mf_number
integer that is incremented when composition changes
vector< double > partialMolarEnthalpies
partial molar enthalpies
double density
used to determine if updates are needed
virtual void update(double T)
Update data container based on temperature T
Definition: ReactionData.h:36
double recipT
inverse of temperature
Definition: ReactionData.h:112
virtual void update(double T)
Update data container based on temperature T
Definition: ReactionData.h:36
double temperature
temperature
Definition: ReactionData.h:110
Unit aggregation utility.
Definition: Units.h:105