Loading [MathJax]/extensions/tex2jax.js
Cantera  3.2.0a1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PlasmaPhase.h
Go to the documentation of this file.
1/**
2 * @file PlasmaPhase.h
3 * Header file for class PlasmaPhase.
4 */
5
6// This file is part of Cantera. See License.txt in the top-level directory or
7// at https://cantera.org/license.txt for license and copyright information.
8
9#ifndef CT_PLASMAPHASE_H
10#define CT_PLASMAPHASE_H
11
13#include "cantera/numerics/eigen_sparse.h"
14
15namespace Cantera
16{
17
18class Reaction;
19class ElectronCollisionPlasmaRate;
20
21//! Base class for handling plasma properties, specifically focusing on the
22//! electron energy distribution.
23/*!
24 * This class provides functionality to manage the the electron energy distribution
25 * using two primary methods for defining the electron distribution and electron
26 * temperature.
27 *
28 * The first method utilizes setElectronTemperature(), which sets the electron
29 * temperature and calculates the electron energy distribution assuming an
30 * isotropic-velocity model. Note that all units in PlasmaPhase are in SI, except
31 * for electron energy, which is measured in volts.
32 *
33 * The generalized electron energy distribution for an isotropic-velocity
34 * distribution (as described by Gudmundsson @cite gudmundsson2001 and Khalilpour
35 * and Foroutan @cite khalilpour2020)
36 * is given by:
37 * @f[
38 * f(\epsilon) = c_1 \frac{\sqrt{\epsilon}}{\epsilon_m^{3/2}}
39 * \exp \left(-c_2 \left(\frac{\epsilon}{\epsilon_m}\right)^x \right),
40 * @f]
41 * where @f$ x = 1 @f$ corresponds to a Maxwellian distribution and
42 * @f$ x = 2 @f$ corresponds to a Druyvesteyn distribution (which is the
43 * default). Here, @f$ \epsilon_m = \frac{3}{2} T_e @f$ [V] represents the
44 * mean electron energy.
45 *
46 * The total probability distribution integrates to one:
47 * @f[
48 * \int_0^{\infty} f(\epsilon) d\epsilon = 1.
49 * @f]
50 * According to Hagelaar and Pitchford @cite hagelaar2005, the electron energy
51 * probability function can be defined as
52 * @f$ F(\epsilon) = \frac{f(\epsilon)}{\sqrt{\epsilon}} @f$ with units of
53 * [V@f$^{-3/2}@f$]. The generalized form of the electron energy probability
54 * function for isotropic-velocity distributions is:
55 * @f[
56 * F(\epsilon) = c_1 \frac{1}{\epsilon_m^{3/2}}
57 * \exp\left(-c_2 \left(\frac{\epsilon}{\epsilon_m}\right)^x\right),
58 * @f]
59 * and this form is used to model the isotropic electron energy distribution
60 * in PlasmaPhase.
61 *
62 * The second method allows for manual definition of the electron energy
63 * distribution using setDiscretizedElectronEnergyDist(). In this approach,
64 * the electron temperature is derived from the mean electron energy,
65 * @f$ \epsilon_m @f$, which can be calculated as follows @cite hagelaar2005 :
66 * @f[
67 * \epsilon_m = \int_0^{\infty} \epsilon^{3/2} F(\epsilon) d\epsilon.
68 * @f]
69 * This integral can be approximated using the trapezoidal rule,
70 * @f[
71 * \epsilon_m = \sum_i \left(\epsilon_{i+1}^{5/2} - \epsilon_i^{5/2}\right)
72 * \frac{F(\epsilon_{i+1}) + F(\epsilon_i)}{2},
73 * @f]
74 * where @f$ i @f$ is the index of discrete energy levels, or Simpson's rule.
75 *
76 * @warning This class is an experimental part of %Cantera and may be
77 * changed or removed without notice.
78 * @todo Implement electron Boltzmann equation solver to solve EEDF.
79 * https://github.com/Cantera/enhancements/issues/127
80 * @ingroup thermoprops
81 */
83{
84public:
85 //! Construct and initialize a PlasmaPhase object
86 //! directly from an input file. The constructor initializes the electron
87 //! energy distribution to be Druyvesteyn distribution (m_x = 2.0). The initial
88 //! electron energy grid is set to a linear space which starts at 0.01 eV and ends
89 //! at 1 eV with 1000 points.
90 /*!
91 * @param inputFile Name of the input file containing the phase definition
92 * to set up the object. If blank, an empty phase will be
93 * created.
94 * @param id ID of the phase in the input file. Defaults to the
95 * empty string.
96 */
97 explicit PlasmaPhase(const string& inputFile="", const string& id="");
98
100
101 string type() const override {
102 return "plasma";
103 }
104
105 void initThermo() override;
106
107 //! Set electron energy levels.
108 //! @param levels The vector of electron energy levels (eV).
109 //! Length: #m_nPoints.
110 //! @param length The length of the @c levels.
111 //! @param updateEnergyDist update electron energy distribution
112 void setElectronEnergyLevels(const double* levels, size_t length,
113 bool updateEnergyDist=true);
114
115 //! Get electron energy levels.
116 //! @param levels The vector of electron energy levels (eV). Length: #m_nPoints
117 void getElectronEnergyLevels(double* levels) const {
118 Eigen::Map<Eigen::ArrayXd>(levels, m_nPoints) = m_electronEnergyLevels;
119 }
120
121 //! Set discretized electron energy distribution.
122 //! @param levels The vector of electron energy levels (eV).
123 //! Length: #m_nPoints.
124 //! @param distrb The vector of electron energy distribution.
125 //! Length: #m_nPoints.
126 //! @param length The length of the vectors, which equals #m_nPoints.
127 void setDiscretizedElectronEnergyDist(const double* levels,
128 const double* distrb,
129 size_t length);
130
131 //! Get electron energy distribution.
132 //! @param distrb The vector of electron energy distribution.
133 //! Length: #m_nPoints.
134 void getElectronEnergyDistribution(double* distrb) const {
135 Eigen::Map<Eigen::ArrayXd>(distrb, m_nPoints) = m_electronEnergyDist;
136 }
137
138 //! Set the shape factor of isotropic electron energy distribution.
139 //! Note that @f$ x = 1 @f$ and @f$ x = 2 @f$ correspond to the
140 //! Maxwellian and Druyvesteyn distribution, respectively.
141 //! @param x The shape factor
142 void setIsotropicShapeFactor(double x);
143
144 //! The shape factor of isotropic electron energy distribution
145 double isotropicShapeFactor() const {
146 return m_isotropicShapeFactor;
147 }
148
149 //! Set the internally stored electron temperature of the phase (K).
150 //! @param Te Electron temperature in Kelvin
151 void setElectronTemperature(double Te) override;
152
153 //! Set mean electron energy [eV]. This method also sets electron temperature
154 //! accordingly.
155 void setMeanElectronEnergy(double energy);
156
157 //! Get electron energy distribution type
159 return m_distributionType;
160 }
161
162 //! Set electron energy distribution type
163 void setElectronEnergyDistributionType(const string& type);
164
165 //! Numerical quadrature method. Method: #m_quadratureMethod
166 string quadratureMethod() const {
167 return m_quadratureMethod;
168 }
169
170 //! Set numerical quadrature method for integrating electron
171 //! energy distribution function. Method: #m_quadratureMethod
172 void setQuadratureMethod(const string& method) {
173 m_quadratureMethod = method;
174 }
175
176 //! Mean electron energy [eV]
177 double meanElectronEnergy() const {
178 return 3.0 / 2.0 * electronTemperature() * Boltzmann / ElectronCharge;
179 }
180
181 //! Set flag of automatically normalize electron energy distribution
182 //! Flag: #m_do_normalizeElectronEnergyDist
185 }
186
187 //! Flag of automatically normalize electron energy distribution.
188 //! Flag: #m_do_normalizeElectronEnergyDist
191 }
192
193 bool addSpecies(shared_ptr<Species> spec) override;
194
195 //! Electron Temperature (K)
196 //! @return The electron temperature of the phase
197 double electronTemperature() const override {
198 return m_electronTemp;
199 }
200
201 //! Return the Gas Constant multiplied by the current electron temperature
202 /*!
203 * The units are Joules kmol-1
204 */
205 double RTe() const {
207 }
208
209 /**
210 * Electron pressure. Units: Pa.
211 * @f[P = n_{k_e} R T_e @f]
212 */
213 virtual double electronPressure() const {
216 }
217
218 //! Number of electron levels
219 size_t nElectronEnergyLevels() const {
220 return m_nPoints;
221 }
222
223 //! Number of collisions
224 size_t nCollisions() const {
225 return m_collisions.size();
226 }
227
228 //! Electron Species Index
229 size_t electronSpeciesIndex() const {
231 }
232
233 //! Return the Molar enthalpy. Units: J/kmol.
234 /*!
235 * For an ideal gas mixture with additional electron,
236 * @f[
237 * \hat h(T) = \sum_{k \neq k_e} X_k \hat h^0_k(T) + X_{k_e} \hat h^0_{k_e}(T_e),
238 * @f]
239 * and is a function only of temperature. The standard-state pure-species
240 * enthalpies @f$ \hat h^0_k(T) @f$ are computed by the species
241 * thermodynamic property manager.
242 *
243 * @see MultiSpeciesThermo
244 */
245 double enthalpy_mole() const override;
246
247 double cp_mole() const override {
248 throw NotImplementedError("PlasmaPhase::cp_mole");
249 }
250
251 double entropy_mole() const override {
252 throw NotImplementedError("PlasmaPhase::entropy_mole");
253 }
254
255 double gibbs_mole() const override {
256 throw NotImplementedError("PlasmaPhase::gibbs_mole");
257 }
258
259 double intEnergy_mole() const override {
260 throw NotImplementedError("PlasmaPhase::intEnergy_mole");
261 }
262
263 void getEntropy_R(double* sr) const override;
264
265 void getGibbs_RT(double* grt) const override;
266
267 void getGibbs_ref(double* g) const override;
268
269 void getStandardVolumes_ref(double* vol) const override;
270
271 void getChemPotentials(double* mu) const override;
272
273 void getStandardChemPotentials(double* muStar) const override;
274
275 void getPartialMolarEnthalpies(double* hbar) const override;
276
277 void getPartialMolarEntropies(double* sbar) const override;
278
279 void getPartialMolarIntEnergies(double* ubar) const override;
280
281 void getParameters(AnyMap& phaseNode) const override;
282
283 void setParameters(const AnyMap& phaseNode,
284 const AnyMap& rootNode=AnyMap()) override;
285
286 //! Electron species name
287 string electronSpeciesName() const {
289 }
290
291 //! Return the distribution Number #m_distNum
292 int distributionNumber() const {
293 return m_distNum;
294 }
295
296 //! Return the electron energy level Number #m_levelNum
297 int levelNumber() const {
298 return m_levelNum;
299 }
300
301 virtual void setSolution(std::weak_ptr<Solution> soln) override;
302
303 /**
304 * The elastic power loss (J/s/m³)
305 * @f[
306 * P_k = N_A N_A C_e e \sum_k C_k K_k,
307 * @f]
308 * where @f$ C_k @f$ and @f$ C_e @f$ are the concentration (kmol/m³) of the
309 * target species and electrons, respectively. @f$ K_k @f$ is the elastic
310 * electron energy loss coefficient (eV-m³/s).
311 */
312 double elasticPowerLoss();
313
314protected:
315 void updateThermo() const override;
316
317 //! When electron energy distribution changed, plasma properties such as
318 //! electron-collision reaction rates need to be re-evaluated.
320
321 //! When electron energy level changed, plasma properties such as
322 //! electron-collision reaction rates need to be re-evaluate.
323 //! In addition, the cross-sections need to be interpolated at
324 //! the new level.
326
327 //! Check the electron energy levels
328 /*!
329 * The values of electron energy levels need to be positive and
330 * monotonically increasing.
331 */
332 void checkElectronEnergyLevels() const;
333
334 //! Check the electron energy distribution
335 /*!
336 * This method check the electron energy distribution for the criteria
337 * below.
338 *
339 * 1. The values of electron energy distribution cannot be negative.
340 *
341 * 2. If the last value of electron energy distribution is larger
342 * than 0.01, it will raise a warning to suggest using a higher electron
343 * energy levels.
344 */
346
347 //! Update electron energy distribution.
349
350 //! Set isotropic electron energy distribution
352
353 //! Update electron temperature (K) From energy distribution.
354 //! #m_electronTemp
356
357 //! Electron energy distribution norm
359
360 //! Update interpolated cross section of a collision
361 bool updateInterpolatedCrossSection(size_t k);
362
363 //! Update electron energy distribution difference
365
366 // Electron energy order in the exponential term
367 double m_isotropicShapeFactor = 2.0;
368
369 //! Number of points of electron energy levels
370 size_t m_nPoints = 1001;
371
372 //! electron energy levels [ev]. Length: #m_nPoints
374
375 //! Normalized electron energy distribution vector [-]
376 //! Length: #m_nPoints
377 Eigen::ArrayXd m_electronEnergyDist;
378
379 //! Index of electron species
381
382 //! Electron temperature [K]
384
385 //! Electron energy distribution type
386 string m_distributionType = "isotropic";
387
388 //! Numerical quadrature method for electron energy distribution
389 string m_quadratureMethod = "simpson";
390
391 //! Flag of normalizing electron energy distribution
393
394 //! Data for initiate reaction
396
397 //! Electron energy distribution Difference dF/dε (V^-5/2)
399
400 //! Elastic electron energy loss coefficients (eV m3/s)
401 /*! The elastic electron energy loss coefficient for species k is,
402 * @f[
403 * K_k = \frac{2 m_e}{m_k} \sqrt{\frac{2 e}{m_e}} \int_0^{\infty} \sigma_k
404 * \epsilon^2 \left( F_0 + \frac{k_B T}{e}
405 * \frac{\partial F_0}{\partial \epsilon} \right) d \epsilon,
406 * @f]
407 * where @f$ m_e @f$ [kg] is the electron mass, @f$ \epsilon @f$ [V] is the
408 * electron energy, @f$ \sigma_k @f$ [m2] is the reaction collision cross section,
409 * @f$ F_0 @f$ [V^(-3/2)] is the normalized electron energy distribution function.
410 */
412
413 //! Updates the elastic electron energy loss coefficient for collision index i
414 /*! Calculates the elastic energy loss coefficient using the current electron
415 energy distribution and cross sections.
416 */
418
419 //! Update elastic electron energy loss coefficients
420 /*! Used by elasticPowerLoss() and other plasma property calculations that
421 depends on #m_elasticElectronEnergyLossCoefficients. This function calls
422 updateInterpolatedCrossSection() before calling
423 updateElasticElectronEnergyLossCoefficient()
424 */
426
427private:
428 //! Electron energy distribution change variable. Whenever
429 //! #m_electronEnergyDist changes, this int is incremented.
430 int m_distNum = -1;
431
432 //! Electron energy level change variable. Whenever
433 //! #m_electronEnergyLevels changes, this int is incremented.
434 int m_levelNum = -1;
435
436 //! The list of shared pointers of plasma collision reactions
437 vector<shared_ptr<Reaction>> m_collisions;
438
439 //! The list of shared pointers of collision rates
440 vector<shared_ptr<ElectronCollisionPlasmaRate>> m_collisionRates;
441
442 //! The collision-target species indices of #m_collisions
444
445 //! Interpolated cross sections. This is used for storing
446 //! interpolated cross sections temporarily.
447 vector<double> m_interp_cs;
448
449 //! The list of whether the interpolated cross sections is ready
450 vector<bool> m_interp_cs_ready;
451
452 //! Set collisions. This function sets the list of collisions and
453 //! the list of target species using #addCollision.
454 void setCollisions();
455
456 //! Add a collision and record the target species
457 void addCollision(std::shared_ptr<Reaction> collision);
458
459};
460
461}
462
463#endif
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:432
Class IdealGasPhase represents low-density gases that obey the ideal gas equation of state.
An error indicating that an unimplemented function has been called.
virtual double concentration(const size_t k) const
Concentration of species k.
Definition Phase.cpp:476
string speciesName(size_t k) const
Name of the species with index k.
Definition Phase.cpp:142
Base class for handling plasma properties, specifically focusing on the electron energy distribution.
Definition PlasmaPhase.h:83
void addCollision(std::shared_ptr< Reaction > collision)
Add a collision and record the target species.
void checkElectronEnergyDistribution() const
Check the electron energy distribution.
void setCollisions()
Set collisions.
double meanElectronEnergy() const
Mean electron energy [eV].
int distributionNumber() const
Return the distribution Number m_distNum.
double enthalpy_mole() const override
Return the Molar enthalpy. Units: J/kmol.
void setQuadratureMethod(const string &method)
Set numerical quadrature method for integrating electron energy distribution function.
size_t m_nPoints
Number of points of electron energy levels.
int levelNumber() const
Return the electron energy level Number m_levelNum.
virtual void setSolution(std::weak_ptr< Solution > soln) override
Set the link to the Solution object that owns this ThermoPhase.
void getPartialMolarEnthalpies(double *hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
void getChemPotentials(double *mu) const override
Get the species chemical potentials. Units: J/kmol.
void normalizeElectronEnergyDistribution()
Electron energy distribution norm.
void getStandardChemPotentials(double *muStar) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
void updateThermo() const override
Update the species reference state thermodynamic functions.
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 ...
void setElectronEnergyLevels(const double *levels, size_t length, bool updateEnergyDist=true)
Set electron energy levels.
string electronEnergyDistributionType() const
Get electron energy distribution type.
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.
void electronEnergyDistributionChanged()
When electron energy distribution changed, plasma properties such as electron-collision reaction rate...
void getEntropy_R(double *sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
string quadratureMethod() const
Numerical quadrature method. Method: m_quadratureMethod.
size_t nElectronEnergyLevels() const
Number of electron levels.
void getGibbs_ref(double *g) const override
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
size_t nCollisions() const
Number of collisions.
Eigen::ArrayXd m_electronEnergyDist
Normalized electron energy distribution vector [-] Length: m_nPoints.
Eigen::ArrayXd m_electronEnergyLevels
electron energy levels [ev]. Length: m_nPoints
void setDiscretizedElectronEnergyDist(const double *levels, const double *distrb, size_t length)
Set discretized electron energy distribution.
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.
vector< double > m_interp_cs
Interpolated cross sections.
string m_distributionType
Electron energy distribution type.
void getStandardVolumes_ref(double *vol) const override
Get the molar volumes of the species reference states at the current T and P_ref of the solution.
void updateElectronEnergyDistribution()
Update electron energy distribution.
vector< double > m_elasticElectronEnergyLossCoefficients
Elastic electron energy loss coefficients (eV m3/s)
string m_quadratureMethod
Numerical quadrature method for electron energy distribution.
size_t electronSpeciesIndex() const
Electron Species Index.
double m_electronTemp
Electron temperature [K].
void getElectronEnergyDistribution(double *distrb) const
Get electron energy distribution.
double RTe() const
Return the Gas Constant multiplied by the current electron temperature.
void getGibbs_RT(double *grt) const override
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
double intEnergy_mole() const override
Molar internal energy. Units: J/kmol.
double entropy_mole() const override
Molar entropy.
bool m_do_normalizeElectronEnergyDist
Flag of normalizing electron energy distribution.
AnyMap m_root
Data for initiate reaction.
void updateElectronEnergyDistDifference()
Update electron energy distribution difference.
bool normalizeElectronEnergyDistEnabled() const
Flag of automatically normalize electron energy distribution.
void updateElasticElectronEnergyLossCoefficient(size_t i)
Updates the elastic electron energy loss coefficient for collision index i.
void getPartialMolarIntEnergies(double *ubar) const override
Return an array of partial molar internal energies for the species in the mixture.
double cp_mole() const override
Molar heat capacity at constant pressure.
string electronSpeciesName() const
Electron species name.
void setIsotropicElectronEnergyDistribution()
Set isotropic electron energy distribution.
Eigen::ArrayXd m_electronEnergyDistDiff
Electron energy distribution Difference dF/dε (V^-5/2)
double isotropicShapeFactor() const
The shape factor of isotropic electron energy distribution.
double gibbs_mole() const override
Molar Gibbs function. Units: J/kmol.
void getElectronEnergyLevels(double *levels) const
Get electron energy levels.
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
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.
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].
size_t m_electronSpeciesIndex
Index of electron species.
void setElectronEnergyDistributionType(const string &type)
Set electron energy distribution type.
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
virtual double electronPressure() const
Electron pressure.
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 Flag: m_do_normalizeElectronEnergyDi...
int m_distNum
Electron energy distribution change variable.
const double Boltzmann
Boltzmann constant [J/K].
Definition ct_defs.h:84
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
const double ElectronCharge
Elementary charge [C].
Definition ct_defs.h:90
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:180