Skip to content

Common tools and variables

Tolosa-lib has a set of variables and tools that are actively used in each Tolosa model. These variables and tools will be detailed in the following paragraphs.


All the common tools and variables are explicitely defined in the Tolosa-lib/src/m_common.f90 and Tolosa-lib/src/submodule/m_common_tools.f90 submodules. Other variables and tools concerning the screen outputs are also created in the Tolosa-lib/src/m_screen.f90 module. Only the most useful variables and tools will be detailed here ; feel free to check the sources.


General variables and shortcuts

Two shortcuts for logical values are defined to call allocation routines in a comprehensive way.

  • T = .true.
  • F = .false.

Other general variables are defined :

  • buffer = '' : Temporal buffer to read formated files (of len=1028)
  • args(:) : Allocatable table of arguments passed to the command line

Input variables

All the input variables that are defined in the input.txt file are global variables. See Available Input Variables to get the input variables list.

Parameters for a cartesian mesh

If the mesh of the domain is defined in the input.txt file and not with a Gmsh file, a cartesian mesh is created by Tolosa (See Inputs). Some global variables are defined to use this cartesian mesh :

  • dx : Space step in x horizontal direction
  • dy : Space step in y vertical direction
  • ddx : Inverse of the Space step in x direction
  • ddy : Inverse of the Space step in y direction
  • ddx2 : Squared Inverse of the Space step in x direction
  • ddy2 : Squared Inverse of the Space step in y direction

Precision management

Two logical variables check at the initialization if the machine is in big endian or little endian, and other variables get the machine precision limits values.

  • big_endian : .true. if the machine is in big endian
  • little_endian : .true. if the machine is in little endian
  • zerom : Machine zero
  • pinfm, minfm : Machine infinities
  • hugem, tinym : Machine overflow/undeflow

Then, a set of parameters enables to define the variables' precision : The various kinds of integer and real are defined as :

  • i8 = INT8 : Byte integer from \(-2^7\) to \(2^7 -1\).
  • i16 = INT16 : Short integer from \(-2^{15}\) to \(2^{15}-1\)
  • i32 = INT32 : Long integer from \(-2^{31}\) to \(2^{31}-1\)
  • i64 = INT64 : Quad integer from \(-2^{63}\) to \(2^{63}-1\)
  • r32 = REAL32 : Single precision real
  • r64 = REAL64 : Double precision real
  • r128 = REAL128 : Quadruple precision real

One should specify the machine precision for integer, real, logical and character. By default, the variables' precision are set to :

  • ip = i32 : integer numbers machine precision
  • rp = r64 : real numbers machine precision
  • lp = 4 : logical numbers machine precision
  • lchar = 128 : character default length
  • lbc = 20 :character default length for boundary tags


The character equivalent of each type is defined. These variables can be used in some procedures, such as the add_get procedure of a cli object (See Inputs).

  • unknow = 'unknow'
  • rtype = 'real'
  • itype = 'integer'
  • ctype = 'character'
  • ltype = 'logical'

Time management

  • nt = 0_ip : Time Iteration Index
  • tc = 0._rp : Simulation Time
  • end_time_loop = .false. : Time Loop Stopping Criterion Logical
  • logic_test = .false. : Time Loop Stopping Criterion Logical

File management

  • file_open_counter = 0_ip : Counter of opened basic output files
  • file_post_counter = 0_ip : Counter of opened post processing files
  • err : Global Integer at output of Fortran Statements
  • file_exist(10) = .false. : Logical to test a file existence
  • is_file_open(500) = '' : Helping to create automaticly basic output files

MPI variables

Some global MPI variables are defined.

  • np = 1_ip : Number of MPI Threads
  • proc = 0_ip : Thread number from 0 to np-1
  • mpi_halo_level


In addition to global variables, Tolosa-lib has global subroutines or functions that are considerably useful. The following paragraphs will detail the operations of these subroutines/function and show usage examples.

Unit test

The unit_test subroutine does a unit test of a check value. If the value is strictly greater than 0, the unit test fails and the program is stopped.

integer(ip) :: check


call unit_test( check , "Unit test of a simple operation" )
Back to top