rizer.pipeline.run_nrp_simulation#

Helper functions for running simulations.

Attributes#

Classes#

CommonSimulationSetup

Parsed plasma/electric_circuit/simulation YAML sections.

Functions#

build_collision_frequencies(...)

Build a MixtureCollisionFrequencies wrapping plasma.

create_case_folder(→ pathlib.Path)

Create a folder for the case, named {case_name}_{date}_{run_number}.

prepare_case_output(→ tuple[pathlib.Path, ...)

Create the case folder and save its provenance files (log, inputs, mechanism, versions).

get_radius_change_events(→ list[tuple[float, float]])

Parse and validate the radius_changes section of a simulation input YAML.

resolve_plasma_mechanism(→ tuple[cantera.Solution, ...)

Resolve the plasma.mechanism YAML section to a Cantera plasma object.

check_charge_neutrality(→ None)

Raise unless plasma's composition has seed electrons and is charge-neutral.

apply_initial_composition(→ None)

Set plasma to (T_g, T_e, P) with the requested composition.

parse_common_simulation_setup(→ CommonSimulationSetup)

Parse, validate and log the common plasma/electric_circuit/simulation sections.

resolved_cpp_mechanism(...)

Yield the (mechanism_path, phase_name) the native Reactor0D should load from.

build_isomass_2T_volume_reactor(...)

Build a constant-mass two-temperature plasma reactor, ready for a cantera.ReactorNet.

configure_reactor_net(→ None)

Configure a cantera.ReactorNet's CVODE tolerances/limits from the input YAML.

compute_reactor_diagnostics(→ dict[str, float])

Compute the per-output-step diagnostics recorded alongside the plasma state.

run_constant_mass_nrp_simulation(→ cantera.SolutionArray)

Run a full 2T0D constant-mass NRP discharge simulation.

Module Contents#

rizer.pipeline.run_nrp_simulation.logger#
rizer.pipeline.run_nrp_simulation.build_collision_frequencies(plasma: cantera.Solution, momentum_transfer_collision_frequencies_list: list[rizer.transport.collision_frequency.MomentumTransferCollisionFrequencyModel], n_points: int = 2000) → rizer.transport.mixture_law.MixtureCollisionFrequencies#

Build a MixtureCollisionFrequencies wrapping plasma.

Also enables its collision-frequency and reverse-rate caches.

Wraps the setup every 2T0D constant-mass run script needs before running a simulation: construct the wrapper, precompute its tabulated cross-section grids (precompute_collision_frequency_tables()), and enable the reverse-two-temperature-plasma rate grid cache (enable_reverse_two_temperature_grid_cache()) – all with the same n_points, and in the order required (both caches must be set up before the first integration step).

Parameters:
Return type:

MixtureCollisionFrequencies

Notes

enable_reverse_two_temperature_grid_cache sets process-wide configuration, independent of plasma; calling this function once per case in a sweep (e.g. run_2T0D_sensitivity_analysis_electron_density.py) re-applies the same configuration redundantly but harmlessly. momentum_transfer_collision_frequencies_list’s models are stateless with respect to any specific plasma object (they take temperature and density as call parameters, not stored state), so the same list – computed once via get_momentum_transfer_collision_frequencies_list() – can safely be reused across many calls to this function for different plasma objects built from the same mechanism (e.g. a sweep that only perturbs reaction-rate multipliers between cases), instead of rebuilding it (re-parsing cross-section data from disk) on every call.

rizer.pipeline.run_nrp_simulation.create_case_folder(base_folder: str, case_name: str) → pathlib.Path#

Create a folder for the case, named {case_name}_{date}_{run_number}.

date is today’s date (YYYY-MM-DD) and run_number starts at 0 and increments to the next free integer, so multiple runs with the same case_name on the same day get their own folder automatically instead of colliding.

Parameters:
  • base_folder (str) – The base folder where the case folder will be created.

  • case_name (str) – Descriptive name for the case (e.g. “maxwellian” or “reference”).

Returns:

The path to the created case folder.

Return type:

pathlib.Path

rizer.pipeline.run_nrp_simulation.prepare_case_output(base_folder: str, case_name: str, input_yaml_file: str | pathlib.Path, plasma: cantera.Solution, previous_log_handler: logging.FileHandler | None = None, logger: logging.Logger | logging.LoggerAdapter | None = None) → tuple[pathlib.Path, logging.FileHandler]#

Create the case folder and save its provenance files (log, inputs, mechanism, versions).

Wraps the setup every 2T0D constant-mass run script needs before calling run_constant_mass_nrp_simulation(): create the case folder (see create_case_folder()), attach its run.log file handler (see add_log_file_handler()), copy input_yaml_file and plasma’s mechanism into the case’s inputs subfolder, and record the versions of the main libraries used.

Parameters:
  • base_folder (str) – Passed straight to create_case_folder().

  • case_name (str) – Passed straight to create_case_folder().

  • input_yaml_file (str or pathlib.Path) – Simulation input YAML to copy into the case’s inputs subfolder.

  • plasma (cantera.Solution) – Plasma object (with any reaction-rate multipliers already applied) whose mechanism is saved to the case’s inputs subfolder.

  • previous_log_handler (logging.FileHandler or None, optional) – A previous call’s returned handler to remove and close first, so a loop over many cases (e.g. the sensitivity-analysis sweep) doesn’t accumulate handlers on the root logger. Default None (nothing to remove – the common case for a single-case script).

  • logger (logging.Logger or logging.LoggerAdapter or None, optional) – Logger used to announce the run.log path. Default None, which uses this module’s own logger.

Returns:

The case folder path, and the newly-added run.log handler (pass it back in as previous_log_handler on the next call in a loop).

Return type:

tuple of pathlib.Path and logging.FileHandler

rizer.pipeline.run_nrp_simulation.get_radius_change_events(radius_changes_input: list[dict[str, float]] | None, simulation_time: float) → list[tuple[float, float]]#

Parse and validate the radius_changes section of a simulation input YAML.

Parameters:
  • radius_changes_input (list of dict of str to float, or None) – Parsed radius_changes YAML section: a list of mappings, each with a "time" (in s) and a "radius" (in m) key, describing a change of the plasma radius at the given time. None or an empty list means the radius stays constant for the whole simulation.

  • simulation_time (float) – Total simulation time, in s (the simulation.t_end this radius_changes section is paired with). Every event’s "time" must be strictly less than this value – see the Notes section.

Returns:

(time_of_change, new_radius) pairs, sorted by increasing time.

Return type:

list of tuple of float

Raises:
  • KeyError – If an event is missing its "time" or "radius" key.

  • ValueError – If any "time" or "radius" value is not strictly positive, if two events share the same "time", or if any event’s "time" is not strictly less than simulation_time.

Notes

run_constant_mass_nrp_simulation builds its integration segments as [0, *change_times, simulation_time]; an event whose "time" is not strictly less than simulation_time (e.g. copy-pasted from a longer-duration case) would silently make that boundary list non-monotonic, either extending the simulation past the requested duration or turning a later segment into a no-op with zero recorded output – with no error raised. Requiring time < simulation_time here catches that misconfiguration up front, at parse time, rather than downstream as a silent behavior change.

class rizer.pipeline.run_nrp_simulation.CommonSimulationSetup#

Bases: NamedTuple

Parsed plasma/electric_circuit/simulation YAML sections.

Bundles the fields every 2T0D constant-mass run script needs regardless of the reactor backend or any per-case reaction-rate perturbation (see parse_common_simulation_setup()).

plasma: cantera.Solution#

Cantera plasma object (with any reaction-rate multipliers already applied).

mechanism_path: str | pathlib.Path | None#

Cantera mechanism (YAML) path plasma was loaded from, or None if it was built dynamically (e.g. by load_goutier2025_mechanism_with_options()) and so matches no single on-disk phase – see resolved_cpp_mechanism().

plasma_phase_name: str#

Cantera mechanism (YAML) phase name plasma was loaded from. Meaningless when mechanism_path is None.

P_0: float#

Total pressure, in Pa.

T_g_0: float#

Gas temperature, in K.

T_e_0: float#

Electron temperature, in K.

mole_fractions: str | dict[str, float]#

Base composition (Cantera string or mapping).

additional_number_density: str | dict[str, float] | None#

Species number densities [m^-3] added on top of mole_fractions, or None.

p_ext: float | str#

External pressure, in Pa (or “atmospheric”/”atm”).

gap: float#

Inter-electrode gap, in m.

pulse_duration: float | None#

Reference pulse duration, in s (Maxwellian Eq VIII-3.10 check), or None to skip that diagnostic (it is then recorded as NaN).

initial_radius: float#

Discharge radius, in m.

initial_volume: float#

Initial plasma volume, in m^3.

polytropic_index: float | str#

Polytropic index for volume evolution.

circuit_input: dict[str, Any]#

electric_circuit YAML section, passed whole to build_circuit_from_input() (validated there).

solver_input: dict[str, Any]#

simulation.solver YAML section.

solver_backend: str#

cpp or python; see build_isomass_2T_volume_reactor().

simulation_time: float#

Total simulation time, in s.

output_interval: float#

Time step between two recorded states, in s.

radius_changes: list[tuple[float, float]]#

See get_radius_change_events().

rizer.pipeline.run_nrp_simulation.resolve_plasma_mechanism(mechanism_input: dict[str, Any]) → tuple[cantera.Solution, pathlib.Path | None, str]#

Resolve the plasma.mechanism YAML section to a Cantera plasma object.

Parameters:

mechanism_input (dict of str to Any) – The plasma.mechanism section (option: "CH4_to_C2H2" or option: "file", plus the matching sub-section).

Returns:

  • plasma (cantera.Solution) – The loaded plasma object.

  • mechanism_path (pathlib.Path or None) – On-disk mechanism path, or None if plasma was built dynamically (CH4_to_C2H2) and so matches no single on-disk phase – see resolved_cpp_mechanism().

  • plasma_phase_name (str) – Cantera mechanism (YAML) phase name plasma was loaded from. Meaningless when mechanism_path is None.

rizer.pipeline.run_nrp_simulation.check_charge_neutrality(plasma: cantera.Solution) → None#

Raise unless plasma’s composition has seed electrons and is charge-neutral.

Positive charge (cations) and negative charge (electrons and anions) are compared per molecule of mixture, sum(X_k * q_k) over each sign; they must agree to one part in 1e6 of the negative charge.

Parameters:

plasma (cantera.Solution) – Plasma phase in the state to check.

Raises:

ValueError – No electrons in the composition, or a net charge.

rizer.pipeline.run_nrp_simulation.apply_initial_composition(plasma: cantera.Solution, T_g: float, T_e: float, P: float, mole_fractions: str | dict[str, Any], additional_number_density: str | dict[str, Any] | None = None) → None#

Set plasma to (T_g, T_e, P) with the requested composition.

mole_fractions is the base composition (Cantera syntax). additional_number_density adds species at absolute number densities [m^-3] on top of it, which is how a seed electron density is measured:

mole_fractions: "CH4: 1.0"
additional_number_density: "e-: 1.0e19, CH4+: 1.0e19"   # m^-3

The base composition is scaled to \(1 - \sum_k x_k\) and each added species contributes \(x_k = n_k / N\), with \(N\) the total number density of the mixture. \(N\) itself depends on the composition through the mean molar mass and, for a two-temperature phase, through the mean temperature, so the mole fractions are found by fixed-point iteration on the phase itself: on return, plasma.concentrations reproduces every requested density.

Parameters:
  • plasma (cantera.Solution) – Plasma phase, set in place.

  • T_g (float) – Heavy-species and electron temperature, in K.

  • T_e (float) – Heavy-species and electron temperature, in K.

  • P (float) – Total pressure, in Pa.

  • mole_fractions (str or dict of str to Any) – Base composition, Cantera syntax.

  • additional_number_density (str or dict of str to Any, optional) – Species number densities [m^-3] added on top of the base composition.

Raises:

ValueError – Unknown or non-positive species density, additions that do not leave room for the base composition, or a fixed point that does not converge.

rizer.pipeline.run_nrp_simulation.parse_common_simulation_setup(parsed_input: dict[str, Any], logger: logging.Logger | logging.LoggerAdapter | None = None) → CommonSimulationSetup#

Parse, validate and log the common plasma/electric_circuit/simulation sections.

Every 2T0D constant-mass run script (single-case or a sensitivity sweep) needs these same fields, independently of the reactor backend or any per-case reaction-rate perturbation; this factors out that shared parsing/validation/logging so scripts don’t duplicate it.

plasma.initial_conditions.mole_fractions is a Cantera composition (string or mapping) that already contains the seed electrons and their counter-ions, e.g. "CH4: 1.0, e-: 1.4e-6, CH4+: 1.4e-6". The caller is still responsible for actually setting plasma’s state (plasma.Te, plasma.TPX = T_g_0, P_0, mole_fractions), since that differs by script (e.g. the sensitivity-analysis sweep recreates plasma once per case).

Parameters:
Return type:

CommonSimulationSetup

rizer.pipeline.run_nrp_simulation.resolved_cpp_mechanism(plasma: cantera.Solution, mechanism_path: str | pathlib.Path | None, plasma_phase_name: str) → collections.abc.Generator[tuple[str, str]]#

Yield the (mechanism_path, phase_name) the native Reactor0D should load from.

Reactor0D reloads the mechanism from a YAML file path, independently of plasma’s in-memory state, so a reaction-rate multiplier applied via plasma.set_multiplier(...) (e.g. by a sensitivity-analysis sweep) would otherwise be silently lost. If mechanism_path is not None and plasma currently has no multiplier in effect, yields (mechanism_path, plasma_phase_name) unchanged – no I/O. Otherwise writes plasma’s current state (species, reactions, and multipliers) to a temporary mechanism file and yields that instead, deleting it on exit.

Pass mechanism_path=None when plasma was not loaded from a single on-disk mechanism file/phase in the first place (e.g. built by load_goutier2025_mechanism_with_options(), which can filter/reassemble species and reactions in memory into a combination that matches no single phase in the source YAML) – there is then no valid on-disk fallback to trust, multiplier or not, so this unconditionally takes the temporary-mechanism-file path below.

Used by build_isomass_2T_volume_reactor() (resolved once per call) and by run_constant_mass_nrp_simulation() (resolved once for the whole run and reused across every radius-change segment, since plasma’s multiplier state never changes between segments of the same run – avoiding a redundant mechanism write/parse per segment).

Parameters:
  • plasma (cantera.Solution) – Cantera plasma object, whose reaction-rate multipliers (if any) must be reflected in the yielded mechanism.

  • mechanism_path (str, pathlib.Path, or None) – Cantera mechanism (YAML) path to fall back to when plasma has no multiplier in effect. None if plasma has no such on-disk fallback (see above), forcing the temporary-mechanism-file path.

  • plasma_phase_name (str) – Cantera mechanism (YAML) phase name to fall back to when mechanism_path is not None and plasma has no multiplier in effect. Unused otherwise (the temporary-mechanism-file path uses plasma.name instead).

Yields:

tuple of str and str – (mechanism_path, phase_name) to load the native reactor from.

rizer.pipeline.run_nrp_simulation.build_isomass_2T_volume_reactor(plasma: cantera.Solution, momentum_transfer_collision_frequencies_list: list[rizer.transport.collision_frequency.MomentumTransferCollisionFrequencyModel], mechanism_path: str | pathlib.Path | None, plasma_phase_name: str, mass: float, initial_radius: float, gap: float, electric_circuit: rizer.electrical_model.circuit.base_circuit.PlasmaVoltageCircuit, polytropic_index: float | str, p_ext: float | str, solver_backend: str = 'cpp', cpp_mechanism: tuple[str, str] | None = None, compute_chemistry: bool = True) → rizer.models.nrp.isomass_2T_volume_reactor.Isomass2TVolumeReactor | rizer.models.nrp.isomass_2T_volume_reactor_cpp.Isomass2TVolumeReactor#

Build a constant-mass two-temperature plasma reactor, ready for a cantera.ReactorNet.

Thin factory choosing between the pure-Python reference reactor and the native C++-backed one, so callers (e.g. run_constant_mass_nrp_simulation()) do not need to branch on solver_backend themselves.

Parameters:
  • plasma (cantera.Solution) – Cantera plasma object, already set to the state the reactor should start from. Passed with clone=False by both reactor classes, so plasma’s state stays live and mutable for the caller throughout integration (the pure-Python reactor mutates it directly; the native reactor only reads it once, at construction, to seed its initial condition).

  • momentum_transfer_collision_frequencies_list (list of MomentumTransferCollisionFrequencyModel) – Per-species momentum-transfer collision-frequency models, as built by get_momentum_transfer_collision_frequencies_list().

  • mechanism_path (str, pathlib.Path, or None) – Cantera mechanism (YAML) path. Only used when solver_backend="cpp", and only as a fallback: if plasma has any reaction-rate multiplier in effect (set_multiplier(), e.g. from a sensitivity-analysis sweep), plasma’s current state is written to a temporary mechanism file and used instead – see the Notes section. Pass None if plasma was not loaded from a single on-disk mechanism file/phase in the first place (e.g. built by load_goutier2025_mechanism_with_options()); this then always takes the temporary-mechanism-file path.

  • plasma_phase_name (str) – Cantera mechanism (YAML) phase name. Only used when solver_backend="cpp".

  • mass (float) – Mass of the plasma, in kg. Assumed constant.

  • initial_radius (float) – Initial radius of the plasma, in m. Only used when solver_backend="python" – the native reactor derives its own initial volume from mass / plasma.density instead.

  • gap (float) – Gap between the two electrodes, in m.

  • electric_circuit (PlasmaVoltageCircuit) – Electric circuit object – any of TransmissionLineResistiveCircuit, TransmissionLineRCLoadCircuit, DirectResistiveCircuit, DirectRCLoadCircuit, GeneratorVoltageCircuit (see PlasmaVoltageCircuit).

  • polytropic_index (float or str) – Polytropic index of the plasma expansion. "gamma" is only supported when solver_backend="python".

  • p_ext (float or str) – External pressure, in Pa. If “atmospheric” or “atm”, the atmospheric pressure is used.

  • solver_backend ({"cpp", "python"}, optional) – Which reactor implementation to build. "cpp" (the default) evaluates chemistry / two-temperature energy / Joule / conductivity natively (~50-300x faster); "python" is the pure-Python reference. See rizer.models.nrp.isomass_2T_volume_reactor_cpp.

  • cpp_mechanism (tuple of str and str, or None, optional) – Pre-resolved (mechanism_path, phase_name) to load the native reactor from – see resolved_cpp_mechanism(). Only used when solver_backend="cpp". Default None, which resolves it fresh from plasma’s current multiplier state on every call (fine for a single build, but wasteful if called once per segment of the same run with an unchanging multiplier – see run_constant_mass_nrp_simulation(), which resolves it once and passes it here for every segment).

  • compute_chemistry (bool, optional) – Include finite-rate chemistry in the reactor’s RHS (the Python reactor’s compute_chemistry, the native one’s reacting). Default True.

Returns:

The reactor (Python- or C++-backed, per solver_backend), ready to be driven by cantera.ReactorNet.

Return type:

Isomass2TVolumeReactor or Isomass2TVolumeReactor

Raises:

ValueError – If solver_backend is not “python” or “cpp”. When solver_backend="cpp", also propagates Isomass2TVolumeReactor’s own validation of polytropic_index (rejects "gamma") and p_ext (must be "atmospheric"/"atm" or a strictly positive float).

Notes

Unlike the pure-Python reactor (built directly on the passed-in plasma object), the native Reactor0D reloads the mechanism itself from a YAML file path and is otherwise independent of plasma’s in-memory state. So a reaction-rate multiplier applied via plasma.set_multiplier(...) (e.g. by a sensitivity-analysis sweep) would silently have no effect on the C++ reactor if it were simply pointed at mechanism_path. See resolved_cpp_mechanism() for how this is worked around (and reused across calls via cpp_mechanism).

rizer.pipeline.run_nrp_simulation.configure_reactor_net(net: cantera.ReactorNet, solver_input: dict[str, Any]) → None#

Configure a cantera.ReactorNet’s CVODE tolerances/limits from the input YAML.

Parameters:
  • net (cantera.ReactorNet) – Reactor network to configure.

  • solver_input (dict of str to Any) – The simulation.solver section of the input YAML. Expected keys: “rtol”, “atol”, “max_step” (maps to net.max_time_step), “nsteps” (maps to net.max_steps), “max_order”. cantera.ReactorNet always integrates with CVODE/BDF, so the former scipy.integrate.ode keys “name”, “method”, “with_jacobian” and “first_step” have no equivalent here and are ignored if present.

rizer.pipeline.run_nrp_simulation.compute_reactor_diagnostics(plasma: cantera.Solution, collision_freq: rizer.transport.mixture_law.MixtureCollisionFrequencies, reactor: rizer.models.nrp.isomass_2T_volume_reactor.Isomass2TVolumeReactor | rizer.models.nrp.isomass_2T_volume_reactor_cpp.Isomass2TVolumeReactor, polytropic_index: float | str) → dict[str, float]#

Compute the per-output-step diagnostics recorded alongside the plasma state.

Must be called right after plasma.Te / plasma.TDY have been set to the state being recorded: every returned quantity is a pure function of that state (plus the electric field carried by reactor), so the result is identical whether reactor is the pure-Python reactor (Isomass2TVolumeReactor) or the native one (Isomass2TVolumeReactor).

plasma_voltage/plasma_resistance/plasma_radius/P_elastic/ P_inelastic/P_chemical/P_chemical_e/P_Joule are read directly off reactor (both backends define all of them identically). k, n_e, and the collision-frequency diagnostics (nu_eH, nu_ee, nu_eI, nu_eH_mass_weighted) are instead computed here directly from plasma/collision_freq, independent of which reactor backend advanced the state. Both reactors now expose nu_eH/nu_ee/ nu_eI natively (the C++ one as Reactor0D properties backed by ReactorRHS::Diagnostics), but neither stores nu_eH_mass_weighted as its own attribute, so there is still no single uniform 4-attribute set to read off both backends – this function keeps deriving all four uniformly from collision_freq rather than reading a mix of native and derived values per backend.

Parameters:
Returns:

Keys: “n_e”, “V_p”, “R_p”, “radius”, “k”, “P_elastic”, “P_inelastic”, “P_chemical”, “P_chemical_e”, “P_Joule”, “nu_eH”, “nu_ee”, “nu_eI”, “nu_eH_mass_weighted”.

Return type:

dict of str to float

rizer.pipeline.run_nrp_simulation.run_constant_mass_nrp_simulation(plasma: cantera.Solution, collision_freq: rizer.transport.mixture_law.MixtureCollisionFrequencies, momentum_transfer_collision_frequencies_list: list[rizer.transport.collision_frequency.MomentumTransferCollisionFrequencyModel], mechanism_path: str | pathlib.Path | None, plasma_phase_name: str, mass: float, initial_radius: float, gap: float, pulse_duration: float | None, electric_circuit: rizer.electrical_model.circuit.base_circuit.PlasmaVoltageCircuit, polytropic_index: float | str, p_ext: float | str, solver_input: dict[str, Any], simulation_time: float, output_interval: float, radius_changes: list[tuple[float, float]], solver_backend: str = 'cpp', print_every: int = 100, logger: logging.Logger | logging.LoggerAdapter | None = None, show_progress: bool = True) → cantera.SolutionArray#

Run a full 2T0D constant-mass NRP discharge simulation.

Integrates build_isomass_2T_volume_reactor()’s reactor, via cantera.ReactorNet, from t=0 to simulation_time, recording the plasma state and diagnostics (see compute_reactor_diagnostics()) every output_interval. The plasma radius (and, since the mass is constant, the density) can be reset at one or more times via radius_changes: each change ends the current integration segment and starts a new one from the same (continuous) Tg, Te and species mass fractions, but a new volume/mass consistent with the new radius (density is preserved across the change).

Parameters:
  • plasma (cantera.Solution) – Cantera plasma object, already set to the initial state (composition, Tg, Te) the simulation starts from.

  • collision_freq (MixtureCollisionFrequencies) – Collision-frequency wrapper around plasma (see build_collision_frequencies()).

  • momentum_transfer_collision_frequencies_list (list of MomentumTransferCollisionFrequencyModel) – Per-species momentum-transfer collision-frequency models, as built by get_momentum_transfer_collision_frequencies_list().

  • mechanism_path (str, pathlib.Path, or None) – Cantera mechanism (YAML) path, or None if plasma was not loaded from a single on-disk mechanism file/phase in the first place – see resolved_cpp_mechanism().

  • plasma_phase_name (str) – Cantera mechanism (YAML) phase name.

  • mass (float) – Initial mass of the plasma, in kg.

  • initial_radius (float) – Initial radius of the plasma, in m.

  • gap (float) – Gap between the two electrodes, in m. Assumed constant.

  • pulse_duration (float or None) – Reference pulse duration, in s – recorded as the tau column, used by the Maxwellian Eq VIII-3.10 post-process check (1 / (nu_ee * tau)). None records tau as NaN, so that diagnostic comes out NaN too instead of being computed.

  • electric_circuit (PlasmaVoltageCircuit) – Electric circuit object – any of TransmissionLineResistiveCircuit, TransmissionLineRCLoadCircuit, DirectResistiveCircuit, DirectRCLoadCircuit, GeneratorVoltageCircuit (see PlasmaVoltageCircuit). Mutated in place (its recorded plasma-voltage history is trimmed at each radius change).

  • polytropic_index (float or str) – Polytropic index of the plasma expansion (see Isomass2TVolumeReactor).

  • p_ext (float or str) – External pressure, in Pa. If “atmospheric” or “atm”, the atmospheric pressure is used.

  • solver_input (dict of str to Any) – The simulation.solver section of the input YAML; see configure_reactor_net().

  • simulation_time (float) – Total simulation time, in s.

  • output_interval (float) – Time step between two recorded states, in s.

  • radius_changes (list of tuple of float) – (time_of_change, new_radius) pairs, as returned by get_radius_change_events(). An empty list means the radius stays constant for the whole simulation.

  • solver_backend ({"cpp", "python"}, optional) – Which reactor implementation to use; see build_isomass_2T_volume_reactor(). Default “cpp”.

  • print_every (int, optional) – Log a progress line (at INFO level) every print_every recorded steps. Default 100.

  • logger (logging.Logger or logging.LoggerAdapter or None, optional) – Logger to use for this run’s progress/status messages. Default None, which uses this module’s own logger. Pass a per-case logger (see get_case_logger()) when running many cases in one process (e.g. a sensitivity-analysis sweep) so every line can be attributed to its case.

  • show_progress (bool, optional) – Show a live tqdm progress bar tracking simulated time, in addition to (not instead of) the print_every log line: the bar is for interactive feedback and isn’t persisted, while the log line is what ends up in a log file (see add_log_file_handler()). Default True. tqdm throttles itself sensibly when stdout isn’t a terminal (e.g. output redirected to a file), so this is normally safe to leave on even for batch runs.

Returns:

The recorded plasma states, with extra columns “t”, “T_e”, “n_e”, “V_p”, “R_p”, “V_g”, “radius”, “gap”, “tau”, “k”, “P_elastic”, “P_inelastic”, “P_chemical”, “P_chemical_e”, “P_Joule”, “nu_eH”, “nu_ee”, “nu_eI”, “nu_eH_mass_weighted”.

Return type:

cantera.SolutionArray