Unified on-disk format (current version: ckpt_version below): every dim writes
magic(42), version(ckpt_version), dim | iter, t, extents(1:dim), neq, dt
| grid_type(char32), fingerprint(2) | payload arrays (dim-specific).
The dim field makes files self-identifying; cross-dim restarts are rejected
with a clear error. Legacy formats (1D v2/v3, 2D magic-4242 v1) are NOT
readable — rejected by the magic/version checks (owner-authorized break;
no user-generated checkpoints exist).
MPI: agree_outcome/conclude_read wrap the collective par_lor decision
points. Callers own the collective SEQUENCE — every rank must reach each
call site uniformly.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | ckpt_magic | = | 42 | |
| integer, | public, | parameter | :: | ckpt_version | = | 6 |
Unified multi-dim format version. v5 (F2) adds two 1D-only trailing
records after the (unchanged) v4 body — the Kahan |
'
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | base | |||
| integer, | intent(in) | :: | iter |
If fname names the pointer file, read the real path from it; otherwise return fname unchanged. Detects >512-char truncation explicitly.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pointer_file | |||
| character(len=*), | intent(in) | :: | fname | |||
| character(len=*), | intent(in) | :: | prefix | |||
| logical, | intent(out), | optional | :: | is_ok | ||
| character(len=*), | intent(out), | optional | :: | message |
Collective outcome agreement (write-side): failed = any rank not ok. On failure the optional status pair gets fail_text; on SUCCESS the pair is left exactly as the caller preset it — hence intent(inout), NOT intent(out) (which would leave the caller's values undefined on the success path). COLLECTIVE — every rank must call.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | local_ok | |||
| character(len=*), | intent(in) | :: | fail_text | |||
| logical, | intent(inout), | optional | :: | is_ok | ||
| character(len=*), | intent(inout), | optional | :: | message |
Shared read epilogue: ONE collective decision point (the only par_lor of
the read path's conclusion); returns the agreed failure flag so callers
write if (conclude_read(...)) return. The failing rank reports its own
err, other ranks the generic text; error-stop fallback when the caller
passed no status arguments. COLLECTIVE — every rank must call.
Status pair semantics as in agree_outcome: assigned only on failure,
caller presets preserved on success (intent(inout)).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | local_ok | |||
| character(len=*), | intent(in) | :: | err | |||
| character(len=*), | intent(in) | :: | generic_text | |||
| logical, | intent(inout), | optional | :: | is_ok | ||
| character(len=*), | intent(inout), | optional | :: | message |
Write the most-recent checkpoint path to the pointer file (rank 0 only — the caller gates on rank).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pointer_file | |||
| character(len=*), | intent(in) | :: | fname | |||
| character(len=*), | intent(in) | :: | prefix | |||
| logical, | intent(out), | optional | :: | is_ok | ||
| character(len=*), | intent(out), | optional | :: | message |
Write the unified header (magic/ckpt_version/dim) + scalars. extents carries the dim global
extents (1D: [n_pt_global]; 2D: [nx_global, ny_global]).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | u | |||
| integer, | intent(in) | :: | dim | |||
| integer, | intent(in) | :: | iter | |||
| real(kind=wp), | intent(in) | :: | t | |||
| integer, | intent(in) | :: | extents(:) | |||
| integer, | intent(in) | :: | neq | |||
| real(kind=wp), | intent(in) | :: | dt | |||
| integer, | intent(out) | :: | info |
Read + validate the unified header against the caller's expectations.
On any failure ok=.false. and err carries '
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | u | |||
| character(len=*), | intent(in) | :: | prefix | |||
| integer, | intent(in) | :: | expected_dim | |||
| integer, | intent(in) | :: | expected_extents(:) | |||
| integer, | intent(in) | :: | expected_neq | |||
| integer, | intent(out) | :: | iter | |||
| real(kind=wp), | intent(out) | :: | t | |||
| real(kind=wp), | intent(out) | :: | dt | |||
| logical, | intent(out) | :: | ok | |||
| character(len=*), | intent(out) | :: | err |
Write the grid record: grid_type token + 2-component fingerprint.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | u | |||
| character(len=32), | intent(in) | :: | grid_type | |||
| real(kind=wp), | intent(in) | :: | fp(2) | |||
| integer, | intent(out) | :: | info |
Read the grid record and compare against the configured grid using the historical 1e-12 relative tolerance.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | u | |||
| character(len=*), | intent(in) | :: | prefix | |||
| character(len=32), | intent(in) | :: | grid_type | |||
| real(kind=wp), | intent(in) | :: | cur_fp(2) | |||
| logical, | intent(out) | :: | ok | |||
| character(len=*), | intent(out) | :: | err |