10.4 Example Usage

An implementation example from the IO_init is straightforward. First, use the module containing definitions for the unit (for _init subroutines, the usual use Unit_data, ONLY: structure is waived). Next, use the module containing interface definitions of the RuntimeParameters unit, i.e., use RuntimeParameters_interface, ONLY:. Finally, read the runtime parameters and store them in unit-specific variables.  
subroutine IO_init()


use IO_data
  use RuntimeParamters_interface, ONLY : RuntimeParameters_get
  implicit none


call RuntimeParameters_get('plotFileNumber',io_plotFileNumber)
  call RuntimeParameters_get('checkpointFileNumber',io_checkpointFileNumber)


call RuntimeParameters_get('plotFileIntervalTime',io_plotFileIntervalTime)
  call RuntimeParameters_get('plotFileIntervalStep',io_plotFileIntervalStep)
  call RuntimeParameters_get('checkpointFileIntervalTime',io_checkpointFileIntervalTime)
  call RuntimeParameters_get('checkpointFileIntervalStep',io_checkpointFileIntervalStep)


!! etc ...
Note that the parameters found in the flash.par or in the Config files, for example plotFileNumber, are generally stored in a variable of the same name with a unit prefix prepended, for example io_plotFileNumber. In this way, a program segment clearly indicates the origin of variables. Variables with a unit prefix (e.g., io_ for IO, pt_ for particles) have been initialized from the RuntimeParameters database, and other variables are locally declared. When creating new simulations, runtime parameters used as variables should be prefixed with sim_.