Checkpoint / Restart¶
Writing checkpoint files¶
write_dump_particle_interaction writes a .dump file (MPI-IO) with all the particle data and the interactions
required to restart the simulation.
| Parameter | Description |
|---|---|
compression_level |
zlib compression level |
filename |
output file |
By default, a checkpoint is written every simulation_dump_frequency steps (global block) by the
dump_data_particles batch, in <dir_name>/CheckpointFiles/exadem_%010d.dump, together with the drivers
(dump_drivers) and, for polyhedra, the shapes (RestartShapeFile.shp).
Reading checkpoint files¶
read_dump_particle_interaction reads a .dump file written by write_dump_particle_interaction, including the
interactions (friction and moment of the active contacts).
| Parameter | Description |
|---|---|
filename |
file to read |
bounds |
overrides the domain bounds, removing the particles outside ([[infx, infy, infz], [supx, supy, supz]]) |
expandable |
overrides the domain expandability stored in the file |
periodicity |
overrides the periodicity stored in the file (e.g. [false, true, false]) |
timestep |
overrides the step number |
scale_cell_size |
rescales the cell size; because of the friction storage per cell, only by an integer (1, 2, 4, 8, ...) or by \(1/2^n\) (0.5, 0.25, ...) |
shrink_to_fit |
with bounds, reduces the grid to the minimum size enclosing the bounds |
enable_extra_data |
reads the interactions |
With polyhedra, read the shapes first (read_shape_file), and call radius_from_shape after the dump, otherwise the
interactions are not defined:
restart¶
restart finds and reads everything needed to restart a simulation in one operator: the latest (or a given)
exadem_*.dump checkpoint under <dir_name>/CheckpointFiles/, the matching shape file (RestartShapeFile.shp by
default) if the simulation uses polyhedra, and the matching drivers file (drivers_<iteration>.msp, written by
dump_drivers) if there are drivers. It replaces the manual chaining of read_dump_particle_interaction, a shape
reader and a driver restore.
| Parameter | Description |
|---|---|
dir_name |
main output directory, usually set by io_config (optional) |
restart_iteration |
checkpoint to restart from; default: the latest exadem_*.dump (optional) |
shape_filename |
overrides <dir_name>/CheckpointFiles/RestartShapeFile.shp (optional) |
drivers_filename |
overrides <dir_name>/CheckpointFiles/drivers_<iteration>.msp (optional) |
For spheres there is no shape file, and not every simulation has drivers: a missing file (not given and not found at its default path) is skipped without error.
Note
domain: must still be defined in the .msp file as usual (grid size, periodicity, ...): only the state of the
particles, shapes and drivers comes from the checkpoint.
Restart template script¶
scripts/tools/restart_template.py adapts an existing launch .msp file for a restart, so that you do not have to
edit input_data: and setup_drivers: by hand. It writes a new <name>_restart.msp next to the input file:
python3 scripts/tools/restart_template.py path/to/my_simulation.msp
# -> writes path/to/my_simulation_restart.msp
How it rewrites input_data:
The input_data: of the generated file is not a copy of the original one. Every entry is dropped and replaced
by a single - restart, except the entries whose name ends with _params (multimat_contact_params:,
drivers_contact_params:, inner_bond_params:, ...), which are kept, in their original order, right after
- restart:
If the original input_data: relies on another operator to (re)build the simulation state — a custom field
operator that is not a *_params entry, for instance — it is silently dropped and must be added back by hand.
setup_drivers: is dropped entirely (drivers are restored by restart from the file of dump_drivers), and
apply_particle_sticking is forced to false in global: (the restored bonds already encode which particles are
stuck; recomputing them from evolved positions would be wrong). Every other block (domain:, compute_force:,
includes:, ...) is kept unchanged, and comment lines are removed.
Drivers format¶
The state of the drivers (position, velocity, motion parameters, ...) is checkpointed separately from the particles,
in its own .msp file. It is written and read automatically: simulation_dump_frequency triggers dump_drivers, and
restart reads its file back with read_drivers. You normally do not call these operators directly.
Note
The default pipeline also writes a legacy file, driver_%010d.msp (operator write_op_drivers), for a manual
restart without the restart operator, see Driver Input / Output.
dump_drivers¶
Writes the drivers to <dir_name>/CheckpointFiles/drivers_%010d.msp, as a plain drivers: list (one entry per
driver: type, id, state, params, and filename/minkowski for RShape drivers) read back by read_drivers. It is part of
the default dump_data_particles batch, with write_dump_particle_interaction and write_op_drivers.
| Parameter | Description |
|---|---|
dir_name |
main output directory |
timestep |
step number (used in the file name) |
Output format, e.g. a stationary surface:
read_drivers¶
Reads a drivers file written by dump_drivers and registers each driver, without setup_drivers: / register_*:
operators nor includes:. restart calls it automatically: use it directly only to restore drivers outside of
restart.
| Parameter | Description |
|---|---|
filename |
drivers file written by dump_drivers |