Cantera  3.1.0
Loading...
Searching...
No Matches
LinearBurkeRate.h
Go to the documentation of this file.
1//! @file LinearBurkeRate.h
2// This file is part of Cantera. See License.txt in the top-level directory or
3// at https://cantera.org/license.txt for license and copyright information.
4
5#ifndef CT_LINEARBURKERATE_H
6#define CT_LINEARBURKERATE_H
7
9#include "cantera/kinetics/Falloff.h"
12
13#include <variant>
14
15namespace Cantera
16{
17
18//! Data container holding shared data specific to LinearBurkeRate
19/**
20 * The data container `LinearBurkeData` holds precalculated data common to
21 * all `LinearBurkeRate` objects.
22 */
24{
26
27 void update(double T, double P) override
28 {
30 pressure = P;
31 logP = std::log(P);
32 }
33
34 bool update(const ThermoPhase& phase, const Kinetics& kin) override;
35
37
38 //! Perturb pressure of data container
39 /**
40 * The method is used for the evaluation of numerical derivatives.
41 * @param deltaP relative pressure perturbation
42 */
43 void perturbPressure(double deltaP);
44
45 void restore() override;
46
47 virtual void resize(size_t nSpecies, size_t nReactions, size_t nPhases) override
48 {
49 moleFractions.resize(nSpecies, NAN);
50 ready = true;
51 }
52
53 void invalidateCache() override
54 {
56 pressure = NAN;
57 }
58
59 double pressure = NAN; //!< Pressure
60 double logP = 0.0; //!< Logarithm of pressure
61 bool ready = false; //!< Boolean indicating whether vectors are accessible
62 vector<double> moleFractions;
63 int mf_number;
64
65protected:
66 double m_pressure_buf = -1.0;
67};
68
69//! Pressure-dependent and composition-dependent reaction rate calculated according to
70//! the reduced-pressure linear mixture rule (LMR-R).
71//!
72//! This parameterization is described by Singal et al. @cite singal2024 and in the
73//! [science reference](../reference/kinetics/rate-constants.html#linear-burke-rate-expressions)
74//! documentation.
75//! @ingroup otherRateGroup
76class LinearBurkeRate final : public ReactionRate
77{
78public:
79 //! Default constructor.
80 LinearBurkeRate() = default;
81
82 LinearBurkeRate(const AnyMap& node, const UnitStack& rate_units={});
83
84 unique_ptr<MultiRateBase> newMultiRate() const override {
85 return make_unique<MultiRate<LinearBurkeRate, LinearBurkeData>>();
86 }
87
88 //! Identifier of reaction rate type
89 const string type() const override { return "linear-Burke"; }
90
91 //! Perform object setup based on AnyMap node information
92 /*!
93 * @param node AnyMap containing rate information
94 * @param rate_units Unit definitions specific to rate information
95 */
96 void setParameters(const AnyMap& node, const UnitStack& rate_units) override;
97
98 void getParameters(AnyMap& rateNode) const override;
99
100 //! Type alias that refers to PlogRate, TroeRate, and ChebyshevRate
101 using RateTypes = std::variant<PlogRate, TroeRate, ChebyshevRate>;
102 //! Type alias that refers to PlogData, FalloffData, and ChebyshevData
103 using DataTypes = std::variant<PlogData, FalloffData, ChebyshevData>;
104
105 double evalFromStruct(const LinearBurkeData& shared_data);
106
107 void setContext(const Reaction& rxn, const Kinetics& kin) override;
108
109 void validate(const string& equation, const Kinetics& kin) override;
110
111protected:
112 //! Evaluate overall reaction rate using PLOG to evaluate pressure-dependent aspect
113 //! of the reaction
114 double evalPlogRate(const LinearBurkeData& shared_data, DataTypes& dataObj,
115 RateTypes& rateObj, double logPeff);
116
117 //! Evaluate overall reaction rate using Troe to evaluate pressure-dependent aspect
118 //! of the reaction
119 double evalTroeRate(const LinearBurkeData& shared_data, DataTypes& dataObj,
120 RateTypes& rateObj, double logPeff);
121
122 //! Evaluate overall reaction rate using Chebyshev to evaluate pressure-dependent
123 //! aspect of the reaction
124 double evalChebyshevRate(const LinearBurkeData& shared_data, DataTypes& dataObj,
125 RateTypes& rateObj, double logPeff);
126
127 //! String name of each collider, appearing in the same order as that of the
128 //! original reaction input.
129 vector<string> m_colliderNames;
130
131 //! Index of each collider in the kinetics object species list where the vector
132 //! elements appear in the same order as that of the original reaction input.
133 vector<size_t> m_colliderIndices;
134 //! Indicates which colliders have a distinct k(T,P) versus only an efficiency
135 vector<bool> m_hasRateConstant;
136
137 //! Third-body collision efficiency object for k(T,P,X) and eig0_mix calculation
138 vector<ArrheniusRate> m_epsObjs1;
139 //! Third-body collision efficiency object for logPeff calculation
140 vector<ArrheniusRate> m_epsObjs2;
141 //! Third-body collision efficiency object for the reference collider M
142 //! (eig0_M/eig0_M = 1 always)
144
145 //! Stores rate objects corresponding the reference collider M, which can be
146 //! either PlogRate, TroeRate, or ChebyshevRate
148 //! Stores rate objects corresponding to each non-M collider, which can be either
149 //! PlogRate, TroeRate, or ChebyshevRate
150 vector<RateTypes> m_rateObjs;
151
152 //! Stores data objects corresponding to the reference collider M, which can be
153 //! either PlogData, TroeData, or ChebyshevData
154 DataTypes m_dataObj_M; //!< collider M
155 //! Stores data objects corresponding to each non-M collider, which can be either
156 //! PlogData, TroeData, or ChebyshevData
157 vector<DataTypes> m_dataObjs; //!< list for non-M colliders
158};
159
160}
161#endif
Header for reaction rates that involve Arrhenius-type kinetics.
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
Arrhenius reaction rate type depends only on temperature.
Definition Arrhenius.h:170
Public interface for kinetics managers.
Definition Kinetics.h:125
Pressure-dependent and composition-dependent reaction rate calculated according to the reduced-pressu...
void getParameters(AnyMap &rateNode) const override
Get parameters.
std::variant< PlogData, FalloffData, ChebyshevData > DataTypes
Type alias that refers to PlogData, FalloffData, and ChebyshevData.
double evalTroeRate(const LinearBurkeData &shared_data, DataTypes &dataObj, RateTypes &rateObj, double logPeff)
Evaluate overall reaction rate using Troe to evaluate pressure-dependent aspect of the reaction.
std::variant< PlogRate, TroeRate, ChebyshevRate > RateTypes
Type alias that refers to PlogRate, TroeRate, and ChebyshevRate.
void setContext(const Reaction &rxn, const Kinetics &kin) override
Set context of reaction rate evaluation.
unique_ptr< MultiRateBase > newMultiRate() const override
Create a rate evaluator for reactions of a particular derived type.
vector< string > m_colliderNames
String name of each collider, appearing in the same order as that of the original reaction input.
void setParameters(const AnyMap &node, const UnitStack &rate_units) override
Perform object setup based on AnyMap node information.
vector< RateTypes > m_rateObjs
Stores rate objects corresponding to each non-M collider, which can be either PlogRate,...
LinearBurkeRate()=default
Default constructor.
DataTypes m_dataObj_M
Stores data objects corresponding to the reference collider M, which can be either PlogData,...
void validate(const string &equation, const Kinetics &kin) override
Validate the reaction rate expression.
double evalChebyshevRate(const LinearBurkeData &shared_data, DataTypes &dataObj, RateTypes &rateObj, double logPeff)
Evaluate overall reaction rate using Chebyshev to evaluate pressure-dependent aspect of the reaction.
ArrheniusRate m_epsObj_M
Third-body collision efficiency object for the reference collider M (eig0_M/eig0_M = 1 always)
vector< size_t > m_colliderIndices
Index of each collider in the kinetics object species list where the vector elements appear in the sa...
const string type() const override
Identifier of reaction rate type.
vector< ArrheniusRate > m_epsObjs1
Third-body collision efficiency object for k(T,P,X) and eig0_mix calculation.
double evalPlogRate(const LinearBurkeData &shared_data, DataTypes &dataObj, RateTypes &rateObj, double logPeff)
Evaluate overall reaction rate using PLOG to evaluate pressure-dependent aspect of the reaction.
vector< bool > m_hasRateConstant
Indicates which colliders have a distinct k(T,P) versus only an efficiency.
vector< ArrheniusRate > m_epsObjs2
Third-body collision efficiency object for logPeff calculation.
RateTypes m_rateObj_M
Stores rate objects corresponding the reference collider M, which can be either PlogRate,...
vector< DataTypes > m_dataObjs
Stores data objects corresponding to each non-M collider, which can be either PlogData,...
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
Definition Reaction.h:25
Base class for a phase with thermodynamic properties.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Data container holding shared data specific to LinearBurkeRate.
virtual void resize(size_t nSpecies, size_t nReactions, size_t nPhases) override
Update number of species, reactions and phases.
void perturbPressure(double deltaP)
Perturb pressure of data container.
double logP
Logarithm of pressure.
bool ready
Boolean indicating whether vectors are accessible.
void restore() override
Restore data container after a perturbation.
void invalidateCache() override
Force shared data and reaction rates to be updated next time.
void update(double T, double P) override
Update data container based on temperature T and an extra parameter.
Data container holding shared data used for ReactionRate calculation.
virtual void update(double T)
Update data container based on temperature T
virtual void invalidateCache()
Force shared data and reaction rates to be updated next time.
Unit aggregation utility.
Definition Units.h:105