Index: /palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_2d.f90	(revision 3553)
+++ /palm/trunk/SOURCE/data_output_2d.f90	(revision 3554)
@@ -25,4 +25,10 @@
 ! -----------------
 ! $Id$
+! - add variable description
+! - rename variable 'if' into 'ivar'
+! - removed namelist LOCAL
+! - removed variable rtext
+! 
+! 3525 2018-11-14 16:06:14Z kanani
 ! Changes related to clean-up of biometeorology (dom_dwd_user)
 ! 
@@ -337,53 +343,50 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=2)  ::  do2d_mode    !< 
-    CHARACTER (LEN=2)  ::  mode         !< 
-    CHARACTER (LEN=4)  ::  grid         !< 
-    CHARACTER (LEN=50) ::  rtext        !< 
+    CHARACTER (LEN=2)  ::  do2d_mode    !< output mode of variable ('xy', 'xz', 'yz')
+    CHARACTER (LEN=2)  ::  mode         !< mode with which the routine is called ('xy', 'xz', 'yz')
+    CHARACTER (LEN=4)  ::  grid         !< string defining the vertical grid
     
-    INTEGER(iwp) ::  av        !< 
-    INTEGER(iwp) ::  ngp       !< 
-    INTEGER(iwp) ::  file_id   !< 
+    INTEGER(iwp) ::  av        !< flag for (non-)average output
+    INTEGER(iwp) ::  ngp       !< number of grid points of an output slice
+    INTEGER(iwp) ::  file_id   !< id of output files
     INTEGER(iwp) ::  flag_nr   !< number of masking flag
-    INTEGER(iwp) ::  i         !< 
-    INTEGER(iwp) ::  if        !< 
-    INTEGER(iwp) ::  is        !< 
-    INTEGER(iwp) ::  iis       !< 
-    INTEGER(iwp) ::  j         !< 
-    INTEGER(iwp) ::  k         !< 
-    INTEGER(iwp) ::  l         !< 
-    INTEGER(iwp) ::  layer_xy  !< 
-    INTEGER(iwp) ::  m         !<
-    INTEGER(iwp) ::  n         !< 
-    INTEGER(iwp) ::  nis       !<
-    INTEGER(iwp) ::  ns        !< 
+    INTEGER(iwp) ::  i         !< loop index
+    INTEGER(iwp) ::  iis       !< vertical index of a xy slice in array 'local_2d_sections'
+    INTEGER(iwp) ::  is        !< slice index
+    INTEGER(iwp) ::  ivar      !< variable index
+    INTEGER(iwp) ::  j         !< loop index
+    INTEGER(iwp) ::  k         !< loop index
+    INTEGER(iwp) ::  l         !< loop index
+    INTEGER(iwp) ::  layer_xy  !< vertical index of a xy slice in array 'local_pf'
+    INTEGER(iwp) ::  m         !< loop index
+    INTEGER(iwp) ::  n         !< loop index
+    INTEGER(iwp) ::  nis       !< number of vertical slices to be written via parallel NetCDF output
+    INTEGER(iwp) ::  ns        !< number of output slices
     INTEGER(iwp) ::  nzb_do    !< lower limit of the data field (usually nzb)
     INTEGER(iwp) ::  nzt_do    !< upper limit of the data field (usually nzt+1)
-    INTEGER(iwp) ::  s_ind     !< 
-    INTEGER(iwp) ::  sender    !< 
-    INTEGER(iwp) ::  ind(4)    !< 
+    INTEGER(iwp) ::  s_ind     !< index of slice types (xy=1, xz=2, yz=3)
+    INTEGER(iwp) ::  sender    !< PE id of sending PE
+    INTEGER(iwp) ::  ind(4)    !< index limits (lower/upper bounds) of array 'local_2d'
+
+    LOGICAL ::  found          !< true if output variable was found
+    LOGICAL ::  resorted       !< true if variable is resorted
+    LOGICAL ::  two_d          !< true if variable is only two dimensional
+
+    REAL(wp) ::  mean_r        !< mean particle radius
+    REAL(wp) ::  s_r2          !< sum( particle-radius**2 )
+    REAL(wp) ::  s_r3          !< sum( particle-radius**3 )
     
-    LOGICAL ::  found          !< 
-    LOGICAL ::  resorted       !< 
-    LOGICAL ::  two_d          !< 
-    
-    REAL(wp) ::  mean_r        !<
-    REAL(wp) ::  s_r2          !<
-    REAL(wp) ::  s_r3          !<
-    
-    REAL(wp), DIMENSION(:), ALLOCATABLE     ::  level_z             !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  local_2d            !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  local_2d_l          !<
-
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf            !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections   !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections_l !<
+    REAL(wp), DIMENSION(:), ALLOCATABLE     ::  level_z             !< z levels for output array
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  local_2d            !< local 2-dimensional array containing output values
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  local_2d_l          !< local 2-dimensional array containing output values
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf            !< output array
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections   !< local array containing values at all slices
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections_l !< local array containing values at all slices
 
 #if defined( __parallel )
-    REAL(wp), DIMENSION(:,:),   ALLOCATABLE ::  total_2d    !<
-#endif
-    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< 
-
-    NAMELIST /LOCAL/  rtext
+    REAL(wp), DIMENSION(:,:),   ALLOCATABLE ::  total_2d    !< same as local_2d
+#endif
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< points to array which shall be output
 
 !
@@ -543,9 +546,9 @@
 !-- Loop of all variables to be written.
 !-- Output dimensions chosen
-    if = 1
-    l = MAX( 2, LEN_TRIM( do2d(av,if) ) )
-    do2d_mode = do2d(av,if)(l-1:l)
-
-    DO  WHILE ( do2d(av,if)(1:1) /= ' ' )
+    ivar = 1
+    l = MAX( 2, LEN_TRIM( do2d(av,ivar) ) )
+    do2d_mode = do2d(av,ivar)(l-1:l)
+
+    DO  WHILE ( do2d(av,ivar)(1:1) /= ' ' )
 
        IF ( do2d_mode == mode )  THEN
@@ -567,5 +570,5 @@
 !--       Store the array chosen on the temporary array.
           resorted = .FALSE.
-          SELECT CASE ( TRIM( do2d(av,if) ) )
+          SELECT CASE ( TRIM( do2d(av,ivar) ) )
              CASE ( 'e_xy', 'e_xz', 'e_yz' )
                 IF ( av == 0 )  THEN
@@ -1135,5 +1138,5 @@
 !--             Substitute the values generated by "mirror" boundary condition
 !--             at the bottom boundary by the real surface values.
-                IF ( do2d(av,if) == 'u_xz'  .OR.  do2d(av,if) == 'u_yz' )  THEN
+                IF ( do2d(av,ivar) == 'u_xz'  .OR.  do2d(av,ivar) == 'u_yz' )  THEN
                    IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0_wp
                 ENDIF
@@ -1186,5 +1189,5 @@
 !--             Substitute the values generated by "mirror" boundary condition
 !--             at the bottom boundary by the real surface values.
-                IF ( do2d(av,if) == 'v_xz'  .OR.  do2d(av,if) == 'v_yz' )  THEN
+                IF ( do2d(av,ivar) == 'v_xz'  .OR.  do2d(av,ivar) == 'v_yz' )  THEN
                    IF ( ibc_uv_b == 0 )  local_pf(:,:,nzb) = 0.0_wp
                 ENDIF
@@ -1316,10 +1319,10 @@
 !--             Quantities of other modules
                 IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
