rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
Loading...
Searching...
No Matches
rizer::PlasmaCell Class Reference

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ PlasmaCell()

rizer::PlasmaCell::PlasmaCell ( std::shared_ptr< Cantera::Solution > sol,
PlasmaCellConfig cfg )

Construct a PlasmaCell for a given plasma Solution and configuration.

Parameters
solCantera plasma Solution (thermo + kinetics) this RHS evaluates against
cfgClosure selection and legacy fallback tables/scalars (see PlasmaCellConfig above)

Definition at line 26 of file PlasmaCell.cpp.

Member Function Documentation

◆ electricalConductivity()

double rizer::PlasmaCell::electricalConductivity ( double Tg,
double Te,
const double * Y,
double rho ) const

Electrical conductivity [S/m] at a node state.

Parameters
TgGas temperature [K]
TeElectron temperature [K]
YMass fractions, length nSpecies [-]
rhoMass density [kg/m^3]
Exceptions
TrialStateErrorif 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.

◆ electronDensity()

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})\).

Parameters
TgGas temperature [K]
TeElectron temperature [K]
YMass fractions, length nSpecies [-]
rhoMass density [kg/m^3]
Exceptions
TrialStateErrorif 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.

◆ electronIndex()

std::size_t rizer::PlasmaCell::electronIndex ( ) const
inline
Returns
Index of the electron species in every length-K array [-]

Definition at line 129 of file PlasmaCell.h.

◆ molecularWeights()

const std::vector< double > & rizer::PlasmaCell::molecularWeights ( ) const
inline
Returns
Per-species molecular weight [kg/kmol], length K

Definition at line 131 of file PlasmaCell.h.

◆ nSpecies()

std::size_t rizer::PlasmaCell::nSpecies ( ) const
inline
Returns
Number of species K in the loaded phase [-]

Definition at line 127 of file PlasmaCell.h.

◆ pressureAndElectronDensity()

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.

Parameters
TgGas temperature [K]
TeElectron temperature [K]
YMass fractions, length nSpecies [-]
rhoMass density [kg/m^3]
[out]pTotal pressure [Pa]
[out]electron_densityElectron number density [1/m^3]
Exceptions
TrialStateErrorif 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.

◆ solution()

const std::shared_ptr< Cantera::Solution > & rizer::PlasmaCell::solution ( ) const
inline

The Solution this cell evaluates on, so a caller can build a second cell on the same mechanism rather than reloading it.

Returns
The shared Solution; the cell keeps ownership

Definition at line 135 of file PlasmaCell.h.

◆ sourceTerms()

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].

Parameters
TgGas (heavy-species) temperature [K]
TeElectron temperature [K]
YMass fractions, length nSpecies [-]
rhoMass density [kg/m^3]
EElectric field magnitude [V/m]
[out]dTgGas temperature time derivative [K/s]
[out]dTeElectron temperature time derivative [K/s]
[out]dYMass fraction time derivatives, length nSpecies [1/s]
[out]lhs_TgGas-energy-equation capacitance (heavy-species \(\rho c_v\)) [J/m^3/K]
[out]lhs_TeElectron-energy-equation capacitance ( \(Y_e \rho c_{v,e}\)) [J/m^3/K]
[out]diagIf non-null, filled with the power / Maxwellian- condition breakdown for this evaluation (see Diagnostics).
Exceptions
TrialStateErrorif 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.

◆ speciesCp()

const std::vector< double > & rizer::PlasmaCell::speciesCp ( ) const
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.

◆ speciesEnthalpies()

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.

Parameters
[in]TgGas temperature [K]
[in]TeElectron temperature [K]
[in]YMass fractions, length nSpecies() [-]
[in]rhoMass density [kg/m^3]
[out]hSpecies enthalpies [J/kg], length nSpecies()
Exceptions
TrialStateErrorif 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.

◆ speciesName()

std::string rizer::PlasmaCell::speciesName ( std::size_t k) const

Name of species k in the mechanism.

Parameters
kSpecies index into the mechanism, 0..nSpecies()-1 [-]

Definition at line 76 of file PlasmaCell.cpp.

◆ updateSpeciesCp()

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.

Parameters
[in]TgGas temperature [K]
[in]TeElectron temperature [K]
[in]YMass fractions, length nSpecies() [-]
[in]rhoMass density [kg/m^3]
Exceptions
TrialStateErrorif 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.


The documentation for this class was generated from the following files:
  • /home/runner/work/rizer/rizer/rizer/cantera_ext/models/nrp/PlasmaCell.h
  • /home/runner/work/rizer/rizer/rizer/cantera_ext/models/nrp/PlasmaCell.cpp