Index: palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- palm/trunk/SOURCE/advec_ws.f90	(revision 3240)
+++ palm/trunk/SOURCE/advec_ws.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Rename variables for boundary-condition flags and for offline nesting mode 
 ! 
@@ -1169,5 +1172,4 @@
        INTEGER(iwp) ::  k     !<
        INTEGER(iwp) ::  k_mm  !<
-       INTEGER(iwp) ::  k_mmm !<
        INTEGER(iwp) ::  k_pp  !<
        INTEGER(iwp) ::  k_ppp !<
@@ -1712,5 +1714,5 @@
 
        USE indices,                                                           &
-           ONLY:  nxl, nxlu, nxr, nyn, nys, nzb, nzb_max, nzt, advc_flags_1
+           ONLY:  nxlu, nys, nzb, nzb_max, nzt, advc_flags_1
 
        USE kinds
@@ -2210,5 +2212,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nys, nysv, nzb, nzb_max, nzt, advc_flags_1
+           ONLY:  nysv, nzb, nzb_max, nzt, advc_flags_1
 
        USE kinds
@@ -2715,6 +2717,5 @@
 
        USE indices,                                                           &
-           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, advc_flags_1,        &
-                  advc_flags_2
+           ONLY:  nys, nzb, nzb_max, nzt, advc_flags_1, advc_flags_2
 
        USE kinds
@@ -3223,5 +3224,4 @@
        INTEGER(iwp) ::  k      !<
        INTEGER(iwp) ::  k_mm   !<
-       INTEGER(iwp) ::  k_mmm  !<
        INTEGER(iwp) ::  k_pp   !<
        INTEGER(iwp) ::  k_ppp  !<
@@ -3750,5 +3750,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxlu, nxr, nyn, nys, nzb, nzb_max, nzt, advc_flags_1
+           ONLY:  nxlu, nxr, nyn, nys, nzb, nzb_max, nzt, advc_flags_1
            
        USE kinds
Index: palm/trunk/SOURCE/boundary_conds.f90
===================================================================
--- palm/trunk/SOURCE/boundary_conds.f90	(revision 3240)
+++ palm/trunk/SOURCE/boundary_conds.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Rename some variables concerning LES-LES as well as offline nesting
 ! 
@@ -189,9 +192,8 @@
     USE arrays_3d,                                                             &
         ONLY:  c_u, c_u_m, c_u_m_l, c_v, c_v_m, c_v_m_l, c_w, c_w_m, c_w_m_l,  &
-               diss, diss_p, dzu, e_p, nc_p, nr_p, pt, pt_p, q, q_p, qc_p,     &
-               qr_p, s,                                                        & 
-               s_p, sa, sa_p, u, ug, u_init, u_m_l, u_m_n, u_m_r, u_m_s, u_p,  &
-               v, vg, v_init, v_m_l, v_m_n, v_m_r, v_m_s, v_p,                 &
-               w, w_p, w_m_l, w_m_n, w_m_r, w_m_s, pt_init, ddzu
+               diss, diss_p, dzu, e_p, nc_p, nr_p, pt, pt_init, pt_p, q,       &
+               q_p, qc_p, qr_p, s, s_p, sa, sa_p, u, u_init, u_m_l, u_m_n,     &
+               u_m_r, u_m_s, u_p, v, v_init, v_m_l, v_m_n, v_m_r, v_m_s, v_p,  &
+               w, w_p, w_m_l, w_m_n, w_m_r, w_m_s
 
     USE chemistry_model_mod,                                                   &
@@ -215,5 +217,5 @@
     USE indices,                                                               &
         ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,             &
-               nzb, nzt, wall_flags_0
+               nzb, nzt
 
     USE kinds
Index: palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- palm/trunk/SOURCE/buoyancy.f90	(revision 3240)
+++ palm/trunk/SOURCE/buoyancy.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused Variable removed
+!
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -257,5 +260,4 @@
        INTEGER(iwp) ::  j              !<
        INTEGER(iwp) ::  k              !<
-       INTEGER(iwp) ::  pr             !<
        INTEGER(iwp) ::  wind_component !<
        
Index: palm/trunk/SOURCE/calc_liquid_water_content.f90
===================================================================
--- palm/trunk/SOURCE/calc_liquid_water_content.f90	(revision 3240)
+++ palm/trunk/SOURCE/calc_liquid_water_content.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2719 2018-01-02 09:02:06Z maronga
 ! Bugfix for last change.
 ! 
@@ -84,5 +87,4 @@
 !
 !
-!
 ! Description:
 ! ------------
@@ -94,5 +96,4 @@
  
 
-
     USE arrays_3d,                                                             &
         ONLY:  q, qc, ql, qr
@@ -102,5 +103,5 @@
 
     USE diagnostic_quantities_mod,                                             &
-        ONLY:  e_s, magnus, q_s, sat, supersaturation, t_l
+        ONLY:  magnus, q_s, supersaturation
 
     USE indices,                                                               &
@@ -126,5 +127,5 @@
 !--          Call calculation of supersaturation located 
 !--          in diagnostic_quantities_mod
-             CALL supersaturation ( i, j, k )
+             CALL supersaturation( i, j, k )
 
 !
Index: palm/trunk/SOURCE/calc_mean_profile.f90
===================================================================
--- palm/trunk/SOURCE/calc_mean_profile.f90	(revision 3240)
+++ palm/trunk/SOURCE/calc_mean_profile.f90	(revision 3241)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! omp_get_thread_num now declared in openmp directive,
+! unused variable removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -83,5 +87,5 @@
 
        USE control_parameters,                                                 &
-           ONLY:  intermediate_timestep_count, message_string
+           ONLY:  intermediate_timestep_count
 
        USE indices,                                                            &
@@ -103,5 +107,5 @@
        INTEGER(iwp) ::  k                  !<
        INTEGER(iwp) ::  pr                 !< 
-       INTEGER(iwp) ::  omp_get_thread_num !<
+!$     INTEGER(iwp) ::  omp_get_thread_num !<
        INTEGER(iwp) ::  tn                 !<
        
Index: palm/trunk/SOURCE/check_open.f90
===================================================================
--- palm/trunk/SOURCE/check_open.f90	(revision 3240)
+++ palm/trunk/SOURCE/check_open.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables and format statements removed
+! 
+! 3159 2018-07-20 11:20:01Z sward
 ! Added multi agent system
 ! 
@@ -172,17 +175,11 @@
  
 
-    USE arrays_3d,                                                             &
-        ONLY:  zu
-
     USE control_parameters,                                                    &
         ONLY:  coupling_char, data_output_2d_on_each_pe,                       &
                max_masks, message_string, mid, nz_do3d, openfile,              &
-               run_description_header, runnr
-
-    USE grid_variables,                                                        &
-        ONLY:  dx, dy
+               run_description_header
 
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nyng, nys, nysg, nz, nzb, nzt 
+        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nz, nzb, nzt
 
     USE kinds
@@ -193,5 +190,5 @@
 
     USE netcdf_interface,                                                      &
-        ONLY:  id_set_agt, id_set_fl, id_set_mask, id_set_pr, id_set_prt,      &
+        ONLY:  id_set_agt, id_set_fl, id_set_mask, id_set_pr,                  &
                id_set_pts, id_set_sp, id_set_ts, id_set_xy, id_set_xz,         &
                id_set_yz, id_set_3d, nc_stat, netcdf_create_file,              &
@@ -212,15 +209,10 @@
 
     CHARACTER (LEN=4)   ::  mask_char               !<
-    CHARACTER (LEN=2)   ::  suffix                  !<
     CHARACTER (LEN=30)  ::  filename                !<
     CHARACTER (LEN=80)  ::  rtext                   !<
-    CHARACTER (LEN=100) ::  line                    !<
 
     INTEGER(iwp) ::  av          !<
     INTEGER(iwp) ::  file_id     !<
-    INTEGER(iwp) ::  i           !<
     INTEGER(iwp) ::  ioerr       !< IOSTAT flag for IO-commands ( 0 = no error )
-    INTEGER(iwp) ::  j           !<
-    INTEGER(iwp) ::  k           !<
     
     LOGICAL ::  netcdf_extend    !<
@@ -1259,15 +1251,4 @@
 !
 !-- Formats
-3300 FORMAT ('#'/                                                              &
-             'coord 1  file=',A,'  filetype=unformatted'/                      &
-             'coord 2  file=',A,'  filetype=unformatted  skip=',I6/            &
-             'coord 3  file=',A,'  filetype=unformatted  skip=',I6/            &
-             '#')
-4000 FORMAT ('# ',A)
-5000 FORMAT ('# ',A/                                                           &
-             '#1 E'/'#2 E*'/'#3 dt'/'#4 u*'/'#5 th*'/'#6 umax'/'#7 vmax'/      &
-             '#8 wmax'/'#9 div_new'/'#10 div_old'/'#11 z_i_wpt'/'#12 z_i_pt'/  &
-             '#13 w*'/'#14 w''pt''0'/'#15 w''pt'''/'#16 wpt'/'#17 pt(0)'/      &
-             '#18 pt(zp)'/'#19 splptx'/'#20 splpty'/'#21 splptz')
 8000 FORMAT (A/                                                                &
              '  step    time    # of parts     lPE sent/recv  rPE sent/recv  ',&
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 3240)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id: check_parameters.f90 2520 2017-10-05 13:50:26Z gronemeier &
+! unused variables removed
+! 
+! 2520 2017-10-05 13:50:26Z gronemeier
 ! references to mrun replaced by palmrun, and updated
 ! 
@@ -3479,5 +3482,5 @@
           CASE DEFAULT
 
-             CALL tcm_check_data_output ( var, unit, i, ilen, k )
+             CALL tcm_check_data_output ( var, unit )
 
              IF ( unit == 'illegal' )  THEN
Index: palm/trunk/SOURCE/chem_photolysis_mod.f90
===================================================================
--- palm/trunk/SOURCE/chem_photolysis_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/chem_photolysis_mod.f90	(revision 3241)
@@ -26,10 +26,11 @@
 ! -----------------
 ! $Id$
+! unused variables commented
+! 
+! 2766 2018-01-22 17:17:47Z kanani
 ! Removed preprocessor directive __chem
 ! 
 ! 2718 2018-01-02 08:49:38Z maronga
 ! Initial revision
-!
-! 
 !
 !
@@ -37,5 +38,4 @@
 ! --------
 ! @author Renate Forkel
-!
 !
 !------------------------------------------------------------------------------!
@@ -143,7 +143,7 @@
 
 
-    REAL(wp) :: time_photolysis = 0.0_wp,         & !< time since last call of photolysis code
-                dt_photolysis = 0.0_wp,           & !< hotolysis model timestep
-                skip_time_do_photolysis = 0.0_wp    !< Radiation model is not called before this time
+!    REAL(wp) :: time_photolysis = 0.0_wp,         & !< time since last call of photolysis code
+!                dt_photolysis = 0.0_wp,           & !< hotolysis model timestep
+!                skip_time_do_photolysis = 0.0_wp    !< Radiation model is not called before this time
 
     REAL(wp)     :: cosz = 0.7_wp                   !< cosine of Zenith angle (45 deg, if not specified otherwise)
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 3241)
@@ -298,13 +298,12 @@
                                                                                   
     USE control_parameters,                                                    &  
-        ONLY:  air_chemistry, bc_radiation_l, bc_radiation_n, bc_radiation_r,  &
-               bc_radiation_s                
+        ONLY:  bc_radiation_l, bc_radiation_n, bc_radiation_r, bc_radiation_s
+
     USE indices,                                                               &  
-        ONLY:  nxl, nxr,  nxlg, nxrg, nyng, nysg, nzt                              
+        ONLY:  nxl, nxr, nzt
                                                                                   
-!    USE prognostic_equations_mod,                                             &
-
     USE arrays_3d,                                                             &     
         ONLY:  dzu                                                
+
     USE surface_mod,                                                           &
         ONLY:  bc_h                                                           
@@ -318,5 +317,4 @@
     INTEGER(iwp) ::  m                                                            !< running index surface elements.
     INTEGER(iwp) ::  lsp                                                          !< running index for chem spcs.
-    INTEGER(iwp) ::  lph                                                          !< running index for photolysis frequencies
 
 
@@ -469,5 +467,5 @@
     INTEGER ::  lsp_pr     !< running index for number of species in cs_names, cs_profiles etc
     INTEGER ::  lpr_lev    !< running index for profile level for each chem spcs. 
-    INTEGER ::  npr_lev    !< the next available profile lev
+!    INTEGER ::  npr_lev    !< the next available profile lev
 
 !-----------------
@@ -548,11 +546,4 @@
 !------------------------------------------------------------------------------!
    SUBROUTINE chem_init
-
-
-      USE control_parameters,                                                  &
-         ONLY: message_string, io_blocks, io_group, turbulent_inflow
-       
-      USE arrays_3d,                                                           &
-          ONLY: mean_inflow_profiles
 
       USE pegrid
@@ -917,5 +908,5 @@
       INTEGER(iwp) ::  lsp                                                          !< running index for chem spcs.
       INTEGER(iwp) ::  lph                                                          !< running index for photolysis frequencies
-      INTEGER                  :: k,m,istatf                                        
+      INTEGER                  :: istatf
       INTEGER,dimension(20)    :: istatus
       REAL(kind=wp),dimension(nzb+1:nzt,nspec)                :: tmp_conc           
@@ -926,8 +917,6 @@
      REAL(wp)                         ::  conv                                !< conversion factor
      REAL(wp), PARAMETER              ::  ppm2fr  = 1.0e-6_wp                 !< Conversion factor ppm to fraction
-     REAL(wp), PARAMETER              ::  pref_i  = 1._wp / 100000.0_wp       !< inverse reference pressure (1/Pa)
      REAL(wp), PARAMETER              ::  t_std   = 273.15_wp                 !< standard pressure (Pa)
      REAL(wp), PARAMETER              ::  p_std   = 101325.0_wp               !< standard pressure (Pa)
-     REAL(wp), PARAMETER              ::  r_cp    = 0.286_wp                  !< R / cp (exponent for potential temperature)
      REAL(wp), PARAMETER              ::  vmolcm  = 22.414e3_wp               !< Mole volume (22.414 l) in cm^{-3}
      REAL(wp), PARAMETER              ::  xna     = 6.022e23_wp               !< Avogadro number (molecules/mol)
@@ -1068,8 +1057,4 @@
    SUBROUTINE chem_check_data_output( var, unit, i, ilen, k )
 
-
-      USE control_parameters,                                                 &
-         ONLY: data_output, message_string
-
       IMPLICIT NONE
 
@@ -1077,7 +1062,5 @@
       CHARACTER (LEN=*) ::  var      !<
 
-      INTEGER(iwp) :: i, lsp
-      INTEGER(iwp) :: ilen
-      INTEGER(iwp) :: k
+      INTEGER(iwp) ::  i, ilen, k, lsp
 
       CHARACTER(len=16)    ::  spec_name
@@ -1278,12 +1261,9 @@
     INTEGER(iwp) ::  m                  !< running index surface type
     INTEGER(iwp) :: lsp                 !< running index for chem spcs
-    INTEGER(iwp) :: lsp_2               !< it looks like redundent .. will be delted ..bK
   
     IF ( mode == 'allocate' )  THEN
        DO lsp = 1, nspec
           IF (TRIM(variable(4:)) == TRIM(chem_species(lsp)%name)) THEN
-!                   lsp_2 = lsp 
              chem_species(lsp)%conc_av = 0.0_wp
-             
           ENDIF
        ENDDO
@@ -1293,5 +1273,4 @@
        DO lsp = 1, nspec
           IF (TRIM(variable(4:)) == TRIM(chem_species(lsp)%name)) THEN
-!                   lsp_2 = lsp 
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
@@ -1336,5 +1315,4 @@
        DO lsp = 1, nspec
           IF (TRIM(variable(4:)) == TRIM(chem_species(lsp)%name)) THEN
-!                   lsp_2 = lsp 
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
Index: palm/trunk/SOURCE/close_file.f90
===================================================================
--- palm/trunk/SOURCE/close_file.f90	(revision 3240)
+++ palm/trunk/SOURCE/close_file.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables and format statements removed
+! 
+! 3045 2018-05-28 07:55:41Z Giersch
 ! z_max_do2d removed and output case 108 disabled
 ! 
@@ -91,12 +94,6 @@
 
     USE control_parameters,                                                    &
-        ONLY:  max_masks, mid, nz_do3d, openfile, run_description_header
+        ONLY:  max_masks, mid, openfile
                 
-    USE grid_variables,                                                        &
-        ONLY:  dy
-        
-    USE indices,                                                               &
-        ONLY:  nx, ny, nz
-        
     USE kinds
     
@@ -106,5 +103,5 @@
 
     USE netcdf_interface,                                                      &
-        ONLY:  id_set_mask, id_set_pr, id_set_prt, id_set_pts, id_set_sp,      &
+        ONLY:  id_set_mask, id_set_pr, id_set_pts, id_set_sp,                  &
                id_set_ts, id_set_xy, id_set_xz, id_set_yz, id_set_3d,          &
                id_set_fl, nc_stat, netcdf_data_format, netcdf_handle_error
@@ -127,8 +124,4 @@
     LOGICAL ::  datleg = .TRUE.   !< 
     LOGICAL ::  dbp = .FALSE.     !< 
-
-    REAL(wp) ::  sizex            !< 
-    REAL(wp) ::  sizey            !< 
-    REAL(wp) ::  yright           !< 
 
     NAMELIST /GLOBAL/  checkuf, datform, dimx, dimy, dbp, planz,               &
@@ -282,19 +275,3 @@
     ENDDO
 
-!
-!-- Formats
-3200 FORMAT ('# AVS',A,'field file'/                                           &
-             '#'/                                                              &
-             '# ',A/                                                           &
-             'ndim=3'/                                                         &
-             'dim1=',I5/                                                       &
-             'dim2=',I5/                                                       &
-             'dim3=',I5/                                                       &
-             'nspace=3'/                                                       &
-             'veclen=',I5/                                                     &
-             'data=xdr_float'/                                                 &
-             'field=rectilinear')
-4000 FORMAT ('time averaged over',F7.1,' s')
-
-
  END SUBROUTINE close_file
Index: palm/trunk/SOURCE/coriolis.f90
===================================================================
--- palm/trunk/SOURCE/coriolis.f90	(revision 3240)
+++ palm/trunk/SOURCE/coriolis.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Remove masking of geostrophic wind forcing in offline nesting case
 ! 
@@ -112,5 +115,5 @@
            
        USE control_parameters,                                                 &
-           ONLY:  f, fs, message_string, nesting_offline
+           ONLY:  f, fs, message_string
            
        USE indices,                                                            &
@@ -211,5 +214,5 @@
            
        USE control_parameters,                                                 &
-           ONLY:  f, fs, message_string, nesting_offline
+           ONLY:  f, fs, message_string
            
        USE indices,                                                            &
Index: palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_2d.f90	(revision 3240)
+++ palm/trunk/SOURCE/data_output_2d.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3176 2018-07-26 17:12:48Z suehring
 ! Remove output of latent heat flux at urban-surfaces and set fill values 
 ! instead 
@@ -232,5 +235,5 @@
     USE arrays_3d,                                                             &
         ONLY:  dzw, e, heatflux_output_conversion, nc, nr, p, pt,              &
-               precipitation_amount, prr, q, qc, ql, ql_c, ql_v, ql_vp, qr,    &
+               precipitation_amount, prr, q, qc, ql, ql_c, ql_v, qr,           &
                rho_ocean, s, sa, tend, u, v, vpt, w, zu, zw,                   &
                waterflux_output_conversion
@@ -249,5 +252,5 @@
                ibc_uv_b, io_blocks, io_group, land_surface, message_string,    &
                ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz,                          &
-               psolver, section, simulated_time, simulated_time_chr,           &
+               psolver, section, simulated_time,                               &
                time_since_reference_point, uv_exposure
         
@@ -255,12 +258,9 @@
         ONLY:  cpu_log, log_point 
         
-    USE grid_variables,                                                        &
-        ONLY:  dx, dy
-
     USE gust_mod,                                                              &
         ONLY:  gust_data_output_2d, gust_module_enabled
         
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz,   &
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,       &
                nzb, nzt, wall_flags_0
                
@@ -304,5 +304,4 @@
     CHARACTER (LEN=2)  ::  mode         !< 
     CHARACTER (LEN=4)  ::  grid         !< 
-    CHARACTER (LEN=25) ::  section_chr  !< 
     CHARACTER (LEN=50) ::  rtext        !< 
     
@@ -325,5 +324,4 @@
     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) ::  psi       !< 
     INTEGER(iwp) ::  s_ind     !< 
     INTEGER(iwp) ::  sender    !< 
@@ -1399,5 +1397,5 @@
                 IF ( .NOT. found )  THEN
                    CALL tcm_data_output_2d( av, do2d(av,if), found, grid, mode,&
-                                             local_pf, two_d, nzb_do, nzt_do )
+                                             local_pf, nzb_do, nzt_do )
                 ENDIF
 
@@ -1420,5 +1418,5 @@
 !--             UV exposure model quantity
                 IF ( uv_exposure )  THEN
-                   CALL uvem_data_output_2d( av, do2d(av,if), found, grid, mode,&
+                   CALL uvem_data_output_2d( av, do2d(av,if), found, grid,     &
                                              local_pf, two_d, nzb_do, nzt_do )
                 ENDIF
Index: palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_3d.f90	(revision 3240)
+++ palm/trunk/SOURCE/data_output_3d.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables and format statements removed
+! 
+! 3049 2018-05-29 13:52:36Z Giersch
 ! Error messages revised
 ! 
@@ -227,6 +230,6 @@
         
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,  &
-               nzt, wall_flags_0
+        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,     &
+               wall_flags_0
         
     USE kinds
@@ -926,8 +929,3 @@
     CALL cpu_log( log_point(14), 'data_output_3d', 'stop' )
 
-!
-!-- Formats.
-3300 FORMAT ('variable ',I4,'  file=',A,'  filetype=unformatted  skip=',I12/   &
-             'label = ',A,A)
-
  END SUBROUTINE data_output_3d
Index: palm/trunk/SOURCE/data_output_flight.f90
===================================================================
--- palm/trunk/SOURCE/data_output_flight.f90	(revision 3240)
+++ palm/trunk/SOURCE/data_output_flight.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -47,6 +50,5 @@
 #if defined( __netcdf )
     USE control_parameters,                                                    &
-        ONLY:  message_string, num_leg, num_var_fl, run_description_header,    &
-               time_since_reference_point, virtual_flight
+        ONLY:  num_leg, num_var_fl, time_since_reference_point, virtual_flight
 
     USE cpulog,                                                                &
Index: palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- palm/trunk/SOURCE/data_output_mask.f90	(revision 3240)
+++ palm/trunk/SOURCE/data_output_mask.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variable removed
+! 
+! 3083 2018-06-19 14:03:12Z gronemeier
 ! 
 ! 
@@ -144,5 +147,5 @@
 
     USE indices,                                                               &
-        ONLY:  nbgp, nxl, nxr, nyn, nys, nzb, nzt
+        ONLY:  nbgp, nxl, nxr, nyn, nys, nzb
         
     USE kinds
@@ -173,5 +176,4 @@
     INTEGER(iwp) ::  n        !< 
     INTEGER(iwp) ::  netcdf_data_format_save !<
-    INTEGER(iwp) ::  psi      !< 
     INTEGER(iwp) ::  sender   !< 
     INTEGER(iwp) ::  ind(6)   !< 
Index: palm/trunk/SOURCE/data_output_profiles.f90
===================================================================
--- palm/trunk/SOURCE/data_output_profiles.f90	(revision 3240)
+++ palm/trunk/SOURCE/data_output_profiles.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused format statements removed
+! 
+! 2932 2018-03-26 09:39:22Z maronga
 ! renamed d3par to runtime_parameters
 ! 
@@ -346,9 +349,3 @@
     CALL cpu_log( log_point(15), 'data_output_profiles','stop' )
 
-!
-!-- Formats
-100 FORMAT ('#1 ',A,1X,A)
-101 FORMAT (E15.7,1X,E15.7)
-102 FORMAT ('NEXT')
-
  END SUBROUTINE data_output_profiles
Index: palm/trunk/SOURCE/data_output_spectra.f90
===================================================================
--- palm/trunk/SOURCE/data_output_spectra.f90	(revision 3240)
+++ palm/trunk/SOURCE/data_output_spectra.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -95,6 +98,5 @@
 #if defined( __netcdf )
     USE control_parameters,                                                    &
-        ONLY:  message_string, run_description_header,                         &
-               time_since_reference_point
+        ONLY:  message_string, time_since_reference_point
 
     USE cpulog,                                                                &
@@ -118,12 +120,7 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  cranz_x !<
-    INTEGER(iwp) ::  cranz_y !<
     INTEGER(iwp) ::  m       !<
     INTEGER(iwp) ::  pr      !<
     
-    LOGICAL      ::  frame_x !< 
-    LOGICAL      ::  frame_y !<
-
     CALL cpu_log( log_point(31), 'data_output_spectra', 'start' )
 
Index: palm/trunk/SOURCE/data_output_tseries.f90
===================================================================
--- palm/trunk/SOURCE/data_output_tseries.f90	(revision 3240)
+++ palm/trunk/SOURCE/data_output_tseries.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused format removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -158,7 +161,3 @@
     CALL cpu_log( log_point(21), 'data_output_tseries', 'stop' )
 
-!
-!-- formats
-500 FORMAT (23(E15.7,1X))
-
  END SUBROUTINE data_output_tseries
Index: palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_u.f90	(revision 3240)
+++ palm/trunk/SOURCE/diffusion_u.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -136,5 +139,5 @@
        
        USE indices,                                                            &
-           ONLY:  nxl, nxlu, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt, wall_flags_0
      
        USE kinds
Index: palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_v.f90	(revision 3240)
+++ palm/trunk/SOURCE/diffusion_v.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -131,5 +134,5 @@
        
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nys, nysv, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_0
        
        USE kinds
Index: palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_w.f90	(revision 3240)
+++ palm/trunk/SOURCE/diffusion_w.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -126,7 +129,4 @@
        USE arrays_3d,                                                          &          
            ONLY :  ddzu, ddzw, km, tend, u, v, w, drho_air_zw, rho_air
-           
-       USE control_parameters,                                                 & 
-           ONLY :  topography
            
        USE grid_variables,                                                     &     
@@ -305,12 +305,9 @@
            ONLY :  ddzu, ddzw, km, tend, u, v, w, drho_air_zw, rho_air
            
-       USE control_parameters,                                                 & 
-           ONLY :  topography
-           
        USE grid_variables,                                                     &     
            ONLY :  ddx, ddy
            
        USE indices,                                                            &            
-           ONLY :  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY :  nzb, nzt, wall_flags_0
            
        USE kinds
Index: palm/trunk/SOURCE/disturb_heatflux.f90
===================================================================
--- palm/trunk/SOURCE/disturb_heatflux.f90	(revision 3240)
+++ palm/trunk/SOURCE/disturb_heatflux.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variable removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -91,5 +94,5 @@
     USE random_generator_parallel,                                             &
         ONLY:  random_number_parallel, random_seed_parallel, random_dummy,     &
-               id_random_array, seq_random_array
+               seq_random_array
 
     USE surface_mod,                                                           &
Index: palm/trunk/SOURCE/eqn_state_seawater.f90
===================================================================
--- palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 3240)
+++ palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -143,8 +146,5 @@
        INTEGER(iwp) ::  j       !< running index y direction
        INTEGER(iwp) ::  k       !< running index z direction
-       INTEGER(iwp) ::  l       !< running index of surface type, south- or north-facing wall
        INTEGER(iwp) ::  m       !< running index surface elements
-       INTEGER(iwp) ::  surf_e  !< End index of surface elements at (j,i)-gridpoint
-       INTEGER(iwp) ::  surf_s  !< Start index of surface elements at (j,i)-gridpoint
 
        REAL(wp) ::  pden   !<
@@ -258,5 +258,4 @@
        INTEGER(iwp) ::  j       !< running index y direction
        INTEGER(iwp) ::  k       !< running index z direction
-       INTEGER(iwp) ::  l       !< running index of surface type, south- or north-facing wall
        INTEGER(iwp) ::  m       !< running index surface elements
        INTEGER(iwp) ::  surf_e  !< End index of surface elements at (j,i)-gridpoint
Index: palm/trunk/SOURCE/exchange_horiz.f90
===================================================================
--- palm/trunk/SOURCE/exchange_horiz.f90	(revision 3240)
+++ palm/trunk/SOURCE/exchange_horiz.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -98,6 +101,6 @@
 
     USE control_parameters,                                                    &
-        ONLY:  bc_lr, bc_lr_cyc, bc_ns, bc_ns_cyc, grid_level,                 &
-               mg_switch_to_pe0, synchronous_exchange
+        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, mg_switch_to_pe0,             &
+               synchronous_exchange
                 
     USE cpulog,                                                                &
@@ -114,7 +117,4 @@
 
 
-    INTEGER(iwp) ::  i           !<
-    INTEGER(iwp) ::  j           !<
-    INTEGER(iwp) ::  k           !<
     INTEGER(iwp) ::  nbgp_local  !<
     
@@ -252,10 +252,10 @@
 !-- workaround has to be removed later. Also, since PGI compiler 12.5 has problems
 !-- with array syntax, explicit loops are used.
-    IF ( bc_lr == 'cyclic' )  THEN
+    IF ( bc_lr_cyc )  THEN
        ar(:,:,nxl-nbgp_local:nxl-1) = ar(:,:,nxr-nbgp_local+1:nxr)
        ar(:,:,nxr+1:nxr+nbgp_local) = ar(:,:,nxl:nxl+nbgp_local-1)
     ENDIF
 
-    IF ( bc_ns == 'cyclic' )  THEN
+    IF ( bc_ns_cyc )  THEN
        ar(:,nys-nbgp_local:nys-1,:) = ar(:,nyn-nbgp_local+1:nyn,:)
        ar(:,nyn+1:nyn+nbgp_local,:) = ar(:,nys:nys+nbgp_local-1,:)
@@ -276,8 +276,8 @@
 
     USE control_parameters,                                                    &
-        ONLY:  bc_lr, bc_lr_cyc, bc_ns, bc_ns_cyc, grid_level
+        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level
                        
     USE indices,                                                               &
-        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
+        ONLY:  nzb
         
     USE kinds
@@ -354,10 +354,10 @@
 #else
 
-    IF ( bc_lr == 'cyclic' )  THEN
+    IF ( bc_lr_cyc )  THEN
        ar(:,:,nxl_l-nbgp_local:nxl_l-1) = ar(:,:,nxr_l-nbgp_local+1:nxr_l)
        ar(:,:,nxr_l+1:nxr_l+nbgp_local) = ar(:,:,nxl_l:nxl_l+nbgp_local-1)
     ENDIF
 
-    IF ( bc_ns == 'cyclic' )  THEN
+    IF ( bc_ns_cyc )  THEN
        ar(:,nys_l-nbgp_local:nys_l-1,:) = ar(:,nyn_l-nbgp_local+1:nyn_l,:)
        ar(:,nyn_l+1:nyn_l+nbgp_local,:) = ar(:,nys_l:nys_l+nbgp_local-1,:)
Index: palm/trunk/SOURCE/fft_xy_mod.f90
===================================================================
--- palm/trunk/SOURCE/fft_xy_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/fft_xy_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! preprocessor switches for variables that are required on NEC only
+! 
+! 3045 2018-05-28 07:55:41Z Giersch
 ! Error messages revised
 ! 
@@ -1515,5 +1518,7 @@
        INTEGER(iwp) ::  k     !<
        INTEGER(iwp) ::  siza  !<
-       INTEGER(iwp) ::  sizw  !< required on NEC only
+#if defined( __nec )
+       INTEGER(iwp) ::  sizw
+#endif
 
        REAL(wp), DIMENSION(0:nx,nz)       ::  ar     !<
@@ -1521,5 +1526,7 @@
        REAL(wp), DIMENSION(6*(nx+4),nz+1) ::  work1  !<
        
-       COMPLEX(wp), DIMENSION(:,:), ALLOCATABLE ::  work  !< required on NEC only
+#if defined( __nec )
+       COMPLEX(wp), DIMENSION(:,:), ALLOCATABLE ::  work
+#endif
 
        IF ( fft_method == 'temperton-algorithm' )  THEN
@@ -1647,11 +1654,15 @@
        INTEGER(iwp) ::  ny1   !<
        INTEGER(iwp) ::  siza  !<
-       INTEGER(iwp) ::  sizw  !< required on NEC only
+#if defined( __nec )
+       INTEGER(iwp) ::  sizw
+#endif
 
        REAL(wp), DIMENSION(0:ny1,nz)      ::  ar     !<
        REAL(wp), DIMENSION(0:ny+3,nz+1)   ::  ai     !<
        REAL(wp), DIMENSION(6*(ny+4),nz+1) ::  work1  !<
-       
-       COMPLEX(wp), DIMENSION(:,:), ALLOCATABLE ::  work !< required on NEC only
+
+#if defined( __nec )
+       COMPLEX(wp), DIMENSION(:,:), ALLOCATABLE ::  work
+#endif
 
 
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 3240)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3042 2018-05-25 10:44:37Z schwenkel
 ! Changed the name specific humidity to mixing ratio
 ! 
@@ -287,5 +290,5 @@
     USE control_parameters,                                                    &
         ONLY:   average_count_pr, cloud_droplets, cloud_physics, do_sum,       &
-                dt_3d, g, humidity, initializing_actions, kappa, land_surface, &
+                dt_3d, g, humidity, initializing_actions, land_surface,        &
                 large_scale_forcing, large_scale_subsidence, max_pr_user,      &
                 message_string, neutral, microphysics_morrison,                &
@@ -348,5 +351,5 @@
     INTEGER(iwp) ::  l                   !< loop variable over surface facing -- up- or downward-facing
     INTEGER(iwp) ::  nt                  !<
-    INTEGER(iwp) ::  omp_get_thread_num  !<
+!$  INTEGER(iwp) ::  omp_get_thread_num  !<
     INTEGER(iwp) ::  sr                  !<
     INTEGER(iwp) ::  tn                  !<
@@ -359,5 +362,4 @@
     REAL(wp) ::  height           !<
     REAL(wp) ::  pts              !<
-    REAL(wp) ::  sums_l_eper      !<
     REAL(wp) ::  sums_l_etot      !<
     REAL(wp) ::  ust              !<
@@ -675,5 +677,5 @@
 !--          are zero at the walls and inside buildings.
        tn = 0
-       !$OMP PARALLEL PRIVATE( i, j, k, pts, sums_ll, sums_l_eper,             &
+       !$OMP PARALLEL PRIVATE( i, j, k, pts, sums_ll,                          &
        !$OMP                   sums_l_etot, tn, ust, ust2, u2, vst, vst2, v2,  &
        !$OMP                   w2, flag, m, ki, l )
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 3240)
+++ palm/trunk/SOURCE/header.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3232 2018-09-07 12:21:44Z raasch
 ! Increase printed length of run identifier
 ! 
@@ -465,5 +468,4 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=1)  ::  prec                !<
     
     CHARACTER (LEN=2)  ::  do2d_mode           !<
@@ -524,6 +526,4 @@
     INTEGER(iwp) ::  i              !<
     INTEGER(iwp) ::  io             !<
-    INTEGER(iwp) ::  j              !<
-    INTEGER(iwp) ::  k              !<
     INTEGER(iwp) ::  l              !<
     INTEGER(iwp) ::  ll             !<
@@ -576,9 +576,9 @@
        CALL message( 'header', 'PA0191', 0, 0, 0, 6, 0 )
     ENDIF
-    IF ( nested_run )  run_classification = 'nested ' // run_classification
+    IF ( nested_run )  run_classification = 'nested ' // run_classification(1:63)
     IF ( ocean )  THEN
-       run_classification = 'ocean - ' // run_classification
+       run_classification = 'ocean - ' // run_classification(1:61)
     ELSE
-       run_classification = 'atmosphere - ' // run_classification
+       run_classification = 'atmosphere - ' // run_classification(1:57)
     ENDIF
 
@@ -1884,6 +1884,6 @@
     WRITE ( io, 410 )  latitude, longitude, omega, f, fs
 
- !
-!-- Geostrophic parameters
+!
+!-- Day of year, UTC
     WRITE ( io, 456 )  day_of_year_init, time_utc_init
     
@@ -2334,6 +2334,4 @@
             '    Specific heat cap. :   c_p   = ',F6.1,' J/(kg K)'/ &
             '    Vapourization heat :   L_v   =',E9.2,' J/kg')
-418 FORMAT (/'    Day of the year at model start :   day_init      =     ',I3 &
-            /'    UTC time at model start        :   time_utc_init = ',F7.1' s')
 420 FORMAT (/'    Characteristic levels of the initial temperature profile:'// &
             '       Height:        ',A,'  m'/ &
@@ -2400,6 +2398,6 @@
 454 FORMAT ('    TKE is not allowed to fall below ',E9.2,' (m/s)**2')
 455 FORMAT ('    initial TKE is prescribed as ',E9.2,' (m/s)**2')
-456 FORMAT ('    Day of the year at model start :   day_init = ',I3             &
-            /'    UTC time at model start        :   time_utc_init = ',F7.1' s')
+456 FORMAT (/'    Day of the year at model start :   day_init      =     ',I3 &
+            /'    UTC time at model start        :   time_utc_init = ',F7.1,' s')
 457 FORMAT ('    RANS-mode constants: c_0 = ',F9.5/         &
             '                         c_1 = ',F9.5/         &
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 3240)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3234 2018-09-07 13:46:58Z schwenkel
 ! The increase of dots_num in case of radiation or land surface model must 
 ! be done before user_init is called
@@ -529,9 +532,8 @@
 
     USE microphysics_mod,                                                      &
-        ONLY:  collision_turbulence, microphysics_init
+        ONLY:  microphysics_init
 
     USE model_1d_mod,                                                          &
-        ONLY:  e1d, init_1d_model, kh1d, km1d, l1d, rif1d, u1d, us1d, usws1d,  &
-               v1d, vsws1d 
+        ONLY:  init_1d_model, l1d, u1d, v1d
 
     USE multi_agent_system_mod,                                                &
@@ -545,5 +547,5 @@
     
     USE particle_attributes,                                                   &
-        ONLY:  particle_advection, use_sgs_for_particles, wang_kernel
+        ONLY:  particle_advection
     
     USE pegrid
@@ -1613,5 +1615,5 @@
        
        IF ( random_generator == 'random-parallel' )  THEN
-          CALL init_parallel_random_generator(nx, ny, nys, nyn, nxl, nxr)
+          CALL init_parallel_random_generator( nx, nys, nyn, nxl, nxr )
        ENDIF
 !
Index: palm/trunk/SOURCE/init_cloud_physics.f90
===================================================================
--- palm/trunk/SOURCE/init_cloud_physics.f90	(revision 3240)
+++ palm/trunk/SOURCE/init_cloud_physics.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! ------------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -95,9 +98,8 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  dzu, hyp, pt_init, zu
+        ONLY:  hyp, pt_init, zu
         
     USE cloud_parameters,                                                      &
-        ONLY:  cp, hyrho, l_d_cp, l_d_r, l_d_rv, l_v, pt_d_t, rho_l, r_d, r_v, &
-               t_d_pt
+        ONLY:  cp, hyrho, l_d_cp, l_d_r, l_d_rv, l_v, pt_d_t, r_d, r_v, t_d_pt
                 
     USE control_parameters,                                                    &
Index: palm/trunk/SOURCE/init_grid.f90
===================================================================
--- palm/trunk/SOURCE/init_grid.f90	(revision 3240)
+++ palm/trunk/SOURCE/init_grid.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3200 2018-08-17 14:46:36Z suehring
 ! Bugfix, missing pre-processor directive
 ! 
@@ -351,19 +354,11 @@
                bc_dirichlet_s, bc_lr_cyc, bc_ns_cyc, bc_radiation_l,           &
                bc_radiation_n, bc_radiation_r, bc_radiation_s,                 &
-               building_height, building_length_x,                             &
-               building_length_y, building_wall_left, building_wall_south,     &
-               canyon_height, canyon_wall_left, canyon_wall_south,             &
-               canyon_width_x, canyon_width_y, constant_flux_layer,            &
-               dp_level_ind_b, dz, dz_max, dz_stretch_factor,                  &   
+               constant_flux_layer, dz, dz_max, dz_stretch_factor,             &
                dz_stretch_factor_array, dz_stretch_level, dz_stretch_level_end,&
                dz_stretch_level_end_index, dz_stretch_level_start_index,       &
-               dz_stretch_level_start, grid_level,                             &
-               ibc_uv_b, masking_method, maximum_grid_level, message_string,   &
+               dz_stretch_level_start, ibc_uv_b, message_string,               &
                momentum_advec, number_stretch_level_end,                       &
                number_stretch_level_start,ocean, psolver, scalar_advec,        &
-               topography, topography_grid_convention, tunnel_height,          &
-               tunnel_length, tunnel_width_x, tunnel_width_y,                  &
-               tunnel_wall_depth, use_surface_fluxes, use_top_fluxes,          &
-               wall_adjustment_factor
+               topography, use_surface_fluxes
          
     USE grid_variables,                                                        &
@@ -395,5 +390,4 @@
     INTEGER(iwp) ::  k             !< index variable along z
     INTEGER(iwp) ::  k_top         !< topography top index on local PE
-    INTEGER(iwp) ::  l             !< loop variable 
     INTEGER(iwp) ::  n             !< loop variable for stretching
     INTEGER(iwp) ::  number_dz     !< number of user-specified dz values       
@@ -1150,5 +1144,5 @@
  
     USE control_parameters,                                                    &
-        ONLY:  dz, dz_stretch_factor, dz_stretch_factor_array,                 &   
+        ONLY:  dz, dz_stretch_factor_array,                 &
                dz_stretch_level_end, dz_stretch_level_start, message_string
   
@@ -1299,6 +1293,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  bc_lr_cyc, bc_ns_cyc, land_surface, message_string, ocean,      &
-               urban_surface
+        ONLY:  bc_lr_cyc, bc_ns_cyc, message_string, ocean
 
     USE indices,                                                               &
@@ -1903,5 +1896,5 @@
                canyon_height, canyon_wall_left, canyon_wall_south,             &
                canyon_width_x, canyon_width_y, dp_level_ind_b, dz,             &
-               message_string, ocean, topography, topography_grid_convention,  &
+               message_string, topography, topography_grid_convention,         &
                tunnel_height, tunnel_length, tunnel_width_x, tunnel_width_y,   &
                tunnel_wall_depth
@@ -2472,6 +2465,6 @@
 
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz,   &
-               nzb, nzt, wall_flags_0
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,  &
+               nzt, wall_flags_0
 
     USE kinds
Index: palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- palm/trunk/SOURCE/init_pegrid.f90	(revision 3240)
+++ palm/trunk/SOURCE/init_pegrid.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Rename variables and boundary conditions in mesoscale-offline nesting mode
 ! 
@@ -244,8 +247,7 @@
         ONLY:  bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, bc_dirichlet_s, &
                bc_lr, bc_ns, bc_radiation_l, bc_radiation_n, bc_radiation_r,   &
-               bc_radiation_s, coupling_mode, coupling_mode_remote,            &
-               coupling_topology, gathered_size, grid_level,                   &
-               grid_level_count, maximum_grid_level, message_string,           &
-               mg_switch_to_pe0_level, momentum_advec, neutral,                &
+               bc_radiation_s, coupling_mode, coupling_topology, gathered_size,&
+               grid_level, grid_level_count, maximum_grid_level,               &
+               message_string, mg_switch_to_pe0_level, momentum_advec, neutral,&
                psolver, outflow_source_plane, recycling_width, scalar_advec,   &
                subdomain_size, turbulent_outflow, y_shift
@@ -299,5 +301,4 @@
     INTEGER(iwp) ::  mg_switch_to_pe0_level_l !<
     INTEGER(iwp) ::  nnx_y                    !<
-    INTEGER(iwp) ::  nnx_z                    !<
     INTEGER(iwp) ::  nny_x                    !<
     INTEGER(iwp) ::  nny_z                    !<
@@ -311,5 +312,5 @@
     INTEGER(iwp) ::  nzb_l                    !<
     INTEGER(iwp) ::  nzt_l                    !<
-    INTEGER(iwp) ::  omp_get_num_threads      !<
+!$  INTEGER(iwp) ::  omp_get_num_threads      !<
 
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ind_all !<
Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3233 2018-09-07 13:21:24Z schwenkel
 ! Adapted for the use of cloud_droplets 
 ! 
@@ -565,5 +568,4 @@
                 drho_l_lv,                              & !< (rho_l * l_v)**-1
                 exn,                                    & !< value of the Exner function
-                e_s = 0.0_wp,                           & !< saturation water vapour pressure
                 field_capacity = 9999999.9_wp,          & !< NAMELIST m_fc
                 f_shortwave_incoming = 9999999.9_wp,    & !< NAMELIST f_sw_in
@@ -1257,5 +1259,4 @@
     CHARACTER (LEN=*) ::  dopr_unit !< local value of dopr_unit
  
-    INTEGER(iwp) ::  user_pr_index !< 
     INTEGER(iwp) ::  var_count     !< 
 
@@ -2480,5 +2481,4 @@
        INTEGER(iwp) ::  st                      !< soil-type index
        INTEGER(iwp) ::  n_soil_layers_total     !< temperature variable, stores the total number of soil layers + 4 
-       INTEGER(iwp) ::  n_surf                  !< number of surface types of given surface element 
 
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  bound, bound_root_fr  !< temporary arrays for storing index bounds
@@ -6442,7 +6442,5 @@
     REAL(wp), DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_2d   !< 
 
-    REAL(wp), DIMENSION(nzb_soil:nzt_soil+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !< 
-
-    REAL(wp), DIMENSION(nzb_soil:nzt_soil,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d2   !< 
+    REAL(wp), DIMENSION(nzb_soil:nzt_soil,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
 
     TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_1d   !< temporary 1D array containing the respective surface variable stored on file, horizontal surfaces
@@ -6554,8 +6552,8 @@
                  ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
               ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_3d2(:,:,:)
+              IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)
               m_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
-                 tmp_3d2(nzb_soil:nzt_soil,nysf                                &
-                         -nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+                 tmp_3d(nzb_soil:nzt_soil,nysf                                 &
+                        -nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
            CASE ( 'qsws_liq_av' )
@@ -6586,8 +6584,7 @@
                  ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
               ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_3d2(:,:,:)
+              IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)
               t_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
-                 tmp_3d2(:,nysf-nbgp:nynf+nbgp,                                &
-                         nxlf-nbgp:nxrf+nbgp)
+                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
            CASE ( 'lsm_start_index_h', 'lsm_start_index_v'  )   
@@ -7014,5 +7011,5 @@
 
        USE control_parameters,                                                 &
-           ONLY: g, kappa, message_string, molecular_viscosity
+           ONLY: g, message_string, molecular_viscosity
 
        IMPLICIT NONE
Index: palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90
===================================================================
--- palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! * Adjustment to new Inifor version: 
 !   - No vertical interpolation/extrapolation of lateral boundary data required
@@ -289,5 +292,4 @@
        INTEGER(iwp) ::  j !< running index y-direction
        INTEGER(iwp) ::  k !< running index z-direction
-       INTEGER(iwp) ::  t !< running index for time levels
 
        REAL(wp) ::  ddt_lsf !< inverse value of time resolution of forcing data
@@ -718,5 +720,4 @@
        CHARACTER (LEN=*) ::  dopr_unit !< local value of dopr_unit
  
-       INTEGER(iwp) ::  user_pr_index !<    
        INTEGER(iwp) ::  var_count     !< 
 
@@ -943,5 +944,4 @@
        INTEGER(iwp) ::  k             !<
        INTEGER(iwp) ::  nt            !<
-       INTEGER(iwp) ::  t             !< running index for time levels
 
        REAL(wp) ::  fac               !<
Index: palm/trunk/SOURCE/lpm_advec.f90
===================================================================
--- palm/trunk/SOURCE/lpm_advec.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_advec.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3207 2018-08-27 12:55:33Z schwenkel
 ! Minor bugfix for sgs-velocities in case of cloud droplets
 ! 
@@ -175,9 +178,9 @@
 
     USE control_parameters,                                                    &
-        ONLY:  atmos_ocean_sign, cloud_droplets, constant_flux_layer, dt_3d,   &
-               dt_3d_reached_l, dz, g, kappa, topography, u_gtrans, v_gtrans
+        ONLY:  cloud_droplets, constant_flux_layer, dt_3d, dt_3d_reached_l,    &
+               dz, g, kappa, topography, u_gtrans, v_gtrans
 
     USE grid_variables,                                                        &
-        ONLY:  ddx, dx, ddy, dy
+        ONLY:  dx, dy
         
     USE indices,                                                               &
@@ -187,7 +190,7 @@
     
     USE particle_attributes,                                                   &
-        ONLY:  block_offset, c_0, dt_min_part, grid_particles,                 &
-               iran_part, log_z_z0, number_of_particles, number_of_sublayers,  &
-               particles, particle_groups, offset_ocean_nzt, sgs_wf_part,      &
+        ONLY:  block_offset, c_0, dt_min_part, grid_particles, iran_part,      &
+               log_z_z0, number_of_particles, number_of_sublayers,             &
+               particles, particle_groups, sgs_wf_part,                        &
                use_sgs_for_particles, vertical_particle_advection, z0_av_global
         
@@ -202,6 +205,4 @@
     LOGICAL ::  subbox_at_wall !< flag to see if the current subgridbox is adjacent to a wall
 
-    INTEGER(iwp) ::  agp                         !< loop variable
-    INTEGER(iwp) ::  gp_outside_of_building(1:8) !< number of grid points used for particle interpolation in case of topography 
     INTEGER(iwp) ::  i                           !< index variable along x
     INTEGER(iwp) ::  ip                          !< index variable along x 
@@ -214,5 +215,4 @@
     INTEGER(iwp) ::  n                           !< loop variable over all particles in a grid box
     INTEGER(iwp) ::  nb                          !< block number particles are sorted in
-    INTEGER(iwp) ::  num_gp                      !< number of adjacent grid points inside topography 
     INTEGER(iwp) ::  surf_start                  !< Index on surface data-type for current grid box 
 
@@ -223,5 +223,4 @@
     REAL(wp) ::  bb                 !< dummy argument for horizontal particle interpolation 
     REAL(wp) ::  cc                 !< dummy argument for horizontal particle interpolation 
-    REAL(wp) ::  d_sum              !< dummy argument for horizontal particle interpolation in case of topography 
     REAL(wp) ::  d_z_p_z0           !< inverse of interpolation length for logarithmic interpolation 
     REAL(wp) ::  dd                 !< dummy argument for horizontal particle interpolation 
@@ -246,5 +245,4 @@
     REAL(wp) ::  gg                 !< dummy argument for horizontal particle interpolation 
     REAL(wp) ::  height_p           !< dummy argument for logarithmic interpolation
-    REAL(wp) ::  location(1:30,1:3) !< wall locations
     REAL(wp) ::  log_z_z0_int       !< logarithmus used for surface_layer interpolation
     REAL(wp) ::  random_gauss       !<
@@ -276,11 +274,4 @@
     REAL(wp), PARAMETER ::  d0_rog = 0.745_wp    !< separation diameter
 
-    REAL(wp), DIMENSION(1:30) ::  d_gp_pl !< dummy argument for particle interpolation scheme in case of topography
-    REAL(wp), DIMENSION(1:30) ::  de_dxi  !< horizontal TKE gradient along x at adjacent wall 
-    REAL(wp), DIMENSION(1:30) ::  de_dyi  !< horizontal TKE gradient along y at adjacent wall 
-    REAL(wp), DIMENSION(1:30) ::  de_dzi  !< horizontal TKE gradient along z at adjacent wall 
-    REAL(wp), DIMENSION(1:30) ::  dissi   !< dissipation at adjacent wall
-    REAL(wp), DIMENSION(1:30) ::  ei      !< TKE at adjacent wall
-
     REAL(wp), DIMENSION(number_of_particles) ::  term_1_2       !< flag to communicate whether a particle is near topography or not
     REAL(wp), DIMENSION(number_of_particles) ::  dens_ratio     !<
@@ -1151,5 +1142,4 @@
     REAL(wp) ::  fac     !< flag to identify adjacent topography
     REAL(wp) ::  fs_n    !< weighting factor to prevent that subgrid-scale particle speed becomes too large
-    REAL(wp) ::  sgs_w   !< constant (1/3)
     REAL(wp) ::  rg_n    !< random number
     REAL(wp) ::  term1   !< memory term
@@ -1183,5 +1173,5 @@
 !
 !-- Random term
-    term3 = SQRT( MAX( a1, 1E-20 ) ) * ( rg_n - 1.0_wp ) * SQRT( dt_n )
+    term3 = SQRT( MAX( a1, 1E-20_wp ) ) * ( rg_n - 1.0_wp ) * SQRT( dt_n )
 !
 !-- In cese one of the adjacent grid-boxes belongs to topograhy, the previous
Index: palm/trunk/SOURCE/lpm_boundary_conds.f90
===================================================================
--- palm/trunk/SOURCE/lpm_boundary_conds.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_boundary_conds.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3189 2018-08-06 13:18:55Z Giersch
 ! Bugfix in calculation of the x/y indices for current particle postion
 ! 
@@ -119,8 +122,8 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  zu, zw
+        ONLY:  zw
 
     USE control_parameters,                                                    &
-        ONLY:  dz, message_string, particle_maximum_age
+        ONLY:  message_string, particle_maximum_age
 
     USE cpulog,                                                                &
@@ -131,5 +134,5 @@
 
     USE indices,                                                               &
-        ONLY:  nxl, nxr, nyn, nys, nz, nzb, wall_flags_0,nyng,nysg
+        ONLY:  nxl, nxr, nyn, nys, nz, wall_flags_0
 
     USE kinds
@@ -137,6 +140,5 @@
     USE particle_attributes,                                                   &
         ONLY:  deleted_particles, ibc_par_b, ibc_par_t, number_of_particles,   &
-               particles, particle_type, offset_ocean_nzt_m1,                  &
-               use_sgs_for_particles
+               particles, particle_type, use_sgs_for_particles
 
     USE pegrid
@@ -191,5 +193,4 @@
 
     REAL(wp) ::  dt_particle    !< particle timestep
-    REAL(wp) ::  dum            !< dummy argument
     REAL(wp) ::  eps = 1E-10_wp !< security number to check if particle has reached a wall
     REAL(wp) ::  pos_x          !< intermediate particle position (x)
Index: palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90
===================================================================
--- palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3039 2018-05-24 13:13:11Z schwenkel
 ! bugfix for lcm with grid stretching
 ! 
@@ -79,5 +82,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  dz, message_string, rho_surface
+        ONLY:  message_string, rho_surface
 
     USE cpulog,                                                                &
Index: palm/trunk/SOURCE/lpm_droplet_collision.f90
===================================================================
--- palm/trunk/SOURCE/lpm_droplet_collision.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_droplet_collision.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3039 2018-05-24 13:13:11Z schwenkel
 ! bugfix for lcm with grid stretching
 ! 
@@ -126,5 +129,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  dt_3d, message_string, dz
+        ONLY:  dt_3d, message_string
 
     USE cpulog,                                                                &
Index: palm/trunk/SOURCE/lpm_droplet_condensation.f90
===================================================================
--- palm/trunk/SOURCE/lpm_droplet_condensation.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_droplet_condensation.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3049 2018-05-29 13:52:36Z Giersch
 ! Error messages revised
 ! 
@@ -136,5 +139,5 @@
 
     USE cloud_parameters,                                                      &
-        ONLY:  l_d_rv, l_v, molecular_weight_of_solute,                        &
+        ONLY:  l_v, molecular_weight_of_solute,                        &
                molecular_weight_of_water, rho_l, rho_s, r_v, vanthoff
 
@@ -143,5 +146,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  dt_3d, dz, message_string, molecular_viscosity, rho_surface
+        ONLY:  dt_3d, message_string, molecular_viscosity, rho_surface
 
     USE cpulog,                                                                &
@@ -160,6 +163,6 @@
 
     USE particle_attributes,                                                   &
-        ONLY:  curvature_solution_effects, hall_kernel, number_of_particles,   &
-               particles, radius_classes, use_kernel_tables, wang_kernel
+        ONLY:  curvature_solution_effects, number_of_particles,   &
+               particles, radius_classes, use_kernel_tables
 
     IMPLICIT NONE
Index: palm/trunk/SOURCE/lpm_init.f90
===================================================================
--- palm/trunk/SOURCE/lpm_init.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_init.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3065 2018-06-12 07:03:02Z Giersch
 ! dz was replaced by dzw or dz(1) to allow for right vertical stretching
 ! 
@@ -1051,6 +1054,6 @@
 
     USE cloud_parameters,                                                      &
-        ONLY: l_d_rv, molecular_weight_of_solute,                              &
-              molecular_weight_of_water, rho_l, r_v, rho_s, vanthoff
+        ONLY: molecular_weight_of_solute, molecular_weight_of_water, rho_l,    &
+              r_v, rho_s, vanthoff
 
     USE constants,                                                             &
Index: palm/trunk/SOURCE/lpm_init_sgs_tke.f90
===================================================================
--- palm/trunk/SOURCE/lpm_init_sgs_tke.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_init_sgs_tke.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -82,6 +85,5 @@
 
     USE indices,                                                               &
-        ONLY:  nbgp, ngp_2dh_outer, nxl, nxr, nyn, nys, nzb,                   &
-               nzb_s_outer, nzt, wall_flags_0
+        ONLY:  nbgp, ngp_2dh_outer, nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
 
     USE kinds
@@ -222,5 +224,5 @@
              DO  k = nzb, nzt+1
 !
-!--             Flag indicate nzb_s_outer 
+!--             Flag indicating vicinity of wall
                 flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 24 ) )
 
@@ -262,5 +264,5 @@
              DO  k = nzb, nzt+1
 !
-!--             Flag indicate nzb_s_outer 
+!--             Flag indicating vicinity of wall
                 flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 24 ) )
 
Index: palm/trunk/SOURCE/lpm_merging.f90
===================================================================
--- palm/trunk/SOURCE/lpm_merging.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_merging.f90	(revision 3241)
@@ -25,15 +25,13 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
-! 
-! 
 ! Change in file header (GPL part)
-!
 ! Added comments
-! 
 ! 
 ! 2263 2017-06-08 14:59:01Z schwenkel
 ! Initial revision
-! 
 ! 
 !
@@ -64,5 +62,5 @@
     USE particle_attributes,                                                   &
         ONLY:  deleted_particles, grid_particles, initial_weighting_factor,    &     
-               merge_drp, merging, number_of_particles, particles, prt_count,  &
+               merge_drp, number_of_particles, particles, prt_count,           &
                radius_merge, sum_merge_drp, weight_factor_merge
 
Index: palm/trunk/SOURCE/lpm_pack_arrays.f90
===================================================================
--- palm/trunk/SOURCE/lpm_pack_arrays.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_pack_arrays.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2801 2018-02-14 16:01:55Z thiele
 ! Introduce particle transfer in nested models.
 ! 
@@ -123,20 +126,18 @@
     SUBROUTINE lpm_sort_in_subboxes
 
-       USE cpulog,                                                              &
+       USE cpulog,                                                             &
           ONLY:  cpu_log, log_point_s
 
-       USE indices,                                                             &
+       USE indices,                                                            &
           ONLY:  nxl, nxr, nys, nyn, nzb, nzt
 
        USE kinds
 
-       USE control_parameters,                                                  &
-          ONLY: dz
-       
-       USE grid_variables,                                                      &
+       USE grid_variables,                                                     &
           ONLY: dx,dy,ddx, ddy
            
-       USE arrays_3d,                                                           &
+       USE arrays_3d,                                                          &
           ONLY:  zu
+
        IMPLICIT NONE
 
@@ -146,5 +147,4 @@
        INTEGER(iwp) ::  j  !<
        INTEGER(iwp) ::  jp !<
-       INTEGER(iwp) ::  k  !<
        INTEGER(iwp) ::  kp !<
        INTEGER(iwp) ::  m  !<
Index: palm/trunk/SOURCE/lpm_set_attributes.f90
===================================================================
--- palm/trunk/SOURCE/lpm_set_attributes.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_set_attributes.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3065 2018-06-12 07:03:02Z Giersch
 ! dz was replaced by dzw to allow for right vertical stretching
 ! 
@@ -83,5 +86,5 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  dzw, pt, u, v, w, zu, zw
+        ONLY:  dzw, pt, u, v, zu
 
     USE control_parameters,                                                    &
@@ -92,6 +95,5 @@
 
     USE dvrp_variables,                                                        &
-        ONLY:  color_interval, dvrp_colortable_entries_prt, dvrpsize_interval, &
-               particle_color, particle_dvrpsize
+        ONLY:  color_interval, dvrp_colortable_entries_prt, particle_color
 
     USE grid_variables,                                                        &
@@ -140,7 +142,4 @@
     REAL(wp)    ::  v_int_l   !<
     REAL(wp)    ::  v_int_u   !<
-    REAL(wp)    ::  w_int     !<
-    REAL(wp)    ::  w_int_l   !<
-    REAL(wp)    ::  w_int_u   !<
     REAL(wp)    ::  x         !<
     REAL(wp)    ::  y         !<
Index: palm/trunk/SOURCE/lpm_splitting.f90
===================================================================
--- palm/trunk/SOURCE/lpm_splitting.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_splitting.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2932 2018-03-26 09:39:22Z maronga
 ! renamed particles_par to particle_parameters
 ! 
@@ -76,10 +79,8 @@
 
     USE particle_attributes,                                                   &
-        ONLY:  grid_particles, iran_part, initial_weighting_factor, isf,       &
-               i_splitting_mode, max_number_particles_per_gridbox,             &  
-               new_particles, n_max, number_concentration,                     &
-               number_of_particles, number_particles_per_gridbox, particles,   &
-               particle_type, prt_count, radius_split, splitting,              &
-               splitting_factor, splitting_factor_max, splitting_mode,         &
+        ONLY:  grid_particles, initial_weighting_factor, isf, i_splitting_mode,&
+               max_number_particles_per_gridbox, new_particles, n_max,         &
+               number_of_particles, particles, particle_type, prt_count,       &
+               radius_split, splitting_factor, splitting_factor_max,           &
                sum_new_particles, weight_factor_split                        
 
Index: palm/trunk/SOURCE/lpm_write_exchange_statistics.f90
===================================================================
--- palm/trunk/SOURCE/lpm_write_exchange_statistics.f90	(revision 3240)
+++ palm/trunk/SOURCE/lpm_write_exchange_statistics.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2967 2018-04-13 11:22:08Z raasch
 ! nesting routine is only called if nesting is switched on
 ! bugfix: missing parallel cpp-directives added
@@ -93,8 +96,8 @@
 
     USE particle_attributes,                                                   &
-        ONLY:  grid_particles,  number_of_particles, prt_count,                &
-               trlp_count_sum, trlp_count_recv_sum, trnp_count_sum,            &
-               trnp_count_recv_sum, trrp_count_sum, trrp_count_recv_sum,       &
-               trsp_count_sum, trsp_count_recv_sum
+        ONLY:  number_of_particles, prt_count, trlp_count_sum,                 &
+               trlp_count_recv_sum, trnp_count_sum, trnp_count_recv_sum,       &
+               trrp_count_sum, trrp_count_recv_sum, trsp_count_sum,            &
+               trsp_count_recv_sum
 
     USE pmc_particle_interface,                                                &
Index: palm/trunk/SOURCE/message.f90
===================================================================
--- palm/trunk/SOURCE/message.f90	(revision 3240)
+++ palm/trunk/SOURCE/message.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3019 2018-05-13 07:05:43Z maronga
 ! Temporaraly deactivate MPI_BARRIER as long as nested systems freeze due to
 ! asynchronous calls of location_message.
@@ -263,5 +266,5 @@
 
     USE pmc_interface,                                                         &
-        ONLY:  cpl_id, nested_run
+        ONLY:  cpl_id
 
     IMPLICIT NONE
@@ -270,7 +273,4 @@
     LOGICAL          ::  advance  !< switch for advancing/noadvancing I/O
 
-#if defined( __parallel )
-!    IF ( nested_run )  CALL MPI_BARRIER( MPI_COMM_WORLD, ierr )
-#endif
 !
 !-- Output for nested runs only on the root domain
Index: palm/trunk/SOURCE/microphysics_mod.f90
===================================================================
--- palm/trunk/SOURCE/microphysics_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/microphysics_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3026 2018-05-22 10:30:53Z schwenkel
 ! Changed the name specific humidity to mixing ratio, since we are computing
 ! mixing ratios.
@@ -201,5 +204,4 @@
     REAL(wp) ::  k_br = 1000.0_wp          !< const. in breakup parametrization (m-1)
     REAL(wp) ::  k_st = 1.2E8_wp           !< const. in drizzle parametrization (m-1 s-1)
-    REAL(wp) ::  kappa_rr = 60.7_wp        !< const. in collision kernel (kg-1/3)
     REAL(wp) ::  kin_vis_air = 1.4086E-5_wp  !< kin. viscosity of air (m2 s-1)
     REAL(wp) ::  prec_time_const = 0.001_wp  !< coef. in Kessler scheme (s-1)
@@ -212,5 +214,4 @@
     REAL(wp) ::  xamin = 5.24E-19_wp       !< average aerosol mass (kg) (~ 0.05Âµm)
     REAL(wp) ::  xcmin = 4.18E-15_wp       !< minimum cloud drop size (kg) (~ 1Âµm)
-    REAL(wp) ::  xcmax = 2.6E-10_wp        !< maximum cloud drop size (kg) (~ 40Âµm)
     REAL(wp) ::  xrmin = 2.6E-10_wp        !< minimum rain drop size (kg)
     REAL(wp) ::  xrmax = 5.0E-6_wp         !< maximum rain drop site (kg)
@@ -556,13 +557,9 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  hyp, nc, nr, pt, q,  qc, qr
+           ONLY:  nc
 
        USE cloud_parameters,                                                   &
-           ONLY:  hyrho, l_d_cp, l_d_r, l_v, molecular_weight_of_solute,       &
-                  molecular_weight_of_water, rho_l, rho_s, r_v, t_d_pt,        &
-                  vanthoff
-
-       USE constants,                                                          &
-           ONLY:  pi
+           ONLY:  molecular_weight_of_solute,       &
+                  molecular_weight_of_water, rho_l, rho_s, r_v, vanthoff
 
        USE cpulog,                                                             &
@@ -570,5 +567,5 @@
 
        USE diagnostic_quantities_mod,                                          &
-           ONLY: e_s, magnus, q_s, sat, supersaturation, t_l
+           ONLY:  magnus, sat, supersaturation, t_l
 
        USE indices,                                                            &
@@ -576,7 +573,4 @@
 
        USE kinds
-
-       USE control_parameters,                                                 &
-          ONLY: simulated_time
 
        IMPLICIT NONE
@@ -684,8 +678,8 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  hyp, nr, pt, q,  qc, qr, nc
+           ONLY:  q,  qc, qr, nc
 
        USE cloud_parameters,                                                   &
-           ONLY:  hyrho, l_d_cp, l_d_r, l_v, r_v, t_d_pt
+           ONLY:  hyrho, l_d_cp, l_v, r_v
 
        USE constants,                                                          &
@@ -702,7 +696,4 @@
 
        USE kinds
-
-       USE control_parameters,                                                 &
-          ONLY: simulated_time
 
        IMPLICIT NONE
@@ -716,5 +707,4 @@
        REAL(wp)     ::  dc                !<
        REAL(wp)     ::  evap              !<
-       REAL(wp)     ::  evap_nc           !<
        REAL(wp)     ::  g_fac             !<
        REAL(wp)     ::  nc_0              !<
@@ -1173,8 +1163,8 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  hyp, nr, pt, q,  qc, qr
+           ONLY:  nr, qc, qr
 
        USE cloud_parameters,                                                   &
-           ONLY:  hyrho, l_d_cp, l_d_r, l_v, r_v, t_d_pt
+           ONLY:  hyrho, l_d_cp, l_v, r_v
 
        USE constants,                                                          &
@@ -1185,5 +1175,5 @@
 
        USE diagnostic_quantities_mod,                                          &
-           ONLY: e_s, magnus, q_s, sat, supersaturation, t_l
+           ONLY: e_s, magnus, sat, supersaturation, t_l
 
        USE indices,                                                            &
@@ -1461,5 +1451,4 @@
        INTEGER(iwp) ::  k             !< running index z direction
        INTEGER(iwp) ::  k_run         !<
-       INTEGER(iwp) ::  l             !< running index of surface type
        INTEGER(iwp) ::  m             !< running index surface elements
        INTEGER(iwp) ::  surf_e        !< End index of surface elements at (j,i)-gridpoint
@@ -1713,7 +1702,4 @@
                   precipitation_amount_interval, time_do2d_xy
 
-       USE indices,                                                            &
-           ONLY:  nxl, nxr, nys, nyn, nzb, nzt, wall_flags_0
-
        USE kinds
 
@@ -1727,6 +1713,4 @@
        INTEGER(iwp) ::  k             !< running index y direction
        INTEGER(iwp) ::  m             !< running index surface elements
-       INTEGER(iwp) ::  surf_e        !< End index of surface elements at (j,i)-gridpoint
-       INTEGER(iwp) ::  surf_s        !< Start index of surface elements at (j,i)-gridpoint
 
        IF ( ( dt_do2d_xy - time_do2d_xy ) < precipitation_amount_interval .AND.&
@@ -1945,24 +1929,18 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  hyp, nr, pt, q,  qc, qr, nc
+           ONLY:  hyp
 
        USE cloud_parameters,                                                   &
-           ONLY:  hyrho, l_d_cp, l_d_r, l_v, molecular_weight_of_solute,       &
+           ONLY:  l_d_cp, l_d_r, molecular_weight_of_solute,                   &
                   molecular_weight_of_water, rho_l, rho_s, r_v, t_d_pt,        &
                   vanthoff
 
-       USE constants,                                                          &
-           ONLY:  pi
-
        USE cpulog,                                                             &
-           ONLY:  cpu_log, log_point_s
+           ONLY:  cpu_log
 
        USE indices,                                                            &
-           ONLY:  nxlg, nxrg, nysg, nyng, nzb, nzt
+           ONLY:  nzb, nzt
 
        USE kinds
-
-       USE control_parameters,                                                 &
-          ONLY: simulated_time
 
        IMPLICIT NONE
@@ -2085,5 +2063,5 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  hyp, nr, pt, q,  qc, qr, nc
+           ONLY:  hyp
 
        USE cloud_parameters,                                                   &
@@ -2094,13 +2072,10 @@
 
        USE cpulog,                                                             &
-           ONLY:  cpu_log, log_point_s
+           ONLY:  cpu_log
 
        USE indices,                                                            &
-           ONLY:  nxlg, nxrg, nysg, nyng, nzb, nzt
+           ONLY:  nzb, nzt
 
        USE kinds
-
-       USE control_parameters,                                                 &
-          ONLY: simulated_time
 
        IMPLICIT NONE
@@ -2116,5 +2091,4 @@
        REAL(wp)     ::  e_s               !<
        REAL(wp)     ::  evap              !<
-       REAL(wp)     ::  evap_nc           !<
        REAL(wp)     ::  g_fac             !<
        REAL(wp)     ::  nc_0              !<
@@ -3027,7 +3001,4 @@
                   precipitation_amount_interval, time_do2d_xy
 
-       USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
-
        USE kinds
 
Index: palm/trunk/SOURCE/multi_agent_system_mod.f90
===================================================================
--- palm/trunk/SOURCE/multi_agent_system_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/multi_agent_system_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3235 2018-09-07 14:06:15Z sward
 ! Bugfix in output, added agent-number dimension and related messages and
 ! input parameters, updated cpu logging, added mas_last_actions
@@ -96,6 +99,6 @@
     INTEGER(iwp) ::  ibc_mas_lr                        !< agent left/right boundary condition dummy
     INTEGER(iwp) ::  ibc_mas_ns                        !< agent north/south boundary condition dummy
-    INTEGER(iwp) ::  ind_pm10 = -9                     !< chemical species index of PM10
-    INTEGER(iwp) ::  ind_pm25 = -9                     !< chemical species index of PM2.5
+!    INTEGER(iwp) ::  ind_pm10 = -9                     !< chemical species index of PM10
+!    INTEGER(iwp) ::  ind_pm25 = -9                     !< chemical species index of PM2.5
     INTEGER(iwp) ::  iran_agent = -1234567             !< number for random generator
     INTEGER(iwp) ::  min_nr_agent = 2                  !< namelist parameter (see documentation)
@@ -536,16 +539,15 @@
        INTEGER(iwp) ::  n  !< loop variable over all agents in a grid box
        INTEGER(iwp) ::  pc !< agent path counter
-       INTEGER(iwp) ::  nobo !< agent path counter
 
        REAL(wp) ::  abs_dir         !< length of direction vector (for normalization)
-       REAL(wp) ::  d_curr_target   !< rounding influence expressed as x speed component
-       REAL(wp) ::  d_prev_target   !< rounding influence expressed as x speed component
+!       REAL(wp) ::  d_curr_target   !< rounding influence expressed as x speed component
+!       REAL(wp) ::  d_prev_target   !< rounding influence expressed as x speed component
        REAL(wp) ::  dir_x           !< direction of agent (x)
        REAL(wp) ::  dir_y           !< direction of agent (y)
-       REAL(wp) ::  dist_round = 3. !< distance at which agents start rounding a corner
+!       REAL(wp) ::  dist_round = 3. !< distance at which agents start rounding a corner
        REAL(wp) ::  dtit            !< distance to intermittent target
-       REAL(wp) ::  round_fac  = .2 !< factor for rounding influence
-       REAL(wp) ::  speed_round_x   !< rounding influence expressed as x speed component
-       REAL(wp) ::  speed_round_y   !< rounding influence expressed as x speed component
+!       REAL(wp) ::  round_fac  = 0.2 !< factor for rounding influence
+!       REAL(wp) ::  speed_round_x   !< rounding influence expressed as x speed component
+!       REAL(wp) ::  speed_round_y   !< rounding influence expressed as x speed component
 
 !
@@ -728,5 +730,4 @@
        INTEGER(iwp) ::  i           !< loop variable ( agent groups )
        INTEGER(iwp) ::  ip          !< index variable along x
-       INTEGER(iwp) ::  j           !< loop variable ( agents per point )
        INTEGER(iwp) ::  jp          !< index variable along y
        INTEGER(iwp) ::  loop_stride !< loop variable for initialization
@@ -1010,6 +1011,4 @@
        IMPLICIT NONE
 
-       INTEGER(iwp) ::  agt_size !< Agent size in bytes
-       INTEGER(iwp) ::  dummy    !< dummy
        INTEGER(iwp) ::  il
        INTEGER(iwp) ::  jl
@@ -1130,5 +1129,5 @@
 
        USE netcdf_interface,                                                   &
-           ONLY:  nc_stat, id_set_agt, id_var_time_agt, id_var_rnoa_agt,       &
+           ONLY:  nc_stat, id_set_agt, id_var_time_agt,        &
                   id_var_agt, netcdf_handle_error
 
@@ -1235,7 +1234,7 @@
        IF ( myid == 0 ) THEN
 #if defined( __parallel )
-          agents=>out_agents
+          agents => out_agents
 #else
-          agents=>trf_agents
+          agents => trf_agents
 #endif
 
@@ -1530,5 +1529,4 @@
 
        TYPE(agent_type), DIMENSION(:), INTENT(IN)  ::  agent_array !< new agents in a grid box
-       TYPE(agent_type), DIMENSION(:), ALLOCATABLE ::  temp_ns     !< temporary agent array for reallocation
 
        pack_done     = .FALSE.
@@ -1662,5 +1660,4 @@
        INTEGER(iwp) ::  j                !< grid index (y) of agent positition
        INTEGER(iwp) ::  jp               !< index variable along y
-       INTEGER(iwp) ::  kp               !< index variable along z
        INTEGER(iwp) ::  n                !< agent index variable 
        INTEGER(iwp) ::  par_size         !< Agent size in bytes
@@ -2252,7 +2249,5 @@
 #if defined( __parallel )
 
-       INTEGER(iwp) ::  i           !< grid index (x) of agent positition
        INTEGER(iwp) ::  ip          !< index variable along x
-       INTEGER(iwp) ::  j           !< grid index (y) of agent positition
        INTEGER(iwp) ::  jp          !< index variable along y
        INTEGER(iwp) ::  agt_size    !< Bit size of agent datatype
@@ -2684,12 +2679,9 @@
            ONLY:  u, v, pt, hyp
 
-       USE chem_gasphase_mod,                                                  &
-           ONLY:  nvar
-
-       USE chemistry_model_mod,                                                &
-           ONLY:  chem_species
-
-       USE control_parameters,                                                 &
-              ONLY:  air_chemistry
+!       USE chemistry_model_mod,                                                &
+!           ONLY:  chem_species
+
+!       USE control_parameters,                                                 &
+!              ONLY:  air_chemistry
 
        IMPLICIT NONE
@@ -2707,6 +2699,4 @@
        REAL(wp) ::  u_a  !< windspeed at agent position (x)
        REAL(wp) ::  v_a  !< windspeed at agent position (y)
-       REAL(wp) ::  x_a  !< agent position (x)
-       REAL(wp) ::  y_a  !< agent position (y)
 
        DO  il = nxl, nxr
@@ -2932,13 +2922,12 @@
     SUBROUTINE mas_init
 
-       USE chem_gasphase_mod,                                                  &
-           ONLY:  nspec
-
-       USE chemistry_model_mod,                                                &
-           ONLY:  chem_species
+!       USE chem_gasphase_mod,                                                  &
+!           ONLY:  nspec
+
+!       USE chemistry_model_mod,                                                &
+!           ONLY:  chem_species
 
        USE control_parameters,                                                 &
-           ONLY:  air_chemistry, coupling_char, initializing_actions,          &
-                  io_blocks, io_group
+           ONLY:  coupling_char, initializing_actions, io_blocks, io_group
 
        USE surface_mod,                                                        &
@@ -2968,5 +2957,4 @@
        REAL(wp) ::  avg_agt_height = 1.8_wp
 
-       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  noc !< temp: number of connections in nav_mesh
 
 !
@@ -3244,12 +3232,9 @@
 
        INTEGER(iwp) ::  cur_node     !< current node of binary heap
-       INTEGER(iwp) ::  i_ag         !< agent index
        INTEGER(iwp) ::  il           !< counter (x)
-       INTEGER(iwp) ::  jl           !< counter (y)
        INTEGER(iwp) ::  neigh_node   !< neighbor node
        INTEGER(iwp) ::  node_counter !< binary heap node counter
        INTEGER(iwp) ::  path_ag      !< index of agent path
        INTEGER(iwp) ::  som          !< size of mesh
-       INTEGER(iwp) ::  rn_side      !< index of agent path
        INTEGER(iwp) ::  steps        !< steps along the path
        INTEGER(iwp) ::  nsteps        !< number of steps
@@ -3259,5 +3244,4 @@
        REAL(wp) ::  new_cost     !< updated cost to reach node
        REAL(wp) ::  new_priority !< priority of node to be added to queue
-       REAL(wp) ::  rand_nr      !< x-coordinate target
        REAL(wp) ::  rn_gate      !< random number for corner gate
        REAL(wp) ::  target_x     !< x-coordinate target
@@ -3927,82 +3911,82 @@
 !> complete the LES timestep.
 !------------------------------------------------------------------------------!
-    SUBROUTINE mas_ps_sort_timeloop_done
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) :: end_index     !< agent end index for each sub-box
-       INTEGER(iwp) :: i             !< index of agent grid box in x-direction
-       INTEGER(iwp) :: j             !< index of agent grid box in y-direction
-       INTEGER(iwp) :: n             !< running index for number of agents
-       INTEGER(iwp) :: nb            !< index of subgrid boux
-       INTEGER(iwp) :: nf            !< indices for agents in each sub-box that already finalized their substeps
-       INTEGER(iwp) :: nnf           !< indices for agents in each sub-box that need further treatment
-       INTEGER(iwp) :: num_finalized !< number of agents in each sub-box that already finalized their substeps
-       INTEGER(iwp) :: start_index   !< agent start index for each sub-box
-
-       TYPE(agent_type), DIMENSION(:), ALLOCATABLE :: sort_agents  !< temporary agent array 
-
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
-
-             number_of_agents = agt_count(j,i)
-             IF ( number_of_agents <= 0 )  CYCLE
-
-             agents => grid_agents(j,i)%agents(1:number_of_agents)
-
-             DO  nb = 0, 3
+!    SUBROUTINE mas_ps_sort_timeloop_done
+!
+!       IMPLICIT NONE
+!
+!       INTEGER(iwp) :: end_index     !< agent end index for each sub-box
+!       INTEGER(iwp) :: i             !< index of agent grid box in x-direction
+!       INTEGER(iwp) :: j             !< index of agent grid box in y-direction
+!       INTEGER(iwp) :: n             !< running index for number of agents
+!       INTEGER(iwp) :: nb            !< index of subgrid boux
+!       INTEGER(iwp) :: nf            !< indices for agents in each sub-box that already finalized their substeps
+!       INTEGER(iwp) :: nnf           !< indices for agents in each sub-box that need further treatment
+!       INTEGER(iwp) :: num_finalized !< number of agents in each sub-box that already finalized their substeps
+!       INTEGER(iwp) :: start_index   !< agent start index for each sub-box
+!
+!       TYPE(agent_type), DIMENSION(:), ALLOCATABLE :: sort_agents  !< temporary agent array
+!
+!       DO  i = nxl, nxr
+!          DO  j = nys, nyn
+!
+!             number_of_agents = agt_count(j,i)
+!             IF ( number_of_agents <= 0 )  CYCLE
+!
+!             agents => grid_agents(j,i)%agents(1:number_of_agents)
+!
+!             DO  nb = 0, 3
 !
 !--             Obtain start and end index for each subgrid box
-                start_index = grid_agents(j,i)%start_index(nb)
-                end_index   = grid_agents(j,i)%end_index(nb)
+!                start_index = grid_agents(j,i)%start_index(nb)
+!                end_index   = grid_agents(j,i)%end_index(nb)
 !
 !--             Allocate temporary array used for sorting
-                ALLOCATE( sort_agents(start_index:end_index) )
+!                ALLOCATE( sort_agents(start_index:end_index) )
 !
 !--             Determine number of agents already completed the LES 
 !--             timestep, and write them into a temporary array
-                nf = start_index
-                num_finalized = 0
-                DO  n = start_index, end_index
-                   IF ( dt_3d - agents(n)%dt_sum < 1E-8_wp )  THEN
-                      sort_agents(nf) = agents(n)
-                      nf              = nf + 1
-                      num_finalized   = num_finalized + 1
-                   ENDIF
-                ENDDO
+!                nf = start_index
+!                num_finalized = 0
+!                DO  n = start_index, end_index
+!                   IF ( dt_3d - agents(n)%dt_sum < 1E-8_wp )  THEN
+!                      sort_agents(nf) = agents(n)
+!                      nf              = nf + 1
+!                      num_finalized   = num_finalized + 1
+!                   ENDIF
+!                ENDDO
 !
 !--             Determine number of agents that not completed the LES 
 !--             timestep, and write them into a temporary array
-                nnf = nf
-                DO  n = start_index, end_index
-                   IF ( dt_3d - agents(n)%dt_sum > 1E-8_wp )  THEN
-                      sort_agents(nnf) = agents(n)
-                      nnf              = nnf + 1
-                   ENDIF
-                ENDDO
+!                nnf = nf
+!                DO  n = start_index, end_index
+!                   IF ( dt_3d - agents(n)%dt_sum > 1E-8_wp )  THEN
+!                      sort_agents(nnf) = agents(n)
+!                      nnf              = nnf + 1
+!                   ENDIF
+!                ENDDO
 !
 !--             Write back sorted agents
-                agents(start_index:end_index) =                          &
-                                        sort_agents(start_index:end_index)
+!                agents(start_index:end_index) =                          &
+!                                        sort_agents(start_index:end_index)
 !
 !--             Determine updated start_index, used to masked already 
 !--             completed agents. 
-                grid_agents(j,i)%start_index(nb) =                     &
-                                   grid_agents(j,i)%start_index(nb)    &
-                                 + num_finalized
+!                grid_agents(j,i)%start_index(nb) =                     &
+!                                   grid_agents(j,i)%start_index(nb)    &
+!                                 + num_finalized
 !
 !--             Deallocate dummy array
-                DEALLOCATE ( sort_agents )
+!                DEALLOCATE ( sort_agents )
 !
 !--             Finally, if number of non-completed agents is non zero 
 !--             in any of the sub-boxes, set control flag appropriately. 
-                IF ( nnf > nf )                                             &
-                   grid_agents(j,i)%time_loop_done = .FALSE.
-
-             ENDDO
-          ENDDO
-       ENDDO
-
-    END SUBROUTINE mas_ps_sort_timeloop_done
+!                IF ( nnf > nf )                                             &
+!                   grid_agents(j,i)%time_loop_done = .FALSE.
+!
+!             ENDDO
+!          ENDDO
+!       ENDDO
+!
+!    END SUBROUTINE mas_ps_sort_timeloop_done
 
 !------------------------------------------------------------------------------!
@@ -4106,6 +4090,6 @@
     SUBROUTINE mas_timestep_social_forces ( mode, nl, ip, jp )
 
-       USE constants,                                                          &
-           ONLY:  pi
+!       USE constants,                                                          &
+!           ONLY:  pi
 
        IMPLICIT NONE
