8#ifndef CT_EEDF_TWO_TERM_APPROXIMATION_H
9#define CT_EEDF_TWO_TERM_APPROXIMATION_H
12#include "cantera/numerics/eigen_sparse.h"
114 const string& gridType);
140 double updateFactor,
size_t maxIterations,
141 bool maxwellianReset);
216 Eigen::VectorXd
iterate(
const Eigen::VectorXd& f0,
double delta);
220 double integralPQ(
double a,
double b,
double u0,
double u1,
221 double g,
double x0);
229 vector<double>
vector_g(
const Eigen::VectorXd& f0);
238 Eigen::SparseMatrix<double>
matrix_P(span<const double> g,
size_t k);
257 Eigen::SparseMatrix<double>
matrix_Q(span<const double> g,
size_t k);
269 Eigen::SparseMatrix<double>
matrix_A(
const Eigen::VectorXd& f0);
301 double norm(
const Eigen::VectorXd& f,
const Eigen::VectorXd& grid);
313 vector<vector<size_t>>
m_j;
316 vector<vector<size_t>>
m_i;
322 vector<vector<vector<double>>>
m_eps;
413 const Eigen::VectorXd& oldF0);
418 span<const double> fpts,
double below_value,
Boltzmann equation solver for the electron energy distribution function based on the two-term approxi...
double m_rtol
Error tolerance for convergence.
Eigen::VectorXd m_f0
Normalized electron energy distribution function.
vector< double > m_gridEdge
Grid of electron energy (cell boundary i-1/2) [eV].
void enableGridAdaptation(bool enabled)
Enable or disable automatic grid adaptation for the EEDF solver energy grid.
vector< vector< size_t > > m_i
Location of cell i for grid cache.
void calculateTotalCrossSection()
Compute the total (elastic + inelastic) cross section.
vector< vector< size_t > > m_j
Location of cell j for grid cache.
vector< double > m_X_targets_prev
Previous mole fraction of targets used to compute eedf.
double m_thresholdToMaxwellian
The threshold in reduced electric field [townsend, Td] below which no EEDF will be computed,...
void projectPreviousEEDFOnCurrentGrid(const Eigen::VectorXd &oldGridCenter, const Eigen::VectorXd &oldF0)
Projects a previously converged EEDF onto the current energy grid.
void adaptEnergyGrid()
Runs the energy grid adaptation script when this feature is activated.
vector< vector< vector< double > > > m_eps
The energy boundaries of the overlap of cell i and j.
double m_maxEedfDecay
Maximum amount of decades decay at the tail of the EEDF when grid adaptation is on.
void setGeometricGrid(double kTe_max, size_t ncell, double ratio=1.01)
Sets a geometric energy grid for the EEDF solver, defined by the maximum energy and the number of gri...
span< const double > getEEDFEdge() const
Return the EEDF values interpolated at the electron energy grid edges.
vector< vector< vector< double > > > m_sigma
Cross section at the boundaries of the overlap of cell i and j.
void setGridAdaptationParameters(double minDecayDecades, double maxDecayDecades, double updateFactor, size_t maxIterations, bool maxwellianReset)
Set parameters controlling automatic adaptation of the EEDF energy grid.
vector< size_t > m_k_lg_Targets
Local to global indices.
string m_gridType
Energy grid spacing type. Can be linear, quadratic or geometric.
double m_moleFractionThreshold
The threshold for species mole fractions.
bool m_first_call
First call to calculateDistributionFunction.
double m_kTeMax
Maximum value of the energy grid [eV].
size_t m_initialGridCells
Number of cells for the starting energy grid.
double m_gamma
Defined by the formula: pow(2.0 * ElectronCharge / ElectronMass, 0.5) and comupted during phase initi...
void converge(Eigen::VectorXd &f0)
Iterate f0 (EEDF) until convergence.
double m_delta0
Formerly options for the EEDF solver.
double electronDiffusivity(const Eigen::VectorXd &f0)
Diffusivity.
PlasmaPhase * m_phase
Pointer to the PlasmaPhase object used to initialize this object.
double norm(const Eigen::VectorXd &f, const Eigen::VectorXd &grid)
Compute the L1 norm of a function f defined over a given energy grid.
void updateMoleFractions()
Update the vector of species mole fractions.
vector< size_t > m_kTargets
List of target species indices in global Cantera numbering (1 index per cs)
bool m_has_EEDF
Flag of having an EEDF.
void setCustomGrid(span< const double > levels)
Sets a custom energy grid for the EEDF solver, defined by the user-provided vector of energy levels.
void setReducedElectricFieldThresholdForMaxwellian(double threshold)
Sets the threshold in reduced electric field below which a Maxwellian is imposed instead of computing...
void setQuadraticGrid(double kTe_max, size_t ncell)
Sets a quadratic energy grid for the EEDF solver, defined by the maximum energy and the number of gri...
double electronMobility(const Eigen::VectorXd &f0)
Mobility.
void setMaxwellianDistribution(double kTe)
Sets a Maxwellian distribution with the specified electron temperature [eV].
Eigen::VectorXd m_gridCenter
Grid of electron energy (cell center) [eV].
size_t m_maxn
Maximum number of iterations.
Eigen::SparseMatrix< double > matrix_A(const Eigen::VectorXd &f0)
Matrix A (Ax = b) of the equation of EEDF, which is discretized by the exponential scheme of Scharfet...
Eigen::SparseMatrix< double > matrix_Q(span< const double > g, size_t k)
The matrix of scattering-in.
Eigen::VectorXd iterate(const Eigen::VectorXd &f0, double delta)
An iteration of solving electron energy distribution function.
double m_gridUpdateFactor
Factor by which the EEDF grid maximum energy is increased of shrunk when grid adaptation is on.
double getElectronMobility() const
Return the latest value of the computed electron mobility computed from the EEDF.
double m_electronMobility
Electron mobility [m²/V·s].
void setInitialGridParameters(double initialMaxEnergy, size_t nGridCells, const string &gridType)
Set the initial grid parameters used by generated EEDF grids.
size_t m_points
The number of points in the EEDF grid.
vector< size_t > m_kOthers
Indices of species which has no cross-section data.
double m_factorM
The factor for step size change.
void calculateTotalElasticCrossSection()
Compute the total elastic collision cross section.
double m_minEedfDecay
Minimum amount of decades decay at the tail of the EEDF when grid adaptation is on.
void updateCrossSections()
Update the total cross sections based on the current state.
size_t m_maxGridAdaptIterations
Maximum number of iterations on the maximum energy accepted for grid adaptation.
double m_geometricRatio
In the case where a geometric grid is employed, this stores the corresponding geometric ratio.
void initSpeciesIndexCrossSections()
Initialize species indices associated with cross-section data.
double m_init_kTe
The initial electron temperature [eV].
double netProductionFrequency(const Eigen::VectorXd &f0)
Reduced net production frequency.
double linearInterpBounded(double x, span< const double > xpts, span< const double > fpts, double below_value, double above_value)
An extension of the linearInterp function that returns specified values when the input is out of boun...
span< const double > getGridEdge() const
Return the electron energy grid edges [eV].
bool m_maxwellianReset
Boolean flag to reset the EEDF to a Maxwellian distribution at the gas temperature when the grid is a...
std::string m_growth
The growth model of EEDF.
void setGridCache()
Build or rebuild the grid-dependent cache used for scattering matrices.
int calculateDistributionFunction()
compute the EEDF given an electric field CQM The solver will take the species to consider and the set...
vector< double > m_totalCrossSectionEdge
Total electron cross section on the cell boundary (i-1/2) of energy grid.
Eigen::SparseMatrix< double > matrix_P(span< const double > g, size_t k)
The matrix of scattering-out.
vector< double > m_f0_edge
EEDF at grid edges (cell boundaries)
bool m_adaptGrid
Flag activating or deactivating automatic grid adaptation.
vector< size_t > m_klocTargets
List of target species indices in local X EEDF numbering (1 index per cs)
vector< double > m_X_targets
Mole fraction of targets.
void updateGrid(double maxEnergy)
Updates the grid according to the grid type and the new maximum energy when running grid adaptation.
double integralPQ(double a, double b, double u0, double u1, double g, double x0)
The integral in [a, b] of assuming that u is linear with u(a) = u0 and u(b) = u1.
vector< double > m_totalCrossSectionCenter
Total electron cross section on the cell center of energy grid.
vector< double > vector_g(const Eigen::VectorXd &f0)
Vector g is used by matrix_P() and matrix_Q().
vector< int > m_inFactor
In factor.
vector< double > m_sigmaElastic
Vector of total elastic cross section weighted with mass ratio.
void setLinearGrid(double kTe_max, size_t ncell)
Sets a linear energy grid for the EEDF solver, defined by the maximum energy and the number of grid c...
Base class for handling plasma properties, specifically focusing on the electron energy distribution.
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.