Blueprints
Pick a solver family
Dispatch is resolved at compile time from the config type. The selection criterion is the problem class, listed below with the evidence for each.
// One scalar type, three solver families, one language.
type FloatType = f64; // swap for Float106 without touching the physics
// Incompressible, fixed mesh -> DEC
let cavity = CfdFlow::march(&dec_config).run_owned()?;
// Compressible layer, 2^L grid -> QTT marcher
let layer = CfdFlow::march(&compressible_config).from_field(seed).run()?;
// Stagnation line, no grid at all -> fitted closure
let post = FittedNormalShock::post_shock(mach, gamma, t_inf);
MarchDispatch selects the pipeline from the config type at compile time. There is
no runtime solver registry and no dynamic dispatch.
Choosing
| Your problem | Family | Evidence |
|---|---|---|
| Incompressible, fixed mesh, wall-bounded | DEC Navier–Stokes | Ghia Re 1000 |
| Compressible layer where a 2^L grid must stay cheap | QTT marcher | Sod, L1 ≤ 0.027 |
| Stagnation line, relaxation, no grid needed | Fitted closures | RAM-C II anchor |
| Curved shock on Cartesian axes at high resolution | Not supported | χ ~ √side |
QTT compression is conditional on coordinate alignment rather than on smoothness. A curved shock captured on Cartesian axes costs more than a dense grid, and in 3-D the bond dimension grows as roughly the square root of the side length. The available responses are to align the coordinate or to select a different family.
The DEC type-state
Velocity lives as an edge 1-form and each step marches the Leray-projected rate, so
the field is divergence-free at every step. The SolenoidalField type-state makes
time-stepping an unprojected field a compile error rather than a slowly diverging
run.
Measured divergence residual on the wake case is 3.33e-15 against a 1e-6 tolerance. The discretization is exact by construction, so the figure reports round-off rather than solver convergence.
Precision as a type parameter
Every example carries one alias:
pub type FloatType = f64;
The physics is written against the scalar bound, so changing that line
re-instantiates the computation. f32, f64 and Float106 are all supported.
f32 carries a representability limit in addition to reduced accuracy: in the
corridor it fails at step one, because a term in the ionization kernel evaluates
to 4.4e-67 and underflows the exponent range.
Forecast horizon under precision measures the effect: roughly a factor of two in usable forecast horizon per nine orders of magnitude of epsilon.
Worked examples using this