Index: /palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_2d.f90	(revision 4499)
+++ /palm/trunk/SOURCE/data_output_2d.f90	(revision 4500)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Unify output conversion of sensible and latent heat flux
+! 
+! 4457 2020-03-11 14:20:43Z raasch
 ! use statement for exchange horiz added
 ! 
@@ -94,5 +97,5 @@
 
     USE basic_constants_and_equations_mod,                                     &
-        ONLY:  c_p, lv_d_cp, l_v
+        ONLY:  lv_d_cp
 
     USE bulk_cloud_model_mod,                                                  &
@@ -716,5 +719,5 @@
                       j = surf_lsm_h%j(m)
                       k = surf_lsm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%qsws(m) * l_v
+                      local_pf(i,j,nzb+1) = surf_lsm_h%qsws(m) * waterflux_output_conversion(k)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
@@ -722,5 +725,5 @@
                       j = surf_usm_h%j(m)
                       k = surf_usm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%qsws(m) * l_v
+                      local_pf(i,j,nzb+1) = surf_usm_h%qsws(m) * waterflux_output_conversion(k)
                    ENDDO
                 ELSE
@@ -820,5 +823,5 @@
                       j = surf_lsm_h%j(m)
                       k = surf_lsm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%shf(m) * c_p
+                      local_pf(i,j,nzb+1) = surf_lsm_h%shf(m) * heatflux_output_conversion(k)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
@@ -826,5 +829,5 @@
                       j = surf_usm_h%j(m)
                       k = surf_usm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%shf(m) * c_p
+                      local_pf(i,j,nzb+1) = surf_usm_h%shf(m) * heatflux_output_conversion(k)
                    ENDDO
                 ELSE
Index: /palm/trunk/SOURCE/data_output_module.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_module.f90	(revision 4499)
+++ /palm/trunk/SOURCE/data_output_module.f90	(revision 4500)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Avoid uninitialized variables
+! 
+! 4481 2020-03-31 18:55:54Z maronga
 ! Enable character-array output
 !
@@ -392,5 +395,5 @@
     INTEGER ::  i             !< loop index
     INTEGER ::  j             !< loop index
-    INTEGER ::  ndims         !< number of dimensions in file
+    INTEGER ::  ndims = 0     !< number of dimensions in file
     INTEGER ::  return_value  !< return value
 
@@ -3400,5 +3403,5 @@
     INTEGER, INTENT(OUT) ::  return_value  !< return value
 
-    LOGICAL ::  found  !< true if dimension required by variable was found in dimension list
+    LOGICAL ::  found = .False. !< true if dimension required by variable was found in dimension list
 
     TYPE(dimension_type), DIMENSION(:), INTENT(IN) ::  dimensions  !< list of dimensions in file
Index: /palm/trunk/SOURCE/restart_data_mpi_io_mod.f90
===================================================================
--- /palm/trunk/SOURCE/restart_data_mpi_io_mod.f90	(revision 4499)
+++ /palm/trunk/SOURCE/restart_data_mpi_io_mod.f90	(revision 4500)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Fix too long lines
+! 
+! 4498 2020-04-15 14:26:31Z raasch
 ! bugfix for creation of filetypes, argument removed from rd_mpi_io_open
 ! 
@@ -1764,5 +1767,6 @@
              ELSE                                          ! read
 #if defined( __parallel )
-                IF ( debug_level >= 2 )  WRITE(9,'(a,8i8)') 'read block ', j, i, j_f, i_f, m_start_index(j_f,i_f), nr_bytes_f, disp_f
+                IF ( debug_level >= 2 )  WRITE(9,'(a,8i8)') 'read block ', j, i, j_f, i_f, &
+                                                            m_start_index(j_f,i_f), nr_bytes_f, disp_f
                 CALL MPI_FILE_SEEK( fh, disp_f, MPI_SEEK_SET, ierr )
                 nr_words = nr_bytes_f / wp
@@ -1789,5 +1793,6 @@
          IF ( debug_level >= 2 .AND. nr_val > 0 )  WRITE(9,*)  'r_surf ', TRIM( name ), ' ', nr_val, SUM( data(1:nr_val) )
       ELSE
-         IF ( debug_level >= 2 .AND. nr_val > 0 )  WRITE(9,*)  'r_surf_next ', TRIM( name ), ' ', lo_first_index,nr_val, SUM( data(1:nr_val) )
+         IF ( debug_level >= 2 .AND. nr_val > 0 )  WRITE(9,*)  'r_surf_next ', TRIM( name ), ' ', &
+                                                               lo_first_index,nr_val, SUM( data(1:nr_val) )
       ENDIF
 
