Skip to content

Feature/flow snapshots - #51

Merged
satfra merged 6 commits into
satfra:mainfrom
KKockler:feature/flow-snapshots
Oct 1, 2026
Merged

satfra merged 6 commits into
satfra:mainfrom
KKockler:feature/flow-snapshots

Conversation

@KKockler

Copy link
Copy Markdown
Contributor

New feature: Snapshot a run at fixed t/k and continue future runs from that scale. Useful for debugging, phase diagrams, etc.

Konrad Kockler and others added 6 commits September 11, 2026 11:47
A run can now write its complete state at chosen RG scales
(/timestepping/snapshots/k or /t, --snapshots-k/-t) to
<run>_snapshot_<nnn>.h5, and a later run can continue from such a
snapshot (/restart/file, --restart) instead of starting at Lambda,
possibly with a changed configuration whose differences are logged.
Intended for parameter scans such as phase diagrams, IR debugging and
continuing runs cut off by wall-time limits.

- AbstractTimestepper::run is now a non-virtual driver that splits the
  flow into segments at snapshot times; steppers implement run_segment.
  Only at segment ends does every stepper (incl. the IDA + explicit
  hybrids) hold its exact accepted state.
- The spatial state is stored cell by cell (CellId + local dof values),
  independent of dof numbering and MPI rank count; adapted meshes are
  rebuilt from the cell ids.
- Optional model hooks save_state/load_state carry history-dependent
  model state (used by the QuarkMesonLPAprime example).
- Python helpers (file_io.snapshots, phasediagram.make_seed,
  run_point(restart=)) and Mathematica SnapshotInfo/ListSnapshots.

Fixes found on the way: t_start > 0 handling in the IDA-family,
TRBDF2 and TC_Default steppers; explicit Euler, Boost ABM and BoostRK
(variables) now end exactly at t_stop; HAdaptivity's uninitialised
last_adapt; phasediagram.get_command without folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The snapshot's configuration is serialized by Boost.JSON as 2E-2 etc.,
which Mathematica's RawJSON import reads as exact rationals (1/50).
Convert them to reals. Verified SnapshotInfo/ListSnapshots against a
real QuarkMesonLPAprime snapshot, including a NaN k (no Lambda), which
Import returns as $Failed and SnapshotInfo maps to Indeterminate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LinearCoordinates1D, LogarithmicCoordinates1D and FocusedLogCoordinates1D gain
prefix(n): the first n points of the grid as a grid of the same type, with
forward(i) bit-identical to the parent's for i < n and backward() unchanged.
Mapping a kernel over prefix(n) fills exactly the first n entries it would
fill over the full grid, so the upper end of a grid (e.g. momenta p >> k
whose loops have decoupled) can be skipped without a different coordinate
type -- SubCoordinates is the general window, but kernels generated against a
concrete coordinate type cannot take it without being regenerated.

The spacing is copied, not re-derived: LogarithmicCoordinates1D's forward()
divides the index by the point count, so a grid rebuilt from n points would
be a different grid, and the other two would move by an ulp. A prefix
therefore keeps its parent's parameters and point count (parent_size()) and
renders as "<parent>.prefix(n)" in to_string(), which operator== follows, so
position caches and HDF5 datasets keyed on it never confuse it with its parent
or with a genuine n-point grid. Grids that are not prefixes render and compare
exactly as before. Conversions between number types keep the prefix.

Not added to LinearPeriodicCoordinates1D (a prefix of a periodic axis is not
periodic, but would still fold in backward() and wrap in the interpolators)
or CoordinatePackND (no single axis to cut; SubCoordinates covers windows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satfra
satfra merged commit 213f323 into satfra:main Oct 1, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants