#| fig-cap: "The adapter converts explicit inputs; the runner records execution and the reader extracts results."
#| fig-alt: "Equilibrium, profiles and explicit physics settings enter the adapter, which writes JOREK input files. The runner executes JOREK and retains every attempt. The reader extracts results from saved outputs."
%%{init: {"flowchart": {"useMaxWidth": false}}}%%
flowchart TD
Inputs["Equilibrium, profiles and explicit physics settings"] --> Adapter["Adapter: units and input files"]
Adapter --> Runner["Runner: snapshot and execute"]
Runner --> Saved["Saved outputs and every attempt"]
Saved --> Reader["Reader: results for comparison"]
JOREK input adapter, output reader and run wrapper
The toolkit now has the input adapter, output reader and run wrapper needed for JOREK reference calculations. They convert equilibria and profiles, read saved results, and retain a record of each execution. These open (Tier A) utilities can be tested without JOREK installed; an actual reference calculation still needs JOREK.
Unit conversion and physics choices are kept separate. JOREK’s own conversion scripts mix unit conversion with physics choices: how profiles continue outside the separatrix, a default diffusivity, Spitzer resistivity, grid sizes. The toolkit adapter converts units and writes files using caller-supplied physics settings. Every physics setting is an explicit input from the caller, with no default, so each one is visible and goes to the owner for a decision.
The adapter converts to JOREK’s normalised units using the constants of the pinned JOREK version. Checked against the units JOREK itself stored in three restart files, the conversion agrees to round-off (time and resistivity units computed by the toolkit match the values JOREK stored in three restart files to 1e-15 relativeC-213). The namelist writer was tested against the real program. A MAST-U input parsed and rewritten by the toolkit gives a restart file identical to the original input’s (the MAST-U input (356 entries) parsed and rewritten by the toolkit gives, with one thread, a restart file identical in every dataset to a run of the original inputC-214). This check is independent of our code, because JOREK parses the file.
Repeated real-program runs exposed a reproducibility limit. Runs with more than one OpenMP thread are not bitwise repeatable, and they intermittently abort during grid set-up (an assertion in the element search tree aborts 3 of 8 grid set-up runs at 8 OpenMP threads and 0 of 8 at 1 thread; two 4-thread runs of the same input differ at round-off, while 1-thread runs repeat bit for bitC-212). The run wrapper therefore does three things: - it records ranks and threads, and marks a run as bitwise repeatable only at one thread; - it retries the grid-set-up abort once, and only when no time step has completed; - it keeps every attempt.
The wrapper keeps read-only copies of the executable and inputs, with a provenance record beside every file. Its tests use fake executables (26 tests pass in normal and Tier-A-only modes: unit conversion, profile files, namelists, the energy reader, and the runner with fake executables (snapshots, retry, timeout, provenance)C-215). On the real program it reproduces a manual run exactly.
Where this stands: adapter and wrapper done; the abort is to be reported to the JOREK developers.
Technical details → JOREK.
JOREK acknowledgement. JOREK is developed by the JOREK team and is open source under the GNU LGPL v3. Results here use JOREK at commit 01a52be3. Citations: M. Hoelzl et al., Nuclear Fusion 61, 065001 (2021); M. Hoelzl et al., Nuclear Fusion 66, 116006 (2026). For a list of JOREK team members, refer to the author list of M. Hoelzl, G.T.A. Huijsmans, F.J. Artola, E. Nardon, M. Becoulet, N. Schwarz, A. Cathey, S.J.P. Pamela et al., Nuclear Fusion 64, 112016 (2024).
Technical details → JOREK › adapter · JOREK › runner
Decisions → OQ-37