@@ -1895,5 +1900,6 @@
        IF ( debug_level >= 2 .AND. nr_val  > 0 )  WRITE(9,*) 'w_surf ', TRIM( name ), ' ', nr_val, SUM( data(1:nr_val) )
     ELSE
-       IF ( debug_level >= 2 .AND. nr_val  > 0 ) WRITE(9,*) 'w_surf_n ', TRIM( name ), ' ', lo_first_index, nr_val, SUM( data(1:nr_val) )
+       IF ( debug_level >= 2 .AND. nr_val  > 0 ) WRITE(9,*) 'w_surf_n ', TRIM( name ), ' ', &
+                                                            lo_first_index, nr_val, SUM( data(1:nr_val) )
     ENDIF
 
Index: /palm/trunk/SOURCE/surface_data_output_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4499)
+++ /palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4500)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! - Correct output of ground/wall heat flux at USM surfaces
+! - Add conversion factor to heat and momentum-flux output
+!
+! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
 ! 
@@ -106,10 +110,15 @@
    USE kinds
 
-   USE arrays_3d,                                                              &
-       ONLY:  zu, zw
-
-   USE control_parameters,                                                     &
-       ONLY:  coupling_char, data_output_during_spinup, end_time,              &
-              message_string, restart_data_format_output, run_description_header, simulated_time_at_begin, &
+   USE arrays_3d,                                                                                  &
+       ONLY:  heatflux_output_conversion,                                                          &
+              momentumflux_output_conversion,                                                      &
+              waterflux_output_conversion,                                                         &
+              zu,                                                                                  &
+              zw
+
+   USE control_parameters,                                                                         &
+       ONLY:  coupling_char, data_output_during_spinup, end_time,                                  &
+              message_string,                                                                      &
+              restart_data_format_output, run_description_header, simulated_time_at_begin,         &
               spinup_time, surface_output
 
@@ -137,7 +146,14 @@
        ONLY:  rrd_mpi_io, wrd_mpi_io
 
-   USE surface_mod,                                                            &
-       ONLY:  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v,                  &
-              surf_usm_h, surf_usm_v
+   USE surface_mod,                                                                                &
+       ONLY:  ind_pav_green,                                                                       &
+              ind_veg_wall,                                                                        &
+              ind_wat_win,                                                                         &
+              surf_def_h,                                                                          &
+              surf_def_v,                                                                          &
+              surf_lsm_h,                                                                          &
+              surf_lsm_v,                                                                          &
+              surf_usm_h,                                                                          &
+              surf_usm_v
 
    IMPLICIT NONE
@@ -1432,4 +1448,6 @@
       INTEGER(iwp) ::  av     !< id indicating average or non-average data output
       INTEGER(iwp) ::  i      !< loop index
+      INTEGER(iwp) ::  l      !< running index for surface orientation
+      INTEGER(iwp) ::  m      !< running index for surface elements
       INTEGER(iwp) ::  n_out  !< counter variables for surface output
 
@@ -1957,5 +1975,6 @@
                                                surf_def_v(3)%usws,             &
                                                surf_lsm_v(3)%usws,             &
-                                               surf_usm_v(3)%usws )
+                                               surf_usm_v(3)%usws,             &
+                                               momentumflux_output_conversion )
                ELSE
 !
@@ -1986,5 +2005,6 @@
                                                surf_def_v(3)%vsws,             &
                                                surf_lsm_v(3)%vsws,             &
-                                               surf_usm_v(3)%vsws )
+                                               surf_usm_v(3)%vsws,             &
+                                               momentumflux_output_conversion )
                ELSE
 !
@@ -2015,5 +2035,6 @@
                                                surf_def_v(3)%shf,              &
                                                surf_lsm_v(3)%shf,              &
-                                               surf_usm_v(3)%shf )
+                                               surf_usm_v(3)%shf,              &
+                                               heatflux_output_conversion )
                ELSE
 !
@@ -2043,5 +2064,6 @@
                                                surf_def_v(3)%qsws,             &
                                                surf_lsm_v(3)%qsws,             &
-                                               surf_usm_v(3)%qsws )
+                                               surf_usm_v(3)%qsws,             &
+                                               waterflux_output_conversion )
                ELSE
 !
@@ -2463,4 +2485,27 @@
 !--            Output of instantaneous data
                IF ( av == 0 )  THEN
