read_checkpoint Subroutine

public subroutine read_checkpoint(state, fname, t, iter, is_ok, message)

Read a checkpoint file and restore solver state.

Validates the magic number, version, grid size, and equation count against the current state to catch mismatches early.

Arguments

Type IntentOptional Attributes Name
type(solver_state_t), intent(inout) :: state

Solver state with ub already allocated (from setup_solver).

character(len=*), intent(in) :: fname

Path to the checkpoint file (or 'latest_checkpoint').

real(kind=wp), intent(out) :: t

Restored simulation time [s].

integer, intent(out) :: iter

Restored iteration count.

logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message