Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 3746)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 3747)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Move initialization of rmask before initializing user_init_arrays
+! 
+! 3711 2019-01-31 13:44:26Z knoop
 ! Introduced module_interface_init_checks for post-init checks in modules
 ! 
@@ -761,5 +764,11 @@
        ALLOCATE( pt_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
     ENDIF
-
+!
+!-- Pre-set masks for regional statistics. Default is the total model domain.
+!-- Ghost points are excluded because counting values at the ghost boundaries
+!-- would bias the statistics
+    rmask = 1.0_wp
+    rmask(:,nxlg:nxl-1,:) = 0.0_wp;  rmask(:,nxr+1:nxrg,:) = 0.0_wp
+    rmask(nysg:nys-1,:,:) = 0.0_wp;  rmask(nyn+1:nyng,:,:) = 0.0_wp
 !
 !-- Following array is required for perturbation pressure within the iterative
@@ -2021,9 +2030,10 @@
 
 !
-!-- Before initializing further modules, compute total sum of active mask 
-!-- grid points and the mean surface level height for each statistic region.
+!-- Compute total sum of grid points and the mean surface level height for each
+!-- statistic region. These are mainly used for horizontal averaging of
+!-- turbulence statistics.
 !-- ngp_2dh: number of grid points of a horizontal cross section through the
-!--          total domain
-!-- ngp_3d:  number of grid points of the total domain
+!--          respective statistic region
+!-- ngp_3d:  number of grid points of the respective statistic region
     ngp_2dh_outer_l   = 0
     ngp_2dh_outer     = 0
@@ -2039,11 +2049,4 @@
     mean_surface_level_height   = 0.0_wp
     mean_surface_level_height_l = 0.0_wp
-!
-!-- Pre-set masks for regional statistics. Default is the total model domain.
-!-- Ghost points are excluded because counting values at the ghost boundaries
-!-- would bias the statistics
-    rmask = 1.0_wp
-    rmask(:,nxlg:nxl-1,:) = 0.0_wp;  rmask(:,nxr+1:nxrg,:) = 0.0_wp
-    rmask(nysg:nys-1,:,:) = 0.0_wp;  rmask(nyn+1:nyng,:,:) = 0.0_wp
 !
 !-- To do: New concept for these non-topography grid points!
@@ -2103,9 +2106,5 @@
        ENDDO
     ENDDO
-!
-!-- Initialize arrays encompassing number of grid-points in inner and outer
-!-- domains, statistic regions, etc. Mainly used for horizontal averaging
-!-- of turbulence statistics. Please note, user_init must be called before
-!-- doing this.   
+
     sr = statistic_regions + 1
 #if defined( __parallel )
Index: palm/trunk/SOURCE/module_interface.f90
===================================================================
--- palm/trunk/SOURCE/module_interface.f90	(revision 3746)
+++ palm/trunk/SOURCE/module_interface.f90	(revision 3747)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Call user_init_arrays
+! 
+! 3745 2019-02-15 18:57:56Z suehring
 ! Add indoor model
 ! 
@@ -306,4 +309,5 @@
               user_check_data_output,                                          &
               user_init,                                                       &
+              user_init_arrays,                                                &
               user_header,                                                     &
               user_actions,                                                    &
@@ -749,4 +753,5 @@
    IF ( surface_output      )  CALL surface_data_output_init_arrays
    IF ( wind_turbine        )  CALL wtm_init_arrays
+   IF ( user_module_enabled )  CALL user_init_arrays
 
 
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 3746)
+++ palm/trunk/SOURCE/modules.f90	(revision 3747)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! ------------------
-! Initialized parameter region
+! 
 ! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Initialized parameter region
+! 
+! 3746 2019-02-16 12:41:27Z gronemeier
 ! Removed most_method
 ! 
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 3746)
+++ palm/trunk/SOURCE/parin.f90	(revision 3747)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! -----------------
-! removed setting of parameter region
+! 
 ! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! removed setting of parameter region
+! 
+! 3746 2019-02-16 12:41:27Z gronemeier
 ! Removed most_method
 ! 
Index: palm/trunk/SOURCE/user_module.f90
===================================================================
--- palm/trunk/SOURCE/user_module.f90	(revision 3746)
+++ palm/trunk/SOURCE/user_module.f90	(revision 3747)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Add routine user_init_arrays
+! 
+! 3703 2019-01-29 16:43:53Z knoop
 ! An example for a user defined global variable has been added (Giersch)
 ! 
@@ -120,4 +123,5 @@
        user_define_netcdf_grid, &
        user_init, &
+       user_init_arrays, &
        user_header, &
        user_actions, &
@@ -160,9 +164,12 @@
        MODULE PROCEDURE user_define_netcdf_grid
     END INTERFACE user_define_netcdf_grid
-    
 
     INTERFACE user_init
        MODULE PROCEDURE user_init
     END INTERFACE user_init
+
+    INTERFACE user_init_arrays
+       MODULE PROCEDURE user_init_arrays
+    END INTERFACE user_init_arrays
 
     INTERFACE user_header
@@ -433,4 +440,43 @@
 ! Description:
 ! ------------
+!> Initialize user-defined arrays
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_init_arrays
+
+
+    INTEGER(iwp) :: i       !< loop index
+    INTEGER(iwp) :: j       !< loop index
+    INTEGER(iwp) :: region  !< index for loop over statistic regions
+
+!
+!-- Allocate user-defined arrays and set flags for statistic regions.
+!-- Sample for user-defined output
+!    ALLOCATE( u2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+!    ALLOCATE( ustvst(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+
+!
+!-- Example for defining a statistic region:
+!     IF ( statistic_regions >= 1 )  THEN
+!        region = 1
+! 
+!        rmask(:,:,region) = 0.0_wp
+!        DO  i = nxl, nxr
+!           IF ( i >= INT( 0.25 * nx ) .AND. i <= INT( 0.75 * nx ) )  THEN
+!              DO  j = nys, nyn
+!                 IF ( i >= INT( 0.25 * ny ) .AND. i <= INT( 0.75 * ny ) )  THEN
+!                    rmask(j,i,region) = 1.0_wp
+!                 ENDIF
+!              ENDDO
+!           ENDIF
+!        ENDDO
+! 
+!     ENDIF
+
+ END SUBROUTINE user_init_arrays
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
 !> Execution of user-defined initializing actions
 !------------------------------------------------------------------------------!
@@ -442,6 +488,5 @@
 !-- Here the user-defined initializing actions follow:
 !-- Sample for user-defined output
-!    ALLOCATE( u2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-!    ALLOCATE( ustvst(nzb:nzt+1,nysg:nyng,nxlg:nxrg) );  ustvst = 0.0_wp
+!    ustvst = 0.0_wp
 
 
