M0 · Scaffold
Done 18 September 2026
Goal
The skeleton everything else hangs on: the data structures for the plasma state, the guard every surrogate will sit behind, the coupling loop, translation to and from IMAS, provenance records, and a test suite, all running on a toy physics model so that each piece can be checked before real physics arrives.
Acceptance criteria (fixed in the brief before work started)
| criterion | result |
|---|---|
| IMAS round trip preserves values and coordinates to machine precision, for all four record types | met: 10−14C-024 relative, including a file round trip |
| a toy transport model runs 100 steps inside compiled code | met: 100 stepsC-001; 0.4 sC-025 once compiled |
| continuous integration green | pending: the workflow runs on the code’s private hosted repository since 1 Oct 2026 (OQ-3); its first result is not yet recorded here. Locally: lint and type checks clean, 42 testsC-029 passing, in both modes |
There was no human gate at M0.
What was built
- Plasma state as immutable data structures: radial grid, profiles, equilibrium, transport coefficients and sources, each field documented with its unit. See core state.
- Open/gated separation: every module labelled, a registry of gated codes, and a switch that disables them all; two tests enforce it. See invariants.
- The guard: input domain, ensemble-spread tolerance, physical output bounds and finiteness, with a per-point fallback. See guard.
- Uncertainty carried through the loop: the ensemble spread travels with the transport coefficients, is zeroed where the fallback is used, and is exported as IMAS error bars.
- The coupling loop, built one milestone early because M0 needs something to run the toy model in. See coupling loop.
- Toy physics: circular equilibrium, smooth critical-gradient transport, Gaussian sources. See physics models.
- IMAS adapters for four record types. See IMAS adapters.
- Provenance beside every artifact. See provenance.
Checks beyond the acceptance criteria: particle and energy balance of a single step to 10−10C-026, and of every step of a full run reconstructed from its record to 10−9C-027; derivatives through 20 coupled steps agree with finite differences to 2 × 10−5C-028.
Deviations from the brief, and why
- The coupling loop arrived at M0, not M1, because M0’s acceptance needs a running loop and the guard and uncertainty plumbing had to be designed against it.
- A final “corrector” solve was added after the nonlinear iteration (not in the brief’s sketch), so the accepted state conserves particles and energy exactly for the coefficients that are recorded, however well the iteration converged. See coupling loop.
- Picard iteration stalls on stiff transport. The toy model’s settings were softened to get through M0 and the stall was reported, not hidden; Newton-Raphson was recommended for M1 and approved (OQ-4).
- Two open-source codes needed at M1 (ASCOT5, Aurora) would not build yet.
What M1 needed from the owner
A hosted repository so CI runs (OQ-3, settled); a benchmark scenario (OQ-6, settled) and its tolerance (OQ-5, settled); a decision on the Newton solver (OQ-4, approved) and on the fallback model (OQ-1, open); and permission to use the cluster’s batch system (OQ-2, settled).