PlasmaPhase.h Source File#

Cantera: PlasmaPhase.h Source File
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
18/**
19 * Base class for a phase with plasma properties. This class manages the
20 * plasma properties such as electron energy distribution function (EEDF).
21 * There are two ways to define the electron distribution and electron
22 * temperature. The first method uses setElectronTemperature() to set
23 * the electron temperature which is used to calculate the electron energy
24 * distribution with isotropic-velocity model. The generalized electron
25 * energy distribution for isotropic-velocity distribution can be
26 * expressed as [1,2],
27 * @f[
28 * f(\epsilon) = c_1 \frac{\sqrt{\epsilon}}{\epsilon_m^{3/2}}
29 * \exp(-c_2 (\frac{\epsilon}{\epsilon_m})^x),
30 * @f]
31 * where @f$ x = 1 @f$ and @f$ x = 2 @f$ correspond to the Maxwellian and
32 * Druyvesteyn (default) electron energy distribution, respectively.
33 * @f$ \epsilon_m = 3/2 T_e @f$ [eV] (mean electron energy). The second
34 * method uses setDiscretizedElectronEnergyDist() to manually set electron
35 * energy distribution and calculate electron temperature from mean electron
36 * energy, which is calculated as [3],
37 * @f[
38 * \epsilon_m = \int_0^{\infty} \epsilon^{3/2} f(\epsilon) d\epsilon,
39 * @f]
40 * which can be calculated using trapezoidal rule,
41 * @f[
42 * \epsilon_m = \sum_i (\epsilon^{5/2}_{i+1} - \epsilon^{5/2}_i)
43 * (f(\epsilon_{i+1}) + f(\epsilon_i)) / 2,
44 * @f]
45 * where @f$ i @f$ is the index of energy levels.
46 *
47 * For references, see Gudmundsson @cite gudmundsson2001; Khalilpour and Foroutan
48 * @cite khalilpour2020; Hagelaar and Pitchford @cite hagelaar2005, and BOLOS
49 * @cite BOLOS.
50 *
51 * @warning This class is an experimental part of %Cantera and may be
52 * changed or removed without notice.
53 * @todo Implement electron Boltzmann equation solver to solve EEDF.
54 * https://github.com/Cantera/enhancements/issues/127
55 * @ingroup phase
56 */
58{
59public:
60 //! Construct and initialize a PlasmaPhase object
61 //! directly from an input file. The constructor initializes the electron
62 //! energy distribution to be Druyvesteyn distribution (m_x = 2.0). The initial
63 //! electron energy grid is set to a linear space which starts at 0.01 eV and ends
64 //! at 1 eV with 1000 points.
65 /*!
66 * @param inputFile Name of the input file containing the phase definition
67 * to set up the object. If blank, an empty phase will be
68 * created.
69 * @param id ID of the phase in the input file. Defaults to the
70 * empty string.
71 */
72 explicit PlasmaPhase(const string& inputFile="", const string& id="");
73
74 string type() const override {
75 return "plasma";
76 }
77
78 void initThermo() override;
79
80 //! Set electron energy levels.
81 //! @param levels The vector of electron energy levels (eV).
82 //! Length: #m_nPoints.
83 //! @param length The length of the @c levels.
84 void setElectronEnergyLevels(const double* levels, size_t length);
85
86 //! Get electron energy levels.
87 //! @param levels The vector of electron energy levels (eV). Length: #m_nPoints
88 void getElectronEnergyLevels(double* levels) const {
89 Eigen::Map<Eigen::ArrayXd>(levels, m_nPoints) = m_electronEnergyLevels;
90 }
91
92 //! Set discretized electron energy distribution.
93 //! @param levels The vector of electron energy levels (eV).
94 //! Length: #m_nPoints.
95 //! @param distrb The vector of electron energy distribution.
96 //! Length: #m_nPoints.
97 //! @param length The length of the vectors, which equals #m_nPoints.
98 void setDiscretizedElectronEnergyDist(const double* levels,
99 const double* distrb,
100 size_t length);
101
102 //! Get electron energy distribution.
103 //! @param distrb The vector of electron energy distribution.
104 //! Length: #m_nPoints.
105 void getElectronEnergyDistribution(double* distrb) const {
106 Eigen::Map<Eigen::ArrayXd>(distrb, m_nPoints) = m_electronEnergyDist;
107 }
108
109 //! Set the shape factor of isotropic electron energy distribution.
110 //! Note that @f$ x = 1 @f$ and @f$ x = 2 @f$ correspond to the
111 //! Maxwellian and Druyvesteyn distribution, respectively.
112 //! @param x The shape factor
113 void setIsotropicShapeFactor(double x);
114
115 //! The shape factor of isotropic electron energy distribution
116 double isotropicShapeFactor() const {
117 return m_isotropicShapeFactor;
118 }
119
120 //! Set the internally stored electron temperature of the phase (K).
121 //! @param Te Electron temperature in Kelvin
122 void setElectronTemperature(double Te) override;
123
124 //! Set mean electron energy [eV]. This method also sets electron temperature
125 //! accordingly.
126 void setMeanElectronEnergy(double energy);
127
128 //! Get electron energy distribution type
130 return m_distributionType;
131 }
132
133 //! Set electron energy distribution type
134 void setElectronEnergyDistributionType(const string& type);
135
136 //! Numerical quadrature method. Method: #m_quadratureMethod
137 string quadratureMethod() const {
138 return m_quadratureMethod;
139 }
140
141 //! Set numerical quadrature method for integrating electron
142 //! energy distribution function. Method: #m_quadratureMethod
143 void setQuadratureMethod(const string& method) {
144 m_quadratureMethod = method;
145 }
146
147 //! Mean electron energy [eV]
148 double meanElectronEnergy() const {
149 return 3.0 / 2.0 * electronTemperature() * Boltzmann / ElectronCharge;
150 }
151
152 //! Set flag of automatically normalize electron energy distribution
153 //! Flag: #m_do_normalizeElectronEnergyDist
156 }
157
158 //! Flag of automatically normalize electron energy distribution.
159 //! Flag: #m_do_normalizeElectronEnergyDist
162 }
163
164 bool addSpecies(shared_ptr<Species> spec) override;
165
166 //! Electron Temperature (K)
167 //! @return The electron temperature of the phase
168 double electronTemperature() const override {
169 return m_electronTemp;
170 }
171
172 //! Return the Gas Constant multiplied by the current electron temperature
173 /*!
174 * The units are Joules kmol-1
175 */
176 double RTe() const {
178 }
179
180 /**
181 * Electron pressure. Units: Pa.
182 * @f[P = n_{k_e} R T_e @f]
183 */
184 virtual double electronPressure() const {
187 }
188
189 //! Number of electron levels
190 size_t nElectronEnergyLevels() const {
191 return m_nPoints;
192 }
193
194 //! Electron Species Index
195 size_t electronSpeciesIndex() const {
197 }
198
199 //! Return the Molar enthalpy. Units: J/kmol.
200 /*!
201 * For an ideal gas mixture with additional electron,
202 * @f[
203 * \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),
204 * @f]
205 * and is a function only of temperature. The standard-state pure-species
206 * enthalpies @f$ \hat h^0_k(T) @f$ are computed by the species
207 * thermodynamic property manager.
208 *
209 * \see MultiSpeciesThermo
210 */
211 double enthalpy_mole() const override;
212
213 double cp_mole() const override {
214 throw NotImplementedError("PlasmaPhase::cp_mole");
215 }
216
217 double entropy_mole() const override {
218 throw NotImplementedError("PlasmaPhase::entropy_mole");
219 }
220
221 double gibbs_mole() const override {
222 throw NotImplementedError("PlasmaPhase::gibbs_mole");
223 }
224
225 double intEnergy_mole() const override {
226 throw NotImplementedError("PlasmaPhase::intEnergy_mole");
227 }
228
229 void getEntropy_R(double* sr) const override;
230
231 void getGibbs_RT(double* grt) const override;
232
233 void getGibbs_ref(double* g) const override;
234
235 void getStandardVolumes_ref(double* vol) const override;
236
237 void getChemPotentials(double* mu) const override;
238
239 void getStandardChemPotentials(double* muStar) const override;
240
241 void getPartialMolarEnthalpies(double* hbar) const override;
242
243 void getPartialMolarEntropies(double* sbar) const override;
244
245 void getPartialMolarIntEnergies(double* ubar) const override;
246
247 void getParameters(AnyMap& phaseNode) const override;
248
249 void setParameters(const AnyMap& phaseNode,
250 const AnyMap& rootNode=AnyMap()) override;
251
252protected:
253 void updateThermo() const override;
254
255 //! Check the electron energy levels
256 /*!
257 * The values of electron energy levels need to be positive and
258 * monotonically increasing.
259 */
260 void checkElectronEnergyLevels() const;
261
262 //! Check the electron energy distribution
263 /*!
264 * This method check the electron energy distribution for the criteria
265 * below.
266 *
267 * 1. The values of electron energy distribution cannot be negative.
268 *
269 * 2. If the last value of electron energy distribution is larger
270 * than 0.01, it will raise a warning to suggest using a higher electron
271 * energy levels.
272 */
274
275 //! Update electron energy distribution.
277
278 //! Set isotropic electron energy distribution
280
281 //! Update electron temperature (K) From energy distribution.
282 //! #m_electronTemp
284
285 //! Electron energy distribution norm
287
288 // Electron energy order in the exponential term
289 double m_isotropicShapeFactor = 2.0;
290
291 //! Number of points of electron energy levels
292 size_t m_nPoints = 1001;
293
294 //! electron energy levels [ev]. Length: #m_nPoints
296
297 //! Normalized electron energy distribution vector [-]
298 //! Length: #m_nPoints
299 Eigen::ArrayXd m_electronEnergyDist;
300
301 //! Index of electron species
303
304 //! Electron temperature [K]
306
307 //! Electron energy distribution type
308 string m_distributionType = "isotropic";
309
310 //! Numerical quadrature method for electron energy distribution
311 string m_quadratureMethod = "simpson";
312
313 //! Flag of normalizing electron energy distribution
315};
316
317}
318
319#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:427
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
Base class for a phase with plasma properties.
Definition PlasmaPhase.h:58
void checkElectronEnergyDistribution() const
Check the electron energy distribution.
double meanElectronEnergy() const
Mean electron energy [eV].
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.
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.
void setElectronTemperature(double Te) override
Set the internally stored electron temperature of the phase (K).
string electronEnergyDistributionType() const
Get electron energy distribution type.
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...
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.
Definition PlasmaPhase.h:74
void checkElectronEnergyLevels() const
Check the electron energy levels.
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
void updateElectronTemperatureFromEnergyDist()
Update electron temperature (K) From energy distribution.
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.
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 setElectronEnergyLevels(const double *levels, size_t length)
Set electron energy levels.
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.
bool normalizeElectronEnergyDistEnabled() const
Flag of automatically normalize electron energy distribution.
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.
void setIsotropicElectronEnergyDistribution()
Set isotropic electron energy distribution.
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.
Definition PlasmaPhase.h:88
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
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...
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:564
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:180