Skip to content

Numerics — implicit Newton, preconditioners, and the block-tridiag shape

This document records why each Newton-solve path in the implicit network solver is the shape it is. The point isn't to re-derive the math (the references at the end do that better); it's to capture which design decisions came from theory and which came from benchmarking, so the next person reading _newton_step understands why each piece is shaped the way it is.

For the practical what to set — knob defaults, TOML examples, cost-shape table, decision flowchart — see implicit-solver-reference.md. For the audit-driven evidence trail behind the bench numbers, see perf-history.md.

Choosing a time integrator (the [case] rk knob)

aeolus1d ships seven time integrators behind the single rk knob — four explicit Runge-Kutta schemes and three implicit ones. They trade three things against each other: temporal accuracy (formal order), stability (does it unlock CFL > 1, and is it L-stable for stiff terms), and numerical damping (how much spurious high-frequency content it dissipates). GT-POWER frames the same trade in Mechanical §1.7.8–9: a controllable-dissipation spectrum from "fully damped" (implicit-Euler-like) to "sharp" (higher-order, near-energy-conserving). aeolus1d's discrete dial:

rk Order Class CFL Numerical damping Pick it for
ssp_rk2 2 Explicit, TVD ≤ 1 only the limiter's Default. Shocked / discontinuous flow, general use — TVD-safe
ssp_rk3 3 Explicit, TVD ≤ 1 only the limiter's Smooth flow wanting lower temporal error while staying TVD
rk4 4 Explicit, not TVD ≤ 1 none (anti-dissipative near shocks) Smooth benchmarks where the temporal-error floor dominates
rk5 5 Explicit, not TVD ≤ 1 none Smooth, temporal-error-limited benchmarks only
implicit_euler 1 Implicit, L-stable > 1 maximal — damps HF content Robust startup, very stiff, low-Mach where you want acoustics damped
bdf2 2 Implicit, A-stable > 1 light General implicit default; ~RK2 accuracy at CFL > 1
radau_iia 5, also through plenums and corberan / passthrough joints (since 2026-10-20); 1 on a network with a cylinder, turbo or EHR junction, see below Implicit, L-stable + stiffly accurate > 1 minimal (sharp) Stiff chemistry-coupled single-pipe runs; a true error controller

How to read it:

  • Shocks → stay explicit and TVD. rk4/rk5 are not TVD; they will oscillate at discontinuities (a Sod tube run with rk4 rings). Use them only on provably smooth flow where the temporal-error floor — not the spatial limiter — is the bottleneck. For everything with a shock, contact, or sharp gradient, ssp_rk2 (default) or ssp_rk3 is the right call.
  • CFL > 1 → go implicit. All three implicit schemes unlock CFL > 1; the explicit ones are bounded by |u| + a (run aeolus1d analyze-cfl case.toml to see the bound and which pipe pins it). Pick the implicit scheme by the damping you want.
  • The damping dial. implicit_euler is the fully-damped end — first-order and L-stable, it scrubs the spurious high-frequency content that a low-Mach or stiff run otherwise rings with, at the cost of accuracy. radau_iia is the sharp end — fifth-order, L-stable and stiffly accurate, it keeps resolved content crisp while still handling stiffness. bdf2 sits in between: second-order and A-stable (lightly damped), the pragmatic implicit default.
  • Stiff source terms (chemistry, Forchheimer) → L-stable. Prefer implicit_euler or radau_iia over bdf2 when the stiffness is in the source terms — A-stability alone (bdf2) can let stiff modes ring; L-stability damps them dead.
  • Adaptive error control ([case] adaptive_error_control) uses step-doubling on one-step implicit stencils — it pairs with implicit_euler and radau_iia but raises on the multi-step bdf2 (which carries history and can't be Richardson-doubled cleanly). If you want a true accuracy controller, pick radau_iia.

Implicit schemes on a junction network

Lifted for plenum networks on 2026-10-20

A plain plenum (no neck, no Python port BC) now takes its own Radau stage states, V_i = V^n + dt Σ_k A_ik G_k, and writes each stage its own ghosts, and its rate at each stage is the pipes' own stage flux (_ImplicitRun._radau_stage_ghosts, inside the Picard loop). A stateless corberan or passthrough joint takes its stage ghosts from the pipes' stage states. On the two-pipe-plenum harness below, at picard_tol = 1e-13, radau_iia measures local orders 4.92 / 4.97 / 4.99 over 4, 8, 16, 32 steps (4.79 / 4.80 / 4.06 through a corberan joint); at the default picard_tol the Picard tolerance floors the fine-step error (2.0 on the (8, 16, 32) window). Against a cfl = 0.0625 reference it beats bdf2 by 17x or more at cfl 1 and 2, and its closed-box energy drift fell from 9.0e-6 to 5.2e-9. The cost: the Picard loop iterates until the stage ghosts settle, where a plenum-only network used to stop after one pass. Cylinders, turbos, EHR and biased-plenum junctions, and plenums with a neck or a Python port BC, still hold it at order 1, and validate_case warns only for those. The text below describes the cap as it was, and still is for those components.

The Order column above is the scheme's order on a single pipe. On a case with a junction the stages resolve, radau_iia keeps it (above); with any other component, every implicit scheme is first-order.

The network coupling is a block-split: each junction's volume is held frozen through the pipe Newton solves and then advanced by forward Euler, and junction ends are Dirichlet. So all three Radau stages see one ghost built from V(t_n), and the split — not the scheme — sets the observed order.

Measured on the two-pipe-plenum network at picard_max_iter = 12:

rk formal order observed on a network interior delta at cfl = 1
implicit_euler 1 1.00 6.50e1
bdf2 2 1.87–1.94 (not capped) 1.51e1
radau_iia 5 0.94–1.00 6.28e1

bdf2's row was 0.98–1.10 until 2026-08-25, and it did not reproduce

That range was prose whose harness was never written down. Promoted to an executable refinement sweep (tests/integration/test_implicit_network_split_order.py — closed two-pipe-plenum, wall far-BCs, N = 20, t_end = 2e-4, same Picard setting), bdf2 rises toward its formal order as the window tightens while radau_iia stays pinned at 1 on the same windows:

refinement window bdf2 radau_iia
(2, 4, 8) 1.671 —
(4, 8, 16) 1.867 0.975
(8, 16, 32) 1.941 1.001
(4, 8, 16, 32) 1.905 —

Rising under refinement is what a second-order method does; a capped scheme cannot, and radau demonstrably does not. The radau_iia claim — the one this section is about — is unaffected.

The same schemes reach their formal order on a single pipe — radau_iia measures 4.86–4.99, including through advance_network_implicit with junctions=[] — and the tableau itself is verified against Hairer & Wanner II.7 (B(5), C(3), D(2) to ~1e-17, R(∞) = 1.1e-16). Switching the volume update to implicit Euler changes nothing; the deltas are bit-identical.

Practical consequence. On a network, radau_iia delivers implicit-Euler accuracy at roughly 3× the per-step cost. Prefer bdf2 there — it is not capped (observed order ~1.9 against a formal 2) and carries a ~4× smaller error constant at 1× the cost. The advice is unchanged from before 2026-08-25; the reason for it is. It used to read "same order 1, but a ~4× smaller error constant", which was right advice for the wrong reason. validate_case emits this as a warning when it sees radau_iia on a case with a component the stages do not resolve (since 2026-10-20; it fired on any junction before).

Radau conserves on a network since 2026-10-08; the order is unchanged

Until then a Radau pipe lost dt·Σ bᵢ·Fᵢ through a junction face (the three stage fluxes) while the junction gained dt·F₃ (the end state), so a closed network created mass and energy at O(dt): 2.6e-5 and 5.1e-5 of the total on the two-pipe-plenum box, 1.1e-4 with a DPF wall exchange in the Newton residual. The junction now evaluates its component at each stored stage state, weighted by the Radau bᵢ, so the same quadrature is applied on both sides of the face: 2.6e-8 and 3.7e-8, the implicit-Euler floor. What is left is the Picard ghost lag. The observed order on a network is still 1, because the junction volume is still held frozen through the stage solve, so the advice above is unchanged.

Lifting the cap needs stage-resolved junction state — fill port ghosts from V_i per stage and close V_i = V^n + dt · Σ_j A_ij G(Y_j, V_j), either as an arrowhead border on the block-tridiagonal solve or by iterating the stage-resolved volume in the existing Picard loop. Tracked in BACKLOG.md.

Practical knob defaults and TOML examples live in implicit-solver-reference.md; this table is the which integrator layer above those.

Verifying the order of accuracy

The Order column above is not a claim on faith — each entry is pinned by a convergence test, and the three discretisation paths (flux, time integrator, source term) are verified separately:

Path What is measured Test
Spatial (flux) mesh refinement at fixed CFL on a smooth density wave → observed spatial order (MUSCL+van Leer ≥ 1.8) tests/integration/test_smooth_advection.py, test_mp5.py
Temporal (each rk) Δt refinement on a fixed mesh (self-convergence) → observed temporal order, one row per integrator tests/integration/test_temporal_order.py
Source term manufactured-solution truncation error → formal order of a source closure's discretisation tests/integration/test_mms_source.py, test_mms_closures.py (area, friction, wall heat)

Three things worth knowing when reading those orders:

  • Spatial order is a lower bound away from smooth extrema. A TVD limiter must clip the reconstruction at a smooth extremum, so the local order drops toward 1 there even for a formally 2nd-order scheme — minmod clips hardest, van_leer least (hence the ≥ 1.8 gate uses van Leer), and MP5 relaxes monotonicity near extrema. The quoted orders are the formal orders on smooth regions, not a per-point guarantee in a limited run.
  • "Radau IIA(3)" is stage-count notation — 3 stages, formal order 2s − 1 = 5, not order 3. The temporal test confirms the 5.
  • The temporal test isolates the time error by comparing each Δt to a fine-Δt reference on the same mesh, so the (identical) spatial truncation cancels. The implicit drivers need a tight Newton tolerance there: the default simplified-Newton — a chord-aged Jacobian (chord_max_age = 2) held across inner iterations, terminated at a finite residual tolerance — leaves a ~1e-6 fixed-point bias that is fine for engineering runs but swamps Radau's minute order-5 time error, a property worth remembering when chasing high temporal accuracy implicitly. (The HLLC flux Jacobian itself is analytic on both the uniform-γ and the per-cell-γ ideal-gas paths — Phase B13's _hllc_flux_jac_analytic_impl and the Phase B15 ..._var_gamma_impl variants — and only falls back to a finite-difference Jacobian on the real-gas / EOS-consistent frozen-MUSCL assembler, so the residual bias is a property of the chord/simplified iteration, not of the Jacobian entries.)

The implicit Newton system

Each implicit time step solves

F(U) = U − U_hist − Δt · R(U) = 0

for the new state U (U_hist is the BDF2 / Implicit-Euler history term and R(U) = -∇·F_flux + S_closure is the spatial residual). Newton's method linearises around the current iterate

J · δ = −F,    J = ∂F/∂U = I − Δt · ∂R/∂U

and updates U ← U + α·δ with a backtracking line search. For the canonical first-order scheme the spatial residual depends on each cell i only through cells i−1, i, i+1 (one HLLC face on each side), so

∂R/∂U[i, j] = 0        for |i − j| > 1

and J is block-tridiagonal with 3×3 blocks. Three arrays of shape (N, 3, 3) carry it through the code:

  • L[i] — the lower block (∂R[i] / ∂U[i−1])
  • D[i] — the diagonal block (∂R[i] / ∂U[i])
  • Up[i] — the upper block (∂R[i] / ∂U[i+1])

After the chord-aged broadcast (Phase Perf-2-quick) the implicit Jacobian becomes L_J = -dt·L, D_J = I - dt·D, Up_J = -dt·Up. The direct path then solves J · δ = -F via block-Thomas (_block_thomas_solve_3x3_jit).

Why the direct block-tridiag solve is the right shape

The direct path solves J · δ = -F with a block-Thomas sweep that exploits the block-tridiagonal structure exactly — no fill-in, O(N) work, and it captures the off-diagonal acoustic + convective coupling (the L / Up blocks) that dominates J at cfl > 1. For the ≤ a few-thousand-cells × 3-unknowns systems aeolus1d solves, that is the correct cost shape and there is nothing cheaper.

A matrix-free Newton-Krylov (JFNK / GMRES with FD J·v) path was prototyped and benchmarked against the direct solve, with both block-Jacobi and ILU(0) preconditioners. It lost at every N tested (~1.8–1.9× slower with ILU(0)/pure; block-Jacobi was catastrophically worse — hundreds of × — because dropping the off-diagonal coupling makes the preconditioned operator less diagonally dominant at large Δt, not more). The lesson that generalises: for a hyperbolic problem at Δt-CFL > 1, a preconditioner that ignores the convective + acoustic off-diagonal coupling is at best useless and often actively harmful, so the only competitive matrix-free preconditioner (ILU(0)) collapses back to the very block-Thomas factorisation the direct path already does. The JFNK path was therefore removed in v0.9 (see the changelog); the direct + chord solve below is the single implicit Newton path.

