Skip to content

Tolosa : 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 :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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.

Initialization

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)

Default timers

This routine initializes a set of default timers for the Simulation Time, MPI_SEND_RECV, MPI_SUM, MPI_MAX, MPI_MIN operations, the Muscl Reconstruction, the Muscl Limitation, the Time Step Computation, the Boundary Conditions, Euler Steps, Linear Solver, the Preconditionner, Linear Combination, Matrix/Vector Product, Dot Product, Norms, Linear System Copy, Writing Result Files, and the Post Treatment

  • mpi_halo_level ???
  • if the mesh variable is passed to the routine : read or create the mesh and initialize spatial schemes considering the mesh (See Mesh)

Note

If neither input nor mesh nor mpi_ghost_level are specified, only the MPI environment, the outputs records length, the machine precision limits, the arguments passed to the command line, and the timers are initialized.

Subroutine details

The full initialization routine is written in the m_Tolosa_lib.f90 module.

Finalization

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

Subroutine details

The full finalization routine is written in the m_Tolosa_lib.f90 module.

Back to top