18#ifndef RIZER_PLASMARATES_H
19#define RIZER_PLASMARATES_H
27#include <unordered_map>
28#include <unordered_set>
51std::shared_ptr<Cantera::Solution>
loadMechanism(
const std::string& mech,
52 const std::string& phase);
97 std::unique_ptr<Cantera::MultiRateBase>
newMultiRate()
const override;
99 const std::string
type()
const override {
100 return "janev-dissociative-recombination-C2Hy";
149 std::unique_ptr<Cantera::MultiRateBase>
newMultiRate()
const override;
151 const std::string
type()
const override {
return "Druyvesteyn"; }
166 void validate(
const std::string& equation,
177 double logRate(
double Te)
const;
217 m_Tg = m_Te = m_P = NAN;
230 std::shared_ptr<Cantera::Solution>
shadow;
251 std::vector<std::shared_ptr<Cantera::ReactionRate>>
fwdRate;
265 void computeLogEquilibriumConstants(std::vector<double>& logKeq);
270 std::vector<double> m_deltaG;
291 std::unique_ptr<Cantera::MultiRateBase>
newMultiRate()
const override;
293 const std::string
type()
const override {
294 return "reverse-two-temperature-plasma";
void setParameters(const Cantera::AnyMap &node, const Cantera::UnitStack &rate_units) override
Set the rate parameters from a YAML/AnyMap rate node.
double logRate(double Te) const
Natural log of the rate, , finite where the rate itself underflows to 0.
std::unique_ptr< Cantera::MultiRateBase > newMultiRate() const override
double m_b
Te exponent [-].
const std::string type() const override
double m_A
Pre-factor in Cantera's internal (kmol, m, s) rate-coefficient units [order-dependent].
void getParameters(Cantera::AnyMap &node) const override
void validate(const std::string &equation, const Cantera::Kinetics &kin) override
Reject a missing or negative pre-factor (mirrors the Python rate's validate; missing "A" leaves m_A a...
double evalFromStruct(const ElectronTemperatureData &shared_data) const
Evaluate the Druyvesteyn rate .
double m_Ea_K
Activation energy expressed in Kelvin [K].
DruyvesteynRate()=default
std::unique_ptr< Cantera::MultiRateBase > newMultiRate() const override
const std::string type() const override
void setParameters(const Cantera::AnyMap &node, const Cantera::UnitStack &rate_units) override
Set the rate parameters from a YAML/AnyMap rate node.
JanevDissociativeRecombinationC2HyRate()=default
double evalFromStruct(const ElectronTemperatureData &shared_data) const
Evaluate the Janev dissociative-recombination rate .
double m_A
Rate pre-factor, in Cantera's internal (kmol, m, s) rate-coefficient units [kmol/m^3/s units,...
void getParameters(Cantera::AnyMap &node) const override
std::unique_ptr< Cantera::MultiRateBase > newMultiRate() const override
double evalFromStruct(const ReverseTwoTempData &shared_data) const
Evaluate the reverse rate at the tagged temperature.
ReverseTwoTemperaturePlasmaRate()=default
void getParameters(Cantera::AnyMap &node) const override
std::string m_forward_equation
Equation string of the forward reaction this rate reverses [-].
const std::string type() const override
size_t m_idx
Cached index of the forward reaction in the shadow kinetics' reaction list [-].
void setParameters(const Cantera::AnyMap &node, const Cantera::UnitStack &rate_units) override
Set the rate parameters from a YAML/AnyMap rate node.
std::string m_T
Which temperature tags this reaction ("Te" or "Tg"); informational, kept for YAML round-trip [-].
std::shared_ptr< Cantera::Solution > loadMechanism(const std::string &mech, const std::string &phase)
Load a mechanism with rizer's custom rate types registered first.
void registerPlasmaRates()
Register the custom plasma reaction rates with Cantera's ReactionRateFactory.
virtual void update(double T)
virtual void invalidateCache()
Shared data carrying the electron temperature (mirrors Cantera's own TwoTempPlasmaData but only needs...
void invalidateCache() override
double electronTemp
electron temperature [K]
bool update(const Cantera::ThermoPhase &phase, const Cantera::Kinetics &kin) override
Read the electron temperature from the phase.
Shared data for all reverse-two-temperature-plasma reactions.
bool update(const Cantera::ThermoPhase &phase, const Cantera::Kinetics &kin) override
Refresh the cached Tg, Te, P and the shadow-solution rate/equilibrium constants.
std::unordered_set< std::string > ambiguousForward
Forward equations shared by more than one forward reaction [-].
std::vector< std::shared_ptr< Cantera::ReactionRate > > fwdRate
Per-reaction forward rate of the shadow, read by the log-space path.
std::shared_ptr< Cantera::Solution > shadow
Forward-only ideal-gas shadow solution [-].
std::vector< double > Keq_Tg
bool anyTeTagged
Whether any reverse reaction is tagged T: Te.
std::vector< double > kf_Te
Per-reaction forward rate constant [kmol/m^3/s units, order-dependent] and dimensionless Kc,...
std::vector< double > logKeq_Tg
Per-reaction natural log of Kc at Tg and at Te [-], from the standard Gibbs energy of reaction,...
std::vector< double > logKeq_Te
std::vector< double > Keq_Te
double electronTemperature() const
Electron temperature from the last update() [K].
std::vector< double > deltaN
Per-reaction change in moles, products minus reactants [-].
std::unordered_map< std::string, size_t > fwdIndex
Forward reaction equation string -> index into the shadow kinetics' reaction list [-].
void invalidateCache() override
void buildShadow(const Cantera::ThermoPhase &phase, const Cantera::Kinetics &kin)
Lazily build the ideal-gas shadow Solution from the main phase + kinetics.
double gasTemperature() const
Gas temperature from the last update() [K].
std::vector< double > kf_Tg
Per-reaction forward rate constant [kmol/m^3/s units, order-dependent] and dimensionless Kc,...