+!
+!--               Sum up ground / wall heat flux. Note, for urban surfaces the 
+!--               wall heat flux is aggregated from the different green, window
+!--               and wall tiles.
+                  DO  m = 1, surf_usm_h%ns
+                     surf_usm_h%ghf(m) = surf_usm_h%frac(m,ind_veg_wall)       &
+                                       * surf_usm_h%wghf_eb(m) +               &
+                                         surf_usm_h%frac(m,ind_pav_green)      &
+                                       * surf_usm_h%wghf_eb_green(m) +         &
+                                         surf_usm_h%frac(m,ind_wat_win)        &
+                                       * surf_usm_h%wghf_eb_window(m)
+                  ENDDO
+                  DO  l = 0, 3
+                     DO  m = 1, surf_usm_v(l)%ns
+                        surf_usm_v(l)%ghf(m) = surf_usm_v(l)%frac(m,ind_veg_wall) &
+                                             * surf_usm_v(l)%wghf_eb(m) +          &
+                                               surf_usm_v(l)%frac(m,ind_pav_green) &
+                                             * surf_usm_v(l)%wghf_eb_green(m) +    &
+                                               surf_usm_v(l)%frac(m,ind_wat_win)   &
+                                             * surf_usm_v(l)%wghf_eb_window(m)
+                     ENDDO
+                  ENDDO
+
                   CALL surface_data_output_collect( surf_def_h(0)%ghf,         &
                                                surf_def_h(1)%ghf,              &
@@ -2479,5 +2524,5 @@
                                                surf_lsm_v(3)%ghf,              &
                                                surf_usm_v(3)%ghf )
-                                                                        ELSE
+               ELSE
 !
 !--               Output of averaged data
@@ -2955,4 +3000,6 @@
       CHARACTER(LEN=100) ::  trimvar !< dummy variable for current output variable
 
+      INTEGER(iwp) ::  l      !< running index for surface orientation
+      INTEGER(iwp) ::  m      !< running index for surface elements
       INTEGER(iwp) ::  n_out  !< counter variables for surface output
 
@@ -3251,5 +3298,6 @@
                                            surf_def_v(3)%usws,                 &
                                            surf_lsm_v(3)%usws,                 &
-                                           surf_usm_v(3)%usws, n_out )
+                                           surf_usm_v(3)%usws, n_out,          &
+                                           momentumflux_output_conversion )
 
             CASE ( 'vsws' )
@@ -3269,5 +3317,6 @@
                                            surf_def_v(3)%vsws,                 &
                                            surf_lsm_v(3)%vsws,                 &
-                                           surf_usm_v(3)%vsws, n_out )
+                                           surf_usm_v(3)%vsws, n_out,          &
+                                           momentumflux_output_conversion )
 
             CASE ( 'shf' )
@@ -3287,5 +3336,6 @@
                                            surf_def_v(3)%shf,                  &
                                            surf_lsm_v(3)%shf,                  &
-                                           surf_usm_v(3)%shf, n_out )
+                                           surf_usm_v(3)%shf, n_out,          &
+                                           heatflux_output_conversion )
 
             CASE ( 'qsws' )
@@ -3305,5 +3355,6 @@
                                            surf_def_v(3)%qsws,                 &
                                            surf_lsm_v(3)%qsws,                 &
-                                           surf_usm_v(3)%qsws, n_out )
+                                           surf_usm_v(3)%qsws, n_out,          &
+                                           waterflux_output_conversion )
 
             CASE ( 'ssws' )
@@ -3561,4 +3612,27 @@
 
             CASE ( 'ghf' )
+!
+!--            Sum up ground / wall heat flux. Note, for urban surfaces the 
+!--            wall heat flux is aggregated from the different green, window
+!--            and wall tiles.
+               DO  m = 1, surf_usm_h%ns
+                  surf_usm_h%ghf(m) = surf_usm_h%frac(m,ind_veg_wall)          &
+                                    * surf_usm_h%wghf_eb(m) +                  &
+                                      surf_usm_h%frac(m,ind_pav_green)         &
+                                    * surf_usm_h%wghf_eb_green(m) +            &
+                                      surf_usm_h%frac(m,ind_wat_win)           &
+                                    * surf_usm_h%wghf_eb_window(m)
+               ENDDO
+               DO  l = 0, 3
+                  DO  m = 1, surf_usm_v(l)%ns
+                     surf_usm_v(l)%ghf(m) = surf_usm_v(l)%frac(m,ind_veg_wall) &
+                                          * surf_usm_v(l)%wghf_eb(m) +         &
+                                            surf_usm_v(l)%frac(m,ind_pav_green)&
+                                          * surf_usm_v(l)%wghf_eb_green(m) +   &
+                                            surf_usm_v(l)%frac(m,ind_wat_win)  &
+                                          * surf_usm_v(l)%wghf_eb_window(m)
+                  ENDDO
+               ENDDO
+
                CALL surface_data_output_sum_up( surf_def_h(0)%ghf,             &
                                            surf_def_h(1)%ghf,                  &
@@ -3846,11 +3920,16 @@
                                      var_def_v1, var_lsm_v1, var_usm_v1,       &
                                      var_def_v2, var_lsm_v2, var_usm_v2,       &
-                                     var_def_v3, var_lsm_v3, var_usm_v3, n_out )
+                                     var_def_v3, var_lsm_v3, var_usm_v3, n_out,&
+                                     fac )
 
       IMPLICIT NONE
 
