Index: /palm/trunk/SOURCE/check_open.f90
===================================================================
--- /palm/trunk/SOURCE/check_open.f90	(revision 4443)
+++ /palm/trunk/SOURCE/check_open.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4400 2020-02-10 20:32:41Z suehring
 ! Remove binary output for virtual measurements
 ! 
@@ -66,8 +69,12 @@
  
 
+    USE control_parameters,                                                                        &
+        ONLY:  coupling_char, data_output_2d_on_each_pe, max_masks, message_string, openfile,      &
+               run_description_header
+
+#if defined( __parallel )
     USE control_parameters,                                                    &
-        ONLY:  coupling_char, data_output_2d_on_each_pe,                       &
-               max_masks, message_string, nz_do3d, openfile,              &
-               run_description_header
+        ONLY:  nz_do3d
+#endif
 
     USE indices,                                                               &
Index: /palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/check_parameters.f90	(revision 4443)
+++ /palm/trunk/SOURCE/check_parameters.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4392 2020-01-31 16:14:57Z pavelkrc
 ! Some error numbers revised to prevent double usage
 ! 
@@ -169,7 +172,9 @@
     USE transpose_indices
 
+#if defined( __parallel )
     USE vertical_nesting_mod,                                                  &
         ONLY:  vnested,                                                        &
                vnest_check_parameters
+#endif
 
 
@@ -196,9 +201,11 @@
     LOGICAL     ::  found                            !< flag, true if output variable is already marked for averaging
 
+    REAL(wp)    ::  gradient                         !< local gradient
+#if defined( __parallel )
     REAL(wp)    ::  dt_spinup_max                    !< maximum spinup timestep in nested domains
-    REAL(wp)    ::  gradient                         !< local gradient
     REAL(wp)    ::  remote = 0.0_wp                  !< MPI id of remote processor
     REAL(wp)    ::  spinup_time_max                  !< maximum spinup time in nested domains
     REAL(wp)    ::  time_to_be_simulated_from_reference_point  !< time to be simulated from reference point
+#endif
 
 
@@ -3175,7 +3182,9 @@
     ENDIF
 
+#if defined( __parallel )
 !
 !-- Vertical nesting: check fine and coarse grid compatibility for data exchange
     IF ( vnested )  CALL vnest_check_parameters
+#endif
 
 !
Index: /palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_2d.f90	(revision 4443)
+++ /palm/trunk/SOURCE/data_output_2d.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4442 2020-03-04 19:21:13Z suehring
 ! Change order of dimension in surface array %frac to allow for better 
 ! vectorization.
@@ -152,5 +155,4 @@
     INTEGER(iwp) ::  flag_nr   !< number of masking flag
     INTEGER(iwp) ::  i         !< loop index
-    INTEGER(iwp) ::  iis       !< vertical index of a xy slice in array 'local_2d_sections'
     INTEGER(iwp) ::  is        !< slice index
     INTEGER(iwp) ::  ivar      !< variable index
@@ -166,6 +168,9 @@
     INTEGER(iwp) ::  nzt_do    !< upper limit of the data field (usually nzt+1)
     INTEGER(iwp) ::  s_ind     !< index of slice types (xy=1, xz=2, yz=3)
+#if defined( __parallel )
+    INTEGER(iwp) ::  iis       !< vertical index of a xy slice in array 'local_2d_sections'
     INTEGER(iwp) ::  sender    !< PE id of sending PE
     INTEGER(iwp) ::  ind(4)    !< index limits (lower/upper bounds) of array 'local_2d'
+#endif
 
     LOGICAL ::  found          !< true if output variable was found
Index: /palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_3d.f90	(revision 4443)
+++ /palm/trunk/SOURCE/data_output_3d.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -90,21 +93,24 @@
 
     USE control_parameters,                                                    &
-        ONLY:  debug_output_timestep,                                          &
-               do3d, do3d_no, do3d_time_count, io_blocks, io_group,            &
+        ONLY:  debug_output_timestep, do3d, do3d_no, do3d_time_count,          &
                land_surface, message_string, ntdim_3d, nz_do3d, plant_canopy,  &
                psolver, time_since_reference_point, urban_surface,             &
                varnamelength
 
+#if defined( __parallel )
+    USE control_parameters,                                                    &
+        ONLY:  io_blocks, io_group
+#endif
+
     USE cpulog,                                                                &
         ONLY:  log_point, cpu_log
 
-#if defined( __parallel )
     USE indices,                                                               &
         ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,     &
                wall_flags_total_0
-#else
+
+#if ! defined( __parallel )
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,  &
-               nzt, wall_flags_total_0
+        ONLY:  nx, ny
 #endif
 
Index: /palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_mask.f90	(revision 4443)
+++ /palm/trunk/SOURCE/data_output_mask.f90	(revision 4444)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! -----------------
-!
-!
+! 
+! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+!
+! 4377 2020-01-15 11:10:51Z gronemeier
 ! bugfix: set fill value for output according to wall_flags_total_0 for
 !         non-terrain following output
@@ -93,8 +96,12 @@
     USE control_parameters,                                                    &
         ONLY:  air_chemistry, domask, domask_no, domask_time_count, mask_i,    &
-               mask_j, mask_k, mask_size, mask_size_l, mask_start_l,           &
-               mask_surface,                                                   &
+               mask_j, mask_k, mask_size_l, mask_surface,                                                   &
                max_masks, message_string, nz_do3d, salsa,                      &
                time_since_reference_point
+
+#if defined( __parallel )
+    USE control_parameters,                                                    &
+        ONLY:  mask_size, mask_start_l
+#endif
 
     USE diagnostic_output_quantities_mod,                                      &
@@ -134,5 +141,4 @@
 
     INTEGER(iwp) ::  av                      !< flag for (non-)average output
-    INTEGER(iwp) ::  ngp                     !< number of grid points of an output slice
     INTEGER(iwp) ::  flag_nr                 !< number of masking flag
     INTEGER(iwp) ::  i                       !< loop index
@@ -146,7 +152,10 @@
     INTEGER(iwp) ::  n                       !< loop index
     INTEGER(iwp) ::  netcdf_data_format_save !< value of netcdf_data_format
+    INTEGER(iwp) ::  ktt                     !< k index of highest terrain surface
+#if defined( __parallel )
+    INTEGER(iwp) ::  ngp                     !< number of grid points of an output slice
     INTEGER(iwp) ::  sender                  !< PE id of sending PE
-    INTEGER(iwp) ::  ktt                     !< k index of highest terrain surface
     INTEGER(iwp) ::  ind(6)                  !< index limits (lower/upper bounds) of array 'local_2d'
+#endif
 
     LOGICAL ::  found      !< true if output variable was found
Index: /palm/trunk/SOURCE/exchange_horiz_2d.f90
===================================================================
--- /palm/trunk/SOURCE/exchange_horiz_2d.f90	(revision 4443)
+++ /palm/trunk/SOURCE/exchange_horiz_2d.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
 ! 
@@ -332,7 +335,11 @@
         ONLY:  bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, bc_dirichlet_s, &
                bc_radiation_l, bc_radiation_n, bc_radiation_r, bc_radiation_s, &
