rizer.adaptive_models.transitions#

Conservation-checked transition operators between model fidelities.

Every model switch goes through an explicit TransitionOperator whose conserved quantities are asserted at the seam. Mass fractions are renormalized and element mass is conserved exactly (renormalization is a uniform scale). Each operator restricts a fine state onto a coarser one; the reverse lifting is ill-posed — a scalar cannot uniquely reconstruct a two-temperature split — except where the coarse state pins the fine one (OneToTwoTemperature at a field rebound).

Thermodynamic invariants are read directly from the plasma phase’s own mixture properties (enthalpy_mass, int_energy_mass): Cantera’s PlasmaPhase already evaluates the electron species’ contribution at Te and every heavy species at Tg internally, so no species-wise Python reimplementation is needed.

Attributes#

Classes#

TransitionOperator

A fine-to-coarse model hand-off with an asserted conservation contract.

TwoTemperatureToOneTemperature

Collapse (Tg, Te) onto the number-weighted mean temperature.

OneToTwoTemperature

Re-open the two-temperature description at a field rebound.

TwoTemperatureToThermochemicalEquilibrium

Equilibrate the 2-T state at constant \((\rho, u)\) (LTE seam).

IsochoricToIsentropic

Hand a 1-T isochoric state to the isentropic (analytic) stage.

IsentropicToIsobaric

Pin the state to the external pressure, conserving enthalpy.

IsobaricToThermochemicalEquilibrium

Equilibrate a 1-T isobaric state at constant \((h, P)\) (LTE seam).

Functions#

push_state(→ None)

Load a canonical state into the shared Cantera plasma object.

Module Contents#

rizer.adaptive_models.transitions.logger#
rizer.adaptive_models.transitions.push_state(state: rizer.adaptive_models.state.PlasmaState, plasma: cantera.Solution) → None#

Load a canonical state into the shared Cantera plasma object.

class rizer.adaptive_models.transitions.TransitionOperator(atol_rel: float = 0.001)#

Bases: abc.ABC

A fine-to-coarse model hand-off with an asserted conservation contract.

Parameters:

atol_rel (float) – Relative tolerance for the conserved-invariant assertion. The facade derives it from its single tol knob (a hand-off may perturb the invariant by up to the accuracy the user asked for, never more).

reviewed_by: str | None = None#
changes_composition: bool = False#
atol_rel#
apply(state: rizer.adaptive_models.state.PlasmaState, plasma: cantera.Solution) → rizer.adaptive_models.state.PlasmaState#

Restrict state, renormalize Y, and assert the contract.

Element mass is conserved exactly: composition may only be renormalized — or, for changes_composition operators, transformed at fixed elemental content (asserted).

class rizer.adaptive_models.transitions.TwoTemperatureToOneTemperature(atol_rel: float = 0.001)#

Bases: TransitionOperator

Collapse (Tg, Te) onto the number-weighted mean temperature.

\[T = \frac{n_h T_g + n_e T_e}{n_h + n_e}\]

Under the multi-temperature ideal-gas EOS \(P = \sum_k n_k k_B T_k\), this mean conserves the pressure exactly: Cantera’s PlasmaPhase.P is evaluated on mean_temperature (\(T_g + x_e (T_e - T_g)\)), algebraically identical to the T computed here, so the pre- and post-collapse pressures match to float precision, not merely to first order. The total internal energy is conserved to first order (exact for constant \(c_v\)) and asserted to atol_rel. Mass is untouched. .. warning:

**UNREVIEWED PHYSICS** (``rizer/adaptive_models/PHYSICS.md``,
section 5.1). The equations above and their implementation
have not been validated by a human: do not use results from this
operator for design decisions or publication. Open findings: PHY-02.

Reviewed-by: nobody yet -- set the class attribute ``reviewed_by``
(:mod:`rizer.adaptive_models.review`) to sign off.
class rizer.adaptive_models.transitions.OneToTwoTemperature(atol_rel: float = 0.001)#

Bases: TransitionOperator

Re-open the two-temperature description at a field rebound.

Coarse-to-fine in the fidelity ladder, yet well-posed — unlike lifting in general — because the rebound seed is known: a kernel that left the deposition tier is thermalized to \(O(\mathrm{tol})\) by construction, so the 2-T split at the instant a new field arrives is zero: Te := Tg (the electrons re-heat within the first integrator steps of the re-entered stage). Composition, density and volume are carried unchanged; the internal-energy shift is the electron thermal term at zero split, i.e. exactly zero. Idempotent on a 1-T state. .. warning:

**UNREVIEWED PHYSICS** (``rizer/adaptive_models/PHYSICS.md``,
section 5.2). The equations above and their implementation
have not been validated by a human: do not use results from this
operator for design decisions or publication.

Reviewed-by: nobody yet -- set the class attribute ``reviewed_by``
(:mod:`rizer.adaptive_models.review`) to sign off.
class rizer.adaptive_models.transitions.TwoTemperatureToThermochemicalEquilibrium(atol_rel: float = 0.001)#

Bases: TransitionOperator

Equilibrate the 2-T state at constant \((\rho, u)\) (LTE seam).

