Checkpoint / Restart¶
hippoLBM can save the full simulation state to a binary dump file at regular intervals and reload it later to
continue a run. A dump file stores the distribution functions \(f_i\), the obstacle field, the LBM parameters (tau,
nu, Fext, …), the timestep counter and the physical time. The domain geometry (bounds, resolution,
periodicity) is also embedded, so the restart file is self-contained, except for the bounce-back planes (see
below). The data are compressed
with zlib.
Saving checkpoints¶
Add simulation_dump_freq to the global block:
A dump file is then written every 3000 iterations to <output_directory>/CheckPointRestart/hippoLBM_<timestep>.dump,
for example MySimDir/CheckPointRestart/hippoLBM_0000003000.dump.
Note
The checkpoint is written at the end of the iteration, after the collision and streaming steps, so the file always contains a physically consistent state.
Final checkpoint¶
display_last_output: true writes both a ParaView output and a dump file at the very end of the simulation,
regardless of simulation_dump_freq:
write_dump¶
For finer control, override the write_dump operator:
| Slot | Type | Default | Description |
|---|---|---|---|
filename |
string |
"hippoLBM_%010d.dump" |
filename pattern (printf-style, receives the timestep) |
output_directory |
string |
"hippoLBMOutputDir" |
base output directory |
compression_level |
int |
1 |
zlib compression level, from 1 (fastest, larger file) to 9 (smallest, slower) |
display_filename |
bool |
true |
print the filename in the log |
Restarting from a checkpoint¶
Replace the do_domain block by a read_dump call. The operator rebuilds the full simulation state — grid, fields,
parameters, timestep and physical time — from the file:
Note
The default initialization and the set_distributions block are automatically skipped on restart (read_dump
sets do_set_distributions to false): the distribution functions of the checkpoint are used directly. You do
not need to remove your set_distributions block.
The boundary conditions, analysis operators and global settings are read from the input file as usual, so you can
change simulation_end_iteration to extend the run:
read_dump¶
| Slot | Type | Default | Description |
|---|---|---|---|
filename |
string |
required | path to the .dump file |
skip_params |
bool |
false |
if true, the LBM parameters of the checkpoint are ignored and those of the lbm_parameters block are used (restart with a different viscosity or forcing) |
display_info |
bool |
true |
print a summary of the checkpoint (timestep, grid size, parameters) |
periodic |
[bool;3] |
optional | override the periodicity stored in the dump |
Restart with a different viscosity
Bounce-back planes
The bounce_back_planes of domain are not stored in the dump. When the simulation uses bounce-back domain
walls, declare them again after read_dump with
add_bounce_back_bcs:
Inspecting a dump file¶
check_dump reads a dump file, prints its header (version, timestep, grid size, number of MPI ranks, fields, LBM
parameters), checks its internal consistency, and stops the run. Use it to verify that a checkpoint is not
corrupted before a restart:
The regression test regression_lbm_checkpoint_restart restarts a Couette flow from
regression-test/data/couette_0000003000.dump.