Skip to content

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
- read_dump_particle_interaction:
    filename: last.dump

With polyhedra, read the shapes first (read_shape_file), and call radius_from_shape after the dump, otherwise the interactions are not defined:

1
2
3
4
5
6
input_data:
  - read_shape_file:
     filename: ExaDEMOutputDir/CheckpointFiles/RestartShapeFile.shp
  - read_dump_particle_interaction:
     filename: ExaDEMOutputDir/CheckpointFiles/exadem_0001400000.dump
  - radius_from_shape

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.

1
2
3
4
5
6
7
8
input_data:
  - restart

# or
input_data:
  - restart:
     restart_iteration: 12345
     shape_filename: OtherCheckpointDir/shapes.shp

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:

# before, input_data: in my_simulation.msp
input_data:
  - init_rcb_grid
  - particle_type: { type: [ Sphere1, Sphere2 ] }
  - lattice: { structure: BCC, types: [ Sphere1, Sphere2 ], size: [ 1.0, 1.0, 1.0 ] }
  - set_fields: { polyhedra: false, type: [ Sphere1, Sphere2 ], radius: [ 0.5, 0.25 ] }
  - multimat_contact_params: { group1: [0], group2: [0], kn: [5000], kt: [4000], kr: [0.0], mu: [0.1], damprate: [0.999] }

# after, input_data: in my_simulation_restart.msp
input_data:
  - restart
  - multimat_contact_params: { group1: [0], group2: [0], kn: [5000], kt: [4000], kr: [0.0], mu: [0.1], damprate: [0.999] }

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:

1
2
3
4
5
drivers:
  - type: SURFACE
    id: 2
    state: {offset: -10, center: [0, 0, -10], normal: [0, 0, 1], vel: [0, 0, 0], vrot: [0, 0, 0], surface: 0}
    params: {motion_type: STATIONARY, motion_vector: [0, 0, 0], motion_start_threshold: 0, motion_end_threshold: 1e+300}

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
- read_drivers:
   filename: ExaDEMOutputDir/CheckpointFiles/drivers_0001400000.msp