-               bc_radiation_l, bc_radiation_n, bc_radiation_r, bc_radiation_s, &
-               grid_level
-        
+               bc_radiation_l, bc_radiation_n, bc_radiation_r, bc_radiation_s
+
+#if defined( __parallel )
+    USE control_parameters,                                                    &
+        ONLY:  grid_level
+#endif
+
     USE cpulog,                                                                &
         ONLY:  cpu_log, log_point_s
Index: /palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/flow_statistics.f90	(revision 4443)
+++ /palm/trunk/SOURCE/flow_statistics.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4442 2020-03-04 19:21:13Z suehring
 ! Change order of dimension in surface array %frac to allow for better 
 ! vectorization.
@@ -101,7 +104,11 @@
         
     USE indices,                                                               &
-        ONLY:   ngp_2dh, ngp_2dh_s_inner, ngp_3d, ngp_3d_inner, ngp_sums,      &
-                ngp_sums_ls, nxl, nxr, nyn, nys, nzb, nzt, topo_min_level,     &
-                wall_flags_total_0
+        ONLY:   ngp_2dh, ngp_2dh_s_inner, ngp_3d, ngp_3d_inner, nxl, nxr, nyn, &
+                nys, nzb, nzt, topo_min_level, wall_flags_total_0
+
+#if defined( __parallel )
+    USE indices,                                                               &
+        ONLY:  ngp_sums, ngp_sums_ls
+#endif
         
     USE kinds
Index: /palm/trunk/SOURCE/header.f90
===================================================================
--- /palm/trunk/SOURCE/header.f90	(revision 4443)
+++ /palm/trunk/SOURCE/header.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Bugfix, character length too short, caused crash on NEC.
 ! 
@@ -123,8 +126,8 @@
     USE pmc_handle_communicator,                                               &
         ONLY:  pmc_get_model_info
-#endif
 
     USE pmc_interface,                                                         &
         ONLY:  nested_run, nesting_datatransfer_mode, nesting_mode
+#endif
 
     USE surface_mod,                                                           &
@@ -148,5 +151,7 @@
     CHARACTER (LEN=26) ::  ver_rev             !< string for run identification
 
+#if defined( __parallel )
     CHARACTER (LEN=32) ::  cpl_name            !< name of child domain (nesting mode only) 
+#endif
     
     CHARACTER (LEN=40) ::  output_format       !< netcdf format
@@ -185,5 +190,4 @@
     INTEGER(iwp) ::  ch             !< canyon depth in generic street-canyon setup
     INTEGER(iwp) ::  count          !< number of masked output locations
-    INTEGER(iwp) ::  cpl_parent_id  !< parent ID for the respective child model
     INTEGER(iwp) ::  cwx            !< canyon width along x in generic street-canyon setup
     INTEGER(iwp) ::  cwy            !< canyon width along y in generic street-canyon setup
@@ -198,13 +202,18 @@
     INTEGER(iwp) ::  ll             !< substring length
     INTEGER(iwp) ::  mid            !< masked output running index
+#if defined( __parallel )
+    INTEGER(iwp) ::  cpl_parent_id  !< parent ID for the respective child model
     INTEGER(iwp) ::  my_cpl_id      !< run id in a nested model setup
     INTEGER(iwp) ::  n              !< running index over number of couplers in a nested model setup
     INTEGER(iwp) ::  ncpl           !< number of coupler in a nested model setup
     INTEGER(iwp) ::  npe_total      !< number of total PEs in a coupler (parent + child)
+#endif
     
 
     REAL(wp) ::  cpuseconds_per_simulated_second  !< CPU time (in s) per simulated second
+#if defined( __parallel )
     REAL(wp) ::  lower_left_coord_x               !< x-coordinate of nest domain
     REAL(wp) ::  lower_left_coord_y               !< y-coordinate of nest domain
+#endif
 
 !
@@ -246,5 +255,7 @@
        CALL message( 'header', 'PA0191', 0, 0, 0, 6, 0 )
     ENDIF
+#if defined( __parallel )
     IF ( nested_run )  run_classification = 'nested ' // run_classification(1:63)
+#endif
     IF ( ocean_mode )  THEN
        run_classification = 'ocean - ' // run_classification(1:61)
@@ -300,9 +311,9 @@
 #endif
 
+#if defined( __parallel )
 !
 !-- Nesting informations
     IF ( nested_run )  THEN
 
-#if defined( __parallel )
        WRITE ( io, 600 )  TRIM( nesting_mode ),                                &
                           TRIM( nesting_datatransfer_mode )
@@ -324,7 +335,8 @@
                              TRIM( cpl_name )
        ENDDO
+
+    ENDIF
 #endif
 
-    ENDIF
     WRITE ( io, 99 )
 
@@ -1919,4 +1931,5 @@
             ' Time:                 ',A8,6X,'Run-No.:   ',I2.2/     &
             ' Run on host:        ',A10,6X,'En-No.:    ',I2.2)
+#if defined( __parallel )
 600 FORMAT (/' Nesting informations:'/ &
             ' --------------------'/ &
@@ -1926,4 +1939,5 @@
             ' (*=me)     id    of PEs      x (m)     y (m)' )
 601 FORMAT (2X,A1,1X,I2.2,6X,I2.2,5X,I5,5X,F8.2,2X,F8.2,5X,A)
+#endif
 
  END SUBROUTINE header
Index: /palm/trunk/SOURCE/init_coupling.f90
===================================================================
--- /palm/trunk/SOURCE/init_coupling.f90	(revision 4443)
+++ /palm/trunk/SOURCE/init_coupling.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! ------------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
 ! 
@@ -54,6 +57,8 @@
 !
 !-- Local variables
+#if defined( __parallel )
     INTEGER(iwp) ::  i            !<
     INTEGER(iwp) ::  inter_color  !<
+#endif
     
     INTEGER(iwp), DIMENSION(:) ::  bc_data(0:3) = 0  !<
Index: /palm/trunk/SOURCE/init_grid.f90
===================================================================
--- /palm/trunk/SOURCE/init_grid.f90	(revision 4443)
+++ /palm/trunk/SOURCE/init_grid.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4414 2020-02-19 20:16:04Z suehring
 ! - Remove deprecated topography arrays nzb_s_inner, nzb_u_inner, etc.
 ! - Move initialization of boundary conditions and multigrid into an extra
@@ -172,6 +175,8 @@
     USE pegrid
 
+#if defined( __parallel )
     USE vertical_nesting_mod,                                                  &
         ONLY:  vnested, vnest_init_grid
+#endif
 
     IMPLICIT NONE
@@ -751,8 +756,11 @@
        ENDDO
     ENDIF
+
+#if defined( __parallel )
 !
 !-- Vertical nesting: communicate vertical grid level arrays between fine and
 !-- coarse grid
     IF ( vnested )  CALL vnest_init_grid
+#endif
 
  END SUBROUTINE init_grid
@@ -948,5 +956,7 @@
     INTEGER(iwp) ::  topo_top_index   !< orography top index, used to map 3D buildings onto terrain
 