+      INTEGER(iwp) ::  k          !< height index of surface element
       INTEGER(iwp) ::  m          !< running index for surface elements
       INTEGER(iwp) ::  n_out      !< index for output variable
       INTEGER(iwp) ::  n_surf     !< running index for surface elements
+
+      REAL(wp), DIMENSION(:), OPTIONAL                ::  fac               !< passed output conversion factor for heatflux output
+      REAL(wp), DIMENSION(nzb:nzt+1)                  ::  conversion_factor !< effective array for output conversion factor
 
       REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_h0 !< output variable at upward-facing default-type surfaces
@@ -3872,4 +3951,11 @@
 
 !
+!--   Set conversion factor to one if not present
+      IF ( .NOT. PRESENT( fac ) )  THEN
+         conversion_factor = 1.0_wp
+      ELSE
+         conversion_factor = fac
+      ENDIF
+!
 !--   Set counter variable to zero before the variable is written to
 !--   the output array.
@@ -3888,6 +3974,7 @@
          DO  m = 1, surf_def_h(0)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_def_h(0)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_def_h0(m)
+                                          + var_def_h0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3897,6 +3984,7 @@
          DO  m = 1, surf_def_h(1)%ns
             n_surf                   = n_surf + 1
+            k                             = surf_def_h(1)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_def_h1(m)
+                                          + var_def_h1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3906,6 +3994,7 @@
          DO  m = 1, surf_lsm_h%ns
             n_surf                        = n_surf + 1
