|
rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
|
Shared single-cell two-temperature reacting-plasma RHS (one physics source). More...
#include <PlasmaCell.h>
Classes | |
| struct | Diagnostics |
| Optional power / Maxwellian-condition breakdown filled by rates() when a non-null pointer is passed. More... | |
Public Member Functions | |
| PlasmaCell (std::shared_ptr< Cantera::Solution > sol, PlasmaCellConfig cfg) | |
| Construct a PlasmaCell for a given plasma Solution and configuration. | |
| std::size_t | nSpecies () const |
| std::size_t | electronIndex () const |
| const std::vector< double > & | molecularWeights () const |
| 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 than reloading it. | |
| const std::vector< double > & | speciesCp () const |
| Mass-basis species heat capacity at constant pressure c_p,k [J/kg/K], length nSpecies(), valid as of the most recent rates() call for this state (rates() must be called first for the same (Tg,Te,Y,rho); this reads back that call's already-evaluated Cantera thermo state rather than re-evaluating it). | |
| std::string | speciesName (std::size_t k) const |
| Name of species k in the mechanism. | |
| 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). | |
| double | electricalConductivity (double Tg, double Te, const double *Y, double rho) const |
| Electrical conductivity [S/m] at a node state. | |
| double | electronDensity (double Tg, double Te, const double *Y, double rho) const |
| Electron number density [1/m^3], \(n_e = X_e P / (k_B T_{mean})\). | |
| 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 of state of PHYSICS.md (G6): the electrons contribute at Te and everything else at Tg. | |
| void | updateSpeciesCp (double Tg, double Te, const double *Y, double rho) const |
| Refresh speciesCp() at one state without evaluating anything else. | |
| 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 species-diffusion terms move it. | |
Shared single-cell two-temperature reacting-plasma RHS (one physics source).
The two-temperature (Te != Tg) energy/chemistry/Joule physics of a single plasma cell, held in one place so the standalone 0D reactor (PlasmaReactor0D) and the 1D channel share ONE implementation. Per call it sets the Cantera state, evaluates finite-rate chemistry, the Joule source \(\sigma E^2\), the elastic/inelastic electron-heavy exchange, and the two energy-equation capacitances.
Conductivity sigma and the elastic energy-exchange frequency nu_E come from a composition-resolved CollisionModel when one is supplied (preferred: tracks the evolving composition); otherwise from the legacy nu_m(Te)/sigma(Te) tables, or a scalar nu_m plus a scalar nu_E, which stay useful for quick runs but do not track the evolving composition.
Definition at line 86 of file PlasmaCell.h.
| rizer::PlasmaCell::PlasmaCell | ( | std::shared_ptr< Cantera::Solution > | sol, |
| PlasmaCellConfig | cfg ) |
Construct a PlasmaCell for a given plasma Solution and configuration.
| sol | Cantera plasma Solution (thermo + kinetics) this RHS evaluates against |
| cfg | Closure selection and legacy fallback tables/scalars (see PlasmaCellConfig above) |
Definition at line 26 of file PlasmaCell.cpp.
| double rizer::PlasmaCell::electricalConductivity | ( | double | Tg, |
| double | Te, | ||
| const double * | Y, | ||
| double | rho ) const |
Electrical conductivity [S/m] at a node state.
| Tg | Gas temperature [K] |
| Te | Electron temperature [K] |
| Y | Mass fractions, length nSpecies [-] |
| rho | Mass density [kg/m^3] |
| TrialStateError | if Tg is outside [TemperatureFloor, TemperatureCeiling], Te is below TemperatureFloor, either is NaN, or a mass fraction is NaN. |
Definition at line 254 of file PlasmaCell.cpp.
| double rizer::PlasmaCell::electronDensity | ( | double | Tg, |
| double | Te, | ||
| const double * | Y, | ||
| double | rho ) const |
Electron number density [1/m^3], \(n_e = X_e P / (k_B T_{mean})\).
| Tg | Gas temperature [K] |
| Te | Electron temperature [K] |
| Y | Mass fractions, length nSpecies [-] |
| rho | Mass density [kg/m^3] |
| TrialStateError | if Tg is outside [TemperatureFloor, TemperatureCeiling], Te is below TemperatureFloor, either is NaN, or a mass fraction is NaN. |
Definition at line 263 of file PlasmaCell.cpp.
|
inline |
Definition at line 129 of file PlasmaCell.h.
|
inline |
Definition at line 131 of file PlasmaCell.h.
|
inline |
Definition at line 127 of file PlasmaCell.h.
| void rizer::PlasmaCell::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 of state of PHYSICS.md (G6): the electrons contribute at Te and everything else at Tg.
The same state-setting the source terms run on, so a caller does not have to keep a second copy of the equation of state in step.
Both at once because one setState() already computes both, and that call – setting the composition and (T, rho) on the Cantera phase and reading the mixture back – is the whole cost. A caller recording the two per node per frame would otherwise pay for it twice.
| Tg | Gas temperature [K] | |
| Te | Electron temperature [K] | |
| Y | Mass fractions, length nSpecies [-] | |
| rho | Mass density [kg/m^3] | |
| [out] | p | Total pressure [Pa] |
| [out] | electron_density | Electron number density [1/m^3] |
| TrialStateError | if Tg is outside [TemperatureFloor, TemperatureCeiling], Te is below TemperatureFloor, either is NaN, or a mass fraction is NaN. |
Definition at line 269 of file PlasmaCell.cpp.
|
inline |
The Solution this cell evaluates on, so a caller can build a second cell on the same mechanism rather than reloading it.
Definition at line 135 of file PlasmaCell.h.
| void rizer::PlasmaCell::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).
Outputs dTg,dTe [K/s], dY [1/s] (length nSpecies), and the energy-equation capacitances lhs_Tg,lhs_Te [J/m^3/K].
| Tg | Gas (heavy-species) temperature [K] | |
| Te | Electron temperature [K] | |
| Y | Mass fractions, length nSpecies [-] | |
| rho | Mass density [kg/m^3] | |
| E | Electric field magnitude [V/m] | |
| [out] | dTg | Gas temperature time derivative [K/s] |
| [out] | dTe | Electron temperature time derivative [K/s] |
| [out] | dY | Mass fraction time derivatives, length nSpecies [1/s] |
| [out] | lhs_Tg | Gas-energy-equation capacitance (heavy-species \(\rho c_v\)) [J/m^3/K] |
| [out] | lhs_Te | Electron-energy-equation capacitance ( \(Y_e \rho c_{v,e}\)) [J/m^3/K] |
| [out] | diag | If non-null, filled with the power / Maxwellian- condition breakdown for this evaluation (see Diagnostics). |
| TrialStateError | if Tg is outside [TemperatureFloor, TemperatureCeiling], Te is below TemperatureFloor, either is NaN, a mass fraction is NaN, or the heavy-pool heat capacity lhs_Tg is not positive (no heavy species present). |
Definition at line 81 of file PlasmaCell.cpp.
|
inline |
Mass-basis species heat capacity at constant pressure c_p,k [J/kg/K], length nSpecies(), valid as of the most recent rates() call for this state (rates() must be called first for the same (Tg,Te,Y,rho); this reads back that call's already-evaluated Cantera thermo state rather than re-evaluating it).
For a heavy species k, \(c_{p,k} = (C_{p,k}/R)\,R/W_k\), i.e. Cantera's dimensionless molar \(C_p/R\) (from getCp_R(), evaluated at Tg) converted to a mass-specific quantity by the molecular weight W_k [kg/kmol]. The electron entry (index electronIndex()) instead holds the analytic monatomic-ideal-gas value \(c_{p,e} = c_{v,e} + R/W_e = 2.5\,R/W_e\) – consistent with the cv_e already used internally by rates() for lhs_Te, rather than Cantera's own (thermo-fit) electron Cp. Used by PlasmaChannel1D's species-diffusion enthalpy-transport (energy- equation "enthalpy diffusion") term.
Definition at line 151 of file PlasmaCell.h.
| void rizer::PlasmaCell::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 species-diffusion terms move it.
What those terms deposit, not a second model of it: the Fickian term adds the species' internal energy, and the compressibility term adds \(R T/W_k\) on top, which together are the partial molar enthalpy at Tg for a heavy species. The electron entry is \((c_{v,e} + R/W_e)\,T_e\), the analytic form lhs_Te and the electron energy are written in, rather than Cantera's own fit.
| [in] | Tg | Gas temperature [K] |
| [in] | Te | Electron temperature [K] |
| [in] | Y | Mass fractions, length nSpecies() [-] |
| [in] | rho | Mass density [kg/m^3] |
| [out] | h | Species enthalpies [J/kg], length nSpecies() |
| TrialStateError | if Tg is outside [TemperatureFloor, TemperatureCeiling], Te is below TemperatureFloor, either is NaN, or a mass fraction is NaN. |
Definition at line 286 of file PlasmaCell.cpp.
| std::string rizer::PlasmaCell::speciesName | ( | std::size_t | k | ) | const |
Name of species k in the mechanism.
| k | Species index into the mechanism, 0..nSpecies()-1 [-] |
Definition at line 76 of file PlasmaCell.cpp.
| void rizer::PlasmaCell::updateSpeciesCp | ( | double | Tg, |
| double | Te, | ||
| const double * | Y, | ||
| double | rho ) const |
Refresh speciesCp() at one state without evaluating anything else.
sourceTerms() already leaves the cache current for the state it was called at, so the solver never needs this. It exists for a caller that wants the enthalpy-diffusion term alone: speciesCp() returns a reference to a per-call cache, and reading it without first putting a state in gives the zeros the constructor left.
| [in] | Tg | Gas temperature [K] |
| [in] | Te | Electron temperature [K] |
| [in] | Y | Mass fractions, length nSpecies() [-] |
| [in] | rho | Mass density [kg/m^3] |
| TrialStateError | if Tg is outside [TemperatureFloor, TemperatureCeiling], Te is below TemperatureFloor, either is NaN, or a mass fraction is NaN. |
Definition at line 279 of file PlasmaCell.cpp.