+#if defined( __parallel )
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  displace_dum        !< displacements of start addresses, used for MPI_ALLGATHERV
+#endif
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  build_ids           !< building IDs on entire model domain
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  build_ids_final     !< building IDs on entire model domain, multiple occurences are sorted out 
Index: /palm/trunk/SOURCE/init_masks.f90
===================================================================
--- /palm/trunk/SOURCE/init_masks.f90	(revision 4443)
+++ /palm/trunk/SOURCE/init_masks.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
 ! 
@@ -100,5 +103,4 @@
     INTEGER(iwp) ::  i            !< loop index
     INTEGER(iwp) ::  ilen         !< length of string saved in 'do_mask'
-    INTEGER(iwp) ::  ind(6)       !< index limits (lower/upper bounds) of output array
     INTEGER(iwp) ::  ind_array(1) !< array index
     INTEGER(iwp) ::  j            !< loop index
@@ -106,6 +108,9 @@
     INTEGER(iwp) ::  m            !< mask index
     INTEGER(iwp) ::  mid            !< masked output running index
+#if defined( __parallel )
+    INTEGER(iwp) ::  ind(6)       !< index limits (lower/upper bounds) of output array
     INTEGER(iwp) ::  n            !< loop index
     INTEGER(iwp) ::  sender       !< PE id of sending PE
+#endif
     
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  tmp_array !< temporary 1D array
Index: /palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- /palm/trunk/SOURCE/init_pegrid.f90	(revision 4443)
+++ /palm/trunk/SOURCE/init_pegrid.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! changed message PA0467
 ! 
@@ -82,19 +85,31 @@
         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_topology, gathered_size,&
+               bc_radiation_s, &
                grid_level, grid_level_count, maximum_grid_level,               &
-               message_string, mg_switch_to_pe0_level, momentum_advec,         &
-               psolver, outflow_source_plane, recycling_width, scalar_advec,   &
-               subdomain_size, turbulent_inflow, turbulent_outflow, y_shift
+               message_string, mg_switch_to_pe0_level,         &
+               psolver
+
+
+#if defined( __parallel )
+    USE control_parameters,                                                    &
+        ONLY:  coupling_mode, coupling_topology, gathered_size, momentum_advec, &
+               outflow_source_plane, recycling_width, scalar_advec, subdomain_size, &
+               turbulent_inflow, turbulent_outflow, y_shift
 
     USE grid_variables,                                                        &
         ONLY:  dx
+#endif
         
     USE indices,                                                               &
-        ONLY:  mg_loc_ind, nbgp, nnx, nny, nnz, nx, nx_a, nx_o, nxl, nxl_mg,   &
-               nxlu, nxr, nxr_mg, ny, ny_a, ny_o, nyn, nyn_mg, nys, nys_mg,    &
+        ONLY:  nnx, nny, nnz, nx, nxl, nxl_mg,   &
+               nxlu, nxr, nxr_mg, ny, nyn, nyn_mg, nys, nys_mg,    &
                nysv, nz, nzb, nzt, nzt_mg, wall_flags_1, wall_flags_2,         &
                wall_flags_3, wall_flags_4, wall_flags_5, wall_flags_6,         &
                wall_flags_7, wall_flags_8, wall_flags_9, wall_flags_10
+
+#if defined( __parallel )
+    USE indices,                                                               &
+        ONLY:  mg_loc_ind, nbgp, nx_a, nx_o, ny_a, ny_o
+#endif
 
     USE kinds
@@ -102,24 +117,32 @@
     USE pegrid
     
+#if defined( __parallel )
     USE pmc_interface,                                                         &
         ONLY:  nested_run
-      
+
     USE spectra_mod,                                                           &
-        ONLY:  calculate_spectra, dt_dosp
+        ONLY:  calculate_spectra
 
     USE synthetic_turbulence_generator_mod,                                    &
         ONLY:  id_stg_left, id_stg_north, id_stg_right, id_stg_south,          &
                use_syn_turb_gen
+#endif
 
     USE transpose_indices,                                                     &
-        ONLY:  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z, nys_x,&
-               nys_z, nzb_x, nzb_y, nzb_yd, nzt_x, nzt_yd, nzt_y
+        ONLY:  nxl_y, nxl_z, nxr_y, nxr_z, nyn_x, nyn_z, nys_x,&
+               nys_z, nzb_x, nzb_y, nzt_x, nzt_y
+
+#if defined( __parallel )
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_yd, nxr_yd, nzb_yd, nzt_yd
 
     USE vertical_nesting_mod,                                                  &
         ONLY:  vnested, vnest_init_pegrid_domain, vnest_init_pegrid_rank
+#endif
 
     IMPLICIT NONE
 
     INTEGER(iwp) ::  i                        !< running index over number of processors or number of multigrid level
+#if defined( __parallel )
     INTEGER(iwp) ::  id_inflow_l              !< ID indicating processors located at the left inflow boundary
     INTEGER(iwp) ::  id_outflow_l             !< local value of id_outflow
@@ -131,4 +154,5 @@
     INTEGER(iwp) ::  id_stg_south_l           !< south lateral boundary local core id in case of turbulence generator  
     INTEGER(iwp) ::  ind(5)                   !< array containing the subdomain bounds
+#endif
     INTEGER(iwp) ::  j                        !< running index, used for various loops
     INTEGER(iwp) ::  k                        !< number of vertical grid points in different multigrid level
@@ -138,4 +162,5 @@
     INTEGER(iwp) ::  mg_levels_z              !< maximum number of grid level allowed along z-direction
     INTEGER(iwp) ::  mg_switch_to_pe0_level_l !< maximum number of grid level with switching to PE 0
+#if defined( __parallel )
     INTEGER(iwp) ::  nnx_y                    !< quotient of number of grid points along x-direction and number of PEs used along y-direction
     INTEGER(iwp) ::  nny_x                    !< quotient of number of grid points along y-direction and number of PEs used along x-direction
@@ -144,12 +169,16 @@
     INTEGER(iwp) ::  nnz_y                    !< quotient of number of grid points along z-direction and number of PEs used along x-direction
     INTEGER(iwp) ::  numproc_sqr              !< square root of the number of processors
+#endif
     INTEGER(iwp) ::  nxl_l                    !< lower index bound along x-direction on subdomain and different multigrid level
     INTEGER(iwp) ::  nxr_l                    !< upper index bound along x-direction on subdomain and different multigrid level
     INTEGER(iwp) ::  nyn_l                    !< lower index bound along y-direction on subdomain and different multigrid level
     INTEGER(iwp) ::  nys_l                    !< upper index bound along y-direction on subdomain and different multigrid level
+#if defined( __parallel )
     INTEGER(iwp) ::  nzb_l                    !< lower index bound along z-direction on subdomain and different multigrid level
+#endif
     INTEGER(iwp) ::  nzt_l                    !< upper index bound along z-direction on subdomain and different multigrid level
 !$  INTEGER(iwp) ::  omp_get_num_threads      !< number of OpenMP threads
 
