Cantera
Loading...
Searching...
No Matches
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
11namespace Cantera
12{
13
15 warn_user("BlowersMaselData::update",
16 "This method does not update the change of reaction enthalpy.");
18}
19
20bool 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;
34 changed = true;
35 }
36 return changed;
37}
38
40 partialMolarEnthalpies.resize(kin.nTotalSpecies(), 0.);
41 ready = true;
42}
43
49
50BlowersMaselRate::BlowersMaselRate(double A, double b, double Ea0, double w)
51 : ArrheniusBase(A, b, Ea0)
52{
53 m_Ea_str = "Ea0";
54 m_E4_str = "w";
55 m_E4_R = w / GasConstant;
56}
57
58BlowersMaselRate::BlowersMaselRate(const AnyMap& node, const UnitStack& rate_units)
60{
61 setParameters(node, rate_units);
62}
63
65{
66 warn_user("BlowersMaselRate::ddTScaledFromStruct",
67 "Temperature derivative does not consider changes of reaction enthalpy.");
69 return (Ea_R * shared_data.recipT + m_b) * shared_data.recipT;
70}
71
73{
74 m_stoich_coeffs.clear();
75 for (const auto& [name, stoich] : rxn.reactants) {
76 m_stoich_coeffs.emplace_back(kin.kineticsSpeciesIndex(name), -stoich);
77 }
78 for (const auto& [name, stoich] : rxn.products) {
79 m_stoich_coeffs.emplace_back(kin.kineticsSpeciesIndex(name), stoich);
80 }
81}
82
83}
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:431
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Set parameters.
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
ArrheniusBase()
Default constructor.
Definition Arrhenius.h:47
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:124
size_t kineticsSpeciesIndex(size_t k, size_t n) const
The location of species k of phase n in species arrays.
Definition Kinetics.h:271
size_t nTotalSpecies() const
The total number of species in all phases participating in the kinetics mechanism.
Definition Kinetics.h:249
double temperature() const
Temperature (K).
Definition Phase.h:586
virtual double density() const
Density (kg/m^3).
Definition Phase.h:611
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition Phase.h:801
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.
virtual void getPartialMolarEnthalpies(span< double > hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:123
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Definition global.h:263
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
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
void update(double T) override
Update data container based on temperature T.
bool ready
boolean indicating whether vectors are accessible
double density
used to determine if updates are needed
void resize(Kinetics &kin) override
Update array sizes that depend on number of species, reactions and phases.
double recipT
inverse of temperature
virtual void update(double T)
Update data container based on temperature T.
double temperature
temperature
Unit aggregation utility.
Definition Units.h:105