The chord-Jacobian heuristic (Phase Perf-3)

The full Newton method rebuilds J every iteration. For most steady-state-ish steps the convergence rate after the first Newton iter is already linear with a good constant — the expensive Jacobian assembly is rebuilding almost the same matrix. The chord (lazy-Jacobian) variant holds J fixed across multiple inner iterations and accepts linear-with-good- constant convergence in exchange for fewer assembly calls.

Two NewtonConfig knobs control the trade-off:

  • chord_max_age (default 2) — hard cap on iterations between rebuilds. 0 reproduces the legacy full-Newton path bit-exactly.
  • chord_rate_threshold (default 0.5) — if F_norm_new / F_norm_old > threshold the chord has stopped matching the local Newton direction; force a rebuild on the next iteration. Line-search rejection on a chord-aged iteration also forces a rebuild.

The cache holds the post-broadcast (L_J, D_J, Up_J) triple, so chord-reused iterations skip both the Jacobian assembly and the closure-Jac augmentation (which Phase Perf-2 made into a JIT'd kernel but still has non-zero cost). In the canonical case 54, the chord saves ~50 % of Jacobian-assembly calls without changing the converged solution.

When each Newton-solve path wins

There is a single implicit Newton-solve path — direct + chord. It was confirmed as the right shape empirically over many bench iterations; the matrix-free Newton-Krylov variants that were prototyped alongside it lost at every N tested and were removed in v0.9 (see the changelog). The cost-shape table is in implicit-solver-reference.md.

What's not yet measured

  • Very large N (≫ 1000 cells per pipe). The direct path's block-Thomas solve scales O(N), which is the right shape at the problem sizes aeolus1d targets; no real workload has pushed N far enough to make the per-step Jacobian assembly the bottleneck.
  • Stiff non-hyperbolic regimes. When friction or porous-Forchheimer source terms dominate, the diagonal block D becomes more diagonally-dominant relative to the off-diagonals — a regime where the implicit step is easiest, not hardest.

A 2-D / 3-D extension would reopen the preconditioner question: line preconditioning (block-Thomas along each characteristic direction) no longer collapses to a 1-D sweep, so a proper line-Jacobi or red-black-line solver would become the right shape. The current 1-D codebase doesn't need that; the block-Thomas design is forward-compatible.

Quasi-steady DAE robustness — the limit-point / concentration-jump problem

The low-Mach aftertreatment solver (solver = "quasi_steady") drops the gas-phase accumulation terms, turning the channel PDEs into a system of differential-algebraic equations (DAEs) in which the surface coverages and solid temperature are the only states carrying explicit time derivatives. Millo et al. [Ch. 11 §11.2.6, ref. [41] in theory.md] document a generic failure mode of this formulation that aeolus1d's quasi-steady kernel has had to engineer around: at a limit point — where the steady surface-balance Jacobian becomes singular — the surface concentration jumps discontinuously (their Fig. 11.8 shows CO surface concentration stepping from 0.25 % to 0.04 % across one channel location). A naive DAE/Picard solve drives its step size toward zero as it approaches such a jump and often fails the error test there. The literature remedy is to monitor the Jacobian and apply special logic at the limit point rather than let the adaptive controller collapse. aeolus1d's SIMPLE/Picard robustness guards (the zero-response dead-zone bracket+bisect bootstrap, the strong-exotherm guard, and the junction-Picard zero-gradient bootstrap) are concrete instances of exactly this class of mitigation. A related guard hardens the species march: near such a jump the Arrhenius source can transiently overflow, and the convex-combination update is bounded only while its source is finite, so the quasi-steady kernel rejects a non-finite primitive/extra source (substitutes zero) and the implicit species floor rejects +inf rather than letting the positivity clip pass it through — see BACKLOG.md and the related memory notes.

Multi-rate circuits

Added 2026-10-20. GT-SUITE lets each flow circuit take its own solver and time step (GT Flow §1.3.1): acoustics where they matter, a quasi-steady solve elsewhere. A case does the same with two [[circuit]] blocks, one explicit and one quasi_steady, every pipe in exactly one:

[[circuit]]
id = "engine"
solver = "explicit"
pipes = ["runner"]
cfl = 0.5            # optional; 0 takes [case] cfl

[[circuit]]
id = "aftertreatment"
solver = "quasi_steady"
pipes = ["brick", "tail"]
dt_max = 1.0e-3      # the macro step and exchange interval; 0 takes [case] qs_dt_max

The explicit circuit runs advance_network at its own CFL step with the case's rk (ssp_rk2 or ssp_rk3). The quasi-steady circuit runs the quasi-steady driver's macro step with every qs_* knob of [case]. [case] solver stays explicit; the circuits name their drivers. The flow chart is Multi-rate circuits, the code solver/multirate.py.

The interface is a plain plenum. A kind = "plenum" junction with ports on both circuits is the coupling element. Its volume is a state of the explicit circuit, advanced at the explicit step through its explicit ports. The quasi-steady pipe ends that meet it see it as a far boundary: its pressure is their end pressure, its reservoir state their ghost, its composition their feed. A Corberán or pass-through joint has no volume to hold the two sides apart, so it cannot be an interface; nor can a quasi-steady port with a neck, a LODI or a Python port BC.

The exchange happens once per quasi-steady macro step, linearised in the plenum pressure (since 2026-11-17; until then the flow of the first step was held constant over the span, which set the 2τ limit below). From t:

  1. The quasi-steady circuit sizes its step Δt and solves its flow with each plenum at its pressure p0.
  2. It is solved again with one plenum at a time 0.1 % higher, which gives each quasi-steady end's ∂ṁ/∂p against each plenum.
  3. The explicit circuit sub-steps from t to t + Δt. At every stage the plenum's source is the ends' flow at p0 plus those slopes times p − p0, at the plenum pressures of that stage. A delivering end brings its own gas, the quasi-steady outlet cell's enthalpy and composition. A drawing end takes the plenum's own enthalpy and composition of the moment, as a port's outflow does.
  4. The quasi-steady circuit is solved once more with each plenum at its time-mean pressure over the span. Linear in p, the source delivered exactly that flow, so the circuit marches its slow states on the flow the plenum actually gave up. Its ends' through-flow over the step is recorded: where it draws, its march's own inlet face flux, ṁ times the ghost's total enthalpy and the feed composition; where it delivers, its outlet cell at the end of the step, which is what a quasi-steady junction passes downstream.
  5. What the record and the plenum still differ by, the slope's curvature error and what the march changed in the gas the ends carry, is added to the next step's source and arrives over that step.

Every pipe of the quasi-steady circuit has its gas energy marched, with or without a source of its own (since 2026-11-21). The plain quasi-steady driver leaves a pipe with no species, catalyst, filter or heat closure at its initial temperature (it warns for one fed by a transient inlet); in a circuit that pipe is fed by the explicit circuit's plenum, and held [pipe.init] T under a 900 K feed: its pressure drop came out 32 % low, and between two plenums 20 % of the energy it took from one never reached the other (test_a_bare_quasi_steady_brick_carries_its_feeds_temperature, test_a_quasi_steady_brick_between_two_plenums_passes_on_what_it_took).

Steps 1 and 2 cost two solves, so most steps skip them. A light step sizes itself on the last solved flow, takes the slope from the last probe, and predicts the flow at p0 as the last mean-pressure solve's flow plus the slope times the plenum's move since. Step 4's solve then checks that prediction: if it missed by more than 1 % of the flow, the next step is a full one again (the first step always is). A missed prediction costs accuracy, not conservation, since step 5 carries what it missed.

It is conservative. At the end of the run the last step's remainder is given to the plenum at once, and the plenum has then received exactly what the quasi-steady side recorded. The quasi-steady circuit stores no gas, that is what quasi-steady means, so the balance is the explicit circuit's, plenum included, against the record. Measured (test_the_interface_conserves_mass_energy_and_species): a closed explicit circuit at 1.3 bar drains through the brick below for 0.02 s, 80 macro steps. 17 % of its mass and 23 % of its energy cross the interface. Received and recorded agree, and the circuit's mass, energy, O2 and NO change by what it received, both to the test's 1e-12 relative bound (re-run 2026-11-17; the 2026-10-20 run of the held exchange measured 3.3e-15 and 3.9e-15).

It is first order in the macro step. Measured (test_the_coupling_converges_at_first_order_in_the_macro_step). The harness:

  • an explicit runner, 0.3 m at 1 cm cells, into a 2 L plenum at 600 K;
  • a 0 to 0.02 kg/s inlet ramp over 10 ms;
  • a quasi-steady Darcy brick, 0.1 m, beta = 1e8, out to 1 bar.

The plenum pressure moves 0.72, 0.34 and 0.16 Pa as Δt halves from 8e-4 to 1e-4 s, orders 1.09 and 1.06. At 5e-5 and 2.5e-5 s it moves 0.08 and 0.04 Pa, close to the junction solve's tolerance. The held exchange moved it 42.3, 21.0, 10.4 and 5.2 Pa from 4e-4 s down, so at the same step the linearised coupling error is about 120 times smaller.

It does not converge to the all-explicit result, and cannot. The limit is the explicit plus quasi-steady model. On the same case it sits 204.4-204.8 Pa from the all-explicit run against a 5.03 kPa brick drop, about 4 %, at every step from 8e-4 to 1e-4 s (2026-11-17; with the held exchange, 181 Pa at 4e-4 s, where its coupling error partly cancelled the model's, and 203 Pa at 2.5e-5 s). It is the quasi-steady brick's own model error: it stores no gas, and it takes the plenum pressure as its inlet static pressure, where the explicit port expands the gas from the plenum's stagnation state. A quasi-steady circuit is the right model where those are small, which is the low-Mach, slowly-varying part of a network.

The macro step is no longer limited by the plenum's relaxation time. The plenum pressure relaxes through the quasi-steady circuit's flow resistance on τ = V / (γ R T s), with s = ∂ṁ/∂p of the quasi-steady side at the plenum. A flow held over Δt was forward Euler on that relaxation, stable only for Δt < 2τ. With the slope in the source, the explicit sub-steps integrate the relaxation themselves, so the bound is on their step, dt_explicit < 2τ. Their step is the acoustic CFL step of the explicit circuit, usually far shorter.

Measured (test_the_coupling_is_stable_past_twice_the_plenum_relaxation_time, the case above, τ = 2.14e-3 s, 0.3 s; the plenum's peak-to-peak swing over the last quarter, then its final pressure):

macro step swing final pressure
0.5 τ 1.66 Pa 104 957.7 Pa
1.5, 2.5 and 5 τ 1.63, 1.65 and 1.84 Pa within 0.1 Pa of it
10 τ 3.6 Pa 104 959.2 Pa
20 τ 13 Pa 104 969 Pa

Over 1 s, 40 τ and 100 τ both settle at 104 958 Pa. (Re-measured with light steps on: every number in the table moved by less than 0.1 Pa.) The held exchange, over 0.06 s, swung 8.6, 7.9 and 7.3 Pa at 0.5, 1.0 and 1.5 τ, 57 Pa at 1.9 τ, 633 Pa at 2.1 τ and 11.4 kPa at 2.5 τ.

Two intermediate forms failed this test first, and why matters for anyone changing the scheme:

  • The step's remainder booked to the plenum at once is an impulse of Δt/τ times the slope's curvature error. It held a 20 τ run 490 Pa low, and a 40 τ run diverged. Carried into the next step's source, it does neither.
  • The drawn flow at the plenum's enthalpy from the start of the step is forward Euler on the plenum's thermal relaxation. With the remainder carried, the plenum swung ±10 K and ±300 Pa, growing, at 20 τ. At the plenum's own enthalpy of the moment it settles.

What it costs. A full step does one more quasi-steady flow solve per plenum than the held exchange did, and one at the mean pressure. A light step does one, as the held exchange did. Every full step on the bench below took 70.4 s at 1 ms, against 29.2 s held. Light steps also change how the circuit is sized: a light step sizes itself on the last solved flow, so the shrink a full step makes onto its own end flow comes a step later. The end flow's CFL is not a trigger for a full step: on the bench at 2 ms it made 38 of 111 steps full, for 34.4 s against 25.5 s without it.

When a probe cannot be solved on either side of p0 (a flow it would reverse), that plenum's flow is held over the step with a warning, and the old 2τ bound applies to it.

Where it pays. What the circuits buy is the explicit step of the circuit that needs it, rather than of the network's finest cell; taking coarse cells out of the explicit circuit buys little, because each quasi-steady macro step costs a junction solve. Harness scripts/bench_multirate.py: a pulsating 50 Hz, 0.02 kg/s inlet into a 0.3 m runner at 1 cm cells, a 2 L collector, then a porous brick, a 0.5 L cone and a 1.2 m tailpipe to ambient as the quasi-steady circuit, dt_max = 1 ms, qs_cfl_adv = 20, 0.2 s:

train cells all explicit two circuits speed-up
1 cm (as the runner) 21.5, 21.9 s 20.3, 21.7 s 1.0x
2.5 mm 105.8, 96.3 s 35.5, 35.4 s 2.7-3.0x

Two reps of each, after one untimed warm-up of each mode; Python 3.10.21, numba 0.67.0, on the 16-core host the CI runner shares, loadavg 26 falling to 17 over the 2.5 mm runs and 26 to 27 over the 1 cm ones. With the train as coarse as the runner, the network steps at the runner's step either way and nothing is gained. With a 2.5 mm train, the all-explicit run steps at the train's acoustic step, four times smaller. The two results differ by what the model does: the time-mean collector pressure over the last 40 ms is 103 353 Pa all-explicit and 102 972 Pa as two circuits, the tailpipe flow 0.02002 and 0.01987 kg/s; cutting dt_max from 2 ms to 0.25 ms moves the circuits' mean by 16 Pa, so the 381 Pa is the quasi-steady model's, not the coupling's.

Re-measured 2026-11-17 with the linearised exchange, the 2.5 mm train, on the same host quiet (loadavg 2-4, no CI running), against the held exchange run from the same tree with only solver/multirate.py swapped back:

dt_max all explicit held linearised, light steps linearised, every step full
1 ms 69.5, 70.1 s 29.2 s 29.9, 30.3 s (2.3x) 70.4 s
2 ms 70.8 s 22.3 s 24.9 s (2.8x) 43.8 s
5 ms 71.8 s 23.1 s (3.1x) 39.3 s

One rep per cell (two at 1 ms), after a warm-up of each mode. The light steps cost 2-12 % over the held exchange. The collector's time-mean pressure is 102 964, 102 978 and 103 086 Pa at 1, 2 and 5 ms (held: 102 972 and 103 009 Pa at 1 and 2 ms). At 5 ms the circuit takes 93 macro steps in 0.2 s, not 40: its own advective and heat-release limits cap the step there, so on this case most of what a longer dt_max buys is spent before the exchange is the limit.

Two explicit circuits

Added 2026-11-19. Two explicit circuits, each at its own CFL step: a fine mesh where it is needed, and the rest of the network at its own, longer step.

[[circuit]]
id = "fine"
solver = "explicit"
pipes = ["runner"]

[[circuit]]
id = "coarse"
solver = "explicit"
pipes = ["tail"]
cfl = 0.6            # optional; 0 takes [case] cfl

They meet at plain plenums, as above. The circuit with the smaller step owns every coupling plenum, and resolves it at that step: the smallest cfl dx / c over its pipes, with the circuit's own cfl and each pipe's sound speed at its initial state (since 2026-11-21; the smallest dx alone until then, which gave a cold fine circuit the plenum over a hot coarse one that steps faster, and the pair then ran at the all-explicit step). A tie goes to the first declared. The other circuit steps its ports against a copy of the plenum. Per macro step, from t:

  1. each copy is reset to its plenum's state;
  2. the other circuit takes its own CFL step Δt, its ports exchanging with the copies exactly as they would with a plenum;
  3. what each copy gained, in mass, internal energy and every species, over Δt becomes its plenum's source, held over the span;
  4. the owning circuit sub-steps over the same span at its own CFL, the plenum taking that source.

The copy's change is exactly what the other circuit's ports passed, at the stage weights of its own SSP-RK steps. So the plenum receives exactly that, and nothing is linearised or recorded twice. Within a step, each circuit sees the other's effect on the plenum only through the step's start, so the coupling is first order in the step. solver/multirate.py, advance_network_explicit_pair, is the code.

The harness for the numbers below (tests/integration/test_multirate_explicit_pair.py):

  • a closed system;
  • a fine runner, 0.3 m at 5 mm cells, at 1.5 bar and 600 K;
  • a 2 L plenum at 1.2 bar;
  • a coarse tail, 0.6 m at 2 cm cells, at 1 bar and 400 K;
  • O2 and NO at different fractions in each;
  • ssp_rk2, first order, measured 2026-11-19 on Python 3.10.21 and numba 0.67.0.

  • It is conservative. Over 10 ms (470 macro steps at cfl 0.5) the network's mass, energy, O2 and NO moved by 4.4e-16, 2.8e-15, 2.7e-16 and -4.3e-16 of themselves.

  • It converges at first order to the all-explicit run as the step is refined. Against an all-explicit run at cfl 0.05, the tail's and the plenum's pressures at 10 ms are off by 27.54, 13.34, 7.22 and 3.75 Pa at cfl 0.4, 0.2, 0.1 and 0.05 (orders 1.05, 0.89, 0.94). The all-explicit run's own error at those steps is 0.417, 0.113 and 0.027 Pa. The plenum sits near 1.18 bar.
  • A plenum short against the coarse cells costs accuracy, not stability. The coarse side's coupling lags a step, so what matters is how long the plenum is, V over the coarse circuit's port area, in coarse cells. At cfl 0.5 over 20 ms, the tail's density was off the all-explicit run by:
Plenum Coarse cells Density error
2 L 50 4.0e-4
0.2 L 5 5.7e-3
50 mL 1.25 2.9e-2
20 mL 0.5 6.1e-2
5 mL 0.125 0.14

It was stable at every size. Under 5 cells the run warns. - Speed. A 0.1 m runner at 2 mm cells against a 3 m pipe at 2 cm, 20 ms, cfl 0.5: 7.42-7.54 s all-explicit, 5.14-5.17 s as two circuits (1.44x), four reps each after a warm-up, at loadavg 3-6. The plenum ends 1.6 Pa apart (110 524 and 110 526 Pa). The cell counts alone promise about 3x. This paragraph blamed the rest on the explicit driver building its network on every call. Retracted 2026-11-21: each circuit's network is built once now, and on a rebuild of this harness that is worth about 3 % (the pair 1.15x over all-explicit built once, 1.12x built per call, at loadavg 14-22, inside the spread). Where the rest goes was not profiled (BACKLOG.md, "Multi-rate circuits, what is left").

The ports of the circuit that does not own a plenum must be plain: no neck, LODI or Python port BC. A turbo, and the shaft it drives, must sit in the owning circuit. A plenum with caloric mixture thermo cannot couple two explicit circuits yet.

The compiled sweep (since 2026-11-23, 0.6.1). An explicit circuit runs the compiled MUSCL residual sweep and the plenum-port ghost sweep (solver/soa.py) on a mirror of its own pipes and plenums when either engages on it (8 swept pipes or 4 plenum ports), as the all-explicit driver does on the whole network (example 39 gains 9.4 % from it). Building that mirror moves the circuit's pipe states into a new buffer and re-flags its ports, so solver/multirate.py::_CircuitMirror records what it moved and puts the build's mirror back when the run ends, the state reached copied into it. A pair's proxy plenum is a new volume every macro step, and the mirror reads it anew before each sub-run; without that the coarse circuit's port ghosts came from the step-start copy. With the thresholds lowered to 1 on the two test harnesses, both run to the result without the sweep to 1e-12 (tests/integration/test_multirate_compiled_sweep.py). No bundled circuit case crosses the thresholds, so none moves.

What it does not do, and is open in BACKLOG.md ("Multi-rate circuits, what is left"): implicit circuits; more than two circuits; an interface other than a plain plenum. Also two explicit circuits with a caloric plenum, and why the pair gains less than its cell counts promise.

References

  • Saad, Y. Iterative Methods for Sparse Linear Systems, 2nd ed. (SIAM, 2003) — chapters 6 (Krylov methods) and 10 (preconditioning) for the general framework.
  • Toro, E. F. Riemann Solvers and Numerical Methods for Fluid Dynamics, 3rd ed. (Springer, 2009) — chapter 10 for HLLC algebra; chapter 13 for implicit time-stepping.
  • Millo, F., Gundlapally, S., Wang, W., Wahiduzzaman, S. 1D Simulation Models for Aftertreatment Components, Ch. 11 in 1D and Multi-D Modeling Techniques for IC Engine Simulation (SAE, 2020) — §11.2.5–11.2.7 for the Method-of-Lines / BDF DAE solution, the limit-point robustness problem, and the inner/outer adaptive mesh.

The source-side documentation tracker is in docs/perf-history.md (the audit-driven evidence trail phase by phase) and BACKLOG.md (open items, including the ones this doc records as deferred or rejected).