Index: palm/trunk/SOURCE/chem_emissions_mod.f90
===================================================================
--- palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 4355)
+++ palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 4356)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! Minor formatting adjustment
+! 
+! 4242 2019-09-27 12:59:10Z suehring
 ! Adjust index_hh access to new definition accompanied with new 
 ! palm_date_time_mod. Note, this is just a preleminary fix. (E Chan)
@@ -934,5 +937,5 @@
         ONLY: days_per_week, get_date_time, hours_per_day, months_per_year, seconds_per_day
    
- IMPLICIT NONE
+    IMPLICIT NONE
   
 
Index: palm/trunk/SOURCE/init_grid.f90
===================================================================
--- palm/trunk/SOURCE/init_grid.f90	(revision 4355)
+++ palm/trunk/SOURCE/init_grid.f90	(revision 4356)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Revise error messages for generic tunnel setup.
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -2073,8 +2076,21 @@
           ENDIF
 !
-!--       Tunnel axis along y
+!--       Check for too small tunnel width in x- and y-direction
+          IF ( tunnel_width_x /= 9999999.9_wp  .AND.                           &   
+               tunnel_width_x - 2.0_wp * td <= 2.0_wp * dx )  THEN
+             message_string = 'tunnel_width_x too small'
+             CALL message( 'init_grid', 'PA0175', 1, 2, 0, 6, 0 )
+          ENDIF
+          IF ( tunnel_width_y /= 9999999.9_wp  .AND.                           &
+               tunnel_width_y - 2.0_wp * td <= 2.0_wp * dy )  THEN
+             message_string = 'tunnel_width_y too small'
+             CALL message( 'init_grid', 'PA0455', 1, 2, 0, 6, 0 )
+          ENDIF
+!
+!--       Check for too large tunnel width. 
+!--       Tunnel axis along y.
           IF ( tunnel_width_x /= 9999999.9_wp )  THEN
              IF ( tunnel_width_x > ( nx + 1 ) * dx )  THEN
-                message_string = 'Tunnel width too large'
+                message_string = 'tunnel_width_x too large'
                 CALL message( 'init_grid', 'PA0282', 1, 2, 0, 6, 0 )
              ENDIF
@@ -2092,21 +2108,9 @@
              tye_in  = tye_out
           ENDIF
-          IF ( tunnel_width_x /= 9999999.9_wp  .AND.                           &   
-               tunnel_width_x - 2.0_wp * td <= 2.0_wp * dx )                   &
-          THEN
-             message_string = 'Tunnel width too small'
-             CALL message( 'init_grid', 'PA0175', 1, 2, 0, 6, 0 )
-          ENDIF
-          IF ( tunnel_width_y /= 9999999.9_wp  .AND.                           &
-               tunnel_width_y - 2.0_wp * td <= 2.0_wp * dy )                   &
-          THEN
-             message_string = 'Tunnel width too small'
-             CALL message( 'init_grid', 'PA0455', 1, 2, 0, 6, 0 )
-          ENDIF
-!
-!--       Tunnel axis along x
+!
+!--       Tunnel axis along x.
           IF ( tunnel_width_y /= 9999999.9_wp )  THEN
              IF ( tunnel_width_y > ( ny + 1 ) * dy )  THEN
-                message_string = 'Tunnel width too large'
+                message_string = 'tunnel_width_y too large'
                 CALL message( 'init_grid', 'PA0456', 1, 2, 0, 6, 0 )
              ENDIF
Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4355)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4356)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Correct single message calls, local checks must be given by the respective
+! mpi rank.
+! 
+! 4339 2019-12-13 18:18:30Z suehring
 ! Bugfix, character length too short, caused crash on NEC.
 ! 
@@ -4856,5 +4860,5 @@
           message_string = 'For non-pavement surfaces the combination ' //     &
                            ' lai = 0.0 and c_veg = 1.0 is not allowed.'
-          CALL message( 'lsm_rrd_local', 'PA0671', 2, 2, 0, 6, 0 )
+          CALL message( 'lsm_rrd_local', 'PA0671', 2, 2, myid, 6, 0 )
        ENDIF
 
@@ -4865,5 +4869,5 @@
              message_string = 'For non-pavement surfaces the combination ' //  &
                               ' lai = 0.0 and c_veg = 1.0 is not allowed.'
-             CALL message( 'lsm_rrd_local', 'PA0671', 2, 2, 0, 6, 0 )
+             CALL message( 'lsm_rrd_local', 'PA0671', 2, 2, myid, 6, 0 )
           ENDIF
        ENDDO
Index: palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4355)
+++ palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4356)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Correct single message calls, local checks must be given by the respective
+! mpi rank.
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -3495,5 +3499,5 @@
                 message_string = 'If vegetation_type = 0 at any location, ' // &
                                  'vegetation_pars is required'
