Index: /palm/trunk/SOURCE/Makefile
===================================================================
--- /palm/trunk/SOURCE/Makefile	(revision 4876)
+++ /palm/trunk/SOURCE/Makefile	(revision 4877)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# add dependency for init_3d_model
+#
+# 4828 2021-01-05 11:21:41Z Giersch
 # Add depedency for indoor model
 #
@@ -720,4 +723,5 @@
 	cpulog_mod.o \
 	disturb_heatflux.o \
+	exchange_horiz_mod.o \
 	large_scale_forcing_nudging_mod.o \
 	model_1d_mod.o \
Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 4876)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 4877)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Bugfix in initialization of vertical surfaces with roughness and surface heat fluxes
+!
+! 4848 2021-01-21 15:51:51Z gronemeier
 ! replaced use_syn_turb_gen by syn_turb_gen
 !
@@ -166,4 +169,7 @@
 
     USE control_parameters
+
+    USE exchange_horiz_mod,                                                                        &
+        ONLY:  exchange_horiz_2d
 
     USE grid_variables,                                                                            &
@@ -207,4 +213,5 @@
                pids_id,                                                                            &
                real_2d,                                                                            &
+               resize_array,                                                                       &
                vars_pids
 
@@ -1508,4 +1515,6 @@
 !--       Read variable
           CALL get_variable( pids_id, 'z0', tmp_2d%var, nxl, nxr, nys, nyn )
+          CALL resize_array( tmp_2d%var, nys, nyn, nxl, nxr )
+          CALL exchange_horiz_2d( tmp_2d%var )
 !
 !--       Initialize roughness length. Note, z0 will be only initialized at default-type surfaces.
@@ -1534,4 +1543,6 @@
 !--       Read variable
           CALL get_variable( pids_id, 'shf', tmp_2d%var, nxl, nxr, nys, nyn )
+          CALL resize_array( tmp_2d%var, nys, nyn, nxl, nxr )
+          CALL exchange_horiz_2d( tmp_2d%var )
 !
 !--       Initialize heat flux. Note, shf will be only initialized at default-type surfaces. At
@@ -1561,4 +1572,6 @@
 !--          Read variable
              CALL get_variable( pids_id, 'qsws', tmp_2d%var, nxl, nxr, nys, nyn )
+             CALL resize_array( tmp_2d%var, nys, nyn, nxl, nxr )
+             CALL exchange_horiz_2d( tmp_2d%var )
 !
 !--          Initialize latent heat flux. Note, qsws will be only initialized at default-type surfaces.
@@ -1590,4 +1603,6 @@
 !--          Read variable
              CALL get_variable( pids_id, 'ssws', tmp_2d%var, nxl, nxr, nys, nyn )
+             CALL resize_array( tmp_2d%var, nys, nyn, nxl, nxr )
+             CALL exchange_horiz_2d( tmp_2d%var )
 !
 !--          Initialize passive scalar flux. Initialize horizontal surface elements.
Index: /palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4876)
+++ /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4877)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Add interface for resize_array and add subroutine to resize 2d-real arrays
+!
+! 4828 2021-01-05 11:21:41Z Giersch
 ! Check if netCDF file actually exists before opening it for reading.
 !
@@ -787,4 +790,13 @@
     END INTERFACE get_attribute
 
+    INTERFACE resize_array
+       MODULE PROCEDURE resize_array_2d_int8
+       MODULE PROCEDURE resize_array_2d_int32
+       MODULE PROCEDURE resize_array_2d_real
+       MODULE PROCEDURE resize_array_3d_int8
+       MODULE PROCEDURE resize_array_3d_real
+       MODULE PROCEDURE resize_array_4d_real
+    END INTERFACE resize_array
+
 !
 !-- Public data structures
@@ -867,5 +879,6 @@
            netcdf_data_input_surface_data,                                                         &
            netcdf_data_input_topo,                                                                 &
-           open_read_file
+           open_read_file,                                                                         &
+           resize_array
 
 
@@ -3427,4 +3440,36 @@
 
  END SUBROUTINE resize_array_2d_int32
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Resize 2D float array: (nys:nyn,nxl:nxr) -> (nysg:nyng,nxlg:nxrg)
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE resize_array_2d_real( var, js, je, is, ie )
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  ie  !< upper index bound along x direction
+    INTEGER(iwp) ::  is  !< lower index bound along x direction
+    INTEGER(iwp) ::  je  !< upper index bound along y direction
+    INTEGER(iwp) ::  js  !< lower index bound along y direction
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  var     !< treated variable
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  var_tmp !< temporary copy
+!
+!-- Allocate temporary variable
+    ALLOCATE( var_tmp(js-nbgp:je+nbgp,is-nbgp:ie+nbgp) )
+!
+!-- Temporary copy of the variable
+    var_tmp(js:je,is:ie) = var(js:je,is:ie)
+!
+!-- Resize the array
+    DEALLOCATE( var )
+    ALLOCATE( var(js-nbgp:je+nbgp,is-nbgp:ie+nbgp) )
+!
+!-- Transfer temporary copy back to original array
+    var(js:je,is:ie) = var_tmp(js:je,is:ie)
+
+ END SUBROUTINE resize_array_2d_real
 
 
Index: /palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_mod.f90	(revision 4876)
+++ /palm/trunk/SOURCE/surface_mod.f90	(revision 4877)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix in init_single_surface_properties for vertical surfaces
+!
+! 4850 2021-01-21 17:59:25Z suehring
 ! +t_prev
 !
@@ -3106,5 +3109,5 @@
 
     REAL(wp), DIMENSION(1:ns) ::  var_surf  !< 1D surface variable that should be initialized
-    REAL(wp), DIMENSION(nys:nyn,nxl:nxr) ::  var_2d  !< input variable
+    REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  var_2d  !< input variable
 
     DO  m = 1, ns
