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

Native C++ two-temperature 0D plasma reactor (stateless per-eval evaluator). More...

#include <PlasmaReactor0D.h>

Public Member Functions

 PlasmaReactor0D (const PlasmaReactor0DConfig &cfg)
 Construct from a mechanism/phase and collision-model configuration.
std::size_t nSpecies () const
std::vector< std::string > speciesNames () const
 Species names in mechanism index order, so a caller passing plain numbers across the Python boundary can still label its columns.
double electricalConductivity (double Tg, double Te, const double *Y, double rho) const
 Electrical conductivity [S/m] at state \( (T_g, T_e, Y, \rho = \text{mass}/V) \).
double electronDensity (double Tg, double Te, const double *Y, double rho) const
 Electron number density [1/m^3].
void rhs (double Tg, double Te, double V, const double *Y, double E, double mass, double p_ext, double polytropic_index, double *dydt) const
 Full 0D RHS.
const PlasmaCell::Diagnostics & diagnostics () const
 Power / Maxwellian-condition breakdown from the most recent rhs() call (see PlasmaCell::Diagnostics) – the native counterpart of the Python reference reactor's stored P_elastic/P_inelastic/P_chemical_H/ P_chemical_e/P_Joule/nu_eH/nu_ee/nu_eI/nu_eH_mass_weighted attributes.

Detailed Description

Native C++ two-temperature 0D plasma reactor (stateless per-eval evaluator).

Wraps the shared PlasmaCell (chemistry/Joule/exchange) with a composition-resolved CollisionModel and the constant-mass volume equation, exposing the per-eval electricalConductivity and rhs that the Python driver (scipy + NRP circuit) calls. The state vector is

\[ y = [T_g,\, T_e,\, V,\, Y_0, \ldots, Y_{K-1}], \qquad \rho = \frac{\text{mass}}{V}. \]

With polytropic_index \( = \infty \) the volume is held constant ( \( dV/dt = 0 \)), matching the 1D channel's constant-volume assumption; a finite index activates the polytropic rarefaction model.

Definition at line 68 of file PlasmaReactor0D.h.

Constructor & Destructor Documentation

◆ PlasmaReactor0D()

rizer::PlasmaReactor0D::PlasmaReactor0D ( const PlasmaReactor0DConfig & cfg)
explicit

Construct from a mechanism/phase and collision-model configuration.

Parameters
cfgReactor configuration (mechanism/phase, reacting flag, per-species collision specs, Te grid bounds/resolution, electrode gap [m]); see PlasmaReactor0DConfig above for field-by-field units.
Exceptions
std::invalid_argumentif the named phase is not a PlasmaPhase, so it carries no electron temperature

Definition at line 22 of file PlasmaReactor0D.cpp.

Member Function Documentation

◆ diagnostics()

const PlasmaCell::Diagnostics & rizer::PlasmaReactor0D::diagnostics ( ) const
inline

Power / Maxwellian-condition breakdown from the most recent rhs() call (see PlasmaCell::Diagnostics) – the native counterpart of the Python reference reactor's stored P_elastic/P_inelastic/P_chemical_H/ P_chemical_e/P_Joule/nu_eH/nu_ee/nu_eI/nu_eH_mass_weighted attributes.

Overwritten by every rhs() call, so it describes the last state the reactor was evaluated at, not a running history. Zero-initialised, so reading it before the first rhs() gives zeros rather than garbage.

Returns
The cached breakdown; the reactor keeps ownership

Definition at line 148 of file PlasmaReactor0D.h.

◆ electricalConductivity()

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

Electrical conductivity [S/m] at state \( (T_g, T_e, Y, \rho = \text{mass}/V) \).

Parameters
TgGas (heavy-species) temperature [K]
TeElectron temperature [K]
YSpecies mass fractions [-], length nSpecies()
rhoMass density [kg/m^3] ( \( = \text{mass}/V \))

Definition at line 94 of file PlasmaReactor0D.h.

◆ electronDensity()

double rizer::PlasmaReactor0D::electronDensity ( double Tg,
double Te,
const double * Y,
double rho ) const
inline

Electron number density [1/m^3].

Parameters
TgGas (heavy-species) temperature [K]
TeElectron temperature [K]
YSpecies mass fractions [-], length nSpecies()
rhoMass density [kg/m^3] ( \( = \text{mass}/V \))

Definition at line 104 of file PlasmaReactor0D.h.

◆ nSpecies()

std::size_t rizer::PlasmaReactor0D::nSpecies ( ) const
inline
Returns
Number of species K in the loaded mechanism [-], which is the length every Y argument below must have

Definition at line 81 of file PlasmaReactor0D.h.

◆ rhs()

void rizer::PlasmaReactor0D::rhs ( double Tg,
double Te,
double V,
const double * Y,
double E,
double mass,
double p_ext,
double polytropic_index,
double * dydt ) const

Full 0D RHS.

Writes dydt = [dTg, dTe, dV, dY_0..dY_{K-1}] (length 3 + K), where

\[ \rho = \frac{\text{mass}}{V}, \qquad \text{polytropic\_index} = \infty \implies \frac{dV}{dt} = 0 \]

(constant volume).

Parameters
TgGas (heavy-species) temperature [K]
TeElectron temperature [K]
VPlasma/reactor volume [m^3]
YSpecies mass fractions [-], length nSpecies()
EElectric field [V/m]
massReactor mass [kg] (constant)
p_extExternal pressure [Pa] (polytropic relaxation target)
polytropic_indexPolytropic index [-] ( \( \infty \) => constant volume, \( dV/dt = 0 \))
[out]dydt[dTg/dt, dTe/dt, dV/dt, dY_k/dt] in [K/s, K/s, m^3/s, 1/s], length 3 + nSpecies()
Exceptions
TrialStateErrorif Tg is outside [TemperatureFloor, TemperatureCeiling], Te is below TemperatureFloor, either is NaN, or the source terms are not finite (PlasmaCell::sourceTerms)
std::invalid_argumentif polytropic_index is not +inf and is not positive (NaN included), or is finite with gap <= 0
std::runtime_errorif the polytropic branch is active and the mixture's heat capacity at constant volume is not positive, so the branch's speed of sound has no meaning

Definition at line 82 of file PlasmaReactor0D.cpp.

◆ speciesNames()

std::vector< std::string > rizer::PlasmaReactor0D::speciesNames ( ) const

Species names in mechanism index order, so a caller passing plain numbers across the Python boundary can still label its columns.

Returns
One name per species, length nSpecies()

Definition at line 74 of file PlasmaReactor0D.cpp.


The documentation for this class was generated from the following files: