Version 22 (modified by suehring, 14 years ago) (diff)

--

Interfaces for user-defined code


Description: The following table describes the available interfaces for user-defined code in the model, the names and possible arguments of the subroutines involved as well as actions which can be accomplished in these subroutines. The respective name of a source code files is the subroutine name followed by ".f90". Exception: the file containing the module user has the name user_module.f90.

Call location Subroutine name and argument(s) Possible actions

---

MODULE user

All user-defined variables which are used outside the respective local scopes of the user-defined subroutines have to be declared here.

End of parin.f90

user_parin

Declaration of user-defined parameters in the NAMELIST group &userpar. These parameters can be read from the local file PARIN and be used for steering the user-defined code (see chapter 4.0?). The user-defined parameter region is already pre-defined in &userpar and must not be changed. Additional NAMELIST groups may be declared if desired. The CPU time needed for executing user_parin is included in the local file CPU_MEASURES within the category "initialisation".

End of header.f90

user_header( io )

Output of the values of the user-defined parameters to the local files HEADER and RUN_CONTROL. This output should be made anyway in order to subsequently check the parameter values used for the respective run. The number of the output unit is passed as an argument and must be used in each WRITE statement (e.g.: "WRITE ( io,…)"). By default, this subroutine only creates output if a user-defined NAMELIST is found in file PARIN (in this case the variable user_defined_namelist_found is set .TRUE. in user_parin). The names of any user-defined subdomains are displayed by default (see statistic_regions).

End of init_3d_model.f90

user_init

Here, user-defined initialization actions which should be accomplished before the start of the 3D-model can be implemented (e.g. inhomogenous change of the surface temperature, the roughness length, or similar). At this point, all default parameter initializations of the model (chapter 4.1?) have already been carried out at all.

One of the most important actions here is the definition of user-defined subdomains for statistic analysis and output (see statistic_regions and chapter 3.5.3?) and of additional time series quantities (see comment line example in the file). CPU time for user_init is considered in the local file CPU_MEASURES within the category "initialisation".
See also user_init_3d_model.

End of read_3d_binary.f90

user_read_restart_data(
nxlc, nxlf, nxl_on_file,
nxrc, nxrf, nxr_on_file,
nync, nynf, nyn_on_file,
nysc, nysf, nys_on_file,
tmp_2d, tmp_3d )

Reading of user-defined 2d- and 3d-arrays from the restart file.
In case of restart runs, user-defined quantities may have to be read from the restart file generated by the previous run. These quantities must have been output by the user in the previous run using routine {{{user_last_actions}}}.

For usage, see example contained in read_3d_binary.f90 and user_last_actions.f90.

DEFAULT case of SELECT CASE( TRIM(canopy_mode) ) command in the middle of init_3d_model.f90

user_init_plant_canopy

User-defined initilisation of the plant canopy model.
Here, the user can define the two three-dimensional arrays lad_s and cdc that stand for the leaf area density and the canopy drag coefficient. By this, the user can configure a plant canopy. This requires definition of at least one new canopy_mode in the SELECT CASE( TRIM(canopy_mode) ) command in user_init_plant_canopy. Note that the canopy_mode 'block' is not allowed here since it is the standard case used in the calling routine init_3d_model.

DEFAULT case of SELECT CASE( TRIM(topography) ) command in the middle of init_grid.f90

user_init_grid

Execution of user-defined grid initializing actions.
Here, the user can define the two-dimensional index array nzb_local that is used to set up a non-flat topography. This requires definition of at least one new topography mode in the SELECT CASE( TRIM(topography) ) command and the definition of topography_grid_convention in user_init_grid. Note that the topography modes 'flat', 'single_building' and 'read_from_file' are not allowed here since these are the standard cases used in the calling routine init_grid.
CPU time for user_init_grid is considered in the local file CPU_MEASURES within the category "initialisation".

End of check_parameters

user_check_parameters

Check &userpar control parameters and deduce further quantities.

In the middle of init_3d_model.f90

user_init_3d_model

Initialization of the 3d-model.
Allows the complete initialization of the 3d model. The user is responsible to set at least all those quantities which are normally set within init_3d_model.

In the middle of init_particles.f90

user_init_particles

With this routine e.g. size and color of particles, which have been released initially from a source, can be specified. Like the calling routine init_particles, this routine is only called if particle advection is switched on (see package parameter dt_prel).