rizer.adaptive_models.composite#
Generic adaptive composite reactor: the time-integration loop.
AdaptiveCompositeReactor is the reusable core of every adaptive
reactor in rizer: a plain time-marching loop (solve())
that advances the currently active stage and delegates every switching
decision — which model applies now, blend weight, hand-off bookkeeping —
to ModelSelector. The loop itself
never inspects why a switch happened; it only reacts to the
HandoffStep the selector returns.
Which model is active at any instant is decided by live physical
conditions (SwitchRule), not by a
position in a fixed sequence — see allowed_models for restricting the
graph to a subset of models for a given run (testing, model comparisons).
Concrete reactors subclass this base —
PulsedPlasmaReactor (one
pulse: isochoric deposition → isentropic expansion → isobaric cooling), and
whatever comes next. A subclass supplies the stages, the switch rules, the
initial state and (optionally) a macro-grid policy; everything else —
blending, conservation-checked seams, result assembly — is inherited.
Attributes#
Classes#
Unified trajectory of an adaptive composite solve. |
|
Base class of every adaptive (self-switching) composite reactor. |
Module Contents#
- rizer.adaptive_models.composite.logger#
- class rizer.adaptive_models.composite.AdaptiveResult#
Bases:
rizer.models.nrp.engineering_model.base.TimeSeriesStateUnified trajectory of an adaptive composite solve.
Extends
TimeSeriesState(t,T,P,plot) with the plasma fields and the model provenance.Tis the unified temperature (Tg; equal to the single temperature after any 2-T stage).- Tg: numpy.ndarray#
- Te: numpy.ndarray#
- deposited_energy: numpy.ndarray#
- class rizer.adaptive_models.composite.AdaptiveCompositeReactor(plasma: cantera.Solution, collision_freq: rizer.transport.mixture_law.MixtureCollisionFrequencies, stages: list[rizer.adaptive_models.models_list.BasePhysicalModel], rules: list[rizer.adaptive_models.selector.SwitchRule], qoi: rizer.adaptive_models.contract.QoISet = ('T', 'P', 'deposited_energy'), tol: float = 0.01, allowed_models: set[str] | None = None)#
Base class of every adaptive (self-switching) composite reactor.
Subclasses build the ladder and call this constructor; users interact with the concrete reactor’s
from_configandsolve()only.- Parameters:
plasma (
cantera.Solution) – The shared Cantera plasma Solution every stage reads and writes.collision_freq (
MixtureCollisionFrequencies) – Collision-frequency wrapper aroundplasma(the modeling-error estimator’s elastic-exchange and conductivity closures).stages (
listofBasePhysicalModel) – The ladder’s stage solvers.stages[0]seeds the trajectory; which model is active thereafter is decided by live conditions, not position (seeSwitchRule/ModelSelector).rules (
listofSwitchRule) – All ladder edges (unordered; several may share the sameoutgoing— whichever fires wins).qoi (
tupleofstr) – Quantities of interest driving the goal-oriented switching.tol (
float) – The single accuracy knob [-].allowed_models (
setofstr, optional) – Restrict the graph to just these stage names (and the edges between them) for this run — for testing a single model in isolation, or comparing runs across model combinations.None(default): every stage/edge the subclass registered is available. The seed stage (stages[0]) must itself be inallowed_modelswhen given. A stage left with no outgoing edges after filtering is a valid configuration (it simply never switches away), not an error.
- plasma#
- qoi = ('T', 'P', 'deposited_energy')#
- tol#
- final_state() rizer.adaptive_models.state.PlasmaState#
Canonical state of whichever stage is active when
solvereturns.
- solve(t_end: float) AdaptiveResult#
March the ladder to
t_endand return the unified trajectory.The mutation decision (which edge, blend weight, hand-off/rebound bookkeeping) is entirely internal to
advance()— this loop only advances the active stage and reacts to theHandoffStepit returns.