@@ -4138,5 +4122,4 @@
        REAL(wp) ::  dist             !< distance to obstacle
        REAL(wp) ::  dist_sq          !< distance to obstacle squared
-       REAL(wp) ::  dummy_coll_time  !< dummy for collision time
        REAL(wp) ::  pos_rel_x        !< relative position of two agents (x)
        REAL(wp) ::  pos_rel_y        !< relative position of two agents (y)
@@ -4311,6 +4294,6 @@
 !
 !--                   Calculate force of found wall on agent
-                      CALL mas_timestep_wall_corner_force ( nl, x_a, x_wall,   &
-                                                            y_a, y_a )
+                      CALL mas_timestep_wall_corner_force( x_a, x_wall, y_a,   &
+                                                           y_a )
 !
 !--                   calculate new x starting index for later scan for corners
@@ -4335,6 +4318,6 @@
 !
 !--                   Calculate force of found wall on agent
-                      CALL mas_timestep_wall_corner_force ( nl, x_a, x_wall,   &
-                                                            y_a, y_a )
+                      CALL mas_timestep_wall_corner_force( x_a, x_wall, y_a,   &
+                                                           y_a )
 !
 !--                   calculate new x end index for later scan for corners
@@ -4358,6 +4341,6 @@
                       y_wall = (jl+1)*dy
 
-                      CALL mas_timestep_wall_corner_force ( nl, x_a, x_a, y_a, &
-                                                            y_wall )
+                      CALL mas_timestep_wall_corner_force( x_a, x_a, y_a,      &
+                                                           y_wall )
 !
 !--                   calculate new y starting index for later scan for corners
@@ -4381,6 +4364,6 @@
                       y_wall = jl*dy
 
-                      CALL mas_timestep_wall_corner_force ( nl, x_a, x_a, y_a, &
-                                                            y_wall )
+                      CALL mas_timestep_wall_corner_force( x_a, x_a, y_a,      &
+                                                           y_wall )
 !
 !--                   calculate new y end index for later scan for corners
@@ -4412,6 +4395,6 @@
                             y_wall = (jl+1)*dy
 
-                            CALL mas_timestep_wall_corner_force ( nl, x_a,     &
-                                                           x_wall, y_a, y_wall )
+                            CALL mas_timestep_wall_corner_force( x_a, x_wall,  &
+                                                                 y_a, y_wall )
 
                          ENDIF
@@ -4426,6 +4409,6 @@
                             y_wall = jl*dy
 
-                            CALL mas_timestep_wall_corner_force ( nl, x_a,     &
-                                                         x_wall, y_a, y_wall )
+                            CALL mas_timestep_wall_corner_force( x_a, x_wall,  &
+                                                                 y_a, y_wall )
 
                          ENDIF
@@ -4442,6 +4425,6 @@
                             y_wall = (jl+1)*dy
 
-                            CALL mas_timestep_wall_corner_force ( nl, x_a,     &
-                                                           x_wall, y_a, y_wall )
+                            CALL mas_timestep_wall_corner_force( x_a, x_wall,  &
+                                                                 y_a, y_wall )
 
                          ENDIF
@@ -4456,6 +4439,6 @@
                             y_wall = jl*dy
 
-                            CALL mas_timestep_wall_corner_force ( nl, x_a,     &
-                                                           x_wall, y_a, y_wall )
+                            CALL mas_timestep_wall_corner_force( x_a, x_wall,  &
+                                                                 y_a, y_wall )
 
                          ENDIF
@@ -4477,9 +4460,7 @@
 !> or wall exerts on that agent
 !------------------------------------------------------------------------------!
-    SUBROUTINE mas_timestep_wall_corner_force ( nl, xa, xw, ya, yw )
+    SUBROUTINE mas_timestep_wall_corner_force( xa, xw, ya, yw )
 
        IMPLICIT NONE
-
-       INTEGER(iwp) ::  nl !< loop variable over all agents in a grid box
 
        REAL(wp) ::  dist_l     !< distance to obstacle
Index: palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3215 2018-08-29 09:58:59Z suehring
 ! - Separate input of soil properties from input of atmospheric data. This 
 !   enables input of soil properties also in child domains without any 
@@ -654,9 +657,7 @@
 
        USE control_parameters,                                                 &
-           ONLY:  land_surface, message_string, topo_no_distinct, urban_surface
+           ONLY:  topo_no_distinct
 
        IMPLICIT NONE
-
-       LOGICAL ::  check_nest  !< flag indicating whether a check passed or not
 
 #if defined ( __netcdf )
@@ -688,5 +689,4 @@
 
        INTEGER(iwp) ::  id_mod   !< NetCDF id of input file
-       INTEGER(iwp) ::  ii       !< running index for IO blocks
 
        IF ( .NOT. input_pids_static )  RETURN
@@ -757,6 +757,6 @@
 
        USE control_parameters,                                                 &
-           ONLY:  bc_lr_cyc, bc_ns_cyc, land_surface, message_string,          &
-                  plant_canopy, urban_surface
+           ONLY:  bc_lr_cyc, bc_ns_cyc, land_surface, plant_canopy,            &
+                  urban_surface
 
        USE indices,                                                            &
@@ -1788,5 +1788,5 @@
 
        USE indices,                                                            &
-           ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt
+           ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb
 
 
@@ -1800,5 +1800,4 @@
        INTEGER(iwp) ::  id_topo       !< NetCDF id of topograhy input file
        INTEGER(iwp) ::  j             !< running index along y-direction
-       INTEGER(iwp) ::  k             !< running index along z-direction
        INTEGER(iwp) ::  num_vars      !< number of variables in netcdf input file
        INTEGER(iwp) ::  skip_n_rows   !< counting variable to skip rows while reading topography file
@@ -2079,6 +2078,5 @@
 
        USE control_parameters,                                                 &
-           ONLY:  bc_lr_cyc, bc_ns_cyc, humidity, land_surface, message_string,&
-                  nesting_offline, neutral, surface_pressure
+           ONLY:  bc_lr_cyc, bc_ns_cyc, humidity, message_string, neutral
 
        USE indices,                                                            &
@@ -2091,8 +2089,5 @@
        LOGICAL      ::  dynamic_3d = .TRUE. !< flag indicating that 3D data is read from dynamic file
        
-       INTEGER(iwp) ::  i          !< running index along x-direction
        INTEGER(iwp) ::  id_dynamic !< NetCDF id of dynamic input file
-       INTEGER(iwp) ::  j          !< running index along y-direction
-       INTEGER(iwp) ::  k          !< running index along z-direction
        INTEGER(iwp) ::  num_vars   !< number of variables in netcdf input file
 
@@ -2554,13 +2549,9 @@
     SUBROUTINE netcdf_data_input_init_lsm
 
-       USE arrays_3d,                                                          &
-           ONLY:  q, pt, u, v, w, zu, zw
-
        USE control_parameters,                                                 &
-           ONLY:  bc_lr_cyc, bc_ns_cyc, humidity, land_surface, message_string,&
-                  nesting_offline, neutral, surface_pressure
+           ONLY:  message_string
 
        USE indices,                                                            &
-           ONLY:  nx, nxl, nxlu, nxr, ny, nyn, nys, nysv, nzb, nz, nzt
+           ONLY:  nx, nxl, nxr, ny, nyn, nys
 
        IMPLICIT NONE
@@ -2699,6 +2690,5 @@
            ONLY:  bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r,              &
                   bc_dirichlet_s, bc_lr_cyc, bc_ns_cyc, humidity,              &
-                  message_string, neutral, nesting_offline,                    &
-                  time_since_reference_point
+                  neutral, nesting_offline, time_since_reference_point
 
        USE indices,                                                            &
@@ -2707,12 +2697,7 @@
        IMPLICIT NONE
        
-       INTEGER(iwp) ::  i          !< running index along x-direction
        INTEGER(iwp) ::  id_dynamic !< NetCDF id of dynamic input file
-       INTEGER(iwp) ::  j          !< running index along y-direction
-       INTEGER(iwp) ::  k          !< running index along z-direction
        INTEGER(iwp) ::  num_vars   !< number of variables in netcdf input file
        INTEGER(iwp) ::  t          !< running index time dimension
-
-       REAL(wp) ::  dum           !< dummy variable to skip columns while reading topography file
 
        nest_offl%from_file = MERGE( .TRUE., .FALSE., input_pids_dynamic ) 
@@ -3562,12 +3547,8 @@
        IMPLICIT NONE
 
-       LOGICAL      ::  top     !< flag indicating extrapolation at model top
-
        INTEGER(iwp) ::  k       !< running index z-direction file
        INTEGER(iwp) ::  kk      !< running index z-direction stretched model grid
        INTEGER(iwp) ::  kl      !< lower index bound along z-direction
        INTEGER(iwp) ::  ku      !< upper index bound along z-direction
-       INTEGER(iwp) ::  nz_file !< number of vertical levels on file
-
 
        REAL(wp), DIMENSION(:) ::  z_grid                  !< grid levels on numeric grid
@@ -3631,6 +3612,4 @@
        IMPLICIT NONE
 
-       INTEGER(iwp) ::  i        !< running index x-direction
-       INTEGER(iwp) ::  j        !< running index y-direction
        INTEGER(iwp) ::  k        !< running index z-direction file
        INTEGER(iwp) ::  kk       !< running index z-direction stretched model grid
@@ -3690,6 +3669,4 @@
        IMPLICIT NONE
 
-       LOGICAL      ::  top     !< flag indicating extrapolation at model top
-
        INTEGER(iwp) ::  i       !< running index x- or y -direction
        INTEGER(iwp) ::  il      !< lower index bound along x- or y-direction
@@ -3699,6 +3676,4 @@
        INTEGER(iwp) ::  kl      !< lower index bound along z-direction
        INTEGER(iwp) ::  ku      !< upper index bound along z-direction
-       INTEGER(iwp) ::  nz_file !< number of vertical levels on file
-
 
        REAL(wp), DIMENSION(:) ::  z_grid                  !< grid levels on numeric grid
@@ -3771,5 +3746,4 @@
        INTEGER(iwp) ::  kl      !< lower index bound along z-direction
        INTEGER(iwp) ::  ku      !< upper index bound along z-direction
-       INTEGER(iwp) ::  nz_file !< number of vertical levels on file
 
        REAL(wp), DIMENSION(:) ::  z_grid                      !< grid levels on numeric grid
@@ -3887,5 +3861,4 @@
        CHARACTER (LEN=*), INTENT(IN) ::  filename  !< filename
        INTEGER(iwp), INTENT(INOUT)   ::  id        !< file id
-       LOGICAL                       ::  file_open = .FALSE.
 
 #if defined( __netcdf4_parallel )
Index: palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3235 2018-09-07 14:06:15Z sward
 ! Changed MAS output dimension id_dim_agtnum to be of defined size and no longer
 ! unlimited. Also changed some MAS output variables to be of type float
@@ -385,37 +388,36 @@
     CHARACTER (LEN=7), DIMENSION(0:1,500) ::  do2d_unit, do3d_unit
 
-    CHARACTER (LEN=16), DIMENSION(25) ::  prt_var_names = &
-          (/ 'pt_age          ', 'pt_dvrp_size    ', 'pt_origin_x     ', &
-             'pt_origin_y     ', 'pt_origin_z     ', 'pt_radius       ', &
-             'pt_speed_x      ', 'pt_speed_y      ', 'pt_speed_z      ', &
-             'pt_weight_factor', 'pt_x            ', 'pt_y            ', &
-             'pt_z            ', 'pt_color        ', 'pt_group        ', &
-             'pt_tailpoints   ', 'pt_tail_id      ', 'pt_density_ratio', &
-             'pt_exp_arg      ', 'pt_exp_term     ', 'not_used        ', &
-             'not_used        ', 'not_used        ', 'not_used        ', &
-             'not_used        ' /)
-
-    CHARACTER (LEN=16), DIMENSION(25) ::  prt_var_units = &
-          (/ 'seconds         ', 'meters          ', 'meters          ', &
-             'meters          ', 'meters          ', 'meters          ', &
-             'm/s             ', 'm/s             ', 'm/s             ', &
-             'factor          ', 'meters          ', 'meters          ', &
-             'meters          ', 'none            ', 'none            ', &
-             'none            ', 'none            ', 'ratio           ', &
-             'none            ', 'none            ', 'not_used        ', &
-             'not_used        ', 'not_used        ', 'not_used        ', &
-             'not_used        ' /)
+!    CHARACTER (LEN=16), DIMENSION(25) ::  prt_var_names = &
+!          (/ 'pt_age          ', 'pt_dvrp_size    ', 'pt_origin_x     ', &
+!             'pt_origin_y     ', 'pt_origin_z     ', 'pt_radius       ', &
+!             'pt_speed_x      ', 'pt_speed_y      ', 'pt_speed_z      ', &
+!             'pt_weight_factor', 'pt_x            ', 'pt_y            ', &
+!             'pt_z            ', 'pt_color        ', 'pt_group        ', &
+!             'pt_tailpoints   ', 'pt_tail_id      ', 'pt_density_ratio', &
+!             'pt_exp_arg      ', 'pt_exp_term     ', 'not_used        ', &
+!             'not_used        ', 'not_used        ', 'not_used        ', &
+!             'not_used        ' /)
+
+!    CHARACTER (LEN=16), DIMENSION(25) ::  prt_var_units = &
+!          (/ 'seconds         ', 'meters          ', 'meters          ', &
+!             'meters          ', 'meters          ', 'meters          ', &
+!             'm/s             ', 'm/s             ', 'm/s             ', &
+!             'factor          ', 'meters          ', 'meters          ', &
+!             'meters          ', 'none            ', 'none            ', &
+!             'none            ', 'none            ', 'ratio           ', &
+!             'none            ', 'none            ', 'not_used        ', &
+!             'not_used        ', 'not_used        ', 'not_used        ', &
+!             'not_used        ' /)
 
     CHARACTER(LEN=20), DIMENSION(11) ::  netcdf_precision = ' '
     CHARACTER(LEN=40) ::  netcdf_data_format_string
 
-    INTEGER(iwp) ::  id_dim_agtnum, id_dim_prtnum, id_dim_time_agt,            &
-                     id_dim_time_fl, id_dim_time_pr, id_dim_time_prt,          &
+    INTEGER(iwp) ::  id_dim_agtnum, id_dim_time_agt,                           &
+                     id_dim_time_fl, id_dim_time_pr,                           &
                      id_dim_time_pts, id_dim_time_sp, id_dim_time_ts,          &
                      id_dim_x_sp, id_dim_y_sp, id_dim_zu_sp, id_dim_zw_sp,     &
                      id_set_agt, id_set_fl, id_set_pr, id_set_prt, id_set_pts, &
                      id_set_sp, id_set_ts, id_var_agtnum, id_var_time_agt,     &
-                     id_var_time_fl, id_var_prtnum, id_var_rnoa_agt,           &
-                     id_var_rnop_prt, id_var_time_pr, id_var_time_prt,         &
+                     id_var_time_fl, id_var_rnoa_agt, id_var_time_pr,          &
                      id_var_time_pts, id_var_time_sp, id_var_time_ts,          &
                      id_var_x_sp, id_var_y_sp, id_var_zu_sp, id_var_zw_sp,     &
@@ -451,5 +453,5 @@
     INTEGER(iwp), DIMENSION(10)  ::  id_var_dospx, id_var_dospy
     INTEGER(iwp), DIMENSION(20)  ::  id_var_agt
-    INTEGER(iwp), DIMENSION(20)  ::  id_var_prt
+!    INTEGER(iwp), DIMENSION(20)  ::  id_var_prt
     INTEGER(iwp), DIMENSION(11)  ::  nc_precision
     INTEGER(iwp), DIMENSION(dopr_norm_num) ::  id_var_norm_dopr
@@ -565,5 +567,5 @@
                mask_k_global, message_string, mid, ntdim_2d_xy,                &
                ntdim_2d_xz, ntdim_2d_yz, ntdim_3d, nz_do3d, plant_canopy,      &
-               prt_time_count, run_description_header, section, simulated_time,&
+               run_description_header, section, simulated_time,                &
                simulated_time_at_begin, skip_time_data_output_av,              &
                skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz,        &
Index: palm/trunk/SOURCE/outflow_turbulence.f90
===================================================================
--- palm/trunk/SOURCE/outflow_turbulence.f90	(revision 3240)
+++ palm/trunk/SOURCE/outflow_turbulence.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -57,5 +60,5 @@
 
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxr, ny, nyn, nys, nyng, nysg, nzb, nzt
+        ONLY:  nbgp, nx, nxr, nyn, nys, nyng, nysg, nzb, nzt
 
     USE kinds
Index: palm/trunk/SOURCE/package_parin.f90
===================================================================
--- palm/trunk/SOURCE/package_parin.f90	(revision 3240)
+++ palm/trunk/SOURCE/package_parin.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3049 2018-05-29 13:52:36Z Giersch
 ! Error messages revised
 ! 
@@ -163,6 +166,6 @@
 
     USE control_parameters,                                                    &
-        ONLY:  dt_data_output, dt_dopts, dt_dvrp, message_string,              &
-               particle_maximum_age, threshold
+        ONLY:  dt_dopts, dt_dvrp, message_string, particle_maximum_age,        &
+               threshold
 
     USE dvrp_variables,                                                        &
Index: palm/trunk/SOURCE/palm.f90
===================================================================
--- palm/trunk/SOURCE/palm.f90	(revision 3240)
+++ palm/trunk/SOURCE/palm.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3235 2018-09-07 14:06:15Z sward
 ! Added mas_last_actions call and multi_agent_system_mod dependency
 ! 
@@ -239,16 +242,11 @@
 
     USE control_parameters,                                                    &
-        ONLY:  air_chemistry,                                                  &
-               cloud_physics, constant_diffusion, child_domain, coupling_char, &
-               coupling_mode,                                                  &
-               do2d_at_begin, do3d_at_begin, humidity, initializing_actions,   &
-               io_blocks, io_group, large_scale_forcing,                       &
+        ONLY:  air_chemistry, cloud_physics, constant_diffusion, child_domain, &
+               coupling_char, coupling_mode, do2d_at_begin, do3d_at_begin,     &
+               humidity, initializing_actions, io_blocks, io_group,            &
                message_string, microphysics_morrison, microphysics_seifert,    &
-               neutral, nudging, passive_scalar, runnr,                        &
-               simulated_time, simulated_time_chr, spinup,                     &
-               time_since_reference_point,                                     &
-               user_interface_current_revision,                                &
-               user_interface_required_revision, version, wall_heatflux,       &
-               write_binary
+               neutral, passive_scalar, runnr, simulated_time_chr, spinup,     &
+               time_since_reference_point, user_interface_current_revision,    &
+               user_interface_required_revision, version, write_binary
 
     USE cpulog,                                                                &
@@ -276,5 +274,5 @@
 
     USE pmc_interface,                                                         &
-        ONLY:  cpl_id, nested_run, pmci_child_initialize, pmci_init,           &
+        ONLY:  nested_run, pmci_child_initialize, pmci_init,                   &
                pmci_modelconfiguration, pmci_parent_initialize,                &
                pmci_ensure_nest_mass_conservation
@@ -288,9 +286,6 @@
 !
 !-- Local variables
-    CHARACTER(LEN=9)  ::  time_to_string  !<
-    CHARACTER(LEN=10) ::  env_string      !< to store string of environment var
-    INTEGER(iwp)      ::  env_stat        !< to hold status of GET_ENV
-    INTEGER(iwp)      ::  i               !<
-    INTEGER(iwp)      ::  myid_openmpi    !< OpenMPI local rank for CUDA aware MPI
+    CHARACTER(LEN=9) ::  time_to_string  !<
+    INTEGER(iwp)     ::  i               !< loop counter for blocked I/O
 
     version = 'PALM 5.0'
Index: palm/trunk/SOURCE/plant_canopy_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3065 2018-06-12 07:03:02Z Giersch
 ! dz was replaced by the help of zw to allow for vertical stretching
 ! 
@@ -314,5 +317,5 @@
  
     USE control_parameters,                                                 &
-        ONLY:  data_output, message_string, urban_surface
+        ONLY:  message_string, urban_surface
 
     IMPLICIT NONE
@@ -671,6 +674,5 @@
 
        USE control_parameters,                                                 &
-           ONLY: humidity, io_blocks, io_group, message_string, ocean,         &
-                 passive_scalar, urban_surface
+           ONLY: humidity, message_string, ocean, urban_surface
 
        USE netcdf_data_input_mod,                                              &
@@ -682,8 +684,5 @@
        IMPLICIT NONE
 
-       CHARACTER(10) :: pct
-       
        INTEGER(iwp) ::  i   !< running index
-       INTEGER(iwp) ::  ii  !< index       
        INTEGER(iwp) ::  j   !< running index
        INTEGER(iwp) ::  k   !< running index
@@ -691,9 +690,7 @@
 
        REAL(wp) ::  int_bpdf        !< vertical integral for lad-profile construction
-       REAL(wp) ::  dzh             !< vertical grid spacing in units of canopy height
        REAL(wp) ::  gradient        !< gradient for lad-profile construction
        REAL(wp) ::  canopy_height   !< canopy height for lad-profile construction
-       REAL(wp) ::  pcv(nzb:nzt+1)  !<
-       
+
 !
 !--    Allocate one-dimensional arrays for the computation of the 
@@ -1099,5 +1096,5 @@
     
        USE control_parameters,                                                 &
-           ONLY:  coupling_char, message_string, passive_scalar
+           ONLY:  coupling_char, message_string
 
        USE indices,                                                            &
@@ -1110,6 +1107,4 @@
        INTEGER(iwp)                        ::  i, j      !< running index
        INTEGER(iwp)                        ::  nzp       !< number of vertical layers of plant canopy
-       INTEGER(iwp)                        ::  nzpltop   !<
-       INTEGER(iwp)                        ::  nzpl      !<
        
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  col   !< vertical column of input data
Index: palm/trunk/SOURCE/pmc_child_mod.f90
===================================================================
--- palm/trunk/SOURCE/pmc_child_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/pmc_child_mod.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2841 2018-02-27 15:02:57Z knoop
 ! Bugfix: wrong placement of include 'mpif.h' corrected
 ! 
@@ -226,5 +229,4 @@
 
     INTEGER(iwp) ::  mype  !<
-    INTEGER(iwp) ::  my_addiarray = 0  !<
 
 
@@ -565,6 +567,4 @@
 !--                                    recv -> parent to child transfer
 !--                                    send -> child to parent transfer
-    CHARACTER(LEN=da_namelen) ::  myname  !<
-
     INTEGER(iwp) ::  arlen    !<
     INTEGER(iwp) ::  myindex  !<
@@ -735,6 +735,4 @@
     LOGICAL, INTENT(IN), OPTIONAL   ::  particle_transfer  !<
 
-    CHARACTER(LEN=da_namelen) ::  myname  !<
-    
     LOGICAL                        ::  lo_ptrans!<
     
@@ -870,6 +868,4 @@
     LOGICAL, INTENT(IN), OPTIONAL   ::  particle_transfer  !<
 
-    CHARACTER(LEN=da_namelen) ::  myname  !<
-    
     LOGICAL ::  lo_ptrans!<
     
@@ -879,8 +875,4 @@
     INTEGER(iwp) ::  j            !<
     INTEGER(iwp) ::  myindex      !<
-    INTEGER(iwp) ::  nr           !< number of elements to get from parent
-    
-    INTEGER(KIND=MPI_ADDRESS_KIND) ::  target_disp  !<
-    
 
     INTEGER(iwp), DIMENSION(1) ::  buf_shape    !<
Index: palm/trunk/SOURCE/pmc_general_mod.f90
===================================================================
--- palm/trunk/SOURCE/pmc_general_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/pmc_general_mod.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! unused variable removed
+! 
+! 2841 2018-02-27 15:02:57Z knoop
 ! Bugfix: wrong placement of include 'mpif.h' corrected
 ! 
@@ -183,5 +186,4 @@
     INTEGER(iwp) ::  i  !<
 
-    TYPE(arraydef), POINTER ::  ar   !<
     TYPE(pedef), POINTER    ::  ape  !<
 
Index: palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3217 2018-08-29 12:53:59Z suehring
 ! Revise calculation of index bounds for array index_list, prevent compiler 
 ! (cray) to delete the loop at high optimization level.  
@@ -703,7 +706,5 @@
 #if defined( __parallel )
 
-    INTEGER(iwp)         ::  ierr         !<
-    INTEGER(iwp)         ::  istat        !<
-    INTEGER(iwp)         ::  pmc_status   !<
+    INTEGER(iwp) ::  pmc_status   !<
 
 
@@ -827,6 +828,4 @@
     INTEGER(iwp) ::  child_id         !<
     INTEGER(iwp) ::  ierr             !<
-    INTEGER(iwp) ::  i                !<
-    INTEGER(iwp) ::  j                !<
     INTEGER(iwp) ::  k                !<
     INTEGER(iwp) ::  m                !<
@@ -1082,6 +1081,4 @@
        INTEGER(iwp) ::  j                  !<
        INTEGER(iwp) ::  k                  !<
-       INTEGER(iwp) ::  m                  !<
-       INTEGER(iwp) ::  n                  !<
        INTEGER(iwp) ::  npx                !<
        INTEGER(iwp) ::  npy                !<
@@ -1560,7 +1557,5 @@
 
        INTEGER(iwp) ::  i       !<
-       INTEGER(iwp) ::  i1      !<
        INTEGER(iwp) ::  j       !<
-       INTEGER(iwp) ::  j1      !<
        INTEGER(iwp) ::  k       !<
        INTEGER(iwp) ::  kc      !<
@@ -1675,12 +1670,8 @@
        INTEGER(iwp) ::  dum            !< dummy value for reduce operation
        INTEGER(iwp) ::  i              !<
-       INTEGER(iwp) ::  icorr          !<
        INTEGER(iwp) ::  ierr           !< MPI status
        INTEGER(iwp) ::  inc            !< Wall outward-normal index increment -1
                                        !< or 1, for direction=1, inc=1 always
-       INTEGER(iwp) ::  iw             !<
        INTEGER(iwp) ::  j              !<
-       INTEGER(iwp) ::  jcorr          !<
-       INTEGER(iwp) ::  jw             !<
        INTEGER(iwp) ::  k              !<
        INTEGER(iwp) ::  k_wall_u_ji    !< topography top index on u-grid
@@ -1694,7 +1685,5 @@
        INTEGER(iwp) ::  k_wall_w_ji_m  !< topography top index on w-grid
        INTEGER(iwp) ::  kb             !<
-       INTEGER(iwp) ::  kcorr          !<
        INTEGER(iwp) ::  lc             !<
-       INTEGER(iwp) ::  m              !< Running index for surface data type
        INTEGER(iwp) ::  ni             !<
        INTEGER(iwp) ::  nj             !<
@@ -3491,8 +3480,6 @@
 #if defined( __parallel )
     INTEGER(iwp) ::  ierr        !<
-    INTEGER(iwp) ::  istat       !<
 
     REAL(wp), POINTER, DIMENSION(:,:)     ::  p_2d        !<
-    REAL(wp), POINTER, DIMENSION(:,:)     ::  p_2d_sec    !<
     REAL(wp), POINTER, DIMENSION(:,:,:)   ::  p_3d        !<
     REAL(wp), POINTER, DIMENSION(:,:,:)   ::  p_3d_sec    !<
@@ -3680,5 +3667,4 @@
 #if defined( __parallel )
     INTEGER(iwp) ::  ierr    !<
-    INTEGER(iwp) ::  istat   !<
 
     REAL(wp), POINTER,DIMENSION(:,:)       ::  p_2d    !<
@@ -4360,8 +4346,6 @@
     IMPLICIT NONE
 
-    INTEGER(iwp)           ::  ierr   !<
-    INTEGER(iwp)           ::  istat  !<
-
     CHARACTER(LEN=*), INTENT(IN) ::  local_nesting_mode
+
 
     IF ( TRIM( local_nesting_mode ) == 'one-way' )  THEN
@@ -4413,12 +4397,7 @@
     INTEGER(iwp) ::  child_id    !<
     INTEGER(iwp) ::  i           !<
-    INTEGER(iwp) ::  ierr        !<
     INTEGER(iwp) ::  j           !<
     INTEGER(iwp) ::  k           !<
     INTEGER(iwp) ::  m           !<
-
-    REAL(wp)               ::  waittime    !<
-    REAL(wp), DIMENSION(1) ::  dtc         !<
-    REAL(wp), DIMENSION(1) ::  dtl         !<
 
 
@@ -4482,5 +4461,4 @@
 
 #if defined( __parallel )
-    INTEGER(iwp) ::  ierr        !<
     INTEGER(iwp) ::  icl         !<
     INTEGER(iwp) ::  icr         !<
@@ -4489,5 +4467,4 @@
     
     REAL(wp), DIMENSION(1) ::  dtl         !<
-    REAL(wp), DIMENSION(1) ::  dts         !<
 
 
@@ -5150,4 +5127,6 @@
 
       IMPLICIT NONE
+
+      INTEGER(iwp) ::  nzt_topo_nestbc   !<
 
       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                      &
@@ -5170,5 +5149,4 @@
                                           INTENT(IN)           ::  logc   !<
       INTEGER(iwp), DIMENSION(1:2,nys:nyn), INTENT(IN)         ::  logc_kbounds !<
-      INTEGER(iwp) ::  nzt_topo_nestbc   !<
 
       CHARACTER(LEN=1), INTENT(IN) ::  edge   !<
@@ -5178,10 +5156,8 @@
       INTEGER(iwp) ::  ib       !<
       INTEGER(iwp) ::  ibgp     !<
-      INTEGER(iwp) ::  iw       !<
       INTEGER(iwp) ::  j        !<
       INTEGER(iwp) ::  jco      !<
       INTEGER(iwp) ::  jcorr    !<
       INTEGER(iwp) ::  jinc     !<
-      INTEGER(iwp) ::  jw       !<
       INTEGER(iwp) ::  j1       !<
       INTEGER(iwp) ::  k        !<
@@ -5193,9 +5169,5 @@
       INTEGER(iwp) ::  m        !<
       INTEGER(iwp) ::  n        !<
-      INTEGER(iwp) ::  kbc      !<
       
-      REAL(wp) ::  coarse_dx   !<
-      REAL(wp) ::  coarse_dy   !<
-      REAL(wp) ::  coarse_dz   !<
       REAL(wp) ::  fkj         !<
       REAL(wp) ::  fkjp        !<
@@ -5371,4 +5343,6 @@
       IMPLICIT NONE
 
+      INTEGER(iwp) ::  nzt_topo_nestbc   !<
+
       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                      &
                                       INTENT(INOUT) ::  f             !<
@@ -5390,5 +5364,4 @@
                                           INTENT(IN)           ::  logc  !<
       INTEGER(iwp), DIMENSION(1:2,nxl:nxr), INTENT(IN)         ::  logc_kbounds  !< 
-      INTEGER(iwp) ::  nzt_topo_nestbc   !<
 
       CHARACTER(LEN=1), INTENT(IN) ::  edge   !<
@@ -5412,7 +5385,4 @@
       INTEGER(iwp) ::  n       !<
                             
-      REAL(wp) ::  coarse_dx   !<
-      REAL(wp) ::  coarse_dy   !<
-      REAL(wp) ::  coarse_dz   !<
       REAL(wp) ::  fk          !<
       REAL(wp) ::  fkj         !<
@@ -5614,7 +5584,4 @@
       INTEGER(iwp) ::  n   !<
       
-      REAL(wp) ::  coarse_dx   !<
-      REAL(wp) ::  coarse_dy   !<
-      REAL(wp) ::  coarse_dz   !<
       REAL(wp) ::  fk          !<
       REAL(wp) ::  fkj         !<
@@ -5695,6 +5662,4 @@
        CHARACTER(LEN=*), INTENT(IN) ::  var   !< identifyer for treated variable
 
-       INTEGER(iwp), DIMENSION(0:kct,jcs:jcn,icl:icr), INTENT(IN) :: ijkfc !< number of child grid points contributing to a parent grid box
-
        INTEGER(iwp) ::  i         !< Running index x-direction - fine-grid
        INTEGER(iwp) ::  ii        !< Running index x-direction - coarse grid
@@ -5718,4 +5683,6 @@
        INTEGER(iwp), DIMENSION(0:kct), INTENT(IN)   ::  kfl !< Indicates start index of child cells belonging to certain parent cell - z direction
        INTEGER(iwp), DIMENSION(0:kct), INTENT(IN)   ::  kfu !< Indicates start index of child cells belonging to certain parent cell - z direction
+
+       INTEGER(iwp), DIMENSION(0:kct,jcs:jcn,icl:icr), INTENT(IN) :: ijkfc !< number of child grid points contributing to a parent grid box
 
        REAL(wp) ::  cellsum   !< sum of respective child cells belonging to parent cell 
Index: palm/trunk/SOURCE/pmc_parent_mod.f90
===================================================================
--- palm/trunk/SOURCE/pmc_parent_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/pmc_parent_mod.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3182 2018-07-27 13:36:03Z suehring
 ! Comment extended
 ! 
@@ -249,10 +252,8 @@
 
      INTEGER(iwp) ::  ian    !<
-     INTEGER(iwp) ::  ic     !<
      INTEGER(iwp) ::  ie     !<
      INTEGER(iwp) ::  ip     !<
      INTEGER(iwp) ::  is     !<
      INTEGER(iwp) ::  istat  !<
-     INTEGER(iwp) ::  n,i    !<
 
 
@@ -472,5 +473,4 @@
     INTEGER(iwp)                   ::  i        !<
     INTEGER(iwp)                   ::  ierr     !<
-    INTEGER(iwp)                   ::  istat    !<
     INTEGER(iwp)                   ::  j        !<
     INTEGER(iwp)                   ::  myindex  !<
@@ -633,5 +633,4 @@
     INTEGER(iwp)               ::  ij       !<
     INTEGER(iwp)               ::  ip       !<
-    INTEGER(iwp)               ::  istat    !<
     INTEGER(iwp)               ::  j        !<
     INTEGER(iwp)               ::  myindex  !<
@@ -728,10 +727,9 @@
     INTEGER(iwp)                   ::  ip_start      !<
     INTEGER(iwp)                   ::  ip_end        !<
-    INTEGER(iwp)                   ::  istat         !<
     INTEGER(iwp)                   ::  j             !<
     INTEGER(iwp)                   ::  myindex       !<
     INTEGER(iwp)                   ::  nr            !<
     INTEGER(iwp)                   ::  target_pe     !<
-    INTEGER(kind=MPI_ADDRESS_KIND) ::  target_disp   !<
+    INTEGER(KIND=MPI_ADDRESS_KIND) ::  target_disp   !<
     
     LOGICAL                        ::  lo_ptrans
@@ -926,5 +924,4 @@
     INTEGER(iwp), INTENT(IN) ::  iactive   !<
 
-    INTEGER(iwp) :: i   !<
     INTEGER(iwp) :: ip  !<
     INTEGER(iwp) :: j   !<
Index: palm/trunk/SOURCE/pmc_particle_interface.f90
===================================================================
--- palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 3240)
+++ palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------! 
 ! $Id$
+! unused variables removed
+! 
+! 3123 2018-07-12 16:21:53Z suehring
 ! Correct working precision for REAL numbers
 ! 
@@ -519,5 +522,4 @@
     INTEGER(iwp) ::  child_id            !< id of the child model
     INTEGER(iwp) ::  i                   !< x grid box index
-    INTEGER(iwp) ::  ierr                !< error code
     INTEGER(iwp) ::  ij                  !< combined xy index for the buffer array
     INTEGER(iwp) ::  ip                  !< loop index (child PEs)
@@ -530,182 +532,4 @@
     INTEGER(iwp) ::  pindex              !<
     INTEGER(iwp) ::  tot_particle_count  !< Total number of particles per child
-    
-    REAL(wp) ::  dx_child   !< child grid spacing
-    REAL(wp) ::  dy_child   !< child grid spacing
-    REAL(wp) ::  dz_child   !< child grid spacing
-    REAL(wp) ::  ny_coord   !< north coordinate of child grid
-    REAL(wp) ::  ny_coord_b !< north coordinate of child grid boundary
-    REAL(wp) ::  lx_coord   !< left coordinate of child grid
-    REAL(wp) ::  lx_coord_b !< left coordinate of child grid boundary
-    REAL(wp) ::  rx_coord   !< right coordinate of child grid
-    REAL(wp) ::  rx_coord_b !< right coordinate of child grid boundary
-    REAL(wp) ::  sy_coord   !< south coordinate of child grid
-    REAL(wp) ::  sy_coord_b !< south coordinate of child grid boundary
-    REAL(wp) ::  uz_coord   !< upper coordinate of child grid
-    REAL(wp) ::  uz_coord_b !< upper coordinate of child grid boundary
-    REAL(wp) ::  x          !< particle position
-    REAL(wp) ::  xo         !< origin of particle
-    REAL(wp) ::  y          !< particle position
-    REAL(wp) ::  yo         !< origin of particle
-    REAL(wp) ::  z          !< particle position
-   
-    INTEGER(iwp),DIMENSION(1) ::  buf_shape !<
-    
-#if defined( __parallel )
-    TYPE(pedef), POINTER ::  ape !< TO_DO Klaus: give a description and better name of the variable
-
-    DO  m = 1, get_number_of_childs()
-
-       child_id = get_childid(m)
-
-       CALL get_child_edges( m, lx_coord, lx_coord_b, rx_coord, rx_coord_b,    &
-                                sy_coord, sy_coord_b, ny_coord, ny_coord_b,    &
-                                uz_coord, uz_coord_b) 
-
-       CALL get_child_gridspacing( m, dx_child, dy_child, dz_child )
-
-       IF ( lfirst )   THEN
-          WRITE(9,'(a,5f10.2)') 'edges          ',lx_coord,rx_coord,sy_coord,ny_coord,uz_coord
-          WRITE(9,'(a,5f10.2)') 'edges boundary ',lx_coord_b,rx_coord_b,sy_coord_b,ny_coord_b,uz_coord_b
-          WRITE(9,'(a,5f10.2)') 'child spacing  ',dx_child, dy_child, dz_child,lower_left_coord_x,lower_left_coord_y
-       ENDIF
-!
-!--    reset values for every child
-       tot_particle_count = 0 
-       nr_part  = 0           
-       part_adr = 0
-       pindex   = 1
-
-       buf_shape(1) = max_nr_particle_in_rma_win
-       CALL C_F_POINTER( buf_ptr(m), particle_in_win , buf_shape )
-
-       DO  ip = 1, children(child_id)%inter_npes
-
-          ape => children(child_id)%pes(ip)
-
-          nr_part_col   = 0 
-	  
-          DO  ij = 1, ape%nrele
-             
-!
-!--          Inside the PMC adressing of 3d arrays starts with 1
-             i = ape%locind(ij)%i + nxl - nbgp - 1
-             j = ape%locind(ij)%j + nys - nbgp - 1
-	     nr_part_col = 0 ! Number of particles to transfer per column
-             part_adr(j,i) = pindex
-             
-             DO  k = nzb + 1, nzt
-                number_of_particles = prt_count(k,j,i)
-                
-                IF ( number_of_particles <= 0 )  CYCLE
-                
-                particles => grid_particles(k,j,i)%particles(1:number_of_particles)
-
-                ! Select particles within boundary area
-
-                DO n = 1, number_of_particles
-                   x = particles(n)%x
-                   y = particles(n)%y
-                   z = particles(n)%z
-!
-!--                check if the particle is located in the fine grid area
-                   active_particle = ((x > lx_coord .AND. x < rx_coord) .AND.  &  
-                                      (y > sy_coord .AND. y < ny_coord) .AND.  &
-                                      (z > 0.000000001 .AND. z < uz_coord))
-                   IF ( active_particle .AND. particles(n)%particle_mask )  THEN
-                      
-                      particle_in_win(pindex) = particles(n)
-!
-!--                   Change particle positions and origin relative to global origin
-                      particle_in_win(pindex)%x = particle_in_win(pindex)%x + lower_left_coord_x
-                      particle_in_win(pindex)%y = particle_in_win(pindex)%y + lower_left_coord_y
-                      particle_in_win(pindex)%origin_x = particle_in_win(pindex)%origin_x + lower_left_coord_x
-                      particle_in_win(pindex)%origin_y = particle_in_win(pindex)%origin_y + lower_left_coord_y
-
-                      tot_particle_count = tot_particle_count + 1
-                      nr_part_col        = nr_part_col + 1
-                      pindex             = pindex + 1
-                      IF ( pindex > max_nr_particle_in_rma_win ) THEN
-                         WRITE(9,*) 'RMA window too small on parent ',pindex, max_nr_particle_in_rma_win
-                         message_string = 'RMA window too small on parent'
-                         CALL message( 'pmci_create_child_arrays', 'PA0481', 3, 2, 0, 6, 0 )   ! PA number has to be adjusted
-                     ENDIF
-                   END IF
-                ENDDO
-             ENDDO
-             nr_part(j,i) = nr_part_col
-          ENDDO
-       ENDDO
-
-       CALL pmc_s_fillbuffer( child_id, particle_transfer = .TRUE. )
-    ENDDO
-
-    lfirst = .FALSE.
-
-#endif
- END SUBROUTINE pmcp_p_fill_particle_win
-
- 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> parent routine:
-!> delete particles from the MPI window
-!------------------------------------------------------------------------------!
- SUBROUTINE pmcp_p_empty_particle_win
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  child_id           !< model id of the child
-    INTEGER(iwp) ::  ip                 !< loop index (child PEs)
-    INTEGER(iwp) ::  m                  !< loop index (number of childs)
-
-    INTEGER(iwp),DIMENSION(1) ::  buf_shape !<
-
-#if defined( __parallel )
-    DO  m = 1, get_number_of_childs()
-
-       child_id = get_childid(m)
-
-       buf_shape(1) = max_nr_particle_in_rma_win
-       CALL C_F_POINTER( buf_ptr(m), particle_in_win , buf_shape )
-
-!
-!--    In some cells of the coarse grid, there are contributions from more than one child process
-!--    Therfore p_copy_particle_to_org_grid is done for one child process per call
-
-       DO ip = 1, pmc_s_get_child_npes( child_id )
-          nr_part  = 0
-          part_adr = 0
-
-          CALL pmc_s_getdata_from_buffer( child_id, particle_transfer = .TRUE., child_process_nr = ip )
-
-          CALL p_copy_particle_to_org_grid( m, child_id )
-       ENDDO
-
-    ENDDO
-
-#endif
- END SUBROUTINE pmcp_p_empty_particle_win
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> parent routine:
-!> After the transfer mark all parent particles that are still inside on of the 
-!> child areas for deletion. 
-!------------------------------------------------------------------------------!
- SUBROUTINE pmcp_p_delete_particles_in_fine_grid_area
-
-    IMPLICIT NONE
-
-    LOGICAL ::  to_delete !< particles outside of model domain are marked as to_delete
-    
-    INTEGER(iwp) ::  i !< loop index (x grid)
-    INTEGER(iwp) ::  j !< loop index (y grid)
-    INTEGER(iwp) ::  k !< loop index (z grid)
-    INTEGER(iwp) ::  m !< loop index (number of particles)
-    INTEGER(iwp) ::  n !< loop index (number of childs)
     
     REAL(wp) ::  dx_child   !< child grid spacing
@@ -725,4 +549,181 @@
     REAL(wp) ::  y          !< particle position
     REAL(wp) ::  z          !< particle position
+   
+    INTEGER(iwp),DIMENSION(1) ::  buf_shape !<
+    
+#if defined( __parallel )
+    TYPE(pedef), POINTER ::  ape !< TO_DO Klaus: give a description and better name of the variable
+
+    DO  m = 1, get_number_of_childs()
+
+       child_id = get_childid(m)
+
+       CALL get_child_edges( m, lx_coord, lx_coord_b, rx_coord, rx_coord_b,    &
+                                sy_coord, sy_coord_b, ny_coord, ny_coord_b,    &
+                                uz_coord, uz_coord_b) 
+
+       CALL get_child_gridspacing( m, dx_child, dy_child, dz_child )
+
+       IF ( lfirst )   THEN
+          WRITE(9,'(a,5f10.2)') 'edges          ',lx_coord,rx_coord,sy_coord,ny_coord,uz_coord
+          WRITE(9,'(a,5f10.2)') 'edges boundary ',lx_coord_b,rx_coord_b,sy_coord_b,ny_coord_b,uz_coord_b
+          WRITE(9,'(a,5f10.2)') 'child spacing  ',dx_child, dy_child, dz_child,lower_left_coord_x,lower_left_coord_y
+       ENDIF
+!
+!--    reset values for every child
+       tot_particle_count = 0 
+       nr_part  = 0           
+       part_adr = 0
+       pindex   = 1
+
+       buf_shape(1) = max_nr_particle_in_rma_win
+       CALL C_F_POINTER( buf_ptr(m), particle_in_win , buf_shape )
+
+       DO  ip = 1, children(child_id)%inter_npes
+
+          ape => children(child_id)%pes(ip)
+
+          nr_part_col   = 0 
+	  
+          DO  ij = 1, ape%nrele
+             
+!
+!--          Inside the PMC adressing of 3d arrays starts with 1
+             i = ape%locind(ij)%i + nxl - nbgp - 1
+             j = ape%locind(ij)%j + nys - nbgp - 1
+             nr_part_col = 0   ! Number of particles to transfer per column
+             part_adr(j,i) = pindex
+             
+             DO  k = nzb + 1, nzt
+                number_of_particles = prt_count(k,j,i)
+                
+                IF ( number_of_particles <= 0 )  CYCLE
+                
+                particles => grid_particles(k,j,i)%particles(1:number_of_particles)
+
+                ! Select particles within boundary area
+
+                DO n = 1, number_of_particles
+                   x = particles(n)%x
+                   y = particles(n)%y
+                   z = particles(n)%z
+!
+!--                check if the particle is located in the fine grid area
+                   active_particle = ((x > lx_coord .AND. x < rx_coord) .AND.  &  
+                                      (y > sy_coord .AND. y < ny_coord) .AND.  &
+                                      (z > 0.000000001 .AND. z < uz_coord))
+                   IF ( active_particle .AND. particles(n)%particle_mask )  THEN
+                      
+                      particle_in_win(pindex) = particles(n)
+!
+!--                   Change particle positions and origin relative to global origin
+                      particle_in_win(pindex)%x = particle_in_win(pindex)%x + lower_left_coord_x
+                      particle_in_win(pindex)%y = particle_in_win(pindex)%y + lower_left_coord_y
+                      particle_in_win(pindex)%origin_x = particle_in_win(pindex)%origin_x + lower_left_coord_x
+                      particle_in_win(pindex)%origin_y = particle_in_win(pindex)%origin_y + lower_left_coord_y
+
+                      tot_particle_count = tot_particle_count + 1
+                      nr_part_col        = nr_part_col + 1
+                      pindex             = pindex + 1
+                      IF ( pindex > max_nr_particle_in_rma_win ) THEN
+                         WRITE(9,*) 'RMA window too small on parent ',pindex, max_nr_particle_in_rma_win
+                         message_string = 'RMA window too small on parent'
+                         CALL message( 'pmci_create_child_arrays', 'PA0481', 3, 2, 0, 6, 0 )   ! PA number has to be adjusted
+                     ENDIF
+                   END IF
+                ENDDO
+             ENDDO
+             nr_part(j,i) = nr_part_col
+          ENDDO
+       ENDDO
+
+       CALL pmc_s_fillbuffer( child_id, particle_transfer = .TRUE. )
+    ENDDO
+
+    lfirst = .FALSE.
+
+#endif
+ END SUBROUTINE pmcp_p_fill_particle_win
+
+ 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> parent routine:
+!> delete particles from the MPI window
+!------------------------------------------------------------------------------!
+ SUBROUTINE pmcp_p_empty_particle_win
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  child_id           !< model id of the child
+    INTEGER(iwp) ::  ip                 !< loop index (child PEs)
+    INTEGER(iwp) ::  m                  !< loop index (number of childs)
+
+    INTEGER(iwp),DIMENSION(1) ::  buf_shape !<
+
+#if defined( __parallel )
+    DO  m = 1, get_number_of_childs()
+
+       child_id = get_childid(m)
+
+       buf_shape(1) = max_nr_particle_in_rma_win
+       CALL C_F_POINTER( buf_ptr(m), particle_in_win , buf_shape )
+
+!
+!--    In some cells of the coarse grid, there are contributions from more than
+!--    one child process. Therefore p_copy_particle_to_org_grid is done for one
+!--    child process per call
+       DO ip = 1, pmc_s_get_child_npes( child_id )
+
+          nr_part  = 0
+          part_adr = 0
+
+          CALL pmc_s_getdata_from_buffer( child_id, particle_transfer = .TRUE.,&
+                                          child_process_nr = ip )
+          CALL p_copy_particle_to_org_grid( m )
+       ENDDO
+
+    ENDDO
+
+#endif
+ END SUBROUTINE pmcp_p_empty_particle_win
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> parent routine:
+!> After the transfer mark all parent particles that are still inside on of the 
+!> child areas for deletion. 
+!------------------------------------------------------------------------------!
+ SUBROUTINE pmcp_p_delete_particles_in_fine_grid_area
+
+    IMPLICIT NONE
+
+    LOGICAL ::  to_delete !< particles outside of model domain are marked as to_delete
+    
+    INTEGER(iwp) ::  i !< loop index (x grid)
+    INTEGER(iwp) ::  j !< loop index (y grid)
+    INTEGER(iwp) ::  k !< loop index (z grid)
+    INTEGER(iwp) ::  m !< loop index (number of particles)
+    INTEGER(iwp) ::  n !< loop index (number of childs)
+    
+    REAL(wp) ::  dx_child   !< child grid spacing
+    REAL(wp) ::  dy_child   !< child grid spacing
+    REAL(wp) ::  dz_child   !< child grid spacing
+    REAL(wp) ::  ny_coord   !< north coordinate of child grid
+    REAL(wp) ::  ny_coord_b !< north coordinate of child grid boundary
+    REAL(wp) ::  lx_coord   !< left coordinate of child grid
+    REAL(wp) ::  lx_coord_b !< left coordinate of child grid boundary
+    REAL(wp) ::  rx_coord   !< right coordinate of child grid
+    REAL(wp) ::  rx_coord_b !< right coordinate of child grid boundary
+    REAL(wp) ::  sy_coord   !< south coordinate of child grid
+    REAL(wp) ::  sy_coord_b !< south coordinate of child grid boundary
+    REAL(wp) ::  uz_coord   !< upper coordinate of child grid
+    REAL(wp) ::  uz_coord_b !< upper coordinate of child grid boundary
+    REAL(wp) ::  x          !< particle position
+    REAL(wp) ::  y          !< particle position
+    REAL(wp) ::  z          !< particle position
     
 #if defined( __parallel )
@@ -951,5 +952,5 @@
                    ENDIF
                    coarse_particles(jc,ic)%parent_particles(n)%x = xc                   ! Adjust coordinates to child grid
-            	   coarse_particles(jc,ic)%parent_particles(n)%y = yc
+                   coarse_particles(jc,ic)%parent_particles(n)%y = yc
                    coarse_particles(jc,ic)%parent_particles(n)%origin_x = xoc           ! Adjust origins to child grid
                    coarse_particles(jc,ic)%parent_particles(n)%origin_y = yoc
@@ -1086,9 +1087,8 @@
 !> copy/sort particles from the MPI window into the respective grid boxes
 !------------------------------------------------------------------------------!
- SUBROUTINE p_copy_particle_to_org_grid( m, child_id )
+ SUBROUTINE p_copy_particle_to_org_grid( m )
 
     IMPLICIT NONE
 
-    INTEGER(iwp),INTENT(IN) ::  child_id !<
     INTEGER(iwp),INTENT(IN) ::  m        !<
 
Index: palm/trunk/SOURCE/poisfft_mod.f90
===================================================================
--- palm/trunk/SOURCE/poisfft_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/poisfft_mod.f90	(revision 3241)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! unused variables removed,
+! declarations of omp_get_thread_num now as omp-directive
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -189,16 +193,9 @@
 ! Description:
 ! ------------
-!> @todo Missing subroutine description.
+!> Setup coefficients for FFT and the tridiagonal solver
 !------------------------------------------------------------------------------!
     SUBROUTINE poisfft_init
 
-       USE arrays_3d,                                                          &
-           ONLY:  ddzu_pres, ddzw
-
-       USE kinds
-
        IMPLICIT NONE
-
-       INTEGER(iwp) ::  k  !<
 
 
@@ -221,5 +218,5 @@
 
        USE control_parameters,                                                 &
-           ONLY:  fft_method, transpose_compute_overlap
+           ONLY:  transpose_compute_overlap
 
        USE cpulog,                                                             &
@@ -245,5 +242,4 @@
        INTEGER(iwp) ::  nnx_y        !<
        INTEGER(iwp) ::  nny_z        !<
-       INTEGER(iwp) ::  nnz_t        !<
        INTEGER(iwp) ::  nnz_x        !<
        INTEGER(iwp) ::  nxl_y_bound  !<
@@ -1012,5 +1008,5 @@
        INTEGER(iwp) ::  m                   !<
        INTEGER(iwp) ::  n                   !<
-       INTEGER(iwp) ::  omp_get_thread_num  !<
+!$     INTEGER(iwp) ::  omp_get_thread_num  !<
        INTEGER(iwp) ::  tn                  !<
 
@@ -1383,5 +1379,5 @@
        INTEGER(iwp) ::  m                   !<
        INTEGER(iwp) ::  n                   !<
-       INTEGER(iwp) ::  omp_get_thread_num  !<
+!$     INTEGER(iwp) ::  omp_get_thread_num  !<
        INTEGER(iwp) ::  tn                  !<
 
Index: palm/trunk/SOURCE/poismg_mod.f90
===================================================================
--- palm/trunk/SOURCE/poismg_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/poismg_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Rename variables in mesoscale-offline nesting mode
 ! 
@@ -305,5 +308,5 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  f1_mg, f2_mg, f3_mg, rho_air_mg
+           ONLY:  rho_air_mg
 
        USE control_parameters,                                                 &
@@ -725,5 +728,5 @@
 
        USE arrays_3d,                                                          &
-           ONLY:  f1_mg, f2_mg, f3_mg, rho_air_mg
+           ONLY:  rho_air_mg
 
        USE control_parameters,                                                 &
@@ -1033,7 +1036,4 @@
 
 
-       USE control_parameters,                                                 &
-           ONLY:  grid_level
-
        USE indices,                                                            &
            ONLY:  nxl_mg, nxr_mg, nys_mg, nyn_mg, nzb, nzt_mg
@@ -1148,7 +1148,4 @@
     SUBROUTINE sort_k_to_even_odd_blocks_int( i_mg , glevel )
 
-
-       USE control_parameters,                                                 &
-           ONLY:  grid_level
 
        USE indices,                                                            &
@@ -1409,7 +1406,6 @@
        USE control_parameters,                                                 &
            ONLY:  bc_lr_dirrad, bc_lr_raddir, bc_ns_dirrad, bc_ns_raddir,      &
-                  child_domain, gamma_mg, grid_level_count, ibc_p_b, ibc_p_t,  &
-                  maximum_grid_level,  mg_switch_to_pe0_level,                 &
-                  mg_switch_to_pe0, ngsrb 
+                  child_domain, gamma_mg, grid_level_count, maximum_grid_level,&
+                  mg_switch_to_pe0_level, mg_switch_to_pe0, ngsrb
 
        USE indices,                                                            &
@@ -1771,5 +1767,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl_mg, nxr_mg, nys_mg, nyn_mg, nzb, nzt_mg
+           ONLY:  nzb, nzt_mg
 
        IMPLICIT NONE
@@ -1822,14 +1818,12 @@
 !> "red" or "black" data points.
 !------------------------------------------------------------------------------!
-     SUBROUTINE special_exchange_horiz ( p_mg, color )
+     SUBROUTINE special_exchange_horiz( p_mg, color )
 
 
        USE control_parameters,                                                 &
-           ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t,          &
-                  maximum_grid_level,                                          &
-                  mg_switch_to_pe0_level, synchronous_exchange
+           ONLY:  grid_level, mg_switch_to_pe0_level, synchronous_exchange
 
        USE indices,                                                            &
-           ONLY:  mg_loc_ind, nxl, nxl_mg, nxr, nxr_mg, nys, nys_mg, nyn,      &
+           ONLY:  nxl, nxl_mg, nxr, nxr_mg, nys, nys_mg, nyn,      &
                   nyn_mg, nzb, nzt, nzt_mg
 
Index: palm/trunk/SOURCE/poismg_noopt_mod.f90
===================================================================
--- palm/trunk/SOURCE/poismg_noopt_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/poismg_noopt_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Rename variables in mesoscale-offline nesting mode
 ! 
@@ -1422,6 +1425,5 @@
        USE control_parameters,                                                 &
            ONLY:  bc_lr_dirrad, bc_lr_raddir, bc_ns_dirrad, bc_ns_raddir,      &
-                  gamma_mg, grid_level_count, ibc_p_b, ibc_p_t,                &
-                  maximum_grid_level,                                          &
+                  gamma_mg, grid_level_count, maximum_grid_level,              &
                   mg_switch_to_pe0_level, mg_switch_to_pe0, ngsrb
 