-                CALL message( 'netcdf_data_input_mod', 'PA0555', 2, 2, -1, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0555', 2, 2, myid, 6, 0 )
              ENDIF
              IF ( .NOT. root_area_density_lsm_f%from_file )  THEN
@@ -3528,5 +3532,5 @@
           message_string = 'If buildings are provided, also building_type ' // &
                            'is required'
-          CALL message( 'netcdf_data_input_mod', 'PA0581', 2, 2, myid, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0581', 2, 2, 0, 6, 0 )
        ENDIF
 !
@@ -3535,5 +3539,5 @@
           message_string = 'If buildings are provided, also building_id ' //   &
                            'is required'
-          CALL message( 'netcdf_data_input_mod', 'PA0582', 2, 2, myid, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0582', 2, 2, 0, 6, 0 )
        ENDIF
 !
@@ -3555,5 +3559,5 @@
           message_string = 'If building_type is provided, also building_id '// &
                            'is required'
-          CALL message( 'netcdf_data_input_mod', 'PA0519', 2, 2, myid, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0519', 2, 2, 0, 6, 0 )
        ENDIF       
 !
@@ -4838,5 +4842,5 @@
                    'non-building coordinates (xs, ys, zenith, azimuth): ',   &
                    xs(isurf), ys(isurf), zenith(isurf), azimuth(isurf)
-                CALL message( 'get_variable_surf', 'PA0684', 2, 2, 0, 6, 0 ) 
+                CALL message( 'get_variable_surf', 'PA0684', 2, 2, myid, 6, 0 ) 
              ENDIF
 !
Index: palm/trunk/SOURCE/plant_canopy_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4355)
+++ palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4356)
@@ -27,4 +27,8 @@
 ! -----------------
 ! $Id$
+! Correct single message call, local check must be given by the respective
+! mpi rank.
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -1126,9 +1130,8 @@
 !--          Check whether topography and local vegetation on top exceed 
 !--          height of the model domain.
-             k = topo_top_ind(j,i,0)
-             IF ( k + pch_index_ji(j,i) >= nzt + 1 )  THEN
+             IF ( topo_top_ind(j,i,0) + pch_index_ji(j,i) >= nzt + 1 )  THEN
                 message_string =  'Local vegetation height on top of ' //      &
                                   'topography exceeds height of model domain.'
-                CALL message( 'pcm_init', 'PA0674', 2, 2, 0, 6, 0 )
+                CALL message( 'pcm_init', 'PA0674', 2, 2, myid, 6, 0 )
              ENDIF
 
Index: palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4355)
+++ palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4356)
@@ -25,4 +25,9 @@
 ! -----------------
 ! $Id$
+! Change automatic arrays to allocatable ones in rrd_local, in order to avoid
+! memory problems due to too small stack size for large jobs with intel 
+! compiler. (J.Resler)
+! 
+! 4331 2019-12-10 18:25:02Z suehring
 ! Enable restart data for 2-m potential temperature output
 ! 
@@ -1050,10 +1055,10 @@
     INTEGER(iwp), DIMENSION(numprocs_previous_run) ::  overlap_count   !<
 
-    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nxlfa      !<
-    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nxrfa      !<
-    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nynfa      !<
-    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nysfa      !<
-    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  offset_xa  !<
-    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  offset_ya  !<
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nxlfa      !<
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nxrfa      !<
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nynfa      !<
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nysfa      !<
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  offset_xa  !<
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  offset_ya  !<
 
     INTEGER(isp), DIMENSION(:,:),   ALLOCATABLE ::  tmp_2d_id_random   !< temporary array for storing random generator data
@@ -1070,4 +1075,14 @@
 !-- Read data from previous model run.
     CALL cpu_log( log_point_s(14), 'rrd_local', 'start' )
+!
+!-- Allocate temporary buffer arrays. In previous versions, there were 
+!-- declared as automated arrays, causing memory problems when these
+!-- were allocate on stack.
+    ALLOCATE( nxlfa(numprocs_previous_run,1000) )
+    ALLOCATE( nxrfa(numprocs_previous_run,1000) )
+    ALLOCATE( nynfa(numprocs_previous_run,1000) )
+    ALLOCATE( nysfa(numprocs_previous_run,1000) )
+    ALLOCATE( offset_xa(numprocs_previous_run,1000) )
+    ALLOCATE( offset_ya(numprocs_previous_run,1000) )
 
 !
@@ -1793,5 +1808,4 @@
 
        ENDDO ! dataloop
-
 !
 !--    Close the restart file
@@ -1801,5 +1815,12 @@
 
     ENDDO  ! loop over restart files
-
+!
+!-- Deallocate temporary buffer arrays
+    DEALLOCATE( nxlfa )
+    DEALLOCATE( nxrfa )
+    DEALLOCATE( nynfa )
+    DEALLOCATE( nysfa )
+    DEALLOCATE( offset_xa )
+    DEALLOCATE( offset_ya )
 !
 !-- Restore the original filename for the restart file to be written
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 4355)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 4356)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Bugfix, hour_call_emis uninitialized at first call of time_integration
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -390,14 +393,14 @@
     CHARACTER (LEN=9) ::  time_to_string   !<
 
-    INTEGER(iwp) ::  hour            !< hour of current time
-    INTEGER(iwp) ::  hour_call_emis  !< last hour where emission was called
-    INTEGER(iwp) ::  ib              !< index for aerosol size bins
-    INTEGER(iwp) ::  ic              !< index for aerosol mass bins
-    INTEGER(iwp) ::  icc             !< additional index for aerosol mass bins
-    INTEGER(iwp) ::  ig              !< index for salsa gases
-    INTEGER(iwp) ::  lsp             !<
-    INTEGER(iwp) ::  lsp_usr         !<
-    INTEGER(iwp) ::  mid             !< masked output running index
-    INTEGER(iwp) ::  n               !< loop counter for chemistry species
+    INTEGER(iwp) ::  hour                !< hour of current time
+    INTEGER(iwp) ::  hour_call_emis = -1 !< last hour where emission was called
+    INTEGER(iwp) ::  ib                  !< index for aerosol size bins
+    INTEGER(iwp) ::  ic                  !< index for aerosol mass bins
+    INTEGER(iwp) ::  icc                 !< additional index for aerosol mass bins
+    INTEGER(iwp) ::  ig                  !< index for salsa gases
+    INTEGER(iwp) ::  lsp                 !<
+    INTEGER(iwp) ::  lsp_usr             !<
+    INTEGER(iwp) ::  mid                 !< masked output running index
+    INTEGER(iwp) ::  n                   !< loop counter for chemistry species
 
     REAL(wp) ::  dt_3d_old  !< temporary storage of timestep to be used for