Collapses \(T_e \to T_g\) and re-equilibrates the composition — both thermal and chemical equilibrium are imposed by the same equilibrate call, hence “thermochemical.” The hand-off to the equilibrium (LTE) tier: the species-wise total internal energy of the 2-T state (heavies at Tg + electron \((3/2)k_B T_e n_e\)) is conserved by construction — Cantera’s UV equilibrate solves for the temperature and composition holding exactly that \((u, 1/\rho)\). Elements are conserved by the equilibrium solve (asserted through the elemental mass fractions).

Valid once the electron density exceeds the thermalization threshold (Minesi et al. 2020 “thermal spark”; Maillard et al. equilibration criterion) — the goal-oriented indicator that arms this seam.

Cantera 4.0 implements the thermodynamics on the PlasmaPhase directly, so the equilibrium solve runs on the plasma object itself (at Te = Tg); no separate ideal-gas mirror is needed. .. warning:

**UNREVIEWED PHYSICS** (``rizer/adaptive_models/PHYSICS.md``,
section 5.3). The equations above and their implementation
have not been validated by a human: do not use results from this
operator for design decisions or publication. Open findings: PHY-07.

Reviewed-by: nobody yet -- set the class attribute ``reviewed_by``
(:mod:`rizer.adaptive_models.review`) to sign off.
changes_composition = True#
class rizer.adaptive_models.transitions.IsochoricToIsentropic(atol_rel: float = 0.001)#

Bases: TransitionOperator

Hand a 1-T isochoric state to the isentropic (analytic) stage.

Carries (rho, e) verbatim — the operator only validates that the state is EOS-consistent (its P matches the plasma object at (T, rho, Y)), which is the pressure-continuity guard at the seam. The polytropic change (k = inf to k = gamma) is a process label on the receiving stage’s fidelity signature. .. warning:

**UNREVIEWED PHYSICS** (``rizer/adaptive_models/PHYSICS.md``,
section 5.4). The equations above and their implementation
have not been validated by a human: do not use results from this
operator for design decisions or publication.

Reviewed-by: nobody yet -- set the class attribute ``reviewed_by``
(:mod:`rizer.adaptive_models.review`) to sign off.
class rizer.adaptive_models.transitions.IsentropicToIsobaric(p_ext: float, atol_rel: float = 0.001)#

Bases: TransitionOperator

Pin the state to the external pressure, conserving enthalpy.

Fires when the expansion has relaxed to \(P \to P_{ext}\) within tolerance:

\[P_{eq} = P_{ext}, \qquad T_{eq} = T\]

For an ideal gas the specific enthalpy depends on \(T\) only, so pinning \(P = P_{ext}\) at fixed \(T\) conserves \(h\) exactly; density, volume and radius are recomputed from the EOS at constant mass.

Warning

UNREVIEWED PHYSICS (rizer/adaptive_models/PHYSICS.md, section 5.5). The equations above and their implementation have not been validated by a human: do not use results from this operator for design decisions or publication.

Reviewed-by: nobody yet – set the class attribute reviewed_by (rizer.adaptive_models.review) to sign off.

Parameters:

p_ext (float) – External pressure [Pa] the isobaric stage runs at.

Examples

rule = SwitchRule(
    outgoing="isentropic",
    incoming="isobaric_plasma_0d1t",
    indicator=lambda s, t: stage_exp.pressure_error(),
    threshold=tol,
    operators=(IsentropicToIsobaric(p_ext=101325.0, atol_rel=tol),),
)
p_ext#
class rizer.adaptive_models.transitions.IsobaricToThermochemicalEquilibrium(atol_rel: float = 0.001)#

Bases: TransitionOperator

Equilibrate a 1-T isobaric state at constant \((h, P)\) (LTE seam).

The isobaric twin of TwoTemperatureToThermochemicalEquilibrium: the incoming stage is already single-temperature, so there is no \(T_e \to T_g\) collapse left to do – only the composition is re-equilibrated, at fixed specific enthalpy and pressure:

\[h(T_{eq}, P, Y_{eq}) = h(T_g, P, Y), \qquad P_{eq} = P\]

solved by Cantera’s HP equilibrate. Density, volume and radius are recomputed from the equilibrated EOS at constant mass (the same pattern as IsentropicToIsobaric).

Used as a SwitchRule operator at the seam from an isobaric finite-rate stage (e.g. IsobaricPlasma0D1T) to an isobaric LTE one (e.g. IsobaricLTE), armed once the composition has stopped changing (a decreasing damkohler() indicator):

rule = SwitchRule(
    outgoing="isobaric_plasma_0d1t",
    incoming="isobaric_lte",
    indicator=lambda s, t: damkohler(s, plasma, tau=1e-6),
    threshold=0.05,
    operators=(IsobaricToThermochemicalEquilibrium(atol_rel=tol),),
)

Warning

UNREVIEWED PHYSICS (rizer/adaptive_models/PHYSICS.md, section 5.6). The equations above and their implementation have not been validated by a human: do not use results from this operator for design decisions or publication.

Reviewed-by: nobody yet – set the class attribute reviewed_by (rizer.adaptive_models.review) to sign off.

changes_composition = True#