15ElectronCollisionPlasmaData::ElectronCollisionPlasmaData()
51 if (!node.
hasKey(
"energy-levels") && !node.
hasKey(
"cross-sections")) {
56 m_kind = node[
"kind"].asString();
58 if (node.
hasKey(
"target")) {
59 m_target = node[
"target"].asString();
61 if (node.
hasKey(
"product")) {
71 node[
"type"] =
type();
80 span<const double> sharedLevels)
84 for (
double level : sharedLevels) {
105 "ECPR:evalFromStruct",
"Size mismatch: len(interp) = {}, len(distrib) = {}",
109 auto cs_array = Eigen::Map<const Eigen::ArrayXd>(
114 auto eps = Eigen::Map<const Eigen::ArrayXd>(
119 auto distribution = Eigen::Map<const Eigen::ArrayXd>(
125 simpson(eps.cwiseProduct(distribution.cwiseProduct(cs_array)), eps);
141 vector<double> superElasticEnergyLevels{0.0};
147 for (
size_t i = 0; i < shared_data.
energyLevels.size(); i++) {
151 superElasticEnergyLevels,
158 auto eps = Eigen::Map<const Eigen::ArrayXd>(
163 auto distribution = Eigen::Map<const Eigen::ArrayXd>(
178 if (thermo.
type() ==
"plasma") {
179 electronName =
dynamic_cast<const PlasmaPhase&
>(thermo).electronSpeciesName();
181 throw CanteraError(
"ElectronCollisionPlasmaRate::setContext",
182 "ElectronCollisionPlasmaRate requires plasma phase");
188 "ElectronCollisionPlasmaRate requires exactly two reactants");
193 if (rxn.
reactants.at(electronName) != 1) {
195 "ElectronCollisionPlasmaRate requires one and only one electron");
204 for (
const auto& [p, stoich] : rxn.
products) {
205 if (p == electronName) {
236 "ElectronCollisionPlasmaRate requires exactly two products"
237 " if the reaction is reversible (super-elastic collisions)");
241 if (rxn.
products.at(electronName) != 1) {
243 "ElectronCollisionPlasmaRate requires one and only one electron in products"
244 " if the reaction is reversible (super-elastic collisions)");
Header for plasma reaction rates parameterized by electron collision cross section and electron energ...
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Header file for class PlasmaPhase.
A map of string keys to values whose type can vary at runtime.
double getDouble(const string &key, double default_) const
If key exists, return it as a double, otherwise return default_.
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Base class for exceptions thrown by Cantera classes.
void updateInterpolatedCrossSection(span< const double >)
Update the value of m_crossSectionsInterpolated [m2].
vector< double > m_crossSectionsInterpolated
collision cross sections [m2] after interpolation
virtual void setContext(const Reaction &rxn, const Kinetics &kin) override
Set context of reaction rate evaluation.
int m_levelNumberSuperelastic
Counter used to indicate when m_crossSectionsOffset needs to be synced with the phase.
string m_product
The product of electron collision.
int m_levelNumber
Counter used to indicate when m_energyLevels needs to be synced with the phase.
string m_target
The name of the target of electron collision.
vector< double > m_crossSections
collision cross sections [m2] at m_energyLevels
double m_threshold
The energy threshold of electron collision.
string m_kind
The name of the kind of electron collision.
virtual void getParameters(AnyMap &node) const override
Get parameters.
void modifyRateConstants(const ElectronCollisionPlasmaData &shared_data, double &kf, double &kr)
Calculate the reverse rate coefficient for super-elastic collisions.
Eigen::ArrayXd m_crossSectionsOffset
collision cross section [m2] interpolated on m_energyLevels offset by the threshold energy (the first...
vector< double > m_energyLevels
electron energy levels [eV]
virtual void setParameters(const AnyMap &node, const UnitStack &units) override
Set parameters.
virtual const std::string type() const override
String identifying reaction rate specialization.
double evalFromStruct(const ElectronCollisionPlasmaData &shared_data)
Evaluate reaction rate.
Public interface for kinetics managers.
ThermoPhase & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism.
size_t speciesIndex(const string &name, bool raise=true) const
Returns the index of a species named 'name' within the Phase object.
double charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Base class for handling plasma properties, specifically focusing on the electron energy distribution.
int distributionNumber() const
Return the distribution Number m_distNum.
int levelNumber() const
Return the electron energy level Number m_levelNum.
size_t nElectronEnergyLevels() const
Number of electron levels.
void getElectronEnergyDistribution(span< double > distrb) const
Get electron energy distribution.
void getElectronEnergyLevels(span< double > levels) const
Get electron energy levels.
virtual void setParameters(const AnyMap &node, const UnitStack &units)
Set parameters.
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
bool reversible
True if the current reaction is reversible. False otherwise.
Composition products
Product species and stoichiometric coefficients.
Composition reactants
Reactant species and stoichiometric coefficients.
AnyMap input
Input data used for specific models.
Base class for a phase with thermodynamic properties.
string type() const override
String indicating the thermodynamic model implemented.
Header for a file containing miscellaneous numerical functions.
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
double simpson(const Eigen::ArrayXd &f, const Eigen::ArrayXd &x)
Numerical integration of a function using Simpson's rule with flexibility of taking odd and even numb...
double linearInterp(double x, span< const double > xpts, span< const double > fpts)
Linearly interpolate a function defined on a discrete grid.
const double Avogadro
Avogadro's Number [number/kmol].
const double ElectronCharge
Elementary charge [C].
const double ElectronMass
Electron Mass [kg].
Namespace for the Cantera kernel.
Data container holding shared data specific to ElectronCollisionPlasmaRate.
vector< double > energyLevels
electron energy levels
virtual bool update(const ThermoPhase &phase, const Kinetics &kin) override
Update data container based on thermodynamic phase state.
int levelNumber
integer that is incremented when electron energy levels change
vector< double > distribution
electron energy distribution
int m_dist_number
integer that is incremented when electron energy distribution changes
Unit aggregation utility.