-                   CALL bcm_data_output_2d( av, do2d(av,if), found, grid, mode,&
+                   CALL bcm_data_output_2d( av, do2d(av,ivar), found, grid, mode,&
                                             local_pf, two_d, nzb_do, nzt_do )
                 ENDIF
 
                 IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
-                   CALL gust_data_output_2d( av, do2d(av,if), found, grid,     &
+                   CALL gust_data_output_2d( av, do2d(av,ivar), found, grid,     &
                                              local_pf, two_d, nzb_do, nzt_do )
                 ENDIF
@@ -1327,5 +1330,5 @@
                 IF ( .NOT. found  .AND.  biometeorology                        &
                                   .AND.  mode == 'xy' )  THEN
-                   CALL bio_data_output_2d( av, do2d(av,if), found, grid,      &
+                   CALL bio_data_output_2d( av, do2d(av,ivar), found, grid,      &
                                             local_pf, two_d, nzb_do, nzt_do,   &
                                             fill_value )
@@ -1333,15 +1336,15 @@
 
                 IF ( .NOT. found  .AND.  land_surface )  THEN
-                   CALL lsm_data_output_2d( av, do2d(av,if), found, grid, mode,&
+                   CALL lsm_data_output_2d( av, do2d(av,ivar), found, grid, mode,&
                                             local_pf, two_d, nzb_do, nzt_do )
                 ENDIF
 
                 IF ( .NOT. found  .AND.  ocean_mode )  THEN
-                   CALL ocean_data_output_2d( av, do2d(av,if), found, grid,    &
+                   CALL ocean_data_output_2d( av, do2d(av,ivar), found, grid,    &
                                               mode, local_pf, nzb_do, nzt_do )
                 ENDIF
 
                 IF ( .NOT. found  .AND.  radiation )  THEN
-                   CALL radiation_data_output_2d( av, do2d(av,if), found, grid,&
+                   CALL radiation_data_output_2d( av, do2d(av,ivar), found, grid,&
                                                   mode, local_pf, two_d,       &
                                                   nzb_do, nzt_do  )
@@ -1349,15 +1352,15 @@
                 
                 IF ( .NOT. found  .AND.  salsa )  THEN
-                   CALL salsa_data_output_2d( av, do2d(av,if), found, grid,    &
+                   CALL salsa_data_output_2d( av, do2d(av,ivar), found, grid,    &
                                               mode, local_pf, two_d )
                 ENDIF                 
 
                 IF ( .NOT. found  .AND.  uv_exposure )  THEN
-                   CALL uvem_data_output_2d( av, do2d(av,if), found, grid,     &
+                   CALL uvem_data_output_2d( av, do2d(av,ivar), found, grid,     &
                                              local_pf, two_d, nzb_do, nzt_do )
                 ENDIF
 
                 IF ( .NOT. found  .AND.  air_chemistry )  THEN
-                   CALL chem_data_output_2d( av, do2d(av,if), found, grid, mode, &
+                   CALL chem_data_output_2d( av, do2d(av,ivar), found, grid, mode, &
                                              local_pf, two_d, nzb_do, nzt_do, fill_value )
                 ENDIF
@@ -1365,5 +1368,5 @@
 !--             User defined quantities
                 IF ( .NOT. found )  THEN
-                   CALL user_data_output_2d( av, do2d(av,if), found, grid,     &
+                   CALL user_data_output_2d( av, do2d(av,ivar), found, grid,     &
                                              local_pf, two_d, nzb_do, nzt_do )
                 ENDIF
@@ -1383,5 +1386,5 @@
                 IF ( .NOT. found )  THEN
                    message_string = 'no output provided for: ' //              &
-                                    TRIM( do2d(av,if) )
+                                    TRIM( do2d(av,ivar) )
                    CALL message( 'data_output_2d', 'PA0181', 0, 0, 0, 6, 0 )
                 ENDIF
@@ -1556,5 +1559,5 @@
                             IF ( two_d ) THEN
                                nc_stat = NF90_PUT_VAR( id_set_xy(av),       &
-                                                       id_var_do2d(av,if),  &
+                                                       id_var_do2d(av,ivar),  &
                                                        total_2d(0:nx,0:ny), &
                              start = (/ 1, 1, 1, do2d_xy_time_count(av) /), &
@@ -1562,5 +1565,5 @@
                             ELSE
                                nc_stat = NF90_PUT_VAR( id_set_xy(av),       &
-                                                       id_var_do2d(av,if),  &
+                                                       id_var_do2d(av,ivar),  &
                                                        total_2d(0:nx,0:ny), &
                             start = (/ 1, 1, is, do2d_xy_time_count(av) /), &
@@ -1594,5 +1597,5 @@
                    IF ( two_d ) THEN
                       nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-                                              id_var_do2d(av,if),           &
+                                              id_var_do2d(av,ivar),           &
                                               local_2d(nxl:nxr,nys:nyn),    &
                              start = (/ 1, 1, 1, do2d_xy_time_count(av) /), &
@@ -1600,5 +1603,5 @@
                    ELSE
                       nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-                                              id_var_do2d(av,if),           &
+                                              id_var_do2d(av,ivar),           &
                                               local_2d(nxl:nxr,nys:nyn),    &
                             start = (/ 1, 1, is, do2d_xy_time_count(av) /), &
@@ -1786,5 +1789,5 @@
 #if defined( __netcdf )
                             nc_stat = NF90_PUT_VAR( id_set_xz(av),             &
-                                                 id_var_do2d(av,if),           &
+                                                 id_var_do2d(av,ivar),           &
                                                  total_2d(0:nx,nzb_do:nzt_do), &
                                start = (/ 1, is, 1, do2d_xz_time_count(av) /), &
@@ -1827,5 +1830,5 @@
 #if defined( __netcdf )
                    nc_stat = NF90_PUT_VAR( id_set_xz(av),                   &
-                                           id_var_do2d(av,if),              &
+                                           id_var_do2d(av,ivar),              &
                                            local_2d(nxl:nxr,nzb_do:nzt_do), &
                             start = (/ 1, is, 1, do2d_xz_time_count(av) /), &
@@ -2004,5 +2007,5 @@
 #if defined( __netcdf )
                             nc_stat = NF90_PUT_VAR( id_set_yz(av),             &
-                                                 id_var_do2d(av,if),           &
+                                                 id_var_do2d(av,ivar),           &
                                                  total_2d(0:ny,nzb_do:nzt_do), &
                             start = (/ is, 1, 1, do2d_yz_time_count(av) /),    &
@@ -2045,5 +2048,5 @@
 #if defined( __netcdf )
                    nc_stat = NF90_PUT_VAR( id_set_yz(av),                   &
-                                           id_var_do2d(av,if),              &
+                                           id_var_do2d(av,ivar),              &
                                            local_2d(nys:nyn,nzb_do:nzt_do), &
                             start = (/ is, 1, 1, do2d_xz_time_count(av) /), &
@@ -2079,5 +2082,5 @@
 !                      IF ( nxr == nx  .AND.  nyn /= ny )  THEN
 !                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-!                                                 id_var_do2d(av,if),           &
+!                                                 id_var_do2d(av,ivar),           &
 !                                                 local_2d_sections(nxl:nxr+1,  &
 !                                                    nys:nyn,1:nis),            &
@@ -2089,5 +2092,5 @@
 !                      ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
 !                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-!                                                 id_var_do2d(av,if),           &
+!                                                 id_var_do2d(av,ivar),           &
 !                                                 local_2d_sections(nxl:nxr,    &
 !                                                    nys:nyn+1,1:nis),          &
@@ -2099,5 +2102,5 @@
 !                      ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
 !                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-!                                                 id_var_do2d(av,if),           &
+!                                                 id_var_do2d(av,ivar),           &
 !                                                 local_2d_sections(nxl:nxr+1,  &
 !                                                    nys:nyn+1,1:nis),          &
@@ -2109,5 +2112,5 @@
 !                      ELSE
                          nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-                                                 id_var_do2d(av,if),           &
+                                                 id_var_do2d(av,ivar),           &
                                                  local_2d_sections(nxl:nxr,    &
                                                     nys:nyn,1:nis),            &
@@ -2151,5 +2154,5 @@
 !                      IF ( nxr == nx )  THEN
 !                         nc_stat = NF90_PUT_VAR( id_set_xz(av),                &
-!                                             id_var_do2d(av,if),               & 
+!                                             id_var_do2d(av,ivar),               & 
 !                                             local_2d_sections(nxl:nxr+1,1:ns, &
 !                                                nzb_do:nzt_do),                &
@@ -2160,5 +2163,5 @@
 !                      ELSE
                          nc_stat = NF90_PUT_VAR( id_set_xz(av),                &
-                                             id_var_do2d(av,if),               &
+                                             id_var_do2d(av,ivar),               &
                                              local_2d_sections(nxl:nxr,1:ns,   &
                                                 nzb_do:nzt_do),                &
@@ -2201,5 +2204,5 @@
 !                      IF ( nyn == ny )  THEN
 !                         nc_stat = NF90_PUT_VAR( id_set_yz(av),                &
-!                                             id_var_do2d(av,if),               &
+!                                             id_var_do2d(av,ivar),               &
 !                                             local_2d_sections(1:ns,           &
 !                                                nys:nyn+1,nzb_do:nzt_do),      &
@@ -2210,5 +2213,5 @@
 !                      ELSE
                          nc_stat = NF90_PUT_VAR( id_set_yz(av),                &
-                                             id_var_do2d(av,if),               &
+                                             id_var_do2d(av,ivar),               &
                                              local_2d_sections(1:ns,nys:nyn,   &
                                                 nzb_do:nzt_do),                &
@@ -2231,7 +2234,7 @@
        ENDIF
 
-       if = if + 1
-       l = MAX( 2, LEN_TRIM( do2d(av,if) ) )
-       do2d_mode = do2d(av,if)(l-1:l)
+       ivar = ivar + 1
+       l = MAX( 2, LEN_TRIM( do2d(av,ivar) ) )
+       do2d_mode = do2d(av,ivar)(l-1:l)
 
     ENDDO
Index: /palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_3d.f90	(revision 3553)
+++ /palm/trunk/SOURCE/data_output_3d.f90	(revision 3554)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! add variable description; rename variable 'if' into 'ivar'
+! 
+! 3525 2018-11-14 16:06:14Z kanani
 ! Changes related to clean-up of biometeorology (dom_dwd_user)
 ! 
@@ -310,24 +313,24 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  av        !< 
+    INTEGER(iwp) ::  av        !< flag for (non-)average output
     INTEGER(iwp) ::  flag_nr   !< number of masking flag
-    INTEGER(iwp) ::  i         !< 
-    INTEGER(iwp) ::  if        !< 
-    INTEGER(iwp) ::  j         !< 
-    INTEGER(iwp) ::  k         !< 
-    INTEGER(iwp) ::  n         !< 
+    INTEGER(iwp) ::  i         !< loop index
+    INTEGER(iwp) ::  ivar      !< variable index
+    INTEGER(iwp) ::  j         !< loop index
+    INTEGER(iwp) ::  k         !< loop index
+    INTEGER(iwp) ::  n         !< loop index
     INTEGER(iwp) ::  nzb_do    !< vertical lower limit for data output
     INTEGER(iwp) ::  nzt_do    !< vertical upper limit for data output
 
-    LOGICAL      ::  found     !< 
-    LOGICAL      ::  resorted  !< 
-
-    REAL(wp)     ::  mean_r    !< 
-    REAL(wp)     ::  s_r2      !< 
-    REAL(wp)     ::  s_r3      !< 
-
-    REAL(sp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf  !<
-
-    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< 
+    LOGICAL      ::  found     !< true if output variable was found
+    LOGICAL      ::  resorted  !< true if variable is resorted
+
+    REAL(wp)     ::  mean_r    !< mean particle radius
+    REAL(wp)     ::  s_r2      !< sum( particle-radius**2 )
+    REAL(wp)     ::  s_r3      !< sum( particle-radius**3 )
+
+    REAL(sp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf  !< output array
+
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< pointer to array which shall be output
 
     CHARACTER (LEN=varnamelength) ::  trimvar  !< TRIM of output-variable string
@@ -387,7 +390,7 @@
 !
 !-- Loop over all variables to be written.
-    if = 1
-
-    DO  WHILE ( do3d(av,if)(1:1) /= ' ' )
+    ivar = 1
+
+    DO  WHILE ( do3d(av,ivar)(1:1) /= ' ' )
 
 !
@@ -395,5 +398,5 @@
 !--    surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ).
 !--    Store the array chosen on the temporary array.
-       trimvar = TRIM( do3d(av,if) )
+       trimvar = TRIM( do3d(av,ivar) )
        IF ( urban_surface  .AND.  trimvar(1:4) == 'usm_' )  THEN
           trimvar = 'usm_output'
@@ -711,5 +714,5 @@
 !--       Block of urban surface model outputs   
           CASE ( 'usm_output' )
-             CALL usm_data_output_3d( av, do3d(av,if), found, local_pf,        &
+             CALL usm_data_output_3d( av, do3d(av,ivar), found, local_pf,        &
                                          nzb_do, nzt_do )
 
@@ -719,5 +722,5 @@
 !--          Quantities of other modules
              IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
-                CALL bcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
+                CALL bcm_data_output_3d( av, do3d(av,ivar), found, local_pf,     &
                                          nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -725,5 +728,5 @@
 
              IF ( .NOT. found  .AND.  air_chemistry )  THEN
-                CALL chem_data_output_3d( av, do3d(av,if), found,              &
+                CALL chem_data_output_3d( av, do3d(av,ivar), found,              &
                                           local_pf, fill_value, nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -731,5 +734,5 @@
 
              IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
-                CALL gust_data_output_3d( av, do3d(av,if), found, local_pf,    &
+                CALL gust_data_output_3d( av, do3d(av,ivar), found, local_pf,    &
                                           nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -746,5 +749,5 @@
                 local_pf = fill_value
 
-                CALL lsm_data_output_3d( av, do3d(av,if), found, local_pf )
+                CALL lsm_data_output_3d( av, do3d(av,ivar), found, local_pf )
                 resorted = .TRUE.
 
@@ -762,5 +765,5 @@
 
              IF ( .NOT. found  .AND.  ocean_mode )  THEN
-                CALL ocean_data_output_3d( av, do3d(av,if), found, local_pf,   &
+                CALL ocean_data_output_3d( av, do3d(av,ivar), found, local_pf,   &
                                            nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -768,5 +771,5 @@
 
              IF ( .NOT. found  .AND.  plant_canopy )  THEN
-                CALL pcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
+                CALL pcm_data_output_3d( av, do3d(av,ivar), found, local_pf,     &
                                          fill_value, nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -774,5 +777,5 @@
 
              IF ( .NOT. found  .AND.  radiation )  THEN
-                CALL radiation_data_output_3d( av, do3d(av,if), found,         &
+                CALL radiation_data_output_3d( av, do3d(av,ivar), found,         &
                                                local_pf, nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -780,5 +783,5 @@
 
              IF ( .NOT. found )  THEN
-                CALL tcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
+                CALL tcm_data_output_3d( av, do3d(av,ivar), found, local_pf,     &
                                          nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -788,10 +791,10 @@
 !--          SALSA output
              IF ( .NOT. found  .AND.  salsa )  THEN
-                CALL salsa_data_output_3d( av, do3d(av,if), found, local_pf )
+                CALL salsa_data_output_3d( av, do3d(av,ivar), found, local_pf )
                 resorted = .TRUE.
              ENDIF                  
 
              IF ( .NOT. found  .AND.  biometeorology )  THEN
-                 CALL bio_data_output_3d( av, do3d(av,if), found, local_pf,    &
+                 CALL bio_data_output_3d( av, do3d(av,ivar), found, local_pf,    &
                                           nzb_do, nzt_do )
              ENDIF
@@ -800,5 +803,5 @@
 !--          User defined quantities
              IF ( .NOT. found )  THEN
-                CALL user_data_output_3d( av, do3d(av,if), found, local_pf,    &
+                CALL user_data_output_3d( av, do3d(av,ivar), found, local_pf,    &
                                           nzb_do, nzt_do )
                 resorted = .TRUE.
@@ -807,5 +810,5 @@
              IF ( .NOT. found )  THEN
                 message_string =  'no output available for: ' //               &
-                                  TRIM( do3d(av,if) )
+                                  TRIM( do3d(av,ivar) )
                 CALL message( 'data_output_3d', 'PA0182', 0, 0, 0, 6, 0 )
              ENDIF
@@ -855,20 +858,20 @@
 !--       Parallel output in netCDF4/HDF5 format.
 !          IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,ivar),  &
 !                               local_pf(nxl:nxr+1,nys:nyn,nzb_do:nzt_do),    &
 !                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
 !                count = (/ nxr-nxl+2, nyn-nys+1, nzt_do-nzb_do+1, 1 /) )
 !          ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,ivar),  &
 !                               local_pf(nxl:nxr,nys:nyn+1,nzb_do:nzt_do),    &
 !                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
 !                count = (/ nxr-nxl+1, nyn-nys+2, nzt_do-nzb_do+1, 1 /) )
 !          ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,ivar),  &
 !                             local_pf(nxl:nxr+1,nys:nyn+1,nzb_do:nzt_do  ),  &
 !                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
 !                count = (/ nxr-nxl+2, nyn-nys+2, nzt_do-nzb_do+1, 1 /) )
 !          ELSE
-             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,ivar),  &
                                  local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do),    &
                 start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
@@ -880,5 +883,5 @@
 #else
 #if defined( __netcdf )
-       nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),        &
+       nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,ivar),        &
                          local_pf(nxl:nxr+1,nys:nyn+1,nzb_do:nzt_do),        &
                          start = (/ 1, 1, 1, do3d_time_count(av) /),     &
@@ -888,5 +891,5 @@
 #endif
 
-       if = if + 1
+       ivar = ivar + 1
 
 !
Index: /palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_mask.f90	(revision 3553)
+++ /palm/trunk/SOURCE/data_output_mask.f90	(revision 3554)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! add variable description
+! 
+! 3467 2018-10-30 19:05:21Z suehring
 ! Implementation of a new aerosol module salsa.
 ! 
@@ -199,29 +202,29 @@
     CHARACTER(LEN=5) ::  grid !< flag to distinquish between staggered grids
 
-    INTEGER(iwp) ::  av                      !< 
-    INTEGER(iwp) ::  ngp                     !< 
-    INTEGER(iwp) ::  i                       !< 
-    INTEGER(iwp) ::  ivar                    !<
-    INTEGER(iwp) ::  j                       !< 
-    INTEGER(iwp) ::  k                       !< 
-    INTEGER(iwp) ::  kk                      !< 
-    INTEGER(iwp) ::  n                       !< 
-    INTEGER(iwp) ::  netcdf_data_format_save !<
-    INTEGER(iwp) ::  sender                  !< 
+    INTEGER(iwp) ::  av                      !< flag for (non-)average output
+    INTEGER(iwp) ::  ngp                     !< number of grid points of an output slice
+    INTEGER(iwp) ::  i                       !< loop index
+    INTEGER(iwp) ::  ivar                    !< variable index
+    INTEGER(iwp) ::  j                       !< loop index
+    INTEGER(iwp) ::  k                       !< loop index
+    INTEGER(iwp) ::  kk                      !< vertical index
+    INTEGER(iwp) ::  n                       !< loop index
+    INTEGER(iwp) ::  netcdf_data_format_save !< value of netcdf_data_format
+    INTEGER(iwp) ::  sender                  !< PE id of sending PE
     INTEGER(iwp) ::  topo_top_ind            !< k index of highest horizontal surface
-    INTEGER(iwp) ::  ind(6)                  !< 
-
-    LOGICAL ::  found     !< 
-    LOGICAL ::  resorted  !< 
-
-    REAL(wp) ::  mean_r   !< 
-    REAL(wp) ::  s_r2     !< 
-    REAL(wp) ::  s_r3     !< 
+    INTEGER(iwp) ::  ind(6)                  !< index limits (lower/upper bounds) of array 'local_2d'
+
+    LOGICAL ::  found      !< true if output variable was found
+    LOGICAL ::  resorted   !< true if variable is resorted
+
+    REAL(wp) ::  mean_r    !< mean particle radius
+    REAL(wp) ::  s_r2      !< sum( particle-radius**2 )
+    REAL(wp) ::  s_r3      !< sum( particle-radius**3 )
     
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf    !<
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf    !< output array
 #if defined( __parallel )
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  total_pf    !<
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  total_pf    !< collected output array
 #endif
-    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !<
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< points to array which shall be output
 
 !
Index: /palm/trunk/SOURCE/data_output_profiles.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_profiles.f90	(revision 3553)
+++ /palm/trunk/SOURCE/data_output_profiles.f90	(revision 3554)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! add variable description
+! 
+! 3241 2018-09-12 15:02:00Z raasch
 ! unused format statements removed
 ! 
@@ -126,6 +129,6 @@
 
 
-    INTEGER(iwp) ::  i  !<
-    INTEGER(iwp) ::  sr !<
+    INTEGER(iwp) ::  i  !< loop index
+    INTEGER(iwp) ::  sr !< statistic region index
 
 !
Index: /palm/trunk/SOURCE/init_masks.f90
===================================================================
--- /palm/trunk/SOURCE/init_masks.f90	(revision 3553)
+++ /palm/trunk/SOURCE/init_masks.f90	(revision 3554)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! add variable description
+! 
+! 3512 2018-11-09 18:09:51Z gronemeier
 ! Bugfix: do not output ghost points if mask_x/y_loop is not specified
 ! 
@@ -196,24 +199,24 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=varnamelength) ::  var  !<
-    CHARACTER (LEN=7) ::  unit !<
+    CHARACTER (LEN=varnamelength) ::  var  !< contains variable name
+    CHARACTER (LEN=7)             ::  unit !< contains unit of variable
     
-    CHARACTER (LEN=varnamelength), DIMENSION(max_masks,100) ::  do_mask      !<
-    CHARACTER (LEN=varnamelength), DIMENSION(max_masks,100) ::  do_mask_user !<
+    CHARACTER (LEN=varnamelength), DIMENSION(max_masks,100) ::  do_mask      !< list of output variables
+    CHARACTER (LEN=varnamelength), DIMENSION(max_masks,100) ::  do_mask_user !< list of user-specified output variables
 
     INTEGER(iwp) ::  count        !< counting masking indices along a dimension
-    INTEGER(iwp) ::  i            !< 
-    INTEGER(iwp) ::  ilen         !<
-    INTEGER(iwp) ::  ind(6)       !<
-    INTEGER(iwp) ::  ind_array(1) !<
-    INTEGER(iwp) ::  j            !<
-    INTEGER(iwp) ::  k            !<
+    INTEGER(iwp) ::  i            !< loop index
+    INTEGER(iwp) ::  ilen         !< length of string saved in 'do_mask'
+    INTEGER(iwp) ::  ind(6)       !< index limits (lower/upper bounds) of output array
+    INTEGER(iwp) ::  ind_array(1) !< array index
+    INTEGER(iwp) ::  j            !< loop index
+    INTEGER(iwp) ::  k            !< loop index
     INTEGER(iwp) ::  m            !< mask index
-    INTEGER(iwp) ::  n            !<
-    INTEGER(iwp) ::  sender       !<
+    INTEGER(iwp) ::  n            !< loop index
+    INTEGER(iwp) ::  sender       !< PE id of sending PE
     
-    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  tmp_array !<
-
-    LOGICAL ::  found !<
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  tmp_array !< temporary 1D array
+
+    LOGICAL ::  found !< true if variable is found
 
 !
Index: /palm/trunk/SOURCE/posix_calls_from_fortran.f90
===================================================================
--- /palm/trunk/SOURCE/posix_calls_from_fortran.f90	(revision 3553)
+++ /palm/trunk/SOURCE/posix_calls_from_fortran.f90	(revision 3554)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id: posix_calls_from_fortran.f90 2696 2017-12-14 17:12:51Z kanani $
+! add variable description
+! 
+! 2696 2017-12-14 17:12:51Z kanani
 ! Corrected "Former revisions" section
 ! 
@@ -50,5 +53,6 @@
 
     INTERFACE
-
+!
+!--    Sleep function from C library
        FUNCTION fsleep( seconds )  BIND( C, NAME='sleep' )
           IMPORT
@@ -73,17 +77,16 @@
 !> Wait a specified amount of seconds
 !------------------------------------------------------------------------------!
-    SUBROUTINE fortran_sleep( seconds )
+ SUBROUTINE fortran_sleep( seconds )
 
-       INTEGER, INTENT(IN) ::  seconds
+    INTEGER, INTENT(IN) ::  seconds             !< seconds to wait
 
-       INTEGER(c_int)      ::  seconds_in_c
-       INTEGER(c_int)      ::  sleep_return_value
+    INTEGER(c_int)      ::  seconds_in_c        !< same as seconds
+    INTEGER(c_int)      ::  sleep_return_value  !< returned value to sleep
 
-       seconds_in_c = seconds
+    seconds_in_c = seconds
 
-       sleep_return_value = fsleep( seconds_in_c )
+    sleep_return_value = fsleep( seconds_in_c )
 
-   END SUBROUTINE fortran_sleep
+ END SUBROUTINE fortran_sleep
 
  END MODULE posix_calls_from_fortran
-
Index: /palm/trunk/SOURCE/subsidence_mod.f90
===================================================================
--- /palm/trunk/SOURCE/subsidence_mod.f90	(revision 3553)
+++ /palm/trunk/SOURCE/subsidence_mod.f90	(revision 3554)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! add subroutine and variable description
+! 
+! 3302 2018-10-03 02:39:40Z raasch
 ! small message change
 ! 
@@ -124,5 +127,5 @@
 ! Description:
 ! ------------
-!> @todo Missing subroutine description.
+!> Initialize vertical subsidence velocity w_subs.
 !------------------------------------------------------------------------------!
     SUBROUTINE init_w_subsidence 
@@ -142,9 +145,9 @@
        IMPLICIT NONE
 
-       INTEGER(iwp) ::  i !< 
-       INTEGER(iwp) ::  k !< 
-
-       REAL(wp)     ::  gradient   !< 
-       REAL(wp)     ::  ws_surface !< 
+       INTEGER(iwp) ::  i !< loop index
+       INTEGER(iwp) ::  k !< loop index
+
+       REAL(wp)     ::  gradient   !< vertical gradient of subsidence velocity
+       REAL(wp)     ::  ws_surface !< subsidence velocity at the surface
 
        IF ( .NOT. ALLOCATED( w_subs ) )  THEN
@@ -201,5 +204,5 @@
 ! Description:
 ! ------------
-!> @todo Missing subroutine description.
+!> Add effect of large-scale subsidence to variable.
 !------------------------------------------------------------------------------!
     SUBROUTINE subsidence( tendency, var, var_init, ls_index ) 
@@ -223,16 +226,16 @@
        IMPLICIT NONE
  
-       INTEGER(iwp) ::  i !< 
-       INTEGER(iwp) ::  j !< 
-       INTEGER(iwp) ::  k !< 
-       INTEGER(iwp) ::  ls_index !<
-
-       REAL(wp)     ::  tmp_tend !<
-       REAL(wp)     ::  tmp_grad !< 
+       INTEGER(iwp) ::  i        !< loop index
+       INTEGER(iwp) ::  j        !< loop index
+       INTEGER(iwp) ::  k        !< loop index
+       INTEGER(iwp) ::  ls_index !< index of large-scale subsidence in sums_ls_l
+
+       REAL(wp)     ::  tmp_tend !< temporary tendency
+       REAL(wp)     ::  tmp_grad !< temporary gradient 
     
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var      !< 
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  tendency !< 
-       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_init                     !< 
-       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_mod                      !< 
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var      !< variable where to add subsidence
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  tendency !< tendency of var
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_init                     !< initialization profile of var
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_mod                      !< modified profile of var
 
        var_mod = var_init
@@ -316,5 +319,5 @@
 ! Description:
 ! ------------
-!> @todo Missing subroutine description.
+!> Add effect of large-scale subsidence to variable.
 !------------------------------------------------------------------------------!
  SUBROUTINE subsidence_ij( i, j, tendency, var, var_init, ls_index ) 
@@ -337,16 +340,16 @@
        IMPLICIT NONE
  
-       INTEGER(iwp) ::  i !< 
-       INTEGER(iwp) ::  j !< 
-       INTEGER(iwp) ::  k !< 
-       INTEGER(iwp) ::  ls_index !<
-
-       REAL(wp)     ::  tmp_tend !<
-       REAL(wp)     ::  tmp_grad !< 
+       INTEGER(iwp) ::  i        !< loop variable
+       INTEGER(iwp) ::  j        !< loop variable
+       INTEGER(iwp) ::  k        !< loop variable
+       INTEGER(iwp) ::  ls_index !< index of large-scale subsidence in sums_ls_l
+
+       REAL(wp)     ::  tmp_tend !< temporary tendency
+       REAL(wp)     ::  tmp_grad !< temporary gradient
     
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var      !< 
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  tendency !< 
-       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_init                     !< 
-       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_mod                      !< 
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var      !< variable where to add subsidence
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  tendency !< tendency of var
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_init                     !< initialization profile of var
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_mod                      !< modified profile of var
 
        var_mod = var_init