+#if defined( __parallel )
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ind_all !< dummy array containing index bounds on subdomain, used for gathering
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nxlf    !< lower index bound allong x-direction for every PE
@@ -161,4 +190,5 @@
     INTEGER(iwp)               ::  lcoord(2)            !< PE coordinates of left neighbor along x and y
     INTEGER(iwp)               ::  rcoord(2)            !< PE coordinates of right neighbor along x and y
+#endif
 
 !
Index: /palm/trunk/SOURCE/lagrangian_particle_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4430 2020-02-27 18:02:20Z suehring
 ! - Bugfix in logarithmic interpolation of near-ground particle speed (density
 !   was not considered).
@@ -175,4 +178,5 @@
     USE particle_attributes
 
+#if defined( __parallel )
     USE pmc_particle_interface,                                                &
         ONLY: pmcp_c_get_particle_from_parent, pmcp_p_fill_particle_win,       &
@@ -180,4 +184,5 @@
               pmcp_p_delete_particles_in_fine_grid_area, pmcp_g_init,          &
               pmcp_g_print_number_of_particles
+#endif
 
     USE pmc_interface,                                                         &
@@ -307,4 +312,6 @@
 
     INTEGER(iwp), PARAMETER ::  NR_2_direction_move = 10000 !<
+
+#if defined( __parallel )
     INTEGER(iwp)            ::  nr_move_north               !<
     INTEGER(iwp)            ::  nr_move_south               !<
@@ -312,4 +319,5 @@
     TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  move_also_north
     TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  move_also_south
+#endif
 
     REAL(wp) ::  epsilon_collision !<
@@ -1234,5 +1242,8 @@
     ENDIF
 
+#if defined( __parallel )
     IF ( nested_run )  CALL pmcp_g_init
+#endif
+
 !
 !-- To avoid programm abort, assign particles array to the local version of
@@ -2263,4 +2274,6 @@
                 first_loop_stride = .FALSE.
              ENDDO   ! timestep loop
+
+#if defined( __parallel )
 !
 !--          in case of nested runs do the transfer of particles after every full model time step
@@ -2274,4 +2287,5 @@
                 deleted_particles = 0
              ENDIF
+#endif
 
 !
@@ -2341,4 +2355,20 @@
  END SUBROUTINE lpm_actions
  
+
+#if defined( __parallel )
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!
+!------------------------------------------------------------------------------!
+ SUBROUTINE particles_from_parent_to_child
+
+    CALL pmcp_c_get_particle_from_parent                         ! Child actions
+    CALL pmcp_p_fill_particle_win                                ! Parent actions
+
+    RETURN
+
+ END SUBROUTINE particles_from_parent_to_child
+
  
 !------------------------------------------------------------------------------!
@@ -2347,19 +2377,4 @@
 !
 !------------------------------------------------------------------------------!
- SUBROUTINE particles_from_parent_to_child
-
-    CALL pmcp_c_get_particle_from_parent                         ! Child actions
-    CALL pmcp_p_fill_particle_win                                ! Parent actions
-
-    RETURN
-
- END SUBROUTINE particles_from_parent_to_child
-
- 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!
-!------------------------------------------------------------------------------!
  SUBROUTINE particles_from_child_to_parent
 
@@ -2370,4 +2385,5 @@
 
  END SUBROUTINE particles_from_child_to_parent
+#endif
  
 !------------------------------------------------------------------------------!
@@ -2421,8 +2437,10 @@
 #endif
 
+#if defined( __parallel )
     IF ( nested_run )  THEN
        CALL pmcp_g_print_number_of_particles( simulated_time+dt_3d,            &
                                               tot_number_of_particles)
     ENDIF
+#endif
 
 !
@@ -6973,10 +6991,12 @@
  SUBROUTINE lpm_exchange_horiz
 
-    INTEGER(iwp) ::  i                 !< grid index (x) of particle positition
     INTEGER(iwp) ::  ip                !< index variable along x
-    INTEGER(iwp) ::  j                 !< grid index (y) of particle positition
     INTEGER(iwp) ::  jp                !< index variable along y
     INTEGER(iwp) ::  kp                !< index variable along z
     INTEGER(iwp) ::  n                 !< particle index variable 
+
+#if defined( __parallel )
+    INTEGER(iwp) ::  i                 !< grid index (x) of particle positition
+    INTEGER(iwp) ::  j                 !< grid index (y) of particle positition
     INTEGER(iwp) ::  par_size          !< Particle size in bytes
     INTEGER(iwp) ::  trlp_count        !< number of particles send to left PE
@@ -6997,4 +7017,5 @@
     TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  trrp  !< particles send to right PE
     TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  trsp  !< particles send to south PE
+#endif
 
     CALL cpu_log( log_point_s(23), 'lpm_exchange_horiz', 'start' )
@@ -7614,4 +7635,5 @@
  END SUBROUTINE lpm_exchange_horiz
 
+#if defined( __parallel )
 !------------------------------------------------------------------------------!
 ! Description:
@@ -7773,7 +7795,6 @@
     ENDDO
 
-    RETURN
-
  END SUBROUTINE lpm_add_particles_to_gridcell
+#endif
  
  
Index: /palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directive moved
+! 
+! 4442 2020-03-04 19:21:13Z suehring
 ! Change order of dimension in surface arrays %frac, %emissivity and %albedo 
 ! to allow for better vectorization in the radiation interactions.
@@ -2376,6 +2379,6 @@
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  bound          !< temporary arrays for storing index bounds
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  bound_root_fr  !< temporary arrays for storing index bounds
+#if defined( __parallel )
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  pr_soil_init   !< temporary array used for averaging soil profiles
-#if defined( __parallel )
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  z_soil_root    !< vertical dimension of soil grid in root domain
 #endif
Index: /palm/trunk/SOURCE/local_stop.f90
===================================================================
--- /palm/trunk/SOURCE/local_stop.f90	(revision 4443)
+++ /palm/trunk/SOURCE/local_stop.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: misplaced cpp-directive moved
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
 ! 
@@ -40,4 +43,5 @@
  SUBROUTINE local_stop
  
+#if defined( __parallel )
 
     USE control_parameters,                                                    &
@@ -52,5 +56,4 @@
 
 
-#if defined( __parallel )
     IF ( coupling_mode == 'uncoupled' )  THEN
        IF ( nested_run )  THEN
Index: /palm/trunk/SOURCE/multi_agent_system_mod.f90
===================================================================
--- /palm/trunk/SOURCE/multi_agent_system_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/multi_agent_system_mod.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Removed wall_flags_static_0 from USE statements as it's not used within
 ! the module
@@ -115,11 +118,13 @@
     INTEGER(iwp) ::  iran_agent = -1234567             !< number for random generator
     INTEGER(iwp) ::  min_nr_agent = 2                  !< namelist parameter (see documentation)
+#if defined( __parallel )
     INTEGER(iwp) ::  ghla_count_recv                   !< number of agents in left ghost layer
     INTEGER(iwp) ::  ghna_count_recv                   !< number of agents in north ghost layer
     INTEGER(iwp) ::  ghra_count_recv                   !< number of agents in right ghost layer
     INTEGER(iwp) ::  ghsa_count_recv                   !< number of agents in south ghost layer
