3.3 Creating a Simulation_data.F90

The Fortran module Simulation_data is used to store data specific to the Simulation unit. In FLASH4-alpha there is no central `database', instead, each unit stores its own data in its Unit_data Fortran module. Data needed from other units is accessed through that unit's interface. The basic structure of the Simulation_data module is shown below:  

module Simulation_data
  implicit none


!! Runtime Parameters
  real, save :: sim_rhoLeft, sim_rhoRight, sim_pLeft, sim_pRight
  real, save :: sim_uLeft, sim_uRight, sim_xAngle, sim_yAngle, sim_posn
  real, save :: sim_gamma, sim_smallP, sim_smallX


!! Other unit variables
  real, save :: sim_xCos, sim_yCos, sim_zCos


end module Simulation_data

Note that all the variables in this data module have the save attribute. Without this attribute the storage for the variable is not guaranteed outside of the scope of Simulation_data module with many compilers. Also notice that there are many more variables in the data module than in the Config file. Some of them, such as 'sim_smallX' etc, are runtime parameters from other units, while others such as 'sim_xCos' are simulation specific variables that are available to all routines in the Simulation unit. The FLASH4-alpha naming convention is that variables that begin with sim_ are used or “belong" to the Simulation unit.