Version 62 (modified by raasch, 2 years ago) (diff) |
---|
Interfaces for user-defined code
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 Model steering by parameters). 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 "initialization". |
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 (see Initialization parameters) have already been carried out at all. |
Begin of virtual_flight_mod.f90 | user_init_flight | Here, user-defined quantities which will be captured during virtual flight measurements can be initialized. |
Middle of virtual_flight_mod.f90 | user_flight | Here, user-defined quantities are calculated which will be captured during virtual flight measurements. |
End of read_3d_binary.f90 |
user_read_restart_data( |
Reading of user-defined 2d- and 3d-arrays from the restart file. |
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. |
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. |
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. |
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). |
End of advec_particles.f90 |
user_particle | Here the particles can be assigned new attributes (diameter, color etc.) after each time step. Like the calling routine advec_particles, this routine is only called if particle advection is switched on (see package parameter dt_prel) |
Beginning and end of the time integration loop of time_integration.f90 |
user_actions |
In this routine user actions can be implemented which are to be executed either at each time step or at certain times (defined by the user). Since in each case the routine is called at the beginning and at the end of a time step as well as after each prognostic equation it must be defined at which place (and/or at which places) the respective actions are supposed to be executed. For this purpose, an appropriate CASE structure is already inserted in this routine. The location of the calling routine is passed to this routine via the argument location. For example, if called at the beginning of a time step, location = 'before_timestep' and if called at the end, location = 'after_timestep'. |
End of prognostic_equations.f90. |
user_prognostic_equations |
This is for implementing complete prognostic equations for additional quantities, e.g. if more than one passive scalar shall be simulated. |
SUBROUTINE preprocess_spectra | user_spectra |
Computation of user-defined spectra. |
flow_statistics.f90 before the summation of array hom (horizontal averages) | user_statistics( sr ) |
Horizontal averages of vertical profiles of user-defined quantities can be computed here. Also, additional time series quantities can be calculated. They have to be defined before in routine user_init. The routine is called once for each defined statistic_region (see statistic_regions). |
Middle of advec_particles.f90, after particle reflection from walls. | user_advec_particles | User-defined actions after the calculation of the new particle position. |
End of check_parameters.f90 where 2d/3d output quantities are checked |
user_check_data_output |
Here the physical unit(s) of user-defined 2d/3d output quantities (see data_output_user) have to be set. Input parameter variable contains the string identifier of the respective variable. For those variables not recognized by the user, the parameter unit is set to illegal, which tells the calling routine that the output variable is not defined and leads to a program abort. |
End of check_parameters.f90 where vertical profile output quantities are checked |
user_check_data_output _pr(variable, |
Here the physical unit(s) and vertical grid (u- or w-grid) of user-defined vertical profile output quantities (see data_output_pr_user) have to be set. Input parameter variable contains the string identifier of the respective variable. Parameter var_count contains the internal profile number and must not be changed by the user. For those variables not recognized by the user, the parameter unit is set to "illegal", which tells the calling routine that the output variable is not defined and leads to a program abort. |
netcdf_interface_mod.f90 (6 times) where the vertical grid coordinates for cross sections and volume data are defined |
user_define_netcdf_grid |
Set the grid on which user-defined output quantities (see data_output_user) are defined. Input parameter variable contains the string identifier of the respective variable. Allowed values are 'x' and 'xu' for grid_x, 'y' and 'yv' for grid_y, and 'zu' and 'zw' for grid_z. The output parameter found has to be set .TRUE. by the user, otherwise, an error message will appear in the job protocol for the respective output quantity. Example: If an output quantity is defined at the center of the grid boxes, the following settings have to be used: grid_x = 'x' grid_y = 'y' grid_z = 'zu' found = .TRUE. For defining an output quantity at the grid points where the u-velocity-component is defined, please use grid_x = 'xu' grid_y = 'y' grid_z = 'zu' found = .TRUE. See User-defined output quantities about creating user-defined output quantities. |
Middle of data_output_2d.f90 |
user_data_output_2d |
Resorts user-defined quantities (to be output as cross-section data; see data_output_user) with indices (k,j,i) to a temporary array local_pf with indices (i,j,k) and sets the grid on which they are defined. Depending on the value of input parameter av resorting is done for instantaneous (av=0) or time averaged data (av=1). Input parameter variable contains the string identifier of the respective variable. Allowed values for grid are 'zu' and 'zw'. The output parameter found has to be set .TRUE. by the user, otherwise, an error message will appear in the job protocol for the respective output quantity. |
data_output_3d.f90 at the end of the CASE structure |
user_data_output_3d |
Resorts user-defined quantities (to be output as volume data; see data_output_user) with indices (k,j,i) to a temporary array local_pf with indices (i,j,k) and sets the grid on which they are defined. Depending on the value of input parameter av resorting is done for instantaneous (av=0) or time averaged data (av=1). Input parameter variable contains the string identifier of the respective variable. The input parameter nz_do defines the upper limit of vertical grid index k of the output array (see nz_do3d. The output parameter found has to be set .TRUE. by the user, otherwise, an error message will appear in the job protocol for the respective output quantity. |
data_output_mask.f90 at the end of the CASE structure |
user_data_output_mask |
Resorts user-defined quantities (to be output as masked data; see data_output_masks_user) with indices (k,j,i) to a temporary array local_pf with indices (i,j,k) and sets the grid on which they are defined. Depending on the value of input parameter av resorting is done for instantaneous (av=0) or time averaged data (av=1). Input parameter variable contains the string identifier of the respective variable. The output parameter found has to be set .TRUE. by the user, otherwise an error message will appear in the job protocol for the respective output quantity. |
End of average_3d_data.f90, middle and end of sum_up_3d_data.f90 |
user_3d_data_averaging |
Sum up and time-average of user-defined output quantities (see data_output_user) as well as allocation of the arrays necessary for storing the respective averages. Input parameter variable contains the string identifier of the respective variable. Depending on the requested action, input parameter mode has the value 'allocate', 'sum', or 'average'. |
End of palm.f90 | user_last_actions | User-defined actions which are to be executed at the end of a model run. When user_last_actions is called all model actions are already completed, but the files opened by the model are not closed yet and possibly terminating actions for these files (see subroutine of close_files) are also not carried out yet. CPU time for user_last_actions appears in the local file CPU_MEASURES within the category "last actions" (the time necessary for close_files is included). |
Not called in the default PALM code |
user_additional | This routine may contain additional routines defined by the user to be called from other user interface routines. |