Skip to content

Initialization and Finalization

To be able to use Tolosa-lib and any of its features and routines, one has to make sure to use the Tolosa_lib module. Moreover, two methods enable one to proceed with the initialization and finalization of a Tolosa program. Those methods need to be called at the beginning and end of a Tolosa program.

Therefore, the general structure of a Tolosa program should be :

PROGRAM example
USE Tolosa_lib
type(cli) :: input
type(msh) :: mesh
integer(ip) :: mpi_ghost_level
call Init_Tolosa( input=input , mesh=mesh , mpi_ghost_level = mpi_ghost_level )
[...]
call Final_Tolosa( mesh=mesh , timing_file=T )
END PROGRAM example

The handled operations of these methods will be described in the following paragraphs.

To use the Tolosa-lib features and set the running environment concerning inputs, computation, domain, etc., one has to initialize Tolosa by calling the Init_Tolosa routine from the library.

type(cli) :: input
type(msh) :: mesh
integer(ip) :: mpi_ghost_level
call Init_Tolosa( input , mesh , mpi_ghost_level )

The input, mesh and mpi_ghost_level variables are optional.

This routine enables one to :

  • initialize the MPI environment : the pool of processes, the derived data types, etc. (See MPI)
  • get the output files stream records length to be able to extract various data
  • get the numbers regarding the machine precision limits
  • if the input variable is passed to the routine : get the arguments passed to the command line or specified in the input.txt file (See Inputs)
  • initialize timers to document the computation time repartition spent on various operations (See Timers)
  • if the mesh variable is passed to the routine : read or create the mesh and initialize spatial schemes considering the mesh (See Mesh)

When the computation is over, one can finalize Tolosa by calling the Final_Tolosa routine.

type(msh) :: mesh
logical :: withouttiming
logical :: timing_file
logical :: perf_nopart
integer(ip) :: perf_dx
integer(ip) :: perf_dt
call Final_Tolosa( mesh , withouttiming , timing_file , perf_dx , perf_dt , perf_nopart )

All variables are optional.

This routine enables one to :

  • Stop timers
  • Compute the performance (in microsec / dx / dt / proc) and write it : If the timing option is activated through withouttiming, a timing report is displayed, and the time performance is computed. Moreover, if timing_file is given, outputs and performance are written in this timing_file.
  • Deallocate the mesh and other arrays