-    INTEGER(iwp) ::  maximum_number_of_agents = 0      !< maximum number of agents during run
     INTEGER(iwp) ::  nr_move_north                     !< number of agts to move north during exchange_horiz
     INTEGER(iwp) ::  nr_move_south                     !< number of agts to move south during exchange_horiz
+#endif
+    INTEGER(iwp) ::  maximum_number_of_agents = 0      !< maximum number of agents during run
     INTEGER(iwp) ::  number_of_agents = 0              !< number of agents for each grid box (3d array is saved on agt_count)
     INTEGER(iwp) ::  number_of_agent_groups = 1        !< namelist parameter (see documentation)
@@ -239,4 +244,5 @@
     TYPE(agent_type), DIMENSION(:), POINTER ::  agents               !< Agent array for this grid cell
     TYPE(agent_type)                        ::  zero_agent           !< zero agent to avoid weird thing
+#if defined( __parallel )
     TYPE(agent_type), DIMENSION(:), ALLOCATABLE ::  move_also_north  !< for agent exchange between PEs
     TYPE(agent_type), DIMENSION(:), ALLOCATABLE ::  move_also_south  !< for agent exchange between PEs
@@ -245,4 +251,5 @@
     TYPE(agent_type), DIMENSION(:), ALLOCATABLE ::  agt_gh_r         !< ghost layer right of pe domain
     TYPE(agent_type), DIMENSION(:), ALLOCATABLE ::  agt_gh_s         !< ghost layer south of pe domain
+#endif
 !
 !-- Type for 2D grid on which agents are stored
@@ -1216,19 +1223,25 @@
        IMPLICIT NONE
 
+#if defined( __parallel )
        INTEGER(iwp) ::  agt_size !< Agent size in bytes
+       INTEGER(iwp) ::  n        !< counter (number of PEs)
+       INTEGER(iwp) ::  noa_rcv  !< received number of agents
+#endif
        INTEGER(iwp) ::  dummy    !< dummy
        INTEGER(iwp) ::  ii       !< counter (x)
        INTEGER(iwp) ::  ip       !< counter (x)
        INTEGER(iwp) ::  jp       !< counter (y)
-       INTEGER(iwp) ::  n        !< counter (number of PEs)
        INTEGER(iwp) ::  noa      !< number of agents
-       INTEGER(iwp) ::  noa_rcv  !< received number of agents
        INTEGER(iwp) ::  out_noa  !< number of agents for output
 
+#if defined( __parallel )
        INTEGER(iwp), DIMENSION(0:numprocs-1) ::  noa_arr !< number of agents on each PE
+#endif
 !
 !--    SAVE attribute required to avoid compiler warning about pointer outlive the pointer target
        TYPE(agent_type), DIMENSION(:), ALLOCATABLE, TARGET, SAVE ::  trf_agents !< all agents on current PE
+#if defined( __parallel )
        TYPE(agent_type), DIMENSION(:), ALLOCATABLE, TARGET, SAVE ::  out_agents !< all agents in entire domain
+#endif
 
        LOGICAL, INTENT (INOUT) :: ftest
@@ -1454,4 +1467,5 @@
     END SUBROUTINE mas_data_output_agents
 
+#if defined( __parallel )
 !------------------------------------------------------------------------------!
 ! Description:
@@ -1596,5 +1610,8 @@
 
     END SUBROUTINE mas_eh_add_agents_to_gridcell
-
+#endif
+
+
+#if defined( __parallel )
 !------------------------------------------------------------------------------!
 ! Description:
@@ -1648,4 +1665,5 @@
        ENDDO
     END SUBROUTINE mas_eh_add_ghost_agents_to_gridcell
+#endif
 
 !------------------------------------------------------------------------------!
@@ -1742,10 +1760,14 @@
        IMPLICIT NONE
 
+       INTEGER(iwp) ::  ip               !< index variable along x
+       INTEGER(iwp) ::  jp               !< index variable along y
+       INTEGER(iwp) ::  n                !< agent index variable
+
+#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) ::  n                !< agent index variable 
        INTEGER(iwp) ::  par_size         !< Agent size in bytes
+
        INTEGER(iwp) ::  trla_count       !< number of agents send to left PE
        INTEGER(iwp) ::  trla_count_recv  !< number of agents receive from right PE
@@ -1765,6 +1787,4 @@
        TYPE(agent_type), DIMENSION(:), ALLOCATABLE ::  trra  !< agents send to right PE
        TYPE(agent_type), DIMENSION(:), ALLOCATABLE ::  trsa  !< agents send to south PE
-
-#if defined( __parallel )
 
 !
@@ -2228,4 +2248,8 @@
        DEALLOCATE( move_also_south )
 
+!
+!--    Accumulate the number of agents transferred between the subdomains)
+       CALL mas_eh_ghost_exchange
+
 #else
 
@@ -2316,10 +2340,8 @@
 #endif
 
-!
-!--    Accumulate the number of agents transferred between the subdomains)
-       CALL mas_eh_ghost_exchange
-
     END SUBROUTINE mas_eh_exchange_horiz
 
+
+#if defined( __parallel )
 !------------------------------------------------------------------------------!
 ! Description:
@@ -2332,6 +2354,4 @@
 
        IMPLICIT NONE
-
-#if defined( __parallel )
 
        INTEGER(iwp) ::  ip          !< index variable along x
@@ -2617,7 +2637,6 @@
        ENDIF
 
+    END SUBROUTINE mas_eh_ghost_exchange
 #endif
-
-    END SUBROUTINE mas_eh_ghost_exchange
 
 !------------------------------------------------------------------------------!
@@ -3922,4 +3941,5 @@
     END SUBROUTINE mas_ps_sort_in_subboxes
 
+#if defined( __parallel )
 !------------------------------------------------------------------------------!
 ! Description:
@@ -3962,5 +3982,6 @@
        number_of_agents = nn
 
-    END SUBROUTINE mas_ps_pack 
+    END SUBROUTINE mas_ps_pack
+#endif
 
 !------------------------------------------------------------------------------!
Index: /palm/trunk/SOURCE/palm.f90
===================================================================
--- /palm/trunk/SOURCE/palm.f90	(revision 4443)
+++ /palm/trunk/SOURCE/palm.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4414 2020-02-19 20:16:04Z suehring
 ! Call to module_interface_init_numerics
 ! 
@@ -73,23 +76,36 @@
     USE arrays_3d
 
+#if defined( __parallel )
     USE bulk_cloud_model_mod,                                                  &
         ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert
+#endif
 
     USE control_parameters,                                                    &
-        ONLY:  constant_diffusion, child_domain,                               &
-               coupling_char, do2d_at_begin, do3d_at_begin, humidity,          &
-               initializing_actions, io_blocks, io_group, message_string,      &
-               neutral, passive_scalar, runnr, simulated_time_chr, spinup,     &
+        ONLY:  coupling_char, do2d_at_begin, do3d_at_begin, io_blocks,         &
+               io_group, message_string, runnr, simulated_time_chr, spinup,    &
                time_since_reference_point, user_interface_current_revision,    &
                user_interface_required_revision, version, write_binary
 
