rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
Loading...
Searching...
No Matches
PlasmaCell.h
Go to the documentation of this file.
1
20
21#ifndef RIZER_PLASMA_CELL_H
22#define RIZER_PLASMA_CELL_H
23
24#ifndef NOMINMAX
25#define NOMINMAX
26#endif
31#include "thermo/PlasmaState.h"
32
35
36#include <memory>
37#include <string>
38#include <vector>
39
40namespace rizer
41{
42
43 // Exactly one of the two closures below is active per instance: if `collision`
44 // is non-empty (i.e. CollisionModel::empty() is false) it is used exclusively
45 // for sigma/nu_E and the sigma_T/sigma_v/nu_m_T/nu_m_v/nu_m/nu_E fallback
46 // fields are ignored; otherwise the legacy tabulated/scalar closure is used.
47 // See PlasmaCell::transport() in PlasmaCell.cpp for the selection logic.
49 {
52 bool reacting = true;
55 // Fallbacks used only when collision.empty():
58 std::vector<double> sigma_T;
61 std::vector<double> sigma_v;
64 std::vector<double> nu_m_T;
67 std::vector<double> nu_m_v;
70 double nu_m = 0.0;
73 double nu_E = 0.0;
83 std::vector<double> species_h0k;
84 };
85
87 {
88 public:
98 {
100 double P_elastic = 0.0;
102 double P_inelastic = 0.0;
104 double P_chemical_H = 0.0;
106 double P_chemical_e = 0.0;
108 double P_Joule = 0.0;
110 double nu_eH = 0.0;
112 double nu_ee = 0.0;
114 double nu_eI = 0.0;
117 };
118
124 PlasmaCell(std::shared_ptr<Cantera::Solution> sol, PlasmaCellConfig cfg);
125
127 std::size_t nSpecies() const { return m_nsp; }
129 std::size_t electronIndex() const { return m_ie; }
131 const std::vector<double> &molecularWeights() const { return m_wt; }
135 const std::shared_ptr<Cantera::Solution> &solution() const { return m_sol; }
136
151 const std::vector<double> &speciesCp() const { return m_cp_mass; }
152
155 std::string speciesName(std::size_t k) const;
156
178 void sourceTerms(
179 double Tg, double Te, const double *Y, double rho, double E, double &dTg,
180 double &dTe, double *dY, double &lhs_Tg, double &lhs_Te,
181 Diagnostics *diag = nullptr) const;
182
191 double electricalConductivity(double Tg, double Te, const double *Y,
192 double rho) const;
201 double electronDensity(double Tg, double Te, const double *Y, double rho) const;
202
222 void pressureAndElectronDensity(double Tg, double Te, const double *Y,
223 double rho, double &p,
224 double &electron_density) const;
225
240 void updateSpeciesCp(double Tg, double Te, const double *Y,
241 double rho) const;
242
260 void speciesEnthalpies(double Tg, double Te, const double *Y, double rho,
261 double *h) const;
262
263 private:
265 void fillSpeciesCp() const;
266
276 TwoTemperatureState setState(double Tg, double Te, const double *Y,
277 double rho) const;
278
294 void transport(double Te, const TwoTemperatureState &state, double &sigma,
295 double &nu_E, double &nu_eH, double &nu_eI,
296 double &nu_eH_mass_weighted) const;
297
299 std::shared_ptr<Cantera::Solution> m_sol;
305 Cantera::PlasmaPhase *m_plasma = nullptr;
307 std::size_t m_nsp;
309 std::size_t m_ie;
311 bool m_reacting;
313 CollisionModel m_collision;
314
315 PropertyTable m_sigma;
316 PropertyTable m_nu_m_tab;
317 double m_nu_m;
318 double m_nu_E;
319 std::vector<double> m_wt;
320 std::vector<char> m_is_electron_rxn;
325 std::vector<double> m_eps_th;
326
327 mutable std::vector<double> m_Yc, m_wdot, m_uk, m_cpR, m_rop, m_X, m_nk;
330 mutable std::vector<double> m_cp_mass;
331 };
332
333} // namespace rizer
334
335#endif
The two-temperature quantities every model in this extension reads back from a PlasmaPhase,...
The error a closure raises for a state it cannot evaluate, so that the integrator proposing that stat...
Composition-resolved electron-heavy momentum-transfer collision model.
std::size_t electronIndex() const
Definition PlasmaCell.h:129
double electronDensity(double Tg, double Te, const double *Y, double rho) const
Electron number density [1/m^3], .
void updateSpeciesCp(double Tg, double Te, const double *Y, double rho) const
Refresh speciesCp() at one state without evaluating anything else.
const std::shared_ptr< Cantera::Solution > & solution() const
The Solution this cell evaluates on, so a caller can build a second cell on the same mechanism rather...
Definition PlasmaCell.h:135
void pressureAndElectronDensity(double Tg, double Te, const double *Y, double rho, double &p, double &electron_density) const
Total pressure [Pa] and electron number density [1/m^3] together, from the two-temperature equation o...
void sourceTerms(double Tg, double Te, const double *Y, double rho, double E, double &dTg, double &dTe, double *dY, double &lhs_Tg, double &lhs_Te, Diagnostics *diag=nullptr) const
Single-cell RHS (no transport, no volume work).
const std::vector< double > & molecularWeights() const
Definition PlasmaCell.h:131
PlasmaCell(std::shared_ptr< Cantera::Solution > sol, PlasmaCellConfig cfg)
Construct a PlasmaCell for a given plasma Solution and configuration.
const std::vector< double > & speciesCp() const
Mass-basis species heat capacity at constant pressure c_p,k [J/kg/K], length nSpecies(),...
Definition PlasmaCell.h:151
void speciesEnthalpies(double Tg, double Te, const double *Y, double rho, double *h) const
Mass-basis species enthalpy h_k [J/kg], the energy one kilogram of species k carries in when the spec...
std::size_t nSpecies() const
Definition PlasmaCell.h:127
double electricalConductivity(double Tg, double Te, const double *Y, double rho) const
Electrical conductivity [S/m] at a node state.
std::string speciesName(std::size_t k) const
Name of species k in the mechanism.
double nu_m
Scalar electron momentum-transfer frequency, used when nu_m_T/nu_m_v are empty [1/s].
Definition PlasmaCell.h:70
CollisionModel collision
Composition-resolved sigma/nu_E (preferred).
Definition PlasmaCell.h:54
std::vector< double > sigma_v
sigma(Te) table: electrical conductivity values at sigma_T [S/m]
Definition PlasmaCell.h:61
bool reacting
Include finite-rate chemistry source terms (true) or freeze composition (false) [-].
Definition PlasmaCell.h:52
std::vector< double > species_h0k
Per-species standard enthalpy of formation at 0 K [J/kmol], length nSpecies(), in mechanism species-i...
Definition PlasmaCell.h:83
std::vector< double > nu_m_v
nu_m(Te) table: electron momentum-transfer frequency values at nu_m_T [1/s]
Definition PlasmaCell.h:67
double nu_E
Scalar elastic electron-heavy energy-exchange frequency, used when collision is empty [1/s].
Definition PlasmaCell.h:73
std::vector< double > nu_m_T
nu_m(Te) table: electron-temperature grid points [K], strictly increasing
Definition PlasmaCell.h:64
std::vector< double > sigma_T
sigma(Te) table: electron-temperature grid points [K], strictly increasing
Definition PlasmaCell.h:58
Optional power / Maxwellian-condition breakdown filled by rates() when a non-null pointer is passed.
Definition PlasmaCell.h:98
double nu_eH
Electron-electron collision frequency [1/s] (Mitchner II-8.11e).
Definition PlasmaCell.h:110
double P_elastic
< Elastic electron-heavy exchange power [W/m^3]
Definition PlasmaCell.h:100
double P_chemical_e
Joule heating power [W/m^3].
Definition PlasmaCell.h:106
double nu_ee
Electron-ion momentum-transfer collision frequency [1/s].
Definition PlasmaCell.h:112
double P_Joule
Electron-heavy momentum-transfer collision frequency [1/s] (Mitchner II-13.3).
Definition PlasmaCell.h:108
double P_inelastic
Heavy-species chemical power [W/m^3].
Definition PlasmaCell.h:102
double nu_eI
sum_h nu_eh/m_h [1/kg/s] (Mitchner VIII-3.8, term 2)
Definition PlasmaCell.h:114
double P_chemical_H
Electron chemical power [W/m^3].
Definition PlasmaCell.h:104
The two-temperature equation of state at the state currently set on a phase, PHYSICS....
Definition PlasmaState.h:72