== Definition of user-defined subdomains == By default, the values of the timeseries quantities and the horizontally averaged vertical profiles always refer to the total model domain. Independently, up to 9 time series or profiles for different user-defined subdomains can be computed and plotted additionally. Steering in principle is done via the initialization parameter [../../inipar#statistic_regions statistic_regions].\\\\ The exact definition of these subdomains has to be made by the user within the user-defined subroutine [../int#user_init user_init]. The subdomains are defined with a mask array named {{{rmask}}}, which has to be given the value ''1.0'' for all horizontal grid points belonging to the user-defined subdomain and the value ''0.0'', where grid points do not belong to the user-defined subdomain. In the model {{{rmask}}} is declared as: {{{ REAL :: rmask(nysd:nynd,nxld:nxrd,0:9) . }}} The first two indices denote the array bounds (including the ghost points) in y and x-direction for each subdomain (see the corresponding description of [../../parallel#parallelization Parallelization]; don't confuse this with the user-defined subdomain!). The third index determines the user-defined subdomain, where 0 indicates the total model domain and ''1'' to ''9'' the user-defined subdomains.\\\\ The following example should illustrate this. Two subdomains are defined by the user. The first is determined by all grid points which lie within a circle whose center is equal to the (horizontal) center of the model domain and whose diameter is equal to half of the total horizontal domain size (square total domain assumed). The second subdomain should be defined by all points outside of this domain. This may be obtained by the following lines of code in [../int#user_init user_init]: {{{ USE grid_variables USE indices USE statistics . . . disc_center_x = dx * (nx + 1)/2 disc_center_y = dy * (ny + 1)/2 disc_radius = 0.5 * disc_center_x DO i = nxld, nxrd x = i * dx DO j = nysd, nynd y = j * dy radial_distance = SQRT( ( x - disc_center_x )**2 + & ( y - disc_center_y )**2 ) IF ( radial_distance > disc_radius ) THEN rmask(j,i,1) = 0.0 rmask(j,i,2) = 1.0 ELSE rmask(j,i,1) = 1.0 rmask(j,i,2) = 0.0 ENDIF ENDDO ENDDO }}} The module {{{statistics}}} must be used, because it contains {{{rmask}}} and the modules {{{grid_variables}}} and {{{indices}}} are necessary in this example, because grid spacing and indices are used. All array elements of {{{rmask}}} ({{{rmask(:,:,:)}}} are preset by the model with ''1.0''. In no case this assignment must be changed for the total domain ({{{rmask(:,:,0)}}})! Computations and output for the user-defined subdomains only take place if the user sets [../../inipar#statistic_regions statistic_regions] ≥ ''1''. Beyond that, names for the user-defined subdomains can be assigned via the initialization parameter [../../userpar#region region]. Output of the names of the selected user-defined subdomains happens in the local files [../../iofiles#HEADER HEADER] and [../../iofiles#RUN_CONTROL RUN_CONTROL] within the user-defined subroutine [../int#user_header user_header].