+#if defined( __parallel )
+    USE control_parameters,                                                    &
+        ONLY:  child_domain, constant_diffusion, humidity,                     &
+               initializing_actions, neutral, passive_scalar
+#endif
+
     USE cpulog,                                                                &
-        ONLY:  cpu_log, log_point, log_point_s, cpu_statistics
+        ONLY:  cpu_log, log_point, cpu_statistics
+
+#if defined( __parallel )
+    USE cpulog,                                                                &
+        ONLY:  log_point_s
+#endif
 
     USE diagnostic_output_quantities_mod,                                      &
         ONLY:  doq_calculate
 
+#if defined( __parallel )
     USE indices,                                                               &
         ONLY:  nbgp
+#endif
 
     USE kinds
@@ -110,4 +126,5 @@
     USE pegrid
 
+#if defined( __parallel )
     USE pmc_particle_interface,                                                &
         ONLY: pmcp_g_alloc_win
@@ -116,4 +133,5 @@
         ONLY:  nested_run, pmci_child_initialize, pmci_init,                   &
                pmci_modelconfiguration, pmci_parent_initialize
+#endif
 
     USE surface_data_output_mod,                                               &
@@ -123,5 +141,5 @@
         ONLY:  wrd_global, wrd_local
 
-#if defined( __parallel) && defined( _OPENACC )
+#if defined( __parallel )  &&  defined( _OPENACC )
     USE openacc
 #endif
@@ -285,4 +303,5 @@
     CALL module_interface_init_output
 
+#if defined( __parallel )
 !
 !-- Coupling protocol setup for nested-domain runs
@@ -325,4 +344,5 @@
        CALL pmcp_g_alloc_win                    ! Must be called after pmci_child_initialize and pmci_parent_initialize
     ENDIF
+#endif
 
 !
Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives and variable declarations for serial mode added
+! 
+! 4413 2020-02-19 15:52:19Z hellstea
 ! All the USE-statements within subroutines moved up to the module declaration section.
 ! 
@@ -183,4 +186,24 @@
  MODULE pmc_interface
 
+#if ! defined( __parallel )
+!
+!-- Serial mode does not allow nesting, but requires the following variables as steering
+!-- quantities
+    USE kinds
+
+    IMPLICIT NONE
+
+    PUBLIC
+
+    CHARACTER(LEN=8), SAVE ::  nesting_mode = 'none'   !< steering parameter for 1- or 2-way nesting
+
+    INTEGER(iwp), SAVE     ::  comm_world_nesting    !< Global nesting communicator
+    INTEGER(iwp), SAVE     ::  cpl_id  = 1           !<
+
+    LOGICAL, SAVE ::  nested_run = .FALSE.        !< general switch
+    LOGICAL, SAVE ::  rans_mode_parent = .FALSE.  !< parent model mode (.F.-LES mode, .T.-RANS mode)
+
+#else
+
     USE ISO_C_BINDING
 
@@ -306,5 +329,5 @@
     
     LOGICAL, SAVE ::  nested_run = .FALSE.  !< general switch
-    LOGICAL       ::  rans_mode_parent = .FALSE. !< mode of parent model (.F. - LES mode, .T. - RANS mode)
+    LOGICAL, SAVE ::  rans_mode_parent = .FALSE. !< mode of parent model (.F. - LES mode, .T. - RANS mode)
 !
 !-- Geometry
@@ -5183,4 +5206,4 @@
  END SUBROUTINE pmci_ensure_nest_mass_conservation_vertical
 
- 
+#endif
 END MODULE pmc_interface
Index: /palm/trunk/SOURCE/pmc_particle_interface.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 4443)
+++ /palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 4444)
@@ -26,4 +26,7 @@
 ! -----------------! 
 ! $Id$
+! bugfix: preprocessor directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
 ! 
@@ -50,4 +53,5 @@
 ! child model.
 !------------------------------------------------------------------------------!
+#if defined( __parallel )
 
    USE, INTRINSIC ::  ISO_C_BINDING
@@ -1199,3 +1203,4 @@
  END SUBROUTINE pmc_realloc_particles_array
 
+#endif
 END MODULE pmc_particle_interface
Index: /palm/trunk/SOURCE/surface_data_output_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Fix wrongly declared nc_stat variable in surface_data_output_mod
 ! 
@@ -1410,6 +1413,8 @@
           ONLY:  io_blocks, io_group, time_since_reference_point
 
+#if defined( __parallel )
       USE pegrid,                                                              &
           ONLY:  comm2d, ierr
+#endif
 
 
@@ -4469,6 +4474,8 @@
           ONLY:  io_blocks, io_group
 
+#if defined( __parallel )
       USE pegrid,                                                              &
           ONLY:  comm2d, ierr
+#endif
 
       IMPLICIT NONE
Index: /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
===================================================================
--- /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added, dummy statements to prevent compile errors added
+! 
+! 4442 2020-03-04 19:21:13Z suehring
 ! Set back turbulent length scale to 8 x grid spacing in the parametrized mode
 ! (was accidantly changed).
@@ -286,8 +289,10 @@
     INTEGER(iwp) ::  nzb_y_stg          !< lower bound of z coordinate (required for transposing z on PEs along y)
     INTEGER(iwp) ::  nzt_y_stg          !< upper bound of z coordinate (required for transposing z on PEs along y)
+#if defined( __parallel )
     INTEGER(iwp) ::  stg_type_xz        !< MPI type for full z range
     INTEGER(iwp) ::  stg_type_xz_small  !< MPI type for small z range
     INTEGER(iwp) ::  stg_type_yz        !< MPI type for full z range
     INTEGER(iwp) ::  stg_type_yz_small  !< MPI type for small z range
+#endif
 
     INTEGER(iwp), DIMENSION(3) ::  nr_non_topo_xz = 0 !< number of non-topography grid points at xz cross-sections,
@@ -296,8 +301,10 @@
                                                       !< required for bias correction of imposed perturbations
     
+#if defined( __parallel )
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  displs_xz      !< displacement for MPI_GATHERV
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  recv_count_xz  !< receive count for MPI_GATHERV
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  displs_yz      !< displacement for MPI_GATHERV
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  recv_count_yz  !< receive count for MPI_GATHERV
+#endif
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nux            !< length scale of u in x direction (in gp)
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nuy            !< length scale of u in y direction (in gp)
@@ -595,6 +602,8 @@
     INTEGER(iwp) :: j                        !> loop index
     INTEGER(iwp) :: k                        !< index
+#if defined( __parallel )
     INTEGER(iwp) :: newtype                  !< dummy MPI type
     INTEGER(iwp) :: realsize                 !< size of REAL variables
+#endif
 
     INTEGER(iwp), DIMENSION(3) ::  nr_non_topo_xz_l = 0 !< number of non-topography grid points at xz-cross-section on subdomain
@@ -612,5 +621,7 @@
     REAL(wp) :: lwy     !< length scale for w in y direction
     REAL(wp) :: lwz     !< length scale for w in z direction
+#if defined( __parallel )
     REAL(wp) :: nnz     !< increment used to determine processor decomposition of z-axis along x and y direction
+#endif
     REAL(wp) :: zz      !< height
 