Index: palm/trunk/SOURCE/print_1d.f90
===================================================================
--- palm/trunk/SOURCE/print_1d.f90	(revision 3240)
+++ palm/trunk/SOURCE/print_1d.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused format statement removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -125,8 +128,4 @@
                              TRIM( region( sr ) ), TRIM( period_chr ), 'uv'
           WRITE ( 16, 105 )  TRIM( simulated_time_chr )
-!          ELSE
-!             WRITE ( 16, 106 )  TRIM( simulated_time_chr ),           &
-!                                averaging_interval_pr, average_count_pr
-!          ENDIF
           WRITE ( 16, 111 )
 
@@ -155,8 +154,4 @@
                              TRIM( region( sr ) ), TRIM( period_chr ), 'w'
           WRITE ( 16, 105 )  TRIM( simulated_time_chr )
-!          ELSE
-!             WRITE ( 16, 106 )  TRIM( simulated_time_chr ),           &
-!                                averaging_interval_pr, average_count_pr
-!          ENDIF
           WRITE ( 16, 111 )
 
@@ -184,6 +179,4 @@
             ' Horizontally',A,' averaged profiles on the ',A,'-level')
 105 FORMAT (' Time: ',A)
-106 FORMAT (' Time: ',A,18X,'averaged over',F7.1,' s (',I4, &
-            ' Single times)')
 111 FORMAT (1X,131('-'))
 112 FORMAT (/)
Index: palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- palm/trunk/SOURCE/prognostic_equations.f90	(revision 3240)
+++ palm/trunk/SOURCE/prognostic_equations.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! omp_get_thread_num now declared in omp directive
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Remove unused variables from USE statements
 ! 
@@ -446,5 +449,5 @@
     INTEGER(iwp) ::  j                   !<
     INTEGER(iwp) ::  k                   !<
-    INTEGER(iwp) ::  omp_get_thread_num  !<
+!$  INTEGER(iwp) ::  omp_get_thread_num  !<
     INTEGER(iwp) ::  tn = 0              !<
 
Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 3241)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed or commented
+! 
+! 3233 2018-09-07 13:21:24Z schwenkel
 ! Adapted for the use of cloud_droplets 
 ! 
@@ -883,5 +886,4 @@
     REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfoutsw        !< array of total sw radiation outgoing from nonvirtual surfaces surfaces after all reflection
     REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfoutlw        !< array of total lw radiation outgoing from nonvirtual surfaces surfaces after all reflection
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfhf           !< array of total radiation flux incoming to minus outgoing from local surface
     REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfemitlwl      !< array of emitted lw radiation for local surface used to calculate effective surface temperature for radiation model
 
@@ -1217,5 +1219,4 @@
        CHARACTER (LEN=*) ::  dopr_unit !< local value of dopr_unit
  
-       INTEGER(iwp) ::  user_pr_index !< 
        INTEGER(iwp) ::  var_count     !< 
 
@@ -1375,5 +1376,5 @@
 
        USE control_parameters,                                                 &
-           ONLY: land_surface, message_string, topography, urban_surface
+           ONLY: land_surface, message_string, urban_surface
 
        USE netcdf_data_input_mod,                                              &
@@ -1469,10 +1470,12 @@
 
        INTEGER(iwp) ::  i         !< running index x-direction 
-       INTEGER(iwp) ::  ind_type  !< running index for subgrid-surface tiles 
        INTEGER(iwp) ::  ioff      !< offset in x between surface element reference grid point in atmosphere and actual surface 
        INTEGER(iwp) ::  j         !< running index y-direction 
        INTEGER(iwp) ::  joff      !< offset in y between surface element reference grid point in atmosphere and actual surface 
        INTEGER(iwp) ::  l         !< running index for orientation of vertical surfaces 
-       INTEGER(iwp) ::  m         !< running index for surface elements  
+       INTEGER(iwp) ::  m         !< running index for surface elements
+#if defined( __rrtmg )
+       INTEGER(iwp) ::  ind_type  !< running index for subgrid-surface tiles
+#endif
 
 !
@@ -2732,5 +2735,5 @@
 11 FORMAT (/'    --> Shortwave radiation is disabled.')
 12 FORMAT  ('    Timestep: dt_radiation = ', F6.2, '  s')
-13 FORMAT (/'    Albedo is set individually for each xy-location, according '  &
+13 FORMAT (/'    Albedo is set individually for each xy-location, according ', &
                  'to given surface type.')
 
@@ -2838,4 +2841,5 @@
     SUBROUTINE radiation_rrtmg
 
+#if defined ( __rrtmg )
        USE indices,                                                            &
            ONLY:  nbgp
@@ -2847,5 +2851,4 @@
        IMPLICIT NONE
 
-#if defined ( __rrtmg )
 
        INTEGER(iwp) ::  i, j, k, l, m, n !< loop indices
@@ -4461,7 +4464,6 @@
 
      IMPLICIT NONE
-
-     INTEGER(iwp)                      :: i, j, k, kk, is, js, d, ku, refstep, m, mm, l, ll
-     INTEGER(iwp)                      :: nzubl, nzutl, isurf, isurfsrc, isvf, icsf, ipcgb
+     INTEGER(iwp)                      :: i, j, k, kk, d, refstep, m, mm, l, ll
+     INTEGER(iwp)                      :: isurf, isurfsrc, isvf, icsf, ipcgb
      INTEGER(iwp)                      :: isd                !< solar direction number
      INTEGER(iwp)                      :: pc_box_dimshift    !< transform for best accuracy
@@ -4477,8 +4479,8 @@
      REAL(wp), PARAMETER               :: alpha = 0._wp      !< grid rotation (TODO: add to namelist or remove)
      REAL(wp)                          :: pc_box_area, pc_abs_frac, pc_abs_eff
-     REAL(wp)                          ::  count_surfaces    !< number of all surfaces in model domain
-     REAL(wp)                          ::  count_surfaces_l  !< number of all surfaces in sub-domain
-     REAL(wp)                          ::  pt_surf_urb       !< mean surface temperature of all surfaces in model domain, temporal work-around
-     REAL(wp)                          ::  pt_surf_urb_l     !< mean surface temperature of all surfaces in sub-domain, temporal work-around
+!     REAL(wp)                          ::  count_surfaces    !< number of all surfaces in model domain
+!     REAL(wp)                          ::  count_surfaces_l  !< number of all surfaces in sub-domain
+!     REAL(wp)                          ::  pt_surf_urb       !< mean surface temperature of all surfaces in model domain, temporal work-around
+!     REAL(wp)                          ::  pt_surf_urb_l     !< mean surface temperature of all surfaces in sub-domain, temporal work-around
 
      REAL(wp), DIMENSION(0:nsurf_type) :: facearea
@@ -4497,5 +4499,4 @@
      REAL(wp)                          :: area_surfl         !< total area of surfaces in local processor
      REAL(wp)                          :: area_surf          !< total area of surfaces in all processor
-     REAL(wp)                          :: area_horl          !< total horizontal area of domain in local processor
      REAL(wp)                          :: area_hor           !< total horizontal area of domain in all processor
 
@@ -4716,5 +4717,4 @@
      surfoutlw = surfoutll
      surfemitlwl = surfoutll
-!        surfhf = surfinsw + surfinlw - surfoutsw - surfoutlw
 
      IF ( .NOT.  surface_reflections )  THEN
@@ -4772,5 +4772,4 @@
          surfoutsw = surfoutsw + surfoutsl
          surfoutlw = surfoutlw + surfoutll
-!            surfhf = surfinsw + surfinlw - surfoutsw - surfoutlw
 
      ENDDO
@@ -5215,13 +5214,11 @@
 
        USE plant_canopy_model_mod,                                             &
-           ONLY:  pch_index, pc_heating_rate, lad_s
+           ONLY:  pch_index, lad_s
 
        IMPLICIT NONE
 
-       INTEGER(iwp) :: i, j, k, d, l, ir, jr, ids, m
+       INTEGER(iwp) :: i, j, k, l, m
        INTEGER(iwp) :: k_topo     !< vertical index indicating topography top for given (j,i)
-       INTEGER(iwp) :: k_topo2    !< vertical index indicating topography top for given (j,i)
        INTEGER(iwp) :: nzptl, nzubl, nzutl, isurf, ipcgb
-       INTEGER(iwp) :: procid
        REAL(wp)     :: mrl
 
@@ -5555,7 +5552,7 @@
         IMPLICIT NONE
         
-        INTEGER(iwp)                                  :: i, j, k, l, d, ip, jp
+        INTEGER(iwp)                                  :: i, j, k, d, ip, jp
         INTEGER(iwp)                                  :: isvf, ksvf, icsf, kcsf, npcsfl, isvf_surflt, imrtt, imrtf, ipcgb
-        INTEGER(iwp)                                  :: sd, td, ioln, iproc
+        INTEGER(iwp)                                  :: sd, td
         INTEGER(iwp)                                  :: iaz, izn      !< azimuth, zenith counters
         INTEGER(iwp)                                  :: naz, nzn      !< azimuth, zenith num of steps
@@ -5581,8 +5578,6 @@
         REAL(wp)                                      :: transparency, rirrf, sqdist, svfsum
         INTEGER(iwp)                                  :: isurflt, isurfs, isurflt_prev
-        INTEGER(iwp)                                  :: itx, ity, itz
         INTEGER(idp)                                  :: ray_skip_maxdist, ray_skip_minval !< skipped raytracing counts
         INTEGER(iwp)                                  :: max_track_len !< maximum 2d track length
-        CHARACTER(len=7)                              :: pid_char = ''
         INTEGER(iwp)                                  :: win_lad, minfo
         REAL(wp), DIMENSION(:,:,:), POINTER           :: lad_s_rma       !< fortran pointer, but lower bounds are 1
@@ -5593,5 +5588,5 @@
 !    
         INTEGER(iwp), DIMENSION(0:svfnorm_report_num) :: svfnorm_counts
-        CHARACTER(200)                                :: msg
+!        CHARACTER(200)                                :: msg
 
 !--     calculation of the SVF
@@ -6260,8 +6255,8 @@
         RETURN
         
-301     WRITE( message_string, * )  &
-            'I/O error when processing shape view factors / ',  &
-            'plant canopy sink factors / direct irradiance factors.'
-        CALL message( 'init_urban_surface', 'PA0502', 2, 2, 0, 6, 0 )
+!        WRITE( message_string, * )  &
+!            'I/O error when processing shape view factors / ',  &
+!            'plant canopy sink factors / direct irradiance factors.'
+!        CALL message( 'init_urban_surface', 'PA0502', 2, 2, 0, 6, 0 )
        
     END SUBROUTINE radiation_calc_svf
@@ -6295,5 +6290,5 @@
         REAL(wp), INTENT(out)                  :: transparency !< along whole path
         INTEGER(iwp), INTENT(in)               :: win_lad
-        INTEGER(iwp)                           :: i, j, k, d
+        INTEGER(iwp)                           :: i, k, d
         INTEGER(iwp)                           :: seldim       !< dimension to be incremented
         INTEGER(iwp)                           :: ncsb         !< no of written plant canopy sinkboxes
@@ -7269,5 +7264,5 @@
         INTEGER(iwp)                            :: iread, iwrite
         TYPE(t_csf), DIMENSION(:), POINTER      :: acsfnew
-        CHARACTER(100)                          :: msg
+!        CHARACTER(100)                          :: msg
 
         IF ( newsize == -1 )  THEN
@@ -9370,16 +9365,16 @@
 !> Subroutine writes debug information
 !------------------------------------------------------------------------------!
- SUBROUTINE radiation_write_debug_log ( message )
+! SUBROUTINE radiation_write_debug_log ( message )
     !> it writes debug log with time stamp
-    CHARACTER(*)  :: message
-    CHARACTER(15) :: dtc
-    CHARACTER(8)  :: date
-    CHARACTER(10) :: time
-    CHARACTER(5)  :: zone
-    CALL date_and_time(date, time, zone)
-    dtc = date(7:8)//','//time(1:2)//':'//time(3:4)//':'//time(5:10)
-    WRITE(9,'(2A)') dtc, TRIM(message)
-    FLUSH(9)
- END SUBROUTINE radiation_write_debug_log
+!    CHARACTER(*)  :: message
+!    CHARACTER(15) :: dtc
+!    CHARACTER(8)  :: date
+!    CHARACTER(10) :: time
+!    CHARACTER(5)  :: zone
+!    CALL date_and_time(date, time, zone)
+!    dtc = date(7:8)//','//time(1:2)//':'//time(3:4)//':'//time(5:10)
+!    WRITE(9,'(2A)') dtc, TRIM(message)
+!    FLUSH(9)
+! END SUBROUTINE radiation_write_debug_log
 
  END MODULE radiation_model_mod
Index: palm/trunk/SOURCE/random_generator_parallel_mod.f90
===================================================================
--- palm/trunk/SOURCE/random_generator_parallel_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/random_generator_parallel_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variable removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -140,5 +143,5 @@
 !> Initialize the parallel random number generator for a specific subdomain
 !------------------------------------------------------------------------------!
-   SUBROUTINE init_parallel_random_generator(nx, ny, nys, nyn, nxl, nxr)
+   SUBROUTINE init_parallel_random_generator( nx, nys, nyn, nxl, nxr )
 
       USE kinds
@@ -150,5 +153,4 @@
 
       INTEGER(isp), INTENT(IN) ::  nx    !< 
-      INTEGER(isp), INTENT(IN) ::  ny    !< 
       INTEGER(isp), INTENT(IN) ::  nys   !< 
       INTEGER(isp), INTENT(IN) ::  nyn   !< 
Index: palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Rename variables for boundary flags
 ! 
@@ -830,9 +833,9 @@
 
 
-       USE arrays_3d,                                                             &
-           ONLY:  inflow_damping_factor, mean_inflow_profiles, ref_state, ug, vg
-
-       USE indices,                                                               &
-           ONLY:  nz, nx, nx_on_file, ny, ny_on_file
+       USE arrays_3d,                                                          &
+           ONLY:  ref_state
+
+       USE indices,                                                            &
+           ONLY:  nz, nx_on_file, ny_on_file
 
        USE kinds
@@ -840,7 +843,6 @@
        USE pegrid
 
-       USE statistics,                                                            &
-           ONLY:  statistic_regions, hom, hom_sum, pr_palm, u_max, u_max_ijk,     &
-                  v_max, v_max_ijk, w_max, w_max_ijk
+       USE statistics,                                                         &
+           ONLY:  statistic_regions, hom, hom_sum, pr_palm
 
        IMPLICIT NONE
@@ -1066,5 +1068,5 @@
 
     USE chemistry_model_mod,                                                   &
-        ONLY:  chem_rrd_local, chem_species, nspec                                
+        ONLY:  chem_rrd_local
 
     USE cpulog,                                                                &
@@ -1089,5 +1091,5 @@
 
     USE radiation_model_mod,                                                   &
-        ONLY: radiation, radiation_rrd_local
+        ONLY: radiation_rrd_local
 
     USE random_function_mod,                                                   &
@@ -1157,6 +1159,4 @@
     LOGICAL ::  found
 
-    REAL(wp) ::  rdummy
-
     REAL(wp), DIMENSION(:,:),   ALLOCATABLE   ::  tmp_2d      !< temporary array for storing 2D data
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d      !< temporary array for storing 3D data
@@ -2090,6 +2090,4 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=10) ::  version_on_file
-
        CHARACTER (LEN=1) ::  cdum
 
Index: palm/trunk/SOURCE/spectra_mod.f90
===================================================================
--- palm/trunk/SOURCE/spectra_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/spectra_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3049 2018-05-29 13:52:36Z Giersch
 ! Error messages revised
 ! 
@@ -372,5 +375,5 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=40) ::  output_format       !< internal string
+!       CHARACTER (LEN=40) ::  output_format       !< internal string
 
        INTEGER(iwp) ::  i                         !< internal counter
@@ -399,5 +402,5 @@
      1 FORMAT ('    Spectra:')
      2 FORMAT ('       Output format: ',A/)
-     3 FORMAT ('       Output format: ',A, '   compressed with level: ',I1/)
+!     3 FORMAT ('       Output format: ',A, '   compressed with level: ',I1/)
      4 FORMAT ('       Output every ',F7.1,' s'/)
      5 FORMAT ('       No output during initial ',F8.2,' s')
@@ -491,5 +494,5 @@
                 CALL transpose_yxd( d, d )
              ENDIF
-             CALL calc_spectra_x( d, pr, m )
+             CALL calc_spectra_x( d, m )
 #else
              message_string = 'sorry, calculation of spectra in non paral' //  &
@@ -521,5 +524,5 @@
 #if defined( __parallel )
              CALL transpose_zyd( d, d )
-             CALL calc_spectra_y( d, pr, m )
+             CALL calc_spectra_y( d, m )
 #else
              message_string = 'sorry, calculation of spectra in non paral' //  &
@@ -658,8 +661,5 @@
 !> @todo Missing subroutine description.
 !------------------------------------------------------------------------------!
-    SUBROUTINE calc_spectra_x( ddd, pr, m )
-
-       USE control_parameters,                                                 &
-           ONLY:  fft_method
+    SUBROUTINE calc_spectra_x( ddd, m )
 
        USE fft_xy,                                                             &
@@ -696,10 +696,8 @@
 
        INTEGER(iwp) ::  i         !<
-       INTEGER(iwp) ::  ishape(1) !<
        INTEGER(iwp) ::  j         !<
        INTEGER(iwp) ::  k         !<
        INTEGER(iwp) ::  m         !<
        INTEGER(iwp) ::  n         !<
-       INTEGER(iwp) ::  pr        !<
 
        REAL(wp) ::  exponent     !<
@@ -805,8 +803,5 @@
 !> @todo Missing subroutine description.
 !------------------------------------------------------------------------------!
-    SUBROUTINE calc_spectra_y( ddd, pr, m )
-
-       USE control_parameters,                                                 &
-           ONLY:  fft_method
+    SUBROUTINE calc_spectra_y( ddd, m )
 
        USE fft_xy,                                                             &
@@ -844,9 +839,7 @@
        INTEGER(iwp) ::  i         !<
        INTEGER(iwp) ::  j         !<
-       INTEGER(iwp) ::  jshape(1) !<
        INTEGER(iwp) ::  k         !<
        INTEGER(iwp) ::  m         !<
        INTEGER(iwp) ::  n         !<
-       INTEGER(iwp) ::  pr        !<
 
        REAL(wp) ::  exponent !<
Index: palm/trunk/SOURCE/sum_up_3d_data.f90
===================================================================
--- palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 3240)
+++ palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3176 2018-07-26 17:12:48Z suehring
 ! Remove output of latent heat flux at urban-surfaces and set fill values 
 ! instead 
@@ -204,5 +207,5 @@
 
     USE averaging,                                                             &
-        ONLY:  diss_av, e_av, ghf_av, kh_av, km_av, lpt_av, lwp_av, nc_av,     &
+        ONLY:  e_av, ghf_av, lpt_av, lwp_av, nc_av,     &
                nr_av,                                                          &
                ol_av, p_av, pc_av, pr_av, prr_av, pt_av, q_av, qc_av, ql_av,   &
@@ -210,6 +213,7 @@
                rho_ocean_av, s_av, sa_av, shf_av, ssws_av, ts_av, tsurf_av,    &
                u_av, us_av, v_av, vpt_av, w_av, z0_av, z0h_av, z0q_av
+
     USE chemistry_model_mod,                                                   &
-        ONLY:  chem_3d_data_averaging, chem_integrate, chem_species, nspec                                   
+        ONLY:  chem_3d_data_averaging
 
     USE cloud_parameters,                                                      &
Index: palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/surface_mod.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3222 2018-08-30 13:35:35Z suehring
 ! +building_type, pavement_type, vegetation_type, water_type
 ! +building_type_name, pavement_type_name, vegetation_type_name, water_type_name 
@@ -1623,6 +1626,4 @@
        INTEGER(iwp) ::  j         !< running index y-direction
        INTEGER(iwp) ::  k         !< running index z-direction
-       INTEGER(iwp) ::  l         !< index variable used to distinguish surface facing
-       INTEGER(iwp) ::  m         !< running index surface elements
 
        INTEGER(iwp)                 ::  start_index_lsm_h !< dummy to determing local start index in surface type for given (j,i), for horizontal natural surfaces
@@ -3366,10 +3367,5 @@
                                   nysc, nys_on_file, found )
 
-       USE pegrid,                                                             &
-           ONLY: myid, numprocs_previous_run
-
        IMPLICIT NONE
-
-       CHARACTER (LEN=1)  ::  dum         !< dummy to create correct string for reading input variable
 
        INTEGER(iwp)       ::  i           !< running index along x-direction, refers to former domain size
@@ -3377,5 +3373,4 @@
        INTEGER(iwp)       ::  j           !< running index along y-direction, refers to former domain size
        INTEGER(iwp)       ::  jc          !< running index along y-direction, refers to former domain size
-       INTEGER(iwp)       ::  k           !< running index along z-direction
        INTEGER(iwp)       ::  m           !< running index for surface elements, refers to gathered array encompassing all surface types
        INTEGER(iwp)       ::  mm          !< running index for surface elements, refers to individual surface types
Index: palm/trunk/SOURCE/swap_timelevel.f90
===================================================================
--- palm/trunk/SOURCE/swap_timelevel.f90	(revision 3240)
+++ palm/trunk/SOURCE/swap_timelevel.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2817 2018-02-19 16:32:21Z knoop
 ! Preliminary gust module interface implemented
 ! 
@@ -125,13 +128,12 @@
 #if defined( __nopointer )
     USE arrays_3d,                                                             &
-        ONLY:  e, e_p, nc, nc_p, nr, nr_p, pt, pt_p, q, q_p, qc, qc_p, qr,     &
-               qr_p, s, s_p, sa, sa_p, u, u_p, v, v_p, w, w_p
+        ONLY:  nc, nc_p, nr, nr_p, pt, pt_p, q, q_p, qc, qc_p, qr, qr_p, s,    &
+               s_p, sa, sa_p, u, u_p, v, v_p, w, w_p
 #else
     USE arrays_3d,                                                             &
-        ONLY:  e, e_1, e_2, e_p, nc, nc_1, nc_2, nc_p, nr, nr_1, nr_2, nr_p,   &
-               pt, pt_1, pt_2, pt_p, q, q_1, q_2, q_p, qc, qc_1, qc_2, qc_p,   &
-               qr, qr_1, qr_2, qr_p, s, s_1, s_2, s_p, sa, sa_1, sa_2, sa_p,   &
-               u, u_1, u_2, u_p, v, v_1, v_2, v_p, w, w_1, w_2, w_p
-
+        ONLY:  nc, nc_1, nc_2, nc_p, nr, nr_1, nr_2, nr_p, pt, pt_1, pt_2,     &
+               pt_p, q, q_1, q_2, q_p, qc, qc_1, qc_2, qc_p, qr, qr_1, qr_2,   &
+               qr_p, s, s_1, s_2, s_p, sa, sa_1, sa_2, sa_p, u, u_1, u_2, u_p, &
+               v, v_1, v_2, v_p, w, w_1, w_2, w_p
 #endif
 
@@ -146,6 +148,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  air_chemistry, cloud_physics, constant_diffusion,               &
-               humidity, land_surface,                                         &
+        ONLY:  air_chemistry, cloud_physics, humidity, land_surface,           &
                microphysics_morrison, microphysics_seifert, neutral, ocean,    &
                passive_scalar, timestep_count, urban_surface
@@ -154,6 +155,8 @@
         ONLY: gust_module_enabled, gust_swap_timelevel
 
+#if defined( __nopointer )
     USE indices,                                                               &
         ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
+#endif
 
     USE pmc_interface,                                                         &
@@ -169,5 +172,7 @@
     IMPLICIT NONE
 
+#if defined( __nopointer )
     INTEGER ::  i, j, k     !> loop indices
+#endif
     INTEGER ::  swap_level  !> swap_level for steering the pmc data transfer
 
Index: palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
===================================================================
--- palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3186 2018-07-30 17:07:14Z suehring
 ! Mask topography while imposing inflow perturbations at the boundaries; do not
 ! impose perturbations at top boundary as well as ghost points
@@ -324,6 +327,6 @@
 
     USE control_parameters,                                                    &
-        ONLY:  bc_lr, bc_ns, child_domain, nesting_offline,                    &
-               number_stretch_level_start, rans_mode, turbulent_inflow
+        ONLY:  bc_lr, bc_ns, child_domain, nesting_offline, rans_mode,         &
+               turbulent_inflow
 
     USE pmc_interface,                                                         &
@@ -430,6 +433,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  child_domain, coupling_char, dz, e_init, nesting_offline,       &
-               rans_mode
+        ONLY:  child_domain, coupling_char, e_init, nesting_offline, rans_mode
 
     USE grid_variables,                                                        &
Index: palm/trunk/SOURCE/temperton_fft_mod.f90
===================================================================
--- palm/trunk/SOURCE/temperton_fft_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/temperton_fft_mod.f90	(revision 3241)
@@ -9,4 +9,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3049 2018-05-29 13:52:36Z Giersch
 ! Error messages revised
 ! 
@@ -59,10 +62,6 @@
     PUBLIC set99, fft991cy
 
-
-    INTEGER(iwp)            ::  nfax(10)    !< array used by *fft991*.
     INTEGER(iwp), PARAMETER ::  nfft =  32  !< maximum length of calls to *fft
     INTEGER(iwp), PARAMETER ::  nout =   6  !< standard output stream
-
-    REAL(wp), ALLOCATABLE ::  trig(:)    !< array used by *fft991*.
 
 CONTAINS
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 3240)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3198 2018-08-15 09:23:10Z sward
 ! Added multi_agent_system_end; defined start time for MAS relative to
 ! time_since_reference_point
@@ -421,5 +424,5 @@
 
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nzb, nzt
 
     USE interaction_droplets_ptq_mod,                                          &
@@ -473,6 +476,5 @@
 
     USE statistics,                                                            &
-        ONLY:  flow_statistics_called, hom, pr_palm, sums_ls_l, u_max,         &
-               u_max_ijk, v_max, v_max_ijk, w_max, w_max_ijk
+        ONLY:  flow_statistics_called, hom, pr_palm, sums_ls_l
 
     USE surface_layer_fluxes_mod,                                              &
@@ -515,12 +517,12 @@
 
     CHARACTER (LEN=9) ::  time_to_string          !< 
-    INTEGER(iwp)      ::  it
-    INTEGER(iwp)      ::  lsp
-    INTEGER(iwp)      ::  n
-
+
+    INTEGER(iwp)      ::  n  !< loop counter for chemistry species
 
     REAL(wp) ::  dt_3d_old  !< temporary storage of timestep to be used for
                             !< steering of run control output interval
-    REAL(wp) ::  tsrp_org   !< original value of time_since_reference_point
+    REAL(wp) ::  time_since_reference_point_save  !< original value of
+                                                  !< time_since_reference_point
+
 !
 !-- At beginning determine the first time step
@@ -1081,10 +1083,12 @@
 
 !
-!--             Adjust the current_ time to the time step of the radiation model.
+!--             Adjust the current time to the time step of the radiation model.
 !--             Needed since radiation is pre-calculated and stored only on apparent 
 !--             solar positions
-                it = FLOOR(time_since_reference_point/dt_radiation)
-                tsrp_org = time_since_reference_point
-                time_since_reference_point = REAL(it,wp) * dt_radiation
+                time_since_reference_point_save = time_since_reference_point
+                time_since_reference_point =                                   &
+                                    REAL( FLOOR( time_since_reference_point /  &
+                                                 dt_radiation), wp )           &
+                                             * dt_radiation
 
                 CALL radiation_control
@@ -1101,5 +1105,5 @@
 !
 !--             Return the current time to its original value
-                time_since_reference_point = tsrp_org
+                time_since_reference_point = time_since_reference_point_save
 
              ENDIF
Index: palm/trunk/SOURCE/time_integration_spinup.f90
===================================================================
--- palm/trunk/SOURCE/time_integration_spinup.f90	(revision 3240)
+++ palm/trunk/SOURCE/time_integration_spinup.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2983 2018-04-18 10:43:40Z suehring
 ! Revise limitation of wall-adjacent velocity.
 ! 
@@ -93,20 +96,14 @@
     USE control_parameters,                                                    &
         ONLY:  averaging_interval_pr, calc_soil_moisture_during_spinup,        &
-               constant_diffusion, constant_flux_layer,                        &
-               coupling_start_time, current_timestep_number,                   &
-               data_output_during_spinup, disturbance_created, dopr_n, do_sum, &
+               constant_diffusion, constant_flux_layer, coupling_start_time,   &
+               data_output_during_spinup, dopr_n, do_sum,                      &
                dt_averaging_input_pr, dt_dopr, dt_dots, dt_do2d_xy, dt_do3d,   &
-               dt_run_control, dt_spinup, dt_3d, humidity,                     &
-               intermediate_timestep_count,                                    &
+               dt_spinup, dt_3d, humidity, intermediate_timestep_count,        &
                intermediate_timestep_count_max, land_surface,                  &
-               simulated_time, simulated_time_chr,                             &
-               skip_time_dopr, skip_time_do2d_xy, skip_time_do3d, spinup,      &
-               spinup_pt_amplitude, spinup_pt_mean, spinup_time,               &
-               timestep_count, timestep_scheme, time_dopr, time_dopr_av,       &
-               time_dots, time_do2d_xy, time_do3d, time_run_control,           &
-               time_since_reference_point, ug_surface, vg_surface, urban_surface
-
-    USE constants,                                                             &
-        ONLY:  pi
+               simulated_time, simulated_time_chr, skip_time_dopr,             &
+               skip_time_do2d_xy, skip_time_do3d, spinup_pt_amplitude,         &
+               spinup_pt_mean, spinup_time, timestep_count, time_dopr,         &
+               time_dopr_av, time_dots, time_do2d_xy, time_do3d,               &
+               time_run_control, time_since_reference_point, urban_surface
 
     USE cpulog,                                                                &
@@ -131,7 +128,6 @@
 
     USE radiation_model_mod,                                                   &
-        ONLY:  force_radiation_call, radiation,                                &
-               radiation_control, rad_sw_in, time_radiation,                   &
-               radiation_interaction, radiation_interactions
+        ONLY:  force_radiation_call, radiation, radiation_control,             &
+               radiation_interaction, radiation_interactions, time_radiation
 
     USE statistics,                                                            &
@@ -142,5 +138,5 @@
 
     USE surface_mod,                                                           &
-        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
+        ONLY :  surf_lsm_h, surf_lsm_v, surf_usm_h,    &
                 surf_usm_v
 
Index: palm/trunk/SOURCE/timestep.f90
===================================================================
--- palm/trunk/SOURCE/timestep.f90	(revision 3240)
+++ palm/trunk/SOURCE/timestep.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3120 2018-07-11 18:30:57Z gronemeier
 ! Put ABS( km ) in computation of time step according to the diffusion criterion
 ! 
@@ -188,12 +191,5 @@
     REAL(wp) ::  kh_max            !< maximum of Kh in entire domain
     REAL(wp) ::  u_gtrans_l        !< 
-    REAL(wp) ::  u_max_l           !< 
-    REAL(wp) ::  u_min_l           !< 
-    REAL(wp) ::  value             !< 
     REAL(wp) ::  v_gtrans_l        !< 
-    REAL(wp) ::  v_max_l           !< 
-    REAL(wp) ::  v_min_l           !< 
-    REAL(wp) ::  w_max_l           !< 
-    REAL(wp) ::  w_min_l           !< 
  
     REAL(wp), DIMENSION(2)         ::  uv_gtrans   !< 
@@ -313,5 +309,5 @@
        ENDDO
 
-       !$OMP PARALLEL private(i,j,k,value) reduction(MIN: dt_diff_l)
+       !$OMP PARALLEL private(i,j,k) reduction(MIN: dt_diff_l)
        !$OMP DO
        DO  i = nxl, nxr
Index: palm/trunk/SOURCE/transpose.f90
===================================================================
--- palm/trunk/SOURCE/transpose.f90	(revision 3240)
+++ palm/trunk/SOURCE/transpose.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -100,5 +103,5 @@
 
      USE transpose_indices,                                                    &
-         ONLY:  nxl_z, nxr_z, nyn_x, nyn_z, nys_x, nys_z, nzb_x, nzt_x
+         ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
      IMPLICIT NONE
@@ -269,5 +272,5 @@
 
     USE indices,                                                               &
-        ONLY:  nnx, nx, nxl, nxr, ny, nyn, nys, nz
+        ONLY:  nnx, nx, nxl, nxr, nyn, nys, nz
 
     USE kinds
@@ -486,5 +489,5 @@
 
     USE cpulog,                                                                &
-        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+        ONLY:  cpu_log, log_point_s
 
     USE indices,                                                               &
@@ -855,5 +858,5 @@
 
 !------------------------------------------------------------------------------!
-! Description:
+! Description:cpu_log_nowait
 ! ------------
 !> Transposition of input array (f_in) from z to y. For the input array, all
@@ -954,5 +957,5 @@
 
     USE cpulog,                                                                &
-        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+        ONLY:  cpu_log, log_point_s
 
     USE indices,                                                               &
@@ -964,5 +967,5 @@
 
     USE transpose_indices,                                                     &
-        ONLY:  nxl_y, nxl_yd, nxr_y, nxr_yd, nzb_y, nzb_yd, nzt_y, nzt_yd
+        ONLY:  nxl_yd, nxr_yd, nzb_yd, nzt_yd
 
     IMPLICIT NONE
Index: palm/trunk/SOURCE/tridia_solver_mod.f90
===================================================================
--- palm/trunk/SOURCE/tridia_solver_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/tridia_solver_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -489,6 +492,4 @@
        INTEGER(iwp) ::  nx                 !< 
        INTEGER(iwp) ::  ny                 !< 
-       INTEGER(iwp) ::  omp_get_thread_num !< 
-       INTEGER(iwp) ::  tn                 !< 
 
        REAL(wp)     ::  ddx2 !< 
Index: palm/trunk/SOURCE/turbulence_closure_mod.f90
===================================================================
--- palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed, shortest_distance has wp now
+! 
+! 3183 2018-07-27 14:25:55Z suehring
 ! Rename variables and remove unused variable from USE statement
 ! 
@@ -200,11 +203,9 @@
     REAL(wp) ::  c_1                !< model constant for RANS mode
     REAL(wp) ::  c_2                !< model constant for RANS mode
-    REAL(wp) ::  c_3                !< model constant for RANS mode
+!    REAL(wp) ::  c_3                !< model constant for RANS mode
     REAL(wp) ::  c_4                !< model constant for RANS mode
     REAL(wp) ::  l_max              !< maximum length scale for Blackadar mixing length
     REAL(wp) ::  dsig_e = 1.0_wp    !< factor to calculate Ke from Km (1/sigma_e)
     REAL(wp) ::  dsig_diss = 1.0_wp !< factor to calculate K_diss from Km (1/sigma_diss)
-    INTEGER(iwp) ::  surf_e         !< end index of surface elements at given i-j position
-    INTEGER(iwp) ::  surf_s         !< start index of surface elements at given i-j position
 
     REAL(wp), DIMENSION(0:4) :: rans_const_c = &       !< model constants for RANS mode (namelist param)
@@ -382,5 +383,5 @@
 
     USE control_parameters,                                                    &
-        ONLY:  message_string, neutral, turbulent_inflow, turbulent_outflow
+        ONLY:  message_string, turbulent_inflow, turbulent_outflow
 
     IMPLICIT NONE
@@ -459,9 +460,6 @@
 !> Check data output.
 !------------------------------------------------------------------------------!
- SUBROUTINE tcm_check_data_output( var, unit, i, ilen, k )
+ SUBROUTINE tcm_check_data_output( var, unit )
  
-    USE control_parameters,                                                    &
-        ONLY:  data_output, message_string
-
     IMPLICIT NONE
 
@@ -469,7 +467,4 @@
     CHARACTER (LEN=*) ::  var      !< name of output variable
 
-    INTEGER(iwp) ::  i      !< index of var in data_output
-    INTEGER(iwp) ::  ilen   !< length of var string
-    INTEGER(iwp) ::  k      !< flag if var contains one of '_xy', '_xz' or '_yz'
 
     SELECT CASE ( TRIM( var ) )
@@ -697,5 +692,5 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE tcm_data_output_2d( av, variable, found, grid, mode, local_pf,     &
-                                two_d, nzb_do, nzt_do )
+                                nzb_do, nzt_do )
  
     USE averaging,                                                             &
@@ -717,5 +712,4 @@
 
     LOGICAL ::  found   !< flag if output variable is found
-    LOGICAL ::  two_d   !< flag parameter that indicates 2D variables (horizontal cross sections)
     LOGICAL ::  resorted  !< flag if output is already resorted
 
@@ -1052,8 +1046,8 @@
 
     USE control_parameters,                                                    &
-        ONLY:  bc_dirichlet_l, complex_terrain, dissipation_1d, topography
+        ONLY:  bc_dirichlet_l, complex_terrain, topography
 
     USE model_1d_mod,                                                          &
-        ONLY:  diss1d, e1d, kh1d, km1d, l1d
+        ONLY:  e1d, kh1d, km1d
 
     USE surface_mod,                                                           &
@@ -1339,5 +1333,4 @@
     INTEGER(iwp) :: ii             !< index variable along x
     INTEGER(iwp) :: j              !< index variable along y
-    INTEGER(iwp) :: jj             !< index variable along y
     INTEGER(iwp) :: k              !< index variable along z
     INTEGER(iwp) :: k_max_topo = 0 !< index of maximum topography height
@@ -1804,5 +1797,5 @@
 !>   and debug options for the compiler. This should be fixed
 !------------------------------------------------------------------------------!
-    REAL FUNCTION shortest_distance( array, orientation, pos_i )
+    REAL(wp) FUNCTION shortest_distance( array, orientation, pos_i )
 
        IMPLICIT NONE
@@ -2089,6 +2082,5 @@
 
     USE surface_mod,                                                           &
-        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
-                surf_usm_v 
+        ONLY :  surf_def_h
 
     IMPLICIT NONE
@@ -2371,19 +2363,9 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  ddzu, diss_l_diss, diss_l_e, diss_s_diss, diss_s_e,             &
-               flux_l_diss, flux_l_e, flux_s_diss, flux_s_e,&
-               u_p,v_p,w_p
+        ONLY:  diss_l_diss, diss_l_e, diss_s_diss, diss_s_e, flux_l_diss,      &
+               flux_l_e, flux_s_diss, flux_s_e
 
     USE control_parameters,                                                    &
-        ONLY:  f, tsc
-
-    USE grid_variables,                                                        &
-        ONLY:  dx, dy
-
-    USE surface_mod,                                                           &
-        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
-                surf_usm_v 
-
-    use indices, only: nx, ny
+        ONLY:  tsc
 
     IMPLICIT NONE
@@ -2393,16 +2375,12 @@
     INTEGER(iwp) ::  j       !< loop index y direction
     INTEGER(iwp) ::  k       !< loop index z direction
-    INTEGER(iwp) ::  l       !< loop index
-    INTEGER(iwp) ::  m       !< loop index
-    INTEGER(iwp) ::  surf_e  !< end index of surface elements at given i-j position
-    INTEGER(iwp) ::  surf_s  !< start index of surface elements at given i-j position
     INTEGER(iwp) ::  tn      !< task number of openmp task
 
-    INTEGER(iwp) :: pis = 32 !< debug variable, print from i=pis                !> @todo remove later
-    INTEGER(iwp) :: pie = 32 !< debug variable, print until i=pie               !> @todo remove later
-    INTEGER(iwp) :: pjs = 26 !< debug variable, print from j=pjs                !> @todo remove later
-    INTEGER(iwp) :: pje = 26 !< debug variable, print until j=pje               !> @todo remove later
-    INTEGER(iwp) :: pkb = 1  !< debug variable, print from k=pkb                !> @todo remove later
-    INTEGER(iwp) :: pkt = 7  !< debug variable, print until k=pkt               !> @todo remove later
+!    INTEGER(iwp) :: pis = 32 !< debug variable, print from i=pis                !> @todo remove later
+!    INTEGER(iwp) :: pie = 32 !< debug variable, print until i=pie               !> @todo remove later
+!    INTEGER(iwp) :: pjs = 26 !< debug variable, print from j=pjs                !> @todo remove later
+!    INTEGER(iwp) :: pje = 26 !< debug variable, print until j=pje               !> @todo remove later
+!    INTEGER(iwp) :: pkb = 1  !< debug variable, print from k=pkb                !> @todo remove later
+!    INTEGER(iwp) :: pkt = 7  !< debug variable, print until k=pkt               !> @todo remove later
 
     REAL(wp), DIMENSION(nzb:nzt+1) :: dum_adv   !< debug variable               !> @todo remove later
@@ -2410,5 +2388,5 @@
     REAL(wp), DIMENSION(nzb:nzt+1) :: dum_dif   !< debug variable               !> @todo remove later
 
-5555 FORMAT(A,7(1X,E12.5))   !> @todo remove later
+!5555 FORMAT(A,7(1X,E12.5))   !> @todo remove later
 
 !
@@ -4812,5 +4790,5 @@
     INTEGER(iwp) ::  j                   !< loop index
     INTEGER(iwp) ::  k                   !< loop index
-    INTEGER(iwp) ::  omp_get_thread_num  !< opemmp function to get thread number
+!$  INTEGER(iwp) ::  omp_get_thread_num  !< opemmp function to get thread number
     INTEGER(iwp) ::  sr                  !< statistic region
     INTEGER(iwp) ::  tn                  !< thread number
@@ -4970,10 +4948,10 @@
     REAL(wp)     ::  vc(-1:1,-1:1)  !< v on grid center
     REAL(wp)     ::  wc(-1:1,-1:1)  !< w on grid center
-    REAL(wp)     ::  u2(-1:1,-1:1)  !< u2 on grid center
-    REAL(wp)     ::  v2(-1:1,-1:1)  !< v2 on grid center
-    REAL(wp)     ::  w2(-1:1,-1:1)  !< w2 on grid center
-    REAL(wp)     ::  uv(-1:1,-1:1)  !< u*v on grid center
-    REAL(wp)     ::  uw(-1:1,-1:1)  !< u*w on grid center
-    REAL(wp)     ::  vw(-1:1,-1:1)  !< v*w on grid center
+!    REAL(wp)     ::  u2(-1:1,-1:1)  !< u2 on grid center
+!    REAL(wp)     ::  v2(-1:1,-1:1)  !< v2 on grid center
+!    REAL(wp)     ::  w2(-1:1,-1:1)  !< w2 on grid center
+!    REAL(wp)     ::  uv(-1:1,-1:1)  !< u*v on grid center
+!    REAL(wp)     ::  uw(-1:1,-1:1)  !< u*w on grid center
+!    REAL(wp)     ::  vw(-1:1,-1:1)  !< v*w on grid center
 
     REAL(wp)     ::  ut(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  !< test filtered u
@@ -5229,7 +5207,10 @@
     IMPLICIT NONE
 
+
+#if defined( __nopointer )
     INTEGER(iwp) ::  i      !< loop index x direction
     INTEGER(iwp) ::  j      !< loop index y direction
     INTEGER(iwp) ::  k      !< loop index z direction
+#endif
     INTEGER, INTENT(IN) ::  mod_count  !< flag defining where pointers point to
 
Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3241)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3223 2018-08-30 13:48:17Z suehring
 ! Bugfix for commit 3222
 ! 
@@ -406,5 +409,4 @@
     INTEGER(iwp) ::  pedestrian_category = 2         !< default category for wall surface in pedestrian zone
     INTEGER(iwp) ::  roof_category = 2               !< default category for root surface
-    REAL(wp)     ::  roughness_concrete = 0.001_wp   !< roughness length of average concrete surface
 !
 !-- Indices of input attributes for (above) ground floor level 
@@ -587,5 +589,4 @@
 !-- arrays for time averages
 !-- Attention: the variable rad_net_av is also used in the 3d field variable in radiation_model_mod.f90. It may be better to rename it 
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  rad_net_av       !< average of rad_net_l
     REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfinsw_av      !< average of sw radiation falling to local surface including radiation from reflections
     REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfinlw_av      !< average of lw radiation falling to local surface including radiation from reflections
@@ -599,12 +600,4 @@
     REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfins_av       !< average of array of residua of sw radiation absorbed in surface after last reflection
     REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfinl_av       !< average of array of residua of lw radiation absorbed in surface after last reflection
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  surfhf_av        !< average of total radiation flux incoming to minus outgoing from local surface  
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  wghf_eb_av       !< average of wghf_eb
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  wshf_eb_av       !< average of wshf_eb
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE          ::  t_wall_av        !< Average of t_wall
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  wghf_eb_green_av !< average of wghf_eb_green
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE          ::  t_green_av       !< Average of t_green
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  wghf_eb_window_av !< average of wghf_eb_window
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE          ::  t_window_av      !< Average of t_window    
     
 
@@ -704,13 +697,4 @@
     
 #endif
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    :: t_surf_av          !< average of wall surface temperature (K)
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    :: t_surf_window_av   !< average of window surface temperature (K)
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    :: t_surf_green_av    !< average of green wall surface temperature (K)
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    :: t_surf_10cm_av    !< average of whole wall surface temperature (K)
-
-!-- Temporal tendencies for time stepping            
-    REAL(wp), DIMENSION(:), ALLOCATABLE            :: tt_surface_m       !< surface temperature tendency of wall (K)
-    REAL(wp), DIMENSION(:), ALLOCATABLE            :: tt_surface_window_m !< surface temperature tendency of window (K)
-    REAL(wp), DIMENSION(:), ALLOCATABLE            :: tt_surface_green_m !< surface temperature tendency of green wall (K)
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -721,43 +705,33 @@
 #if defined( __nopointer )
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_wall_h             !< Wall temperature (K)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_wall_h_av          !< Average of t_wall
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_wall_h_p           !< Prog. wall temperature (K)
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_window_h           !< Window temperature (K)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_window_h_av        !< Average of t_window
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_window_h_p         !< Prog. window temperature (K)
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_green_h            !< Green temperature (K)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_green_h_av         !< Average of t_green
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_green_h_p          !< Prog. green temperature (K)
 
     TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_wall_v             !< Wall temperature (K)
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_wall_v_av          !< Average of t_wall
     TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_wall_v_p           !< Prog. wall temperature (K)
     TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_window_v           !< Window temperature (K)
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_window_v_av        !< Average of t_window
     TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_window_v_p         !< Prog. window temperature (K)
     TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_green_v            !< Green temperature (K)
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_green_v_av         !< Average of t_green
     TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_green_v_p          !< Prog. green temperature (K)
 #else
     REAL(wp), DIMENSION(:,:), POINTER                :: t_wall_h, t_wall_h_p
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_wall_h_av, t_wall_h_1, t_wall_h_2
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_wall_h_1, t_wall_h_2
     REAL(wp), DIMENSION(:,:), POINTER                :: t_window_h, t_window_h_p
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_window_h_av, t_window_h_1, t_window_h_2
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_window_h_1, t_window_h_2
     REAL(wp), DIMENSION(:,:), POINTER                :: t_green_h, t_green_h_p
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_green_h_av, t_green_h_1, t_green_h_2
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    :: t_green_h_1, t_green_h_2
 
     TYPE(t_wall_vertical), DIMENSION(:), POINTER   :: t_wall_v, t_wall_v_p
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_wall_v_av, t_wall_v_1, t_wall_v_2
+    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_wall_v_1, t_wall_v_2
     TYPE(t_wall_vertical), DIMENSION(:), POINTER   :: t_window_v, t_window_v_p
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_window_v_av, t_window_v_1, t_window_v_2
+    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_window_v_1, t_window_v_2
     TYPE(t_wall_vertical), DIMENSION(:), POINTER   :: t_green_v, t_green_v_p
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_green_v_av, t_green_v_1, t_green_v_2
+    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  :: t_green_v_1, t_green_v_2
 #endif
 
-!-- Wall temporal tendencies for time stepping
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE          :: tt_wall_m          !< t_wall prognostic array 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE          :: tt_window_m        !< t_window prognostic array 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE          :: tt_green_m         !< t_green prognostic array 
-
+!
 !-- Surface and material parameters classes (surface_type)
 !-- albedo, emissivity, lambda_surf, roughness, thickness, volumetric heat capacity, thermal conductivity
@@ -1270,11 +1244,11 @@
         IMPLICIT NONE
 
-        CHARACTER (len=*), INTENT(IN) ::  mode
-        CHARACTER (len=*), INTENT(IN) :: variable
+        CHARACTER(LEN=*), INTENT(IN) ::  mode
+        CHARACTER(LEN=*), INTENT(IN) :: variable
   
         INTEGER(iwp)                                       :: i, j, k, l, m, ids, idsint, iwl, istat
-        CHARACTER (len=varnamelength)                      :: var, surfid
+        CHARACTER(LEN=varnamelength)                       :: var
         INTEGER(iwp), PARAMETER                            :: nd = 5
-        CHARACTER(len=6), DIMENSION(0:nd-1), PARAMETER     :: dirname = (/ '_roof ', '_south', '_north', '_west ', '_east ' /)
+        CHARACTER(LEN=6), DIMENSION(0:nd-1), PARAMETER     :: dirname = (/ '_roof ', '_south', '_north', '_west ', '_east ' /)
         INTEGER(iwp), DIMENSION(0:nd-1), PARAMETER         :: dirint = (/ iup_u, isouth_u, inorth_u, iwest_u, ieast_u /)
 
@@ -2440,5 +2414,4 @@
         INTEGER(iwp)                                           :: ids,idsint,idsidx,isurf,isvf,isurfs,isurflt
         INTEGER(iwp)                                           :: is,js,ks,i,j,k,iwl,istat, l, m
-        INTEGER(iwp)                                           :: k_topo    !< topography top index
 
         dirstart = (/ startland, startwall, startwall, startwall, startwall /)
@@ -3621,5 +3594,5 @@
         INTEGER(iwp) ::  st                  !< dummy  
 
-        REAL(wp)     ::  c, d, tin, twin
+        REAL(wp)     ::  c, tin, twin
         REAL(wp)     ::  ground_floor_level_l         !< local height of ground floor level
         REAL(wp)     ::  z_agl                        !< height above ground
@@ -5348,5 +5321,4 @@
                            naheatlayers,                                       &
                            pedestrian_category,                                &
-                           roughness_concrete,                                 &
                            read_wall_temp_3d,                                  &
                            roof_category,                                      &
@@ -5366,5 +5338,4 @@
                            naheatlayers,                                       &
                            pedestrian_category,                                &
-                           roughness_concrete,                                 &
                            read_wall_temp_3d,                                  &
                            roof_category,                                      &
@@ -5574,6 +5545,4 @@
            
        IMPLICIT NONE
-
-       CHARACTER (LEN=1)  ::  dum              !< dummy to create correct string for reading input variable
 
        INTEGER(iwp)       ::  l                !< index variable for surface type
@@ -6758,5 +6727,5 @@
         INTEGER(iwp), DIMENSION(0:17, nysg:nyng, nxlg:nxrg)   :: usm_par
         REAL(wp), DIMENSION(1:14, nysg:nyng, nxlg:nxrg)       :: usm_val
-        INTEGER(iwp)                                          :: k, l, d, iw, jw, kw, it, ip, ii, ij, m
+        INTEGER(iwp)                                          :: k, l, iw, jw, kw, it, ip, ii, ij, m
         INTEGER(iwp)                                          :: i, j
         INTEGER(iwp)                                          :: nz, roof, dirwe, dirsn
@@ -6769,7 +6738,4 @@
         REAL(wp)                                              :: wealbedo2, wethick2, snalbedo2, snthick2
         REAL(wp)                                              :: wealbedo3, wethick3, snalbedo3, snthick3
-        
-        LOGICAL                                               ::  surfpar
-        LOGICAL                                               ::  urbsurf
 
 !
@@ -7332,5 +7298,5 @@
         IMPLICIT NONE
 
-        INTEGER(iwp)                          :: i, j, k, l, d, m   !< running indices
+        INTEGER(iwp)                          :: i, j, k, l, m      !< running indices
         
         REAL(wp)                              :: stend              !< surface tendency
@@ -7839,10 +7805,9 @@
 !> called out from subroutine swap_timelevel
 !------------------------------------------------------------------------------!
-    SUBROUTINE usm_swap_timelevel ( mod_count )
+    SUBROUTINE usm_swap_timelevel( mod_count )
 
        IMPLICIT NONE
 
-       INTEGER(iwp), INTENT(IN) :: mod_count
-       INTEGER(iwp)             :: i
+       INTEGER(iwp), INTENT(IN) ::  mod_count
       
 #if defined( __nopointer )
Index: palm/trunk/SOURCE/uv_exposure_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/uv_exposure_model_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/uv_exposure_model_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3014 2018-05-09 08:42:38Z maronga
 ! Bugfix: domain bounds of local_pf corrected
 ! 
@@ -313,6 +316,6 @@
 !> Subroutine defining 2D output variables
 !-----------------------------------------------------------------------------!
- SUBROUTINE uvem_data_output_2d( av, variable, found, grid, mode, local_pf,   &
-                                 two_d, nzb_do, nzt_do )
+ SUBROUTINE uvem_data_output_2d( av, variable, found, grid, local_pf, two_d,   &
+                                 nzb_do, nzt_do )
  
     USE indices
@@ -324,5 +327,4 @@
 
     CHARACTER (LEN=*) ::  grid     !< 
-    CHARACTER (LEN=*) ::  mode     !< 
     CHARACTER (LEN=*) ::  variable !< 
 
@@ -330,6 +332,4 @@
     INTEGER(iwp) ::  i       !< running index 
     INTEGER(iwp) ::  j       !< running index
-    INTEGER(iwp) ::  k       !< running index
-    INTEGER(iwp) ::  m       !< running index
     INTEGER(iwp) ::  nzb_do  !< 
     INTEGER(iwp) ::  nzt_do  !< 
@@ -491,6 +491,4 @@
     INTEGER(iwp) ::  i       !< 
     INTEGER(iwp) ::  j       !< 
-    INTEGER(iwp) ::  k       !< 
-    INTEGER(iwp) ::  m       !< running index
 
     IF ( mode == 'allocate' )  THEN
Index: palm/trunk/SOURCE/vertical_nesting_mod.f90
===================================================================
--- palm/trunk/SOURCE/vertical_nesting_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/vertical_nesting_mod.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3232 2018-09-07 12:21:44Z raasch
 ! references to mrun replaced by palmrun, and updated
 ! 
@@ -137,5 +140,4 @@
 
     INTEGER(iwp)                              :: n_cell_c         !> total no. of CG grid points in a PE
-    INTEGER(iwp)                              :: n_cell_f         !> total no. of FG grid points in a PE
     INTEGER(iwp),DIMENSION(2)                 :: pdims_partner    !> processor topology of partner PE
     INTEGER(iwp)                              :: target_idex      !> temporary variable
@@ -185,5 +187,5 @@
             f_rnk_lst, c_rnk_lst, cfratio, pdims_partner,                     &
             nxc, nxf, nyc, nyf, nzc, nzf,                                     &
-            ngp_c, ngp_f, target_idex, n_cell_c, n_cell_f,                    &
+            ngp_c, ngp_f, target_idex, n_cell_c,                              &
             offset, map_coord, TYPE_VNEST_BC, TYPE_VNEST_ANTER                
 
@@ -253,6 +255,4 @@
         USE interfaces
         USE pegrid
-        USE surface_mod,                                                       &
-            ONLY :  surf_def_h, surf_def_v
         USE turbulence_closure_mod,                                            &
             ONLY :  tcm_diffusivities
@@ -264,8 +264,4 @@
         INTEGER(iwp)                          :: i
         INTEGER(iwp)                          :: j
-        INTEGER(iwp)                          :: k
-        INTEGER(iwp)                          :: im
-        INTEGER(iwp)                          :: jn
-        INTEGER(iwp)                          :: ko
         INTEGER(iwp)                          :: iif
         INTEGER(iwp)                          :: jjf
@@ -480,20 +476,20 @@
                 comm_inter,status, ierr )
             interpol3d => u
-            call interpolate_to_fine_u ( 101 )
+            call interpolate_to_fine_u
    
             CALL MPI_RECV( work3d,n_cell_c, MPI_REAL, target_idex, 102, &
                 comm_inter,status, ierr )
             interpol3d => v
-            call interpolate_to_fine_v ( 102 )
+            call interpolate_to_fine_v
    
             CALL MPI_RECV( work3d,n_cell_c, MPI_REAL, target_idex, 103, &
                 comm_inter,status, ierr )
             interpol3d => w
-            call interpolate_to_fine_w ( 103 )
+            call interpolate_to_fine_w
    
             CALL MPI_RECV( work3d,n_cell_c, MPI_REAL, target_idex, 105, &
                 comm_inter,status, ierr )
             interpol3d => pt
-            call interpolate_to_fine_s ( 105 )
+            call interpolate_to_fine_s
    
             IF ( humidity )  THEN
@@ -501,5 +497,5 @@
                 comm_inter,status, ierr )
             interpol3d => q
-            call interpolate_to_fine_s ( 116 )
+            call interpolate_to_fine_s
             ENDIF
 
@@ -507,14 +503,14 @@
                 comm_inter,status, ierr )
             interpol3d => e
