7. Checkpointing and Coarse Output

7.1. Checkpointing

Checkpointing mechanisms save the current state of an application, allowing users to recover from interruptions. For this our solver has to save its current state at defined points over the course of a simulation (checkpoints). A checkpoint contains all information which is required to continue a simulation. Our netCDF-output, implemented as part of Ch. 5.1, already contains the most important information (domain size, \(b\), \(h\) and momenta).

Tasks

  1. Extend your netCDF writer such that it writes all information required for restarting the simulation.

  2. Create a setup setups::CheckPoint which loads a netCDF checkpoint file. The setup should use the last available time step in the file.

  3. Test your checkpointing. To simulate a crash, you can kill your solver by pressing CTRL-C in the shell. Be aware of in-memory buffers and consider utilizing the function nc_sync.

  4. Extend your solver such that it automatically uses the checkpoint scenario if the checkpoint file already exists and contains at least one time step. In all other cases, it would go through regular initialization. This allows us to continue the simulation with the same command line parameters as used initially.

7.2. Coarse Output

To reduce the overall amount of output, we modify the output writer such that it averages several neighboring cells of the computational grid into one cell of the output file. A domain of size \(m\times n\) cells should result in an output file with \(\lceil m/k\rceil\times\lceil n/k\rceil\) cells per time step. The user should be able to specify \(k\) via a command line argument or in your configuration file.

Tasks

  1. Modify your output writer as described above!

  2. Run a simulation of the March 11, 2011, M 9.1 Tohoku earthquake and tsunami event with a cell size of 50m. Use the same domain as in Ch. 6.2. If you cannot run the entire setup, simply run the first couple of time steps. Visualize your coarse output!