@@ -622,6 +633,6 @@
 !-- Create mpi-datatypes for exchange in case of non-local but distributed 
 !-- computation of the velocity seeds. This option is useful in 
-!-- case large turbulent length scales are presentm, where the computational
-!-- effort becomes large and need to be parallelized. For parametrized
+!-- case large turbulent length scales are present, where the computational
+!-- effort becomes large and need to be parallelized. For parameterized
 !-- turbulence the length scales are small and computing the velocity seeds
 !-- locally is faster (no overhead by communication).
@@ -1892,4 +1903,7 @@
 #else
        f_n(nzb+1:nzt+1,nys:nyn) = f_n_l(nzb_x_stg:nzt_x_stg+1,nys:nyn)
+!
+!--    Next line required to avoid compile errors because of unused dummy arguments
+       IF ( id_left == 0 )  id_right = 0
 #endif
 
@@ -2073,4 +2087,7 @@
 #else
        f_n(nzb+1:nzt+1,nxl:nxr) = f_n_l(nzb_y_stg:nzt_y_stg+1,nxl:nxr)
+!
+!--    Next line required to avoid compile errors because of unused dummy arguments
+       IF ( id_north == 0 )  id_south = 0
 #endif
 
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 4443)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4420 2020-02-24 14:13:56Z maronga
 ! Added output control for wind turbine model
 ! 
@@ -198,7 +201,11 @@
 
     USE arrays_3d,                                                                                 &
-        ONLY:  diss, diss_p, dzu, e, e_p, nc, nc_p, nr, nr_p, prho, pt, pt_p, pt_init, q_init, q,  &
-               qc, qc_p, qr, qr_p, q_p, ref_state, rho_ocean, s, s_p, sa_p, &
-               tend, u, u_p, v, vpt, v_p, w, w_p
+        ONLY:  diss, diss_p, dzu, e_p, nc_p, nr_p, prho, pt, pt_p, pt_init, q, qc_p, qr_p, q_init, &
+               q_p, ref_state, rho_ocean, sa_p, s_p, tend, u, u_p, v, vpt, v_p, w_p
+
+#if defined( __parallel )  &&  ! defined( _OPENACC )
+    USE arrays_3d,                                                                                 &
+        ONLY:  e, nc, nr, qc, qr, s, w
+#endif
 
     USE biometeorology_mod,                                                                        &
@@ -220,7 +227,11 @@
 
     USE chem_modules,                                                                              &
-        ONLY:  bc_cs_t_val, chem_species, cs_name,                                                 &
-               emissions_anthropogenic, emiss_read_legacy_mode,                                    &
+        ONLY:  bc_cs_t_val, chem_species, emissions_anthropogenic, emiss_read_legacy_mode,         &
                n_matched_vars
+
+#if defined( __parallel )
+    USE chem_modules,                                                                              &
+        ONLY:  cs_name
+#endif
 
     USE chemistry_model_mod,                                                                       &
@@ -242,5 +253,5 @@
                multi_agent_system_end, multi_agent_system_start, nesting_offline, neutral,         &
                nr_timesteps_this_run, nudging, ocean_mode, passive_scalar, pt_reference,           &
-               pt_slope_offset, random_heatflux, rans_mode, rans_tke_e, run_coupled, salsa,        &
+               pt_slope_offset, random_heatflux, rans_tke_e, run_coupled, salsa,                   &
                simulated_time, simulated_time_chr, skip_time_do2d_xy, skip_time_do2d_xz,           &
                skip_time_do2d_yz, skip_time_do3d, skip_time_domask, skip_time_dopr,                &
@@ -254,4 +265,9 @@
                virtual_flight, virtual_measurement, ws_scheme_mom, ws_scheme_sca, timestep_count
 
+#if defined( __parallel )
+    USE control_parameters,                                                                        &
+        ONLY:  rans_mode
+#endif
+
     USE cpulog,                                                                                    &
         ONLY:  cpu_log, log_point, log_point_s
@@ -311,8 +327,10 @@
     USE pegrid
 
+#if defined( __parallel )
     USE pmc_interface,                                                                             &
         ONLY:  nested_run, nesting_mode, pmci_boundary_conds, pmci_datatrans, pmci_synchronize,    &
         pmci_ensure_nest_mass_conservation, pmci_ensure_nest_mass_conservation_vertical,           &
         pmci_set_swaplevel
+#endif
 
     USE progress_bar,                                                                              &
@@ -361,7 +379,11 @@
 
     USE vertical_nesting_mod,                                                                      &
-        ONLY:  vnested, vnest_anterpolate, vnest_anterpolate_e, vnest_boundary_conds,              &
-               vnest_boundary_conds_khkm, vnest_deallocate, vnest_init, vnest_init_fine,           &
-               vnest_start_time
+        ONLY:  vnested, vnest_init
+
+#if defined( __parallel )
+    USE vertical_nesting_mod,                                                                      &
+        ONLY:  vnest_anterpolate, vnest_anterpolate_e, vnest_boundary_conds,                       &
+               vnest_boundary_conds_khkm, vnest_deallocate, vnest_init_fine, vnest_start_time
+#endif
 
     USE virtual_measurement_mod,                                                                   &
@@ -377,9 +399,9 @@
 
 #if defined( _OPENACC )
-    USE arrays_3d,                                                             &
-        ONLY:  d, dd2zu, ddzu, ddzw, drho_air, drho_air_zw, dzw, heatflux_output_conversion, kh,   &
-               km, momentumflux_output_conversion, p, ptdf_x, ptdf_y, rdf, rdf_sc, rho_air,        &
-               rho_air_zw, tdiss_m, te_m, tpt_m, tu_m, tv_m, tw_m, ug, u_init, u_stokes_zu, vg,    &
-               v_init, v_stokes_zu, zu
+    USE arrays_3d,                                                                                 &
+        ONLY:  d, dd2zu, ddzu, ddzw, drho_air, drho_air_zw, dzw, e, heatflux_output_conversion,    &
+               kh, km, momentumflux_output_conversion, nc, nr, p, ptdf_x, ptdf_y, qc, qr, rdf,     &
+               rdf_sc, rho_air, rho_air_zw, s, tdiss_m, te_m, tpt_m, tu_m, tv_m, tw_m, ug, u_init, &
+               u_stokes_zu, vg, v_init, v_stokes_zu, w, zu
 
     USE control_parameters,                                                                        &
@@ -411,7 +433,9 @@
     INTEGER(iwp) ::  ig                  !< index for salsa gases
     INTEGER(iwp) ::  lsp                 !<
+    INTEGER(iwp) ::  mid                 !< masked output running index
+#if defined( __parallel )
     INTEGER(iwp) ::  lsp_usr             !<
-    INTEGER(iwp) ::  mid                 !< masked output running index
     INTEGER(iwp) ::  n                   !< loop counter for chemistry species
+#endif
 
     REAL(wp) ::  dt_3d_old  !< temporary storage of timestep to be used for
@@ -520,4 +544,6 @@
 !-- At beginning determine the first time step
     CALL timestep
+
+#if defined( __parallel )
 !
 !-- Synchronize the timestep in case of nested run.
