| Cantera 3.0.0

Loading...
Searching...
No Matches
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
12#include "cantera/thermo/IdealGasPhase.h"
13#include "cantera/numerics/eigen_sparse.h"
14
15 namespace 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 */
57 class PlasmaPhase: public IdealGasPhase
58{
59 public:
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
129 string electronEnergyDistributionType() const {
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
154 void enableNormalizeElectronEnergyDist(bool enable) {
155 m_do_normalizeElectronEnergyDist = enable;
156 }
157
158 //! Flag of automatically normalize electron energy distribution.
159 //! Flag: #m_do_normalizeElectronEnergyDist
160 bool normalizeElectronEnergyDistEnabled() const {
161 return 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 {
177 return electronTemperature() * GasConstant;
178 }
179
180 /**
181 * Electron pressure. Units: Pa.
182 * @f[P = n_{k_e} R T_e @f]
183 */
184 virtual double electronPressure() const {
185 return GasConstant * concentration(m_electronSpeciesIndex) *
186 electronTemperature();
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 {
196 return m_electronSpeciesIndex;
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
252 protected:
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 */
273 void checkElectronEnergyDistribution() const;
274
275 //! Update electron energy distribution.
276 void updateElectronEnergyDistribution();
277
278 //! Set isotropic electron energy distribution
279 void setIsotropicElectronEnergyDistribution();
280
281 //! Update electron temperature (K) From energy distribution.
282 //! #m_electronTemp
283 void updateElectronTemperatureFromEnergyDist();
284
285 //! Electron energy distribution norm
286 void normalizeElectronEnergyDistribution();
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
295 Eigen::ArrayXd m_electronEnergyLevels;
296
297 //! Normalized electron energy distribution vector [-]
298 //! Length: #m_nPoints
299 Eigen::ArrayXd m_electronEnergyDist;
300
301 //! Index of electron species
302 size_t m_electronSpeciesIndex = npos;
303
304 //! Electron temperature [K]
305 double m_electronTemp;
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
314 bool m_do_normalizeElectronEnergyDist = true;
315};
316
317}
318
319#endif
IdealGasPhase.h
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::IdealGasPhase
Class IdealGasPhase represents low-density gases that obey the ideal gas equation of state.
Definition IdealGasPhase.h:250
Cantera::NotImplementedError
An error indicating that an unimplemented function has been called.
Definition ctexceptions.h:195
Cantera::Phase::concentration
virtual double concentration(const size_t k) const
Concentration of species k.
Definition Phase.cpp:589
Cantera::PlasmaPhase
Base class for a phase with plasma properties.
Definition PlasmaPhase.h:58
Cantera::PlasmaPhase::checkElectronEnergyDistribution
void checkElectronEnergyDistribution() const
Check the electron energy distribution.
Definition PlasmaPhase.cpp:103
Cantera::PlasmaPhase::meanElectronEnergy
double meanElectronEnergy() const
Mean electron energy [eV].
Definition PlasmaPhase.h:148
Cantera::PlasmaPhase::enthalpy_mole
double enthalpy_mole() const override
Return the Molar enthalpy. Units: J/kmol.
Definition PlasmaPhase.cpp:265
Cantera::PlasmaPhase::setQuadratureMethod
void setQuadratureMethod(const string &method)
Set numerical quadrature method for integrating electron energy distribution function.
Definition PlasmaPhase.h:143
Cantera::PlasmaPhase::m_nPoints
size_t m_nPoints
Number of points of electron energy levels.
Definition PlasmaPhase.h:292
Cantera::PlasmaPhase::getPartialMolarEnthalpies
void getPartialMolarEnthalpies(double *hbar) const override
Returns an array of partial molar enthalpies for the species in the mixture.
Definition PlasmaPhase.cpp:285
Cantera::PlasmaPhase::getChemPotentials
void getChemPotentials(double *mu) const override
Get the species chemical potentials. Units: J/kmol.
Definition PlasmaPhase.cpp:309
Cantera::PlasmaPhase::normalizeElectronEnergyDistribution
void normalizeElectronEnergyDistribution()
Electron energy distribution norm.
Definition PlasmaPhase.cpp:35
Cantera::PlasmaPhase::getStandardChemPotentials
void getStandardChemPotentials(double *muStar) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition PlasmaPhase.cpp:317
Cantera::PlasmaPhase::updateThermo
void updateThermo() const override
Update the species reference state thermodynamic functions.
Definition PlasmaPhase.cpp:245
Cantera::PlasmaPhase::setElectronTemperature
void setElectronTemperature(double Te) override
Set the internally stored electron temperature of the phase (K).
Definition PlasmaPhase.cpp:74
Cantera::PlasmaPhase::electronEnergyDistributionType
string electronEnergyDistributionType() const
Get electron energy distribution type.
Definition PlasmaPhase.h:129
Cantera::PlasmaPhase::getEntropy_R
void getEntropy_R(double *sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition PlasmaPhase.cpp:325
Cantera::PlasmaPhase::quadratureMethod
string quadratureMethod() const
Numerical quadrature method. Method: m_quadratureMethod.
Definition PlasmaPhase.h:137
Cantera::PlasmaPhase::nElectronEnergyLevels
size_t nElectronEnergyLevels() const
Number of electron levels.
Definition PlasmaPhase.h:190
Cantera::PlasmaPhase::getGibbs_ref
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...
Definition PlasmaPhase.cpp:273
Cantera::PlasmaPhase::m_electronEnergyDist
Eigen::ArrayXd m_electronEnergyDist
Normalized electron energy distribution vector [-] Length: m_nPoints.
Definition PlasmaPhase.h:299
Cantera::PlasmaPhase::m_electronEnergyLevels
Eigen::ArrayXd m_electronEnergyLevels
electron energy levels [ev]. Length: m_nPoints
Definition PlasmaPhase.h:295
Cantera::PlasmaPhase::setDiscretizedElectronEnergyDist
void setDiscretizedElectronEnergyDist(const double *levels, const double *distrb, size_t length)
Set discretized electron energy distribution.
Definition PlasmaPhase.cpp:120
Cantera::PlasmaPhase::getParameters
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition PlasmaPhase.cpp:152
Cantera::PlasmaPhase::type
string type() const override
String indicating the thermodynamic model implemented.
Definition PlasmaPhase.h:74
Cantera::PlasmaPhase::checkElectronEnergyLevels
void checkElectronEnergyLevels() const
Check the electron energy levels.
Definition PlasmaPhase.cpp:92
Cantera::PlasmaPhase::initThermo
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition PlasmaPhase.cpp:235
Cantera::PlasmaPhase::updateElectronTemperatureFromEnergyDist
void updateElectronTemperatureFromEnergyDist()
Update electron temperature (K) From energy distribution.
Definition PlasmaPhase.cpp:138
Cantera::PlasmaPhase::m_distributionType
string m_distributionType
Electron energy distribution type.
Definition PlasmaPhase.h:308
Cantera::PlasmaPhase::getStandardVolumes_ref
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.
Definition PlasmaPhase.cpp:279
Cantera::PlasmaPhase::updateElectronEnergyDistribution
void updateElectronEnergyDistribution()
Update electron energy distribution.
Definition PlasmaPhase.cpp:25
Cantera::PlasmaPhase::m_quadratureMethod
string m_quadratureMethod
Numerical quadrature method for electron energy distribution.
Definition PlasmaPhase.h:311
Cantera::PlasmaPhase::electronSpeciesIndex
size_t electronSpeciesIndex() const
Electron Species Index.
Definition PlasmaPhase.h:195
Cantera::PlasmaPhase::m_electronTemp
double m_electronTemp
Electron temperature [K].
Definition PlasmaPhase.h:305
Cantera::PlasmaPhase::getElectronEnergyDistribution
void getElectronEnergyDistribution(double *distrb) const
Get electron energy distribution.
Definition PlasmaPhase.h:105
Cantera::PlasmaPhase::RTe
double RTe() const
Return the Gas Constant multiplied by the current electron temperature.
Definition PlasmaPhase.h:176
Cantera::PlasmaPhase::setElectronEnergyLevels
void setElectronEnergyLevels(const double *levels, size_t length)
Set electron energy levels.
Definition PlasmaPhase.cpp:84
Cantera::PlasmaPhase::getGibbs_RT
void getGibbs_RT(double *grt) const override
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
Definition PlasmaPhase.cpp:339
Cantera::PlasmaPhase::intEnergy_mole
double intEnergy_mole() const override
Molar internal energy. Units: J/kmol.
Definition PlasmaPhase.h:225
Cantera::PlasmaPhase::entropy_mole
double entropy_mole() const override
Molar entropy.
Definition PlasmaPhase.h:217
Cantera::PlasmaPhase::m_do_normalizeElectronEnergyDist
bool m_do_normalizeElectronEnergyDist
Flag of normalizing electron energy distribution.
Definition PlasmaPhase.h:314
Cantera::PlasmaPhase::normalizeElectronEnergyDistEnabled
bool normalizeElectronEnergyDistEnabled() const
Flag of automatically normalize electron energy distribution.
Definition PlasmaPhase.h:160
Cantera::PlasmaPhase::getPartialMolarIntEnergies
void getPartialMolarIntEnergies(double *ubar) const override
Return an array of partial molar internal energies for the species in the mixture.
Definition PlasmaPhase.cpp:299
Cantera::PlasmaPhase::cp_mole
double cp_mole() const override
Molar heat capacity at constant pressure.
Definition PlasmaPhase.h:213
Cantera::PlasmaPhase::setIsotropicElectronEnergyDistribution
void setIsotropicElectronEnergyDistribution()
Set isotropic electron energy distribution.
Definition PlasmaPhase.cpp:58
Cantera::PlasmaPhase::isotropicShapeFactor
double isotropicShapeFactor() const
The shape factor of isotropic electron energy distribution.
Definition PlasmaPhase.h:116
Cantera::PlasmaPhase::gibbs_mole
double gibbs_mole() const override
Molar Gibbs function. Units: J/kmol.
Definition PlasmaPhase.h:221
Cantera::PlasmaPhase::getElectronEnergyLevels
void getElectronEnergyLevels(double *levels) const
Get electron energy levels.
Definition PlasmaPhase.h:88
Cantera::PlasmaPhase::addSpecies
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
Definition PlasmaPhase.cpp:216
Cantera::PlasmaPhase::setParameters
void setParameters(const AnyMap &phaseNode, const AnyMap &rootNode=AnyMap()) override
Set equation of state parameters from an AnyMap phase description.
Definition PlasmaPhase.cpp:172
Cantera::PlasmaPhase::setMeanElectronEnergy
void setMeanElectronEnergy(double energy)
Set mean electron energy [eV].
Definition PlasmaPhase.cpp:79
Cantera::PlasmaPhase::m_electronSpeciesIndex
size_t m_electronSpeciesIndex
Index of electron species.
Definition PlasmaPhase.h:302
Cantera::PlasmaPhase::setElectronEnergyDistributionType
void setElectronEnergyDistributionType(const string &type)
Set electron energy distribution type.
Definition PlasmaPhase.cpp:47
Cantera::PlasmaPhase::getPartialMolarEntropies
void getPartialMolarEntropies(double *sbar) const override
Returns an array of partial molar entropies of the species in the solution.
Definition PlasmaPhase.cpp:291
Cantera::PlasmaPhase::electronPressure
virtual double electronPressure() const
Electron pressure.
Definition PlasmaPhase.h:184
Cantera::PlasmaPhase::electronTemperature
double electronTemperature() const override
Electron Temperature (K)
Definition PlasmaPhase.h:168
Cantera::PlasmaPhase::setIsotropicShapeFactor
void setIsotropicShapeFactor(double x)
Set the shape factor of isotropic electron energy distribution.
Definition PlasmaPhase.cpp:147
Cantera::PlasmaPhase::enableNormalizeElectronEnergyDist
void enableNormalizeElectronEnergyDist(bool enable)
Set flag of automatically normalize electron energy distribution Flag: m_do_normalizeElectronEnergyDi...
Definition PlasmaPhase.h:154
Cantera::Boltzmann
const double Boltzmann
Boltzmann constant [J/K].
Definition ct_defs.h:84
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition ct_defs.h:120
Cantera::ElectronCharge
const double ElectronCharge
Elementary charge [C].
Definition ct_defs.h:90
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::npos
const size_t npos
index returned by functions to indicate "no position"
Definition ct_defs.h:195