Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 3686)
+++ palm/trunk/SOURCE/Makefile	(revision 3687)
@@ -688,12 +688,4 @@
 	turbulence_closure_mod.f90 \
 	urban_surface_mod.f90 \
-	user_3d_data_averaging.f90 \
-	user_actions.f90 \
-	user_additional_routines.f90 \
-	user_check_data_output.f90 \
-	user_check_data_output_pr.f90 \
-	user_check_parameters.f90 \
-	user_data_output_2d.f90 \
-	user_data_output_3d.f90 \
 	user_data_output_dvrp.f90 \
 	user_data_output_mask.f90 \
@@ -701,7 +693,5 @@
 	user_dvrp_coltab.f90 \
 	user_flight.f90\
-	user_header.f90 \
 	user_init_3d_model.f90 \
-	user_init.f90 \
 	user_init_flight.f90 \
 	user_init_grid.f90 \
@@ -710,14 +700,9 @@
 	user_init_radiation.f90 \
 	user_init_urban_surface.f90 \
-	user_last_actions.f90 \
 	user_lpm_advec.f90 \
 	user_lpm_init.f90 \
 	user_lpm_set_attributes.f90 \
 	user_module.f90 \
-	user_parin.f90 \
-	user_read_restart_data_mod.f90 \
 	user_spectra.f90 \
-	user_statistics.f90 \
-	user_write_restart_data_mod.f90 \
 	vertical_nesting_mod.f90 \
 	virtual_flight_mod.f90 \
@@ -874,6 +859,5 @@
 	netcdf_data_input_mod.o \
 	radiation_model_mod.o \
-	surface_mod.o \
-	user_module.o
+	surface_mod.o
 chem_gasphase_mod.o: \
 	mod_kinds.o \
@@ -1125,10 +1109,8 @@
 init_masks.o: \
 	bulk_cloud_model_mod.o \
-	chemistry_model_mod.o \
-	mod_kinds.o \
-	modules.o \
-	netcdf_interface_mod.o \
-	radiation_model_mod.o \
-	salsa_mod.o
+	mod_kinds.o \
+	module_interface.o \
+	modules.o \
+	netcdf_interface_mod.o
 init_pegrid.o: \
 	mod_kinds.o \
@@ -1330,7 +1312,5 @@
 	synthetic_turbulence_generator_mod.o \
 	urban_surface_mod.o \
-	user_actions.o \
-	user_read_restart_data_mod.o \
-	user_write_restart_data_mod.o \
+	user_module.o \
 	virtual_flight_mod.o \
 	virtual_measurement_mod.o \
@@ -1405,4 +1385,5 @@
 	land_surface_model_mod.o \
 	mod_kinds.o \
+	module_interface.o \
 	modules.o \
 	multi_agent_system_mod.o \
@@ -1421,4 +1402,5 @@
 	model_1d_mod.o \
 	mod_kinds.o \
+	module_interface.o \
 	modules.o \
 	netcdf_interface_mod.o \
@@ -1761,39 +1743,4 @@
 	radiation_model_mod.o \
 	surface_mod.o
-user_3d_data_averaging.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
-user_actions.o: \
-	cpulog_mod.o \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
-user_additional_routines.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
-user_check_data_output.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
-user_check_data_output_pr.o: \
-	mod_kinds.o \
-	modules.o \
-	netcdf_interface_mod.o \
-	user_module.o
-user_check_parameters.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
-user_data_output_2d.o: \
-	mod_kinds.o \
-	modules.o \
-	surface_mod.o \
-	user_module.o
-user_data_output_3d.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
 user_data_output_mask.o: \
 	mod_kinds.o \
@@ -1817,13 +1764,4 @@
 	modules.o \
 	user_module.o
-user_header.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
-user_init.o: \
-	mod_kinds.o \
-	modules.o \
-	netcdf_interface_mod.o \
-	user_module.o
 user_init_3d_model.o: \
 	mod_kinds.o \
@@ -1863,8 +1801,4 @@
 	urban_surface_mod.o \
 	user_module.o
-user_last_actions.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
 user_lpm_advec.o: \
 	mod_kinds.o \
@@ -1880,23 +1814,12 @@
 	user_module.o
 user_module.o: \
-	mod_kinds.o
-user_parin.o: \
-	mod_kinds.o \
-	modules.o \
-	user_module.o
-user_read_restart_data_mod.o: \
-	modules.o \
-	user_module.o
+	mod_kinds.o \
+	modules.o \
+	netcdf_interface_mod.o \
+	surface_mod.o
 user_spectra.o: \
 	mod_kinds.o \
 	modules.o \
 	spectra_mod.o \
-	user_module.o
-user_statistics.o: \
-	mod_kinds.o \
-	modules.o \
-	netcdf_interface_mod.o \
-	user_module.o
-user_write_restart_data_mod.o: \
 	user_module.o
 vertical_nesting_mod.o: \
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 3686)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 3687)
@@ -2629,6 +2629,4 @@
     USE pegrid
     USE statistics
-
-    USE user
 
     IMPLICIT NONE
Index: palm/trunk/SOURCE/init_masks.f90
===================================================================
--- palm/trunk/SOURCE/init_masks.f90	(revision 3686)
+++ palm/trunk/SOURCE/init_masks.f90	(revision 3687)
@@ -164,7 +164,4 @@
     USE bulk_cloud_model_mod,                                                  &
         ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert
-
-    USE chemistry_model_mod,                                                   &
-        ONLY:  chem_check_data_output
 
     USE control_parameters,                                                    &
@@ -190,4 +187,7 @@
     USE kinds
 
+    USE module_interface,                                                      &
+        ONLY:  module_interface_init_masks
+
     USE netcdf_interface,                                                      &
         ONLY:  domask_unit, netcdf_data_format
@@ -196,11 +196,5 @@
         ONLY:  particle_advection
 
-    USE pegrid  
-    
-    USE radiation_model_mod,                                                   &
-        ONLY:  radiation_check_data_output
-        
-    USE salsa_mod,                                                             &
-        ONLY:  salsa_check_data_output 
+    USE pegrid
 
     IMPLICIT NONE
@@ -494,19 +488,7 @@
 
              CASE DEFAULT
-             
-                CALL user_check_data_output( var, unit )
-                           
-                IF ( salsa )  THEN
-                   CALL salsa_check_data_output( var, unit )
-                ENDIF               
-
-                IF ( unit == 'illegal'  .AND.  air_chemistry                   &
-                     .AND.  (var(1:3) == 'kc_' .OR. var(1:3) == 'em_') )  THEN
-                   CALL chem_check_data_output( var, unit, 0, 0, 0 )
-                ENDIF
-
-                IF ( unit == 'illegal' )  THEN
-                   CALL radiation_check_data_output( var, unit, 0, 0, 0 )
-                ENDIF
+!
+!--             Allocate arrays for other modules
+                CALL module_interface_init_masks( var, unit )
 
                 IF ( unit == 'illegal' )  THEN
Index: palm/trunk/SOURCE/module_interface.f90
===================================================================
--- palm/trunk/SOURCE/module_interface.f90	(revision 3686)
+++ palm/trunk/SOURCE/module_interface.f90	(revision 3687)
@@ -268,14 +268,21 @@
               usm_wrd_local
 
-   USE user_actions_mod,                                                       &
-       ONLY:  user_actions
-
-   USE user_read_restart_data_mod,                                             &
-       ONLY:  user_rrd_global,                                                 &
-              user_rrd_local
-
-   USE user_write_restart_data_mod,                                            &
-       ONLY:  user_wrd_global,                                                 &
-              user_wrd_local
+   USE user,                                                                   &
+       ONLY:  user_parin,                                                      &
+              user_check_parameters,                                           &
+              user_check_data_output_pr,                                       &
+              user_check_data_output,                                          &
+              user_init,                                                       &
+              user_header,                                                     &
+              user_actions,                                                    &
+              user_3d_data_averaging,                                          &
+              user_data_output_2d,                                             &
+              user_data_output_3d,                                             &
+              user_statistics,                                                 &
+              user_rrd_global,                                                 &
+              user_rrd_local,                                                  &
+              user_wrd_global,                                                 &
+              user_wrd_local,                                                  &
+              user_last_actions
 
    USE virtual_measurement_mod,                                                &
@@ -302,4 +309,5 @@
       module_interface_check_data_output_pr,                                   &
       module_interface_check_data_output,                                      &
+      module_interface_init_masks,                                             &
       module_interface_define_netcdf_grid,                                     &
       module_interface_init_arrays,                                            &
@@ -315,5 +323,6 @@
       module_interface_wrd_global,                                             &
       module_interface_rrd_local,                                              &
-      module_interface_wrd_local
+      module_interface_wrd_local,                                              &
+      module_interface_last_actions
 
 
@@ -333,4 +342,8 @@
       MODULE PROCEDURE module_interface_check_data_output
    END INTERFACE module_interface_check_data_output
+
+   INTERFACE module_interface_init_masks
+      MODULE PROCEDURE module_interface_init_masks
+   END INTERFACE module_interface_init_masks
 
    INTERFACE module_interface_define_netcdf_grid
@@ -390,4 +403,8 @@
       MODULE PROCEDURE module_interface_wrd_local
    END INTERFACE module_interface_wrd_local
+
+   INTERFACE module_interface_last_actions
+      MODULE PROCEDURE module_interface_last_actions
+   END INTERFACE module_interface_last_actions
 
 
@@ -499,5 +516,5 @@
    ENDIF
 
-   IF ( unit == 'illegal' )  THEN
+   IF ( unit == 'illegal'  .AND.  radiation )  THEN
       CALL radiation_check_data_output_pr( variable, var_count, unit, dopr_unit )
    ENDIF
@@ -557,5 +574,5 @@
    ENDIF
 
-   IF ( unit == 'illegal' )  THEN
+   IF ( unit == 'illegal'  .AND.  radiation )  THEN
       CALL radiation_check_data_output( variable, unit, i, ilen, k )
    ENDIF
@@ -577,4 +594,38 @@
 
 END SUBROUTINE module_interface_check_data_output
+
+
+!------------------------------------------------------------------------------!
+!
+! Description:
+! ------------
+!> Interface for init_masks. ToDo: get rid of these redundant calls!
+!------------------------------------------------------------------------------!
+SUBROUTINE module_interface_init_masks( variable, unit )
+
+
+   CHARACTER (LEN=*), INTENT(IN)    ::  variable !< variable name
+   CHARACTER (LEN=*), INTENT(INOUT) ::  unit     !< physical unit of variable
+
+   IF ( unit == 'illegal'  .AND.  air_chemistry                                &
+        .AND.  (variable(1:3) == 'kc_' .OR. variable(1:3) == 'em_') )  THEN  ! ToDo: remove aditional conditions
+      CALL chem_check_data_output( variable, unit, 0, 0, 0 )
+   ENDIF
+
+   IF ( unit == 'illegal'  .AND.  radiation )  THEN
+      CALL radiation_check_data_output( variable, unit, 0, 0, 0 )
+   ENDIF
+
+   IF ( unit == 'illegal'  .AND.  salsa )  THEN
+      CALL salsa_check_data_output( variable, unit )
+   ENDIF
+
+   IF ( unit == 'illegal' )  THEN
+      unit = ''
+      CALL user_check_data_output( variable, unit )
+   ENDIF
+
+
+END SUBROUTINE module_interface_init_masks
 
 
@@ -650,4 +701,5 @@
    IF ( wind_turbine        )  CALL wtm_init
    IF ( radiation           )  CALL radiation_init
+                               CALL user_init
 
 
@@ -1142,3 +1194,17 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Perform module-specific last actions before the program terminates
+!------------------------------------------------------------------------------!
+SUBROUTINE module_interface_last_actions
+
+
+   CALL user_last_actions ! ToDo: make user module switch
+
+
+END SUBROUTINE module_interface_last_actions
+
+
 END MODULE module_interface
Index: palm/trunk/SOURCE/palm.f90
===================================================================
--- palm/trunk/SOURCE/palm.f90	(revision 3686)
+++ palm/trunk/SOURCE/palm.f90	(revision 3687)
@@ -295,4 +295,7 @@
 
     USE kinds
+
+    USE module_interface,                                                      &
+        ONLY:  module_interface_last_actions
 
     USE multi_agent_system_mod,                                                &
@@ -560,16 +563,17 @@
     IF ( myid == 0 )  CALL header
 !
-!-- If required, final  user-defined actions, and
-!-- last actions on the open files and close files. Unit 14 was opened
-!-- in wrd_local but it is closed here, to allow writing on this
-!-- unit in routine user_last_actions.
+!-- Perform module specific last actions
     CALL cpu_log( log_point(4), 'last actions', 'start' )
 
-    IF ( myid == 0 .AND. agents_active ) CALL mas_last_actions
-    CALL user_last_actions
+    IF ( myid == 0 .AND. agents_active ) CALL mas_last_actions ! ToDo: move to module_interface
+
+    CALL module_interface_last_actions
+
+    CALL cpu_log( log_point(4), 'last actions', 'stop' )
+
+!
+!-- Close files
     CALL close_file( 0 )
     CALL close_dvrp
-
-    CALL cpu_log( log_point(4), 'last actions', 'stop' )
 
 !