@@ -528,4 +554,5 @@
        CALL pmci_synchronize
     ENDIF
+#endif
 
 !
@@ -558,4 +585,6 @@
 
        CALL cpu_log( log_point_s(10), 'timesteps', 'start' )
+
+#if defined( __parallel )
 !
 !--    Vertical nesting: initialize fine grid
@@ -568,4 +597,6 @@
           ENDIF
        ENDIF
+#endif
+
 !
 !--    Determine ug, vg and w_subs in dependence on data from external file 
@@ -764,10 +795,14 @@
 !--       Set the swap level for all modules
           CALL module_interface_swap_timelevel( MOD( timestep_count, 2) )
+
+#if defined( __parallel )
 !
 !--       Set the swap level for steering the pmc data transfer
           IF ( nested_run )  CALL pmci_set_swaplevel( MOD( timestep_count, 2) + 1 )  !> @todo: why the +1 ?
+#endif
 
           CALL cpu_log( log_point(28), 'swap_timelevel', 'stop' )
 
+#if defined( __parallel )
 !
 !--       Vertical nesting: Interpolate fine grid data to the coarse grid
@@ -886,4 +921,5 @@
 
           ENDIF
+#endif
 
 !
@@ -962,4 +998,5 @@
 
              IF (  vnest_init ) THEN
+#if defined( __parallel )
 !
 !--             Compute pressure in the CG, interpolate top boundary conditions
@@ -977,6 +1014,10 @@
                 CALL vnest_anterpolate_e
                 CALL cpu_log( log_point_s(28), 'vnest_anter_e', 'stop' )
+#else
+                CONTINUE
+#endif
 
              ELSE
+#if defined( __parallel )
 !
 !--             Mass (volume) flux correction to ensure global mass conservation for child domains.
@@ -988,5 +1029,5 @@
                    ENDIF
                 ENDIF
-
+#endif
                 CALL pres
 
@@ -1107,7 +1148,10 @@
              ENDIF
              CALL cpu_log( log_point(17), 'diffusivities', 'stop' )
+
+#if defined( __parallel )
 !
 !--          Vertical nesting: set fine grid eddy viscosity top boundary condition
              IF ( vnest_init )  CALL vnest_boundary_conds_khkm
+#endif
 
           ENDIF
@@ -1612,4 +1656,5 @@
        CALL timestep
 
+#if defined( __parallel )
 !
 !--    Synchronize the timestep in case of nested run.
@@ -1620,4 +1665,5 @@
           CALL pmci_synchronize
        ENDIF
+#endif
 
 !
@@ -1653,7 +1699,9 @@
 !$ACC END DATA
 
+#if defined( __parallel )
 !
 !-- Vertical nesting: Deallocate variables initialized for vertical nesting    
     IF ( vnest_init )  CALL vnest_deallocate
+#endif
 
     IF ( myid == 0 )  CALL finish_progress_bar
Index: /palm/trunk/SOURCE/time_integration_spinup.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration_spinup.f90	(revision 4443)
+++ /palm/trunk/SOURCE/time_integration_spinup.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Enable output of diagnostic quantities, e.g. 2-m temperature
 ! 
@@ -96,6 +99,8 @@
     USE pegrid
 
+#if defined( __parallel )
     USE pmc_interface,                                                         &
         ONLY:  nested_run
+#endif
 
     USE kinds
Index: /palm/trunk/SOURCE/timestep.f90
===================================================================
--- /palm/trunk/SOURCE/timestep.f90	(revision 4443)
+++ /palm/trunk/SOURCE/timestep.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Added missing OpenMP directives
 ! 
@@ -58,8 +61,12 @@
 
     USE control_parameters,                                                    &
-        ONLY:  cfl_factor, coupling_mode, dt_3d, dt_fixed, dt_max,             &
-               galilei_transformation, message_string, rans_mode,              &
-               stop_dt, terminate_coupled, terminate_coupled_remote,           &
-               timestep_reason, u_gtrans, use_ug_for_galilei_tr, v_gtrans
+        ONLY:  cfl_factor, dt_3d, dt_fixed, dt_max, galilei_transformation,    &
+               message_string, rans_mode, stop_dt, timestep_reason, u_gtrans,  &
+               use_ug_for_galilei_tr, v_gtrans
+
+#if defined( __parallel )
+    USE control_parameters,                                                    &
+        ONLY:  coupling_mode, terminate_coupled, terminate_coupled_remote
+#endif
 
     USE cpulog,                                                                &
@@ -88,6 +95,8 @@
                w_max, w_max_ijk
 
+#if defined( __parallel )
     USE vertical_nesting_mod,                                                  &
         ONLY:  vnested, vnest_timestep_sync
+#endif
 
     IMPLICIT NONE
@@ -115,8 +124,10 @@
     REAL(wp) ::  v_gtrans_l        !< 
  
+    REAL(wp), DIMENSION(2)         ::  uv_gtrans_l !<
+#if defined( __parallel )
     REAL(wp), DIMENSION(2)         ::  uv_gtrans   !< 
-    REAL(wp), DIMENSION(2)         ::  uv_gtrans_l !< 
     REAL(wp), DIMENSION(3)         ::  reduce      !< 
-    REAL(wp), DIMENSION(3)         ::  reduce_l    !< 
+    REAL(wp), DIMENSION(3)         ::  reduce_l    !<
+#endif
     REAL(wp), DIMENSION(nzb+1:nzt) ::  dxyz2_min   !<  
     !$ACC DECLARE CREATE(dxyz2_min)
@@ -382,7 +393,9 @@
     ENDIF
 
+#if defined( __parallel )
 !
 !-- Vertical nesting: coarse and fine grid timestep has to be identical    
     IF ( vnested )  CALL vnest_timestep_sync
+#endif
 
     CALL cpu_log( log_point(12), 'calculate_timestep', 'stop' )
Index: /palm/trunk/SOURCE/vertical_nesting_mod.f90
===================================================================
--- /palm/trunk/SOURCE/vertical_nesting_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/vertical_nesting_mod.f90	(revision 4444)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
 ! 
@@ -85,5 +88,5 @@
                                                                                !> identical in PARIN & PARIN_N
 
-
+#if defined( __parallel )
 
     INTEGER(iwp),DIMENSION(3,2)               :: bdims = 0        !> sub-domain grid topology of current PE
@@ -3968,3 +3971,4 @@
        END SUBROUTINE vnest_deallocate
 
+#endif
  END MODULE vertical_nesting_mod
Index: /palm/trunk/SOURCE/virtual_measurement_mod.f90
===================================================================
--- /palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4443)
+++ /palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4444)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix: cpp-directives for serial mode added
+! 
+! 4438 2020-03-03 20:49:28Z suehring
 ! Add cpu-log points
 ! 
@@ -868,6 +871,8 @@
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE     ::  ns_all !< dummy array used to sum-up the number of observation coordinates
 
+#if defined( __parallel )
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  ns_atmos !< number of observation points for each station on each mpi rank
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  ns_soil  !< number of observation points for each station on each mpi rank
+#endif
 
     INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  meas_flag !< mask array indicating measurement positions