+            k                             = surf_lsm_h%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_lsm_h(m)
+                                          + var_lsm_h(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3915,6 +4004,7 @@
          DO  m = 1, surf_usm_h%ns
             n_surf                        = n_surf + 1
+            k                             = surf_usm_h%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_usm_h(m)
+                                          + var_usm_h(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3926,6 +4016,7 @@
          DO  m = 1, surf_def_v(0)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_def_v(0)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_def_v0(m)
+                                          + var_def_v0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3935,6 +4026,7 @@
          DO  m = 1, surf_lsm_v(0)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(0)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_lsm_v0(m)
+                                          + var_lsm_v0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3944,6 +4036,7 @@
          DO  m = 1, surf_usm_v(0)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_usm_v(0)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_usm_v0(m)
+                                          + var_usm_v0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3955,6 +4048,7 @@
          DO  m = 1, surf_def_v(1)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_def_v(1)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_def_v1(m)
+                                          + var_def_v1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3964,6 +4058,7 @@
          DO  m = 1, surf_lsm_v(1)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(1)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_lsm_v1(m)
+                                          + var_lsm_v1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3973,6 +4068,7 @@
          DO  m = 1, surf_usm_v(1)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_usm_v(1)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_usm_v1(m)
+                                          + var_usm_v1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3984,6 +4080,7 @@
          DO  m = 1, surf_def_v(2)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_def_v(2)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_def_v2(m)
+                                          + var_def_v2(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -3993,6 +4090,7 @@
          DO  m = 1, surf_lsm_v(2)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(2)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_lsm_v2(m)
+                                          + var_lsm_v2(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4002,6 +4100,7 @@
          DO  m = 1, surf_usm_v(2)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_usm_v(2)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_usm_v2(m)
+                                          + var_usm_v2(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4013,6 +4112,7 @@
          DO  m = 1, surf_def_v(3)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_def_v(3)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_def_v3(m)
+                                          + var_def_v3(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4022,6 +4122,7 @@
          DO  m = 1, surf_lsm_v(3)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(3)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_lsm_v3(m)
+                                          + var_lsm_v3(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4031,6 +4132,7 @@
          DO  m = 1, surf_usm_v(3)%ns
             n_surf                        = n_surf + 1
+            k                             = surf_usm_v(3)%k(m)
             surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)      &
-                                          + var_usm_v3(m)
+                                          + var_usm_v3(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4050,10 +4152,15 @@
                                       var_def_v1, var_lsm_v1, var_usm_v1,      &
                                       var_def_v2, var_lsm_v2, var_usm_v2,      &
-                                      var_def_v3, var_lsm_v3, var_usm_v3 )
+                                      var_def_v3, var_lsm_v3, var_usm_v3,      &
+                                      fac )
 
       IMPLICIT NONE
 
+      INTEGER(iwp) ::  k      !< height index of surface element
       INTEGER(iwp) ::  m      !< running index for surface elements
       INTEGER(iwp) ::  n_surf !< running index for surface elements
+
+      REAL(wp), DIMENSION(:), OPTIONAL                ::  fac               !< passed output conversion factor for heatflux output
+      REAL(wp), DIMENSION(nzb:nzt+1)                  ::  conversion_factor !< effective array for output conversion factor
 
       REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_h0 !< output variable at upward-facing default-type surfaces
@@ -4075,8 +4182,14 @@
 
 !
+!--   Set conversion factor to one if not present
+      IF ( .NOT. PRESENT( fac ) )  THEN
+         conversion_factor = 1.0_wp
+      ELSE
+         conversion_factor = fac
+      ENDIF
+!
 !--   Set counter variable to zero before the variable is written to
 !--   the output array.
       n_surf = 0
-
 !
 !--   Write the horizontal surfaces.
@@ -4085,5 +4198,5 @@
 !--   If a variable is not defined, skip the block and increment the counter
 !--   variable by the number of surface elements of this type. Usually this
-!--   is zere, however, there might be the situation that e.g. urban surfaces
+!--   is zero, however, there might be the situation that e.g. urban surfaces
 !--   are defined but the respective variable is not allocated for this surface
 !--   type. To write the data on the exact position, increment the counter.
@@ -4091,5 +4204,6 @@
          DO  m = 1, surf_def_h(0)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_def_h0(m)
+            k                        = surf_def_h(0)%k(m)
+            surfaces%var_out(n_surf) = var_def_h0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4099,5 +4213,6 @@
          DO  m = 1, surf_def_h(1)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_def_h1(m)
+            k                        = surf_def_h(1)%k(m)
+            surfaces%var_out(n_surf) = var_def_h1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4107,5 +4222,6 @@
          DO  m = 1, surf_lsm_h%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_lsm_h(m)
+            k                        = surf_lsm_h%k(m)
+            surfaces%var_out(n_surf) = var_lsm_h(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4115,5 +4231,6 @@
          DO  m = 1, surf_usm_h%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_usm_h(m)
+            k                        = surf_usm_h%k(m)
+            surfaces%var_out(n_surf) = var_usm_h(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4125,5 +4242,6 @@
          DO  m = 1, surf_def_v(0)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_def_v0(m)
+            k                        = surf_def_v(0)%k(m)
+            surfaces%var_out(n_surf) = var_def_v0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4133,5 +4251,6 @@
          DO  m = 1, surf_lsm_v(0)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_lsm_v0(m)
+            k                        = surf_lsm_v(0)%k(m)
+            surfaces%var_out(n_surf) = var_lsm_v0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4141,5 +4260,6 @@
          DO  m = 1, surf_usm_v(0)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_usm_v0(m)
+            k                        = surf_usm_v(0)%k(m)
+            surfaces%var_out(n_surf) = var_usm_v0(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4151,5 +4271,6 @@
          DO  m = 1, surf_def_v(1)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_def_v1(m)
+            k                        = surf_def_v(1)%k(m)
+            surfaces%var_out(n_surf) = var_def_v1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4159,5 +4280,6 @@
          DO  m = 1, surf_lsm_v(1)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_lsm_v1(m)
+            k                        = surf_lsm_v(1)%k(m)
+            surfaces%var_out(n_surf) = var_lsm_v1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4167,5 +4289,6 @@
          DO  m = 1, surf_usm_v(1)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_usm_v1(m)
+            k                        = surf_usm_v(1)%k(m)
+            surfaces%var_out(n_surf) = var_usm_v1(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4177,5 +4300,6 @@
          DO  m = 1, surf_def_v(2)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_def_v2(m)
+            k                        = surf_def_v(2)%k(m)
+            surfaces%var_out(n_surf) = var_def_v2(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4185,5 +4309,6 @@
          DO  m = 1, surf_lsm_v(2)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_lsm_v2(m)
+            k                        = surf_lsm_v(2)%k(m)
+            surfaces%var_out(n_surf) = var_lsm_v2(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4193,5 +4318,6 @@
          DO  m = 1, surf_usm_v(2)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_usm_v2(m)
+            k                        = surf_usm_v(2)%k(m)
+            surfaces%var_out(n_surf) = var_usm_v2(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4203,5 +4329,6 @@
          DO  m = 1, surf_def_v(3)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_def_v3(m)
+            k                        = surf_def_v(3)%k(m)
+            surfaces%var_out(n_surf) = var_def_v3(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4211,5 +4338,6 @@
          DO  m = 1, surf_lsm_v(3)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_lsm_v3(m)
+            k                        = surf_lsm_v(3)%k(m)
+            surfaces%var_out(n_surf) = var_lsm_v3(m) * conversion_factor(k)
          ENDDO
       ELSE
@@ -4219,5 +4347,6 @@
          DO  m = 1, surf_usm_v(3)%ns
             n_surf                   = n_surf + 1
-            surfaces%var_out(n_surf) = var_usm_v3(m)
+            k                        = surf_usm_v(3)%k(m)
+            surfaces%var_out(n_surf) = var_usm_v3(m) * conversion_factor(k)
          ENDDO
       ELSE
Index: /palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4499)
+++ /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4500)
@@ -28,4 +28,8 @@
 ! -----------------
 ! $Id$
+! Allocate array for wall heat flux, which is further used to aggregate tile
+! fractions in the surface output
+! 
+! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
 ! 
@@ -1122,5 +1126,5 @@
         ENDDO
 !
-!--     allocate wall heat flux output array and set initial values. For horizontal surfaces
+!--     Allocate wall heat flux output arrays and set initial values. For horizontal surfaces
 !        ALLOCATE ( surf_usm_h%wshf(1:surf_usm_h%ns)    )  !can be removed 
         ALLOCATE ( surf_usm_h%wshf_eb(1:surf_usm_h%ns) )
@@ -1130,4 +1134,5 @@
         ALLOCATE ( surf_usm_h%iwghf_eb(1:surf_usm_h%ns) )
         ALLOCATE ( surf_usm_h%iwghf_eb_window(1:surf_usm_h%ns) )
+        ALLOCATE ( surf_usm_h%ghf(1:surf_usm_h%ns) )
         IF ( ALLOCATED( surf_usm_h%wshf    ) )  surf_usm_h%wshf    = 0.0_wp
         IF ( ALLOCATED( surf_usm_h%wshf_eb ) )  surf_usm_h%wshf_eb = 0.0_wp
@@ -1137,4 +1142,5 @@
         IF ( ALLOCATED( surf_usm_h%iwghf_eb ) )  surf_usm_h%iwghf_eb = 0.0_wp
         IF ( ALLOCATED( surf_usm_h%iwghf_eb_window ) )  surf_usm_h%iwghf_eb_window = 0.0_wp
+        IF ( ALLOCATED( surf_usm_h%ghf ) )  surf_usm_h%ghf = 0.0_wp
 !
 !--     Now, for vertical surfaces
@@ -1147,4 +1153,5 @@
            ALLOCATE ( surf_usm_v(l)%iwghf_eb(1:surf_usm_v(l)%ns) )
            ALLOCATE ( surf_usm_v(l)%iwghf_eb_window(1:surf_usm_v(l)%ns) )
+           ALLOCATE ( surf_usm_v(l)%ghf(1:surf_usm_v(l)%ns) )
            IF ( ALLOCATED( surf_usm_v(l)%wshf    ) )  surf_usm_v(l)%wshf    = 0.0_wp
            IF ( ALLOCATED( surf_usm_v(l)%wshf_eb ) )  surf_usm_v(l)%wshf_eb = 0.0_wp
@@ -1154,4 +1161,5 @@
            IF ( ALLOCATED( surf_usm_v(l)%iwghf_eb ) )  surf_usm_v(l)%iwghf_eb = 0.0_wp
            IF ( ALLOCATED( surf_usm_v(l)%iwghf_eb_window ) )  surf_usm_v(l)%iwghf_eb_window = 0.0_wp
+           IF ( ALLOCATED( surf_usm_v(l)%ghf ) )  surf_usm_v(l)%ghf = 0.0_wp
         ENDDO
 !
