rizer.plasma.constant_mass_reactor_cpp#
C++-backed two-temperature 0D plasma reactor driver.
A drop-in alternative to
ConstantMassPlasmaReactorOde whose per-RHS
chemistry / 2T-energy / Joule / conductivity are evaluated natively in the
_plasma1d extension (Cantera MultiRate rate-constant caching + the C++
CollisionModel), while scipy integration and the NRP electric circuit
stay in Python – the validated, single-source-of-truth circuit.
The state vector matches the Python reference: y = [Tg, Te, V, Y_0..Y_{K-1}].
Per RHS eval: sigma (C++) -> R_p -> V_p (Python circuit) -> E ->
dydt (C++). See rizer.plasma.constant_mass_reactor.ConstantMassPlasmaReactorOde
for the physics; this class reproduces it with the heavy numerics moved to C++.
Classes#
Constant-mass 2T plasma reactor RHS with a native C++ core. |
Functions#
|
Construct a native |
Module Contents#
- rizer.plasma.constant_mass_reactor_cpp.build_reactor0d(mech: str, phase: str, species_names: list[str], mtcf: list[rizer.plasma.collision_frequency.MomentumTransferCollisionFrequencyModel], reacting: bool = True, gap: float = 0.0, Te_min: float = 300.0, Te_max: float = 100000.0, Te_n: int = 600, spitzer: bool = True) Any#
Construct a native
Reactor0Dfrom a momentum-transfer-model list.mtcfis the same per-species model list used byPlasmaExtension(get_momentum_transfer_collision_frequencies_list); the per-species cross-section data / hard-sphere radius / ion charge are extracted from it so the C++ collision model is identical to the Python reference’s.- Parameters:
mech (
str) – Cantera mechanism (YAML) path.phase (
str) – Cantera mechanism (YAML) phase name (aPlasmaPhasewithe-).species_names (
listofstr) – Species names, in mechanism order. Only used to count species (nsp = len(species_names)); the C++ side re-reads the mechanism itself for the authoritative species order.mtcf (
listofMomentumTransferCollisionFrequencyModel) – Per-species momentum-transfer collision-frequency models, in species-index order (as built byrizer.misc.simulation.simulation.get_momentum_transfer_collision_frequencies_list()). Unpacked into the flat cross-section / hard-sphere-radius / ion-charge arrays the C++CollisionModelconstructor expects.reacting (
bool, optional) – Include finite-rate chemistry in the reactor’s RHS. Default True.gap (
float, optional) – Inter-electrode gap [m], used only by the reactor’s own diagnostics (not by the RHS physics, which is homogeneous/0D). Default 0.0.Te_min (
float, optional) – Electron-temperature bounds [K] of the log-spaced grid the C++CollisionModelprecomputes its per-species Maxwellian-averaged cross sections on. Defaults 300.0 and 1.0e5.Te_max (
float, optional) – Electron-temperature bounds [K] of the log-spaced grid the C++CollisionModelprecomputes its per-species Maxwellian-averaged cross sections on. Defaults 300.0 and 1.0e5.Te_n (
int, optional) – Number of points in that Te grid. Default 600.spitzer (
bool, optional) – Apply the Spitzer e-e correction to the electron-electron contribution of the collision model. Default True.
- Returns:
Native two-temperature 0D reactor evaluator (persistent: rebuilds its rate/cross-section caches once at construction, then is queried once per RHS call from
ConstantMassPlasmaReactorOdeCpp()).- Return type:
rizer.cantera_ext._plasma1d.Reactor0D
- class rizer.plasma.constant_mass_reactor_cpp.ConstantMassPlasmaReactorOdeCpp(mech: str, phase: str, mtcf: list[rizer.plasma.collision_frequency.MomentumTransferCollisionFrequencyModel], mass: float, gap: float, electric_circuit: rizer.electric_circuit.nrp_circuit.NRPCircuit, nb_reflections: int, polytropic_index: float | str = np.inf, p_ext: float | str = 101325.0, reacting: bool = True, species_names: list[str] | None = None, Te_n: int = 600, spitzer: bool = True)#
Constant-mass 2T plasma reactor RHS with a native C++ core.
Parameters mirror the relevant subset of
ConstantMassPlasmaReactorOde; see that class’s docstring for the physics (equation of state, species mass-fraction balance, electron- and gas-energy balances). Here, every RHS evaluation delegates the chemistry / 2T-energy / Joule / conductivity algebra to the native_plasma1d.Reactor0D(seePlasma0DReactor.cpp/ReactorRHS.cpp), and only the volume/circuit bookkeeping that needs the Python NRP circuit stays here.- Parameters:
mech (
str) – Cantera mechanism (YAML) path and phase name.phase (
str) – Cantera mechanism (YAML) path and phase name.mtcf (
listofMomentumTransferCollisionFrequencyModel) – Per-species momentum-transfer collision-frequency models; seebuild_reactor0d().mass (
float) – Mass of the plasma [kg]. Assumed constant.gap (
float) – Gap between the two electrodes [m]. Used to compute the electric field from the plasma voltage, and the radius from the volume.electric_circuit (
NRPCircuit) – Electric circuit object (generator + cable). Defines the mappingR_p -> V_p(plasma resistance to plasma voltage) evaluated in Python at every RHS call.nb_reflections (
int) – Number of reflections of the generator voltage wave to take into account in the computation of the plasma voltage.polytropic_index (
floatorstr, optional) – Polytropic index of the plasma expansion.np.infmeans constant volume (the default – the only case exercised by the C++ RHS so far). If1, isothermal."gamma"(adiabatic index, computed from the live composition) is supported by the pure-Python reference but not here; pass a numeric value instead.p_ext (
floatorstr, optional) – External pressure [Pa], used only whenpolytropic_indexis finite (pressure-relaxation volume equation). Default 101325.0. If a string, it must be"atmospheric"or"atm", resolved tocantera.one_atm.reacting (
bool, optional) – Include finite-rate chemistry. Default True.species_names (
listofstrorNone, optional) – Species names, in mechanism order. If None (default), loaded once from a throwawaycantera.Solution(mech, phase)just to readspecies_names– avoids requiring the caller to already have aSolutionobject.Te_n (
int, optional) – Number of points in the collision model’s electron-temperature table. Default 600.spitzer (
bool, optional) – Apply the Spitzer e-e correction in the collision model. Default True.
- Raises:
ValueError – If
polytropic_index == "gamma"(not supported natively; pass a numeric polytropic index instead), if p_ext is a string other than"atmospheric"/"atm", or if a numeric p_ext is not strictly positive.
- species_names#
- mass#
- gap#
- polytropic_index#
- electric_circuit#
- nb_reflections#
- plasma_resistance = 0.0#
Stored plasma resistance [Ohm], updated at the last RHS evaluation.
- plasma_voltage = 0.0#
Stored plasma voltage [V], updated at the last RHS evaluation.
- plasma_radius = 0.0#
Stored plasma radius [m] (from V = pi*r^2*gap), updated at the last RHS evaluation.
- P_elastic = 0.0#
Elastic electron-heavy exchange power [W/m^3], from the last RHS evaluation.
- P_inelastic = 0.0#
Inelastic electron-impact-reaction power [W/m^3], from the last RHS evaluation.
- P_chemical = 0.0#
Heavy-species chemical power [W/m^3], from the last RHS evaluation.
- P_chemical_e = 0.0#
Electron chemical power [W/m^3], from the last RHS evaluation.
- P_Joule = 0.0#
Joule heating power [W/m^3], from the last RHS evaluation.
- cond_maxwell_1 = 0.0#
Maxwellian-distribution condition term 1 (nu_ee/m_e), from the last RHS evaluation.
- cond_maxwell_2 = 0.0#
Maxwellian-distribution condition term 2 (sum_h nu_eh/m_h), from the last RHS evaluation.