Index: palm/trunk/SOURCE/user_3d_data_averaging.f90
===================================================================
--- palm/trunk/SOURCE/user_3d_data_averaging.f90	(revision 3686)
+++ 	(revision )
@@ -1,157 +1,0 @@
-!> @file user_3d_data_averaging.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Further allocation checks implemented
-! 
-! 2718 2018-01-02 08:49:38Z maronga
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1353 2014-04-08 15:21:23Z heinze
-! REAL constants provided with KIND-attribute
-!
-! 1322 2014-03-20 16:38:49Z raasch
-! REAL functions provided with KIND-attribute
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Sum up and time-average user-defined output quantities as well as allocate
-!> the array necessary for storing the average.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_3d_data_averaging( mode, variable )
- 
-
-    USE control_parameters
-
-    USE indices
-
-    USE kinds
-
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=*) ::  mode    !< 
-    CHARACTER (LEN=*) :: variable !< 
-
-    INTEGER(iwp) ::  i !< 
-    INTEGER(iwp) ::  j !< 
-    INTEGER(iwp) ::  k !< 
-
-    IF ( mode == 'allocate' )  THEN
-
-       SELECT CASE ( TRIM( variable ) )
-
-!
-!--       Uncomment and extend the following lines, if necessary.
-!--       The arrays for storing the user defined quantities (here u2_av) have
-!--       to be declared and defined by the user!
-!--       Sample for user-defined output:
-!          CASE ( 'u2' )
-!             IF ( .NOT. ALLOCATED( u2_av ) )  THEN
-!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-!             ENDIF
-!             u2_av = 0.0_wp
-
-          CASE DEFAULT
-             CONTINUE
-
-       END SELECT
-
-    ELSEIF ( mode == 'sum' )  THEN
-
-       SELECT CASE ( TRIM( variable ) )
-
-!
-!--       Uncomment and extend the following lines, if necessary.
-!--       The arrays for storing the user defined quantities (here u2 and
-!--       u2_av) have to be declared and defined by the user!
-!--       Sample for user-defined output:
-!          CASE ( 'u2' )
-!             IF ( ALLOCATED( u2_av ) ) THEN
-!                DO  i = nxlg, nxrg
-!                   DO  j = nysg, nyng
-!                      DO  k = nzb, nzt+1
-!                         u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i)
-!                      ENDDO
-!                   ENDDO
-!                ENDDO
-!             ENDIF
-
-          CASE DEFAULT
-             CONTINUE
-
-       END SELECT
-
-    ELSEIF ( mode == 'average' )  THEN
-
-       SELECT CASE ( TRIM( variable ) )
-
-!
-!--       Uncomment and extend the following lines, if necessary.
-!--       The arrays for storing the user defined quantities (here u2_av) have
-!--       to be declared and defined by the user!
-!--       Sample for user-defined output:
-!          CASE ( 'u2' )
-!             IF ( ALLOCATED( u2_av ) ) THEN
-!                DO  i = nxlg, nxrg
-!                   DO  j = nysg, nyng
-!                      DO  k = nzb, nzt+1
-!                         u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp )
-!                      ENDDO
-!                   ENDDO
-!                ENDDO
-!             ENDIF
-
-       END SELECT
-
-    ENDIF
-
-
- END SUBROUTINE user_3d_data_averaging
Index: palm/trunk/SOURCE/user_actions.f90
===================================================================
--- palm/trunk/SOURCE/user_actions.f90	(revision 3686)
+++ 	(revision )
@@ -1,266 +1,0 @@
-!> @file user_actions.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! ------------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1960 2016-07-12 16:34:24Z suehring
-! New CASE statement for scalar tendency
-! 
-! 1873 2016-04-18 14:50:06Z maronga
-! Module renamed (removed _mod)
-! 
-! 
-! 1850 2016-04-08 13:29:27Z maronga
-! Module renamed
-!
-! 
-! 1822 2016-04-07 07:49:42Z hoffmann
-! qr/nr-tendency removed.
-!
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1353 2014-04-08 15:21:23Z heinze
-! REAL constants provided with KIND-attribute
-! 
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
-!
-! 1053 2012-11-13 17:11:03Z hoffmann
-! +qr-tendency, nr-tendency
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Execution of user-defined actions before or after single timesteps
-!------------------------------------------------------------------------------!
- MODULE user_actions_mod
- 
-
-    PRIVATE
-    PUBLIC user_actions
-
-    INTERFACE user_actions
-       MODULE PROCEDURE user_actions
-       MODULE PROCEDURE user_actions_ij
-    END INTERFACE user_actions
-
- CONTAINS
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for all grid points
-!------------------------------------------------------------------------------!
-    SUBROUTINE user_actions( location )
-
-       USE control_parameters
-
-       USE cpulog
-
-       USE indices
-
-       USE kinds
-
-       USE pegrid
-
-       USE user
-
-       USE arrays_3d
-
-       IMPLICIT NONE
-
-       CHARACTER (LEN=*) ::  location !< 
-
-       INTEGER(iwp) ::  i !< 
-       INTEGER(iwp) ::  j !< 
-       INTEGER(iwp) ::  k !< 
-
-       CALL cpu_log( log_point(24), 'user_actions', 'start' )
-
-!
-!--    Here the user-defined actions follow
-!--    No calls for single grid points are allowed at locations before and
-!--    after the timestep, since these calls are not within an i,j-loop
-       SELECT CASE ( location )
-
-          CASE ( 'before_timestep' )
-!
-!--          Enter actions to be done before every timestep here
-
-
-          CASE ( 'after_integration' )
-!
-!--          Enter actions to be done after every time integration (before
-!--          data output)
-!--          Sample for user-defined output:
-!             DO  i = nxlg, nxrg
-!                DO  j = nysg, nyng
-!                   DO  k = nzb, nzt
-!                      u2(k,j,i) = u(k,j,i)**2
-!                   ENDDO
-!                ENDDO
-!             ENDDO
-!             DO  i = nxlg, nxr
-!                DO  j = nysg, nyn
-!                   DO  k = nzb, nzt+1
-!                      ustvst(k,j,i) =  &
-!                         ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * &
-!                         ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) )
-!                   ENDDO
-!                ENDDO
-!             ENDDO
-
-
-          CASE ( 'after_timestep' )
-!
-!--          Enter actions to be done after every timestep here
-
-
-          CASE ( 'u-tendency' )
-!
-!--          Enter actions to be done in the u-tendency term here
-
-
-          CASE ( 'v-tendency' )
-
-
-          CASE ( 'w-tendency' )
-
-
-          CASE ( 'pt-tendency' )
-
-
-          CASE ( 'sa-tendency' )
-
-
-          CASE ( 'e-tendency' )
-
-
-          CASE ( 'q-tendency' )
-          
-          
-          CASE ( 's-tendency' )          
-
-
-          CASE DEFAULT
-             message_string = 'unknown location "' // location // '"'
-             CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 )
-
-       END SELECT
-
-       CALL cpu_log( log_point(24), 'user_actions', 'stop' )
-
-    END SUBROUTINE user_actions
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for grid point i,j
-!------------------------------------------------------------------------------!
-    SUBROUTINE user_actions_ij( i, j, location )
-
-       USE control_parameters
-       USE kinds
-       USE pegrid
-       USE user
-
-       IMPLICIT NONE
-
-       CHARACTER (LEN=*) ::  location
-
-       INTEGER(iwp) ::  i
-       INTEGER(iwp) ::  idum
-       INTEGER(iwp) ::  j
-
-!
-!--    Here the user-defined actions follow
-       SELECT CASE ( location )
-
-          CASE ( 'u-tendency' )
-!
-!--          Enter actions to be done in the u-tendency term here
-
-
-          CASE ( 'v-tendency' )
-
-
-          CASE ( 'w-tendency' )
-
-
-          CASE ( 'pt-tendency' )
-
-
-          CASE ( 'sa-tendency' )
-
-
-          CASE ( 'e-tendency' )
-
-
-          CASE ( 'q-tendency' )
-          
-          
-          CASE ( 's-tendency' )
-
-
-          CASE ( 'before_timestep', 'after_integration', 'after_timestep' )
-             message_string = 'location "' // location // '" is not ' // &
-                             'allowed to be called with parameters "i" and "j"'
-             CALL message( 'user_actions', 'UI0002', 1, 2, 0, 6, 0 )
-
-
-          CASE DEFAULT
-             message_string = 'unknown location "' // location // '"'
-             CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 )
-             
-
-       END SELECT
-
-    END SUBROUTINE user_actions_ij
-
- END MODULE user_actions_mod
Index: palm/trunk/SOURCE/user_additional_routines.f90
===================================================================
--- palm/trunk/SOURCE/user_additional_routines.f90	(revision 3686)
+++ 	(revision )
@@ -1,70 +1,0 @@
-!> @file user_additional_routines.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Initial version
-!
-! Description:
-! ------------
-!> This file may contain additional user-defined routines.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_dummy
- 
-
-    USE kinds
-
-    USE user
-
-    IMPLICIT NONE
-
-!
-!-- Here comes the code of the user-defined routine
-
- END SUBROUTINE user_dummy
-
Index: palm/trunk/SOURCE/user_check_data_output.f90
===================================================================
--- palm/trunk/SOURCE/user_check_data_output.f90	(revision 3686)
+++ 	(revision )
@@ -1,90 +1,0 @@
-!> @file user_check_data_output.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Set the unit of user defined output quantities. 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.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_check_data_output( variable, unit )
- 
-
-    USE kinds
-
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=*) ::  unit     !< 
-    CHARACTER (LEN=*) ::  variable !<
-
-
-    SELECT CASE ( TRIM( variable ) )
-
-!
-!--    Uncomment and extend the following lines, if necessary
-!       CASE ( 'u2' )
-!          unit = 'm2/s2'
-!
-!       CASE ( 'u*v*' )
-!          unit = 'm2/s2'
-!
-       CASE DEFAULT
-          unit = 'illegal'
-
-    END SELECT
-
-
- END SUBROUTINE user_check_data_output
-
Index: palm/trunk/SOURCE/user_check_data_output_pr.f90
===================================================================
--- palm/trunk/SOURCE/user_check_data_output_pr.f90	(revision 3686)
+++ 	(revision )
@@ -1,116 +1,0 @@
-!> @file user_check_data_output_pr.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-!
-! 1783 2016-03-06 18:36:17Z raasch
-! netcdf module name changed + relatec changes
-!
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Set the unit of user defined profile output quantities. 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.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_check_data_output_pr( variable, var_count, unit )
- 
-
-    USE arrays_3d
-
-    USE indices
-
-    USE kinds
-
-    USE netcdf_interface,                                                      &
-        ONLY:  dopr_unit
-
-    USE profil_parameter
-
-    USE statistics
-
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=*) ::  unit     !< 
-    CHARACTER (LEN=*) ::  variable !< 
-
-    INTEGER(iwp) ::  user_pr_index !< 
-    INTEGER(iwp) ::  var_count     !< 
-
-    SELECT CASE ( TRIM( variable ) )
-
-!
-!--    Uncomment and extend the following lines, if necessary.
-!--    Add additional CASE statements depending on the number of quantities
-!--    for which profiles are to be calculated. The respective calculations
-!--    to be performed have to be added in routine user_statistics.
-!--    The quantities are (internally) identified by a user-profile-number
-!--    (see variable "user_pr_index" below). The first user-profile must be assigned
-!--    the number "pr_palm+1", the second one "pr_palm+2", etc. The respective
-!--    user-profile-numbers have also to be used in routine user_statistics!
-!       CASE ( 'u*v*' )                      ! quantity string as given in
-!                                            ! data_output_pr_user
-!          user_pr_index = pr_palm + 1
-!          dopr_index(var_count)  = user_pr_index    ! quantities' user-profile-number
-!          dopr_unit(var_count)   = 'm2/s2'  ! quantity unit
-!          hom(:,2,user_pr_index,:)       = SPREAD( zu, 2, statistic_regions+1 )
-!                                            ! grid on which the quantity is
-!                                            ! defined (use zu or zw)
-
-       CASE DEFAULT
-          unit = 'illegal'
-
-    END SELECT
-
-
- END SUBROUTINE user_check_data_output_pr
-
Index: palm/trunk/SOURCE/user_check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/user_check_parameters.f90	(revision 3686)
+++ 	(revision )
@@ -1,74 +1,0 @@
-!> @file user_check_parameters.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 217 2008-12-09 18:00:48Z letzel
-! Initial version
-!
-! Description:
-! ------------
-!> Check &userpar control parameters and deduce further quantities.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_check_parameters
- 
-
-    USE control_parameters
-
-    USE kinds
-
-    USE user
-
-    IMPLICIT NONE
-
-!
-!-- Here the user may add code to check the validity of further &userpar 
-!-- control parameters or deduce further quantities.
-
-
- END SUBROUTINE user_check_parameters
-
Index: palm/trunk/SOURCE/user_data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/user_data_output_2d.f90	(revision 3686)
+++ 	(revision )
@@ -1,183 +1,0 @@
-!> @file user_data_output_2d.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Bugfix: domain bounds of local_pf corrected
-! 
-! 3004 2018-04-27 12:33:25Z Giersch
-! Further allocation checks implemented (averaged data will be assigned to fill
-! values if no allocation happened so far)
-! 
-! 2718 2018-01-02 08:49:38Z maronga
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2512 2017-10-04 08:26:59Z raasch
-! ghost layer points removed from output array local_pf
-! 
-! 2233 2017-05-30 18:08:54Z suehring
-!
-! 2232 2017-05-30 17:47:52Z suehring
-! Example code added for accessing output quantities stored on surface-data
-! types
-! 
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1551 2015-03-03 14:18:16Z maronga
-! Replaced nzb and nzt+1 with the new array bounds nzb_do and nzt_do.
-! 
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Resorts the user-defined output quantity with indices (k,j,i) to a
-!> temporary array with indices (i,j,k) and sets the grid on which it is defined.
-!> Allowed values for grid are "zu" and "zw".
-!------------------------------------------------------------------------------!
- SUBROUTINE user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do )
- 
-
-    USE indices
-
-    USE kinds
-
-    USE surface_mod
-
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=*) ::  grid     !< 
-    CHARACTER (LEN=*) ::  variable !< 
-
-    INTEGER(iwp) ::  av     !< flag to control data output of instantaneous or time-averaged data
-    INTEGER(iwp) ::  i      !< grid index along x-direction
-    INTEGER(iwp) ::  j      !< grid index along y-direction
-    INTEGER(iwp) ::  k      !< grid index along z-direction
-    INTEGER(iwp) ::  m      !< running index surface elements
-    INTEGER(iwp) ::  nzb_do !< lower limit of the domain (usually nzb)
-    INTEGER(iwp) ::  nzt_do !< upper limit of the domain (usually nzt+1)
-
-    LOGICAL      ::  found !< 
-    LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
-
-    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
-
-    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
-
-
-    found = .TRUE.
-
-    SELECT CASE ( TRIM( variable ) )
-
-!
-!--    Uncomment and extend the following lines, if necessary.
-!--    The arrays for storing the user defined quantities (here u2 and u2_av)
-!--    have to be declared and defined by the user!
-!--    Sample for user-defined output:
-!       CASE ( 'u2_xy', 'u2_xz', 'u2_yz' )
-!          IF ( av == 0 )  THEN
-!             DO  i = nxl, nxr
-!                DO  j = nys, nyn
-!                   DO  k = nzb_do, nzt_do
-!                      local_pf(i,j,k) = u2(k,j,i)
-!                   ENDDO
-!                ENDDO
-!             ENDDO
-!          ELSE
-!             IF ( .NOT. ALLOCATED( u2_av ) ) THEN
-!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-!                u2_av = REAL( fill_value, KIND = wp )
-!             ENDIF
-!             DO  i = nxl, nxr
-!                DO  j = nys, nyn
-!                   DO  k = nzb_do, nzt_do
-!                      local_pf(i,j,k) = u2_av(k,j,i)
-!                   ENDDO
-!                ENDDO
-!             ENDDO
-!          ENDIF
-!
-!          grid = 'zu'
-!
-!--    In case two-dimensional surface variables are output, the user
-!--    has to access related surface-type. Uncomment and extend following lines
-!--    appropriately (example output of vertical surface momentum flux of u-
-!--    component). Please note, surface elements can be distributed over 
-!--    several data type, depending on their respective surface properties.
-!       CASE ( 'usws_xy' )
-!          IF ( av == 0 )  THEN
-!
-!--           Horizontal default-type surfaces
-!             DO  m = 1, surf_def_h(0)%ns
-!                i = surf_def_h(0)%i(m)
-!                j = surf_def_h(0)%j(m)
-!                local_pf(i,j,1) = surf_def_h(0)%usws(m)
-!             ENDDO
-!
-!--           Horizontal natural-type surfaces
-!             DO  m = 1, surf_lsm_h%ns
-!                i = surf_lsm_h%i(m)
-!                j = surf_lsm_h%j(m)
-!                local_pf(i,j,1) = surf_lsm_h%usws(m)
-!             ENDDO
-!
-!--           Horizontal urban-type surfaces
-!             DO  m = 1, surf_usm_h%ns
-!                i = surf_usm_h%i(m)
-!                j = surf_usm_h%j(m)
-!                local_pf(i,j,1) = surf_usm_h%usws(m)
-!             ENDDO
-!          ENDIF
-!
-!          grid = 'zu'
-!--       
-
-
-       CASE DEFAULT
-          found = .FALSE.
-          grid  = 'none'
-
-    END SELECT
-
-
- END SUBROUTINE user_data_output_2d
Index: palm/trunk/SOURCE/user_data_output_3d.f90
===================================================================
--- palm/trunk/SOURCE/user_data_output_3d.f90	(revision 3686)
+++ 	(revision )
@@ -1,138 +1,0 @@
-!> @file user_data_output_3d.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! ------------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Further allocation checks implemented (averaged data will be assigned to fill
-! values if no allocation happened so far)
-! 
-! 2718 2018-01-02 08:49:38Z maronga
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2512 2017-10-04 08:26:59Z raasch
-! ghost layer points removed from output array local_pf
-! 
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1551 2015-03-03 14:18:16Z maronga
-! Replaced nzb and nzt+1 with the new array bounds nzb_do and nzt_do.
-! 
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements
-!
-! 1106 2013-03-04 05:31:38Z raasch
-! array_kind renamed precision_kind
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Resorts the user-defined output quantity with indices (k,j,i) to a
-!> temporary array with indices (i,j,k).
-!------------------------------------------------------------------------------!
- SUBROUTINE user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
- 
-
-    USE indices
-
-    USE kinds
-
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=*) ::  variable !< 
-
-    INTEGER(iwp) ::  av    !< 
-    INTEGER(iwp) ::  i     !< 
-    INTEGER(iwp) ::  j     !< 
-    INTEGER(iwp) ::  k     !< 
-    INTEGER(iwp) ::  nzb_do !< lower limit of the data output (usually 0)
-    INTEGER(iwp) ::  nzt_do !< vertical upper limit of the data output (usually nz_do3d)
-
-    LOGICAL      ::  found !< 
-
-    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
-
-    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
-
-
-    found = .TRUE.
-
-    SELECT CASE ( TRIM( variable ) )
-
-!
-!--    Uncomment and extend the following lines, if necessary.
-!--    The arrays for storing the user defined quantities (here u2 and u2_av)
-!--    have to be declared and defined by the user!
-!--    Sample for user-defined output:
-!       CASE ( 'u2' )
-!          IF ( av == 0 )  THEN
-!             DO  i = nxl, nxr
-!                DO  j = nys, nyn
-!                   DO  k = nzb_do, nzt_do
-!                      local_pf(i,j,k) = u2(k,j,i)
-!                   ENDDO
-!                ENDDO
-!             ENDDO
-!          ELSE
-!             IF ( .NOT. ALLOCATED( u2_av ) ) THEN
-!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-!                u2_av = REAL( fill_value, KIND = wp )
-!             ENDIF
-!             DO  i = nxl, nxr
-!                DO  j = nys, nyn
-!                   DO  k = nzb_do, nzt_do
-!                      local_pf(i,j,k) = u2_av(k,j,i)
-!                   ENDDO
-!                ENDDO
-!             ENDDO
-!          ENDIF
-!
-
-       CASE DEFAULT
-          found = .FALSE.
-
-    END SELECT
-
-
- END SUBROUTINE user_data_output_3d
-
Index: palm/trunk/SOURCE/user_header.f90
===================================================================
--- palm/trunk/SOURCE/user_header.f90	(revision 3686)
+++ 	(revision )
@@ -1,108 +1,0 @@
-!> @file user_header.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1551 2015-03-03 14:18:16Z maronga
-! Typo removed
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! ONLY-attribute added to USE-statements,
-! kind-parameters added to all INTEGER and REAL declaration statements, 
-! kinds are defined in new module kinds, 
-! old module precision_kind is removed,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 2008-12-09 18:00:48Z letzel
-! +topography_grid_convention
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Print a header with user-defined information.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_header( io )
- 
-
-    USE kinds
-    
-    USE statistics,                                                            &
-        ONLY:  statistic_regions, region
-        
-    USE user
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  i    !< 
-    INTEGER(iwp) ::  io   !< 
-
-!
-!-- If no user-defined variables are read from the namelist-file, no
-!-- information will be printed.
-    IF ( .NOT. user_defined_namelist_found )  THEN
-       WRITE ( io, 100 )
-       RETURN
-    ENDIF
-
-!
-!-- Printing the information.
-    WRITE ( io, 110 )
-
-    IF ( statistic_regions /= 0 )  THEN
-       WRITE ( io, 200 )
-       DO  i = 0, statistic_regions
-          WRITE ( io, 201 )  i, region(i)
-       ENDDO
-    ENDIF
-
-!
-!-- Format-descriptors
-100 FORMAT (//' *** no user-defined variables found'/)
-110 FORMAT (//1X,78('#')                                                       &
-            //' User-defined variables and actions:'/                          &
-              ' -----------------------------------'//)
-200 FORMAT (' Output of profiles and time series for following regions:' /)
-201 FORMAT (4X,'Region ',I1,':   ',A)
-
-
- END SUBROUTINE user_header
-
Index: palm/trunk/SOURCE/user_init.f90
===================================================================
--- palm/trunk/SOURCE/user_init.f90	(revision 3686)
+++ 	(revision )
@@ -1,105 +1,0 @@
-!> @file user_init.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1799 2016-04-05 08:35:55Z gronemeier
-! Bugfix: added dots_num to variable list
-!
-! 1783 2016-03-06 18:36:17Z raasch
-! netcdf module name changed + related changes
-!
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1353 2014-04-08 15:21:23Z heinze
-! REAL constants provided with KIND-attribute 
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Execution of user-defined initializing actions
-!------------------------------------------------------------------------------!
- SUBROUTINE user_init
- 
-
-    USE control_parameters
-    
-    USE indices
-    
-    USE kinds
-    
-    USE netcdf_interface,                                                      &
-        ONLY: dots_label, dots_unit, dots_num
-    
-    USE pegrid
-    
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=20) :: field_char   !< 
-!
-!-- 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
-
-!-- Sample for user-defined time series
-!-- For each time series quantity you have to give a label and a unit,
-!-- which will be used for the NetCDF file. They must not contain more than
-!-- seven characters. The value of dots_num has to be increased by the
-!-- number of new time series quantities. Its old value has to be store in
-!-- dots_num_palm. See routine user_statistics on how to output calculate
-!-- and output these quantities.
-!    dots_label(dots_num+1) = 'abs_umx'
-!    dots_unit(dots_num+1)  = 'm/s'
-!    dots_label(dots_num+2) = 'abs_vmx'
-!    dots_unit(dots_num+2)  = 'm/s'
-!
-!    dots_num_palm = dots_num
-!    dots_num = dots_num + 2
-
- END SUBROUTINE user_init
-
Index: palm/trunk/SOURCE/user_last_actions.f90
===================================================================
--- palm/trunk/SOURCE/user_last_actions.f90	(revision 3686)
+++ 	(revision )
@@ -1,76 +1,0 @@
-!> @file user_last_actions.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Writing of user-defined restart data will be done in an own module called
-! user_write_restart_data_mod 
-! 
-! 2718 2018-01-02 08:49:38Z suehring
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2298 2017-06-29 09:28:18Z raasch
-! type of write_binary changed from CHARACTER to LOGICAL
-! 
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! revision history before 2012 removed
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Execution of user-defined actions at the end of a job.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_last_actions
- 
-
-    USE control_parameters
-        
-    USE kinds
-    
-    USE user
-
-    IMPLICIT NONE
-
-!
-!-- Here the user-defined actions at the end of a job might follow.
-
-
- END SUBROUTINE user_last_actions
-
Index: palm/trunk/SOURCE/user_module.f90
===================================================================
--- palm/trunk/SOURCE/user_module.f90	(revision 3686)
+++ palm/trunk/SOURCE/user_module.f90	(revision 3687)
@@ -70,7 +70,24 @@
 !------------------------------------------------------------------------------!
  MODULE user
- 
+
+
+    USE arrays_3d
+
+    USE control_parameters
+
+    USE cpulog
+
+    USE indices
 
     USE kinds
+
+    USE pegrid
+
+    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  statistic_regions, region
+
+    USE surface_mod
 
     IMPLICIT NONE
@@ -93,3 +110,1034 @@
     SAVE
 
+!    PRIVATE
+
+!
+!- Public functions
+    PUBLIC &
+       user_parin, &
+       user_check_parameters, &
+       user_check_data_output_pr, &
+       user_check_data_output, &
+       user_init, &
+       user_header, &
+       user_actions, &
+       user_3d_data_averaging, &
+       user_data_output_2d, &
+       user_data_output_3d, &
+       user_statistics, &
+       user_rrd_global, &
+       user_rrd_local, &
+       user_wrd_global, &
+       user_wrd_local
+
+!
+!- Public parameters, constants and initial values
+!   PUBLIC &
+!      user_module_enabled
+
+    INTERFACE user_parin
+       MODULE PROCEDURE user_parin
+    END INTERFACE user_parin
+
+    INTERFACE user_check_parameters
+       MODULE PROCEDURE user_check_parameters
+    END INTERFACE user_check_parameters
+
+    INTERFACE user_check_data_output_pr
+       MODULE PROCEDURE user_check_data_output_pr
+    END INTERFACE user_check_data_output_pr
+
+    INTERFACE user_check_data_output
+       MODULE PROCEDURE user_check_data_output
+    END INTERFACE user_check_data_output
+
+    INTERFACE user_init
+       MODULE PROCEDURE user_init
+    END INTERFACE user_init
+
+    INTERFACE user_header
+       MODULE PROCEDURE user_header
+    END INTERFACE user_header
+
+    INTERFACE user_actions
+       MODULE PROCEDURE user_actions
+       MODULE PROCEDURE user_actions_ij
+    END INTERFACE user_actions
+
+    INTERFACE user_3d_data_averaging
+       MODULE PROCEDURE user_3d_data_averaging
+    END INTERFACE user_3d_data_averaging
+
+    INTERFACE user_data_output_2d
+       MODULE PROCEDURE user_data_output_2d
+    END INTERFACE user_data_output_2d
+
+    INTERFACE user_data_output_3d
+       MODULE PROCEDURE user_data_output_3d
+    END INTERFACE user_data_output_3d
+
+    INTERFACE user_statistics
+       MODULE PROCEDURE user_statistics
+    END INTERFACE user_statistics
+
+    INTERFACE user_rrd_global
+       MODULE PROCEDURE user_rrd_global
+    END INTERFACE user_rrd_global
+
+    INTERFACE user_rrd_local
+       MODULE PROCEDURE user_rrd_local
+    END INTERFACE user_rrd_local
+
+    INTERFACE user_wrd_global
+       MODULE PROCEDURE user_wrd_global
+    END INTERFACE user_wrd_global
+
+    INTERFACE user_wrd_local
+       MODULE PROCEDURE user_wrd_local
+    END INTERFACE user_wrd_local
+
+
+ CONTAINS
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Parin for &user_parameters for user module
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_parin
+
+
+    CHARACTER (LEN=80) ::  line   !< 
+
+    INTEGER(iwp) ::  i                 !< 
+    INTEGER(iwp) ::  j                 !< 
+
+
+    NAMELIST /userpar/  data_output_pr_user, data_output_user, region,         &
+                        data_output_masks_user
+                        
+                        
+    NAMELIST /user_parameters/  data_output_pr_user, data_output_user, region, &
+                        data_output_masks_user
+
+!
+!-- Set revision number of this default interface version. It will be checked within
+!-- the main program (palm). Please change the revision number in case that the
+!-- current revision does not match with previous revisions (e.g. if routines
+!-- have been added/deleted or if parameter lists in subroutines have been changed).
+    user_interface_current_revision = 'r3240'
+
+!
+!-- Position the namelist-file at the beginning (it was already opened in
+!-- parin), search for user-defined namelist-group ("userpar", but any other
+!-- name can be choosed) and position the file at this line.
+    REWIND ( 11 )
+
+    line = ' '
+    DO WHILE ( INDEX( line, '&user_parameters' ) == 0 )
+       READ ( 11, '(A)', END=12 )  line
+    ENDDO
+    BACKSPACE ( 11 )
+
+!
+!-- Read user-defined namelist
+    READ ( 11, user_parameters, ERR = 10 )
+
+    user_defined_namelist_found = .TRUE.
+
+    GOTO 14
+
+10  BACKSPACE( 11 )
+    READ( 11 , '(A)') line
+    CALL parin_fail_message( 'user_parameters', line )
+
+12  REWIND ( 11 )
+
+    line = ' ' 
+    DO WHILE ( INDEX( line, '&userpar' ) == 0 )
+       READ ( 11, '(A)', END=14 )  line
+    ENDDO
+    BACKSPACE ( 11 )
+
+!
+!-- Read user-defined namelist
+    READ ( 11, userpar, ERR = 13, END = 14 )
+
+    message_string = 'namelist userpar is deprecated and will be ' //          &
+                     'removed in near future. &Please use namelist ' //        &
+                     'user_parameters instead' 
+    CALL message( 'user_parin', 'PA0487', 0, 1, 0, 6, 0 )
+
+    user_defined_namelist_found = .TRUE.
+
+    GOTO 14
+
+13  BACKSPACE( 11 )
+    READ( 11 , '(A)') line
+    CALL parin_fail_message( 'userpar', line )
+
+14  CONTINUE
+
+!
+!-- Determine the number of user-defined profiles and append them to the
+!-- standard data output (data_output_pr)
+    IF ( user_defined_namelist_found )  THEN
+       IF ( data_output_pr_user(1) /= ' ' )  THEN
+          i = 1
+          DO WHILE ( data_output_pr(i) /= ' '  .AND.  i <= 100 )
+             i = i + 1
+          ENDDO
+          j = 1
+          DO WHILE ( data_output_pr_user(j) /= ' '  .AND.  j <= 100 )
+             data_output_pr(i) = data_output_pr_user(j)
+             max_pr_user_tmp   = max_pr_user_tmp + 1
+             i = i + 1
+             j = j + 1
+          ENDDO
+       ENDIF
+    ENDIF
+ 
+    RETURN
+
+ END SUBROUTINE user_parin
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Check &userpar control parameters and deduce further quantities.
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_check_parameters
+
+
+!-- Here the user may add code to check the validity of further &userpar 
+!-- control parameters or deduce further quantities.
+
+
+ END SUBROUTINE user_check_parameters
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Set the unit of user defined profile output quantities. 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.
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_check_data_output_pr( variable, var_count, unit )
+
+
+    USE netcdf_interface,                                                      &
+        ONLY:  dopr_unit
+
+    USE profil_parameter
+
+
+    CHARACTER (LEN=*) ::  unit     !< 
+    CHARACTER (LEN=*) ::  variable !< 
+
+    INTEGER(iwp) ::  user_pr_index !< 
+    INTEGER(iwp) ::  var_count     !< 
+
+    SELECT CASE ( TRIM( variable ) )
+
+!
+!--    Uncomment and extend the following lines, if necessary.
+!--    Add additional CASE statements depending on the number of quantities
+!--    for which profiles are to be calculated. The respective calculations
+!--    to be performed have to be added in routine user_statistics.
+!--    The quantities are (internally) identified by a user-profile-number
+!--    (see variable "user_pr_index" below). The first user-profile must be assigned
+!--    the number "pr_palm+1", the second one "pr_palm+2", etc. The respective
+!--    user-profile-numbers have also to be used in routine user_statistics!
+!       CASE ( 'u*v*' )                      ! quantity string as given in
+!                                            ! data_output_pr_user
+!          user_pr_index = pr_palm + 1
+!          dopr_index(var_count)  = user_pr_index    ! quantities' user-profile-number
+!          dopr_unit(var_count)   = 'm2/s2'  ! quantity unit
+!          hom(:,2,user_pr_index,:)       = SPREAD( zu, 2, statistic_regions+1 )
+!                                            ! grid on which the quantity is
+!                                            ! defined (use zu or zw)
+
+       CASE DEFAULT
+          unit = 'illegal'
+
+    END SELECT
+
+
+ END SUBROUTINE user_check_data_output_pr
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Set the unit of user defined output quantities. 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.
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_check_data_output( variable, unit )
+
+
+    CHARACTER (LEN=*) ::  unit     !< 
+    CHARACTER (LEN=*) ::  variable !<
+
+
+    SELECT CASE ( TRIM( variable ) )
+
+!
+!--    Uncomment and extend the following lines, if necessary
+!       CASE ( 'u2' )
+!          unit = 'm2/s2'
+!
+!       CASE ( 'u*v*' )
+!          unit = 'm2/s2'
+!
+       CASE DEFAULT
+          unit = 'illegal'
+
+    END SELECT
+
+
+ END SUBROUTINE user_check_data_output
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Execution of user-defined initializing actions
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_init
+
+
+    USE netcdf_interface,                                                      &
+        ONLY: dots_label, dots_unit, dots_num
+
+
+    CHARACTER (LEN=20) :: field_char   !< 
+!
+!-- 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
+
+!-- Sample for user-defined time series
+!-- For each time series quantity you have to give a label and a unit,
+!-- which will be used for the NetCDF file. They must not contain more than
+!-- seven characters. The value of dots_num has to be increased by the
+!-- number of new time series quantities. Its old value has to be store in
+!-- dots_num_palm. See routine user_statistics on how to output calculate
+!-- and output these quantities.
+!    dots_label(dots_num+1) = 'abs_umx'
+!    dots_unit(dots_num+1)  = 'm/s'
+!    dots_label(dots_num+2) = 'abs_vmx'
+!    dots_unit(dots_num+2)  = 'm/s'
+!
+!    dots_num_palm = dots_num
+!    dots_num = dots_num + 2
+
+ END SUBROUTINE user_init
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Print a header with user-defined information.
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_header( io )
+
+
+    INTEGER(iwp) ::  i    !< 
+    INTEGER(iwp) ::  io   !< 
+
+!
+!-- If no user-defined variables are read from the namelist-file, no
+!-- information will be printed.
+    IF ( .NOT. user_defined_namelist_found )  THEN
+       WRITE ( io, 100 )
+       RETURN
+    ENDIF
+
+!
+!-- Printing the information.
+    WRITE ( io, 110 )
+
+    IF ( statistic_regions /= 0 )  THEN
+       WRITE ( io, 200 )
+       DO  i = 0, statistic_regions
+          WRITE ( io, 201 )  i, region(i)
+       ENDDO
+    ENDIF
+
+!
+!-- Format-descriptors
+100 FORMAT (//' *** no user-defined variables found'/)
+110 FORMAT (//1X,78('#')                                                       &
+            //' User-defined variables and actions:'/                          &
+              ' -----------------------------------'//)
+200 FORMAT (' Output of profiles and time series for following regions:' /)
+201 FORMAT (4X,'Region ',I1,':   ',A)
+
+
+ END SUBROUTINE user_header
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Call for all grid points
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_actions( location )
+
+
+    CHARACTER (LEN=*) ::  location !< 
+
+    INTEGER(iwp) ::  i !< 
+    INTEGER(iwp) ::  j !< 
+    INTEGER(iwp) ::  k !< 
+
+    CALL cpu_log( log_point(24), 'user_actions', 'start' )
+
+!
+!-- Here the user-defined actions follow
+!-- No calls for single grid points are allowed at locations before and
+!-- after the timestep, since these calls are not within an i,j-loop
+    SELECT CASE ( location )
+
+       CASE ( 'before_timestep' )
+!
+!--       Enter actions to be done before every timestep here
+
+
+       CASE ( 'after_integration' )
+!
+!--       Enter actions to be done after every time integration (before
+!--       data output)
+!--       Sample for user-defined output:
+!          DO  i = nxlg, nxrg
+!             DO  j = nysg, nyng
+!                DO  k = nzb, nzt
+!                   u2(k,j,i) = u(k,j,i)**2
+!                ENDDO
+!             ENDDO
+!          ENDDO
+!          DO  i = nxlg, nxr
+!             DO  j = nysg, nyn
+!                DO  k = nzb, nzt+1
+!                   ustvst(k,j,i) =  &
+!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * &
+!                      ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) )
+!                ENDDO
+!             ENDDO
+!          ENDDO
+
+
+       CASE ( 'after_timestep' )
+!
+!--       Enter actions to be done after every timestep here
+
+
+       CASE ( 'u-tendency' )
+!
+!--       Enter actions to be done in the u-tendency term here
+
+
+       CASE ( 'v-tendency' )
+
+
+       CASE ( 'w-tendency' )
+
+
+       CASE ( 'pt-tendency' )
+
+
+       CASE ( 'sa-tendency' )
+
+
+       CASE ( 'e-tendency' )
+
+
+       CASE ( 'q-tendency' )
+
+
+       CASE ( 's-tendency' )
+
+
+       CASE DEFAULT
+          message_string = 'unknown location "' // location // '"'
+          CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 )
+
+    END SELECT
+
+    CALL cpu_log( log_point(24), 'user_actions', 'stop' )
+
+ END SUBROUTINE user_actions
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Call for grid point i,j
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_actions_ij( i, j, location )
+
+
+       CHARACTER (LEN=*) ::  location
+
+       INTEGER(iwp) ::  i
+       INTEGER(iwp) ::  idum
+       INTEGER(iwp) ::  j
+
+!
+!-- Here the user-defined actions follow
+    SELECT CASE ( location )
+
+       CASE ( 'u-tendency' )
+!
+!--       Enter actions to be done in the u-tendency term here
+
+
+       CASE ( 'v-tendency' )
+
+
+       CASE ( 'w-tendency' )
+
+
+       CASE ( 'pt-tendency' )
+
+
+       CASE ( 'sa-tendency' )
+
+
+       CASE ( 'e-tendency' )
+
+
+       CASE ( 'q-tendency' )
+
+
+       CASE ( 's-tendency' )
+
+
+       CASE ( 'before_timestep', 'after_integration', 'after_timestep' )
+          message_string = 'location "' // location // '" is not ' // &
+                          'allowed to be called with parameters "i" and "j"'
+          CALL message( 'user_actions', 'UI0002', 1, 2, 0, 6, 0 )
+
+
+       CASE DEFAULT
+          message_string = 'unknown location "' // location // '"'
+          CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 )
+
+
+    END SELECT
+
+ END SUBROUTINE user_actions_ij
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Sum up and time-average user-defined output quantities as well as allocate
+!> the array necessary for storing the average.
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_3d_data_averaging( mode, variable )
+
+
+    CHARACTER (LEN=*) ::  mode    !< 
+    CHARACTER (LEN=*) :: variable !< 
+
+    INTEGER(iwp) ::  i !< 
+    INTEGER(iwp) ::  j !< 
+    INTEGER(iwp) ::  k !< 
+
+    IF ( mode == 'allocate' )  THEN
+
+       SELECT CASE ( TRIM( variable ) )
+
+!
+!--       Uncomment and extend the following lines, if necessary.
+!--       The arrays for storing the user defined quantities (here u2_av) have
+!--       to be declared and defined by the user!
+!--       Sample for user-defined output:
+!          CASE ( 'u2' )
+!             IF ( .NOT. ALLOCATED( u2_av ) )  THEN
+!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+!             ENDIF
+!             u2_av = 0.0_wp
+
+          CASE DEFAULT
+             CONTINUE
+
+       END SELECT
+
+    ELSEIF ( mode == 'sum' )  THEN
+
+       SELECT CASE ( TRIM( variable ) )
+
+!
+!--       Uncomment and extend the following lines, if necessary.
+!--       The arrays for storing the user defined quantities (here u2 and
+!--       u2_av) have to be declared and defined by the user!
+!--       Sample for user-defined output:
+!          CASE ( 'u2' )
+!             IF ( ALLOCATED( u2_av ) ) THEN
+!                DO  i = nxlg, nxrg
+!                   DO  j = nysg, nyng
+!                      DO  k = nzb, nzt+1
+!                         u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i)
+!                      ENDDO
+!                   ENDDO
+!                ENDDO
+!             ENDIF
+
+          CASE DEFAULT
+             CONTINUE
+
+       END SELECT
+
+    ELSEIF ( mode == 'average' )  THEN
+
+       SELECT CASE ( TRIM( variable ) )
+
+!
+!--       Uncomment and extend the following lines, if necessary.
+!--       The arrays for storing the user defined quantities (here u2_av) have
+!--       to be declared and defined by the user!
+!--       Sample for user-defined output:
+!          CASE ( 'u2' )
+!             IF ( ALLOCATED( u2_av ) ) THEN
+!                DO  i = nxlg, nxrg
+!                   DO  j = nysg, nyng
+!                      DO  k = nzb, nzt+1
+!                         u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+!                      ENDDO
+!                   ENDDO
+!                ENDDO
+!             ENDIF
+
+       END SELECT
+
+    ENDIF
+
+
+ END SUBROUTINE user_3d_data_averaging
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Resorts the user-defined output quantity with indices (k,j,i) to a
+!> temporary array with indices (i,j,k) and sets the grid on which it is defined.
+!> Allowed values for grid are "zu" and "zw".
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do )
+
+
+    CHARACTER (LEN=*) ::  grid     !< 
+    CHARACTER (LEN=*) ::  variable !< 
+
+    INTEGER(iwp) ::  av     !< flag to control data output of instantaneous or time-averaged data
+    INTEGER(iwp) ::  i      !< grid index along x-direction
+    INTEGER(iwp) ::  j      !< grid index along y-direction
+    INTEGER(iwp) ::  k      !< grid index along z-direction
+    INTEGER(iwp) ::  m      !< running index surface elements
+    INTEGER(iwp) ::  nzb_do !< lower limit of the domain (usually nzb)
+    INTEGER(iwp) ::  nzt_do !< upper limit of the domain (usually nzt+1)
+
+    LOGICAL      ::  found !< 
+    LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
+
+    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
+
+    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
+
+
+    found = .TRUE.
+
+    SELECT CASE ( TRIM( variable ) )
+
+!
+!--    Uncomment and extend the following lines, if necessary.
+!--    The arrays for storing the user defined quantities (here u2 and u2_av)
+!--    have to be declared and defined by the user!
+!--    Sample for user-defined output:
+!       CASE ( 'u2_xy', 'u2_xz', 'u2_yz' )
+!          IF ( av == 0 )  THEN
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
+!                   DO  k = nzb_do, nzt_do
+!                      local_pf(i,j,k) = u2(k,j,i)
+!                   ENDDO
+!                ENDDO
+!             ENDDO
+!          ELSE
+!             IF ( .NOT. ALLOCATED( u2_av ) ) THEN
+!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+!                u2_av = REAL( fill_value, KIND = wp )
+!             ENDIF
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
+!                   DO  k = nzb_do, nzt_do
+!                      local_pf(i,j,k) = u2_av(k,j,i)
+!                   ENDDO
+!                ENDDO
+!             ENDDO
+!          ENDIF
+!
+!          grid = 'zu'
+!
+!--    In case two-dimensional surface variables are output, the user
+!--    has to access related surface-type. Uncomment and extend following lines
+!--    appropriately (example output of vertical surface momentum flux of u-
+!--    component). Please note, surface elements can be distributed over 
+!--    several data type, depending on their respective surface properties.
+!       CASE ( 'usws_xy' )
+!          IF ( av == 0 )  THEN
+!
+!--           Horizontal default-type surfaces
+!             DO  m = 1, surf_def_h(0)%ns
+!                i = surf_def_h(0)%i(m)
+!                j = surf_def_h(0)%j(m)
+!                local_pf(i,j,1) = surf_def_h(0)%usws(m)
+!             ENDDO
+!
+!--           Horizontal natural-type surfaces
+!             DO  m = 1, surf_lsm_h%ns
+!                i = surf_lsm_h%i(m)
+!                j = surf_lsm_h%j(m)
+!                local_pf(i,j,1) = surf_lsm_h%usws(m)
+!             ENDDO
+!
+!--           Horizontal urban-type surfaces
+!             DO  m = 1, surf_usm_h%ns
+!                i = surf_usm_h%i(m)
+!                j = surf_usm_h%j(m)
+!                local_pf(i,j,1) = surf_usm_h%usws(m)
+!             ENDDO
+!          ENDIF
+!
+!          grid = 'zu'
+!--       
+
+
+       CASE DEFAULT
+          found = .FALSE.
+          grid  = 'none'
+
+    END SELECT
+
+
+ END SUBROUTINE user_data_output_2d
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Resorts the user-defined output quantity with indices (k,j,i) to a
+!> temporary array with indices (i,j,k).
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
+
+
+    CHARACTER (LEN=*) ::  variable !< 
+
+    INTEGER(iwp) ::  av    !< 
+    INTEGER(iwp) ::  i     !< 
+    INTEGER(iwp) ::  j     !< 
+    INTEGER(iwp) ::  k     !< 
+    INTEGER(iwp) ::  nzb_do !< lower limit of the data output (usually 0)
+    INTEGER(iwp) ::  nzt_do !< vertical upper limit of the data output (usually nz_do3d)
+
+    LOGICAL      ::  found !< 
+
+    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
+
+    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
+
+
+    found = .TRUE.
+
+    SELECT CASE ( TRIM( variable ) )
+
+!
+!--    Uncomment and extend the following lines, if necessary.
+!--    The arrays for storing the user defined quantities (here u2 and u2_av)
+!--    have to be declared and defined by the user!
+!--    Sample for user-defined output:
+!       CASE ( 'u2' )
+!          IF ( av == 0 )  THEN
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
+!                   DO  k = nzb_do, nzt_do
+!                      local_pf(i,j,k) = u2(k,j,i)
+!                   ENDDO
+!                ENDDO
+!             ENDDO
+!          ELSE
+!             IF ( .NOT. ALLOCATED( u2_av ) ) THEN
+!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+!                u2_av = REAL( fill_value, KIND = wp )
+!             ENDIF
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
+!                   DO  k = nzb_do, nzt_do
+!                      local_pf(i,j,k) = u2_av(k,j,i)
+!                   ENDDO
+!                ENDDO
+!             ENDDO
+!          ENDIF
+!
+
+       CASE DEFAULT
+          found = .FALSE.
+
+    END SELECT
+
+
+ END SUBROUTINE user_data_output_3d
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Calculation of user-defined statistics, i.e. horizontally averaged profiles
+!> and time series.
+!> This routine is called for every statistic region sr defined by the user,
+!> but at least for the region "total domain" (sr=0).
+!> See section 3.5.4 on how to define, calculate, and output user defined
+!> quantities.
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_statistics( mode, sr, tn )
+
+
+    USE netcdf_interface,                                                      &
+        ONLY:  dots_max
+
+
+    CHARACTER (LEN=*) ::  mode   !< 
+
+    INTEGER(iwp) ::  i    !< 
+    INTEGER(iwp) ::  j    !< 
+    INTEGER(iwp) ::  k    !< 
+    INTEGER(iwp) ::  sr   !< 
+    INTEGER(iwp) ::  tn   !< 
+
+    REAL(wp),                                                                  &
+       DIMENSION(dots_num_palm+1:dots_max) ::                                  &
+          ts_value_l   !< 
+
+
+    IF ( mode == 'profiles' )  THEN
+
+!
+!--    Sample on how to calculate horizontally averaged profiles of user-
+!--    defined quantities. Each quantity is identified by the index
+!--    "pr_palm+#" where "#" is an integer starting from 1. These
+!--    user-profile-numbers must also be assigned to the respective strings
+!--    given by data_output_pr_user in routine user_check_data_output_pr.
+!       !$OMP DO
+!       DO  i = nxl, nxr
+!          DO  j = nys, nyn
+!             DO  k = nzb+1, nzt
+!!
+!!--             Sample on how to calculate the profile of the resolved-scale
+!!--             horizontal momentum flux u*v*
+!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +             &
+!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *&
+!                      ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )  &
+!                                     * rmask(j,i,sr)                          &
+!                                     * MERGE( 1.0_wp, 0.0_wp,                 &
+!                                              BTEST( wall_flags_0(k,j,i), 0 ) )
+!!
+!!--             Further profiles can be defined and calculated by increasing
+!!--             the second index of array sums_l (replace ... appropriately)
+!                sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ...           &
+!                                         * rmask(j,i,sr)
+!             ENDDO
+!          ENDDO
+!       ENDDO
+
+    ELSEIF ( mode == 'time_series' )  THEN
+
+!
+!--    Sample on how to add values for the user-defined time series quantities.
+!--    These have to be defined before in routine user_init. This sample
+!--    creates two time series for the absolut values of the horizontal
+!--    velocities u and v.
+!       ts_value_l = 0.0_wp
+!       ts_value_l(dots_num_palm+1) = ABS( u_max )
+!       ts_value_l(dots_num_palm+2) = ABS( v_max )
+!
+!--     Collect / send values to PE0, because only PE0 outputs the time series.
+!--     CAUTION: Collection is done by taking the sum over all processors.
+!--              You may have to normalize this sum, depending on the quantity
+!--              that you like to calculate. For serial runs, nothing has to be
+!--              done.
+!--     HINT: If the time series value that you are calculating has the same
+!--           value on all PEs, you can omit the MPI_ALLREDUCE call and
+!--           assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly.
+!#if defined( __parallel )
+!       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
+!       CALL MPI_ALLREDUCE( ts_value_l(dots_num_palm+1),                         &
+!                           ts_value(dots_num_palm+1,sr),                        &
+!                           dots_max-dots_num_palm, MPI_REAL, MPI_SUM, comm2d,   &
+!                           ierr )
+!#else
+!       ts_value(dots_num_palm+1:,sr) = ts_value_l
+!#endif
+
+    ENDIF
+
+ END SUBROUTINE user_statistics
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Reading global restart data that has been defined by the user.
+!------------------------------------------------------------------------------!
+    SUBROUTINE user_rrd_global( found )
+
+
+       USE control_parameters,                                                 &
+           ONLY: length, restart_string
+
+
+       LOGICAL, INTENT(OUT)  ::  found 
+
+
+       found = .TRUE.
+
+
+       SELECT CASE ( restart_string(1:length) )
+
+          CASE ( 'global_paramter' )
+!             READ ( 13 )  global_parameter
+
+          CASE DEFAULT
+ 
+             found = .FALSE.
+
+       END SELECT
+
+
+    END SUBROUTINE user_rrd_global
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Reading processor specific restart data from file(s) that has been defined 
+!> by the user.
+!> Subdomain index limits on file are given by nxl_on_file, etc.
+!> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the
+!> subdomain on file (f) to the subdomain of the current PE (c). They have been
+!> calculated in routine rrd_local.
+!------------------------------------------------------------------------------!
+    SUBROUTINE user_rrd_local( i, k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,      &
+                               nxr_on_file, nynf, nync, nyn_on_file, nysf,     & 
+                               nysc, nys_on_file, tmp_3d, found )
+
+
+       INTEGER(iwp) ::  i               !< 
+       INTEGER(iwp) ::  k               !< 
+       INTEGER(iwp) ::  nxlc            !< 
+       INTEGER(iwp) ::  nxlf            !< 
+       INTEGER(iwp) ::  nxl_on_file     !< 
+       INTEGER(iwp) ::  nxrc            !< 
+       INTEGER(iwp) ::  nxrf            !< 
+       INTEGER(iwp) ::  nxr_on_file     !< 
+       INTEGER(iwp) ::  nync            !< 
+       INTEGER(iwp) ::  nynf            !< 
+       INTEGER(iwp) ::  nyn_on_file     !< 
+       INTEGER(iwp) ::  nysc            !< 
+       INTEGER(iwp) ::  nysf            !< 
+       INTEGER(iwp) ::  nys_on_file     !< 
+
+       LOGICAL, INTENT(OUT)  ::  found 
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !< 
+
+!
+!-- Here the reading of user-defined restart data follows:
+!-- Sample for user-defined output
+
+
+       found = .TRUE.
+
+
+          SELECT CASE ( restart_string(1:length) )
+
+             CASE ( 'u2_av' )
+!                IF ( .NOT. ALLOCATED( u2_av ) ) THEN
+!                     ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+!                ENDIF
+!                IF ( k == 1 )  READ ( 13 )  tmp_3d
+!                   u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =         &
+!                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+!
+             CASE DEFAULT
+
+                found = .FALSE.
+
+             END SELECT
+
+
+    END SUBROUTINE user_rrd_local
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Writes global and user-defined restart data into binary file(s) for restart
+!> runs.
+!------------------------------------------------------------------------------!
+    SUBROUTINE user_wrd_global
+
+
+!       CALL wrd_write_string( 'global_parameter' )
+!       WRITE ( 14 )  global_parameter
+
+
+    END SUBROUTINE user_wrd_global    
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Writes processor specific and user-defined restart data into binary file(s) 
+!> for restart runs.
+!------------------------------------------------------------------------------!
+    SUBROUTINE user_wrd_local
+
+
+!
+!-- Here the user-defined actions at the end of a job follow.
+!-- Sample for user-defined output:
+!          IF ( ALLOCATED( u2_av ) )  THEN
+!             CALL wrd_write_string( 'u2_av' )  
+!             WRITE ( 14 )  u2_av
+!          ENDIF
+
+
+
+    END SUBROUTINE user_wrd_local
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Execution of user-defined actions at the end of a job.
+!------------------------------------------------------------------------------!
+ SUBROUTINE user_last_actions
+
+!
+!-- Here the user-defined actions at the end of a job might follow.
+
+
+ END SUBROUTINE user_last_actions
+
+
  END MODULE user
