solprop.backends.host.runge_kutta#

The reference’s Runge-Kutta march, adaptive and replayed (SEP 45, SEP 52).

RungeKuttaMarch holds the march’s state (MarchState) and makes its decisions with solprop.backends.rk_core’s functions of one policy record; every state-sized operation is its engine’s (RungeKuttaEngine). It is the counterpart of native’s rk_march.cpp, whose decisions on identical inputs are its own (the decision traces of tests/backends).

The controller’s state is its own proposal, never the clipped or stretched step that was executed, and what the history and a rejection see is the norm the proposal would have scored while what decides acceptance is the error the executed step committed (docs/dev/stepper.md section 3).

Classes

RungeKuttaMarch(engine, policy, host, *, ...)

Step a state adaptively, or replay a schedule, with an embedded pair.

class solprop.backends.host.runge_kutta.RungeKuttaMarch(engine, policy, host, *, schedule, proposal, name='numpy_ref')[source]#

Bases: object

Step a state adaptively, or replay a schedule, with an embedded pair.

Parameters:
enginesolprop.backends.engines.RungeKuttaEngine

The engine.

policysolprop.backends.records.RungeKuttaPolicy

The controller and the landings.

hostsolprop.backends.host.marches.MarchHost

The session the march reports to.

schedulesolprop.stepper.schedule.FixedSchedule or None

The schedule to replay, or None to step adaptively.

proposalfloat

The first proposal, m.

namestr, optional

The backend’s name, for messages.

Attributes:
statesolprop.backends.host.marches.MarchState

The march’s position, proposal, cursor and accepted norms.

advance(target)[source]#

Replay the schedule, or step adaptively, towards target.

Parameters:
targetfloat

The position to reach, m.

property engine: object[source]#

Engine the march steps through.

property in_flight: tuple[float, float] | None[source]#

The step its engine left in flight, its start and length, m; or None.

load(z, proposal, cursor)[source]#

Start afresh at a loaded position.

Parameters:
zfloat

The position, m.

proposalfloat

The first proposal, m.

cursorint

The replay cursor at z.

march_to(target)[source]#

Step adaptively to target, landing on it exactly.

Parameters:
targetfloat

The position to reach, m.

Raises:
ConvergenceError

If the controller asks for a step below the policy’s floor.

replay_to(schedule, target)[source]#

Replay a fixed schedule to target.

A replay takes its steps as given and never rejects, but the embedded estimate costs nothing extra and is computed and recorded every step, so that a schedule too coarse for its tolerance is reported rather than silent (docs/dev/stepper.md section 8). The position is read off the schedule’s edges rather than accumulated, so every save plane is hit exactly.

Parameters:
schedulesolprop.stepper.schedule.FixedSchedule

The schedule.

targetfloat

The position to reach, m.

Raises:
ConvergenceError

If a replayed step’s error norm is not finite.

BackendError

If the schedule ends before target.