Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 4887)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 4888)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Output ghf and r_a as sum of all horizontally upward-facing surfaces in LSM+USM simulations
+!
+! 4828 2021-01-05 11:21:41Z Giersch
 ! Implement relative humidity as diagnostic output quantity
 !
@@ -103,4 +106,5 @@
 !>       up according to the staggered grid. However, this implies no error since staggered velocity
 !>       components are zero at the walls and inside buildings.
+!> @todo Revise output steering of land-surface and urban-surface output quantities
 !--------------------------------------------------------------------------------------------------!
  SUBROUTINE flow_statistics
@@ -129,4 +133,5 @@
                 large_scale_subsidence, max_pr_salsa, max_pr_user, message_string, neutral,        &
                 ocean_mode, passive_scalar, salsa, simulated_time, simulated_time_at_begin,        &
+                urban_surface,                                                                     &
                 use_subsidence_tendencies, use_surface_fluxes, use_top_fluxes, ws_scheme_mom,      &
                 ws_scheme_sca
@@ -1466,4 +1471,21 @@
        ENDIF
 !
+!--    Treat urban-surface quantities according to new wall model structure. Here, ghf and r_a are
+!--    added on top of LSM sums.
+       IF ( land_surface  .AND.  urban_surface )  THEN
+          tn = 0
+          !$OMP PARALLEL PRIVATE( i, j, m, tn )
+          !$ tn = omp_get_thread_num()
+          !$OMP DO
+          DO  m = 1, surf_usm_h(0)%ns
+             i = surf_usm_h(0)%i(m)
+             j = surf_usm_h(0)%j(m)
+
+             sums_l(nzb,93,tn)  = sums_l(nzb,93,tn) + surf_usm_h(0)%wghf_eb(m) * rmask(j,i,sr)
+             sums_l(nzb,97,tn)  = sums_l(nzb,97,tn) + surf_usm_h(0)%r_a(m)     * rmask(j,i,sr)
+          ENDDO
+          !$OMP END PARALLEL
+       ENDIF
+!
 !--    For speed optimization fluxes which have been computed in part directly inside the WS
 !--    advection routines are treated seperatly.
@@ -1820,14 +1842,27 @@
 !--    Profiles:
        DO  k = nzb, nzt+1
-          sums(k,3)             = sums(k,3)             / ngp_2dh(sr)
-          sums(k,12:22)         = sums(k,12:22)         / ngp_2dh(sr)
-          sums(k,30:32)         = sums(k,30:32)         / ngp_2dh(sr)
-          sums(k,35:39)         = sums(k,35:39)         / ngp_2dh(sr)
-          sums(k,45:53)         = sums(k,45:53)         / ngp_2dh(sr)
-          sums(k,55:63)         = sums(k,55:63)         / ngp_2dh(sr)
-          sums(k,81:88)         = sums(k,81:88)         / ngp_2dh(sr)
-
+          sums(k,3)             = sums(k,3)     / ngp_2dh(sr)
+          sums(k,12:22)         = sums(k,12:22) / ngp_2dh(sr)
+          sums(k,30:32)         = sums(k,30:32) / ngp_2dh(sr)
+          sums(k,35:39)         = sums(k,35:39) / ngp_2dh(sr)
+          sums(k,45:53)         = sums(k,45:53) / ngp_2dh(sr)
+          sums(k,55:63)         = sums(k,55:63) / ngp_2dh(sr)
+          sums(k,81:88)         = sums(k,81:88) / ngp_2dh(sr)
+!
+!--       Average land-surface quantities over LSM surfaces only
           IF ( land_surface  .AND.  surf_lsm_h(0)%ns_tot > 0 )  THEN
-             sums(k,89:98) = sums(k,89:98)              / surf_lsm_h(0)%ns_tot
+             sums(k,89:92) = sums(k,89:92) / surf_lsm_h(0)%ns_tot
+             sums(k,94:96) = sums(k,94:96) / surf_lsm_h(0)%ns_tot
+             sums(k,98)    = sums(k,98)    / surf_lsm_h(0)%ns_tot
+          ENDIF
+!
+!--       Average land/urban-surface quantities over LSM+USM surfaces. Note, at the moment this
+!--       only works when the land-surface model runs alone or in combination with the urban-
+!--       surface model. This is because the number of output quantities is defined by the LSM.
+!--       This needs to be revised in the future.
+          IF ( land_surface  .AND.  surf_lsm_h(0)%ns_tot + surf_usm_h(0)%ns_tot > 0 )  THEN
+           !  print*, surf_lsm_h(0)%ns_tot + surf_usm_h(0)%ns_tot, surf_lsm_h(0)%ns_tot, surf_usm_h(0)%ns_tot
+             sums(k,93) = sums(k,93) / ( surf_lsm_h(0)%ns_tot + surf_usm_h(0)%ns_tot )
+             sums(k,97) = sums(k,97) / ( surf_lsm_h(0)%ns_tot + surf_usm_h(0)%ns_tot )
           ENDIF
 
Index: palm/trunk/SOURCE/virtual_measurement_mod.f90
===================================================================
--- palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4887)
+++ palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4888)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Reduce number of additional grid point output in z for timeseries data to a reasonable number
+!
+! 4843 2021-01-15 15:22:11Z raasch
 ! reading of namelist file and actions in case of namelist errors revised so that statement labels
 ! and goto statements are not required any more,
@@ -413,5 +416,5 @@
     INTEGER(iwp) ::  off_ts              = 1   !< number of neighboring grid points (in horizontal direction) where virtual profile
                                                !< measurements shall be taken, in addition to the given coordinates in the driver
-    INTEGER(iwp) ::  off_ts_z            = 50  !< number of additional grid points (in each upwardd and downward direction) where 
+    INTEGER(iwp) ::  off_ts_z            = 1   !< number of additional grid points (in each upwardd and downward direction) where
                                                !< virtual profile measurements shall be taken, in addition to the given z coordinates in the driver
     INTEGER(iwp) ::  off_tr              = 1   !< number of neighboring grid points (in horizontal direction) where virtual profile
