Cantera  4.0.0a1
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 virtual void resize(Kinetics& kin) override;
47
48 void invalidateCache() override
49 {
51 pressure = NAN;
52 }
53
54 double pressure = NAN; //!< Pressure
55 double logP = 0.0; //!< Logarithm of pressure
56 bool ready = false; //!< Boolean indicating whether vectors are accessible
57 vector<double> moleFractions;
58 int mf_number;
59
60protected:
61 double m_pressure_buf = -1.0;
62};
63
64//! Pressure-dependent and composition-dependent reaction rate calculated according to
65//! the reduced-pressure linear mixture rule (LMR-R).
66//!
67//! This parameterization is described by Singal et al. @cite singal2024 and in the
68//! [science reference](../reference/kinetics/rate-constants.html#linear-burke-rate-expressions)
69//! documentation.
70//! @ingroup otherRateGroup
71class LinearBurkeRate final : public ReactionRate
72{
73public:
74 //! Default constructor.
75 LinearBurkeRate() = default;
76
77 LinearBurkeRate(const AnyMap& node, const UnitStack& rate_units={});
78
79 unique_ptr<MultiRateBase> newMultiRate() const override {
80 return make_unique<MultiRate<LinearBurkeRate, LinearBurkeData>>();
81 }
82
83 //! Identifier of reaction rate type
84 const string type() const override { return "linear-Burke"; }
85
86 //! Perform object setup based on AnyMap node information
87 /*!
88 * @param node AnyMap containing rate information
89 * @param rate_units Unit definitions specific to rate information
90 */
91 void setParameters(const AnyMap& node, const UnitStack& rate_units) override;
92
93 void getParameters(AnyMap& rateNode) const override;
94
95 //! Type alias that refers to PlogRate, TroeRate, and ChebyshevRate
96 using RateTypes = std::variant<PlogRate, TroeRate, ChebyshevRate>;
97 //! Type alias that refers to PlogData, FalloffData, and ChebyshevData
98 using DataTypes = std::variant<PlogData, FalloffData, ChebyshevData>;
99
100 double evalFromStruct(const LinearBurkeData& shared_data);
101
102 void setContext(const Reaction& rxn, const Kinetics& kin) override;
103
104 void validate(const string& equation, const Kinetics& kin) override;
105
106protected:
107 //! Evaluate overall reaction rate using PLOG to evaluate pressure-dependent aspect
108 //! of the reaction
109 double evalPlogRate(const LinearBurkeData& shared_data, DataTypes& dataObj,
110 RateTypes& rateObj, double logPeff);
111
112 //! Evaluate overall reaction rate using Troe to evaluate pressure-dependent aspect
113 //! of the reaction
114 double evalTroeRate(const LinearBurkeData& shared_data, DataTypes& dataObj,
115 RateTypes& rateObj, double logPeff);
116
117 //! Evaluate overall reaction rate using Chebyshev to evaluate pressure-dependent
118 //! aspect of the reaction
119 double evalChebyshevRate(const LinearBurkeData& shared_data, DataTypes& dataObj,
120 RateTypes& rateObj, double logPeff);
121
122 //! String name of each collider, appearing in the same order as that of the
123 //! original reaction input.
124 vector<string> m_colliderNames;
125
126 //! Index of each collider in the kinetics object species list where the vector
127 //! elements appear in the same order as that of the original reaction input.
128 vector<size_t> m_colliderIndices;
129 //! Indicates which colliders have a distinct k(T,P) versus only an efficiency
130 vector<bool> m_hasRateConstant;
131
132 //! Third-body collision efficiency object for k(T,P,X) and eig0_mix calculation
133 vector<ArrheniusRate> m_epsObjs1;
134 //! Third-body collision efficiency object for logPeff calculation
135 vector<ArrheniusRate> m_epsObjs2;
136 //! Third-body collision efficiency object for the reference collider M
137 //! (eig0_M/eig0_M = 1 always)
139
140 //! Stores rate objects corresponding the reference collider M, which can be
141 //! either PlogRate, TroeRate, or ChebyshevRate
143 //! Stores rate objects corresponding to each non-M collider, which can be either
144 //! PlogRate, TroeRate, or ChebyshevRate
145 vector<RateTypes> m_rateObjs;
146
147 //! Stores data objects corresponding to the reference collider M, which can be
148 //! either PlogData, TroeData, or ChebyshevData
149 DataTypes m_dataObj_M; //!< collider M
150 //! Stores data objects corresponding to each non-M collider, which can be either
151 //! PlogData, TroeData, or ChebyshevData
152 vector<DataTypes> m_dataObjs; //!< list for non-M colliders
153};
154
155}
156#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:126
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.
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.
virtual void resize(Kinetics &kin) override
Update array sizes that depend on number of species, reactions and phases.
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