| Cantera 3.0.0

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
6#include "cantera/kinetics/BlowersMaselRate.h"
7#include "cantera/kinetics/Reaction.h"
8#include "cantera/kinetics/Kinetics.h"
9#include "cantera/thermo/ThermoPhase.h"
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.");
17 ReactionData::update(T);
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) {
27 ReactionData::update(T);
28 changed = true;
29 }
30 if (changed || rho != density || mf != m_state_mf_number) {
31 density = rho;
32 m_state_mf_number = mf;
33 phase.getPartialMolarEnthalpies(partialMolarEnthalpies.data());
34 changed = true;
35 }
36 return changed;
37}
38
39 BlowersMaselRate::BlowersMaselRate()
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)
54 : BlowersMaselRate()
55{
56 setParameters(node, rate_units);
57}
58
59 double BlowersMaselRate::ddTScaledFromStruct(const BlowersMaselData& shared_data) const
60{
61 warn_user("BlowersMaselRate::ddTScaledFromStruct",
62 "Temperature derivative does not consider changes of reaction enthalpy.");
63 double Ea_R = effectiveActivationEnergy_R(m_deltaH_R);
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}
BlowersMaselRate.h
Header for Blowers-Masel reaction rates.
Kinetics.h
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Reaction.h
ThermoPhase.h
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::ArrheniusBase
Base class for Arrhenius-type Parameterizations.
Definition Arrhenius.h:44
Cantera::ArrheniusBase::setParameters
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Set parameters.
Definition Arrhenius.cpp:100
Cantera::ArrheniusBase::m_E4_str
string m_E4_str
The string for an optional 4th parameter.
Definition Arrhenius.h:156
Cantera::ArrheniusBase::m_E4_R
double m_E4_R
Optional 4th energy parameter (in temperature units)
Definition Arrhenius.h:150
Cantera::ArrheniusBase::m_Ea_str
string m_Ea_str
The string for activation energy.
Definition Arrhenius.h:155
Cantera::ArrheniusBase::m_b
double m_b
Temperature exponent.
Definition Arrhenius.h:148
Cantera::BlowersMaselRate
Blowers Masel reaction rate type depends on the enthalpy of reaction.
Definition BlowersMaselRate.h:70
Cantera::BlowersMaselRate::setContext
void setContext(const Reaction &rxn, const Kinetics &kin) override
Set context of reaction rate evaluation.
Definition BlowersMaselRate.cpp:67
Cantera::BlowersMaselRate::m_stoich_coeffs
vector< pair< size_t, double > > m_stoich_coeffs
Pairs of species indices and multipliers to calculate enthalpy change.
Definition BlowersMaselRate.h:180
Cantera::BlowersMaselRate::BlowersMaselRate
BlowersMaselRate()
Default constructor.
Definition BlowersMaselRate.cpp:39
Cantera::BlowersMaselRate::effectiveActivationEnergy_R
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...
Definition BlowersMaselRate.h:137
Cantera::BlowersMaselRate::m_deltaH_R
double m_deltaH_R
enthalpy change of reaction (in temperature units)
Definition BlowersMaselRate.h:182
Cantera::BlowersMaselRate::ddTScaledFromStruct
double ddTScaledFromStruct(const BlowersMaselData &shared_data) const
Evaluate derivative of reaction rate with respect to temperature divided by reaction rate.
Definition BlowersMaselRate.cpp:59
Cantera::Kinetics
Public interface for kinetics managers.
Definition Kinetics.h:126
Cantera::Kinetics::kineticsSpeciesIndex
size_t kineticsSpeciesIndex(size_t k, size_t n) const
The location of species k of phase n in species arrays.
Definition Kinetics.h:288
Cantera::Phase::temperature
double temperature() const
Temperature (K).
Definition Phase.h:662
Cantera::Phase::density
virtual double density() const
Density (kg/m^3).
Definition Phase.h:687
Cantera::Phase::stateMFNumber
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition Phase.h:866
Cantera::Reaction
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
Definition Reaction.h:27
Cantera::Reaction::products
Composition products
Product species and stoichiometric coefficients.
Definition Reaction.h:135
Cantera::Reaction::reactants
Composition reactants
Reactant species and stoichiometric coefficients.
Definition Reaction.h:132
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition ThermoPhase.h:390
Cantera::ThermoPhase::getPartialMolarEnthalpies
virtual void getPartialMolarEnthalpies(double *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition ThermoPhase.h:816
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
Cantera::warn_user
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
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::BlowersMaselData
Data container holding shared data specific to BlowersMaselRate.
Definition BlowersMaselRate.h:20
Cantera::BlowersMaselData::m_state_mf_number
int m_state_mf_number
integer that is incremented when composition changes
Definition BlowersMaselRate.h:37
Cantera::BlowersMaselData::partialMolarEnthalpies
vector< double > partialMolarEnthalpies
partial molar enthalpies
Definition BlowersMaselRate.h:34
Cantera::BlowersMaselData::update
void update(double T) override
Update data container based on temperature T
Definition BlowersMaselRate.cpp:14
Cantera::BlowersMaselData::density
double density
used to determine if updates are needed
Definition BlowersMaselRate.h:33
Cantera::ReactionData::recipT
double recipT
inverse of temperature
Definition ReactionData.h:112
Cantera::ReactionData::update
virtual void update(double T)
Update data container based on temperature T
Definition ReactionData.h:36
Cantera::ReactionData::temperature
double temperature
temperature
Definition ReactionData.h:110
Cantera::UnitStack
Unit aggregation utility.
Definition Units.h:105