-            call interpolate_to_fine_s ( 104 )
+            call interpolate_to_fine_s
    
 !-- kh,km no target attribute, use of pointer not possible
             CALL MPI_RECV( work3d,n_cell_c, MPI_REAL, target_idex, 106, &
                 comm_inter,status, ierr )
-            call interpolate_to_fine_kh ( 106 )
+            call interpolate_to_fine_kh
    
             CALL MPI_RECV( work3d,n_cell_c, MPI_REAL, target_idex, 107, &
                 comm_inter,status, ierr )
-            call interpolate_to_fine_km ( 107 )
+            call interpolate_to_fine_km
    
             DEALLOCATE(   work3d       )
@@ -644,5 +640,5 @@
     CONTAINS
    
-       SUBROUTINE interpolate_to_fine_w( tag )
+       SUBROUTINE interpolate_to_fine_w
       
            USE arrays_3d
@@ -655,5 +651,4 @@
            IMPLICIT NONE
       
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -776,5 +771,5 @@
        END SUBROUTINE interpolate_to_fine_w
       
-       SUBROUTINE interpolate_to_fine_u( tag )
+       SUBROUTINE interpolate_to_fine_u
       
       
@@ -788,5 +783,4 @@
            IMPLICIT NONE
       
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -922,5 +916,5 @@
       
       
-       SUBROUTINE interpolate_to_fine_v( tag )
+       SUBROUTINE interpolate_to_fine_v
       
       
@@ -934,5 +928,4 @@
            IMPLICIT NONE
 
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -1066,5 +1059,5 @@
       
       
-       SUBROUTINE interpolate_to_fine_s( tag )
+       SUBROUTINE interpolate_to_fine_s
       
       
@@ -1078,5 +1071,4 @@
            IMPLICIT NONE
 
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -1216,5 +1208,5 @@
       
       
-       SUBROUTINE interpolate_to_fine_kh( tag )
+       SUBROUTINE interpolate_to_fine_kh
       
       
@@ -1228,5 +1220,4 @@
            IMPLICIT NONE
 
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -1248,22 +1239,6 @@
            REAL(wp)                           :: edot
            REAL(wp)                           :: eplus
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: uprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: vprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: wprs
            REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ptprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: eprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: kmprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: khprs
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: tspr 
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: uprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: vprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: wprf
            REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ptprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: eprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: kmprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: khprf
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: uswspr
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: vswspr
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: uspr
       
       
@@ -1384,5 +1359,5 @@
        END SUBROUTINE interpolate_to_fine_kh
       
-       SUBROUTINE interpolate_to_fine_km( tag )
+       SUBROUTINE interpolate_to_fine_km
       
       
@@ -1396,5 +1371,4 @@
            IMPLICIT NONE
 
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -1416,21 +1390,6 @@
            REAL(wp)                           :: edot
            REAL(wp)                           :: eplus
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: uprs 
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: vprs 
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: wprs 
            REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ptprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: eprs 
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: kmprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: khprs
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: vprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: wprf
            REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ptprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: eprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: kmprf
-           REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: khprf
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: uswspr
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: vswspr
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: tspr 
-           REAL(wp), DIMENSION(:,:), ALLOCATABLE   :: uspr
       
       
@@ -1554,5 +1513,5 @@
       
       
-       SUBROUTINE interpolate_to_fine_flux( tag )
+       SUBROUTINE interpolate_to_fine_flux
       
       
@@ -1566,19 +1525,12 @@
            IMPLICIT NONE
 
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
-           INTEGER(iwp)                       :: k
            INTEGER(iwp)                       :: iif
            INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
-           INTEGER(iwp)                       :: nzbottom
-           INTEGER(iwp)                       :: nztop
            INTEGER(iwp)                       :: bottomx
            INTEGER(iwp)                       :: bottomy
-           INTEGER(iwp)                       :: bottomz
            INTEGER(iwp)                       :: topx
            INTEGER(iwp)                       :: topy
-           INTEGER(iwp)                       :: topz
            REAL(wp)                           :: eps
            REAL(wp)                           :: alpha
@@ -1715,6 +1667,4 @@
         INTEGER(iwp)                          :: iif
         INTEGER(iwp)                          :: jjf
-        REAL(wp)                              :: c_max
-        REAL(wp)                              :: denom
     
     
@@ -1868,8 +1818,6 @@
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
-           INTEGER(iwp)                       :: k
            INTEGER(iwp)                       :: iif
            INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
            INTEGER(iwp)                       :: bottomx
            INTEGER(iwp)                       :: bottomy
@@ -1973,5 +1921,4 @@
            INTEGER(iwp)                       :: iif
            INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
            INTEGER(iwp)                       :: bottomx
            INTEGER(iwp)                       :: bottomy
@@ -2073,5 +2020,4 @@
            INTEGER(iwp)                       :: iif
            INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
            INTEGER(iwp)                       :: bottomx
            INTEGER(iwp)                       :: bottomy
@@ -2182,5 +2128,4 @@
            INTEGER(iwp)                       :: iif
            INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
            INTEGER(iwp)                       :: bottomx
            INTEGER(iwp)                       :: bottomy
@@ -2332,6 +2277,4 @@
         INTEGER(iwp)                          :: iif
         INTEGER(iwp)                          :: jjf
-        REAL(wp)                              :: c_max
-        REAL(wp)                              :: denom
     
     
@@ -2474,5 +2417,4 @@
            INTEGER(iwp)                       :: iif
            INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
            INTEGER(iwp)                       :: bottomx
            INTEGER(iwp)                       :: bottomy
@@ -2614,8 +2556,6 @@
            INTEGER(iwp)                       :: bottomx
            INTEGER(iwp)                       :: bottomy
-           INTEGER(iwp)                       :: bottomz
            INTEGER(iwp)                       :: topx
            INTEGER(iwp)                       :: topy
-           INTEGER(iwp)                       :: topz
            REAL(wp)                           :: eps
            REAL(wp)                           :: alpha
@@ -2766,7 +2706,4 @@
         INTEGER(iwp)                          ::  j
         INTEGER(iwp)                          ::  k
-        INTEGER(iwp)                          ::  im
-        INTEGER(iwp)                          ::  jn
-        INTEGER(iwp)                          ::  ko
         INTEGER(iwp)                          ::  kb !< variable to set respective boundary value, depends on facing. 
         INTEGER(iwp)                          ::  l  !< running index boundary type, for up- and downward-facing walls
@@ -2969,5 +2906,5 @@
             anterpol3d => u
       
-            CALL anterpolate_to_crse_u ( 101 )
+            CALL anterpolate_to_crse_u
             CALL MPI_SEND( work3d, 1, TYPE_VNEST_ANTER, target_idex,  &
                 101, comm_inter, ierr)
@@ -2975,5 +2912,5 @@
             anterpol3d => v
    
-            CALL anterpolate_to_crse_v ( 102 )
+            CALL anterpolate_to_crse_v
             CALL MPI_SEND( work3d, 1, TYPE_VNEST_ANTER, target_idex,  &
                 102, comm_inter, ierr)
@@ -2981,5 +2918,5 @@
             anterpol3d => pt
    
-            CALL anterpolate_to_crse_s ( 105 )
+            CALL anterpolate_to_crse_s
             CALL MPI_SEND( work3d, 1, TYPE_VNEST_ANTER, target_idex,  &
                 105, comm_inter, ierr)
@@ -2990,5 +2927,5 @@
             anterpol3d => q
    
-            CALL anterpolate_to_crse_s ( 106 )
+            CALL anterpolate_to_crse_s
             CALL MPI_SEND( work3d, 1, TYPE_VNEST_ANTER, target_idex,  &
                 106, comm_inter, ierr)
@@ -3001,5 +2938,5 @@
                                  bdims_rem(1,1)  :bdims_rem(1,2)))
             anterpol3d => w
-            CALL anterpolate_to_crse_w ( 103 )
+            CALL anterpolate_to_crse_w
             CALL MPI_SEND( work3d, 1, TYPE_VNEST_ANTER, target_idex,  &
                 103, comm_inter, ierr)
@@ -3013,5 +2950,5 @@
 
     CONTAINS
-       SUBROUTINE anterpolate_to_crse_u( tag )
+       SUBROUTINE anterpolate_to_crse_u
       
       
@@ -3025,5 +2962,203 @@
            IMPLICIT NONE
 
-           INTEGER(iwp), intent(in)           :: tag
+           INTEGER(iwp)                       :: i
+           INTEGER(iwp)                       :: j
+           INTEGER(iwp)                       :: k
+           INTEGER(iwp)                       :: iif
+           INTEGER(iwp)                       :: jjf
+           INTEGER(iwp)                       :: kkf
+           INTEGER(iwp)                       :: bottomy
+           INTEGER(iwp)                       :: bottomz
+           INTEGER(iwp)                       :: topy
+           INTEGER(iwp)                       :: topz
+           REAL(wp)                           :: aweight
+      
+           !
+           !-- Anterpolation of the velocity components u
+           !-- only values in yz-planes that coincide in the fine and
+           !-- the coarse grid are considered
+      
+           DO k = bdims_rem(3,1)+1, bdims_rem(3,2)
+      
+               bottomz = (dzc/dzf) * (k-1) + 1
+               topz    = (dzc/dzf) * k
+      
+               DO j = bdims_rem(2,1),bdims_rem(2,2)
+       
+                   bottomy = (nyf+1) / (nyc+1) * j
+                   topy    = (nyf+1) / (nyc+1) * (j+1) - 1
+      
+                   DO i = bdims_rem(1,1),bdims_rem(1,2)
+      
+                       iif = (nxf+1) / (nxc+1) * i
+      
+                       aweight   = 0.0
+      
+                       DO kkf = bottomz, topz
+                           DO jjf = bottomy, topy
+      
+                               aweight   = aweight + anterpol3d(kkf,jjf,iif) *        &
+                                   (dzf/dzc) * (dyf/dyc)
+      
+                           END DO
+                       END DO
+      
+                       work3d(k,j,i)   = aweight
+      
+                   END DO
+      
+               END DO
+      
+           END DO
+      
+      
+      
+       END SUBROUTINE anterpolate_to_crse_u
+      
+      
+       SUBROUTINE anterpolate_to_crse_v
+      
+      
+           USE arrays_3d
+           USE control_parameters
+           USE grid_variables
+           USE indices
+           USE pegrid
+           
+      
+           IMPLICIT NONE
+
+           INTEGER(iwp)                       :: i
+           INTEGER(iwp)                       :: j
+           INTEGER(iwp)                       :: k
+           INTEGER(iwp)                       :: iif
+           INTEGER(iwp)                       :: jjf
+           INTEGER(iwp)                       :: kkf
+           INTEGER(iwp)                       :: bottomx
+           INTEGER(iwp)                       :: bottomz
+           INTEGER(iwp)                       :: topx
+           INTEGER(iwp)                       :: topz
+           REAL(wp)                           :: aweight
+
+           !
+           !-- Anterpolation of the velocity components v
+           !-- only values in xz-planes that coincide in the fine and
+           !-- the coarse grid are considered
+      
+           DO k = bdims_rem(3,1)+1, bdims_rem(3,2)
+      
+               bottomz = (dzc/dzf) * (k-1) + 1
+               topz    = (dzc/dzf) * k
+      
+               DO j = bdims_rem(2,1), bdims_rem(2,2)
+      
+                   jjf = (nyf+1) / (nyc+1) * j
+      
+                   DO i = bdims_rem(1,1), bdims_rem(1,2)
+      
+                       bottomx = (nxf+1) / (nxc+1) * i
+                       topx    = (nxf+1) / (nxc+1) * (i+1) - 1
+      
+                       aweight   = 0.0
+      
+                       DO kkf = bottomz, topz
+                           DO iif = bottomx, topx
+      
+                               aweight   = aweight + anterpol3d(kkf,jjf,iif) *        &
+                                   (dzf/dzc) * (dxf/dxc)
+      
+      
+                           END DO
+                       END DO
+      
+                       work3d(k,j,i)   = aweight
+      
+                   END DO
+               END DO
+           END DO
+      
+      
+      
+       END SUBROUTINE anterpolate_to_crse_v
+      
+      
+       SUBROUTINE anterpolate_to_crse_w
+      
+      
+           USE arrays_3d
+           USE control_parameters
+           USE grid_variables
+           USE indices
+           USE pegrid
+           
+      
+           IMPLICIT NONE
+
+           INTEGER(iwp)                       :: i
+           INTEGER(iwp)                       :: j
+           INTEGER(iwp)                       :: k
+           INTEGER(iwp)                       :: iif
+           INTEGER(iwp)                       :: jjf
+           INTEGER(iwp)                       :: kkf
+           INTEGER(iwp)                       :: bottomx
+           INTEGER(iwp)                       :: bottomy
+           INTEGER(iwp)                       :: topx
+           INTEGER(iwp)                       :: topy
+           REAL(wp)                           :: aweight
+
+           !
+           !-- Anterpolation of the velocity components w
+           !-- only values in xy-planes that coincide in the fine and
+           !-- the coarse grid are considered
+      
+           DO k = bdims_rem(3,1), bdims_rem(3,2)-1
+      
+               kkf = cfratio(3) * k
+      
+               DO j = bdims_rem(2,1), bdims_rem(2,2)
+      
+                   bottomy = (nyf+1) / (nyc+1) * j
+                   topy    = (nyf+1) / (nyc+1) * (j+1) - 1
+      
+                   DO i = bdims_rem(1,1), bdims_rem(1,2)
+      
+                       bottomx = (nxf+1) / (nxc+1) * i
+                       topx    = (nxf+1) / (nxc+1) * (i+1) - 1
+      
+                       aweight   = 0.0
+      
+                       DO jjf = bottomy, topy
+                           DO iif = bottomx, topx
+      
+                               aweight   = aweight + anterpol3d (kkf,jjf,iif) *        &
+                                   (dxf/dxc) * (dyf/dyc)
+      
+                           END DO
+                       END DO
+      
+                       work3d(k,j,i)   = aweight
+      
+                   END DO
+      
+               END DO
+      
+           END DO
+      
+      
+       END SUBROUTINE anterpolate_to_crse_w
+      
+      
+       SUBROUTINE anterpolate_to_crse_s
+      
+      
+           USE arrays_3d
+           USE control_parameters
+           USE grid_variables
+           USE indices
+           USE pegrid
+           
+      
+           IMPLICIT NONE
+
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -3041,212 +3176,4 @@
       
            !
-           !-- Anterpolation of the velocity components u
-           !-- only values in yz-planes that coincide in the fine and
-           !-- the coarse grid are considered
-      
-           DO k = bdims_rem(3,1)+1, bdims_rem(3,2)
-      
-               bottomz = (dzc/dzf) * (k-1) + 1
-               topz    = (dzc/dzf) * k
-      
-               DO j = bdims_rem(2,1),bdims_rem(2,2)
-       
-                   bottomy = (nyf+1) / (nyc+1) * j
-                   topy    = (nyf+1) / (nyc+1) * (j+1) - 1
-      
-                   DO i = bdims_rem(1,1),bdims_rem(1,2)
-      
-                       iif = (nxf+1) / (nxc+1) * i
-      
-                       aweight   = 0.0
-      
-                       DO kkf = bottomz, topz
-                           DO jjf = bottomy, topy
-      
-                               aweight   = aweight + anterpol3d(kkf,jjf,iif) *        &
-                                   (dzf/dzc) * (dyf/dyc)
-      
-                           END DO
-                       END DO
-      
-                       work3d(k,j,i)   = aweight
-      
-                   END DO
-      
-               END DO
-      
-           END DO
-      
-      
-      
-       END SUBROUTINE anterpolate_to_crse_u
-      
-      
-       SUBROUTINE anterpolate_to_crse_v( tag )
-      
-      
-           USE arrays_3d
-           USE control_parameters
-           USE grid_variables
-           USE indices
-           USE pegrid
-           
-      
-           IMPLICIT NONE
-
-           INTEGER(iwp), intent(in)           :: tag
-           INTEGER(iwp)                       :: i
-           INTEGER(iwp)                       :: j
-           INTEGER(iwp)                       :: k
-           INTEGER(iwp)                       :: iif
-           INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
-           INTEGER(iwp)                       :: bottomx
-           INTEGER(iwp)                       :: bottomy
-           INTEGER(iwp)                       :: bottomz
-           INTEGER(iwp)                       :: topx
-           INTEGER(iwp)                       :: topy
-           INTEGER(iwp)                       :: topz
-           REAL(wp)                           :: aweight
-
-           !
-           !-- Anterpolation of the velocity components v
-           !-- only values in xz-planes that coincide in the fine and
-           !-- the coarse grid are considered
-      
-           DO k = bdims_rem(3,1)+1, bdims_rem(3,2)
-      
-               bottomz = (dzc/dzf) * (k-1) + 1
-               topz    = (dzc/dzf) * k
-      
-               DO j = bdims_rem(2,1), bdims_rem(2,2)
-      
-                   jjf = (nyf+1) / (nyc+1) * j
-      
-                   DO i = bdims_rem(1,1), bdims_rem(1,2)
-      
-                       bottomx = (nxf+1) / (nxc+1) * i
-                       topx    = (nxf+1) / (nxc+1) * (i+1) - 1
-      
-                       aweight   = 0.0
-      
-                       DO kkf = bottomz, topz
-                           DO iif = bottomx, topx
-      
-                               aweight   = aweight + anterpol3d(kkf,jjf,iif) *        &
-                                   (dzf/dzc) * (dxf/dxc)
-      
-      
-                           END DO
-                       END DO
-      
-                       work3d(k,j,i)   = aweight
-      
-                   END DO
-               END DO
-           END DO
-      
-      
-      
-       END SUBROUTINE anterpolate_to_crse_v
-      
-      
-       SUBROUTINE anterpolate_to_crse_w( tag )
-      
-      
-           USE arrays_3d
-           USE control_parameters
-           USE grid_variables
-           USE indices
-           USE pegrid
-           
-      
-           IMPLICIT NONE
-
-           INTEGER(iwp), intent(in)           :: tag
-           INTEGER(iwp)                       :: i
-           INTEGER(iwp)                       :: j
-           INTEGER(iwp)                       :: k
-           INTEGER(iwp)                       :: iif
-           INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
-           INTEGER(iwp)                       :: bottomx
-           INTEGER(iwp)                       :: bottomy
-           INTEGER(iwp)                       :: bottomz
-           INTEGER(iwp)                       :: topx
-           INTEGER(iwp)                       :: topy
-           INTEGER(iwp)                       :: topz
-           REAL(wp)                           :: aweight
-
-           !
-           !-- Anterpolation of the velocity components w
-           !-- only values in xy-planes that coincide in the fine and
-           !-- the coarse grid are considered
-      
-           DO k = bdims_rem(3,1), bdims_rem(3,2)-1
-      
-               kkf = cfratio(3) * k
-      
-               DO j = bdims_rem(2,1), bdims_rem(2,2)
-      
-                   bottomy = (nyf+1) / (nyc+1) * j
-                   topy    = (nyf+1) / (nyc+1) * (j+1) - 1
-      
-                   DO i = bdims_rem(1,1), bdims_rem(1,2)
-      
-                       bottomx = (nxf+1) / (nxc+1) * i
-                       topx    = (nxf+1) / (nxc+1) * (i+1) - 1
-      
-                       aweight   = 0.0
-      
-                       DO jjf = bottomy, topy
-                           DO iif = bottomx, topx
-      
-                               aweight   = aweight + anterpol3d (kkf,jjf,iif) *        &
-                                   (dxf/dxc) * (dyf/dyc)
-      
-                           END DO
-                       END DO
-      
-                       work3d(k,j,i)   = aweight
-      
-                   END DO
-      
-               END DO
-      
-           END DO
-      
-      
-       END SUBROUTINE anterpolate_to_crse_w
-      
-      
-       SUBROUTINE anterpolate_to_crse_s( tag )
-      
-      
-           USE arrays_3d
-           USE control_parameters
-           USE grid_variables
-           USE indices
-           USE pegrid
-           
-      
-           IMPLICIT NONE
-
-           INTEGER(iwp), intent(in)           :: tag
-           INTEGER(iwp)                       :: i
-           INTEGER(iwp)                       :: j
-           INTEGER(iwp)                       :: k
-           INTEGER(iwp)                       :: iif
-           INTEGER(iwp)                       :: jjf
-           INTEGER(iwp)                       :: kkf
-           INTEGER(iwp)                       :: bottomx
-           INTEGER(iwp)                       :: bottomy
-           INTEGER(iwp)                       :: bottomz
-           INTEGER(iwp)                       :: topx
-           INTEGER(iwp)                       :: topy
-           INTEGER(iwp)                       :: topz
-           REAL(wp)                           :: aweight
-      
-           !
            !-- Anterpolation of the potential temperature pt
            !-- all fine grid values are considered
@@ -3317,9 +3244,4 @@
         INTEGER(iwp)                          :: i
         INTEGER(iwp)                          :: j
-        INTEGER(iwp)                          :: k
-        INTEGER(iwp)                          :: im
-        INTEGER(iwp)                          :: jn
-        INTEGER(iwp)                          :: ko
-   
    
         !
@@ -3437,5 +3359,5 @@
             anterpol3d => e
    
-            CALL anterpolate_to_crse_e ( 104 )
+            CALL anterpolate_to_crse_e
 
             CALL MPI_SEND( work3d, 1, TYPE_VNEST_ANTER, target_idex,  &
@@ -3453,5 +3375,5 @@
    
    
-       SUBROUTINE anterpolate_to_crse_e( tag )
+       SUBROUTINE anterpolate_to_crse_e
       
       
@@ -3465,5 +3387,4 @@
            IMPLICIT NONE
 
-           INTEGER(iwp), intent(in)           :: tag
            INTEGER(iwp)                       :: i
            INTEGER(iwp)                       :: j
@@ -3565,12 +3486,6 @@
 
 
-       USE control_parameters,                                                    &
-           ONLY:  coupling_mode, coupling_mode_remote, coupling_topology, dz
-
-       USE grid_variables,                                                        &
-           ONLY:  dx, dy
-           
-       USE indices,                                                               &
-           ONLY: nbgp, nx, ny, nz
+       USE control_parameters,                                                 &
+           ONLY:  coupling_mode
 
        USE kinds
@@ -3588,5 +3503,5 @@
                CALL MPI_SEND( pdims, 2, MPI_INTEGER, numprocs, 33, comm_inter, &
                    ierr )
-               CALL MPI_RECV( pdims_partner, 2, MPI_INTEGER, numprocs, 66,      &
+               CALL MPI_RECV( pdims_partner, 2, MPI_INTEGER, numprocs, 66,     &
                    comm_inter, status, ierr )
            ELSEIF ( coupling_mode == 'vnested_fine') THEN
@@ -3649,14 +3564,13 @@
 #if defined( __parallel )
 
-       USE control_parameters,                                                    &
-           ONLY:  coupling_mode, coupling_mode_remote, coupling_topology, dz,     &
+       USE control_parameters,                                                 &
+           ONLY:  coupling_mode, coupling_topology, dz,                        &
                   dz_stretch_level_start, message_string
 
-       USE grid_variables,                                                        &
+       USE grid_variables,                                                     &
            ONLY:  dx, dy
            
-       USE indices,                                                               &
-           ONLY: nbgp, nx, ny, nz, nxl, nxr, nys, nyn, nzb, nzt, &
-                 nxlg, nxrg, nysg, nyng
+       USE indices,                                                            &
+           ONLY: nbgp, nx, ny, nz, nxl, nxr, nys, nyn, nzb, nzt
 
        USE kinds
@@ -3666,5 +3580,4 @@
        IMPLICIT NONE
 
-       INTEGER(iwp)                           :: dest_rnk
        INTEGER(iwp)                           :: i              !<
        INTEGER(iwp)                           :: j              !<
Index: palm/trunk/SOURCE/virtual_flight_mod.f90
===================================================================
--- palm/trunk/SOURCE/virtual_flight_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/virtual_flight_mod.f90	(revision 3241)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3182 2018-07-27 13:36:03Z suehring
 ! IF statement revised to consider new vertical grid stretching
 ! 
@@ -227,5 +230,5 @@
 
        USE control_parameters,                                                 &
-           ONLY:  initializing_actions, message_string  
+           ONLY:  message_string
       
        IMPLICIT NONE
@@ -514,6 +517,6 @@
 
        USE control_parameters,                                                 &
-           ONLY:  cloud_droplets, cloud_physics, dz, dz_stretch_level, dt_3d,  &
-                  humidity, neutral, passive_scalar, simulated_time
+           ONLY:  cloud_droplets, cloud_physics, dt_3d, humidity, neutral,     &
+                  passive_scalar, simulated_time
                   
        USE cpulog,                                                             &
@@ -524,5 +527,5 @@
 
        USE indices,                                                            &
-           ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nys, nysg, nyn, nyng, nzb, nzt
+           ONLY:  nx, nxl, nxr, ny, nys, nyn
 
        USE pegrid
@@ -739,5 +742,5 @@
            ONLY:  dz, dz_stretch_level_start   
   
-      USE grid_variables,                                                     &
+      USE grid_variables,                                                      &
           ONLY:  dx, dy
     
@@ -828,5 +831,5 @@
     
        USE control_parameters,                                                 &
-           ONLY:  bc_lr_cyc, bc_ns_cyc, dz, message_string
+           ONLY:  bc_lr_cyc, bc_ns_cyc, message_string
 
        USE grid_variables,                                                     &
Index: palm/trunk/SOURCE/wind_turbine_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/wind_turbine_model_mod.f90	(revision 3240)
+++ palm/trunk/SOURCE/wind_turbine_model_mod.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 3182 2018-07-27 13:36:03Z suehring
 ! Check for vertical stretching has been revised. 
 ! 
@@ -265,5 +268,4 @@
     INTEGER(iwp) ::  nrings_max   !< maximum number of rings (all turbines, required for allocation of arrays)
     INTEGER(iwp) ::  ring         !< ring loop index (ring number)
-    INTEGER(iwp) ::  rr_int       !<
     INTEGER(iwp) ::  upper_end    !<
 
@@ -1680,6 +1682,6 @@
        INTEGER(iwp) ::  inot             !< turbine loop index (turbine id)
        INTEGER(iwp) ::  iialpha, iir     !<
-       INTEGER(iwp) ::  rseg, rseg_int   !<
-       INTEGER(iwp) ::  ring, ring_int   !<
+       INTEGER(iwp) ::  rseg             !<
+       INTEGER(iwp) ::  ring             !<
        INTEGER(iwp) ::  ii, jj, kk       !<
     
@@ -1696,9 +1698,8 @@
 !
 !      Variables for pitch control
-       REAL(wp)     ::  torque_max=0.0_wp
-       LOGICAL      ::  pitch_sw=.FALSE.
-
-       INTEGER(iwp), DIMENSION(1) :: lct=0
-       REAL(wp), DIMENSION(1)     :: rad_d=0.0_wp
+       LOGICAL ::  pitch_sw = .FALSE.
+
+       INTEGER(iwp), DIMENSION(1) ::  lct = 0
+       REAL(wp), DIMENSION(1)     ::  rad_d = 0.0_wp
        
        REAL(wp) :: tl_factor !< factor for tip loss correction
Index: palm/trunk/UTIL/combine_plot_fields.f90
===================================================================
--- palm/trunk/UTIL/combine_plot_fields.f90	(revision 3240)
+++ palm/trunk/UTIL/combine_plot_fields.f90	(revision 3241)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -126,7 +129,7 @@
 
     INTEGER(iwp) ::  av, danz, i, id, j, k, model, models, nc_stat,            &
-                     nxa, nxag, nxe, nxeg, nya, nyag, nye, nyeg,               &
+                     nxa, nxe, nya, nye,               &
                      nza, nze, pos, time_step, xa, xe, xxa, xxe, ya, ya_do,    &
-                     ya_tot, ye, ye_do, ye_tot, yya, yye, za, ze, zza, zze
+                     ya_tot, ye, ye_do, ye_tot, yya, yye, za, ze
 
     INTEGER(8)                        ::  count, count_rate
@@ -141,5 +144,5 @@
                  netcdf_1, vnest
 
-    REAL(wp) ::  cpu_start_time, cpu_end_time, dx, simulated_time
+    REAL(wp) ::  cpu_start_time, cpu_end_time, simulated_time
     REAL(wp),  DIMENSION(:,:), ALLOCATABLE   ::  pf, pf_tmp
     REAL(spk), DIMENSION(:,:,:), ALLOCATABLE ::  pf3d, pf3d_tmp
@@ -752,5 +755,4 @@
 !--             Allocate the array for storing the total domain data
                 IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 )  THEN
-!                   READ ( id+110 )  nxag, nxeg, nyag, nyeg
                    READ ( id+110 )  nxa, nxe, nya, nye, nza, nze
                    ALLOCATE ( pf3d(nxa:nxe,nya:nye,nza:nze) )