Index: palm/trunk/SOURCE/user_parin.f90
===================================================================
--- palm/trunk/SOURCE/user_parin.f90	(revision 3686)
+++ 	(revision )
@@ -1,216 +1,0 @@
-!> @file user_parin.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! current revision for user interface has been changed to 3240
-! 
-! 3248 2018-09-14 09:42:06Z sward
-! Minor formating changes
-! 
-! 3246 2018-09-13 15:14:50Z sward
-! Added error handling for input namelist via parin_fail_message
-! 
-! 3240 2018-09-12 12:04:40Z Giersch
-! The check that controls the number of user-defined profiles on the restart file
-! with the one given for the current run has been removed.
-! 
-! 3189 2018-08-06 13:18:55Z Giersch
-! Indent revised
-! 
-! 3174 2018-07-26 13:46:50Z Giersch
-! userpar in READ statement has been changed to user_parameters 
-! 
-! 3049 2018-05-29 13:52:36Z Giersch
-! Error messages revised
-! 
-! 3045 2018-05-28 07:55:41Z Giersch
-! renamed userpar to user_parameters
-! 
-! 2718 2018-01-02 08:49:38Z maronga
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2512 2017-10-04 08:26:59Z raasch
-! current interface revision number number set to r2512
-! 
-! 2298 2017-06-29 09:28:18Z raasch
-! user interface current revision updated
-! 
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1833 2016-04-07 14:23:03Z raasch
-! required interface revision changed
-!
-! 1783 2016-03-06 18:36:17Z raasch
-! required interface revision changed
-!
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-!
-! 1668 2015-09-23 13:45:36Z raasch
-! current interface revision number number set to r1663
-!
-! 1666 2015-09-23 07:31:10Z raasch
-! interface revision number is set to blank
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements, 
-! kinds are defined in new module kinds, 
-! old module precision_kind is removed,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 931 2012-06-08 15:09:28Z maronga
-! Re-enabled check for max_pr_user
-!
-! 841 2012-02-28 12:29:49Z maronga
-! Bugfix: disable max_pr_user check during prior namelist file check
-!
-! 217 2008-12-09 18:00:48Z letzel
-! +topography_grid_convention
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Interface to read user-defined namelist-parameters.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_parin
- 
-
-    USE control_parameters
-    
-    USE kinds
-    
-    USE pegrid
-    
-    USE statistics
-    
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=80) ::  line   !< 
-
-    INTEGER(iwp) ::  i                 !< 
-    INTEGER(iwp) ::  j                 !< 
-
-
-    NAMELIST /userpar/  data_output_pr_user, data_output_user, region,         &
-                        data_output_masks_user
-                        
-                        
-    NAMELIST /user_parameters/  data_output_pr_user, data_output_user, region, &
-                        data_output_masks_user
-
-!
-!-- Set revision number of this default interface version. It will be checked within
-!-- the main program (palm). Please change the revision number in case that the
-!-- current revision does not match with previous revisions (e.g. if routines
-!-- have been added/deleted or if parameter lists in subroutines have been changed).
-    user_interface_current_revision = 'r3240'
-
-!
-!-- Position the namelist-file at the beginning (it was already opened in
-!-- parin), search for user-defined namelist-group ("userpar", but any other
-!-- name can be choosed) and position the file at this line.
-    REWIND ( 11 )
-
-    line = ' '
-    DO WHILE ( INDEX( line, '&user_parameters' ) == 0 )
-       READ ( 11, '(A)', END=12 )  line
-    ENDDO
-    BACKSPACE ( 11 )
-
-!
-!-- Read user-defined namelist
-    READ ( 11, user_parameters, ERR = 10 )
-
-    user_defined_namelist_found = .TRUE.
-
-    GOTO 14
-
-10  BACKSPACE( 11 )
-    READ( 11 , '(A)') line
-    CALL parin_fail_message( 'user_parameters', line )
-
-12  REWIND ( 11 )
-
-    line = ' ' 
-    DO WHILE ( INDEX( line, '&userpar' ) == 0 )
-       READ ( 11, '(A)', END=14 )  line
-    ENDDO
-    BACKSPACE ( 11 )
-
-!
-!-- Read user-defined namelist
-    READ ( 11, userpar, ERR = 13, END = 14 )
-
-    message_string = 'namelist userpar is deprecated and will be ' //          &
-                     'removed in near future. &Please use namelist ' //        &
-                     'user_parameters instead' 
-    CALL message( 'user_parin', 'PA0487', 0, 1, 0, 6, 0 )
-
-    user_defined_namelist_found = .TRUE.
-
-    GOTO 14
-
-13  BACKSPACE( 11 )
-    READ( 11 , '(A)') line
-    CALL parin_fail_message( 'userpar', line )
-
-14  CONTINUE
-
-!
-!-- Determine the number of user-defined profiles and append them to the
-!-- standard data output (data_output_pr)
-    IF ( user_defined_namelist_found )  THEN
-       IF ( data_output_pr_user(1) /= ' ' )  THEN
-          i = 1
-          DO WHILE ( data_output_pr(i) /= ' '  .AND.  i <= 100 )
-             i = i + 1
-          ENDDO
-          j = 1
-          DO WHILE ( data_output_pr_user(j) /= ' '  .AND.  j <= 100 )
-             data_output_pr(i) = data_output_pr_user(j)
-             max_pr_user_tmp   = max_pr_user_tmp + 1
-             i = i + 1
-             j = j + 1
-          ENDDO
-       ENDIF
-    ENDIF
- 
-    RETURN
-
- END SUBROUTINE user_parin
-
Index: palm/trunk/SOURCE/user_read_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/user_read_restart_data_mod.f90	(revision 3686)
+++ 	(revision )
@@ -1,165 +1,0 @@
-!> @file user_read_restart_data_mod.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Initial revision
-!
-!
-! Description:
-! ------------
-!> Reads user specific restart data into binary file(s) for restart runs.
-!------------------------------------------------------------------------------!
- MODULE user_read_restart_data_mod
-
-
-    USE user
-     
-
-    IMPLICIT NONE
-
-
-    INTERFACE user_rrd_global
-       MODULE PROCEDURE user_rrd_global
-    END INTERFACE user_rrd_global
-
-    INTERFACE user_rrd_local
-       MODULE PROCEDURE user_rrd_local
-    END INTERFACE user_rrd_local
-
-
-    PUBLIC user_rrd_global, user_rrd_local
-
-
- CONTAINS
-
-
-!-------------
-! Description:
-! ------------
-!> Reading global restart data that has been defined by the user.
-!------------------------------------------------------------------------------!
-    SUBROUTINE user_rrd_global( found )
-
-
-       USE control_parameters,                                                 &
-           ONLY: length, restart_string
-
-
-       IMPLICIT NONE
-
-       LOGICAL, INTENT(OUT)  ::  found 
-
-
-       found = .TRUE.
-
-
-       SELECT CASE ( restart_string(1:length) )
-
-          CASE ( 'global_paramter' )
-!             READ ( 13 )  global_parameter
-
-          CASE DEFAULT
- 
-             found = .FALSE.
-
-       END SELECT  
-
-
-    END SUBROUTINE user_rrd_global
-
-
-! Description:
-! ------------
-!> Reading processor specific restart data from file(s) that has been defined 
-!> by the user.
-!> Subdomain index limits on file are given by nxl_on_file, etc.
-!> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the
-!> subdomain on file (f) to the subdomain of the current PE (c). They have been
-!> calculated in routine rrd_local.
-!------------------------------------------------------------------------------!
-    SUBROUTINE user_rrd_local( i, k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,      &
-                               nxr_on_file, nynf, nync, nyn_on_file, nysf,     & 
-                               nysc, nys_on_file, tmp_3d, found )
-    
-
-       USE control_parameters
-           
-       USE indices
-       
-       USE kinds
-       
-       USE pegrid
- 
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i               !< 
-       INTEGER(iwp) ::  k               !< 
-       INTEGER(iwp) ::  nxlc            !< 
-       INTEGER(iwp) ::  nxlf            !< 
-       INTEGER(iwp) ::  nxl_on_file     !< 
-       INTEGER(iwp) ::  nxrc            !< 
-       INTEGER(iwp) ::  nxrf            !< 
-       INTEGER(iwp) ::  nxr_on_file     !< 
-       INTEGER(iwp) ::  nync            !< 
-       INTEGER(iwp) ::  nynf            !< 
-       INTEGER(iwp) ::  nyn_on_file     !< 
-       INTEGER(iwp) ::  nysc            !< 
-       INTEGER(iwp) ::  nysf            !< 
-       INTEGER(iwp) ::  nys_on_file     !< 
-
-       LOGICAL, INTENT(OUT)  ::  found 
-
-       REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !< 
-
-!
-!-- Here the reading of user-defined restart data follows:
-!-- Sample for user-defined output
-
-
-       found = .TRUE.
-
-
-          SELECT CASE ( restart_string(1:length) )
-
-             CASE ( 'u2_av' )
-!                IF ( .NOT. ALLOCATED( u2_av ) ) THEN
-!                     ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-!                ENDIF
-!                IF ( k == 1 )  READ ( 13 )  tmp_3d
-!                   u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =         &
-!                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-!
-             CASE DEFAULT
-
-                found = .FALSE.
-
-             END SELECT
-
-
-    END SUBROUTINE user_rrd_local
-
-
- END MODULE user_read_restart_data_mod
Index: palm/trunk/SOURCE/user_statistics.f90
===================================================================
--- palm/trunk/SOURCE/user_statistics.f90	(revision 3686)
+++ 	(revision )
@@ -1,173 +1,0 @@
-!> @file user_statistics.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2233 2017-05-30 18:08:54Z suehring
-!
-! 2232 2017-05-30 17:47:52Z suehring
-! Ajdustments for new topography masking
-! 
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1804 2016-04-05 16:30:18Z maronga
-! Removed code for parameter file check (__check)
-!
-! 1783 2016-03-06 18:36:17Z raasch
-! netcdf module name changed + related changes
-!
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1353 2014-04-08 15:21:23Z heinze
-! REAL constants provided with KIND-attribute 
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements, 
-! kinds are defined in new module kinds, 
-! old module precision_kind is removed,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1046 2012-11-09 14:38:45Z maronga
-! added preprocessor directive for parameter file check 
-! 
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
-!
-! 211 2008-11-11 04:46:24Z raasch
-! Former file user_interface.f90 split into one file per subroutine
-!
-! Description:
-! ------------
-!> Calculation of user-defined statistics, i.e. horizontally averaged profiles
-!> and time series.
-!> This routine is called for every statistic region sr defined by the user,
-!> but at least for the region "total domain" (sr=0).
-!> See section 3.5.4 on how to define, calculate, and output user defined
-!> quantities.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_statistics( mode, sr, tn )
- 
-
-    USE arrays_3d
-    
-    USE indices
-    
-    USE kinds
-    
-    USE netcdf_interface,                                                      &
-        ONLY:  dots_max
-
-    USE pegrid
-    
-    USE statistics
-    
-    USE user
-
-    IMPLICIT NONE
-
-    CHARACTER (LEN=*) ::  mode   !< 
-
-    INTEGER(iwp) ::  i    !< 
-    INTEGER(iwp) ::  j    !< 
-    INTEGER(iwp) ::  k    !< 
-    INTEGER(iwp) ::  sr   !< 
-    INTEGER(iwp) ::  tn   !< 
-
-    REAL(wp),                                                                  &
-       DIMENSION(dots_num_palm+1:dots_max) ::                                  &
-          ts_value_l   !< 
-
-
-    IF ( mode == 'profiles' )  THEN
-
-!
-!--    Sample on how to calculate horizontally averaged profiles of user-
-!--    defined quantities. Each quantity is identified by the index
-!--    "pr_palm+#" where "#" is an integer starting from 1. These
-!--    user-profile-numbers must also be assigned to the respective strings
-!--    given by data_output_pr_user in routine user_check_data_output_pr.
-!       !$OMP DO
-!       DO  i = nxl, nxr
-!          DO  j = nys, nyn
-!             DO  k = nzb+1, nzt
-!!
-!!--             Sample on how to calculate the profile of the resolved-scale
-!!--             horizontal momentum flux u*v*
-!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +             &
-!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *&
-!                      ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )  &
-!                                     * rmask(j,i,sr)                          &
-!                                     * MERGE( 1.0_wp, 0.0_wp,                 &
-!                                              BTEST( wall_flags_0(k,j,i), 0 ) )
-!!
-!!--             Further profiles can be defined and calculated by increasing
-!!--             the second index of array sums_l (replace ... appropriately)
-!                sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ...           &
-!                                         * rmask(j,i,sr)
-!             ENDDO
-!          ENDDO
-!       ENDDO
-
-    ELSEIF ( mode == 'time_series' )  THEN
-
-!
-!--    Sample on how to add values for the user-defined time series quantities.
-!--    These have to be defined before in routine user_init. This sample
-!--    creates two time series for the absolut values of the horizontal
-!--    velocities u and v.
-!       ts_value_l = 0.0_wp
-!       ts_value_l(dots_num_palm+1) = ABS( u_max )
-!       ts_value_l(dots_num_palm+2) = ABS( v_max )
-!
-!--     Collect / send values to PE0, because only PE0 outputs the time series.
-!--     CAUTION: Collection is done by taking the sum over all processors.
-!--              You may have to normalize this sum, depending on the quantity
-!--              that you like to calculate. For serial runs, nothing has to be
-!--              done.
-!--     HINT: If the time series value that you are calculating has the same
-!--           value on all PEs, you can omit the MPI_ALLREDUCE call and
-!--           assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly.
-!#if defined( __parallel )
-!       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-!       CALL MPI_ALLREDUCE( ts_value_l(dots_num_palm+1),                         &
-!                           ts_value(dots_num_palm+1,sr),                        &
-!                           dots_max-dots_num_palm, MPI_REAL, MPI_SUM, comm2d,   &
-!                           ierr )
-!#else
-!       ts_value(dots_num_palm+1:,sr) = ts_value_l
-!#endif
-
-    ENDIF
-
- END SUBROUTINE user_statistics
-
Index: palm/trunk/SOURCE/user_write_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/user_write_restart_data_mod.f90	(revision 3686)
+++ 	(revision )
@@ -1,101 +1,0 @@
-!> @file user_write_restart_data_mod.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Initial revision
-! 
-!
-! Description:
-! ------------
-!> Writes user specific restart data into binary file(s) for restart runs.
-!------------------------------------------------------------------------------!
- MODULE user_write_restart_data_mod
-
-
-    USE user
-     
-
-    IMPLICIT NONE
-
-
-    INTERFACE user_wrd_global
-       MODULE PROCEDURE user_wrd_global
-    END INTERFACE user_wrd_global
-
-    INTERFACE user_wrd_local
-       MODULE PROCEDURE user_wrd_local
-    END INTERFACE user_wrd_local
-
-
-    PUBLIC user_wrd_global, user_wrd_local
-
-
- CONTAINS
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Writes global and user-defined restart data into binary file(s) for restart
-!> runs.
-!------------------------------------------------------------------------------!
-    SUBROUTINE user_wrd_global  
-
-
-       IMPLICIT NONE
-
-       
-!       CALL wrd_write_string( 'global_parameter' )
-!       WRITE ( 14 )  global_parameter
-
-       
-    END SUBROUTINE user_wrd_global    
-
-
-! Description:
-! ------------
-!> Writes processor specific and user-defined restart data into binary file(s) 
-!> for restart runs.
-!------------------------------------------------------------------------------!
-    SUBROUTINE user_wrd_local
-
-
-       IMPLICIT NONE
-
-
-!
-!-- Here the user-defined actions at the end of a job follow.
-!-- Sample for user-defined output:
-!          IF ( ALLOCATED( u2_av ) )  THEN
-!             CALL wrd_write_string( 'u2_av' )  
-!             WRITE ( 14 )  u2_av
-!          ENDIF
-
-
-
-    END SUBROUTINE user_wrd_local
-
-
- END MODULE user_write_restart_data_mod
Index: palm/trunk/SOURCE/wrd_write_string.f90
===================================================================
--- palm/trunk/SOURCE/wrd_write_string.f90	(revision 3686)
+++ palm/trunk/SOURCE/wrd_write_string.f90	(revision 3687)
@@ -1,3 +1,3 @@
-!> @file user_last_actions.f90
+!> @file wrd_write_string.f90
 !------------------------------------------------------------------------------!
 ! This file is part of the PALM model system.
