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.
Sources
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.
Variables¶
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 (oflen=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 directiondy
: Space step in y vertical directionddx
: Inverse of the Space step in x directionddy
: Inverse of the Space step in y directionddx2
: Squared Inverse of the Space step in x directionddy2
: 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 endianlittle_endian
:.true.
if the machine is in little endianzerom
: Machine zeropinfm
,minfm
: Machine infinitieshugem
,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 realr64 = REAL64
: Double precision realr128 = 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 precisionrp = r64
: real numbers machine precisionlp = 4
: logical numbers machine precisionlchar = 128
: character default lengthlbc = 20
:character default length for boundary tags
Note
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 Indextc = 0._rp
: Simulation Timeend_time_loop = .false.
: Time Loop Stopping Criterion Logicallogic_test = .false.
: Time Loop Stopping Criterion Logical
File management¶
file_open_counter = 0_ip
: Counter of opened basic output filesfile_post_counter = 0_ip
: Counter of opened post processing fileserr
: Global Integer at output of Fortran Statementsfile_exist(10) = .false.
: Logical to test a file existenceis_file_open(500) = ''
: Helping to create automaticly basic output files
MPI variables¶
Some global MPI variables are defined.
np = 1_ip
: Number of MPI Threadsproc = 0_ip
: Thread number from 0 to np-1mpi_halo_level
Tools¶
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" )