9.4 Output Scalars

In FLASH4, each unit has the opportunity to request scalar data to be output to checkpoint or plotfiles. Because there is no central database, each unit ``owns" different data in the simulation. For example, the Driver unit owns the timestep variable dt, the simulation variable simTime, and the simulation step number nStep. The Grid unit owns the sizes of each block, nxb, nyb, and nzb. The IO unit owns the variable checkpointFileNumber. Each of these quantities are output into checkpoint files. Instead of hard coding the values into checkpoint routines, FLASH4 offers a more flexible interface whereby each unit sends its data to the IO unit. The IO unit then stores these values in a linked list and writes them to the checkpoint file or plotfile. Each unit has a routine called ``Unit_sendOutputData", e.g., Driver_sendOutputData and Grid_sendOutputData. These routines in turn call IO_setScalar. For example, the routine Grid_sendOutputData calls


IO_setScalar("nxb", NXB)
 IO_setScalar("nyb", NYB)
 IO_setScalar("nzb", NZB)

To output additional simulation scalars in a checkpoint file, the user should override one of the ``Unit_sendOutputData" or Simulation_sendOutputData.

After restarting a simulation from a checkpoint file, a unit might call IO_getScalar to reset a variable value. For example, the Driver unit calls IO_getScalar("dt", dr_dt) to get the value of the timestep dt reinitialized from the checkpoint file. A value from the checkpoint file can be obtained by calling IO_getPrevScalar. This call can take an optional argument to find out if an error has occurred in finding the previous value, most commonly because the value was not found in the checkpoint file. By using this argument, the user can then decide what to do if the value is not found. If the scalar value is not found and the optional argument is not used, then the subroutine will call Driver_abortFlash and terminate the run.

Generic Flash Docs User 2019-10-18