# Module: Base Simulation system size, and the size setup subroutine. :Name: mod_mupro_base :Depends on: None :Defined variables: idp, rdp, cdp :Defined types: [type_mupro_SizeContext](#type_mupro_SizeContext) :Defined subroutines: [mupro_size_setup](#mupro_size_setup), [mupro_mpi_setup](#mupro_mpi_setup), [mupro_toml_read_file](#mupro_toml_read_file), [mupro_toml_get_value_evaluate](#mupro_toml_get_value_evaluate) The module is to set commonly used double precision variable kind. ## Defined variables ```Fortran use, intrinsic :: ISO_Fortran_env integer, parameter::idp = int64 integer, parameter::rdp = real64 integer, parameter::cdp = real64 ``` ## Defined Types ### type_mupro_SizeContext | Variable | Type | Meaning | | :------: | :----: | :-------------------------------------------------------------- | | nx | int32 | Number of simulation grids along x direction | | ny | int32 | Number of simulation grids along y direction | | nz | int32 | Number of simulation grids along z direction | | ns | int32 | Number of simulation grids in the substrate for thin film setup | | nf | int32 | Number of simulation grids in the film for thin film setup | | lx | real64 | Simulation size along x in real dimension (m) | | ly | real64 | Simulation size along y in real dimension (m) | | lz | real64 | Simulation size along z in real dimension (m) | ## Defined Subroutines ### mupro_size_setup(context) Set the simulation size for the whole simulation, the variables will be used implicitly later in almost all the modules and subroutines. ```{important} This is the base for all other modules. You must call the `mupro_size_setup` subroutine before you can use any other functionalities provided by the SDK. ``` | Argument | Type(Intent) | Meaning | | :------: | :----------------------------------------------------: | :--------------------------------------------------- | | context | [type_mupro_SizeContext(IN)](#type_mupro_SizeContext)  | The simulation size you want to have for the solvers | ### mupro_mpi_setup(rank, process) Initialize the MPI, this is necessary for all simulation using our SDK. ```{important} This is the base for all other modules. You must call the `mupro_mpi_setup` subroutine before you can use any other functionalities provided by the SDK. There is no particular sequence requested between mupro_mpi_setup and mupro_size_setup. ``` | Argument | Type(Intent) | Meaning | | :------: | :-----------: | :--------------------------------------------- | | rank | integer(out)  | The MPI rank for current core, starting from 0 | | process | integer(out)  | The total number of processes(cores) | ### mupro_toml_read_file(file, table) Read a toml file into toml_table type (from the toml-f package). ```{important} You must use this subroutine before you and use the `get_value` and `mupro_toml_get_value_evaluate` subroutine to read parameters from the toml file. ``` | Argument | Type(Intent) | Meaning | | :------: | :--------------------: | :---------------------------------------------------------- | | file | character(len=\*)(in)  | The toml file name | | table | toml_table(out)  | The toml_table to be used later in the get_value subroutine | ### mupro_toml_get_value_evaluate(table, name, out) This subroutine combine the funtionalities of `get_value` from toml-f package, which can read a string from the toml file, and the `exprtk::expression`, `exprtk::parser` functions which evaluate string math expression into numbers. | Argument | Type(Intent) | Meaning | | :------: | :--------------------: | :------------------------------------------------ | | table | toml_table(in)  | The toml_table obtained from mupro_toml_read_file | | name | character(len=\*)(in)  | The key of the to be parsed toml variable | | out | real(kind=rdp)(out)  | The exprtk evaluated number |