Tristan-MP v2
allows simulations to be paused and continued later. For that the code can store all the field and particle data into separate files. When restarted, the simulation can read all the data from that file and initialize all the relevant quantities as if it never stopped running in the first place.
Saving restart files
Directory where the code stores all the restart finales in binary format is specified at runtime with the flag -r
:
$ mpiexec exec/tristan-mp2d ... -r [restart_dir_name]
If not specified, the restart_dir_name
will default to just restart
.
Rest of the configurations for the restart are specified in the input
file:
<restart>
do_restart = 0 # perform simulation restart [0]
cpu_group = 50 # simultaneously written restart files [50]
enable = 0 # enable/disable restart [0]
start = 1 # first restart step [0]
interval = 1000 # step interval between restarts [10000]
rewrite = 1 # 1 = rewrite each restart; 0 = separate restart each time [0]
There are two options for the rewrite
variable: you can either create a single restart folder and overwrite it once every interval
timesteps (rewrite = 1
), or you can create separate folders for each of the restart steps (rewrite = 0
). All the directories will be saved in the path specified above – [restart_dir_name]
. If rewrite = 1
– there will be just one directory called step_00000/
where all the restart files will be saved. If rewrite = 0
– you’ll see several directories of the form step_*****
, where *****
will be the number of the restart.
Restarting simulation
To restart the simulation with the data stored in the restart directory you need to include the following flag when running:
$ mpiexec exec/tristan-mp2d ... -R [RESTART_FROM]
or
srun exec/tristan-mp2d ... -R [RESTART_FROM]
[RESTART_FROM]
is the directory where all the restart files are stored, i.e., typically it will be of the form: restart/step_*****
. Notice that here you’ll also need to specify the subdirectory step_
where all the files are actually stored. That way you can specify which restart point you actually want to use.
userReadInput()
function will still be called during the restart. However, user-specific particle and field initializations will be ignored.