Cantera 2.6.0

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
14BlowersMaselData::BlowersMaselData()
15 : ready(false)
16 , density(NAN)
17 , m_state_mf_number(-1)
18{
19}
20
21 void BlowersMaselData::update(double T) {
22 warn_user("BlowersMaselData::update",
23 "This method does not update the change of reaction enthalpy.");
24 ReactionData::update(T);
25}
26
27 bool BlowersMaselData::update(const ThermoPhase& phase, const Kinetics& kin)
28{
29 double rho = phase.density();
30 int mf = phase.stateMFNumber();
31 double T = phase.temperature();
32 bool changed = false;
33 if (T != temperature) {
34 ReactionData::update(T);
35 changed = true;
36 }
37 if (changed || rho != density || mf != m_state_mf_number) {
38 density = rho;
39 m_state_mf_number = mf;
40 phase.getPartialMolarEnthalpies(partialMolarEnthalpies.data());
41 changed = true;
42 }
43 return changed;
44}
45
46BlowersMaselRate::BlowersMaselRate()
47 : m_deltaH_R(0.)
48{
49 m_Ea_str = "Ea0";
50 m_E4_str = "w";
51}
52
53 BlowersMaselRate::BlowersMaselRate(double A, double b, double Ea0, double w)
54 : ArrheniusBase(A, b, Ea0)
55 , m_deltaH_R(0.)
56{
57 m_Ea_str = "Ea0";
58 m_E4_str = "w";
59 m_E4_R = w / GasConstant;
60}
61
62 double BlowersMaselRate::ddTScaledFromStruct(const BlowersMaselData& shared_data) const
63{
64 warn_user("BlowersMaselRate::ddTScaledFromStruct",
65 "Temperature derivative does not consider changes of reaction enthalpy.");
66 double Ea_R = effectiveActivationEnergy_R(m_deltaH_R);
67 return (Ea_R * shared_data.recipT + m_b) * shared_data.recipT;
68}
69
70 void BlowersMaselRate::setContext(const Reaction& rxn, const Kinetics& kin)
71{
72 m_stoich_coeffs.clear();
73 for (const auto& sp : rxn.reactants) {
74 m_stoich_coeffs.emplace_back(kin.kineticsSpeciesIndex(sp.first), -sp.second);
75 }
76 for (const auto& sp : rxn.products) {
77 m_stoich_coeffs.emplace_back(kin.kineticsSpeciesIndex(sp.first), sp.second);
78 }
79}
80
81}
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::ArrheniusBase
Base class for Arrhenius-type Parameterizations.
Definition: Arrhenius.h:52
Cantera::ArrheniusBase::m_Ea_str
std::string m_Ea_str
The string for activation energy.
Definition: Arrhenius.h:172
Cantera::ArrheniusBase::m_E4_str
std::string m_E4_str
The string for an optional 4th parameter.
Definition: Arrhenius.h:173
Cantera::ArrheniusBase::m_E4_R
double m_E4_R
Optional 4th energy parameter (in temperature units)
Definition: Arrhenius.h:167
Cantera::ArrheniusBase::m_b
double m_b
Temperature exponent.
Definition: Arrhenius.h:165
Cantera::BlowersMaselRate::setContext
virtual void setContext(const Reaction &rxn, const Kinetics &kin) override
Set context of reaction rate evaluation.
Definition: BlowersMaselRate.cpp:70
Cantera::BlowersMaselRate::BlowersMaselRate
BlowersMaselRate()
Default constructor.
Definition: BlowersMaselRate.cpp:46
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:142
Cantera::BlowersMaselRate::m_deltaH_R
double m_deltaH_R
enthalpy change of reaction (in temperature units)
Definition: BlowersMaselRate.h:187
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:62
Cantera::BlowersMaselRate::m_stoich_coeffs
std::vector< std::pair< size_t, double > > m_stoich_coeffs
Pairs of species indices and multiplers to calculate enthalpy change.
Definition: BlowersMaselRate.h:185
Cantera::Kinetics
Public interface for kinetics managers.
Definition: Kinetics.h:114
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:265
Cantera::Phase::density
virtual double density() const
Density (kg/m^3).
Definition: Phase.h:679
Cantera::Phase::stateMFNumber
int stateMFNumber() const
Return the State Mole Fraction Number.
Definition: Phase.h:858
Cantera::Phase::temperature
doublereal temperature() const
Temperature (K).
Definition: Phase.h:654
Cantera::Reaction
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
Definition: Reaction.h:33
Cantera::Reaction::products
Composition products
Product species and stoichiometric coefficients.
Definition: Reaction.h:138
Cantera::Reaction::reactants
Composition reactants
Reactant species and stoichiometric coefficients.
Definition: Reaction.h:135
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
Cantera::ThermoPhase::getPartialMolarEnthalpies
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: ThermoPhase.h:521
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::warn_user
void warn_user(const std::string &method, const std::string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Definition: global.h:245
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:113
Cantera::BlowersMaselData
Data container holding shared data specific to BlowersMaselRate.
Definition: BlowersMaselRate.h:20
Cantera::ReactionData::recipT
double recipT
inverse of temperature
Definition: ReactionData.h:111