8#include <boost/math/special_functions/gamma.hpp>
11#include "cantera/numerics/eigen_dense.h"
15#include <boost/polymorphic_pointer_cast.hpp>
28 m_eedfSolver = make_unique<EEDFTwoTermApproximation>(
this);
31 size_t nGridCells = 301;
43PlasmaPhase::~PlasmaPhase()
45 if (shared_ptr<Solution> soln =
m_soln.lock()) {
46 soln->removeChangedCallback(
this);
47 soln->kinetics()->removeReactionAddedCallback(
this);
62 "No electron species found.");
72 static const int cacheId =
m_cache.getId();
73 CachedScalar cached =
m_cache.getScalar(cacheId);
79 if (cached.
state1 != tempNow || cached.
state2 != electronTempNow) {
85 cached.
state2 = electronTempNow;
101 if ((spec->name ==
"e" || spec->name ==
"Electron") ||
102 (spec->composition.find(
"E") != spec->composition.end() &&
103 spec->composition.size() == 1 &&
104 spec->composition[
"E"] == 1)) {
109 "Cannot add species, {}. "
110 "Only one electron species is allowed.", spec->name);
128 if (shared_ptr<Solution> soln =
m_soln.lock()) {
129 soln->registerChangedCallback(
this, [&]() {
139 phaseNode[
"vibrational-reservoir-species-mapping"] =
146 eedf[
"energy-levels"] = levels;
148 eedf[
"shape-factor"] = m_isotropicShapeFactor;
153 eedf[
"distribution"] = dist;
156 phaseNode[
"electron-energy-distribution"] = std::move(eedf);
161 const string routineName =
"PlasmaPhase::setElectronEnergyDistributionParameters";
162 if (!eedf.
hasKey(
"type")) {
164 "The electron energy distribution mapping requires the key 'type'.");
169 if (eedf.
hasKey(
"shape-factor")) {
173 "isotropic type requires shape-factor key.");
175 if (eedf.
hasKey(
"mean-electron-energy")) {
176 double energy = eedf.
convert(
"mean-electron-energy",
"eV");
180 "isotropic type requires mean-electron-energy key.");
182 if (eedf.
hasKey(
"energy-levels")) {
183 auto levels = eedf[
"energy-levels"].asVector<
double>();
188 if (!eedf.
hasKey(
"energy-levels")) {
190 "Cannot find key energy-levels.");
192 if (!eedf.
hasKey(
"distribution")) {
194 "Cannot find key distribution.");
196 if (eedf.
hasKey(
"normalize")) {
199 auto levels = eedf[
"energy-levels"].asVector<
double>();
200 auto distribution = eedf[
"distribution"].asVector<
double>(levels.size());
203 if (eedf.
hasKey(
"energy-levels")) {
204 auto levels = eedf[
"energy-levels"].asVector<
double>();
209 if (!eedf.
hasKey(
"initial-max-energy-level")) {
211 "Boltzmann-two-term requires either "
212 "'energy-levels' or 'initial-max-energy-level'.");
215 if (!eedf.
hasKey(
"grid-cell-count")) {
217 "Boltzmann-two-term requires either 'energy-levels' "
218 "or 'grid-cell-count'.");
221 double initialMaxEnergy = eedf[
"initial-max-energy-level"].asDouble();
222 size_t nGridCells =
static_cast<size_t>(eedf[
"grid-cell-count"].asInt());
224 if (!std::isfinite(initialMaxEnergy) || initialMaxEnergy <= 0.0) {
226 "initial-max-energy-level must be finite and greater than zero.");
229 if (nGridCells == 0) {
231 "grid-cell-count must be greater than zero.");
234 string energyLevelsDistribution =
235 eedf.
getString(
"energy-level-spacing",
"linear");
238 initialMaxEnergy, nGridCells, energyLevelsDistribution);
240 if (energyLevelsDistribution ==
"linear") {
241 m_eedfSolver->setLinearGrid(initialMaxEnergy, nGridCells);
242 }
else if (energyLevelsDistribution ==
"quadratic") {
243 m_eedfSolver->setQuadraticGrid(initialMaxEnergy, nGridCells);
244 }
else if (energyLevelsDistribution ==
"geometric") {
245 if (eedf.
hasKey(
"geometric-grid-ratio")) {
246 double ratio = eedf[
"geometric-grid-ratio"].asDouble();
247 if (!std::isfinite(ratio) || ratio <= 1.0) {
249 "geometric-grid-ratio must be finite and greater than 1.0.");
251 m_eedfSolver->setGeometricGrid(initialMaxEnergy, nGridCells, ratio);
253 m_eedfSolver->setGeometricGrid(initialMaxEnergy, nGridCells);
257 "energy-level-spacing should be linear, quadratic or geometric.");
260 if (eedf.
hasKey(
"energy-grid-adaptation")) {
261 const AnyMap adapt = eedf[
"energy-grid-adaptation"].as<
AnyMap>();
262 bool enabled = adapt.
getBool(
"enabled",
true);
263 bool maxwellianReset = adapt.
getBool(
"Maxwellian-reset",
true);
264 double minDecayDecades = adapt.
getDouble(
"min-decay-decades", 10.0);
265 double maxDecayDecades = adapt.
getDouble(
"max-decay-decades", 12.0);
266 double updateFactor = adapt.
getDouble(
"update-factor", 0.1);
267 size_t maxIterations = adapt.
getInt(
"max-iterations", 1000);
270 minDecayDecades, maxDecayDecades, updateFactor, maxIterations,
279 if (eedf.
hasKey(
"reduced-field-threshold-before-Maxwellian")) {
280 double maxwellianThreshold =
281 eedf.
convert(
"reduced-field-threshold-before-Maxwellian",
"Td");
282 if (!std::isfinite(maxwellianThreshold) || maxwellianThreshold < 0.0) {
284 "reduced-field-threshold-before-Maxwellian must be finite "
285 "and non-negative.");
288 m_eedfSolver->setReducedElectricFieldThresholdForMaxwellian(
289 maxwellianThreshold);
301 "Unknown electron energy distribution type '{}'. Supported types are "
302 "'isotropic', 'discretized', and 'Boltzmann-two-term'.",
310 if (phaseNode.
hasKey(
"electron-energy-distribution")) {
311 const AnyMap eedf = phaseNode[
"electron-energy-distribution"].as<
AnyMap>();
316 if (phaseNode.
hasKey(
"vibrational-reservoir-species-mapping")) {
318 phaseNode[
"vibrational-reservoir-species-mapping"].asMap<
string>();
321 if (rootNode.
hasKey(
"electron-collisions")) {
322 for (
const auto& item : rootNode[
"electron-collisions"].asVector<AnyMap>()) {
323 auto rate = make_shared<ElectronCollisionPlasmaRate>(item);
325 reactants[item[
"target"].asString()] = 1;
327 if (item.hasKey(
"product")) {
328 products[item[
"product"].asString()] = 1;
330 products[item[
"target"].asString()] = 1;
333 if (rate->kind() ==
"ionization") {
335 }
else if (rate->kind() ==
"attachment") {
338 auto R = make_shared<Reaction>(reactants, products, rate);
351 throw CanteraError(
"PlasmaPhase::updateElectronEnergyDistribution",
352 "Invalid for discretized electron energy distribution.");
356 auto ierr =
m_eedfSolver->calculateDistributionFunction();
363 throw CanteraError(
"PlasmaPhase::updateElectronEnergyDistribution",
364 "Call to calculateDistributionFunction failed.");
367 throw CanteraError(
"PlasmaPhase::updateElectronEnergyDistribution",
379 throw CanteraError(
"PlasmaPhase::normalizeElectronEnergyDistribution",
380 "The norm is negative. This might be caused by bad "
381 "electron energy distribution");
388 if (
type ==
"discretized" ||
389 type ==
"isotropic" ||
390 type ==
"Boltzmann-two-term") {
393 throw CanteraError(
"PlasmaPhase::setElectronEnergyDistributionType",
394 "Unknown type for electron energy distribution.");
401 double x = m_isotropicShapeFactor;
402 double gamma1 = boost::math::tgamma(3.0 / 2.0 / x);
403 double gamma2 = boost::math::tgamma(5.0 / 2.0 / x);
404 double c1 = x * std::pow(gamma2, 1.5) / std::pow(gamma1, 2.5);
405 double c2 = std::pow(gamma2 / gamma1, x);
415 throw CanteraError(
"PlasmaPhase::setElectronTemperature",
416 "Electron temperature cannot be negative.");
469 const auto& rate = boost::polymorphic_pointer_downcast
481 throw CanteraError(
"PlasmaPhase::checkElectronEnergyLevels",
482 "Values of electron energy levels need to be positive and "
483 "monotonically increasing.");
492 throw CanteraError(
"PlasmaPhase::checkElectronEnergyDistribution",
493 "Values of electron energy distribution cannot be negative.");
496 warn_user(
"PlasmaPhase::checkElectronEnergyDistribution",
497 "The value of the last element of electron energy distribution exceed 0.01. "
498 "This indicates that the value of electron energy level is not high enough "
499 "to contain the isotropic distribution at mean electron energy of "
505 span<const double> dist)
534 if (epsilon_m < 0.0) {
535 throw CanteraError(
"PlasmaPhase::updateElectronTemperatureFromEnergyDist",
536 "The electron energy distribution produces negative electron temperature.");
543 m_isotropicShapeFactor = x;
549 if (shared_ptr<Solution> soln =
m_soln.lock()) {
550 shared_ptr<Kinetics> kin = soln->kinetics();
557 set<Reaction*> existing;
559 existing.insert(R.get());
561 for (
size_t i = 0; i < kin->nReactions(); i++) {
562 shared_ptr<Reaction> R = kin->reaction(i);
563 if (R->rate()->type() !=
"electron-collision-plasma"
564 || existing.count(R.get())) {
572 kin->registerReactionAddedCallback(
this, [
this, kin]() {
573 size_t i = kin->nReactions() - 1;
574 if (kin->reaction(i)->type() ==
"electron-collision-plasma") {
590 std::dynamic_pointer_cast<ElectronCollisionPlasmaRate>(
collision->rate());
603 if (target.empty()) {
604 throw CanteraError(
"PlasmaPhase::addCollision",
"Error identifying target for"
605 " collision with equation '{}'",
collision->equation());
610 std::dynamic_pointer_cast<ElectronCollisionPlasmaRate>(
collision->rate()));
621 if ((kind ==
"effective" || kind ==
"elastic")) {
627 throw CanteraError(
"PlasmaPhase::addCollision",
"Phase already contains"
628 " an effective/elastic cross section for '{}'.", target);
636 auto levels = rate.energyLevels();
638 auto sections = rate.crossSections();
664 for (
size_t i = 1; i <
m_nPoints - 1; i++) {
670 (h1 * h0) / (h1 + h0);
684 static const int cacheId =
m_cache.getId();
685 CachedScalar last_stateNum =
m_cache.getScalar(cacheId);
699 if (interpChanged[i]) {
718 auto cs_array = Eigen::Map<const Eigen::ArrayXd>(
740 "EEDF not initialized");
754 if (!std::isfinite(q_elastic)) {
756 "Non-finite elastic power loss");
769 "Electron mobility is only available for 'Boltzmann-two-term' "
770 "electron energy distributions.");
783 for (
size_t k = 0; k <
m_kk; ++k) {
794 for (
size_t k = 0; k <
m_kk; ++k) {
805 for (
size_t k = 0; k <
m_kk; ++k) {
816 for (
size_t k = 0; k <
m_kk; ++k) {
831 return T_g + X_e * (T_e - T_g);
851 for (
size_t k = 0; k <
nSpecies(); k++) {
860 for (
size_t k = 0; k <
m_kk; k++) {
875 mu[k] += (
RTe() -
RT()) * log(xx);
904 for (
size_t k = 0; k <
m_kk; k++) {
905 ubar[k] =
RT() * (_h[k] - 1.0);
909 ubar[k] =
RTe() * (_h[k] - 1.0);
915 for (
size_t k = 0; k <
m_kk; k++) {
934 for (
size_t k = 0; k <
m_kk; k++) {
946 for (
size_t k = 0; k <
m_kk; k++) {
980 AnyMap state = input_state;
983 if (state.
hasKey(
"electron-temperature")) {
984 state[
"Te"] = state[
"electron-temperature"];
992 if (state.
hasKey(
"gas-temperature")) {
993 state[
"T"] = state[
"gas-temperature"];
996 state[
"T"] = state[
"Tg"];
1019 return sigma * E * E;
1039 size_t kReservoir =
speciesIndex(reservoirName,
false);
1042 if (kReservoir ==
npos) {
1044 "PlasmaPhase::updateVibrationalReservoirSpecies",
1045 "Vibrational reservoir species '{}' is not present "
1050 if (kBase ==
npos) {
1052 "PlasmaPhase::updateVibrationalReservoirSpecies",
1053 "Base species '{}' associated with vibrational "
1054 "reservoir '{}' is not present in the phase.",
1078 const size_t kReservoir = reservoir.reservoirIndex;
1079 const size_t kBase = reservoir.baseSpeciesIndex;
1086 const double pool = Xv + Xb;
1090 reservoir.warningActive =
false;
1098 const double reservoirFraction = Xv / pool;
1102 if (reservoir.warningActive) {
1103 if (reservoirFraction < resetThreshold) {
1104 reservoir.warningActive =
false;
1110 const string& reservoirName =
speciesName(kReservoir);
1113 warn_user(
"PlasmaPhase::checkVibrationalReservoirMoleFractions",
1114 "Warning: fictive vibrational reservoir species '{}' contains "
1115 "{:.3e} of the total '{}' pool. "
1116 "X({}) = {:.3e}, X({}) = {:.3e}, threshold = {:.3e}. "
1117 "Chemistry involving '{}' may be affected because part of the "
1118 "material is stored in an inert vibrational reservoir.\n",
1126 reservoir.warningActive =
true;
EEDF Two-Term approximation solver.
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.
Declaration for class Cantera::Species.
A map of string keys to values whose type can vary at runtime.
long int getInt(const string &key, long int default_) const
If key exists, return it as a long int, otherwise return default_.
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.
double convert(const string &key, const string &units) const
Convert the item stored by the given key to the units specified in units.
bool getBool(const string &key, bool default_) const
If key exists, return it as a bool, otherwise return default_.
const string & getString(const string &key, const string &default_) const
If key exists, return it as a string, otherwise return default_.
Base class for exceptions thrown by Cantera classes.
Electron collision plasma reaction rate type.
void getGibbs_ref(span< double > g) const override
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
void getPartialMolarEnthalpies(span< double > hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
vector< double > m_g0_RT
Temporary storage for dimensionless reference state Gibbs energies.
vector< double > m_h0_RT
Temporary storage for dimensionless reference state enthalpies.
span< const double > enthalpy_RT_ref() const
Returns a reference to the dimensionless reference state enthalpy vector.
virtual void updateThermo() const
Update the species reference state thermodynamic functions.
vector< double > m_s0_R
Temporary storage for dimensionless reference state entropies.
void getPartialMolarEntropies(span< double > sbar) const override
Returns an array of partial molar entropies of the species in the solution.
vector< double > m_cp0_R
Temporary storage for dimensionless reference state heat capacities.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
void getChemPotentials(span< double > mu) const override
Get the species chemical potentials. Units: J/kmol.
void getStandardVolumes_ref(span< double > vol) const override
Get the molar volumes of the species reference states at the current T and P_ref of the solution.
An error indicating that an unimplemented function has been called.
ValueCache m_cache
Cached for saved calculations within each ThermoPhase.
size_t nSpecies() const
Returns the number of species in the phase.
size_t m_kk
Number of species in the phase.
size_t speciesIndex(const string &name, bool raise=true) const
Returns the index of a species named 'name' within the Phase object.
double temperature() const
Temperature (K).
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol).
virtual double concentration(const size_t k) const
Concentration of species k.
string speciesName(size_t k) const
Name of the species with index k.
double moleFraction(size_t k) const
Return the mole fraction of a single species.
virtual double density() const
Density (kg/m^3).
double molecularWeight(size_t k) const
Molecular weight of species k.
string name() const
Return the name of the phase.
void checkElectronEnergyDistribution() const
Check the electron energy distribution.
void getStandardChemPotentials(span< double > muStar) const override
Return the standard chemical potentials of the species. Units: J/kmol.
vector< vector< double > > m_energyLevels
Electron energy levels corresponding to the cross section data.
void setCollisions()
Set collisions.
double meanElectronEnergy() const
Mean electron energy [eV].
void getGibbs_ref(span< double > g) const override
Return the reference chemical potentials of the species. Units: J/kmol.
double m_electronTempEquil
Saved electron temperature during an equilibrium solve.
double enthalpy_mole() const override
Return the Molar enthalpy. Units: J/kmol.
size_t m_nPoints
Number of points of electron energy levels.
void setState(const AnyMap &state) override
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
void getActivities(span< double > a) const override
Get the array of non-dimensional activities at the current solution temperature, pressure,...
void addCollision(shared_ptr< Reaction > collision)
Add a collision and record the target species.
bool m_vibrationalReservoirSpeciesNeedUpdate
A boolean flag to update vibrational reservoir species.
virtual void setSolution(std::weak_ptr< Solution > soln) override
Set the link to the Solution object that owns this ThermoPhase.
void normalizeElectronEnergyDistribution()
Electron energy distribution norm.
void updateThermo() const override
Update the species reference state thermodynamic functions.
void getPartialMolarEnthalpies(span< double > hbar) const override
Return the partial molar enthalpies of the species in the solution. Units: J/kmol.
vector< size_t > m_targetSpeciesIndices
The collision-target species indices of m_collisions.
void setElectronTemperature(double Te) override
Set the internally stored electron temperature of the phase [K].
void electronEnergyLevelChanged()
When electron energy level changed, plasma properties such as electron-collision reaction rates need ...
double pressure() const override
Return the pressure of the plasma phase. Units: Pa.
double elasticPowerLoss()
The elastic power loss [J/s/m³].
int m_levelNum
Electron energy level change variable.
bool updateInterpolatedCrossSection(size_t k)
Update interpolated cross section of a collision.
double m_vibrationalAbsoluteMoleFractionThreshold
The absolute mole threshold below which a the chemistry is assumed to be safe from alterations from v...
bool m_inEquilibrate
Lock flag (default off).
void electronEnergyDistributionChanged()
When electron energy distribution changed, plasma properties such as electron-collision reaction rate...
vector< VibrationalReservoirSpecies > m_vibrationalReservoirSpecies
Vector of species serving as mean vibrational energy reservoirs.
size_t nElectronEnergyLevels() const
Number of electron levels.
size_t nCollisions() const
Number of electron collision cross sections.
void endEquilibrate() override
Hook called at the end of an equilibrium calculation on this phase.
Eigen::ArrayXd m_electronEnergyDist
Normalized electron energy distribution vector [-] Length: m_nPoints.
double electricField() const
Get the applied electric field strength [V/m].
Eigen::ArrayXd m_electronEnergyLevels
electron energy levels [ev]. Length: m_nPoints
void updateVibrationalReservoirSpecies()
Resolve configured vibrational reservoir and base species names to their corresponding phase species ...
void getActivityCoefficients(span< double > ac) const override
Get the array of non-dimensional activity coefficients at the current solution temperature,...
double meanTemperature() const
Return the mean temperature of the plasma phase. Units: K.
double intrinsicHeating() override
Intrinsic volumetric heating rate [W/m³].
double electronMobility() const
The electron mobility (m²/V/s).
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
string type() const override
String indicating the thermodynamic model implemented.
void checkElectronEnergyLevels() const
Check the electron energy levels.
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
void updateElasticElectronEnergyLossCoefficients()
Update elastic electron energy loss coefficients.
void updateElectronTemperatureFromEnergyDist()
Update electron temperature (K) From energy distribution.
string m_distributionType
Electron energy distribution type. Can be "isotropic", "discretized" or "Boltzmann-two-term".
void updateElectronEnergyDistribution()
Update the electron energy distribution.
void checkVibrationalReservoirMoleFractions()
A function to check that vibrational reservoir species are not at risk to hinder phase chemistry.
vector< double > m_elasticElectronEnergyLossCoefficients
Elastic electron energy loss coefficients (eV m3/s).
string m_quadratureMethod
Numerical quadrature method for electron energy distribution.
map< string, string > m_vibrationalReservoirSpeciesMapping
Mapping of vibrational reservoir species names to their corresponding base species names.
PlasmaPhase(const string &inputFile="", const string &id="")
Construct and initialize a PlasmaPhase object directly from an input file.
void beginEquilibrate() override
Hook called at the beginning of an equilibrium calculation on this phase.
void setDiscretizedElectronEnergyDist(span< const double > levels, span< const double > distrb)
Set discretized electron energy distribution.
double m_electronTemp
Electron temperature [K].
double RTe() const
Return the Gas Constant multiplied by the current electron temperature [J/kmol].
double intEnergy_mole() const override
Return the molar internal energy. Units: J/kmol.
double entropy_mole() const override
Return the molar entropy. Units: J/kmol/K.
bool m_do_normalizeElectronEnergyDist
Flag of normalizing electron energy distribution.
void updateElectronEnergyDistDifference()
Update electron energy distribution difference.
void updateElasticElectronEnergyLossCoefficient(size_t i)
Updates the elastic electron energy loss coefficient for collision index i.
vector< size_t > m_kElastic
Indices of elastic collisions in m_crossSections.
double m_vibrationalMoleFractionThreshold
Threshold fraction of vibrational reservoirs to their ground state above which they may be at risk of...
unique_ptr< EEDFTwoTermApproximation > m_eedfSolver
Solver used to calculate the EEDF based on electron collision rates.
string electronSpeciesName() const
Electron species name.
void setElectronEnergyDistributionParameters(const AnyMap &eedf)
Set parameters for the electron energy distribution.
void setIsotropicElectronEnergyDistribution()
Set isotropic electron energy distribution.
void getPartialMolarVolumes(span< double > vbar) const override
Return the partial molar volumes of the species in the solution. Units: m³/kmol.
Eigen::ArrayXd m_electronEnergyDistDiff
ionization degree for the electron-electron collisions (tmp is the previous one)
void getStandardVolumes(span< double > vol) const override
Return the standard molar volumes of the species. Units: m³/kmol.
void getPartialMolarEntropies(span< double > sbar) const override
Return the partial molar entropies of the species in the solution. Units: J/kmol/K.
double gibbs_mole() const override
Return the molar Gibbs free energy. Units: J/kmol.
double standardConcentration(size_t k=0) const override
Returns the standard concentration , which is used to normalize the generalized concentration.
std::vector< double > m_work
Work array.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
const shared_ptr< Reaction > collision(size_t i) const
Get the Reaction object associated with electron collision i.
vector< bool > m_interp_cs_ready
The list of whether the interpolated cross sections is ready.
vector< shared_ptr< ElectronCollisionPlasmaRate > > m_collisionRates
The list of shared pointers of collision rates.
void getChemPotentials(span< double > mu) const override
Return the chemical potentials of the species in the solution. Units: J/kmol.
void setElectronEnergyLevels(span< const double > levels)
Set electron energy levels.
vector< shared_ptr< Reaction > > m_collisions
The list of shared pointers of plasma collision reactions.
void setParameters(const AnyMap &phaseNode, const AnyMap &rootNode=AnyMap()) override
Set equation of state parameters from an AnyMap phase description.
void setMeanElectronEnergy(double energy)
Set mean electron energy [eV].
void getStandardVolumes_ref(span< double > vol) const override
Return the molar volumes of the species reference states. Units: m³/kmol.
size_t m_electronSpeciesIndex
Index of electron species.
vector< vector< double > > m_crossSections
Cross section data.
void setElectronEnergyDistributionType(const string &type)
Set electron energy distribution type.
double jouleHeatingPower() const
The joule heating power (W/m³).
vector< size_t > m_kInelastic
Indices of inelastic collisions in m_crossSections.
double electronTemperature() const override
Electron Temperature [K].
void setIsotropicShapeFactor(double x)
Set the shape factor of isotropic electron energy distribution.
void enableNormalizeElectronEnergyDist(bool enable)
Set flag of automatically normalize electron energy distribution.
void getPartialMolarIntEnergies(span< double > ubar) const override
Return the partial molar internal energies of the species in the solution. Units: J/kmol.
int m_distNum
Electron energy distribution change variable.
virtual void endEquilibrate()
Hook called at the end of an equilibrium calculation on this phase.
virtual void setParameters(const AnyMap &phaseNode, const AnyMap &rootNode=AnyMap())
Set equation of state parameters from an AnyMap phase description.
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
virtual void setState(const AnyMap &state)
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
double RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void setSolution(std::weak_ptr< Solution > soln)
Set the link to the Solution object that owns this ThermoPhase.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
std::weak_ptr< Solution > m_soln
reference to Solution
virtual void beginEquilibrate()
Hook called at the beginning of an equilibrium calculation on this phase.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual double refPressure() const
Returns the reference pressure in Pa.
Header for a file containing miscellaneous numerical functions.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
double numericalQuadrature(const string &method, const Eigen::ArrayXd &f, const Eigen::ArrayXd &x)
Numerical integration of a function.
const double Boltzmann
Boltzmann constant [J/K].
const double Avogadro
Avogadro's Number [number/kmol].
const double GasConstant
Universal Gas Constant [J/kmol/K].
const double ElectronCharge
Elementary charge [C].
const double ElectronMass
Electron Mass [kg].
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
void checkFinite(const double tmp)
Check to see that a number is finite (not NaN, +Inf or -Inf).
MappedVector asVectorXd(vector< double > &v)
Convenience wrapper for accessing std::vector as an Eigen VectorXd.
span< double > asSpan(Eigen::DenseBase< Derived > &v)
Convenience wrapper for accessing Eigen vector/array/map data as a span.
const double SmallNumber
smallest number to compare to zero.
map< string, double > Composition
Map from string names to doubles.
void checkArraySize(const char *procedure, size_t available, size_t required)
Wrapper for throwing ArraySizeError.
double state2
Value of the second state variable for the state at which value was evaluated, for example density or...
bool validate(double state1New)
Check whether the currently cached value is valid based on a single state variable.
double state1
Value of the first state variable for the state at which value was evaluated, for example temperature...
A structure to describe species serving as mean vibrational energy reservoirs.
size_t reservoirIndex
Index of the vibrational reservoir species.
size_t baseSpeciesIndex
Index of the corresponding ground state phase species.