Index: palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4671)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4577 2020-06-25 09:53:58Z raasch
 ! further re-formatting concerning Fortran parameter variables
 !
@@ -1557,5 +1560,6 @@
                             surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,                              &
                             surf_def_h(2)%qcsws,                                                   &
-                            surf_lsm_h%qcsws,    surf_usm_h%qcsws,                                 &
+                            surf_lsm_h(0)%qcsws, surf_lsm_h(1)%qcsws,                              &
+                            surf_usm_h(0)%qcsws, surf_usm_h(1)%qcsws,                              &
                             surf_def_v(0)%qcsws, surf_def_v(1)%qcsws,                              &
                             surf_def_v(2)%qcsws, surf_def_v(3)%qcsws,                              &
@@ -1647,5 +1651,6 @@
                             surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,                              &
                             surf_def_h(2)%ncsws,                                                   &
-                            surf_lsm_h%ncsws,    surf_usm_h%ncsws,                                 &
+                            surf_lsm_h(0)%ncsws, surf_lsm_h(1)%ncsws,                              &
+                            surf_usm_h(0)%ncsws, surf_usm_h(1)%ncsws,                              &
                             surf_def_v(0)%ncsws, surf_def_v(1)%ncsws,                              &
                             surf_def_v(2)%ncsws, surf_def_v(3)%ncsws,                              &
@@ -1745,5 +1750,6 @@
                             surf_def_h(0)%qisws, surf_def_h(1)%qisws,                              &
                             surf_def_h(2)%qisws,                                                   &
-                            surf_lsm_h%qisws,    surf_usm_h%qisws,                                 &
+                            surf_lsm_h(0)%qisws, surf_lsm_h(1)%qisws,                              &
+                            surf_usm_h(0)%qisws, surf_usm_h(1)%qisws,                              &
                             surf_def_v(0)%qisws, surf_def_v(1)%qisws,                              &
                             surf_def_v(2)%qisws, surf_def_v(3)%qisws,                              &
@@ -1835,5 +1841,6 @@
                             surf_def_h(0)%nisws, surf_def_h(1)%nisws,                              &
                             surf_def_h(2)%nisws,                                                   &
-                            surf_lsm_h%nisws,    surf_usm_h%nisws,                                 &
+                            surf_lsm_h(0)%nisws, surf_lsm_h(1)%nisws,                              &
+                            surf_usm_h(0)%nisws, surf_usm_h(1)%nisws,                              &
                             surf_def_v(0)%nisws, surf_def_v(1)%nisws,                              &
                             surf_def_v(2)%nisws, surf_def_v(3)%nisws,                              &
@@ -1933,5 +1940,6 @@
                             surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,                              &
                             surf_def_h(2)%qrsws,                                                   &
-                            surf_lsm_h%qrsws,    surf_usm_h%qrsws,                                 &
+                            surf_lsm_h(0)%qrsws, surf_lsm_h(1)%qrsws,                              &
+                            surf_usm_h(0)%qrsws, surf_usm_h(1)%qrsws,                              &
                             surf_def_v(0)%qrsws, surf_def_v(1)%qrsws,                              &
                             surf_def_v(2)%qrsws, surf_def_v(3)%qrsws,                              &
@@ -2023,5 +2031,6 @@
                             surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,                              &
                             surf_def_h(2)%nrsws,                                                   &
-                            surf_lsm_h%nrsws,    surf_usm_h%nrsws,                                 &
+                            surf_lsm_h(0)%nrsws, surf_lsm_h(1)%nrsws,                              &
+                            surf_usm_h(0)%nrsws, surf_usm_h(1)%nrsws,                              &
                             surf_def_v(0)%nrsws, surf_def_v(1)%nrsws,                              &
                             surf_def_v(2)%nrsws, surf_def_v(3)%nrsws,                              &
@@ -2122,5 +2131,6 @@
                             surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,                              &
                             surf_def_h(2)%qcsws,                                                   &
-                            surf_lsm_h%qcsws,    surf_usm_h%qcsws,                                 &
+                            surf_lsm_h(0)%qcsws, surf_lsm_h(1)%qcsws,                              &
+                            surf_usm_h(0)%qcsws, surf_usm_h(1)%qcsws,                              &
                             surf_def_v(0)%qcsws, surf_def_v(1)%qcsws,                              &
                             surf_def_v(2)%qcsws, surf_def_v(3)%qcsws,                              &
@@ -2179,5 +2189,6 @@
                             surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,                              &
                             surf_def_h(2)%ncsws,                                                   &
-                            surf_lsm_h%ncsws,    surf_usm_h%ncsws,                                 &
+                            surf_lsm_h(0)%ncsws, surf_lsm_h(1)%ncsws,                              &
+                            surf_usm_h(0)%ncsws, surf_usm_h(1)%ncsws,                              &
                             surf_def_v(0)%ncsws, surf_def_v(1)%ncsws,                              &
                             surf_def_v(2)%ncsws, surf_def_v(3)%ncsws,                              &
@@ -2243,5 +2254,6 @@
                             surf_def_h(0)%qisws, surf_def_h(1)%qisws,                              &
                             surf_def_h(2)%qisws,                                                   &
-                            surf_lsm_h%qisws,    surf_usm_h%qisws,                                 &
+                            surf_lsm_h(0)%qisws, surf_lsm_h(1)%qisws,                              &
+                            surf_usm_h(0)%qisws, surf_usm_h(1)%qisws,                              &
                             surf_def_v(0)%qisws, surf_def_v(1)%qisws,                              &
                             surf_def_v(2)%qisws, surf_def_v(3)%qisws,                              &
@@ -2300,5 +2312,6 @@
                             surf_def_h(0)%nisws, surf_def_h(1)%nisws,                              &
                             surf_def_h(2)%nisws,                                                   &
-                            surf_lsm_h%nisws,    surf_usm_h%nisws,                                 &
+                            surf_lsm_h(0)%nisws, surf_lsm_h(1)%nisws,                              &
+                            surf_usm_h(0)%nisws, surf_usm_h(1)%nisws,                              &
                             surf_def_v(0)%nisws, surf_def_v(1)%nisws,                              &
                             surf_def_v(2)%nisws, surf_def_v(3)%nisws,                              &
@@ -2364,5 +2377,6 @@
                             surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,                              &
                             surf_def_h(2)%qrsws,                                                   &
-                            surf_lsm_h%qrsws,    surf_usm_h%qrsws,                                 &
+                            surf_lsm_h(0)%qrsws, surf_lsm_h(1)%qrsws,                              &
+                            surf_usm_h(0)%qrsws, surf_usm_h(1)%qrsws,                              &
                             surf_def_v(0)%qrsws, surf_def_v(1)%qrsws,                              &
                             surf_def_v(2)%qrsws, surf_def_v(3)%qrsws,                              &
@@ -2421,5 +2435,6 @@
                             surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,                              &
                             surf_def_h(2)%nrsws,                                                   &
-                            surf_lsm_h%nrsws,    surf_usm_h%nrsws,                                 &
+                            surf_lsm_h(0)%nrsws, surf_lsm_h(1)%nrsws,                              &
+                            surf_usm_h(0)%nrsws, surf_usm_h(1)%nrsws,                              &
                             surf_def_v(0)%nrsws, surf_def_v(1)%nrsws,                              &
                             surf_def_v(2)%nrsws, surf_def_v(3)%nrsws,                              &
Index: palm/trunk/SOURCE/chem_emissions_mod.f90
===================================================================
--- palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 4671)
@@ -21,9 +21,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4559 2020-06-11 08:51:48Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -1486,17 +1489,17 @@
 !-- horizontal urban walls that are at k == 0 (building is lower than the first grid point). Hence,
 !-- in order to have only emissions at streets, set the surfaces emissions to zero at urban walls.
-             IF  ( surf_usm_h%ns >=1 )  surf_usm_h%cssws = 0.0_wp
+             IF  ( surf_usm_h(0)%ns >=1 )  surf_usm_h(0)%cssws = 0.0_wp
 
 !
 !--          Treat land-surfaces.
-             DO  m = 1, surf_lsm_h%ns
-
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-                k = surf_lsm_h%k(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+
+                i = surf_lsm_h(0)%i(m)
+                j = surf_lsm_h(0)%j(m)
+                k = surf_lsm_h(0)%k(m)
 
 !
 !--             Set everything to zero then reassign according to street type
-                surf_lsm_h%cssws(:,m) = 0.0_wp
+                surf_lsm_h(0)%cssws(:,m) = 0.0_wp
 
                 IF  ( street_type_f%var(j,i) >= main_street_id  .AND.                              &
@@ -1515,5 +1518,5 @@
 !
 !--                      kg/(m^2*s) * kg/m^3
-                         surf_lsm_h%cssws(match_spec_model(ispec),m) =                             &
+                         surf_lsm_h(0)%cssws(match_spec_model(ispec),m) =                          &
                                    emiss_factor_main(match_spec_input(ispec)) *                    &
                                    emis_distribution(1,j,i,ispec)             *   &     ! kg/(m^2*s)
@@ -1527,5 +1530,5 @@
 !
 !--                      ppm/s *m *kg/m^3
-                         surf_lsm_h%cssws(match_spec_model(ispec),m) =                             &
+                         surf_lsm_h(0)%cssws(match_spec_model(ispec),m) =                          &
                                    emiss_factor_main( match_spec_input(ispec) ) *                  &
                                    emis_distribution(1,j,i,ispec) *       &     ! micromoles/(m^2*s)
@@ -1553,5 +1556,5 @@
 !
 !--                      kg/(m^2*s) * kg/m^3
-                         surf_lsm_h%cssws(match_spec_model(ispec),m) =                             &
+                         surf_lsm_h(0)%cssws(match_spec_model(ispec),m) =                          &
                                    emiss_factor_side( match_spec_input(ispec) ) *                  &
                                    emis_distribution(1,j,i,ispec)               * &     ! kg/(m^2*s)
@@ -1564,5 +1567,5 @@
 !
 !--                      ppm/s *m *kg/m^3
-                         surf_lsm_h%cssws(match_spec_model(ispec),m) =                             &
+                         surf_lsm_h(0)%cssws(match_spec_model(ispec),m) =                          &
                                    emiss_factor_side( match_spec_input(ispec) ) *                  &
                                    emis_distribution(1,j,i,ispec)        *   &  ! micromoles/(m^2*s)
@@ -1579,5 +1582,5 @@
 !                ELSE
 !
-!                   surf_lsm_h%cssws(:,m) = 0.0_wp
+!                   surf_lsm_h(0)%cssws(:,m) = 0.0_wp
 
                 ENDIF  ! street type
@@ -1649,9 +1652,9 @@
 !
 !--          LSM surfaces
-             DO  m = 1, surf_lsm_h%ns
-
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-                k = surf_lsm_h%k(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+
+                i = surf_lsm_h(0)%i(m)
+                j = surf_lsm_h(0)%j(m)
+                k = surf_lsm_h(0)%k(m)
 
                 IF  ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
@@ -1663,7 +1666,7 @@
                          TRIM( spc_names( match_spec_model(ispec) ) ) == "PM10" )  THEN
 
-                      surf_lsm_h%cssws(match_spec_model(ispec),m) =           &    ! kg/m2/s * kg/m3
-                                             emis_distribution(1,j,i,ispec) * &    ! kg/m2/s
-                                             rho_air(k)                            ! kg/m^3
+                      surf_lsm_h(0)%cssws(match_spec_model(ispec),m) =           &    ! kg/m2/s * kg/m3
+                                             emis_distribution(1,j,i,ispec) *    &    ! kg/m2/s
+                                             rho_air(k)                               ! kg/m^3
 
                    ELSE
@@ -1674,9 +1677,9 @@
                             emt_att%species_name(match_spec_input(ispec)) == "VOC" )  THEN
 
-                         surf_lsm_h%cssws(match_spec_model(ispec),m) =      &   ! ppm/s * m * kg/m3
-                               emis_distribution(1,j,i,ispec) *             &   ! mole/m2/s
-                               conv_to_ratio(k,j,i)           *             &   ! m^3/mole
-                               ratio2ppm                      *             &   ! ppm
-                               rho_air(k)                                       ! kg/m^3
+                         surf_lsm_h(0)%cssws(match_spec_model(ispec),m) =      &   ! ppm/s * m * kg/m3
+                               emis_distribution(1,j,i,ispec) *                &   ! mole/m2/s
+                               conv_to_ratio(k,j,i)           *                &   ! m^3/mole
+                               ratio2ppm                      *                &   ! ppm
+                               rho_air(k)                                          ! kg/m^3
 
 !
@@ -1684,10 +1687,10 @@
                       ELSE
 
-                         surf_lsm_h%cssws(match_spec_model(ispec),m) =       &   ! ppm/s * m * kg/m3
-                               emis_distribution(1,j,i,ispec) *              &   ! kg/m2/s
-                               ( 1.0_wp / emt_att%xm(ispec) ) *              &   ! mole/kg
-                               conv_to_ratio(k,j,i)           *              &   ! m^3/mole
-                               ratio2ppm                      *              &   ! ppm
-                               rho_air(k)                                        ! kg/m^3
+                         surf_lsm_h(0)%cssws(match_spec_model(ispec),m) =       &   ! ppm/s * m * kg/m3
+                               emis_distribution(1,j,i,ispec) *                 &   ! kg/m2/s
+                               ( 1.0_wp / emt_att%xm(ispec) ) *                 &   ! mole/kg
+                               conv_to_ratio(k,j,i)           *                 &   ! m^3/mole
+                               ratio2ppm                      *                 &   ! ppm
+                               rho_air(k)                                           ! kg/m^3
 
                       ENDIF  ! VOC
@@ -1703,9 +1706,9 @@
 !
 !--          USM surfaces
-             DO  m = 1, surf_usm_h%ns
-
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                k = surf_usm_h%k(m)
+             DO  m = 1, surf_usm_h(0)%ns
+
+                i = surf_usm_h(0)%i(m)
+                j = surf_usm_h(0)%j(m)
+                k = surf_usm_h(0)%k(m)
 
                 IF  ( emis_distribution(1,j,i,ispec) > 0.0_wp )  THEN
@@ -1717,7 +1720,7 @@
                          TRIM( spc_names( match_spec_model(ispec) ) ) == "PM10" )  THEN
 
-                      surf_usm_h%cssws(match_spec_model(ispec),m) =           &    ! kg/m2/s * kg/m3
-                               emis_distribution(1,j,i,ispec) *               &    ! kg/m2/s
-                               rho_air(k)                                           ! kg/m^3
+                      surf_usm_h(0)%cssws(match_spec_model(ispec),m) =           &    ! kg/m2/s * kg/m3
+                               emis_distribution(1,j,i,ispec) *                  &    ! kg/m2/s
+                               rho_air(k)                                             ! kg/m^3
 
                    ELSE
@@ -1728,9 +1731,9 @@
                             emt_att%species_name(match_spec_input(ispec)) == "VOC" )  THEN
 
-                         surf_usm_h%cssws(match_spec_model(ispec),m) =       &   ! ppm/s * m * kg/m3
-                               emis_distribution(1,j,i,ispec) *              &   ! m2/s
-                               conv_to_ratio(k,j,i)           *              &   ! m^3/mole
-                               ratio2ppm                      *              &   ! ppm
-                               rho_air(k)                                        ! kg/m^3
+                         surf_usm_h(0)%cssws(match_spec_model(ispec),m) =       &   ! ppm/s * m * kg/m3
+                               emis_distribution(1,j,i,ispec) *                 &   ! m2/s
+                               conv_to_ratio(k,j,i)           *                 &   ! m^3/mole
+                               ratio2ppm                      *                 &   ! ppm
+                               rho_air(k)                                           ! kg/m^3
 
 !
@@ -1738,10 +1741,10 @@
                       ELSE
 
-                         surf_usm_h%cssws(match_spec_model(ispec),m) =       &   ! ppm/s * m * kg/m3
-                               emis_distribution(1,j,i,ispec) *              &   ! kg/m2/s
-                               ( 1.0_wp / emt_att%xm(ispec) ) *              &   ! mole/kg
-                               conv_to_ratio(k,j,i)           *              &   ! m^3/mole
-                               ratio2ppm                      *              &   ! ppm
-                               rho_air(k)                                        ! kg/m^3
+                         surf_usm_h(0)%cssws(match_spec_model(ispec),m) =       &   ! ppm/s * m * kg/m3
+                               emis_distribution(1,j,i,ispec) *                 &   ! kg/m2/s
+                               ( 1.0_wp / emt_att%xm(ispec) ) *                 &   ! mole/kg
+                               conv_to_ratio(k,j,i)           *                 &   ! m^3/mole
+                               ratio2ppm                      *                 &   ! ppm
+                               rho_air(k)                                           ! kg/m^3
 
 
@@ -2030,8 +2033,8 @@
     cssws_def_h = 0.0_wp
 
-    ALLOCATE( cssws_lsm_h(n_matched_vars,surf_lsm_h%ns) )
+    ALLOCATE( cssws_lsm_h(n_matched_vars,surf_lsm_h(0)%ns) )
     cssws_lsm_h = 0.0_wp
 
-    ALLOCATE( cssws_usm_h(n_matched_vars,surf_usm_h%ns) )
+    ALLOCATE( cssws_usm_h(n_matched_vars,surf_usm_h(0)%ns) )
     cssws_usm_h = 0.0_wp
 
@@ -2043,11 +2046,11 @@
 
 
-    CALL assign_surface_flux ( cssws_lsm_h, surf_lsm_h%ns,                                         &
-                               surf_lsm_h%j, surf_lsm_h%i,                                         &
+    CALL assign_surface_flux ( cssws_lsm_h, surf_lsm_h(0)%ns,                                      &
+                               surf_lsm_h(0)%j, surf_lsm_h(0)%i,                                   &
                                emis_distrib, mass2mole )
 
 
-    CALL assign_surface_flux ( cssws_usm_h, surf_usm_h%ns,                                         &
-                               surf_usm_h%j, surf_usm_h%i,                                         &
+    CALL assign_surface_flux ( cssws_usm_h, surf_usm_h(0)%ns,                                      &
+                               surf_usm_h(0)%j, surf_usm_h(0)%i,                                   &
                                emis_distrib, mass2mole )
 
@@ -2058,10 +2061,10 @@
        ENDDO
 
-       DO m = 1, surf_lsm_h%ns
-          surf_lsm_h%cssws(k,m)    = cssws_lsm_h(k,m)
+       DO m = 1, surf_lsm_h(0)%ns
+          surf_lsm_h(0)%cssws(k,m)  = cssws_lsm_h(k,m)
        ENDDO
 
-       DO m = 1, surf_usm_h%ns
-          surf_usm_h%cssws(k,m)    = cssws_usm_h(k,m)
+       DO m = 1, surf_usm_h(0)%ns
+          surf_usm_h(0)%cssws(k,m)    = cssws_usm_h(k,m)
        ENDDO
 
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4671)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4637 2020-08-07 07:49:33Z suehring
 ! Avoid usage of omp_lib, instead declare omp_get_thread_num explicitly
 !
@@ -684,6 +687,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i)    <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i)    <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -692,11 +695,11 @@
                                                            surf_def_h(0)%cssws(lsp,m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
+                         m = surf_lsm_h(0)%end_index(j,i)
                          chem_species(lsp)%cssws_av(j,i) = chem_species(lsp)%cssws_av(j,i) +       &
-                                                           surf_lsm_h%cssws(lsp,m)
+                                                           surf_lsm_h(0)%cssws(lsp,m)
                       ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
+                         m = surf_usm_h(0)%end_index(j,i)
                          chem_species(lsp)%cssws_av(j,i) = chem_species(lsp)%cssws_av(j,i) +       &
-                                                           surf_usm_h%cssws(lsp,m)
+                                                           surf_usm_h(0)%cssws(lsp,m)
                       ENDIF
                    ENDDO
@@ -1468,13 +1471,15 @@
 !
 !--          No average output for now.
-             DO  m = 1, surf_lsm_h%ns
-                local_pf(surf_lsm_h%i(m),surf_lsm_h%j(m),nzb+1) =                                  &
-                                                   local_pf(surf_lsm_h%i(m),surf_lsm_h%j(m),nzb+1) &
-                                                   + surf_lsm_h%cssws(lsp,m)
+!--          !!! IT NEEDS TO RETHINK - with fully 3D structure, only lower (upper)
+!--          !!! upward facing horizontal surfaces should be taken into account here
+             DO  m = 1, surf_lsm_h(0)%ns
+                local_pf(surf_lsm_h(0)%i(m),surf_lsm_h(0)%j(m),nzb+1) =                                  &
+                                                   local_pf(surf_lsm_h(0)%i(m),surf_lsm_h(0)%j(m),nzb+1) &
+                                                   + surf_lsm_h(0)%cssws(lsp,m)
              ENDDO
-             DO  m = 1, surf_usm_h%ns
-                   local_pf(surf_usm_h%i(m),surf_usm_h%j(m),nzb+1) =                               &
-                                                   local_pf(surf_usm_h%i(m),surf_usm_h%j(m),nzb+1) &
-                                                   + surf_usm_h%cssws(lsp,m)
+             DO  m = 1, surf_usm_h(0)%ns
+                   local_pf(surf_usm_h(0)%i(m),surf_usm_h(0)%j(m),nzb+1) =                               &
+                                                   local_pf(surf_usm_h(0)%i(m),surf_usm_h(0)%j(m),nzb+1) &
+                                                   + surf_usm_h(0)%cssws(lsp,m)
              ENDDO
              grid = 'zu'
@@ -1577,13 +1582,15 @@
 !
 !--          no average for now
-             DO  m = 1, surf_usm_h%ns
-                local_pf(surf_usm_h%i(m),surf_usm_h%j(m),surf_usm_h%k(m)) =                        &
-                                         local_pf(surf_usm_h%i(m),surf_usm_h%j(m),surf_usm_h%k(m)) &
-                                         + surf_usm_h%cssws(lsp,m)
-             ENDDO
-             DO  m = 1, surf_lsm_h%ns
-                local_pf(surf_lsm_h%i(m),surf_lsm_h%j(m),surf_lsm_h%k(m)) =                        &
-                                         local_pf(surf_lsm_h%i(m),surf_lsm_h%j(m),surf_lsm_h%k(m)) &
-                                         + surf_lsm_h%cssws(lsp,m)
+             DO l = 0, 1
+                DO  m = 1, surf_usm_h(l)%ns
+                   local_pf(surf_usm_h(l)%i(m),surf_usm_h(l)%j(m),surf_usm_h(l)%k(m)) =            &
+                                local_pf(surf_usm_h(l)%i(m),surf_usm_h(l)%j(m),surf_usm_h(l)%k(m)) &
+                                + surf_usm_h(l)%cssws(lsp,m)
+                ENDDO
+                DO  m = 1, surf_lsm_h(l)%ns
+                   local_pf(surf_lsm_h(l)%i(m),surf_lsm_h(l)%j(m),surf_lsm_h(l)%k(m)) =            &
+                                local_pf(surf_lsm_h(l)%i(m),surf_lsm_h(l)%j(m),surf_lsm_h(l)%k(m)) &
+                                + surf_lsm_h(l)%cssws(lsp,m)
+                ENDDO
              ENDDO
              DO  l = 0, 3
@@ -2994,6 +3001,8 @@
             surf_def_h(1)%cssws(ilsp,:),                                                           &
             surf_def_h(2)%cssws(ilsp,:),                                                           &
-            surf_lsm_h%cssws(ilsp,:),                                                              &
-            surf_usm_h%cssws(ilsp,:),                                                              &
+            surf_lsm_h(0)%cssws(ilsp,:),                                                           &
+            surf_lsm_h(1)%cssws(ilsp,:),                                                           &
+            surf_usm_h(0)%cssws(ilsp,:),                                                           &
+            surf_usm_h(1)%cssws(ilsp,:),                                                           &
             surf_def_v(0)%cssws(ilsp,:),                                                           &
             surf_def_v(1)%cssws(ilsp,:),                                                           &
@@ -3115,5 +3124,6 @@
             surf_def_h(0)%cssws(ilsp,:), surf_def_h(1)%cssws(ilsp,:),                              &
             surf_def_h(2)%cssws(ilsp,:),                                                           &
-            surf_lsm_h%cssws(ilsp,:), surf_usm_h%cssws(ilsp,:),                                    &
+            surf_lsm_h(0)%cssws(ilsp,:), surf_lsm_h(1)%cssws(ilsp,:),                              &
+            surf_usm_h(0)%cssws(ilsp,:), surf_usm_h(1)%cssws(ilsp,:),                              &
             surf_def_v(0)%cssws(ilsp,:), surf_def_v(1)%cssws(ilsp,:),                              &
             surf_def_v(2)%cssws(ilsp,:), surf_def_v(3)%cssws(ilsp,:),                              &
@@ -3273,4 +3283,5 @@
     INTEGER(iwp) ::  j                   !< running index on y-axis
     INTEGER(iwp) ::  k                   !< vertical index counter
+    INTEGER(iwp) ::  l                   !< direction index counter
     INTEGER(iwp) ::  lpr                 !< running index chem spcs
     INTEGER(iwp) ::  m                   !< running index for surface elements
@@ -3328,28 +3339,28 @@
                 ENDDO
 !
-!--             Add surface fluxes
-                surf_s = surf_def_h(0)%start_index(j,i)
-                surf_e = surf_def_h(0)%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k   = surf_def_h(0)%k(m) + surf_def_h(0)%koff
-                   sums_tmp(k,tn) = sums_tmp(k,tn) + surf_def_h(0)%cssws(cs_pr_index_fl_sgs(lpr),m)
+!--             Add surface fluxes (?Is the order mandatory or could it be done in one cycle?)
+                DO l = 0, 1
+                   surf_s = surf_def_h(0)%start_index(j,i)
+                   surf_e = surf_def_h(0)%end_index(j,i)
+                   DO  m = surf_s, surf_e
+                      k   = surf_def_h(0)%k(m) + surf_def_h(0)%koff
+                      sums_tmp(k,tn) = sums_tmp(k,tn) + surf_def_h(0)%cssws(cs_pr_index_fl_sgs(lpr),m)
+                   ENDDO
                 ENDDO
-                surf_s = surf_def_h(1)%start_index(j,i)
-                surf_e = surf_def_h(1)%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k   = surf_def_h(1)%k(m)  + surf_def_h(1)%koff
-                   sums_tmp(k,tn) = sums_tmp(k,tn) + surf_def_h(1)%cssws(cs_pr_index_fl_sgs(lpr),m)
+                DO l = 0, 1
+                   surf_s = surf_lsm_h(0)%start_index(j,i)
+                   surf_e = surf_lsm_h(0)%end_index(j,i)
+                   DO  m = surf_s, surf_e
+                      k   = surf_lsm_h(0)%k(m) + surf_lsm_h(0)%koff
+                      sums_tmp(k,tn) = sums_tmp(k,tn) + surf_lsm_h(0)%cssws(cs_pr_index_fl_sgs(lpr),m)
+                   ENDDO
                 ENDDO
-                surf_s = surf_lsm_h%start_index(j,i)
-                surf_e = surf_lsm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k   = surf_lsm_h%k(m) + surf_lsm_h%koff
-                   sums_tmp(k,tn) = sums_tmp(k,tn) + surf_lsm_h%cssws(cs_pr_index_fl_sgs(lpr),m)
-                ENDDO
-                surf_s = surf_usm_h%start_index(j,i)
-                surf_e = surf_usm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k   = surf_usm_h%k(m) + surf_usm_h%koff
-                   sums_tmp(k,tn) = sums_tmp(k,tn) + surf_usm_h%cssws(cs_pr_index_fl_sgs(lpr),m)
+                DO l = 0, 1
+                   surf_s = surf_usm_h(0)%start_index(j,i)
+                   surf_e = surf_usm_h(0)%end_index(j,i)
+                   DO  m = surf_s, surf_e
+                      k   = surf_usm_h(0)%k(m) + surf_usm_h(0)%koff
+                      sums_tmp(k,tn) = sums_tmp(k,tn) + surf_usm_h(0)%cssws(cs_pr_index_fl_sgs(lpr),m)
+                   ENDDO
                 ENDDO
              ENDDO
@@ -3450,7 +3461,7 @@
 ! ------------
 !> Subroutine to calculate the deposition of gases and PMs. For now deposition only takes place on
-!> lsm and usm horizontal surfaces. Default surfaces are NOT considered. The deposition of particles
-!> is derived following Zhang et al., 2001, gases are deposited using the DEPAC module
-!> (van Zanten et al., 2010).
+!> lsm and usm horizontal upward faceing surfaces. Default surfaces are NOT considered.
+!> The deposition of particlesis derived following Zhang et al., 2001, gases are deposited using
+!>  the DEPAC module (van Zanten et al., 2010).
 !>
 !> @TODO: Consider deposition on vertical surfaces
@@ -3768,8 +3779,8 @@
     k = 0
 !
-!-- LSM or USM surface present at i,j:
+!-- LSM or USM horizintal upward facing surface present at i,j:
 !-- Default surfaces are NOT considered for deposition
-    match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-    match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+    match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+    match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 !
 !--For LSM surfaces
@@ -3777,14 +3788,14 @@
 !
 !--    Get surface element information at i,j:
-       m = surf_lsm_h%start_index(j,i)
-       k = surf_lsm_h%k(m)
+       m = surf_lsm_h(0)%start_index(j,i)
+       k = surf_lsm_h(0)%k(m)
 !
 !--    Get needed variables for surface element m
-       ustar_surf  = surf_lsm_h%us(m)
-       z0h_surf    = surf_lsm_h%z0h(m)
-       r_aero_surf = surf_lsm_h%r_a(m)
-       solar_rad   = surf_lsm_h%rad_sw_dir(m) + surf_lsm_h%rad_sw_dif(m)
-
-       lai = surf_lsm_h%lai(m)
+       ustar_surf  = surf_lsm_h(0)%us(m)
+       z0h_surf    = surf_lsm_h(0)%z0h(m)
+       r_aero_surf = surf_lsm_h(0)%r_a(m)
+       solar_rad   = surf_lsm_h(0)%rad_sw_dir(m) + surf_lsm_h(0)%rad_sw_dif(m)
+
+       lai = surf_lsm_h(0)%lai(m)
        sai = lai + 1
 !
@@ -3808,6 +3819,6 @@
 !
 !--    Get land use for i,j and assign to DEPAC lu
-       IF ( surf_lsm_h%frac(m,ind_veg_wall) > 0 )  THEN
-          luv_palm = surf_lsm_h%vegetation_type(m)
+       IF ( surf_lsm_h(0)%frac(m,ind_veg_wall) > 0 )  THEN
+          luv_palm = surf_lsm_h(0)%vegetation_type(m)
           IF ( luv_palm == ind_luv_user )  THEN
              message_string = 'No vegetation type defined. Please define vegetation type to enable deposition calculation'
@@ -3852,6 +3863,6 @@
        ENDIF
 
-       IF ( surf_lsm_h%frac(m,ind_pav_green) > 0 )  THEN
-          lup_palm = surf_lsm_h%pavement_type(m)
+       IF ( surf_lsm_h(0)%frac(m,ind_pav_green) > 0 )  THEN
+          lup_palm = surf_lsm_h(0)%pavement_type(m)
           IF ( lup_palm == ind_lup_user )  THEN
              message_string = 'No pavement type defined. Please define pavement type to enable deposition calculation'
@@ -3890,6 +3901,6 @@
        ENDIF
 
-       IF ( surf_lsm_h%frac(m,ind_wat_win) > 0 )  THEN
-          luw_palm = surf_lsm_h%water_type(m)
+       IF ( surf_lsm_h(0)%frac(m,ind_wat_win) > 0 )  THEN
+          luw_palm = surf_lsm_h(0)%water_type(m)
           IF ( luw_palm == ind_luw_user )  THEN
              message_string = 'No water type defined. Please define water type to enable deposition calculation'
@@ -3909,5 +3920,5 @@
 !
 !--    Set wetness indicator to dry or wet for lsm vegetation or pavement
-       IF ( surf_lsm_h%c_liq(m) > 0 )  THEN
+       IF ( surf_lsm_h(0)%c_liq(m) > 0 )  THEN
           nwet = 1
        ELSE
@@ -3950,5 +3961,5 @@
 !
 !--    Vegetation
-       IF ( surf_lsm_h%frac(m,ind_veg_wall) > 0 )  THEN
+       IF ( surf_lsm_h(0)%frac(m,ind_veg_wall) > 0 )  THEN
 
 !
@@ -4084,5 +4095,5 @@
 !
 !--    Pavement
-       IF ( surf_lsm_h%frac(m,ind_pav_green) > 0 )  THEN
+       IF ( surf_lsm_h(0)%frac(m,ind_pav_green) > 0 )  THEN
 !
 !--       No vegetation on pavements:
@@ -4208,5 +4219,5 @@
 !
 !--    Water
-       IF ( surf_lsm_h%frac(m,ind_wat_win) > 0 )  THEN
+       IF ( surf_lsm_h(0)%frac(m,ind_wat_win) > 0 )  THEN
 !
 !--       No vegetation on water:
@@ -4339,7 +4350,7 @@
        DO  lsp = 1, nspec
 
-          bud(lsp) = surf_lsm_h%frac(m,ind_veg_wall)  * bud_luv(lsp) +                             &
-                     surf_lsm_h%frac(m,ind_pav_green) * bud_lup(lsp) +                             &
-                     surf_lsm_h%frac(m,ind_wat_win)   * bud_luw(lsp)
+          bud(lsp) = surf_lsm_h(0)%frac(m,ind_veg_wall)  * bud_luv(lsp) +                             &
+                     surf_lsm_h(0)%frac(m,ind_pav_green) * bud_lup(lsp) +                             &
+                     surf_lsm_h(0)%frac(m,ind_wat_win)   * bud_luw(lsp)
 !
 !--       Compute new concentration:
@@ -4356,13 +4367,13 @@
 !
 !--    Get surface element information at i,j:
-       m = surf_usm_h%start_index(j,i)
-       k = surf_usm_h%k(m)
+       m = surf_usm_h(0)%start_index(j,i)
+       k = surf_usm_h(0)%k(m)
 !
 !--    Get needed variables for surface element m
-       ustar_surf  = surf_usm_h%us(m)
-       z0h_surf    = surf_usm_h%z0h(m)
-       r_aero_surf = surf_usm_h%r_a(m)
-       solar_rad   = surf_usm_h%rad_sw_dir(m) + surf_usm_h%rad_sw_dif(m)
-       lai = surf_usm_h%lai(m)
+       ustar_surf  = surf_usm_h(0)%us(m)
+       z0h_surf    = surf_usm_h(0)%z0h(m)
+       r_aero_surf = surf_usm_h(0)%r_a(m)
+       solar_rad   = surf_usm_h(0)%rad_sw_dir(m) + surf_usm_h(0)%rad_sw_dif(m)
+       lai = surf_usm_h(0)%lai(m)
        sai = lai + 1
 !
@@ -4386,5 +4397,5 @@
 !
 !--    Get land use for i,j and assign to DEPAC lu
-       IF ( surf_usm_h%frac(m,ind_pav_green) > 0 )  THEN
+       IF ( surf_usm_h(0)%frac(m,ind_pav_green) > 0 )  THEN
 !
 !--       For green urban surfaces (e.g. green roofs assume LU short grass
@@ -4432,5 +4443,5 @@
        ENDIF
 
-       IF ( surf_usm_h%frac(m,ind_veg_wall) > 0 )  THEN
+       IF ( surf_usm_h(0)%frac(m,ind_veg_wall) > 0 )  THEN
 !
 !--       For walls in USM assume concrete walls/roofs,
@@ -4473,5 +4484,5 @@
        ENDIF
 
-       IF ( surf_usm_h%frac(m,ind_wat_win) > 0 )  THEN
+       IF ( surf_usm_h(0)%frac(m,ind_wat_win) > 0 )  THEN
 !
 !--       For windows in USM assume metal as this is as close as we get, assumed LU class desert as
@@ -4516,5 +4527,5 @@
 !--    @TODO: Activate these lines as soon as new ebsolver branch is merged:
 !--    Set wetness indicator to dry or wet for usm vegetation or pavement
-       !IF ( surf_usm_h%c_liq(m) > 0 )  THEN
+       !IF ( surf_usm_h(0)%c_liq(m) > 0 )  THEN
        !   nwet = 1
        !ELSE
@@ -4557,5 +4568,5 @@
 
 !--    Walls/roofs
-       IF ( surf_usm_h%frac(m,ind_veg_wall) > 0 )  THEN
+       IF ( surf_usm_h(0)%frac(m,ind_veg_wall) > 0 )  THEN
 !
 !--       No vegetation on non-green walls:
@@ -4684,5 +4695,5 @@
 !
 !--    Green usm surfaces
-       IF ( surf_usm_h%frac(m,ind_pav_green) > 0 )  THEN
+       IF ( surf_usm_h(0)%frac(m,ind_pav_green) > 0 )  THEN
 
 !
@@ -4817,5 +4828,5 @@
 !
 !--    Windows
-       IF ( surf_usm_h%frac(m,ind_wat_win) > 0 )  THEN
+       IF ( surf_usm_h(0)%frac(m,ind_wat_win) > 0 )  THEN
 !
 !--       No vegetation on windows:
@@ -4947,7 +4958,7 @@
 
 
-          bud(lsp) = surf_usm_h%frac(m,ind_veg_wall)  * bud_luu(lsp) +                             &
-                     surf_usm_h%frac(m,ind_pav_green) * bud_lug(lsp) +                             &
-                     surf_usm_h%frac(m,ind_wat_win)   * bud_lud(lsp)
+          bud(lsp) = surf_usm_h(0)%frac(m,ind_veg_wall)  * bud_luu(lsp) +                             &
+                     surf_usm_h(0)%frac(m,ind_pav_green) * bud_lug(lsp) +                             &
+                     surf_usm_h(0)%frac(m,ind_wat_win)   * bud_lud(lsp)
 !
 !--       Compute new concentration
Index: palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_2d.f90	(revision 4670)
+++ palm/trunk/SOURCE/data_output_2d.f90	(revision 4671)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4559 2020-06-11 08:51:48Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -441,18 +444,18 @@
              CASE ( 'ghf*_xy' )        ! 2d-array
                 IF ( av == 0 )  THEN
-                   DO  m = 1, surf_lsm_h%ns
-                      i                   = surf_lsm_h%i(m)
-                      j                   = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%ghf(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i                   = surf_usm_h%i(m)
-                      j                   = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = 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)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i                   = surf_lsm_h(0)%i(m)
+                      j                   = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%ghf(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i                   = surf_usm_h(0)%i(m)
+                      j                   = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%frac(m,ind_veg_wall)  *                     &
+                                            surf_usm_h(0)%wghf_eb(m)        +                         &
+                                            surf_usm_h(0)%frac(m,ind_pav_green) *                     &
+                                            surf_usm_h(0)%wghf_eb_green(m)  +                         &
+                                            surf_usm_h(0)%frac(m,ind_wat_win)   *                     &
+                                            surf_usm_h(0)%wghf_eb_window(m)
                    ENDDO
                 ELSE
@@ -479,13 +482,13 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%ol(m)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%ol(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%ol(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%ol(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%ol(m)
                    ENDDO
                 ELSE
@@ -711,14 +714,14 @@
                    ENDDO
 
-                   DO  m = 1, surf_lsm_h%ns
-                      i                   = surf_lsm_h%i(m)
-                      j                   = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%q_surface(m)
-                   ENDDO
-
-                   DO  m = 1, surf_usm_h%ns
-                      i                   = surf_usm_h%i(m)
-                      j                   = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%q_surface(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i                   = surf_lsm_h(0)%i(m)
+                      j                   = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%q_surface(m)
+                   ENDDO
+
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i                   = surf_usm_h(0)%i(m)
+                      j                   = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%q_surface(m)
                    ENDDO
 
@@ -750,15 +753,15 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%qsws(m) * waterflux_output_conversion(k)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      k = surf_lsm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%qsws(m) * waterflux_output_conversion(k)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      k = surf_usm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%qsws(m) * waterflux_output_conversion(k)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      k = surf_lsm_h(0)%k(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%qsws(m) * waterflux_output_conversion(k)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      k = surf_usm_h(0)%k(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%qsws(m) * waterflux_output_conversion(k)
                    ENDDO
                 ELSE
@@ -798,19 +801,19 @@
              CASE ( 'r_a*_xy' )        ! 2d-array
                 IF ( av == 0 )  THEN
-                   DO  m = 1, surf_lsm_h%ns
-                      i                   = surf_lsm_h%i(m)
-                      j                   = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%r_a(m)
-                   ENDDO
-
-                   DO  m = 1, surf_usm_h%ns
-                      i   = surf_usm_h%i(m)
-                      j   = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = ( surf_usm_h%frac(m,ind_veg_wall)  *                   &
-                                              surf_usm_h%r_a(m)       +                            &
-                                              surf_usm_h%frac(m,ind_pav_green) *                   &
-                                              surf_usm_h%r_a_green(m) +                            &
-                                              surf_usm_h%frac(m,ind_wat_win)   *                   &
-                                              surf_usm_h%r_a_window(m) )
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i                   = surf_lsm_h(0)%i(m)
+                      j                   = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%r_a(m)
+                   ENDDO
+
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i   = surf_usm_h(0)%i(m)
+                      j   = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = ( surf_usm_h(0)%frac(m,ind_veg_wall)  *                   &
+                                              surf_usm_h(0)%r_a(m)       +                            &
+                                              surf_usm_h(0)%frac(m,ind_pav_green) *                   &
+                                              surf_usm_h(0)%r_a_green(m) +                            &
+                                              surf_usm_h(0)%frac(m,ind_wat_win)   *                   &
+                                              surf_usm_h(0)%r_a_window(m) )
                    ENDDO
                 ELSE
@@ -851,15 +854,15 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%shf(m) * heatflux_output_conversion(k)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      k = surf_lsm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%shf(m) * heatflux_output_conversion(k)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      k = surf_usm_h%k(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%shf(m) * heatflux_output_conversion(k)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      k = surf_lsm_h(0)%k(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%shf(m) * heatflux_output_conversion(k)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      k = surf_usm_h(0)%k(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%shf(m) * heatflux_output_conversion(k)
                    ENDDO
                 ELSE
@@ -908,13 +911,13 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%ssws(m)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%ssws(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%ssws(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%ssws(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%ssws(m)
                    ENDDO
                 ELSE
@@ -940,13 +943,13 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%ts(m)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%ts(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%ts(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%ts(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%ts(m)
                    ENDDO
                 ELSE
@@ -973,14 +976,14 @@
                    ENDDO
 
-                   DO  m = 1, surf_lsm_h%ns
-                      i                   = surf_lsm_h%i(m)
-                      j                   = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%pt_surface(m)
-                   ENDDO
-
-                   DO  m = 1, surf_usm_h%ns
-                      i   = surf_usm_h%i(m)
-                      j   = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%pt_surface(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i                   = surf_lsm_h(0)%i(m)
+                      j                   = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%pt_surface(m)
+                   ENDDO
+
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i   = surf_usm_h(0)%i(m)
+                      j   = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%pt_surface(m)
                    ENDDO
 
@@ -1026,13 +1029,13 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%us(m)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%us(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%us(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%us(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%us(m)
                    ENDDO
                 ELSE
@@ -1102,13 +1105,13 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%z0(m)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%z0(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%z0(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%z0(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%z0(m)
                    ENDDO
                 ELSE
@@ -1134,13 +1137,13 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%z0h(m)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%z0h(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%z0h(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%z0h(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%z0h(m)
                    ENDDO
                 ELSE
@@ -1166,13 +1169,13 @@
                       local_pf(i,j,nzb+1) = surf_def_h(0)%z0q(m)
                    ENDDO
-                   DO  m = 1, surf_lsm_h%ns
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%z0q(m)
-                   ENDDO
-                   DO  m = 1, surf_usm_h%ns
-                      i = surf_usm_h%i(m)
-                      j = surf_usm_h%j(m)
-                      local_pf(i,j,nzb+1) = surf_usm_h%z0q(m)
+                   DO  m = 1, surf_lsm_h(0)%ns
+                      i = surf_lsm_h(0)%i(m)
+                      j = surf_lsm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%z0q(m)
+                   ENDDO
+                   DO  m = 1, surf_usm_h(0)%ns
+                      i = surf_usm_h(0)%i(m)
+                      j = surf_usm_h(0)%j(m)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%z0q(m)
                    ENDDO
                 ELSE
Index: palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90
===================================================================
--- palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4671)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4583 2020-06-29 12:36:47Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -1693,7 +1696,7 @@
              surf => surf_def_h(0)
              CALL calc_pt_2m
-             surf => surf_lsm_h
+             surf => surf_lsm_h(0)
              CALL calc_pt_2m
-             surf => surf_usm_h
+             surf => surf_usm_h(0)
              CALL calc_pt_2m
 !
@@ -1707,7 +1710,7 @@
              surf => surf_def_h(0)
              CALL calc_wind_10m
-             surf => surf_lsm_h
+             surf => surf_lsm_h(0)
              CALL calc_wind_10m
-             surf => surf_usm_h
+             surf => surf_usm_h(0)
              CALL calc_wind_10m
 !
Index: palm/trunk/SOURCE/diffusion_s.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_s.f90	(revision 4670)
+++ palm/trunk/SOURCE/diffusion_s.f90	(revision 4671)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4583 2020-06-29 12:36:47Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -74,5 +77,6 @@
     SUBROUTINE diffusion_s( s, s_flux_def_h_up,    s_flux_def_h_down,                              &
                                s_flux_t,                                                           &
-                               s_flux_lsm_h_up,    s_flux_usm_h_up,                                &
+                               s_flux_lsm_h_up,    s_flux_lsm_h_down,                              &
+                               s_flux_usm_h_up,    s_flux_usm_h_down,                              &
                                s_flux_def_v_north, s_flux_def_v_south,                             &
                                s_flux_def_v_east,  s_flux_def_v_west,                              &
@@ -116,16 +120,18 @@
        REAL(wp) ::  mask_west         !< flag to mask vertical surface west of the grid point
 
+       REAL(wp), DIMENSION(1:surf_def_h(0)%ns) ::  s_flux_def_h_up    !< flux at horizontal upward-facing default-type surfaces
        REAL(wp), DIMENSION(1:surf_def_h(1)%ns) ::  s_flux_def_h_down  !< flux at horizontal donwward-facing default-type surfaces
-       REAL(wp), DIMENSION(1:surf_def_h(0)%ns) ::  s_flux_def_h_up    !< flux at horizontal upward-facing default-type surfaces
        REAL(wp), DIMENSION(1:surf_def_v(2)%ns) ::  s_flux_def_v_east  !< flux at east-facing vertical default-type surfaces
        REAL(wp), DIMENSION(1:surf_def_v(0)%ns) ::  s_flux_def_v_north !< flux at north-facing vertical default-type surfaces
        REAL(wp), DIMENSION(1:surf_def_v(1)%ns) ::  s_flux_def_v_south !< flux at south-facing vertical default-type surfaces
        REAL(wp), DIMENSION(1:surf_def_v(3)%ns) ::  s_flux_def_v_west  !< flux at west-facing vertical default-type surfaces
-       REAL(wp), DIMENSION(1:surf_lsm_h%ns)    ::  s_flux_lsm_h_up    !< flux at horizontal upward-facing natural-type surfaces
+       REAL(wp), DIMENSION(1:surf_lsm_h(0)%ns) ::  s_flux_lsm_h_up    !< flux at horizontal upward-facing natural-type surfaces
+       REAL(wp), DIMENSION(1:surf_lsm_h(1)%ns) ::  s_flux_lsm_h_down  !< flux at horizontal downward-facing natural-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(2)%ns) ::  s_flux_lsm_v_east  !< flux at east-facing vertical natural-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(0)%ns) ::  s_flux_lsm_v_north !< flux at north-facing vertical natural-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(1)%ns) ::  s_flux_lsm_v_south !< flux at south-facing vertical natural-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(3)%ns) ::  s_flux_lsm_v_west  !< flux at west-facing vertical natural-type surfaces
-       REAL(wp), DIMENSION(1:surf_usm_h%ns)    ::  s_flux_usm_h_up    !< flux at horizontal upward-facing urban-type surfaces
+       REAL(wp), DIMENSION(1:surf_usm_h(0)%ns) ::  s_flux_usm_h_up    !< flux at horizontal upward-facing urban-type surfaces
+       REAL(wp), DIMENSION(1:surf_usm_h(1)%ns) ::  s_flux_usm_h_down  !< flux at horizontal downward-facing urban-type surfaces
        REAL(wp), DIMENSION(1:surf_usm_v(2)%ns) ::  s_flux_usm_v_east  !< flux at east-facing vertical urban-type surfaces
        REAL(wp), DIMENSION(1:surf_usm_v(0)%ns) ::  s_flux_usm_v_north !< flux at north-facing vertical urban-type surfaces
@@ -144,14 +150,14 @@
        !$ACC PRESENT(ddzu, ddzw, drho_air, rho_air_zw) &
        !$ACC PRESENT(surf_def_h(0:2), surf_def_v(0:3)) &
-       !$ACC PRESENT(surf_lsm_h, surf_lsm_v(0:3)) &
-       !$ACC PRESENT(surf_usm_h, surf_usm_v(0:3)) &
+       !$ACC PRESENT(surf_lsm_h(0:1), surf_lsm_v(0:3)) &
+       !$ACC PRESENT(surf_usm_h(0:1), surf_usm_v(0:3)) &
        !$ACC PRESENT(s_flux_def_h_up, s_flux_def_h_down) &
        !$ACC PRESENT(s_flux_t) &
        !$ACC PRESENT(s_flux_def_v_north, s_flux_def_v_south) &
        !$ACC PRESENT(s_flux_def_v_east, s_flux_def_v_west) &
-       !$ACC PRESENT(s_flux_lsm_h_up) &
+       !$ACC PRESENT(s_flux_lsm_h_up, s_flux_lsm_h_down) &
        !$ACC PRESENT(s_flux_lsm_v_north, s_flux_lsm_v_south) &
        !$ACC PRESENT(s_flux_lsm_v_east, s_flux_lsm_v_west) &
-       !$ACC PRESENT(s_flux_usm_h_up) &
+       !$ACC PRESENT(s_flux_usm_h_up, s_flux_usm_h_down) &
        !$ACC PRESENT(s_flux_usm_v_north, s_flux_usm_v_south) &
        !$ACC PRESENT(s_flux_usm_v_east, s_flux_usm_v_west) &
@@ -328,8 +334,6 @@
                 surf_e = surf_def_h(0)%end_index(j,i)
                 DO  m = surf_s, surf_e
-
                    k   = surf_def_h(0)%k(m)
                    tend(k,j,i) = tend(k,j,i) + s_flux_def_h_up(m) * ddzw(k) * drho_air(k)
-
                 ENDDO
 !
@@ -338,28 +342,38 @@
                 surf_e = surf_def_h(1)%end_index(j,i)
                 DO  m = surf_s, surf_e
-
                    k   = surf_def_h(1)%k(m)
                    tend(k,j,i) = tend(k,j,i) + s_flux_def_h_down(m) * ddzw(k) * drho_air(k)
-
                 ENDDO
 !
 !--             Natural-type surfaces, upward-facing
-                surf_s = surf_lsm_h%start_index(j,i)
-                surf_e = surf_lsm_h%end_index(j,i)
+                surf_s = surf_lsm_h(0)%start_index(j,i)
+                surf_e = surf_lsm_h(0)%end_index(j,i)
                 DO  m = surf_s, surf_e
-
-                   k   = surf_lsm_h%k(m)
+                   k   = surf_lsm_h(0)%k(m)
                    tend(k,j,i) = tend(k,j,i) + s_flux_lsm_h_up(m) * ddzw(k) * drho_air(k)
-
                 ENDDO
 !
+!--             Natural-type surfaces, downward-facing
+                surf_s = surf_lsm_h(1)%start_index(j,i)
+                surf_e = surf_lsm_h(1)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k   = surf_lsm_h(1)%k(m)
+                   tend(k,j,i) = tend(k,j,i) + s_flux_lsm_h_down(m) * ddzw(k) * drho_air(k)
+                ENDDO
+!
 !--             Urban-type surfaces, upward-facing
-                surf_s = surf_usm_h%start_index(j,i)
-                surf_e = surf_usm_h%end_index(j,i)
+                surf_s = surf_usm_h(0)%start_index(j,i)
+                surf_e = surf_usm_h(0)%end_index(j,i)
                 DO  m = surf_s, surf_e
-
-                   k   = surf_usm_h%k(m)
+                   k   = surf_usm_h(0)%k(m)
                    tend(k,j,i) = tend(k,j,i) + s_flux_usm_h_up(m) * ddzw(k) * drho_air(k)
-
+                ENDDO
+!
+!--             Urban-type surfaces, downward-facing
+                surf_s = surf_usm_h(1)%start_index(j,i)
+                surf_e = surf_usm_h(1)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k   = surf_usm_h(1)%k(m)
+                   tend(k,j,i) = tend(k,j,i) + s_flux_usm_h_down(m) * ddzw(k) * drho_air(k)
                 ENDDO
 
@@ -390,5 +404,6 @@
                                s_flux_def_h_up,    s_flux_def_h_down,                              &
                                s_flux_t,                                                           &
-                               s_flux_lsm_h_up,    s_flux_usm_h_up,                                &
+                               s_flux_lsm_h_up,    s_flux_lsm_h_down,                              &
+                               s_flux_usm_h_up,    s_flux_usm_h_down,                              &
                                s_flux_def_v_north, s_flux_def_v_south,                             &
                                s_flux_def_v_east,  s_flux_def_v_west,                              &
@@ -438,10 +453,12 @@
        REAL(wp), DIMENSION(1:surf_def_v(1)%ns) ::  s_flux_def_v_south !< flux at south-facing vertical default-type surfaces
        REAL(wp), DIMENSION(1:surf_def_v(3)%ns) ::  s_flux_def_v_west  !< flux at west-facing vertical default-type surfaces
-       REAL(wp), DIMENSION(1:surf_lsm_h%ns)    ::  s_flux_lsm_h_up    !< flux at horizontal upward-facing natural-type surfaces
+       REAL(wp), DIMENSION(1:surf_lsm_h(0)%ns) ::  s_flux_lsm_h_up    !< flux at horizontal upward-facing natural-type surfaces
+       REAL(wp), DIMENSION(1:surf_lsm_h(1)%ns) ::  s_flux_lsm_h_down    !< flux at horizontal downward-facing natural-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(2)%ns) ::  s_flux_lsm_v_east  !< flux at east-facing vertical urban-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(0)%ns) ::  s_flux_lsm_v_north !< flux at north-facing vertical urban-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(1)%ns) ::  s_flux_lsm_v_south !< flux at south-facing vertical urban-type surfaces
        REAL(wp), DIMENSION(1:surf_lsm_v(3)%ns) ::  s_flux_lsm_v_west  !< flux at west-facing vertical urban-type surfaces
-       REAL(wp), DIMENSION(1:surf_usm_h%ns)    ::  s_flux_usm_h_up    !< flux at horizontal upward-facing urban-type surfaces
+       REAL(wp), DIMENSION(1:surf_usm_h(0)%ns) ::  s_flux_usm_h_up    !< flux at horizontal upward-facing urban-type surfaces
+       REAL(wp), DIMENSION(1:surf_usm_h(1)%ns) ::  s_flux_usm_h_down  !< flux at horizontal downward-facing urban-type surfaces
        REAL(wp), DIMENSION(1:surf_usm_v(2)%ns) ::  s_flux_usm_v_east  !< flux at east-facing vertical urban-type surfaces
        REAL(wp), DIMENSION(1:surf_usm_v(0)%ns) ::  s_flux_usm_v_north !< flux at north-facing vertical urban-type surfaces
@@ -625,7 +642,5 @@
           surf_e = surf_def_h(0)%end_index(j,i)
           DO  m = surf_s, surf_e
-
              k   = surf_def_h(0)%k(m)
-
              tend(k,j,i) = tend(k,j,i) + s_flux_def_h_up(m) * ddzw(k) * drho_air(k)
           ENDDO
@@ -635,26 +650,38 @@
           surf_e = surf_def_h(1)%end_index(j,i)
           DO  m = surf_s, surf_e
-
              k   = surf_def_h(1)%k(m)
-
              tend(k,j,i) = tend(k,j,i) + s_flux_def_h_down(m) * ddzw(k) * drho_air(k)
           ENDDO
 !
 !--       Natural-type surfaces, upward-facing
-          surf_s = surf_lsm_h%start_index(j,i)
-          surf_e = surf_lsm_h%end_index(j,i)
+          surf_s = surf_lsm_h(0)%start_index(j,i)
+          surf_e = surf_lsm_h(0)%end_index(j,i)
           DO  m = surf_s, surf_e
-             k   = surf_lsm_h%k(m)
-
+             k   = surf_lsm_h(0)%k(m)
              tend(k,j,i) = tend(k,j,i) + s_flux_lsm_h_up(m) * ddzw(k) * drho_air(k)
           ENDDO
 !
+!--       Natural-type surfaces, downward-facing
+          surf_s = surf_lsm_h(1)%start_index(j,i)
+          surf_e = surf_lsm_h(1)%end_index(j,i)
+          DO  m = surf_s, surf_e
+             k   = surf_lsm_h(1)%k(m)
+             tend(k,j,i) = tend(k,j,i) + s_flux_lsm_h_down(m) * ddzw(k) * drho_air(k)
+          ENDDO
+!
 !--       Urban-type surfaces, upward-facing
-          surf_s = surf_usm_h%start_index(j,i)
-          surf_e = surf_usm_h%end_index(j,i)
+          surf_s = surf_usm_h(0)%start_index(j,i)
+          surf_e = surf_usm_h(0)%end_index(j,i)
           DO  m = surf_s, surf_e
-             k   = surf_usm_h%k(m)
-
+             k   = surf_usm_h(0)%k(m)
              tend(k,j,i) = tend(k,j,i) + s_flux_usm_h_up(m) * ddzw(k) * drho_air(k)
+          ENDDO
+!
+!--       Urban-type surfaces, upward-facing
+          surf_s = surf_usm_h(1)%start_index(j,i)
+          surf_e = surf_usm_h(1)%end_index(j,i)
+          DO  m = surf_s, surf_e
+             k   = surf_usm_h(1)%k(m)
+             tend(k,j,i) = tend(k,j,i) + s_flux_usm_h_down(m) * ddzw(k) * drho_air(k)
           ENDDO
        ENDIF
@@ -665,5 +692,4 @@
           surf_e = surf_def_h(2)%end_index(j,i)
           DO  m = surf_s, surf_e
-
              k   = surf_def_h(2)%k(m)
              tend(k,j,i) = tend(k,j,i) + ( - s_flux_t(m) ) * ddzw(k) * drho_air(k)
Index: palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_u.f90	(revision 4670)
+++ palm/trunk/SOURCE/diffusion_u.f90	(revision 4671)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4583 2020-06-29 12:36:47Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -247,23 +250,45 @@
 !
 !--             Natural-type surfaces, upward-facing
-                surf_s = surf_lsm_h%start_index(j,i)
-                surf_e = surf_lsm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-
-                   k   = surf_lsm_h%k(m)
-
-                   tend(k,j,i) = tend(k,j,i)                                                       &
-                                 + ( - ( - surf_lsm_h%usws(m) ) ) * ddzw(k) * drho_air(k)
+                surf_s = surf_lsm_h(0)%start_index(j,i)
+                surf_e = surf_lsm_h(0)%end_index(j,i)
+                DO  m = surf_s, surf_e
+
+                   k   = surf_lsm_h(0)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 + ( - ( - surf_lsm_h(0)%usws(m) ) ) * ddzw(k) * drho_air(k)
+                ENDDO
+!
+!--             Natural-type surfaces, downward-facing
+                surf_s = surf_lsm_h(1)%start_index(j,i)
+                surf_e = surf_lsm_h(1)%end_index(j,i)
+                DO  m = surf_s, surf_e
+
+                   k   = surf_lsm_h(1)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 + ( - surf_lsm_h(1)%usws(m) ) * ddzw(k) * drho_air(k)
                 ENDDO
 !
 !--             Urban-type surfaces, upward-facing
-                surf_s = surf_usm_h%start_index(j,i)
-                surf_e = surf_usm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-
-                   k   = surf_usm_h%k(m)
-
-                   tend(k,j,i) = tend(k,j,i)                                                       &
-                                 + ( - ( - surf_usm_h%usws(m) ) ) * ddzw(k) * drho_air(k)
+                surf_s = surf_usm_h(0)%start_index(j,i)
+                surf_e = surf_usm_h(0)%end_index(j,i)
+                DO  m = surf_s, surf_e
+
+                   k   = surf_usm_h(0)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 + ( - ( - surf_usm_h(0)%usws(m) ) ) * ddzw(k) * drho_air(k)
+                ENDDO
+!
+!--             Urban-type surfaces, downward-facing
+                surf_s = surf_usm_h(1)%start_index(j,i)
+                surf_e = surf_usm_h(1)%end_index(j,i)
+                DO  m = surf_s, surf_e
+
+                   k   = surf_usm_h(1)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 + ( - surf_usm_h(1)%usws(m) ) * ddzw(k) * drho_air(k)
                 ENDDO
 
@@ -452,21 +477,41 @@
 !
 !--       Natural-type surfaces, upward-facing
-          surf_s = surf_lsm_h%start_index(j,i)
-          surf_e = surf_lsm_h%end_index(j,i)
-          DO  m = surf_s, surf_e
-
-             k   = surf_lsm_h%k(m)
-
-             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_lsm_h%usws(m) ) ) * ddzw(k) * drho_air(k)
+          surf_s = surf_lsm_h(0)%start_index(j,i)
+          surf_e = surf_lsm_h(0)%end_index(j,i)
+          DO  m = surf_s, surf_e
+
+             k   = surf_lsm_h(0)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_lsm_h(0)%usws(m) ) ) * ddzw(k) * drho_air(k)
+          ENDDO
+!
+!--       Natural-type surfaces, downward-facing
+          surf_s = surf_lsm_h(1)%start_index(j,i)
+          surf_e = surf_lsm_h(1)%end_index(j,i)
+          DO  m = surf_s, surf_e
+
+             k   = surf_lsm_h(1)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - surf_lsm_h(1)%usws(m) ) * ddzw(k) * drho_air(k)
           ENDDO
 !
 !--       Urban-type surfaces, upward-facing
-          surf_s = surf_usm_h%start_index(j,i)
-          surf_e = surf_usm_h%end_index(j,i)
-          DO  m = surf_s, surf_e
-
-             k   = surf_usm_h%k(m)
-
-             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_usm_h%usws(m) ) ) * ddzw(k) * drho_air(k)
+          surf_s = surf_usm_h(0)%start_index(j,i)
+          surf_e = surf_usm_h(0)%end_index(j,i)
+          DO  m = surf_s, surf_e
+
+             k   = surf_usm_h(0)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_usm_h(0)%usws(m) ) ) * ddzw(k) * drho_air(k)
+          ENDDO
+!
+!--       Urban-type surfaces, downward-facing
+          surf_s = surf_usm_h(1)%start_index(j,i)
+          surf_e = surf_usm_h(1)%end_index(j,i)
+          DO  m = surf_s, surf_e
+
+             k   = surf_usm_h(1)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - surf_usm_h(1)%usws(m) ) * ddzw(k) * drho_air(k)
           ENDDO
 
Index: palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_v.f90	(revision 4670)
+++ palm/trunk/SOURCE/diffusion_v.f90	(revision 4671)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4583 2020-06-29 12:36:47Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -241,22 +244,44 @@
 !
 !--             Natural-type surfaces, upward-facing
-                surf_s = surf_lsm_h%start_index(j,i)
-                surf_e = surf_lsm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k   = surf_lsm_h%k(m)
-
-                   tend(k,j,i) = tend(k,j,i)                                                       &
-                                 + ( - ( - surf_lsm_h%vsws(m) ) ) * ddzw(k) * drho_air(k)
+                surf_s = surf_lsm_h(0)%start_index(j,i)
+                surf_e = surf_lsm_h(0)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k   = surf_lsm_h(0)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 + ( - ( - surf_lsm_h(0)%vsws(m) ) ) * ddzw(k) * drho_air(k)
+
+                ENDDO
+!
+!--             Natural-type surfaces, downward-facing
+                surf_s = surf_lsm_h(1)%start_index(j,i)
+                surf_e = surf_lsm_h(1)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k   = surf_lsm_h(1)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 +  ( - surf_lsm_h(1)%vsws(m) ) * ddzw(k) * drho_air(k)
 
                 ENDDO
 !
 !--             Urban-type surfaces, upward-facing
-                surf_s = surf_usm_h%start_index(j,i)
-                surf_e = surf_usm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k   = surf_usm_h%k(m)
-
-                   tend(k,j,i) = tend(k,j,i)                                                       &
-                                 + ( - ( - surf_usm_h%vsws(m) ) ) * ddzw(k) * drho_air(k)
+                surf_s = surf_usm_h(0)%start_index(j,i)
+                surf_e = surf_usm_h(0)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k   = surf_usm_h(0)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 + ( - ( - surf_usm_h(0)%vsws(m) ) ) * ddzw(k) * drho_air(k)
+
+                ENDDO
+!
+!--             Urban-type surfaces, downward-facing
+                surf_s = surf_usm_h(1)%start_index(j,i)
+                surf_e = surf_usm_h(1)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k   = surf_usm_h(1)%k(m)
+
+                   tend(k,j,i) = tend(k,j,i)                                                       &
+                                 + ( - surf_usm_h(1)%vsws(m) ) * ddzw(k) * drho_air(k)
 
                 ENDDO
@@ -446,20 +471,40 @@
 !
 !--       Natural-type surfaces, upward-facing
-          surf_s = surf_lsm_h%start_index(j,i)
-          surf_e = surf_lsm_h%end_index(j,i)
-          DO  m = surf_s, surf_e
-             k   = surf_lsm_h%k(m)
-
-             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_lsm_h%vsws(m) ) ) * ddzw(k) * drho_air(k)
+          surf_s = surf_lsm_h(0)%start_index(j,i)
+          surf_e = surf_lsm_h(0)%end_index(j,i)
+          DO  m = surf_s, surf_e
+             k   = surf_lsm_h(0)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_lsm_h(0)%vsws(m) ) ) * ddzw(k) * drho_air(k)
+
+          ENDDO
+!
+!--       Natural-type surfaces, downward-facing
+          surf_s = surf_lsm_h(1)%start_index(j,i)
+          surf_e = surf_lsm_h(1)%end_index(j,i)
+          DO  m = surf_s, surf_e
+             k   = surf_lsm_h(1)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - surf_lsm_h(1)%vsws(m) ) * ddzw(k) * drho_air(k)
 
           ENDDO
 !
 !--       Urban-type surfaces, upward-facing
-          surf_s = surf_usm_h%start_index(j,i)
-          surf_e = surf_usm_h%end_index(j,i)
-          DO  m = surf_s, surf_e
-             k   = surf_usm_h%k(m)
-
-             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_usm_h%vsws(m) ) ) * ddzw(k) * drho_air(k)
+          surf_s = surf_usm_h(0)%start_index(j,i)
+          surf_e = surf_usm_h(0)%end_index(j,i)
+          DO  m = surf_s, surf_e
+             k   = surf_usm_h(0)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - ( - surf_usm_h(0)%vsws(m) ) ) * ddzw(k) * drho_air(k)
+
+          ENDDO
+!
+!--       Urban-type surfaces, downward-facing
+          surf_s = surf_usm_h(1)%start_index(j,i)
+          surf_e = surf_usm_h(1)%end_index(j,i)
+          DO  m = surf_s, surf_e
+             k   = surf_usm_h(1)%k(m)
+
+             tend(k,j,i) = tend(k,j,i) + ( - surf_usm_h(1)%vsws(m) ) * ddzw(k) * drho_air(k)
 
           ENDDO
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 4670)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 4671)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4646 2020-08-24 16:02:40Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -523,5 +526,5 @@
        !$ACC PRESENT(e, u, v, w, km, kh, p, pt) &
        !$ACC PRESENT(ddx, ddy, ddzu, ddzw) &
-       !$ACC PRESENT(surf_def_h(0), surf_lsm_h, surf_usm_h) &
+       !$ACC PRESENT(surf_def_h(0), surf_lsm_h(0), surf_usm_h(0)) &
        !$ACC PRESENT(sums_l)
        DO  i = nxl, nxr
@@ -685,26 +688,26 @@
                                             surf_def_h(0)%pt_surface(m) * rmask(j,i,sr)
              ENDIF
-             IF ( surf_lsm_h%end_index(j,i) >= surf_lsm_h%start_index(j,i) )  THEN
-                m = surf_lsm_h%start_index(j,i)
+             IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) )  THEN
+                m = surf_lsm_h(0)%start_index(j,i)
                 !$ACC ATOMIC
                 sums_l(nzb,pr_palm,tn)   = sums_l(nzb,pr_palm,tn) +                                &
-                                           surf_lsm_h%us(m)   * rmask(j,i,sr)
+                                           surf_lsm_h(0)%us(m)   * rmask(j,i,sr)
                 !$ACC ATOMIC
                 sums_l(nzb+1,pr_palm,tn) = sums_l(nzb+1,pr_palm,tn) +                              &
-                                           surf_lsm_h%usws(m) * rmask(j,i,sr)
+                                           surf_lsm_h(0)%usws(m) * rmask(j,i,sr)
                 !$ACC ATOMIC
                 sums_l(nzb+2,pr_palm,tn) = sums_l(nzb+2,pr_palm,tn) +                              &
-                                           surf_lsm_h%vsws(m) * rmask(j,i,sr)
+                                           surf_lsm_h(0)%vsws(m) * rmask(j,i,sr)
                 !$ACC ATOMIC
                 sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) +                              &
-                                           surf_lsm_h%ts(m)   * rmask(j,i,sr)
+                                           surf_lsm_h(0)%ts(m)   * rmask(j,i,sr)
 #ifndef _OPENACC
                 IF ( humidity )  THEN
                    sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) +                         &
-                                               surf_lsm_h%qs(m)   * rmask(j,i,sr)
+                                               surf_lsm_h(0)%qs(m)   * rmask(j,i,sr)
                 ENDIF
                 IF ( passive_scalar )  THEN
                    sums_l(nzb+13,pr_palm,tn) = sums_l(nzb+13,pr_palm,tn) +                         &
-                                               surf_lsm_h%ss(m)   * rmask(j,i,sr)
+                                               surf_lsm_h(0)%ss(m)   * rmask(j,i,sr)
                 ENDIF
 #endif
@@ -713,28 +716,28 @@
                 !$ACC ATOMIC
                 sums_l(nzb+14,pr_palm,tn) = sums_l(nzb+14,pr_palm,tn) +                            &
-                                            surf_lsm_h%pt_surface(m) * rmask(j,i,sr)
+                                            surf_lsm_h(0)%pt_surface(m) * rmask(j,i,sr)
              ENDIF
-             IF ( surf_usm_h%end_index(j,i) >= surf_usm_h%start_index(j,i) )  THEN
-                m = surf_usm_h%start_index(j,i)
+             IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) )  THEN
+                m = surf_usm_h(0)%start_index(j,i)
                 !$ACC ATOMIC
                 sums_l(nzb,pr_palm,tn)   = sums_l(nzb,pr_palm,tn) +                                &
-                                           surf_usm_h%us(m)   * rmask(j,i,sr)
+                                           surf_usm_h(0)%us(m)   * rmask(j,i,sr)
                 !$ACC ATOMIC
                 sums_l(nzb+1,pr_palm,tn) = sums_l(nzb+1,pr_palm,tn) +                              &
-                                           surf_usm_h%usws(m) * rmask(j,i,sr)
+                                           surf_usm_h(0)%usws(m) * rmask(j,i,sr)
                 !$ACC ATOMIC
                 sums_l(nzb+2,pr_palm,tn) = sums_l(nzb+2,pr_palm,tn) +                              &
-                                           surf_usm_h%vsws(m) * rmask(j,i,sr)
+                                           surf_usm_h(0)%vsws(m) * rmask(j,i,sr)
                 !$ACC ATOMIC
                 sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) +                              &
-                                           surf_usm_h%ts(m)   * rmask(j,i,sr)
+                                           surf_usm_h(0)%ts(m)   * rmask(j,i,sr)
 #ifndef _OPENACC
                 IF ( humidity )  THEN
                    sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) +                         &
-                                               surf_usm_h%qs(m)   * rmask(j,i,sr)
+                                               surf_usm_h(0)%qs(m)   * rmask(j,i,sr)
                 ENDIF
                 IF ( passive_scalar )  THEN
                    sums_l(nzb+13,pr_palm,tn) = sums_l(nzb+13,pr_palm,tn) +                         &
-                                               surf_usm_h%ss(m) * rmask(j,i,sr)
+                                               surf_usm_h(0)%ss(m) * rmask(j,i,sr)
                 ENDIF
 #endif
@@ -743,5 +746,5 @@
                 !$ACC ATOMIC
                 sums_l(nzb+14,pr_palm,tn) = sums_l(nzb+14,pr_palm,tn) +                            &
-                                            surf_usm_h%pt_surface(m)  * rmask(j,i,sr)
+                                            surf_usm_h(0)%pt_surface(m)  * rmask(j,i,sr)
              ENDIF
           ENDDO !j-loop
@@ -816,5 +819,5 @@
        !$ACC PRESENT(wall_flags_total_0, rmask, ddzu, rho_air_zw, hom(:,1,1:4,sr)) &
        !$ACC PRESENT(heatflux_output_conversion, momentumflux_output_conversion) &
-       !$ACC PRESENT(surf_def_h(0:2), surf_lsm_h, surf_usm_h) &
+       !$ACC PRESENT(surf_def_h(0:2), surf_lsm_h(0:1), surf_usm_h(0:1) &
        !$ACC PRESENT(sums_l)
        DO  i = nxl, nxr
@@ -988,115 +991,114 @@
 
                    ENDIF
-                ENDDO
-                IF ( surf_lsm_h%end_index(j,i) >= surf_lsm_h%start_index(j,i) )  THEN
-                   m = surf_lsm_h%start_index(j,i)
-                   !$ACC ATOMIC
-                   sums_l(nzb,12,tn) = sums_l(nzb,12,tn) +                                         &
-                                       momentumflux_output_conversion(nzb) *                       &
-                                       surf_lsm_h%usws(m) * rmask(j,i,sr)     ! w"u"
-                   !$ACC ATOMIC
-                   sums_l(nzb,14,tn) = sums_l(nzb,14,tn) +                                         &
-                                       momentumflux_output_conversion(nzb) *                       &
-                                       surf_lsm_h%vsws(m) * rmask(j,i,sr)     ! w"v"
-                   !$ACC ATOMIC
-                   sums_l(nzb,16,tn) = sums_l(nzb,16,tn) +                                         &
-                                       heatflux_output_conversion(nzb) *                           &
-                                       surf_lsm_h%shf(m)  * rmask(j,i,sr)     ! w"pt"
+                   IF ( surf_lsm_h(l)%end_index(j,i) >= surf_lsm_h(l)%start_index(j,i) )  THEN
+                      m = surf_lsm_h(l)%start_index(j,i)
+                      !$ACC ATOMIC
+                      sums_l(nzb,12,tn) = sums_l(nzb,12,tn) +                                         &
+                                          momentumflux_output_conversion(nzb) *                       &
+                                          surf_lsm_h(l)%usws(m) * rmask(j,i,sr)     ! w"u"
+                      !$ACC ATOMIC
+                      sums_l(nzb,14,tn) = sums_l(nzb,14,tn) +                                         &
+                                          momentumflux_output_conversion(nzb) *                       &
+                                          surf_lsm_h(l)%vsws(m) * rmask(j,i,sr)     ! w"v"
+                      !$ACC ATOMIC
+                      sums_l(nzb,16,tn) = sums_l(nzb,16,tn) +                                         &
+                                          heatflux_output_conversion(nzb) *                           &
+                                          surf_lsm_h(l)%shf(m)  * rmask(j,i,sr)     ! w"pt"
 #if 0
-                   sums_l(nzb,58,tn) = sums_l(nzb,58,tn) +                                         &
-                                       0.0_wp * rmask(j,i,sr)        ! u"pt"
-                   sums_l(nzb,61,tn) = sums_l(nzb,61,tn) +                                         &
-                                       0.0_wp * rmask(j,i,sr)        ! v"pt"
+                      sums_l(nzb,58,tn) = sums_l(nzb,58,tn) +                                         &
+                                          0.0_wp * rmask(j,i,sr)        ! u"pt"
+                      sums_l(nzb,61,tn) = sums_l(nzb,61,tn) +                                         &
+                                          0.0_wp * rmask(j,i,sr)        ! v"pt"
 #endif
 #ifndef _OPENACC
-                   IF ( ocean_mode )  THEN
-                      sums_l(nzb,65,tn) = sums_l(nzb,65,tn) +                                      &
-                                          surf_lsm_h%sasws(m) * rmask(j,i,sr)  ! w"sa"
+                      IF ( ocean_mode )  THEN
+                         sums_l(nzb,65,tn) = sums_l(nzb,65,tn) +                                      &
+                                             surf_lsm_h(l)%sasws(m) * rmask(j,i,sr)  ! w"sa"
+                      ENDIF
+                      IF ( humidity )  THEN
+                         sums_l(nzb,48,tn) = sums_l(nzb,48,tn) +                                      &
+                                             waterflux_output_conversion(nzb) *                       &
+                                             surf_lsm_h(l)%qsws(m) * rmask(j,i,sr)  ! w"q" (w"qv")
+                         sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                    &
+                                             ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) * surf_lsm_h(l)%shf(m) +  &
+                                               0.61_wp * pt(nzb,j,i) * surf_lsm_h(l)%qsws(m) )           &
+                                             * heatflux_output_conversion(nzb)
+                         IF ( cloud_droplets )  THEN
+                            sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                 &
+                                                ( 1.0_wp + 0.61_wp * q(nzb,j,i) -                     &
+                                                  ql(nzb,j,i) ) * surf_lsm_h(l)%shf(m) +                 &
+                                                  0.61_wp * pt(nzb,j,i) * surf_lsm_h(l)%qsws(m) )        &
+                                                * heatflux_output_conversion(nzb)
+                         ENDIF
+                         IF ( bulk_cloud_model )  THEN
+!
+!--                         Formula does not work if ql(nzb) /= 0.0
+                            sums_l(nzb,51,tn) = sums_l(nzb,51,tn) +                                   &
+                                                waterflux_output_conversion(nzb) *                    &
+                                                surf_lsm_h(l)%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv")
+                         ENDIF
+                      ENDIF
+                      IF ( passive_scalar )  THEN
+                         sums_l(nzb,117,tn) = sums_l(nzb,117,tn) +                                    &
+                                              surf_lsm_h(l)%ssws(m) * rmask(j,i,sr) ! w"s"
+                      ENDIF
+#endif
+
                    ENDIF
-                   IF ( humidity )  THEN
-                      sums_l(nzb,48,tn) = sums_l(nzb,48,tn) +                                      &
-                                          waterflux_output_conversion(nzb) *                       &
-                                          surf_lsm_h%qsws(m) * rmask(j,i,sr)  ! w"q" (w"qv")
-                      sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                    &
-                                          ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) * surf_lsm_h%shf(m) +  &
-                                            0.61_wp * pt(nzb,j,i) * surf_lsm_h%qsws(m) )           &
-                                          * heatflux_output_conversion(nzb)
-                      IF ( cloud_droplets )  THEN
-                         sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                 &
-                                             ( 1.0_wp + 0.61_wp * q(nzb,j,i) -                     &
-                                               ql(nzb,j,i) ) * surf_lsm_h%shf(m) +                 &
-                                               0.61_wp * pt(nzb,j,i) * surf_lsm_h%qsws(m) )        &
-                                             * heatflux_output_conversion(nzb)
-                      ENDIF
-                      IF ( bulk_cloud_model )  THEN
-!
-!--                      Formula does not work if ql(nzb) /= 0.0
-                         sums_l(nzb,51,tn) = sums_l(nzb,51,tn) +                                   &
-                                             waterflux_output_conversion(nzb) *                    &
-                                             surf_lsm_h%qsws(m) * rmask(j,i,sr) ! w"q" (w"qv")
-                      ENDIF
-                   ENDIF
-                   IF ( passive_scalar )  THEN
-                      sums_l(nzb,117,tn) = sums_l(nzb,117,tn) +                                    &
-                                           surf_lsm_h%ssws(m) * rmask(j,i,sr) ! w"s"
-                   ENDIF
-#endif
-
-                ENDIF
-                IF ( surf_usm_h%end_index(j,i) >= surf_usm_h%start_index(j,i) )  THEN
-                   m = surf_usm_h%start_index(j,i)
-                   !$ACC ATOMIC
-                   sums_l(nzb,12,tn) = sums_l(nzb,12,tn) +                                         &
-                                       momentumflux_output_conversion(nzb) *                       &
-                                       surf_usm_h%usws(m) * rmask(j,i,sr)                ! w"u"
-                   !$ACC ATOMIC
-                   sums_l(nzb,14,tn) = sums_l(nzb,14,tn) +                                         &
-                                       momentumflux_output_conversion(nzb) *                       &
-                                       surf_usm_h%vsws(m) * rmask(j,i,sr)                ! w"v"
-                   !$ACC ATOMIC
-                   sums_l(nzb,16,tn) = sums_l(nzb,16,tn) +                                         &
-                                       heatflux_output_conversion(nzb) *                           &
-                                       surf_usm_h%shf(m)  * rmask(j,i,sr)                ! w"pt"
+                   IF ( surf_usm_h(l)%end_index(j,i) >= surf_usm_h(l)%start_index(j,i) )  THEN
+                      m = surf_usm_h(l)%start_index(j,i)
+                      !$ACC ATOMIC
+                      sums_l(nzb,12,tn) = sums_l(nzb,12,tn) +                                         &
+                                          momentumflux_output_conversion(nzb) *                       &
+                                          surf_usm_h(l)%usws(m) * rmask(j,i,sr)                ! w"u"
+                      !$ACC ATOMIC
+                      sums_l(nzb,14,tn) = sums_l(nzb,14,tn) +                                         &
+                                          momentumflux_output_conversion(nzb) *                       &
+                                          surf_usm_h(l)%vsws(m) * rmask(j,i,sr)                ! w"v"
+                      !$ACC ATOMIC
+                      sums_l(nzb,16,tn) = sums_l(nzb,16,tn) +                                         &
+                                          heatflux_output_conversion(nzb) *                           &
+                                          surf_usm_h(l)%shf(m)  * rmask(j,i,sr)                ! w"pt"
 #if 0
-                   sums_l(nzb,58,tn) = sums_l(nzb,58,tn) + 0.0_wp * rmask(j,i,sr)        ! u"pt"
-                   sums_l(nzb,61,tn) = sums_l(nzb,61,tn) + 0.0_wp * rmask(j,i,sr)        ! v"pt"
+                      sums_l(nzb,58,tn) = sums_l(nzb,58,tn) + 0.0_wp * rmask(j,i,sr)        ! u"pt"
+                      sums_l(nzb,61,tn) = sums_l(nzb,61,tn) + 0.0_wp * rmask(j,i,sr)        ! v"pt"
 #endif
 #ifndef _OPENACC
-                   IF ( ocean_mode )  THEN
-                      sums_l(nzb,65,tn) = sums_l(nzb,65,tn) +                                      &
-                                          surf_usm_h%sasws(m) * rmask(j,i,sr)            ! w"sa"
+                      IF ( ocean_mode )  THEN
+                         sums_l(nzb,65,tn) = sums_l(nzb,65,tn) +                                      &
+                                             surf_usm_h(l)%sasws(m) * rmask(j,i,sr)            ! w"sa"
+                      ENDIF
+                      IF ( humidity )  THEN
+                         sums_l(nzb,48,tn) = sums_l(nzb,48,tn) +                                      &
+                                             waterflux_output_conversion(nzb) *                       &
+                                             surf_usm_h(l)%qsws(m) * rmask(j,i,sr)             ! w"q" (w"qv")
+                         sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                    &
+                                             ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) *                      &
+                                             surf_usm_h(l)%shf(m) + 0.61_wp * pt(nzb,j,i) *              &
+                                             surf_usm_h(l)%qsws(m)  )                                    &
+                                             * heatflux_output_conversion(nzb)
+                         IF ( cloud_droplets )  THEN
+                            sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                 &
+                                                ( 1.0_wp + 0.61_wp * q(nzb,j,i) -                     &
+                                                 ql(nzb,j,i) ) * surf_usm_h(l)%shf(m) +                  &
+                                                 0.61_wp * pt(nzb,j,i) * surf_usm_h(l)%qsws(m) )         &
+                                                * heatflux_output_conversion(nzb)
+                         ENDIF
+                         IF ( bulk_cloud_model )  THEN
+!
+!--                         Formula does not work if ql(nzb) /= 0.0
+                            sums_l(nzb,51,tn) = sums_l(nzb,51,tn) +                                   &
+                                                waterflux_output_conversion(nzb) *                    &
+                                                surf_usm_h(l)%qsws(m) * rmask(j,i,sr)          ! w"q" (w"qv")
+                         ENDIF
+                      ENDIF
+                      IF ( passive_scalar )  THEN
+                         sums_l(nzb,117,tn) = sums_l(nzb,117,tn) +                                    &
+                                              surf_usm_h(l)%ssws(m) * rmask(j,i,sr)            ! w"s"
+                      ENDIF
+#endif
+
                    ENDIF
-                   IF ( humidity )  THEN
-                      sums_l(nzb,48,tn) = sums_l(nzb,48,tn) +                                      &
-                                          waterflux_output_conversion(nzb) *                       &
-                                          surf_usm_h%qsws(m) * rmask(j,i,sr)             ! w"q" (w"qv")
-                      sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                    &
-                                          ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) *                      &
-                                          surf_usm_h%shf(m) + 0.61_wp * pt(nzb,j,i) *              &
-                                          surf_usm_h%qsws(m)  )                                    &
-                                          * heatflux_output_conversion(nzb)
-                      IF ( cloud_droplets )  THEN
-                         sums_l(nzb,45,tn) = sums_l(nzb,45,tn) + (                                 &
-                                             ( 1.0_wp + 0.61_wp * q(nzb,j,i) -                     &
-                                              ql(nzb,j,i) ) * surf_usm_h%shf(m) +                  &
-                                              0.61_wp * pt(nzb,j,i) * surf_usm_h%qsws(m) )         &
-                                             * heatflux_output_conversion(nzb)
-                      ENDIF
-                      IF ( bulk_cloud_model )  THEN
-!
-!--                      Formula does not work if ql(nzb) /= 0.0
-                         sums_l(nzb,51,tn) = sums_l(nzb,51,tn) +                                   &
-                                             waterflux_output_conversion(nzb) *                    &
-                                             surf_usm_h%qsws(m) * rmask(j,i,sr)          ! w"q" (w"qv")
-                      ENDIF
-                   ENDIF
-                   IF ( passive_scalar )  THEN
-                      sums_l(nzb,117,tn) = sums_l(nzb,117,tn) +                                    &
-                                           surf_usm_h%ssws(m) * rmask(j,i,sr)            ! w"s"
-                   ENDIF
-#endif
-
-                ENDIF
-
+                ENDDO
              ENDIF
 
@@ -1107,11 +1109,11 @@
                    sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_def_h(0)%ol(m) * rmask(j,i,sr) ! L
                 ENDIF
-                IF ( surf_lsm_h%end_index(j,i) >= surf_lsm_h%start_index(j,i) )  THEN
-                   m = surf_lsm_h%start_index(j,i)
-                   sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_lsm_h%ol(m)    * rmask(j,i,sr) ! L
-                ENDIF
-                IF ( surf_usm_h%end_index(j,i) >= surf_usm_h%start_index(j,i) )  THEN
-                   m = surf_usm_h%start_index(j,i)
-                   sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_usm_h%ol(m)    * rmask(j,i,sr) ! L
+                IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) )  THEN
+                   m = surf_lsm_h(0)%start_index(j,i)
+                   sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_lsm_h(0)%ol(m)    * rmask(j,i,sr) ! L
+                ENDIF
+                IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) )  THEN
+                   m = surf_usm_h(0)%start_index(j,i)
+                   sums_l(nzb,112,tn) = sums_l(nzb,112,tn) + surf_usm_h(0)%ol(m)    * rmask(j,i,sr) ! L
                 ENDIF
              ENDIF
@@ -1131,29 +1133,29 @@
                                         surf_def_h(0)%rad_sw_out(m) * rmask(j,i,sr)
                 ENDIF
-                IF ( surf_lsm_h%end_index(j,i) >= surf_lsm_h%start_index(j,i) )  THEN
-                   m = surf_lsm_h%start_index(j,i)
+                IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) )  THEN
+                   m = surf_lsm_h(0)%start_index(j,i)
                    sums_l(nzb,99,tn)  = sums_l(nzb,99,tn)   +                                      &
-                                        surf_lsm_h%rad_net(m)    * rmask(j,i,sr)
+                                        surf_lsm_h(0)%rad_net(m)    * rmask(j,i,sr)
                    sums_l(nzb,100,tn) = sums_l(nzb,100,tn)  +                                      &
-                                        surf_lsm_h%rad_lw_in(m)  * rmask(j,i,sr)
+                                        surf_lsm_h(0)%rad_lw_in(m)  * rmask(j,i,sr)
                    sums_l(nzb,101,tn) = sums_l(nzb,101,tn)  +                                      &
-                                        surf_lsm_h%rad_lw_out(m) * rmask(j,i,sr)
+                                        surf_lsm_h(0)%rad_lw_out(m) * rmask(j,i,sr)
                    sums_l(nzb,102,tn) = sums_l(nzb,102,tn)  +                                      &
-                                        surf_lsm_h%rad_sw_in(m)  * rmask(j,i,sr)
+                                        surf_lsm_h(0)%rad_sw_in(m)  * rmask(j,i,sr)
                    sums_l(nzb,103,tn) = sums_l(nzb,103,tn)  +                                      &
-                                        surf_lsm_h%rad_sw_out(m) * rmask(j,i,sr)
-                ENDIF
-                IF ( surf_usm_h%end_index(j,i) >= surf_usm_h%start_index(j,i) )  THEN
-                   m = surf_usm_h%start_index(j,i)
+                                        surf_lsm_h(0)%rad_sw_out(m) * rmask(j,i,sr)
+                ENDIF
+                IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) )  THEN
+                   m = surf_usm_h(0)%start_index(j,i)
                    sums_l(nzb,99,tn)  = sums_l(nzb,99,tn)   +                                      &
-                                        surf_usm_h%rad_net(m)    * rmask(j,i,sr)
+                                        surf_usm_h(0)%rad_net(m)    * rmask(j,i,sr)
                    sums_l(nzb,100,tn) = sums_l(nzb,100,tn)  +                                      &
-                                        surf_usm_h%rad_lw_in(m)  * rmask(j,i,sr)
+                                        surf_usm_h(0)%rad_lw_in(m)  * rmask(j,i,sr)
                    sums_l(nzb,101,tn) = sums_l(nzb,101,tn)  +                                      &
-                                        surf_usm_h%rad_lw_out(m) * rmask(j,i,sr)
+                                        surf_usm_h(0)%rad_lw_out(m) * rmask(j,i,sr)
                    sums_l(nzb,102,tn) = sums_l(nzb,102,tn)  +                                      &
-                                        surf_usm_h%rad_sw_in(m)  * rmask(j,i,sr)
+                                        surf_usm_h(0)%rad_sw_in(m)  * rmask(j,i,sr)
                    sums_l(nzb,103,tn) = sums_l(nzb,103,tn)  +                                      &
-                                        surf_usm_h%rad_sw_out(m) * rmask(j,i,sr)
+                                        surf_usm_h(0)%rad_sw_out(m) * rmask(j,i,sr)
                 ENDIF
 
@@ -1172,33 +1174,33 @@
                                            surf_def_h(0)%rrtm_asdir(m,0) * rmask(j,i,sr)
                    ENDIF
-                   IF ( surf_lsm_h%end_index(j,i) >= surf_lsm_h%start_index(j,i) )  THEN
-                      m = surf_lsm_h%start_index(j,i)
+                   IF ( surf_lsm_h(0)%end_index(j,i) >= surf_lsm_h(0)%start_index(j,i) )  THEN
+                      m = surf_lsm_h(0)%start_index(j,i)
                       sums_l(nzb,108,tn)  = sums_l(nzb,108,tn)  +                                  &
-                                            SUM( surf_lsm_h%frac(m,:) *                            &
-                                                 surf_lsm_h%rrtm_aldif(m,:) ) * rmask(j,i,sr)
+                                            SUM( surf_lsm_h(0)%frac(m,:) *                            &
+                                                 surf_lsm_h(0)%rrtm_aldif(m,:) ) * rmask(j,i,sr)
                       sums_l(nzb,109,tn) = sums_l(nzb,109,tn)  +                                   &
-                                           SUM( surf_lsm_h%frac(m,:) *                             &
-                                                surf_lsm_h%rrtm_aldir(m,:) ) * rmask(j,i,sr)
+                                           SUM( surf_lsm_h(0)%frac(m,:) *                             &
+                                                surf_lsm_h(0)%rrtm_aldir(m,:) ) * rmask(j,i,sr)
                       sums_l(nzb,110,tn) = sums_l(nzb,110,tn)  +                                   &
-                                           SUM( surf_lsm_h%frac(m,:) *                             &
-                                                surf_lsm_h%rrtm_asdif(m,:) ) * rmask(j,i,sr)
+                                           SUM( surf_lsm_h(0)%frac(m,:) *                             &
+                                                surf_lsm_h(0)%rrtm_asdif(m,:) ) * rmask(j,i,sr)
                       sums_l(nzb,111,tn) = sums_l(nzb,111,tn)  +                                   &
-                                           SUM( surf_lsm_h%frac(m,:) *                             &
-                                                surf_lsm_h%rrtm_asdir(m,:) ) * rmask(j,i,sr)
+                                           SUM( surf_lsm_h(0)%frac(m,:) *                             &
+                                                surf_lsm_h(0)%rrtm_asdir(m,:) ) * rmask(j,i,sr)
                    ENDIF
-                   IF ( surf_usm_h%end_index(j,i) >= surf_usm_h%start_index(j,i) )  THEN
-                      m = surf_usm_h%start_index(j,i)
+                   IF ( surf_usm_h(0)%end_index(j,i) >= surf_usm_h(0)%start_index(j,i) )  THEN
+                      m = surf_usm_h(0)%start_index(j,i)
                       sums_l(nzb,108,tn)  = sums_l(nzb,108,tn)  +                                  &
-                                            SUM( surf_usm_h%frac(m,:) *                            &
-                                                 surf_usm_h%rrtm_aldif(m,:) ) * rmask(j,i,sr)
+                                            SUM( surf_usm_h(0)%frac(m,:) *                            &
+                                                 surf_usm_h(0)%rrtm_aldif(m,:) ) * rmask(j,i,sr)
                       sums_l(nzb,109,tn) = sums_l(nzb,109,tn)  +                                   &
-                                           SUM( surf_usm_h%frac(m,:) *                             &
-                                                surf_usm_h%rrtm_aldir(m,:) ) * rmask(j,i,sr)
+                                           SUM( surf_usm_h(0)%frac(m,:) *                             &
+                                                surf_usm_h(0)%rrtm_aldir(m,:) ) * rmask(j,i,sr)
                       sums_l(nzb,110,tn) = sums_l(nzb,110,tn)  +                                   &
-                                           SUM( surf_usm_h%frac(m,:) *                             &
-                                                surf_usm_h%rrtm_asdif(m,:) ) * rmask(j,i,sr)
+                                           SUM( surf_usm_h(0)%frac(m,:) *                             &
+                                                surf_usm_h(0)%rrtm_asdif(m,:) ) * rmask(j,i,sr)
                       sums_l(nzb,111,tn) = sums_l(nzb,111,tn)  +                                   &
-                                           SUM( surf_usm_h%frac(m,:) *                             &
-                                                surf_usm_h%rrtm_asdir(m,:) ) * rmask(j,i,sr)
+                                           SUM( surf_usm_h(0)%frac(m,:) *                             &
+                                                surf_usm_h(0)%rrtm_asdir(m,:) ) * rmask(j,i,sr)
                    ENDIF
 
@@ -1405,15 +1407,15 @@
           !$ tn = omp_get_thread_num()
           !$OMP DO
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
+          DO  m = 1, surf_lsm_h(0)%ns
+             i = surf_lsm_h(0)%i(m)
+             j = surf_lsm_h(0)%j(m)
 
              IF ( i >= nxl  .AND.  i <= nxr  .AND.  j >= nys  .AND.  j <= nyn )  THEN
-                sums_l(nzb,93,tn)  = sums_l(nzb,93,tn) + surf_lsm_h%ghf(m)       * rmask(j,i,sr)
-                sums_l(nzb,94,tn)  = sums_l(nzb,94,tn) + surf_lsm_h%qsws_liq(m)  * rmask(j,i,sr)
-                sums_l(nzb,95,tn)  = sums_l(nzb,95,tn) + surf_lsm_h%qsws_soil(m) * rmask(j,i,sr)
-                sums_l(nzb,96,tn)  = sums_l(nzb,96,tn) + surf_lsm_h%qsws_veg(m)  * rmask(j,i,sr)
-                sums_l(nzb,97,tn)  = sums_l(nzb,97,tn) + surf_lsm_h%r_a(m)       * rmask(j,i,sr)
-                sums_l(nzb,98,tn)  = sums_l(nzb,98,tn) + surf_lsm_h%r_s(m)       * rmask(j,i,sr)
+                sums_l(nzb,93,tn)  = sums_l(nzb,93,tn) + surf_lsm_h(0)%ghf(m)       * rmask(j,i,sr)
+                sums_l(nzb,94,tn)  = sums_l(nzb,94,tn) + surf_lsm_h(0)%qsws_liq(m)  * rmask(j,i,sr)
+                sums_l(nzb,95,tn)  = sums_l(nzb,95,tn) + surf_lsm_h(0)%qsws_soil(m) * rmask(j,i,sr)
+                sums_l(nzb,96,tn)  = sums_l(nzb,96,tn) + surf_lsm_h(0)%qsws_veg(m)  * rmask(j,i,sr)
+                sums_l(nzb,97,tn)  = sums_l(nzb,97,tn) + surf_lsm_h(0)%r_a(m)       * rmask(j,i,sr)
+                sums_l(nzb,98,tn)  = sums_l(nzb,98,tn) + surf_lsm_h(0)%r_s(m)       * rmask(j,i,sr)
              ENDIF
           ENDDO
@@ -1424,14 +1426,14 @@
           !$ tn = omp_get_thread_num()
           !$OMP DO
-          DO  m = 1, surf_lsm_h%ns
-
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
+          DO  m = 1, surf_lsm_h(0)%ns
+
+             i = surf_lsm_h(0)%i(m)
+             j = surf_lsm_h(0)%j(m)
 
              IF ( i >= nxl  .AND.  i <= nxr  .AND.  j >= nys  .AND.  j <= nyn )  THEN
 
                 DO  k = nzb_soil, nzt_soil
-                   sums_l(k,89,tn)  = sums_l(k,89,tn)  + t_soil_h%var_2d(k,m) * rmask(j,i,sr)
-                   sums_l(k,91,tn)  = sums_l(k,91,tn)  + m_soil_h%var_2d(k,m) * rmask(j,i,sr)
+                   sums_l(k,89,tn)  = sums_l(k,89,tn)  + t_soil_h(0)%var_2d(k,m) * rmask(j,i,sr)
+                   sums_l(k,91,tn)  = sums_l(k,91,tn)  + m_soil_h(0)%var_2d(k,m) * rmask(j,i,sr)
                 ENDDO
              ENDIF
Index: palm/trunk/SOURCE/indoor_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4646 2020-08-24 16:02:40Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -801,26 +804,28 @@
 !-- Horizontal facades
     buildings(:)%num_facades_per_building_h_l = 0
-    DO  m = 1, surf_usm_h%ns
-!
-!--    For the current facade element determine corresponding building index.
-!--    First, obtain j,j,k indices of the building. Please note the offset between facade/surface
-!--    element and building location (for horizontal surface elements the horizontal offsets are
-!--    zero).
-       i = surf_usm_h%i(m) + surf_usm_h%ioff
-       j = surf_usm_h%j(m) + surf_usm_h%joff
-       k = surf_usm_h%k(m) + surf_usm_h%koff
-!
-!--    Determine building index and check whether building is on PE.
-       nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), DIM=1 )
-
-       IF ( buildings(nb)%on_pe )  THEN
-!
-!--       Count number of facade elements at each height level.
-          buildings(nb)%num_facade_h(k) = buildings(nb)%num_facade_h(k) + 1
-!
-!--       Moreover, sum up number of local facade elements per building.
-          buildings(nb)%num_facades_per_building_h_l =                                             &
+    DO  l = 0, 1
+       DO  m = 1, surf_usm_h(l)%ns
+!
+!--       For the current facade element determine corresponding building index.
+!--       First, obtain j,j,k indices of the building. Please note the offset between facade/surface
+!--       element and building location (for horizontal surface elements the horizontal offsets are
+!--       zero).
+          i = surf_usm_h(l)%i(m) + surf_usm_h(l)%ioff
+          j = surf_usm_h(l)%j(m) + surf_usm_h(l)%joff
+          k = surf_usm_h(l)%k(m) + surf_usm_h(l)%koff
+!
+!--       Determine building index and check whether building is on PE.
+          nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), DIM=1 )
+
+          IF ( buildings(nb)%on_pe )  THEN
+!
+!--          Count number of facade elements at each height level.
+             buildings(nb)%num_facade_h(k) = buildings(nb)%num_facade_h(k) + 1
+!
+!--          Moreover, sum up number of local facade elements per building.
+             buildings(nb)%num_facades_per_building_h_l =                                             &
                                                       buildings(nb)%num_facades_per_building_h_l + 1
-       ENDIF
+          ENDIF
+       ENDDO
     ENDDO
 !
@@ -944,14 +949,16 @@
     n_fa = 1
 
-    DO  m = 1, surf_usm_h%ns
-       i = surf_usm_h%i(m) + surf_usm_h%ioff
-       j = surf_usm_h%j(m) + surf_usm_h%joff
-
-       nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), DIM=1 )
-
-       IF ( buildings(nb)%on_pe )  THEN
-          buildings(nb)%m_h(n_fa(nb)) = m
-          n_fa(nb) = n_fa(nb) + 1
-       ENDIF
+    DO  l = 0, 1
+       DO  m = 1, surf_usm_h(l)%ns
+          i = surf_usm_h(l)%i(m) + surf_usm_h(l)%ioff
+          j = surf_usm_h(l)%j(m) + surf_usm_h(l)%joff
+
+          nb = MINLOC( ABS( buildings(:)%id - building_id_f%var(j,i) ), DIM=1 )
+
+          IF ( buildings(nb)%on_pe )  THEN
+             buildings(nb)%m_h(n_fa(nb)) = m
+             n_fa(nb) = n_fa(nb) + 1
+          ENDIF
+       ENDDO
     ENDDO
 
@@ -1212,9 +1219,10 @@
           DO  fa = 1, buildings(nb)%num_facades_per_building_h_l
 !
-!--          Determine index where corresponding surface-type information is stored.
-             m = buildings(nb)%m_h(fa)
+!--          Determine indices where corresponding surface-type information is stored.
+             l = buildings(nb)%l_v(fa)
+             m = buildings(nb)%m_v(fa)
 !
 !--          Determine building height level index.
-             kk = surf_usm_h%k(m) + surf_usm_h%koff
+             kk = surf_usm_h(l)%k(m) + surf_usm_h(l)%koff
 !
 !--          Building geometries --> not time-dependent
@@ -1225,5 +1233,5 @@
                                             ( buildings(nb)%num_facades_per_building_h +           &
                                               buildings(nb)%num_facades_per_building_v )              !< [m2] area of total facade
-             window_area_per_facade       = surf_usm_h%frac(m,ind_wat_win)  * facade_element_area     !< [m2] window area per facade
+             window_area_per_facade       = surf_usm_h(l)%frac(m,ind_wat_win)  * facade_element_area     !< [m2] window area per facade
                                                                                                       !< element
 
@@ -1274,14 +1282,14 @@
 !
 !--          Net short-wave radiation through window area (was i_global)
-             net_sw_in = surf_usm_h%rad_sw_in(m) - surf_usm_h%rad_sw_out(m)
+             net_sw_in = surf_usm_h(l)%rad_sw_in(m) - surf_usm_h(l)%rad_sw_out(m)
 !
 !--          Quantities needed for im_calc_temperatures
-             i = surf_usm_h%i(m)
-             j = surf_usm_h%j(m)
-             k = surf_usm_h%k(m)
-             near_facade_temperature = surf_usm_h%pt_10cm(m)
-             indoor_wall_window_temperature =                                                      &
-                                            surf_usm_h%frac(m,ind_veg_wall) * t_wall_h(nzt_wall,m) &
-                                          + surf_usm_h%frac(m,ind_wat_win)  * t_window_h(nzt_wall,m)
+             i = surf_usm_h(l)%i(m)
+             j = surf_usm_h(l)%j(m)
+             k = surf_usm_h(l)%k(m)
+             near_facade_temperature = surf_usm_h(l)%pt_10cm(m)
+             indoor_wall_window_temperature =                                                             &
+                                            surf_usm_h(l)%frac(m,ind_veg_wall) * t_wall_h(l)%val(nzt_wall,m) &
+                                          + surf_usm_h(l)%frac(m,ind_wat_win)  * t_window_h(l)%val(nzt_wall,m)
 !
 !--          Solar thermal gains. If net_sw_in larger than sun-protection threshold parameter
@@ -1393,5 +1401,5 @@
 !--          Will be used for thermal comfort calculations.
              theta_op     = 0.3_wp * theta_air_ac + 0.7_wp * theta_s          !< [degree_C] operative Temperature Eq. (C.12)
-!              surf_usm_h%t_indoor(m) = theta_op                               !< not integrated now
+!              surf_usm_h(l)%t_indoor(m) = theta_op                               !< not integrated now
 !
 !--          Heat flux into the wall. Value needed in urban_surface_mod to
@@ -1403,6 +1411,6 @@
 !
 !--          Transfer q_wall_win back to USM (innermost wall/window layer)
-             surf_usm_h%iwghf_eb(m)        = q_wall_win
-             surf_usm_h%iwghf_eb_window(m) = q_wall_win
+             surf_usm_h(l)%iwghf_eb(m)        = q_wall_win
+             surf_usm_h(l)%iwghf_eb_window(m) = q_wall_win
 !
 !--          Sum up operational indoor temperature per kk-level. Further below, this temperature is
@@ -1425,5 +1433,5 @@
                             ) / facade_element_area                                             !< [W/m2] , observe the directional
                                                                                                 !< convention in PALM!
-             surf_usm_h%waste_heat(m) = q_waste_heat
+             surf_usm_h(l)%waste_heat(m) = q_waste_heat
           ENDDO !< Horizontal surfaces loop
 !
@@ -1510,6 +1518,6 @@
              near_facade_temperature = surf_usm_v(l)%pt_10cm(m)
              indoor_wall_window_temperature =                                                      &
-                                    surf_usm_v(l)%frac(m,ind_veg_wall) * t_wall_v(l)%t(nzt_wall,m) &
-                                  + surf_usm_v(l)%frac(m,ind_wat_win)  * t_window_v(l)%t(nzt_wall,m)
+                                    surf_usm_v(l)%frac(m,ind_veg_wall) * t_wall_v(l)%val(nzt_wall,m) &
+                                  + surf_usm_v(l)%frac(m,ind_wat_win)  * t_window_v(l)%val(nzt_wall,m)
 !
 !--          Solar thermal gains. If net_sw_in larger than sun-protection
@@ -1885,9 +1893,9 @@
         CASE ( 'im_hf_roof' )
            IF ( av == 0 )  THEN
-              DO  m = 1, surf_usm_h%ns
-                 i = surf_usm_h%i(m) !+ surf_usm_h%ioff
-                 j = surf_usm_h%j(m) !+ surf_usm_h%joff
-                 k = surf_usm_h%k(m) !+ surf_usm_h%koff
-                 local_pf(i,j,k) = surf_usm_h%iwghf_eb(m)
+              DO  m = 1, surf_usm_h(0)%ns
+                 i = surf_usm_h(0)%i(m) !+ surf_usm_h%ioff
+                 j = surf_usm_h(0)%j(m) !+ surf_usm_h%joff
+                 k = surf_usm_h(0)%k(m) !+ surf_usm_h%koff
+                 local_pf(i,j,k) = surf_usm_h(0)%iwghf_eb(m)
               ENDDO
            ENDIF
@@ -1895,9 +1903,9 @@
         CASE ( 'im_hf_roof_waste' )
            IF ( av == 0 )  THEN
-              DO m = 1, surf_usm_h%ns
-                 i = surf_usm_h%i(m) !+ surf_usm_h%ioff
-                 j = surf_usm_h%j(m) !+ surf_usm_h%joff
-                 k = surf_usm_h%k(m) !+ surf_usm_h%koff
-                 local_pf(i,j,k) = surf_usm_h%waste_heat(m)
+              DO m = 1, surf_usm_h(0)%ns
+                 i = surf_usm_h(0)%i(m) !+ surf_usm_h%ioff
+                 j = surf_usm_h(0)%j(m) !+ surf_usm_h%joff
+                 k = surf_usm_h(0)%k(m) !+ surf_usm_h%koff
+                 local_pf(i,j,k) = surf_usm_h(0)%waste_heat(m)
               ENDDO
            ENDIF
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 4670)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 4671)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4648 2020-08-25 07:52:08Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -1631,6 +1634,6 @@
        IF ( use_surface_fluxes  .AND.  constant_heatflux  .AND.  random_heatflux )  THEN
           IF ( surf_def_h(0)%ns >= 1 )  CALL disturb_heatflux( surf_def_h(0) )
-          IF ( surf_lsm_h%ns    >= 1 )  CALL disturb_heatflux( surf_lsm_h    )
-          IF ( surf_usm_h%ns    >= 1 )  CALL disturb_heatflux( surf_usm_h    )
+          IF ( surf_lsm_h(0)%ns >= 1 )  CALL disturb_heatflux( surf_lsm_h(0) )
+          IF ( surf_usm_h(0)%ns >= 1 )  CALL disturb_heatflux( surf_usm_h(0) )
        ENDIF
     ENDIF
@@ -1673,12 +1676,12 @@
                    mean_surface_level_height_l(sr) = mean_surface_level_height_l(sr) + zw(k-1)
                 ENDIF
-                IF ( surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i) )  THEN
-                   m = surf_lsm_h%start_index(j,i)
-                   k = surf_lsm_h%k(m)
+                IF ( surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) )  THEN
+                   m = surf_lsm_h(0)%start_index(j,i)
+                   k = surf_lsm_h(0)%k(m)
                    mean_surface_level_height_l(sr) = mean_surface_level_height_l(sr) + zw(k-1)
                 ENDIF
-                IF ( surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i) )  THEN
-                   m = surf_usm_h%start_index(j,i)
-                   k = surf_usm_h%k(m)
+                IF ( surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) )  THEN
+                   m = surf_usm_h(0)%start_index(j,i)
+                   k = surf_usm_h(0)%k(m)
                    mean_surface_level_height_l(sr) = mean_surface_level_height_l(sr) + zw(k-1)
                 ENDIF
Index: palm/trunk/SOURCE/lagrangian_particle_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4671)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4648 2020-08-25 07:52:08Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -1055,5 +1058,5 @@
 !--    exact for heterogeneous z0.
 !--    However, sensitivity studies showed that the effect is negligible.
-       z0_av_local  = SUM( surf_def_h(0)%z0 ) + SUM( surf_lsm_h%z0 ) + SUM( surf_usm_h%z0 )
+       z0_av_local  = SUM( surf_def_h(0)%z0 ) + SUM( surf_lsm_h(0)%z0 ) + SUM( surf_usm_h(0)%z0 )
        z0_av_global = 0.0_wp
 
Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4671)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces for RTM 4.1
+! Author: J. Resler (Institute of Computer Science, Prague)
+!
+! 4669 2020-09-09 13:43:47Z pavelkrc
 ! Fix calculation of force_radiation_call
 ! 
@@ -449,32 +453,36 @@
                                    zs_layer = 9999999.9_wp             !< soil layer depths (edge)
 
-    TYPE(surf_type_lsm), POINTER ::  t_soil_h,    & !< Soil temperature (K), horizontal surface elements
-                                     t_soil_h_p,  & !< Prog. soil temperature (K), horizontal surface elements
-                                     m_soil_h,    & !< Soil moisture (m3/m3), horizontal surface elements
-                                     m_soil_h_p     !< Prog. soil moisture (m3/m3), horizontal surface elements
-
-    TYPE(surf_type_lsm), TARGET  ::  t_soil_h_1,  & !<
-                                     t_soil_h_2,  & !<
-                                     m_soil_h_1,  & !<
-                                     m_soil_h_2     !<
-
-    TYPE(surf_type_lsm), DIMENSION(:), POINTER :: &
-                                     t_soil_v,    & !< Soil temperature (K), vertical surface elements
-                                     t_soil_v_p,  & !< Prog. soil temperature (K), vertical surface elements
-                                     m_soil_v,    & !< Soil moisture (m3/m3), vertical surface elements
-                                     m_soil_v_p     !< Prog. soil moisture (m3/m3), vertical surface elements
-
-    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::&
-                                     t_soil_v_1,  & !<
-                                     t_soil_v_2,  & !<
-                                     m_soil_v_1,  & !<
-                                     m_soil_v_2     !<
-
-    TYPE(surf_type_lsm), POINTER  ::  t_surface_h,    & !< surface temperature (K), horizontal surface elements
+    TYPE(surf_type_lsm), DIMENSION(:), POINTER ::     &
+                                     t_soil_h,        & !< Soil temperature (K), horizontal surface elements
+                                     t_soil_h_p,      & !< Prog. soil temperature (K), horizontal surface elements
+                                     m_soil_h,        & !< Soil moisture (m3/m3), horizontal surface elements
+                                     m_soil_h_p         !< Prog. soil moisture (m3/m3), horizontal surface elements
+
+    TYPE(surf_type_lsm), DIMENSION(0:1), TARGET ::    &
+                                     t_soil_h_1,      & !<
+                                     t_soil_h_2,      & !<
+                                     m_soil_h_1,      & !<
+                                     m_soil_h_2         !<
+
+    TYPE(surf_type_lsm), DIMENSION(:), POINTER ::     &
+                                     t_soil_v,        & !< Soil temperature (K), vertical surface elements
+                                     t_soil_v_p,      & !< Prog. soil temperature (K), vertical surface elements
+                                     m_soil_v,        & !< Soil moisture (m3/m3), vertical surface elements
+                                     m_soil_v_p         !< Prog. soil moisture (m3/m3), vertical surface elements
+
+    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::    &
+                                     t_soil_v_1,      & !<
+                                     t_soil_v_2,      & !<
+                                     m_soil_v_1,      & !<
+                                     m_soil_v_2        !<
+
+    TYPE(surf_type_lsm), DIMENSION(:), POINTER ::&
+                                      t_surface_h,    & !< surface temperature (K), horizontal surface elements
                                       t_surface_h_p,  & !< progn. surface temperature (K), horizontal surface elements
                                       m_liq_h,        & !< liquid water reservoir (m), horizontal surface elements
                                       m_liq_h_p         !< progn. liquid water reservoir (m), horizontal surface elements
 
-    TYPE(surf_type_lsm), TARGET   ::  t_surface_h_1,  & !<
+    TYPE(surf_type_lsm), DIMENSION(0:1), TARGET ::    &
+                                      t_surface_h_1,  & !<
                                       t_surface_h_2,  & !<
                                       m_liq_h_1,      & !<
@@ -498,8 +506,8 @@
                                                         m_soil_av    !< Average of m_soil
 
-    TYPE(surf_type_lsm), TARGET ::  tm_liq_h_m      !< liquid water reservoir tendency (m), horizontal surface elements
-    TYPE(surf_type_lsm), TARGET ::  tt_surface_h_m  !< surface temperature tendency (K), horizontal surface elements
-    TYPE(surf_type_lsm), TARGET ::  tt_soil_h_m     !< t_soil storage array, horizontal surface elements
-    TYPE(surf_type_lsm), TARGET ::  tm_soil_h_m     !< m_soil storage array, horizontal surface elements
+    TYPE(surf_type_lsm), DIMENSION(0:1), TARGET ::  tm_liq_h_m      !< liquid water reservoir tendency (m), horizontal surface elements
+    TYPE(surf_type_lsm), DIMENSION(0:1), TARGET ::  tt_surface_h_m  !< surface temperature tendency (K), horizontal surface elements
+    TYPE(surf_type_lsm), DIMENSION(0:1), TARGET ::  tt_soil_h_m     !< t_soil storage array, horizontal surface elements
+    TYPE(surf_type_lsm), DIMENSION(0:1), TARGET ::  tm_soil_h_m     !< m_soil storage array, horizontal surface elements
 
     TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tm_liq_v_m      !< liquid water reservoir tendency (m), vertical surface elements
@@ -871,10 +879,12 @@
     INTEGER(iwp) :: m      !< running index surface elements
 
-    koff = surf_lsm_h%koff
-    DO  m = 1, surf_lsm_h%ns
-       i = surf_lsm_h%i(m)
-       j = surf_lsm_h%j(m)
-       k = surf_lsm_h%k(m)
-       pt(k+koff,j,i) = pt(k,j,i)
+    DO l = 0, 1
+       koff = surf_lsm_h(l)%koff
+       DO  m = 1, surf_lsm_h(l)%ns
+          i = surf_lsm_h(l)%i(m)
+          j = surf_lsm_h(l)%j(m)
+          k = surf_lsm_h(l)%k(m)
+          pt(k+koff,j,i) = pt(k,j,i)
+       ENDDO
     ENDDO
 
@@ -892,13 +902,14 @@
 !-- In case of humidity, set boundary conditions also for q and vpt.
     IF ( humidity )  THEN
-       koff = surf_lsm_h%koff
-       DO  m = 1, surf_lsm_h%ns
-          i = surf_lsm_h%i(m)
-          j = surf_lsm_h%j(m)
-          k = surf_lsm_h%k(m)
-          q(k+koff,j,i)   = q(k,j,i)
-          vpt(k+koff,j,i) = vpt(k,j,i)
+       DO  l = 0, 1
+          koff = surf_lsm_h(l)%koff
+          DO  m = 1, surf_lsm_h(l)%ns
+             i = surf_lsm_h(l)%i(m)
+             j = surf_lsm_h(l)%j(m)
+             k = surf_lsm_h(l)%k(m)
+             q(k+koff,j,i)   = q(k,j,i)
+             vpt(k+koff,j,i) = vpt(k,j,i)
+          ENDDO
        ENDDO
-
        DO  l = 0, 3
           ioff = surf_lsm_v(l)%ioff
@@ -1597,7 +1608,37 @@
 ! Description:
 ! ------------
+!> Calls energy balance solver and soil energy model the surfaces in all directions.
+!------------------------------------------------------------------------------!
+ SUBROUTINE lsm_energy_balance ( during_spinup )
+
+    USE control_parameters,                                                                        &
+        ONLY:  calc_soil_moisture_during_spinup
+
+    LOGICAL      ::  during_spinup  !< flag indicating soil/wall spinup phase
+    LOGICAL      ::  calc_sm
+    INTEGER(iwp) ::  l              !< loop index for surface types
+
+    calc_sm = .NOT. during_spinup .OR. calc_soil_moisture_during_spinup
+!
+!-- Call for horizontal surfaces
+    DO l = 0, 1
+       CALL lsm_surface_energy_balance( .TRUE., l )
+       CALL lsm_soil_model( .TRUE., l, calc_sm )
+    ENDDO
+!
+!--   Call for vertical surfaces
+    DO l = 0, 3
+       CALL lsm_surface_energy_balance( .FALSE., l )
+       CALL lsm_soil_model( .FALSE., l, calc_sm )
+    ENDDO
+
+END SUBROUTINE lsm_energy_balance
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
 !> Solver for the energy balance at the surface.
 !------------------------------------------------------------------------------!
- SUBROUTINE lsm_energy_balance( horizontal, l )
+ SUBROUTINE lsm_surface_energy_balance( horizontal, l )
 
     USE pegrid
@@ -1617,4 +1658,5 @@
 
     LOGICAL      ::  horizontal !< Flag indicating horizontal or vertical surfaces
+    LOGICAL      ::  upward     !< Flag indicating upward horizontal surfaces
 
     REAL(wp) :: c_surface_tmp,  & !< temporary variable for storing the volumetric heat capacity of the surface
@@ -1654,22 +1696,22 @@
 
     IF ( debug_output_timestep )  THEN
-       WRITE( debug_string, * ) 'lsm_energy_balance', horizontal, l
+       WRITE( debug_string, * ) 'lsm_surface_energy_balance', horizontal, l
        CALL debug_message( debug_string, 'start' )
     ENDIF
 
+    upward = .FALSE.
     IF ( horizontal )  THEN
-       surf              => surf_lsm_h
-
-       surf_t_surface    => t_surface_h
-       surf_t_surface_p  => t_surface_h_p
-       surf_tt_surface_m => tt_surface_h_m
-       surf_m_liq        => m_liq_h
-       surf_m_liq_p      => m_liq_h_p
-       surf_tm_liq_m     => tm_liq_h_m
-       surf_m_soil       => m_soil_h
-       surf_t_soil       => t_soil_h
+       surf              => surf_lsm_h(l)
+       surf_t_surface    => t_surface_h(l)
+       surf_t_surface_p  => t_surface_h_p(l)
+       surf_tt_surface_m => tt_surface_h_m(l)
+       surf_m_liq        => m_liq_h(l)
+       surf_m_liq_p      => m_liq_h_p(l)
+       surf_tm_liq_m     => tm_liq_h_m(l)
+       surf_m_soil       => m_soil_h(l)
+       surf_t_soil       => t_soil_h(l)
+       IF ( l == 0 ) upward = .TRUE.
     ELSE
        surf              => surf_lsm_v(l)
-
        surf_t_surface    => t_surface_v(l)
        surf_t_surface_p  => t_surface_v_p(l)
@@ -1777,5 +1819,5 @@
 !        ENDIF
 !
-!--     Calculation of r_a for vertical surfaces
+!--     Calculation of r_a for vertical and horizontal downward surfaces
 !--
 !--     heat transfer coefficient for forced convection along vertical walls
@@ -1806,5 +1848,5 @@
 !--    holes, the resistance can become negative. For this reason, limit r_a
 !--    to positive values.
-       IF ( horizontal  .OR.  .NOT. aero_resist_kray )  THEN
+       IF ( upward .OR.  .NOT. aero_resist_kray )  THEN
           surf%r_a(m) = ABS( ( surf%pt1(m) - surf%pt_surface(m) ) /                               &
                              ( surf%ts(m) * surf%us(m) + 1.0E-20_wp ) )
@@ -2055,5 +2097,5 @@
 !
 ! update the 3d field of rad_lw_out array to have consistent output
-       IF ( horizontal ) THEN
+       IF ( upward )  THEN
           IF ( radiation_scheme == 'rrtmg' ) THEN
              rad_lw_out(k+k_off,j+j_off,i+i_off) = surf%rad_lw_out(m)
@@ -2217,8 +2259,8 @@
 !
 !-- Calculate new roughness lengths (for water surfaces only)
-    IF ( horizontal  .AND.  .NOT. constant_roughness )  CALL calc_z0_water_surface
+    IF ( upward .AND.  .NOT. constant_roughness )  CALL calc_z0_water_surface
 
     IF ( debug_output_timestep )  THEN
-       WRITE( debug_string, * ) 'lsm_energy_balance', horizontal, l
+       WRITE( debug_string, * ) 'lsm_surface_energy_balance', horizontal, l
        CALL debug_message( debug_string, 'end' )
     ENDIF
@@ -2282,5 +2324,5 @@
     END SUBROUTINE calc_q_surface
 
- END SUBROUTINE lsm_energy_balance
+ END SUBROUTINE lsm_surface_energy_balance
 
 
@@ -2443,20 +2485,22 @@
 !--    Set initial values for prognostic quantities
 !--    Horizontal surfaces
-       tt_surface_h_m%var_1d = 0.0_wp
-       tt_soil_h_m%var_2d    = 0.0_wp
-       tm_soil_h_m%var_2d    = 0.0_wp
-       tm_liq_h_m%var_1d     = 0.0_wp
-       surf_lsm_h%c_liq      = 0.0_wp
-
-       surf_lsm_h%ghf = 0.0_wp
-
-       surf_lsm_h%qsws_liq  = 0.0_wp
-       surf_lsm_h%qsws_soil = 0.0_wp
-       surf_lsm_h%qsws_veg  = 0.0_wp
-
-       surf_lsm_h%r_a        = 50.0_wp
-       surf_lsm_h%r_s        = 50.0_wp
-       surf_lsm_h%r_canopy   = 0.0_wp
-       surf_lsm_h%r_soil     = 0.0_wp
+       DO  l = 0, 1
+          tt_surface_h_m(l)%var_1d = 0.0_wp
+          tt_soil_h_m(l)%var_2d    = 0.0_wp
+          tm_soil_h_m(l)%var_2d    = 0.0_wp
+          tm_liq_h_m(l)%var_1d     = 0.0_wp
+          surf_lsm_h(l)%c_liq      = 0.0_wp
+
+          surf_lsm_h(l)%ghf = 0.0_wp
+
+          surf_lsm_h(l)%qsws_liq  = 0.0_wp
+          surf_lsm_h(l)%qsws_soil = 0.0_wp
+          surf_lsm_h(l)%qsws_veg  = 0.0_wp
+
+          surf_lsm_h(l)%r_a        = 50.0_wp
+          surf_lsm_h(l)%r_s        = 50.0_wp
+          surf_lsm_h(l)%r_canopy   = 0.0_wp
+          surf_lsm_h(l)%r_soil     = 0.0_wp
+       ENDDO
 !
 !--    Do the same for vertical surfaces
@@ -2483,8 +2527,9 @@
 !--    Set initial values for prognostic soil quantities
        IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
-          t_soil_h%var_2d = 0.0_wp
-          m_soil_h%var_2d = 0.0_wp
-          m_liq_h%var_1d  = 0.0_wp
-
+          DO  l = 0, 1
+             t_soil_h(l)%var_2d = 0.0_wp
+             m_soil_h(l)%var_2d = 0.0_wp
+             m_liq_h(l)%var_1d  = 0.0_wp
+          ENDDO
           DO  l = 0, 3
              t_soil_v(l)%var_2d = 0.0_wp
@@ -2496,27 +2541,29 @@
 !--    Allocate 3D soil model arrays
 !--    First, for horizontal surfaces
-       ALLOCATE ( surf_lsm_h%alpha_vg(nzb_soil:nzt_soil,1:surf_lsm_h%ns)    )
-       ALLOCATE ( surf_lsm_h%gamma_w_sat(nzb_soil:nzt_soil,1:surf_lsm_h%ns) )
-       ALLOCATE ( surf_lsm_h%lambda_h(nzb_soil:nzt_soil,1:surf_lsm_h%ns)    )
-       ALLOCATE ( surf_lsm_h%lambda_h_def(nzb_soil:nzt_soil,1:surf_lsm_h%ns))
-       ALLOCATE ( surf_lsm_h%l_vg(nzb_soil:nzt_soil,1:surf_lsm_h%ns)        )
-       ALLOCATE ( surf_lsm_h%m_fc(nzb_soil:nzt_soil,1:surf_lsm_h%ns)        )
-       ALLOCATE ( surf_lsm_h%m_res(nzb_soil:nzt_soil,1:surf_lsm_h%ns)       )
-       ALLOCATE ( surf_lsm_h%m_sat(nzb_soil:nzt_soil,1:surf_lsm_h%ns)       )
-       ALLOCATE ( surf_lsm_h%m_wilt(nzb_soil:nzt_soil,1:surf_lsm_h%ns)      )
-       ALLOCATE ( surf_lsm_h%n_vg(nzb_soil:nzt_soil,1:surf_lsm_h%ns)        )
-       ALLOCATE ( surf_lsm_h%rho_c_total(nzb_soil:nzt_soil,1:surf_lsm_h%ns) )
-       ALLOCATE ( surf_lsm_h%rho_c_total_def(nzb_soil:nzt_soil,1:surf_lsm_h%ns) )
-       ALLOCATE ( surf_lsm_h%root_fr(nzb_soil:nzt_soil,1:surf_lsm_h%ns)     )
-
-       surf_lsm_h%lambda_h     = 0.0_wp
-!
-!--    If required, allocate humidity-related variables for the soil model
-       IF ( humidity )  THEN
-          ALLOCATE ( surf_lsm_h%lambda_w(nzb_soil:nzt_soil,1:surf_lsm_h%ns) )
-          ALLOCATE ( surf_lsm_h%gamma_w(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  )
-
-          surf_lsm_h%lambda_w = 0.0_wp
-       ENDIF
+       DO  l = 0, 1
+          ALLOCATE ( surf_lsm_h(l)%alpha_vg(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)    )
+          ALLOCATE ( surf_lsm_h(l)%gamma_w_sat(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns) )
+          ALLOCATE ( surf_lsm_h(l)%lambda_h(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)    )
+          ALLOCATE ( surf_lsm_h(l)%lambda_h_def(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns))
+          ALLOCATE ( surf_lsm_h(l)%l_vg(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)        )
+          ALLOCATE ( surf_lsm_h(l)%m_fc(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)        )
+          ALLOCATE ( surf_lsm_h(l)%m_res(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)       )
+          ALLOCATE ( surf_lsm_h(l)%m_sat(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)       )
+          ALLOCATE ( surf_lsm_h(l)%m_wilt(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)      )
+          ALLOCATE ( surf_lsm_h(l)%n_vg(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)        )
+          ALLOCATE ( surf_lsm_h(l)%rho_c_total(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns) )
+          ALLOCATE ( surf_lsm_h(l)%rho_c_total_def(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns) )
+          ALLOCATE ( surf_lsm_h(l)%root_fr(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)     )
+
+          surf_lsm_h(l)%lambda_h     = 0.0_wp
+!
+!--       If required, allocate humidity-related variables for the soil model
+          IF ( humidity )  THEN
+             ALLOCATE ( surf_lsm_h(l)%lambda_w(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns) )
+             ALLOCATE ( surf_lsm_h(l)%gamma_w(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)  )
+
+             surf_lsm_h(l)%lambda_w = 0.0_wp
+          ENDIF
+       ENDDO
 !
 !--    For vertical surfaces
@@ -2551,16 +2598,18 @@
 !--    fraction.
 !--    Set default values at each surface element.
-       ALLOCATE ( surf_lsm_h%albedo_type(1:surf_lsm_h%ns,0:2) )
-       ALLOCATE ( surf_lsm_h%emissivity(1:surf_lsm_h%ns,0:2) )
-!
-!--    Initialize albedo type according to its default type, in order to set values
-!--    independent on default albedo_type in radiation model.
-       surf_lsm_h%albedo_type(:,ind_veg_wall)  =                               &
-                             INT( vegetation_pars(ind_v_at,vegetation_type) )
-       surf_lsm_h%albedo_type(:,ind_wat_win)   =                               &
-                             INT( water_pars(ind_w_at,water_type)           )
-       surf_lsm_h%albedo_type(:,ind_pav_green) =                               &
-                             INT( pavement_pars(ind_p_at,pavement_type)     )
-       surf_lsm_h%emissivity  = emissivity
+       DO  l = 0, 1
+          ALLOCATE ( surf_lsm_h(l)%albedo_type(1:surf_lsm_h(l)%ns,0:2) )
+          ALLOCATE ( surf_lsm_h(l)%emissivity(1:surf_lsm_h(l)%ns,0:2) )
+!
+!--       Initialize albedo type according to its default type, in order to set values
+!--       independent on default albedo_type in radiation model.
+          surf_lsm_h(l)%albedo_type(:,ind_veg_wall)  =                               &
+                                INT( vegetation_pars(ind_v_at,vegetation_type) )
+          surf_lsm_h(l)%albedo_type(:,ind_wat_win)   =                               &
+                                INT( water_pars(ind_w_at,water_type)           )
+          surf_lsm_h(l)%albedo_type(:,ind_pav_green) =                               &
+                                INT( pavement_pars(ind_p_at,pavement_type)     )
+          surf_lsm_h(l)%emissivity  = emissivity
+       ENDDO
        DO  l = 0, 3
           ALLOCATE ( surf_lsm_v(l)%albedo_type(1:surf_lsm_v(l)%ns,0:2) )
@@ -2580,6 +2629,8 @@
 !--    Allocate arrays for relative surface fraction.
 !--    0 - vegetation fraction, 2 - water fraction, 1 - pavement fraction
-       ALLOCATE( surf_lsm_h%frac(1:surf_lsm_h%ns,0:2) )
-       surf_lsm_h%frac = 0.0_wp
+       DO  l = 0, 1
+          ALLOCATE( surf_lsm_h(l)%frac(1:surf_lsm_h(l)%ns,0:2) )
+          surf_lsm_h(l)%frac = 0.0_wp
+       ENDDO
        DO  l = 0, 3
           ALLOCATE( surf_lsm_v(l)%frac(1:surf_lsm_v(l)%ns,0:2) )
@@ -2595,20 +2646,21 @@
 !--    Allocate arrays for the respective types and their names on the surface
 !--    elements. This will be required to treat deposition of chemical species.
-       ALLOCATE( surf_lsm_h%pavement_type(1:surf_lsm_h%ns)   )
-       ALLOCATE( surf_lsm_h%vegetation_type(1:surf_lsm_h%ns) )
-       ALLOCATE( surf_lsm_h%water_type(1:surf_lsm_h%ns)      )
-
-       surf_lsm_h%pavement_type   = 0
-       surf_lsm_h%vegetation_type = 0
-       surf_lsm_h%water_type      = 0
-
-       ALLOCATE( surf_lsm_h%pavement_type_name(1:surf_lsm_h%ns)   )
-       ALLOCATE( surf_lsm_h%vegetation_type_name(1:surf_lsm_h%ns) )
-       ALLOCATE( surf_lsm_h%water_type_name(1:surf_lsm_h%ns)      )
-
-       surf_lsm_h%pavement_type_name   = 'none'
-       surf_lsm_h%vegetation_type_name = 'none'
-       surf_lsm_h%water_type_name      = 'none'
-
+       DO  l = 0, 1
+          ALLOCATE( surf_lsm_h(l)%pavement_type(1:surf_lsm_h(l)%ns)   )
+          ALLOCATE( surf_lsm_h(l)%vegetation_type(1:surf_lsm_h(l)%ns) )
+          ALLOCATE( surf_lsm_h(l)%water_type(1:surf_lsm_h(l)%ns)      )
+
+          surf_lsm_h(l)%pavement_type   = 0
+          surf_lsm_h(l)%vegetation_type = 0
+          surf_lsm_h(l)%water_type      = 0
+
+          ALLOCATE( surf_lsm_h(l)%pavement_type_name(1:surf_lsm_h(l)%ns)   )
+          ALLOCATE( surf_lsm_h(l)%vegetation_type_name(1:surf_lsm_h(l)%ns) )
+          ALLOCATE( surf_lsm_h(l)%water_type_name(1:surf_lsm_h(l)%ns)      )
+
+          surf_lsm_h(l)%pavement_type_name   = 'none'
+          surf_lsm_h(l)%vegetation_type_name = 'none'
+          surf_lsm_h(l)%water_type_name      = 'none'
+       ENDDO
        DO  l = 0, 3
           ALLOCATE( surf_lsm_v(l)%pavement_type(1:surf_lsm_v(l)%ns)   )
@@ -2635,7 +2687,8 @@
 
           CASE ( 'vegetation' )
-
-             surf_lsm_h%vegetation_surface = .TRUE.
-             surf_lsm_h%frac(:,ind_veg_wall) = 1.0_wp
+             DO  l = 0, 1
+                surf_lsm_h(l)%vegetation_surface = .TRUE.
+                surf_lsm_h(l)%frac(:,ind_veg_wall) = 1.0_wp
+             ENDDO
              DO  l = 0, 3
                 surf_lsm_v(l)%vegetation_surface = .TRUE.
@@ -2644,9 +2697,10 @@
 
           CASE ( 'water' )
-
-             surf_lsm_h%water_surface = .TRUE.
-             surf_lsm_h%frac(:,ind_wat_win) = 1.0_wp
-!
-!--          Note, vertical water surface does not really make sense.
+!
+!--          Note, downward and vertical water surface does not really make sense.
+             DO  l = 0, 1
+               surf_lsm_h(l)%water_surface = .TRUE.
+               surf_lsm_h(l)%frac(:,ind_wat_win) = 1.0_wp
+             ENDDO
              DO  l = 0, 3
                 surf_lsm_v(l)%water_surface   = .TRUE.
@@ -2655,7 +2709,8 @@
 
           CASE ( 'pavement' )
-
-             surf_lsm_h%pavement_surface = .TRUE.
-                surf_lsm_h%frac(:,ind_pav_green) = 1.0_wp
+             DO  l = 0, 1
+                surf_lsm_h(l)%pavement_surface = .TRUE.
+                surf_lsm_h(l)%frac(:,ind_pav_green) = 1.0_wp
+             ENDDO
              DO  l = 0, 3
                 surf_lsm_v(l)%pavement_surface   = .TRUE.
@@ -2664,27 +2719,27 @@
 
           CASE ( 'netcdf' )
-
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-                IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )    &
-                   surf_lsm_h%vegetation_surface(m) = .TRUE.
-                IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill )      &
-                   surf_lsm_h%pavement_surface(m) = .TRUE.
-                IF ( water_type_f%var(j,i)      /= water_type_f%fill )         &
-                   surf_lsm_h%water_surface(m) = .TRUE.
-!
-!--             Check if at least one type is set.
-                IF ( .NOT. surf_lsm_h%vegetation_surface(m)  .AND.             &
-                     .NOT. surf_lsm_h%pavement_surface(m)    .AND.             &
-                     .NOT. surf_lsm_h%water_surface(m) )  THEN
-                   WRITE( message_string, * ) 'Horizontal surface element ' // &
-                                       ' at i, j = ',  i, j,                   &
-                                       ' is neither a vegetation, ' //         &
-                                       'pavement, nor a water surface.'
-                   CALL message( 'land_surface_model_mod', 'PA0619',          &
-                                  2, 2, myid, 6, 0 )
-                ENDIF
-
+             DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+                   IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )    &
+                      surf_lsm_h(l)%vegetation_surface(m) = .TRUE.
+                   IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill )      &
+                      surf_lsm_h(l)%pavement_surface(m) = .TRUE.
+                   IF ( water_type_f%var(j,i)      /= water_type_f%fill )         &
+                      surf_lsm_h(l)%water_surface(m) = .TRUE.
+   !
+   !--             Check if at least one type is set.
+                   IF ( .NOT. surf_lsm_h(l)%vegetation_surface(m)  .AND.             &
+                        .NOT. surf_lsm_h(l)%pavement_surface(m)    .AND.             &
+                        .NOT. surf_lsm_h(l)%water_surface(m) )  THEN
+                      WRITE( message_string, * ) 'Horizontal surface element ' // &
+                                          ' at i, j = ',  i, j,                   &
+                                          ' is neither a vegetation, ' //         &
+                                          'pavement, nor a water surface.'
+                      CALL message( 'land_surface_model_mod', 'PA0619',          &
+                                     2, 2, myid, 6, 0 )
+                   ENDIF
+                ENDDO
              ENDDO
 !
@@ -2790,46 +2845,47 @@
 !--    location (already checked).
        IF ( input_pids_static  .AND.  surface_fraction_f%from_file )  THEN
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-!
-!--          0 - vegetation fraction, 1 - pavement fraction, 2 - water fraction
-             IF ( surface_fraction_f%frac(ind_veg_wall,j,i) /=                 &
-                  surface_fraction_f%fill )  THEN
-                surf_lsm_h%frac(m,ind_veg_wall)  =                             &
-                                    surface_fraction_f%frac(ind_veg_wall,j,i)
-             ENDIF
-             IF ( surface_fraction_f%frac(ind_pav_green,j,i) /=                &
-                  surface_fraction_f%fill )  THEN
-                surf_lsm_h%frac(m,ind_pav_green) =                             &
-                                    surface_fraction_f%frac(ind_pav_green,j,i)
-             ENDIF
-             IF ( surface_fraction_f%frac(ind_wat_win,j,i) /=                  &
-                  surface_fraction_f%fill )  THEN
-                surf_lsm_h%frac(m,ind_wat_win)   =                             &
-                                    surface_fraction_f%frac(ind_wat_win,j,i)
-             ENDIF
-!
-!--          Check if sum of relative fractions is zero. This case, give an
-!--          error message.
-             IF ( SUM ( surf_lsm_h%frac(m,:) ) == 0.0_wp )  THEN
-                WRITE( message_string, * )                                     &
-                                 'surface fractions at grid point (j,i) = (',  &
-                                 j, i, ') are all zero.'
-                CALL message( 'land_surface_model_mod', 'PA0688',              &
-                               2, 2, myid, 6, 0 )
-             ENDIF
-!
-!--          In case the sum of all surfaces is not 1, which may happen
-!--          due to rounding errors or type conversions, normalize the
-!--          fractions to one. Note, at the moment no tile approach is
-!--          implemented, so that relative fractions are either 1 or zero.
-             IF ( SUM ( surf_lsm_h%frac(m,:) ) > 1.0_wp  .OR.                  &
-                  SUM ( surf_lsm_h%frac(m,:) ) < 1.0_wp  )  THEN
-                surf_lsm_h%frac(m,:) = surf_lsm_h%frac(m,:) /                  &
-                                       SUM ( surf_lsm_h%frac(m,:) )
-
-             ENDIF
-
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+   !
+   !--          0 - vegetation fraction, 1 - pavement fraction, 2 - water fraction
+                IF ( surface_fraction_f%frac(ind_veg_wall,j,i) /=                 &
+                     surface_fraction_f%fill )  THEN
+                   surf_lsm_h(l)%frac(m,ind_veg_wall)  =                             &
+                                       surface_fraction_f%frac(ind_veg_wall,j,i)
+                ENDIF
+                IF ( surface_fraction_f%frac(ind_pav_green,j,i) /=                &
+                     surface_fraction_f%fill )  THEN
+                   surf_lsm_h(l)%frac(m,ind_pav_green) =                             &
+                                       surface_fraction_f%frac(ind_pav_green,j,i)
+                ENDIF
+                IF ( surface_fraction_f%frac(ind_wat_win,j,i) /=                  &
+                     surface_fraction_f%fill )  THEN
+                   surf_lsm_h(l)%frac(m,ind_wat_win)   =                             &
+                                       surface_fraction_f%frac(ind_wat_win,j,i)
+                ENDIF
+   !
+   !--          Check if sum of relative fractions is zero. This case, give an
+   !--          error message.
+                IF ( SUM ( surf_lsm_h(l)%frac(m,:) ) == 0.0_wp )  THEN
+                   WRITE( message_string, * )                                     &
+                                    'surface fractions at grid point (j,i) = (',  &
+                                    j, i, ') are all zero.'
+                   CALL message( 'land_surface_model_mod', 'PA0688',              &
+                                  2, 2, myid, 6, 0 )
+                ENDIF
+   !
+   !--          In case the sum of all surfaces is not 1, which may happen
+   !--          due to rounding errors or type conversions, normalize the
+   !--          fractions to one. Note, at the moment no tile approach is
+   !--          implemented, so that relative fractions are either 1 or zero.
+                IF ( SUM ( surf_lsm_h(l)%frac(m,:) ) > 1.0_wp  .OR.                  &
+                     SUM ( surf_lsm_h(l)%frac(m,:) ) < 1.0_wp  )  THEN
+                   surf_lsm_h(l)%frac(m,:) = surf_lsm_h(l)%frac(m,:) /                  &
+                                          SUM ( surf_lsm_h(l)%frac(m,:) )
+
+                ENDIF
+             ENDDO
           ENDDO
           DO  l = 0, 3
@@ -2881,14 +2937,16 @@
        ELSEIF ( input_pids_static  .AND.  .NOT. surface_fraction_f%from_file ) &
        THEN
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-
-             IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )       &
-                surf_lsm_h%frac(m,ind_veg_wall)  = 1.0_wp
-             IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill   )       &
-                surf_lsm_h%frac(m,ind_pav_green) = 1.0_wp
-             IF ( water_type_f%var(j,i)      /= water_type_f%fill      )       &
-                surf_lsm_h%frac(m,ind_wat_win)   = 1.0_wp
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+
+                IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )       &
+                   surf_lsm_h(l)%frac(m,ind_veg_wall)  = 1.0_wp
+                IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill   )       &
+                   surf_lsm_h(l)%frac(m,ind_pav_green) = 1.0_wp
+                IF ( water_type_f%var(j,i)      /= water_type_f%fill      )       &
+                   surf_lsm_h(l)%frac(m,ind_wat_win)   = 1.0_wp
+             ENDDO
           ENDDO
           DO  l = 0, 3
@@ -2950,13 +3008,15 @@
 !--    Map values to the respective 2D/3D arrays
 !--    Horizontal surfaces
-       surf_lsm_h%alpha_vg      = alpha_vangenuchten
-       surf_lsm_h%l_vg          = l_vangenuchten
-       surf_lsm_h%n_vg          = n_vangenuchten
-       surf_lsm_h%gamma_w_sat   = hydraulic_conductivity
-       surf_lsm_h%m_sat         = saturation_moisture
-       surf_lsm_h%m_fc          = field_capacity
-       surf_lsm_h%m_wilt        = wilting_point
-       surf_lsm_h%m_res         = residual_moisture
-       surf_lsm_h%r_soil_min    = min_soil_resistance
+       DO  l = 0, 1
+          surf_lsm_h(l)%alpha_vg      = alpha_vangenuchten
+          surf_lsm_h(l)%l_vg          = l_vangenuchten
+          surf_lsm_h(l)%n_vg          = n_vangenuchten
+          surf_lsm_h(l)%gamma_w_sat   = hydraulic_conductivity
+          surf_lsm_h(l)%m_sat         = saturation_moisture
+          surf_lsm_h(l)%m_fc          = field_capacity
+          surf_lsm_h(l)%m_wilt        = wilting_point
+          surf_lsm_h(l)%m_res         = residual_moisture
+          surf_lsm_h(l)%r_soil_min    = min_soil_resistance
+       ENDDO
 !
 !--    Vertical surfaces
@@ -2984,19 +3044,21 @@
 !
 !--          Horizontal surfaces
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-
-                st = soil_type_f%var_2d(j,i)
-                IF ( st /= soil_type_f%fill )  THEN
-                   surf_lsm_h%alpha_vg(:,m)    = soil_pars(0,st)
-                   surf_lsm_h%l_vg(:,m)        = soil_pars(1,st)
-                   surf_lsm_h%n_vg(:,m)        = soil_pars(2,st)
-                   surf_lsm_h%gamma_w_sat(:,m) = soil_pars(3,st)
-                   surf_lsm_h%m_sat(:,m)       = soil_pars(4,st)
-                   surf_lsm_h%m_fc(:,m)        = soil_pars(5,st)
-                   surf_lsm_h%m_wilt(:,m)      = soil_pars(6,st)
-                   surf_lsm_h%m_res(:,m)       = soil_pars(7,st)
-                ENDIF
+             DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+
+                   st = soil_type_f%var_2d(j,i)
+                   IF ( st /= soil_type_f%fill )  THEN
+                      surf_lsm_h(l)%alpha_vg(:,m)    = soil_pars(0,st)
+                      surf_lsm_h(l)%l_vg(:,m)        = soil_pars(1,st)
+                      surf_lsm_h(l)%n_vg(:,m)        = soil_pars(2,st)
+                      surf_lsm_h(l)%gamma_w_sat(:,m) = soil_pars(3,st)
+                      surf_lsm_h(l)%m_sat(:,m)       = soil_pars(4,st)
+                      surf_lsm_h(l)%m_fc(:,m)        = soil_pars(5,st)
+                      surf_lsm_h(l)%m_wilt(:,m)      = soil_pars(6,st)
+                      surf_lsm_h(l)%m_res(:,m)       = soil_pars(7,st)
+                   ENDIF
+                ENDDO
              ENDDO
 !
@@ -3028,20 +3090,22 @@
 !
 !--          Horizontal surfaces
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-
-                DO  k = nzb_soil, nzt_soil
-                   st = soil_type_f%var_3d(k,j,i)
-                   IF ( st /= soil_type_f%fill )  THEN
-                      surf_lsm_h%alpha_vg(k,m)    = soil_pars(0,st)
-                      surf_lsm_h%l_vg(k,m)        = soil_pars(1,st)
-                      surf_lsm_h%n_vg(k,m)        = soil_pars(2,st)
-                      surf_lsm_h%gamma_w_sat(k,m) = soil_pars(3,st)
-                      surf_lsm_h%m_sat(k,m)       = soil_pars(4,st)
-                      surf_lsm_h%m_fc(k,m)        = soil_pars(5,st)
-                      surf_lsm_h%m_wilt(k,m)      = soil_pars(6,st)
-                      surf_lsm_h%m_res(k,m)       = soil_pars(7,st)
-                   ENDIF
+             DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+
+                   DO  k = nzb_soil, nzt_soil
+                      st = soil_type_f%var_3d(k,j,i)
+                      IF ( st /= soil_type_f%fill )  THEN
+                         surf_lsm_h(l)%alpha_vg(k,m)    = soil_pars(0,st)
+                         surf_lsm_h(l)%l_vg(k,m)        = soil_pars(1,st)
+                         surf_lsm_h(l)%n_vg(k,m)        = soil_pars(2,st)
+                         surf_lsm_h(l)%gamma_w_sat(k,m) = soil_pars(3,st)
+                         surf_lsm_h(l)%m_sat(k,m)       = soil_pars(4,st)
+                         surf_lsm_h(l)%m_fc(k,m)        = soil_pars(5,st)
+                         surf_lsm_h(l)%m_wilt(k,m)      = soil_pars(6,st)
+                         surf_lsm_h(l)%m_res(k,m)       = soil_pars(7,st)
+                      ENDIF
+                   ENDDO
                 ENDDO
              ENDDO
@@ -3083,25 +3147,26 @@
 !
 !--          Horizontal surfaces
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-
-                IF ( soil_pars_f%pars_xy(0,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%alpha_vg(:,m)    = soil_pars_f%pars_xy(0,j,i)
-                IF ( soil_pars_f%pars_xy(1,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%l_vg(:,m)        = soil_pars_f%pars_xy(1,j,i)
-                IF ( soil_pars_f%pars_xy(2,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%n_vg(:,m)        = soil_pars_f%pars_xy(2,j,i)
-                IF ( soil_pars_f%pars_xy(3,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%gamma_w_sat(:,m) = soil_pars_f%pars_xy(3,j,i)
-                IF ( soil_pars_f%pars_xy(4,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%m_sat(:,m)       = soil_pars_f%pars_xy(4,j,i)
-                IF ( soil_pars_f%pars_xy(5,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%m_fc(:,m)        = soil_pars_f%pars_xy(5,j,i)
-                IF ( soil_pars_f%pars_xy(6,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%m_wilt(:,m)      = soil_pars_f%pars_xy(6,j,i)
-                IF ( soil_pars_f%pars_xy(7,j,i) /= soil_pars_f%fill )              &
-                   surf_lsm_h%m_res(:,m)       = soil_pars_f%pars_xy(7,j,i)
-
+             DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+
+                   IF ( soil_pars_f%pars_xy(0,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%alpha_vg(:,m)    = soil_pars_f%pars_xy(0,j,i)
+                   IF ( soil_pars_f%pars_xy(1,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%l_vg(:,m)        = soil_pars_f%pars_xy(1,j,i)
+                   IF ( soil_pars_f%pars_xy(2,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%n_vg(:,m)        = soil_pars_f%pars_xy(2,j,i)
+                   IF ( soil_pars_f%pars_xy(3,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%gamma_w_sat(:,m) = soil_pars_f%pars_xy(3,j,i)
+                   IF ( soil_pars_f%pars_xy(4,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%m_sat(:,m)       = soil_pars_f%pars_xy(4,j,i)
+                   IF ( soil_pars_f%pars_xy(5,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%m_fc(:,m)        = soil_pars_f%pars_xy(5,j,i)
+                   IF ( soil_pars_f%pars_xy(6,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%m_wilt(:,m)      = soil_pars_f%pars_xy(6,j,i)
+                   IF ( soil_pars_f%pars_xy(7,j,i) /= soil_pars_f%fill )              &
+                      surf_lsm_h(l)%m_res(:,m)       = soil_pars_f%pars_xy(7,j,i)
+                ENDDO
              ENDDO
 !
@@ -3139,27 +3204,28 @@
 !
 !--          Horizontal surfaces
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-
-                DO  k = nzb_soil, nzt_soil
-                   IF ( soil_pars_f%pars_xyz(0,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%alpha_vg(k,m)    = soil_pars_f%pars_xyz(0,k,j,i)
-                   IF ( soil_pars_f%pars_xyz(1,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%l_vg(k,m)        = soil_pars_f%pars_xyz(1,k,j,i)
-                   IF ( soil_pars_f%pars_xyz(2,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%n_vg(k,m)        = soil_pars_f%pars_xyz(2,k,j,i)
-                   IF ( soil_pars_f%pars_xyz(3,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%gamma_w_sat(k,m) = soil_pars_f%pars_xyz(3,k,j,i)
-                   IF ( soil_pars_f%pars_xyz(4,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%m_sat(k,m)       = soil_pars_f%pars_xyz(4,k,j,i)
-                   IF ( soil_pars_f%pars_xyz(5,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%m_fc(k,m)        = soil_pars_f%pars_xyz(5,k,j,i)
-                   IF ( soil_pars_f%pars_xyz(6,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%m_wilt(k,m)      = soil_pars_f%pars_xyz(6,k,j,i)
-                   IF ( soil_pars_f%pars_xyz(7,k,j,i) /= soil_pars_f%fill )        &
-                      surf_lsm_h%m_res(k,m)       = soil_pars_f%pars_xyz(7,k,j,i)
+             DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+
+                   DO  k = nzb_soil, nzt_soil
+                      IF ( soil_pars_f%pars_xyz(0,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%alpha_vg(k,m)    = soil_pars_f%pars_xyz(0,k,j,i)
+                      IF ( soil_pars_f%pars_xyz(1,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%l_vg(k,m)        = soil_pars_f%pars_xyz(1,k,j,i)
+                      IF ( soil_pars_f%pars_xyz(2,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%n_vg(k,m)        = soil_pars_f%pars_xyz(2,k,j,i)
+                      IF ( soil_pars_f%pars_xyz(3,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%gamma_w_sat(k,m) = soil_pars_f%pars_xyz(3,k,j,i)
+                      IF ( soil_pars_f%pars_xyz(4,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%m_sat(k,m)       = soil_pars_f%pars_xyz(4,k,j,i)
+                      IF ( soil_pars_f%pars_xyz(5,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%m_fc(k,m)        = soil_pars_f%pars_xyz(5,k,j,i)
+                      IF ( soil_pars_f%pars_xyz(6,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%m_wilt(k,m)      = soil_pars_f%pars_xyz(6,k,j,i)
+                      IF ( soil_pars_f%pars_xyz(7,k,j,i) /= soil_pars_f%fill )        &
+                         surf_lsm_h(l)%m_res(k,m)       = soil_pars_f%pars_xyz(7,k,j,i)
+                   ENDDO
                 ENDDO
-
              ENDDO
 !
@@ -3257,28 +3323,29 @@
 !
 !--    Map values onto horizontal elemements
-       DO  m = 1, surf_lsm_h%ns
-          IF ( surf_lsm_h%vegetation_surface(m) )  THEN
-             surf_lsm_h%r_canopy_min(m)     = min_canopy_resistance
-             surf_lsm_h%lai(m)              = leaf_area_index
-             surf_lsm_h%c_veg(m)            = vegetation_coverage
-             surf_lsm_h%g_d(m)              = canopy_resistance_coefficient
-             surf_lsm_h%z0(m)               = z0_vegetation
-             surf_lsm_h%z0h(m)              = z0h_vegetation
-             surf_lsm_h%z0q(m)              = z0q_vegetation
-             surf_lsm_h%lambda_surface_s(m) = lambda_surface_stable
-             surf_lsm_h%lambda_surface_u(m) = lambda_surface_unstable
-             surf_lsm_h%f_sw_in(m)          = f_shortwave_incoming
-             surf_lsm_h%c_surface(m)        = c_surface
-             surf_lsm_h%albedo_type(m,ind_veg_wall) = albedo_type
-             surf_lsm_h%emissivity(m,ind_veg_wall)  = emissivity
-
-             surf_lsm_h%vegetation_type(m)      = vegetation_type
-             surf_lsm_h%vegetation_type_name(m) = vegetation_type_name(vegetation_type)
-          ELSE
-             surf_lsm_h%lai(m)   = 0.0_wp
-             surf_lsm_h%c_veg(m) = 0.0_wp
-             surf_lsm_h%g_d(m)   = 0.0_wp
-          ENDIF
-
+       DO  l = 0, 1
+          DO  m = 1, surf_lsm_h(l)%ns
+             IF ( surf_lsm_h(l)%vegetation_surface(m) )  THEN
+                surf_lsm_h(l)%r_canopy_min(m)     = min_canopy_resistance
+                surf_lsm_h(l)%lai(m)              = leaf_area_index
+                surf_lsm_h(l)%c_veg(m)            = vegetation_coverage
+                surf_lsm_h(l)%g_d(m)              = canopy_resistance_coefficient
+                surf_lsm_h(l)%z0(m)               = z0_vegetation
+                surf_lsm_h(l)%z0h(m)              = z0h_vegetation
+                surf_lsm_h(l)%z0q(m)              = z0q_vegetation
+                surf_lsm_h(l)%lambda_surface_s(m) = lambda_surface_stable
+                surf_lsm_h(l)%lambda_surface_u(m) = lambda_surface_unstable
+                surf_lsm_h(l)%f_sw_in(m)          = f_shortwave_incoming
+                surf_lsm_h(l)%c_surface(m)        = c_surface
+                surf_lsm_h(l)%albedo_type(m,ind_veg_wall) = albedo_type
+                surf_lsm_h(l)%emissivity(m,ind_veg_wall)  = emissivity
+
+                surf_lsm_h(l)%vegetation_type(m)      = vegetation_type
+                surf_lsm_h(l)%vegetation_type_name(m) = vegetation_type_name(vegetation_type)
+             ELSE
+                surf_lsm_h(l)%lai(m)   = 0.0_wp
+                surf_lsm_h(l)%c_veg(m) = 0.0_wp
+                surf_lsm_h(l)%g_d(m)   = 0.0_wp
+             ENDIF
+          ENDDO
        ENDDO
 !
@@ -3320,27 +3387,29 @@
 !
 !--       Horizontal surfaces
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-
-             st = vegetation_type_f%var(j,i)
-             IF ( st /= vegetation_type_f%fill  .AND.  st /= 0 )  THEN
-                surf_lsm_h%r_canopy_min(m)     = vegetation_pars(ind_v_rc_min,st)
-                surf_lsm_h%lai(m)              = vegetation_pars(ind_v_rc_lai,st)
-                surf_lsm_h%c_veg(m)            = vegetation_pars(ind_v_c_veg,st)
-                surf_lsm_h%g_d(m)              = vegetation_pars(ind_v_gd,st)
-                surf_lsm_h%z0(m)               = vegetation_pars(ind_v_z0,st)
-                surf_lsm_h%z0h(m)              = vegetation_pars(ind_v_z0qh,st)
-                surf_lsm_h%z0q(m)              = vegetation_pars(ind_v_z0qh,st)
-                surf_lsm_h%lambda_surface_s(m) = vegetation_pars(ind_v_lambda_s,st)
-                surf_lsm_h%lambda_surface_u(m) = vegetation_pars(ind_v_lambda_u,st)
-                surf_lsm_h%f_sw_in(m)          = vegetation_pars(ind_v_f_sw_in,st)
-                surf_lsm_h%c_surface(m)        = vegetation_pars(ind_v_c_surf,st)
-                surf_lsm_h%albedo_type(m,ind_veg_wall) = INT( vegetation_pars(ind_v_at,st) )
-                surf_lsm_h%emissivity(m,ind_veg_wall)  = vegetation_pars(ind_v_emis,st)
-
-                surf_lsm_h%vegetation_type(m)      = st
-                surf_lsm_h%vegetation_type_name(m) = vegetation_type_name(st)
-             ENDIF
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+
+                st = vegetation_type_f%var(j,i)
+                IF ( st /= vegetation_type_f%fill  .AND.  st /= 0 )  THEN
+                   surf_lsm_h(l)%r_canopy_min(m)     = vegetation_pars(ind_v_rc_min,st)
+                   surf_lsm_h(l)%lai(m)              = vegetation_pars(ind_v_rc_lai,st)
+                   surf_lsm_h(l)%c_veg(m)            = vegetation_pars(ind_v_c_veg,st)
+                   surf_lsm_h(l)%g_d(m)              = vegetation_pars(ind_v_gd,st)
+                   surf_lsm_h(l)%z0(m)               = vegetation_pars(ind_v_z0,st)
+                   surf_lsm_h(l)%z0h(m)              = vegetation_pars(ind_v_z0qh,st)
+                   surf_lsm_h(l)%z0q(m)              = vegetation_pars(ind_v_z0qh,st)
+                   surf_lsm_h(l)%lambda_surface_s(m) = vegetation_pars(ind_v_lambda_s,st)
+                   surf_lsm_h(l)%lambda_surface_u(m) = vegetation_pars(ind_v_lambda_u,st)
+                   surf_lsm_h(l)%f_sw_in(m)          = vegetation_pars(ind_v_f_sw_in,st)
+                   surf_lsm_h(l)%c_surface(m)        = vegetation_pars(ind_v_c_surf,st)
+                   surf_lsm_h(l)%albedo_type(m,ind_veg_wall) = INT( vegetation_pars(ind_v_at,st) )
+                   surf_lsm_h(l)%emissivity(m,ind_veg_wall)  = vegetation_pars(ind_v_emis,st)
+
+                   surf_lsm_h(l)%vegetation_type(m)      = st
+                   surf_lsm_h(l)%vegetation_type_name(m) = vegetation_type_name(st)
+                ENDIF
+             ENDDO
           ENDDO
 !
@@ -3381,75 +3450,76 @@
 !
 !--       Horizontal surfaces
-          DO  m = 1, surf_lsm_h%ns
-
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-!
-!--          If surface element is not a vegetation surface and any value in
-!--          vegetation_pars is given, neglect this information and give an
-!--          informative message that this value will not be used.
-             IF ( .NOT. surf_lsm_h%vegetation_surface(m)  .AND.                &
-                   ANY( vegetation_pars_f%pars_xy(:,j,i) /=                    &
-                   vegetation_pars_f%fill ) )  THEN
-                WRITE( message_string, * )                                     &
-                                 'surface element at grid point (j,i) = (',    &
-                                 j, i, ') is not a vegetation surface, ',      &
-                                 'so that information given in ',              &
-                                 'vegetation_pars at this point is neglected.'
-                CALL message( 'land_surface_model_mod', 'PA0436', 0, 0, myid, 6, 0 )
-             ELSE
-
-                IF ( vegetation_pars_f%pars_xy(ind_v_rc_min,j,i) /=            &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%r_canopy_min(m)  =                               &
-                                   vegetation_pars_f%pars_xy(ind_v_rc_min,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_rc_lai,j,i) /=            &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%lai(m)           =                               &
-                                   vegetation_pars_f%pars_xy(ind_v_rc_lai,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_c_veg,j,i) /=             &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%c_veg(m)         =                               &
-                                   vegetation_pars_f%pars_xy(ind_v_c_veg,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_gd,j,i) /=                &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%g_d(m)           =                               &
-                                   vegetation_pars_f%pars_xy(ind_v_gd,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_z0,j,i) /=                &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%z0(m)            =                               &
-                                   vegetation_pars_f%pars_xy(ind_v_z0,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_z0qh,j,i) /=              &
-                     vegetation_pars_f%fill )  THEN
-                   surf_lsm_h%z0h(m)           =                               &
-                                   vegetation_pars_f%pars_xy(ind_v_z0qh,j,i)
-                   surf_lsm_h%z0q(m)           =                               &
-                                   vegetation_pars_f%pars_xy(ind_v_z0qh,j,i)
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+!
+!--             If surface element is not a vegetation surface and any value in
+!--             vegetation_pars is given, neglect this information and give an
+!--             informative message that this value will not be used.
+                IF ( .NOT. surf_lsm_h(l)%vegetation_surface(m)  .AND.                &
+                      ANY( vegetation_pars_f%pars_xy(:,j,i) /=                    &
+                      vegetation_pars_f%fill ) )  THEN
+                   WRITE( message_string, * )                                     &
+                                    'surface element at grid point (j,i) = (',    &
+                                    j, i, ') is not a vegetation surface, ',      &
+                                    'so that information given in ',              &
+                                    'vegetation_pars at this point is neglected.'
+                   CALL message( 'land_surface_model_mod', 'PA0436', 0, 0, myid, 6, 0 )
+                ELSE
+
+                   IF ( vegetation_pars_f%pars_xy(ind_v_rc_min,j,i) /=            &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%r_canopy_min(m)  =                               &
+                                      vegetation_pars_f%pars_xy(ind_v_rc_min,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_rc_lai,j,i) /=            &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%lai(m)           =                               &
+                                      vegetation_pars_f%pars_xy(ind_v_rc_lai,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_c_veg,j,i) /=             &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%c_veg(m)         =                               &
+                                      vegetation_pars_f%pars_xy(ind_v_c_veg,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_gd,j,i) /=                &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%g_d(m)           =                               &
+                                      vegetation_pars_f%pars_xy(ind_v_gd,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_z0,j,i) /=                &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%z0(m)            =                               &
+                                      vegetation_pars_f%pars_xy(ind_v_z0,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_z0qh,j,i) /=              &
+                        vegetation_pars_f%fill )  THEN
+                      surf_lsm_h(l)%z0h(m)           =                               &
+                                      vegetation_pars_f%pars_xy(ind_v_z0qh,j,i)
+                      surf_lsm_h(l)%z0q(m)           =                               &
+                                      vegetation_pars_f%pars_xy(ind_v_z0qh,j,i)
+                   ENDIF
+                   IF ( vegetation_pars_f%pars_xy(ind_v_lambda_s,j,i) /=          &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%lambda_surface_s(m) =                            &
+                                      vegetation_pars_f%pars_xy(ind_v_lambda_s,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_lambda_u,j,i) /=          &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%lambda_surface_u(m) =                            &
+                                      vegetation_pars_f%pars_xy(ind_v_lambda_u,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_f_sw_in,j,i) /=           &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%f_sw_in(m)          =                            &
+                                      vegetation_pars_f%pars_xy(ind_v_f_sw_in,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_c_surf,j,i) /=            &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%c_surface(m)        =                            &
+                                      vegetation_pars_f%pars_xy(ind_v_c_surf,j,i)
+                   IF ( vegetation_pars_f%pars_xy(ind_v_at,j,i) /=                &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%albedo_type(m,ind_veg_wall) =                    &
+                                      INT( vegetation_pars_f%pars_xy(ind_v_at,j,i) )
+                   IF ( vegetation_pars_f%pars_xy(ind_v_emis,j,i) /=              &
+                        vegetation_pars_f%fill )                                  &
+                      surf_lsm_h(l)%emissivity(m,ind_veg_wall)  =                    &
+                                      vegetation_pars_f%pars_xy(ind_v_emis,j,i)
                 ENDIF
-                IF ( vegetation_pars_f%pars_xy(ind_v_lambda_s,j,i) /=          &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%lambda_surface_s(m) =                            &
-                                   vegetation_pars_f%pars_xy(ind_v_lambda_s,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_lambda_u,j,i) /=          &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%lambda_surface_u(m) =                            &
-                                   vegetation_pars_f%pars_xy(ind_v_lambda_u,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_f_sw_in,j,i) /=           &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%f_sw_in(m)          =                            &
-                                   vegetation_pars_f%pars_xy(ind_v_f_sw_in,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_c_surf,j,i) /=            &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%c_surface(m)        =                            &
-                                   vegetation_pars_f%pars_xy(ind_v_c_surf,j,i)
-                IF ( vegetation_pars_f%pars_xy(ind_v_at,j,i) /=                &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%albedo_type(m,ind_veg_wall) =                    &
-                                   INT( vegetation_pars_f%pars_xy(ind_v_at,j,i) )
-                IF ( vegetation_pars_f%pars_xy(ind_v_emis,j,i) /=              &
-                     vegetation_pars_f%fill )                                  &
-                   surf_lsm_h%emissivity(m,ind_veg_wall)  =                    &
-                                   vegetation_pars_f%pars_xy(ind_v_emis,j,i)
-             ENDIF
+             ENDDO
           ENDDO
 !
@@ -3565,20 +3635,22 @@
 !
 !--    Map values onto horizontal elemements
-       DO  m = 1, surf_lsm_h%ns
-          IF ( surf_lsm_h%water_surface(m) )  THEN
-             IF ( TRIM( initializing_actions ) /= 'read_restart_data' )        &
-                t_soil_h%var_2d(:,m)        = water_temperature
-             surf_lsm_h%z0(m)               = z0_water
-             surf_lsm_h%z0h(m)              = z0h_water
-             surf_lsm_h%z0q(m)              = z0q_water
-             surf_lsm_h%lambda_surface_s(m) = 1.0E10_wp
-             surf_lsm_h%lambda_surface_u(m) = 1.0E10_wp
-             surf_lsm_h%c_surface(m)        = 0.0_wp
-             surf_lsm_h%albedo_type(m,ind_wat_win) = albedo_type
-             surf_lsm_h%emissivity(m,ind_wat_win)  = emissivity
-
-             surf_lsm_h%water_type(m)      = water_type
-             surf_lsm_h%water_type_name(m) = water_type_name(water_type)
-          ENDIF
+       DO  l = 0, 1
+          DO  m = 1, surf_lsm_h(l)%ns
+             IF ( surf_lsm_h(l)%water_surface(m) )  THEN
+                IF ( TRIM( initializing_actions ) /= 'read_restart_data' )        &
+                   t_soil_h(l)%var_2d(:,m)        = water_temperature
+                surf_lsm_h(l)%z0(m)               = z0_water
+                surf_lsm_h(l)%z0h(m)              = z0h_water
+                surf_lsm_h(l)%z0q(m)              = z0q_water
+                surf_lsm_h(l)%lambda_surface_s(m) = 1.0E10_wp
+                surf_lsm_h(l)%lambda_surface_u(m) = 1.0E10_wp
+                surf_lsm_h(l)%c_surface(m)        = 0.0_wp
+                surf_lsm_h(l)%albedo_type(m,ind_wat_win) = albedo_type
+                surf_lsm_h(l)%emissivity(m,ind_wat_win)  = emissivity
+
+                surf_lsm_h(l)%water_type(m)      = water_type
+                surf_lsm_h(l)%water_type_name(m) = water_type_name(water_type)
+             ENDIF
+          ENDDO
        ENDDO
 !
@@ -3589,5 +3661,5 @@
              IF ( surf_lsm_v(l)%water_surface(m) )  THEN
                 IF ( TRIM( initializing_actions ) /= 'read_restart_data' )     &
-                   t_soil_v(l)%var_2d(:,m)           = water_temperature
+                   t_soil_v(l)%var_2d(:,m)        = water_temperature
                 surf_lsm_v(l)%z0(m)               = z0_water
                 surf_lsm_v(l)%z0h(m)              = z0h_water
@@ -3615,24 +3687,26 @@
 !
 !--       Horizontal surfaces
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-
-             st = water_type_f%var(j,i)
-             IF ( st /= water_type_f%fill  .AND.  st /= 0 )  THEN
-                IF ( TRIM( initializing_actions ) /= 'read_restart_data' )     &
-                   t_soil_h%var_2d(:,m) = water_pars(ind_w_temp,st)
-                surf_lsm_h%z0(m)     = water_pars(ind_w_z0,st)
-                surf_lsm_h%z0h(m)    = water_pars(ind_w_z0h,st)
-                surf_lsm_h%z0q(m)    = water_pars(ind_w_z0h,st)
-                surf_lsm_h%lambda_surface_s(m) = water_pars(ind_w_lambda_s,st)
-                surf_lsm_h%lambda_surface_u(m) = water_pars(ind_w_lambda_u,st)
-                surf_lsm_h%c_surface(m)        = 0.0_wp
-                surf_lsm_h%albedo_type(m,ind_wat_win) = INT( water_pars(ind_w_at,st) )
-                surf_lsm_h%emissivity(m,ind_wat_win)  = water_pars(ind_w_emis,st)
-
-                surf_lsm_h%water_type(m)      = st
-                surf_lsm_h%water_type_name(m) = water_type_name(st)
-             ENDIF
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+
+                st = water_type_f%var(j,i)
+                IF ( st /= water_type_f%fill  .AND.  st /= 0 )  THEN
+                   IF ( TRIM( initializing_actions ) /= 'read_restart_data' )     &
+                      t_soil_h(l)%var_2d(:,m) = water_pars(ind_w_temp,st)
+                   surf_lsm_h(l)%z0(m)     = water_pars(ind_w_z0,st)
+                   surf_lsm_h(l)%z0h(m)    = water_pars(ind_w_z0h,st)
+                   surf_lsm_h(l)%z0q(m)    = water_pars(ind_w_z0h,st)
+                   surf_lsm_h(l)%lambda_surface_s(m) = water_pars(ind_w_lambda_s,st)
+                   surf_lsm_h(l)%lambda_surface_u(m) = water_pars(ind_w_lambda_u,st)
+                   surf_lsm_h(l)%c_surface(m)        = 0.0_wp
+                   surf_lsm_h(l)%albedo_type(m,ind_wat_win) = INT( water_pars(ind_w_at,st) )
+                   surf_lsm_h(l)%emissivity(m,ind_wat_win)  = water_pars(ind_w_emis,st)
+
+                   surf_lsm_h(l)%water_type(m)      = st
+                   surf_lsm_h(l)%water_type_name(m) = water_type_name(st)
+                ENDIF
+             ENDDO
           ENDDO
 !
@@ -3675,53 +3749,55 @@
 !
 !--       Horizontal surfaces
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-!
-!--          If surface element is not a water surface and any value in
-!--          water_pars is given, neglect this information and give an
-!--          informative message that this value will not be used.
-             IF ( .NOT. surf_lsm_h%water_surface(m)  .AND.                     &
-                   ANY( water_pars_f%pars_xy(:,j,i) /= water_pars_f%fill ) )  THEN
-                WRITE( message_string, * )                                     &
-                              'surface element at grid point (j,i) = (',       &
-                              j, i, ') is not a water surface, ',              &
-                              'so that information given in ',                 &
-                              'water_pars at this point is neglected.'
-                CALL message( 'land_surface_model_mod', 'PA0645', 0, 0, myid, 6, 0 )
-             ELSE
-                IF ( water_pars_f%pars_xy(ind_w_temp,j,i) /=                   &
-                     water_pars_f%fill  .AND.                                  &
-                     TRIM( initializing_actions ) /= 'read_restart_data' )     &
-                      t_soil_h%var_2d(:,m) = water_pars_f%pars_xy(ind_w_temp,j,i)
-
-                IF ( water_pars_f%pars_xy(ind_w_z0,j,i) /= water_pars_f%fill ) &
-                   surf_lsm_h%z0(m)     = water_pars_f%pars_xy(ind_w_z0,j,i)
-
-                IF ( water_pars_f%pars_xy(ind_w_z0h,j,i) /= water_pars_f%fill )&
-                THEN
-                   surf_lsm_h%z0h(m)    = water_pars_f%pars_xy(ind_w_z0h,j,i)
-                   surf_lsm_h%z0q(m)    = water_pars_f%pars_xy(ind_w_z0h,j,i)
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+   !
+   !--          If surface element is not a water surface and any value in
+   !--          water_pars is given, neglect this information and give an
+   !--          informative message that this value will not be used.
+                IF ( .NOT. surf_lsm_h(l)%water_surface(m)  .AND.                     &
+                      ANY( water_pars_f%pars_xy(:,j,i) /= water_pars_f%fill ) )  THEN
+                   WRITE( message_string, * )                                     &
+                                 'surface element at grid point (j,i) = (',       &
+                                 j, i, ') is not a water surface, ',              &
+                                 'so that information given in ',                 &
+                                 'water_pars at this point is neglected.'
+                   CALL message( 'land_surface_model_mod', 'PA0645', 0, 0, myid, 6, 0 )
+                ELSE
+                   IF ( water_pars_f%pars_xy(ind_w_temp,j,i) /=                   &
+                        water_pars_f%fill  .AND.                                  &
+                        TRIM( initializing_actions ) /= 'read_restart_data' )     &
+                         t_soil_h(l)%var_2d(:,m) = water_pars_f%pars_xy(ind_w_temp,j,i)
+
+                   IF ( water_pars_f%pars_xy(ind_w_z0,j,i) /= water_pars_f%fill ) &
+                      surf_lsm_h(l)%z0(m)     = water_pars_f%pars_xy(ind_w_z0,j,i)
+
+                   IF ( water_pars_f%pars_xy(ind_w_z0h,j,i) /= water_pars_f%fill )&
+                   THEN
+                      surf_lsm_h(l)%z0h(m)    = water_pars_f%pars_xy(ind_w_z0h,j,i)
+                      surf_lsm_h(l)%z0q(m)    = water_pars_f%pars_xy(ind_w_z0h,j,i)
+                   ENDIF
+                   IF ( water_pars_f%pars_xy(ind_w_lambda_s,j,i) /=               &
+                        water_pars_f%fill )                                       &
+                      surf_lsm_h(l)%lambda_surface_s(m) =                            &
+                                           water_pars_f%pars_xy(ind_w_lambda_s,j,i)
+
+                   IF ( water_pars_f%pars_xy(ind_w_lambda_u,j,i) /=               &
+                         water_pars_f%fill )                                      &
+                      surf_lsm_h(l)%lambda_surface_u(m) =                            &
+                                           water_pars_f%pars_xy(ind_w_lambda_u,j,i)
+
+                   IF ( water_pars_f%pars_xy(ind_w_at,j,i) /=                     &
+                        water_pars_f%fill )                                       &
+                      surf_lsm_h(l)%albedo_type(m,ind_wat_win) =                     &
+                                          INT( water_pars_f%pars_xy(ind_w_at,j,i) )
+
+                   IF ( water_pars_f%pars_xy(ind_w_emis,j,i) /=                   &
+                        water_pars_f%fill )                                       &
+                      surf_lsm_h(l)%emissivity(m,ind_wat_win) =                      &
+                                             water_pars_f%pars_xy(ind_w_emis,j,i)
                 ENDIF
-                IF ( water_pars_f%pars_xy(ind_w_lambda_s,j,i) /=               &
-                     water_pars_f%fill )                                       &
-                   surf_lsm_h%lambda_surface_s(m) =                            &
-                                        water_pars_f%pars_xy(ind_w_lambda_s,j,i)
-
-                IF ( water_pars_f%pars_xy(ind_w_lambda_u,j,i) /=               &
-                      water_pars_f%fill )                                      &
-                   surf_lsm_h%lambda_surface_u(m) =                            &
-                                        water_pars_f%pars_xy(ind_w_lambda_u,j,i)
-
-                IF ( water_pars_f%pars_xy(ind_w_at,j,i) /=                     &
-                     water_pars_f%fill )                                       &
-                   surf_lsm_h%albedo_type(m,ind_wat_win) =                     &
-                                       INT( water_pars_f%pars_xy(ind_w_at,j,i) )
-
-                IF ( water_pars_f%pars_xy(ind_w_emis,j,i) /=                   &
-                     water_pars_f%fill )                                       &
-                   surf_lsm_h%emissivity(m,ind_wat_win) =                      &
-                                          water_pars_f%pars_xy(ind_w_emis,j,i)
-             ENDIF
+             ENDDO
           ENDDO
 !
@@ -3844,39 +3920,41 @@
 !--    Level 1 initialization of pavement type surfaces. Horizontally
 !--    homogeneous characteristics are assumed
-       surf_lsm_h%nzt_pavement = pavement_depth_level
-       DO  m = 1, surf_lsm_h%ns
-          IF ( surf_lsm_h%pavement_surface(m) )  THEN
-             surf_lsm_h%nzt_pavement(m)        = nzt_pavement
-             surf_lsm_h%z0(m)                  = z0_pavement
-             surf_lsm_h%z0h(m)                 = z0h_pavement
-             surf_lsm_h%z0q(m)                 = z0q_pavement
-             surf_lsm_h%lambda_surface_s(m)    = pavement_heat_conduct         &
-                                                  * ddz_soil(nzb_soil)         &
-                                                  * 2.0_wp
-             surf_lsm_h%lambda_surface_u(m)    = pavement_heat_conduct         &
-                                                  * ddz_soil(nzb_soil)         &
-                                                  * 2.0_wp
-             surf_lsm_h%c_surface(m)           = pavement_heat_capacity        &
-                                                        * dz_soil(nzb_soil)    &
-                                                        * 0.25_wp
-
-             surf_lsm_h%albedo_type(m,ind_pav_green) = albedo_type
-             surf_lsm_h%emissivity(m,ind_pav_green)  = emissivity
-
-             surf_lsm_h%pavement_type(m)      = pavement_type
-             surf_lsm_h%pavement_type_name(m) = pavement_type_name(pavement_type)
-
-             IF ( pavement_type /= 0 )  THEN
-                DO  k = nzb_soil, surf_lsm_h%nzt_pavement(m)
-                   surf_lsm_h%lambda_h_def(k,m)    =                           &
-                                     pavement_subsurface_pars_1(k,pavement_type)
-                   surf_lsm_h%rho_c_total_def(k,m) =                           &
-                                     pavement_subsurface_pars_2(k,pavement_type)
-                ENDDO
-             ELSE
-                surf_lsm_h%lambda_h_def(:,m)     = pavement_heat_conduct
-                surf_lsm_h%rho_c_total_def(:,m)  = pavement_heat_capacity
+       DO  l = 0, 1
+          surf_lsm_h(l)%nzt_pavement = pavement_depth_level
+          DO  m = 1, surf_lsm_h(l)%ns
+             IF ( surf_lsm_h(l)%pavement_surface(m) )  THEN
+                surf_lsm_h(l)%nzt_pavement(m)        = nzt_pavement
+                surf_lsm_h(l)%z0(m)                  = z0_pavement
+                surf_lsm_h(l)%z0h(m)                 = z0h_pavement
+                surf_lsm_h(l)%z0q(m)                 = z0q_pavement
+                surf_lsm_h(l)%lambda_surface_s(m)    = pavement_heat_conduct         &
+                                                     * ddz_soil(nzb_soil)         &
+                                                     * 2.0_wp
+                surf_lsm_h(l)%lambda_surface_u(m)    = pavement_heat_conduct         &
+                                                     * ddz_soil(nzb_soil)         &
+                                                     * 2.0_wp
+                surf_lsm_h(l)%c_surface(m)           = pavement_heat_capacity        &
+                                                           * dz_soil(nzb_soil)    &
+                                                           * 0.25_wp
+
+                surf_lsm_h(l)%albedo_type(m,ind_pav_green) = albedo_type
+                surf_lsm_h(l)%emissivity(m,ind_pav_green)  = emissivity
+
+                surf_lsm_h(l)%pavement_type(m)      = pavement_type
+                surf_lsm_h(l)%pavement_type_name(m) = pavement_type_name(pavement_type)
+
+                IF ( pavement_type /= 0 )  THEN
+                   DO  k = nzb_soil, surf_lsm_h(l)%nzt_pavement(m)
+                      surf_lsm_h(l)%lambda_h_def(k,m)    =                           &
+                                        pavement_subsurface_pars_1(k,pavement_type)
+                      surf_lsm_h(l)%rho_c_total_def(k,m) =                           &
+                                        pavement_subsurface_pars_2(k,pavement_type)
+                   ENDDO
+                ELSE
+                   surf_lsm_h(l)%lambda_h_def(:,m)     = pavement_heat_conduct
+                   surf_lsm_h(l)%rho_c_total_def(:,m)  = pavement_heat_capacity
+                ENDIF
              ENDIF
-          ENDIF
+          ENDDO
        ENDDO
 
@@ -3926,50 +4004,52 @@
 !
 !--       Horizontal surfaces
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-
-             st = pavement_type_f%var(j,i)
-             IF ( st /= pavement_type_f%fill  .AND.  st /= 0 )  THEN
-!
-!--             Determine deepmost index of pavement layer
-                DO  k = nzb_soil, nzt_soil
-                   IF ( pavement_subsurface_pars_1(k,st) == 9999999.9_wp       &
-                   .OR. pavement_subsurface_pars_2(k,st) == 9999999.9_wp)      &
-                   THEN
-                      surf_lsm_h%nzt_pavement(m) = k-1
-                      EXIT
-                   ENDIF
-                ENDDO
-
-                surf_lsm_h%z0(m)                = pavement_pars(ind_p_z0,st)
-                surf_lsm_h%z0h(m)               = pavement_pars(ind_p_z0h,st)
-                surf_lsm_h%z0q(m)               = pavement_pars(ind_p_z0h,st)
-
-                surf_lsm_h%lambda_surface_s(m)  =                              &
-                                              pavement_subsurface_pars_1(0,st) &
-                                                  * ddz_soil(nzb_soil)         &
-                                                  * 2.0_wp
-                surf_lsm_h%lambda_surface_u(m)  =                              &
-                                              pavement_subsurface_pars_1(0,st) &
-                                                  * ddz_soil(nzb_soil)         &
-                                                  * 2.0_wp
-                surf_lsm_h%c_surface(m)         =                              &
-                                               pavement_subsurface_pars_2(0,st)&
-                                                        * dz_soil(nzb_soil)    &
-                                                        * 0.25_wp
-                surf_lsm_h%albedo_type(m,ind_pav_green) = INT( pavement_pars(ind_p_at,st) )
-                surf_lsm_h%emissivity(m,ind_pav_green)  = pavement_pars(ind_p_emis,st)
-
-                surf_lsm_h%pavement_type(m)      = st
-                surf_lsm_h%pavement_type_name(m) = pavement_type_name(st)
-
-                DO  k = nzb_soil, surf_lsm_h%nzt_pavement(m)
-                   surf_lsm_h%lambda_h_def(k,m)    =                           &
-                                     pavement_subsurface_pars_1(k,pavement_type)
-                   surf_lsm_h%rho_c_total_def(k,m) =                           &
-                                     pavement_subsurface_pars_2(k,pavement_type)
-                ENDDO
-             ENDIF
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+
+                st = pavement_type_f%var(j,i)
+                IF ( st /= pavement_type_f%fill  .AND.  st /= 0 )  THEN
+   !
+   !--             Determine deepmost index of pavement layer
+                   DO  k = nzb_soil, nzt_soil
+                      IF ( pavement_subsurface_pars_1(k,st) == 9999999.9_wp       &
+                      .OR. pavement_subsurface_pars_2(k,st) == 9999999.9_wp)      &
+                      THEN
+                         surf_lsm_h(l)%nzt_pavement(m) = k-1
+                         EXIT
+                      ENDIF
+                   ENDDO
+
+                   surf_lsm_h(l)%z0(m)                = pavement_pars(ind_p_z0,st)
+                   surf_lsm_h(l)%z0h(m)               = pavement_pars(ind_p_z0h,st)
+                   surf_lsm_h(l)%z0q(m)               = pavement_pars(ind_p_z0h,st)
+
+                   surf_lsm_h(l)%lambda_surface_s(m)  =                              &
+                                                 pavement_subsurface_pars_1(0,st) &
+                                                     * ddz_soil(nzb_soil)         &
+                                                     * 2.0_wp
+                   surf_lsm_h(l)%lambda_surface_u(m)  =                              &
+                                                 pavement_subsurface_pars_1(0,st) &
+                                                     * ddz_soil(nzb_soil)         &
+                                                     * 2.0_wp
+                   surf_lsm_h(l)%c_surface(m)         =                              &
+                                                  pavement_subsurface_pars_2(0,st)&
+                                                           * dz_soil(nzb_soil)    &
+                                                           * 0.25_wp
+                   surf_lsm_h(l)%albedo_type(m,ind_pav_green) = INT( pavement_pars(ind_p_at,st) )
+                   surf_lsm_h(l)%emissivity(m,ind_pav_green)  = pavement_pars(ind_p_emis,st)
+
+                   surf_lsm_h(l)%pavement_type(m)      = st
+                   surf_lsm_h(l)%pavement_type_name(m) = pavement_type_name(st)
+
+                   DO  k = nzb_soil, surf_lsm_h(l)%nzt_pavement(m)
+                      surf_lsm_h(l)%lambda_h_def(k,m)    =                           &
+                                        pavement_subsurface_pars_1(k,pavement_type)
+                      surf_lsm_h(l)%rho_c_total_def(k,m) =                           &
+                                        pavement_subsurface_pars_2(k,pavement_type)
+                   ENDDO
+                ENDIF
+             ENDDO
           ENDDO
 !
@@ -4036,39 +4116,40 @@
 !
 !--       Horizontal surfaces
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-!
-!--          If surface element is not a pavement surface and any value in
-!--          pavement_pars is given, neglect this information and give an
-!--          informative message that this value will not be used.
-             IF ( .NOT. surf_lsm_h%pavement_surface(m)  .AND.                  &
-                   ANY( pavement_pars_f%pars_xy(:,j,i) /=                      &
-                   pavement_pars_f%fill ) )  THEN
-                WRITE( message_string, * )                                     &
-                              'surface element at grid point (j,i) = (',       &
-                              j, i, ') is not a pavement surface, ',           &
-                              'so that information given in ',                 &
-                              'pavement_pars at this point is neglected.'
-                CALL message( 'land_surface_model_mod', 'PA0647', 0, 0, myid, 6, 0 )
-             ELSE
-                IF ( pavement_pars_f%pars_xy(ind_p_z0,j,i) /=                  &
-                     pavement_pars_f%fill )                                    &
-                   surf_lsm_h%z0(m)  = pavement_pars_f%pars_xy(ind_p_z0,j,i)
-                IF ( pavement_pars_f%pars_xy(ind_p_z0h,j,i) /=                 &
-                     pavement_pars_f%fill )  THEN
-                   surf_lsm_h%z0h(m) = pavement_pars_f%pars_xy(ind_p_z0h,j,i)
-                   surf_lsm_h%z0q(m) = pavement_pars_f%pars_xy(ind_p_z0h,j,i)
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+   !
+   !--          If surface element is not a pavement surface and any value in
+   !--          pavement_pars is given, neglect this information and give an
+   !--          informative message that this value will not be used.
+                IF ( .NOT. surf_lsm_h(l)%pavement_surface(m)  .AND.                  &
+                      ANY( pavement_pars_f%pars_xy(:,j,i) /=                      &
+                      pavement_pars_f%fill ) )  THEN
+                   WRITE( message_string, * )                                     &
+                                 'surface element at grid point (j,i) = (',       &
+                                 j, i, ') is not a pavement surface, ',           &
+                                 'so that information given in ',                 &
+                                 'pavement_pars at this point is neglected.'
+                   CALL message( 'land_surface_model_mod', 'PA0647', 0, 0, myid, 6, 0 )
+                ELSE
+                   IF ( pavement_pars_f%pars_xy(ind_p_z0,j,i) /=                  &
+                        pavement_pars_f%fill )                                    &
+                      surf_lsm_h(l)%z0(m)  = pavement_pars_f%pars_xy(ind_p_z0,j,i)
+                   IF ( pavement_pars_f%pars_xy(ind_p_z0h,j,i) /=                 &
+                        pavement_pars_f%fill )  THEN
+                      surf_lsm_h(l)%z0h(m) = pavement_pars_f%pars_xy(ind_p_z0h,j,i)
+                      surf_lsm_h(l)%z0q(m) = pavement_pars_f%pars_xy(ind_p_z0h,j,i)
+                   ENDIF
+                   IF ( pavement_pars_f%pars_xy(ind_p_at,j,i) /=                  &
+                        pavement_pars_f%fill )                                    &
+                      surf_lsm_h(l)%albedo_type(m,ind_pav_green) =                   &
+                                      INT( pavement_pars_f%pars_xy(ind_p_at,j,i) )
+                   IF ( pavement_pars_f%pars_xy(ind_p_emis,j,i) /=                &
+                        pavement_pars_f%fill )                                    &
+                      surf_lsm_h(l)%emissivity(m,ind_pav_green)  =                   &
+                                      pavement_pars_f%pars_xy(ind_p_emis,j,i)
                 ENDIF
-                IF ( pavement_pars_f%pars_xy(ind_p_at,j,i) /=                  &
-                     pavement_pars_f%fill )                                    &
-                   surf_lsm_h%albedo_type(m,ind_pav_green) =                   &
-                                   INT( pavement_pars_f%pars_xy(ind_p_at,j,i) )
-                IF ( pavement_pars_f%pars_xy(ind_p_emis,j,i) /=                &
-                     pavement_pars_f%fill )                                    &
-                   surf_lsm_h%emissivity(m,ind_pav_green)  =                   &
-                                   pavement_pars_f%pars_xy(ind_p_emis,j,i)
-             ENDIF
-
+             ENDDO
           ENDDO
 !
@@ -4124,45 +4205,47 @@
 !--       Set pavement depth to nzt_soil. Please note, this is just a
 !--       workaround at the moment.
-          DO  m = 1, surf_lsm_h%ns
-             IF ( surf_lsm_h%pavement_surface(m) )  THEN
-
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-
-                surf_lsm_h%nzt_pavement(m) = nzt_soil
-
-                IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i) &
-                     /= pavement_subsurface_pars_f%fill )  THEN
-                   surf_lsm_h%lambda_surface_s(m)  =                           &
-                      pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i)&
-                                                  * ddz_soil(nzb_soil)         &
-                                                  * 2.0_wp
-                   surf_lsm_h%lambda_surface_u(m)  =                           &
-                      pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i)&
-                                                  * ddz_soil(nzb_soil)         &
-                                                  * 2.0_wp
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                IF ( surf_lsm_h(l)%pavement_surface(m) )  THEN
+
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+
+                   surf_lsm_h(l)%nzt_pavement(m) = nzt_soil
+
+                   IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i) &
+                        /= pavement_subsurface_pars_f%fill )  THEN
+                      surf_lsm_h(l)%lambda_surface_s(m)  =                           &
+                         pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i)&
+                                                     * ddz_soil(nzb_soil)         &
+                                                     * 2.0_wp
+                      surf_lsm_h(l)%lambda_surface_u(m)  =                           &
+                         pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i)&
+                                                     * ddz_soil(nzb_soil)         &
+                                                     * 2.0_wp
+                   ENDIF
+                   IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i) /= &
+                        pavement_subsurface_pars_f%fill )  THEN
+                      surf_lsm_h(l)%c_surface(m)     =                               &
+                         pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i)   &
+                                                     * dz_soil(nzb_soil)          &
+                                                     * 0.25_wp
+                   ENDIF
+
+                   DO  k = nzb_soil, nzt_soil
+                      IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,k,j,i) /= &
+                           pavement_subsurface_pars_f%fill )  THEN
+                         surf_lsm_h(l)%lambda_h_def(k,m) =                              &
+                             pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,k,j,i)
+                      ENDIF
+                      IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,k,j,i) /= &
+                           pavement_subsurface_pars_f%fill )  THEN
+                         surf_lsm_h(l)%rho_c_total_def(k,m) =                           &
+                             pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,k,j,i)
+                      ENDIF
+                   ENDDO
+
                 ENDIF
-                IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i) /= &
-                     pavement_subsurface_pars_f%fill )  THEN
-                   surf_lsm_h%c_surface(m)     =                               &
-                      pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i)   &
-                                                  * dz_soil(nzb_soil)          &
-                                                  * 0.25_wp
-                ENDIF
-
-                DO  k = nzb_soil, nzt_soil
-                   IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,k,j,i) /= &
-                        pavement_subsurface_pars_f%fill )  THEN
-                      surf_lsm_h%lambda_h_def(k,m) =                              &
-                          pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,k,j,i)
-                   ENDIF
-                   IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,k,j,i) /= &
-                        pavement_subsurface_pars_f%fill )  THEN
-                      surf_lsm_h%rho_c_total_def(k,m) =                           &
-                          pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,k,j,i)
-                   ENDIF
-                ENDDO
-
-             ENDIF
+             ENDDO
           ENDDO
           DO  l = 0, 3
@@ -4217,9 +4300,11 @@
 !--    the albedo type has been already given by the pars, albedo_type overwrites these values.
        IF ( albedo_type_f%from_file )  THEN
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-             IF ( albedo_type_f%var(j,i) /= albedo_type_f%fill )                                   &
-                surf_lsm_h%albedo_type(m,:) = albedo_type_f%var(j,i)
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+                IF ( albedo_type_f%var(j,i) /= albedo_type_f%fill )                                   &
+                   surf_lsm_h(l)%albedo_type(m,:) = albedo_type_f%var(j,i)
+             ENDDO
           ENDDO
           DO  l = 0, 3
@@ -4244,13 +4329,15 @@
 !--       data provided from input file contains fill values at some locations.
 !--       Level 1, initialization via profiles given in parameter file
-          DO  m = 1, surf_lsm_h%ns
-             IF ( surf_lsm_h%vegetation_surface(m)  .OR.                       &
-                  surf_lsm_h%pavement_surface(m) )  THEN
-                DO  k = nzb_soil, nzt_soil
-                   t_soil_h%var_2d(k,m) = soil_temperature(k)
-                   m_soil_h%var_2d(k,m) = soil_moisture(k)
-                ENDDO
-                t_soil_h%var_2d(nzt_soil+1,m) = deep_soil_temperature
-             ENDIF
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                IF ( surf_lsm_h(l)%vegetation_surface(m)  .OR.                       &
+                     surf_lsm_h(l)%pavement_surface(m) )  THEN
+                   DO  k = nzb_soil, nzt_soil
+                      t_soil_h(l)%var_2d(k,m) = soil_temperature(k)
+                      m_soil_h(l)%var_2d(k,m) = soil_moisture(k)
+                   ENDDO
+                   t_soil_h(l)%var_2d(nzt_soil+1,m) = deep_soil_temperature
+                ENDIF
+             ENDDO
           ENDDO
           DO  l = 0, 3
@@ -4543,15 +4630,17 @@
 
              IF ( init_3d%lod_msoil == 1 )  THEN
-                DO  m = 1, surf_lsm_h%ns
-                   IF ( surf_lsm_h%vegetation_surface(m)  .OR.                 &
-                        surf_lsm_h%pavement_surface(m) )  THEN
-
-                      CALL interpolate_soil_profile(                           &
-                                       m_soil_h%var_2d(nzb_soil:nzt_soil,m),   &
-                                       init_3d%msoil_1d(:),                    &
-                                       zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
-                                       nzb_soil, nzt_soil,                     &
-                                       nzb_soil, init_3d%nzs-1 )
-                   ENDIF
+                DO  l = 0, 1
+                   DO  m = 1, surf_lsm_h(l)%ns
+                      IF ( surf_lsm_h(l)%vegetation_surface(m)  .OR.                 &
+                           surf_lsm_h(l)%pavement_surface(m) )  THEN
+
+                         CALL interpolate_soil_profile(                           &
+                                          m_soil_h(l)%var_2d(nzb_soil:nzt_soil,m),&
+                                          init_3d%msoil_1d(:),                    &
+                                          zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
+                                          nzb_soil, nzt_soil,                     &
+                                          nzb_soil, init_3d%nzs-1 )
+                      ENDIF
+                   ENDDO
                 ENDDO
                 DO  l = 0, 3
@@ -4569,19 +4658,20 @@
                 ENDDO
              ELSE
-
-                DO  m = 1, surf_lsm_h%ns
-                   IF ( surf_lsm_h%vegetation_surface(m)  .OR.                 &
-                        surf_lsm_h%pavement_surface(m) )  THEN
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-
-                      IF ( init_3d%msoil_3d(0,j,i) /= init_3d%fill_msoil )     &
-                         CALL interpolate_soil_profile(                        &
-                                       m_soil_h%var_2d(nzb_soil:nzt_soil,m),   &
-                                       init_3d%msoil_3d(:,j,i),                &
-                                       zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
-                                       nzb_soil, nzt_soil,                     &
-                                       nzb_soil, init_3d%nzs-1 )
-                   ENDIF
+                DO  l = 0, 1
+                   DO  m = 1, surf_lsm_h(l)%ns
+                      IF ( surf_lsm_h(l)%vegetation_surface(m)  .OR.                 &
+                           surf_lsm_h(l)%pavement_surface(m) )  THEN
+                         i = surf_lsm_h(l)%i(m)
+                         j = surf_lsm_h(l)%j(m)
+
+                         IF ( init_3d%msoil_3d(0,j,i) /= init_3d%fill_msoil )     &
+                            CALL interpolate_soil_profile(                        &
+                                          m_soil_h(l)%var_2d(nzb_soil:nzt_soil,m),&
+                                          init_3d%msoil_3d(:,j,i),                &
+                                          zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
+                                          nzb_soil, nzt_soil,                     &
+                                          nzb_soil, init_3d%nzs-1 )
+                      ENDIF
+                   ENDDO
                 ENDDO
                 DO  l = 0, 3
@@ -4614,17 +4704,19 @@
 
              IF ( init_3d%lod_tsoil == 1 )  THEN ! change to 1 if provided correctly by INIFOR
-                DO  m = 1, surf_lsm_h%ns
-                   IF ( surf_lsm_h%vegetation_surface(m)  .OR.                 &
-                        surf_lsm_h%pavement_surface(m) )  THEN
-                      CALL interpolate_soil_profile(                           &
-                                       t_soil_h%var_2d(nzb_soil:nzt_soil,m),   &
-                                       init_3d%tsoil_1d(:),                    &
-                                       zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
-                                       nzb_soil, nzt_soil,                     &
-                                       nzb_soil, init_3d%nzs-1 )
-!
-!--                   Set boundary condition, i.e. deep soil temperature
-                      t_soil_h%var_2d(nzt_soil+1,m) = t_soil_h%var_2d(nzt_soil,m)
-                   ENDIF
+                DO  l = 0, 1
+                   DO  m = 1, surf_lsm_h(l)%ns
+                      IF ( surf_lsm_h(l)%vegetation_surface(m)  .OR.                 &
+                           surf_lsm_h(l)%pavement_surface(m) )  THEN
+                         CALL interpolate_soil_profile(                           &
+                                          t_soil_h(l)%var_2d(nzb_soil:nzt_soil,m),   &
+                                          init_3d%tsoil_1d(:),                    &
+                                          zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
+                                          nzb_soil, nzt_soil,                     &
+                                          nzb_soil, init_3d%nzs-1 )
+   !
+   !--                   Set boundary condition, i.e. deep soil temperature
+                         t_soil_h(l)%var_2d(nzt_soil+1,m) = t_soil_h(l)%var_2d(nzt_soil,m)
+                      ENDIF
+                   ENDDO
                 ENDDO
                 DO  l = 0, 3
@@ -4646,22 +4738,23 @@
                 ENDDO
              ELSE
-
-                DO  m = 1, surf_lsm_h%ns
-                   IF ( surf_lsm_h%vegetation_surface(m)  .OR.                 &
-                        surf_lsm_h%pavement_surface(m) )  THEN
-                      i = surf_lsm_h%i(m)
-                      j = surf_lsm_h%j(m)
-
-                      IF ( init_3d%tsoil_3d(0,j,i) /= init_3d%fill_tsoil )     &
-                         CALL interpolate_soil_profile(                        &
-                                       t_soil_h%var_2d(nzb_soil:nzt_soil,m),   &
-                                       init_3d%tsoil_3d(:,j,i),                &
-                                       zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
-                                       nzb_soil, nzt_soil,                     &
-                                       nzb_soil, init_3d%nzs-1 )
-!
-!--                   Set boundary condition, i.e. deep soil temperature
-                      t_soil_h%var_2d(nzt_soil+1,m) = t_soil_h%var_2d(nzt_soil,m)
-                   ENDIF
+                DO  l = 0, 1
+                   DO  m = 1, surf_lsm_h(l)%ns
+                      IF ( surf_lsm_h(l)%vegetation_surface(m)  .OR.                 &
+                           surf_lsm_h(l)%pavement_surface(m) )  THEN
+                         i = surf_lsm_h(l)%i(m)
+                         j = surf_lsm_h(l)%j(m)
+
+                         IF ( init_3d%tsoil_3d(0,j,i) /= init_3d%fill_tsoil )     &
+                            CALL interpolate_soil_profile(                        &
+                                          t_soil_h(l)%var_2d(nzb_soil:nzt_soil,m),   &
+                                          init_3d%tsoil_3d(:,j,i),                &
+                                          zs(nzb_soil:nzt_soil), init_3d%z_soil,  &
+                                          nzb_soil, nzt_soil,                     &
+                                          nzb_soil, init_3d%nzs-1 )
+   !
+   !--                   Set boundary condition, i.e. deep soil temperature
+                         t_soil_h(l)%var_2d(nzt_soil+1,m) = t_soil_h(l)%var_2d(nzt_soil,m)
+                      ENDIF
+                   ENDDO
                 ENDDO
                 DO  l = 0, 3
@@ -4699,18 +4792,20 @@
 !--       point errors. Hence, limit the soil moisture to its saturation value
 !--       and give a warning.
-          DO  m = 1, surf_lsm_h%ns
-             IF ( surf_lsm_h%vegetation_surface(m)  .OR.                       &
-                  surf_lsm_h%pavement_surface(m) )  THEN
-                DO  k = nzb_soil, nzt_soil
-                   IF ( m_soil_h%var_2d(k,m) > surf_lsm_h%m_sat(k,m) )  THEN
-                      m_soil_h%var_2d(k,m) = surf_lsm_h%m_sat(k,m)
-                      WRITE( message_string, * ) 'soil moisture is higher '//  &
-                            'than its saturation value at (k,j,i) ', k,        &
-                            surf_lsm_h%i(m), surf_lsm_h%j(m), ' and is ' //    &
-                            'thus limited to this value to maintain stability.'
-                      CALL message( 'lsm_init', 'PA0458', 0, 1, myid, 6, 0 )
-                   ENDIF
-                ENDDO
-             ENDIF
+          DO l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                IF ( surf_lsm_h(l)%vegetation_surface(m)  .OR.                       &
+                     surf_lsm_h(l)%pavement_surface(m) )  THEN
+                   DO  k = nzb_soil, nzt_soil
+                      IF ( m_soil_h(l)%var_2d(k,m) > surf_lsm_h(l)%m_sat(k,m) )  THEN
+                         m_soil_h(l)%var_2d(k,m) = surf_lsm_h(l)%m_sat(k,m)
+                         WRITE( message_string, * ) 'soil moisture is higher '//     &
+                               'than its saturation value at (k,j,i) ', k,           &
+                               surf_lsm_h(l)%i(m), surf_lsm_h(l)%j(m), ' and is ' // &
+                               'thus limited to this value to maintain stability.'
+                         CALL message( 'lsm_init', 'PA0458', 0, 1, myid, 6, 0 )
+                      ENDIF
+                   ENDDO
+                ENDIF
+             ENDDO
           ENDDO
           DO  l = 0, 3
@@ -4737,30 +4832,32 @@
 !
 !--       Further initialization
-          DO  m = 1, surf_lsm_h%ns
-
-             i   = surf_lsm_h%i(m)
-             j   = surf_lsm_h%j(m)
-             k   = surf_lsm_h%k(m)
-!
-!--          Initialize surface temperature with soil temperature in the uppermost
-!--          uppermost layer
-             t_surface_h%var_1d(m)    = t_soil_h%var_2d(nzb_soil,m)
-             surf_lsm_h%pt_surface(m) = t_soil_h%var_2d(nzb_soil,m) / exner(nzb)
-
-             IF ( bulk_cloud_model  .OR. cloud_droplets ) THEN
-                surf_lsm_h%pt1(m) = pt(k,j,i) + lv_d_cp * d_exner(k) * ql(k,j,i)
-             ELSE
-                surf_lsm_h%pt1(m) = pt(k,j,i)
-             ENDIF
-!
-!--          Assure that r_a cannot be zero at model start
-             IF ( surf_lsm_h%pt1(m) == surf_lsm_h%pt_surface(m) )              &
-                surf_lsm_h%pt1(m) = surf_lsm_h%pt1(m) + 1.0E-20_wp
-
-             surf_lsm_h%us(m)   = 0.1_wp
-             surf_lsm_h%ts(m)   = ( surf_lsm_h%pt1(m) - surf_lsm_h%pt_surface(m) )&
-                                  / surf_lsm_h%r_a(m)
-             surf_lsm_h%shf(m)  = - surf_lsm_h%us(m) * surf_lsm_h%ts(m)        &
-                                  * rho_surface
+          DO l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+
+                i   = surf_lsm_h(l)%i(m)
+                j   = surf_lsm_h(l)%j(m)
+                k   = surf_lsm_h(l)%k(m)
+   !
+   !--          Initialize surface temperature with soil temperature in the uppermost
+   !--          uppermost layer
+                t_surface_h(l)%var_1d(m)    = t_soil_h(l)%var_2d(nzb_soil,m)
+                surf_lsm_h(l)%pt_surface(m) = t_soil_h(l)%var_2d(nzb_soil,m) / exner(nzb)
+
+                IF ( bulk_cloud_model  .OR. cloud_droplets ) THEN
+                   surf_lsm_h(l)%pt1(m) = pt(k,j,i) + lv_d_cp * d_exner(k) * ql(k,j,i)
+                ELSE
+                   surf_lsm_h(l)%pt1(m) = pt(k,j,i)
+                ENDIF
+   !
+   !--          Assure that r_a cannot be zero at model start
+                IF ( surf_lsm_h(l)%pt1(m) == surf_lsm_h(l)%pt_surface(m) )              &
+                   surf_lsm_h(l)%pt1(m) = surf_lsm_h(l)%pt1(m) + 1.0E-20_wp
+
+                surf_lsm_h(l)%us(m)   = 0.1_wp
+                surf_lsm_h(l)%ts(m)   = ( surf_lsm_h(l)%pt1(m) - surf_lsm_h(l)%pt_surface(m) )&
+                                     / surf_lsm_h(l)%r_a(m)
+                surf_lsm_h(l)%shf(m)  = - surf_lsm_h(l)%us(m) * surf_lsm_h(l)%ts(m)        &
+                                     * rho_surface
+             ENDDO
           ENDDO
 !
@@ -4802,7 +4899,9 @@
 !--    Level 1 initialization of root distribution - provided by the user via
 !--    via namelist.
-       DO  m = 1, surf_lsm_h%ns
-          DO  k = nzb_soil, nzt_soil
-             surf_lsm_h%root_fr(k,m) = root_fraction(k)
+       DO l = 0, 1
+          DO  m = 1, surf_lsm_h(l)%ns
+             DO  k = nzb_soil, nzt_soil
+                surf_lsm_h(l)%root_fr(k,m) = root_fraction(k)
+             ENDDO
           ENDDO
        ENDDO
@@ -4874,23 +4973,25 @@
 !
 !--       Map calculated root fractions
-          DO  m = 1, surf_lsm_h%ns
-             DO  k = nzb_soil, nzt_soil
-                IF ( surf_lsm_h%pavement_surface(m)  .AND.                     &
-                     k <= surf_lsm_h%nzt_pavement(m) )  THEN
-                   surf_lsm_h%root_fr(k,m) = 0.0_wp
-                ELSE
-                   surf_lsm_h%root_fr(k,m) = root_fraction(k)
+          DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   DO  k = nzb_soil, nzt_soil
+                      IF ( surf_lsm_h(l)%pavement_surface(m)  .AND.                     &
+                           k <= surf_lsm_h(l)%nzt_pavement(m) )  THEN
+                         surf_lsm_h(l)%root_fr(k,m) = 0.0_wp
+                      ELSE
+                         surf_lsm_h(l)%root_fr(k,m) = root_fraction(k)
+                      ENDIF
+
+                   ENDDO
+!
+!--             Normalize so that the sum = 1. Only relevant when the root
+!--             distribution was set to zero due to pavement at some layers.
+                IF ( SUM( surf_lsm_h(l)%root_fr(:,m) ) > 0.0_wp )  THEN
+                   DO k = nzb_soil, nzt_soil
+                      surf_lsm_h(l)%root_fr(k,m) = surf_lsm_h(l)%root_fr(k,m)           &
+                      / SUM( surf_lsm_h(l)%root_fr(:,m) )
+                   ENDDO
                 ENDIF
-
-             ENDDO
-!
-!--          Normalize so that the sum = 1. Only relevant when the root
-!--          distribution was set to zero due to pavement at some layers.
-             IF ( SUM( surf_lsm_h%root_fr(:,m) ) > 0.0_wp )  THEN
-                DO k = nzb_soil, nzt_soil
-                   surf_lsm_h%root_fr(k,m) = surf_lsm_h%root_fr(k,m)           &
-                   / SUM( surf_lsm_h%root_fr(:,m) )
-                ENDDO
-             ENDIF
+             ENDDO
           ENDDO
           DO  l = 0, 3
@@ -4920,15 +5021,16 @@
 !--    Take value from file
        IF ( root_area_density_lsm_f%from_file )  THEN
-          DO  m = 1, surf_lsm_h%ns
-             IF ( surf_lsm_h%vegetation_surface(m) )  THEN
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-                DO  k = nzb_soil, nzt_soil
-                   surf_lsm_h%root_fr(k,m) = root_area_density_lsm_f%var(k,j,i)
-                ENDDO
-
-             ENDIF
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                IF ( surf_lsm_h(l)%vegetation_surface(m) )  THEN
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+                   DO  k = nzb_soil, nzt_soil
+                      surf_lsm_h(l)%root_fr(k,m) = root_area_density_lsm_f%var(k,j,i)
+                   ENDDO
+
+                ENDIF
+             ENDDO
           ENDDO
-
           DO  l = 0, 3
              DO  m = 1, surf_lsm_v(l)%ns
@@ -4983,12 +5085,13 @@
 !--    Finally, make some consistency checks.
 !--    Ceck for illegal combination of LAI and vegetation coverage.
-       IF ( ANY( .NOT. surf_lsm_h%pavement_surface  .AND.                      &
-                 surf_lsm_h%lai == 0.0_wp  .AND.  surf_lsm_h%c_veg == 1.0_wp ) &
-          )  THEN
-          message_string = 'For non-pavement surfaces the combination ' //     &
-                           ' lai = 0.0 and c_veg = 1.0 is not allowed.'
-          CALL message( 'lsm_init', 'PA0671', 2, 2, myid, 6, 0 )
-       ENDIF
-
+       DO  l = 0, 1
+          IF ( ANY( .NOT. surf_lsm_h(l)%pavement_surface  .AND.                      &
+                    surf_lsm_h(l)%lai == 0.0_wp  .AND.  surf_lsm_h(l)%c_veg == 1.0_wp ) &
+             )  THEN
+             message_string = 'For non-pavement surfaces the combination ' //     &
+                              ' lai = 0.0 and c_veg = 1.0 is not allowed.'
+             CALL message( 'lsm_init', 'PA0671', 2, 2, myid, 6, 0 )
+          ENDIF
+       ENDDO
        DO  l = 0, 3
           IF ( ANY( .NOT. surf_lsm_v(l)%pavement_surface  .AND.                &
@@ -5005,16 +5108,19 @@
 !--    necessary. This case, give an informative message. Note, to avoid
 !--    that the job-protocoll is messed-up, this message is only given once.
+!--    ???what about the vertical surfaces???
        flag_exceed_z0  = .FALSE.
        flag_exceed_z0h = .FALSE.
-       DO  m = 1, surf_lsm_h%ns
-          IF ( surf_lsm_h%z0(m) > 0.5_wp * surf_lsm_h%z_mo(m) )  THEN
-             surf_lsm_h%z0(m) = 0.5_wp * surf_lsm_h%z_mo(m)
-             flag_exceed_z0   = .TRUE.
-          ENDIF
-          IF ( surf_lsm_h%z0h(m) > 0.5_wp * surf_lsm_h%z_mo(m) )  THEN
-             surf_lsm_h%z0h(m) = 0.5_wp * surf_lsm_h%z_mo(m)
-             surf_lsm_h%z0q(m) = 0.5_wp * surf_lsm_h%z_mo(m)
-             flag_exceed_z0h   = .TRUE.
-          ENDIF
+       DO l = 0, 1
+          DO  m = 1, surf_lsm_h(l)%ns
+             IF ( surf_lsm_h(l)%z0(m) > 0.5_wp * surf_lsm_h(l)%z_mo(m) )  THEN
+                surf_lsm_h(l)%z0(m) = 0.5_wp * surf_lsm_h(l)%z_mo(m)
+                flag_exceed_z0   = .TRUE.
+             ENDIF
+             IF ( surf_lsm_h(l)%z0h(m) > 0.5_wp * surf_lsm_h(l)%z_mo(m) )  THEN
+                surf_lsm_h(l)%z0h(m) = 0.5_wp * surf_lsm_h(l)%z_mo(m)
+                surf_lsm_h(l)%z0q(m) = 0.5_wp * surf_lsm_h(l)%z_mo(m)
+                flag_exceed_z0h   = .TRUE.
+             ENDIF
+          ENDDO
        ENDDO
 #if defined( __parallel )
@@ -5102,12 +5208,14 @@
 !
 !--    Horizontal surfaces
-       ALLOCATE ( m_liq_h_1%var_1d(1:surf_lsm_h%ns)                      )
-       ALLOCATE ( m_liq_h_2%var_1d(1:surf_lsm_h%ns)                      )
-       ALLOCATE ( t_surface_h_1%var_1d(1:surf_lsm_h%ns)                  )
-       ALLOCATE ( t_surface_h_2%var_1d(1:surf_lsm_h%ns)                  )
-       ALLOCATE ( m_soil_h_1%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h%ns)   )
-       ALLOCATE ( m_soil_h_2%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h%ns)   )
-       ALLOCATE ( t_soil_h_1%var_2d(nzb_soil:nzt_soil+1,1:surf_lsm_h%ns) )
-       ALLOCATE ( t_soil_h_2%var_2d(nzb_soil:nzt_soil+1,1:surf_lsm_h%ns) )
+       DO l = 0, 1
+          ALLOCATE ( m_liq_h_1(l)%var_1d(1:surf_lsm_h(l)%ns)                      )
+          ALLOCATE ( m_liq_h_2(l)%var_1d(1:surf_lsm_h(l)%ns)                      )
+          ALLOCATE ( t_surface_h_1(l)%var_1d(1:surf_lsm_h(l)%ns)                  )
+          ALLOCATE ( t_surface_h_2(l)%var_1d(1:surf_lsm_h(l)%ns)                  )
+          ALLOCATE ( m_soil_h_1(l)%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)   )
+          ALLOCATE ( m_soil_h_2(l)%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)   )
+          ALLOCATE ( t_soil_h_1(l)%var_2d(nzb_soil:nzt_soil+1,1:surf_lsm_h(l)%ns) )
+          ALLOCATE ( t_soil_h_2(l)%var_2d(nzb_soil:nzt_soil+1,1:surf_lsm_h(l)%ns) )
+       ENDDO
 !
 !--    Vertical surfaces
@@ -5126,5 +5234,7 @@
 !--    Allocate array for heat flux in W/m2, required for radiation?
 !--    Consider to remove this array
-       ALLOCATE( surf_lsm_h%surfhf(1:surf_lsm_h%ns) )
+       DO l = 0, 1
+          ALLOCATE( surf_lsm_h(l)%surfhf(1:surf_lsm_h(l)%ns) )
+       ENDDO
        DO  l = 0, 3
           ALLOCATE( surf_lsm_v(l)%surfhf(1:surf_lsm_v(l)%ns) )
@@ -5135,8 +5245,10 @@
 !--    Allocate intermediate timestep arrays
 !--    Horizontal surfaces
-       ALLOCATE ( tm_liq_h_m%var_1d(1:surf_lsm_h%ns)                     )
-       ALLOCATE ( tt_surface_h_m%var_1d(1:surf_lsm_h%ns)                 )
-       ALLOCATE ( tm_soil_h_m%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  )
-       ALLOCATE ( tt_soil_h_m%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  )
+       DO l = 0, 1
+          ALLOCATE ( tm_liq_h_m(l)%var_1d(1:surf_lsm_h(l)%ns)                     )
+          ALLOCATE ( tt_surface_h_m(l)%var_1d(1:surf_lsm_h(l)%ns)                 )
+          ALLOCATE ( tm_soil_h_m(l)%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)  )
+          ALLOCATE ( tt_soil_h_m(l)%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h(l)%ns)  )
+       ENDDO
 !
 !--    Horizontal surfaces
@@ -5151,37 +5263,38 @@
 !--    Allocate 2D vegetation model arrays
 !--    Horizontal surfaces
-       ALLOCATE ( surf_lsm_h%building_surface(1:surf_lsm_h%ns)    )
-       ALLOCATE ( surf_lsm_h%c_liq(1:surf_lsm_h%ns)               )
-       ALLOCATE ( surf_lsm_h%c_surface(1:surf_lsm_h%ns)           )
-       ALLOCATE ( surf_lsm_h%c_veg(1:surf_lsm_h%ns)               )
-       ALLOCATE ( surf_lsm_h%f_sw_in(1:surf_lsm_h%ns)             )
-       ALLOCATE ( surf_lsm_h%ghf(1:surf_lsm_h%ns)                 )
-       ALLOCATE ( surf_lsm_h%g_d(1:surf_lsm_h%ns)                 )
-       ALLOCATE ( surf_lsm_h%lai(1:surf_lsm_h%ns)                 )
-       ALLOCATE ( surf_lsm_h%lambda_surface_u(1:surf_lsm_h%ns)    )
-       ALLOCATE ( surf_lsm_h%lambda_surface_s(1:surf_lsm_h%ns)    )
-       ALLOCATE ( surf_lsm_h%nzt_pavement(1:surf_lsm_h%ns)        )
-       ALLOCATE ( surf_lsm_h%pavement_surface(1:surf_lsm_h%ns)    )
-       ALLOCATE ( surf_lsm_h%qsws_soil(1:surf_lsm_h%ns)           )
-       ALLOCATE ( surf_lsm_h%qsws_liq(1:surf_lsm_h%ns)            )
-       ALLOCATE ( surf_lsm_h%qsws_veg(1:surf_lsm_h%ns)            )
-       ALLOCATE ( surf_lsm_h%rad_net_l(1:surf_lsm_h%ns)           )
-       ALLOCATE ( surf_lsm_h%r_a(1:surf_lsm_h%ns)                 )
-       ALLOCATE ( surf_lsm_h%r_canopy(1:surf_lsm_h%ns)            )
-       ALLOCATE ( surf_lsm_h%r_soil(1:surf_lsm_h%ns)              )
-       ALLOCATE ( surf_lsm_h%r_soil_min(1:surf_lsm_h%ns)          )
-       ALLOCATE ( surf_lsm_h%r_s(1:surf_lsm_h%ns)                 )
-       ALLOCATE ( surf_lsm_h%r_canopy_min(1:surf_lsm_h%ns)        )
-       ALLOCATE ( surf_lsm_h%vegetation_surface(1:surf_lsm_h%ns)  )
-       ALLOCATE ( surf_lsm_h%water_surface(1:surf_lsm_h%ns)       )
-
-       surf_lsm_h%water_surface        = .FALSE.
-       surf_lsm_h%pavement_surface     = .FALSE.
-       surf_lsm_h%vegetation_surface   = .FALSE.
-
-!
-!--    Set default values
-       surf_lsm_h%r_canopy_min = 0.0_wp
-
+       DO l = 0, 1
+          ALLOCATE ( surf_lsm_h(l)%building_surface(1:surf_lsm_h(l)%ns)    )
+          ALLOCATE ( surf_lsm_h(l)%c_liq(1:surf_lsm_h(l)%ns)               )
+          ALLOCATE ( surf_lsm_h(l)%c_surface(1:surf_lsm_h(l)%ns)           )
+          ALLOCATE ( surf_lsm_h(l)%c_veg(1:surf_lsm_h(l)%ns)               )
+          ALLOCATE ( surf_lsm_h(l)%f_sw_in(1:surf_lsm_h(l)%ns)             )
+          ALLOCATE ( surf_lsm_h(l)%ghf(1:surf_lsm_h(l)%ns)                 )
+          ALLOCATE ( surf_lsm_h(l)%g_d(1:surf_lsm_h(l)%ns)                 )
+          ALLOCATE ( surf_lsm_h(l)%lai(1:surf_lsm_h(l)%ns)                 )
+          ALLOCATE ( surf_lsm_h(l)%lambda_surface_u(1:surf_lsm_h(l)%ns)    )
+          ALLOCATE ( surf_lsm_h(l)%lambda_surface_s(1:surf_lsm_h(l)%ns)    )
+          ALLOCATE ( surf_lsm_h(l)%nzt_pavement(1:surf_lsm_h(l)%ns)        )
+          ALLOCATE ( surf_lsm_h(l)%pavement_surface(1:surf_lsm_h(l)%ns)    )
+          ALLOCATE ( surf_lsm_h(l)%qsws_soil(1:surf_lsm_h(l)%ns)           )
+          ALLOCATE ( surf_lsm_h(l)%qsws_liq(1:surf_lsm_h(l)%ns)            )
+          ALLOCATE ( surf_lsm_h(l)%qsws_veg(1:surf_lsm_h(l)%ns)            )
+          ALLOCATE ( surf_lsm_h(l)%rad_net_l(1:surf_lsm_h(l)%ns)           )
+          ALLOCATE ( surf_lsm_h(l)%r_a(1:surf_lsm_h(l)%ns)                 )
+          ALLOCATE ( surf_lsm_h(l)%r_canopy(1:surf_lsm_h(l)%ns)            )
+          ALLOCATE ( surf_lsm_h(l)%r_soil(1:surf_lsm_h(l)%ns)              )
+          ALLOCATE ( surf_lsm_h(l)%r_soil_min(1:surf_lsm_h(l)%ns)          )
+          ALLOCATE ( surf_lsm_h(l)%r_s(1:surf_lsm_h(l)%ns)                 )
+          ALLOCATE ( surf_lsm_h(l)%r_canopy_min(1:surf_lsm_h(l)%ns)        )
+          ALLOCATE ( surf_lsm_h(l)%vegetation_surface(1:surf_lsm_h(l)%ns)  )
+          ALLOCATE ( surf_lsm_h(l)%water_surface(1:surf_lsm_h(l)%ns)       )
+
+          surf_lsm_h(l)%water_surface        = .FALSE.
+          surf_lsm_h(l)%pavement_surface     = .FALSE.
+          surf_lsm_h(l)%vegetation_surface   = .FALSE.
+
+!
+!--       Set default values
+          surf_lsm_h(l)%r_canopy_min = 0.0_wp
+       ENDDO
 !
 !--    Vertical surfaces
@@ -5410,12 +5523,12 @@
 
        IF ( horizontal )  THEN
-          surf           => surf_lsm_h
-
-          surf_m_soil    => m_soil_h
-          surf_m_soil_p  => m_soil_h_p
-          surf_t_soil    => t_soil_h
-          surf_t_soil_p  => t_soil_h_p
-          surf_tm_soil_m => tm_soil_h_m
-          surf_tt_soil_m => tt_soil_h_m
+          surf           => surf_lsm_h(l)
+
+          surf_m_soil    => m_soil_h(l)
+          surf_m_soil_p  => m_soil_h_p(l)
+          surf_t_soil    => t_soil_h(l)
+          surf_t_soil_p  => t_soil_h_p(l)
+          surf_tm_soil_m => tm_soil_h_m(l)
+          surf_tt_soil_m => tt_soil_h_m(l)
        ELSE
           surf           => surf_lsm_v(l)
@@ -5880,8 +5993,8 @@
           CASE ( 'c_liq*' )
              IF ( ALLOCATED( c_liq_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
-                   c_liq_av(j,i) = c_liq_av(j,i) + surf_lsm_h%c_liq(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
+                   c_liq_av(j,i) = c_liq_av(j,i) + surf_lsm_h(0)%c_liq(m)
                 ENDDO
              ENDIF
@@ -5889,8 +6002,8 @@
           CASE ( 'c_soil*' )
              IF ( ALLOCATED( c_soil_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
-                   c_soil_av(j,i) = c_soil_av(j,i) + (1.0 - surf_lsm_h%c_veg(m))
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
+                   c_soil_av(j,i) = c_soil_av(j,i) + (1.0 - surf_lsm_h(0)%c_veg(m))
                 ENDDO
              ENDIF
@@ -5898,8 +6011,8 @@
           CASE ( 'c_veg*' )
              IF ( ALLOCATED( c_veg_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
-                   c_veg_av(j,i) = c_veg_av(j,i) + surf_lsm_h%c_veg(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
+                   c_veg_av(j,i) = c_veg_av(j,i) + surf_lsm_h(0)%c_veg(m)
                 ENDDO
              ENDIF
@@ -5907,8 +6020,8 @@
           CASE ( 'lai*' )
              IF ( ALLOCATED( lai_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
-                   lai_av(j,i) = lai_av(j,i) + surf_lsm_h%lai(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
+                   lai_av(j,i) = lai_av(j,i) + surf_lsm_h(0)%lai(m)
                 ENDDO
              ENDIF
@@ -5916,8 +6029,8 @@
           CASE ( 'm_liq*' )
              IF ( ALLOCATED( m_liq_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
-                   m_liq_av(j,i) = m_liq_av(j,i) + m_liq_h%var_1d(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
+                   m_liq_av(j,i) = m_liq_av(j,i) + m_liq_h(0)%var_1d(m)
                 ENDDO
              ENDIF
@@ -5925,9 +6038,9 @@
           CASE ( 'm_soil' )
              IF ( ALLOCATED( m_soil_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
                    DO  k = nzb_soil, nzt_soil
-                      m_soil_av(k,j,i) = m_soil_av(k,j,i) + m_soil_h%var_2d(k,m)
+                      m_soil_av(k,j,i) = m_soil_av(k,j,i) + m_soil_h(0)%var_2d(k,m)
                    ENDDO
                 ENDDO
@@ -5936,9 +6049,9 @@
           CASE ( 'qsws_liq*' )
              IF ( ALLOCATED( qsws_liq_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
                    qsws_liq_av(j,i) = qsws_liq_av(j,i) +                       &
-                                         surf_lsm_h%qsws_liq(m)
+                                         surf_lsm_h(0)%qsws_liq(m)
                 ENDDO
              ENDIF
@@ -5946,9 +6059,9 @@
           CASE ( 'qsws_soil*' )
              IF ( ALLOCATED( qsws_soil_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
                    qsws_soil_av(j,i) = qsws_soil_av(j,i) +                     &
-                                          surf_lsm_h%qsws_soil(m)
+                                          surf_lsm_h(0)%qsws_soil(m)
                 ENDDO
              ENDIF
@@ -5956,9 +6069,9 @@
           CASE ( 'qsws_veg*' )
              IF ( ALLOCATED(qsws_veg_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
                    qsws_veg_av(j,i) = qsws_veg_av(j,i) +                       &
-                                         surf_lsm_h%qsws_veg(m)
+                                         surf_lsm_h(0)%qsws_veg(m)
                 ENDDO
              ENDIF
@@ -5966,8 +6079,8 @@
           CASE ( 'r_s*' )
              IF ( ALLOCATED( r_s_av) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
-                   r_s_av(j,i) = r_s_av(j,i) + surf_lsm_h%r_s(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
+                   r_s_av(j,i) = r_s_av(j,i) + surf_lsm_h(0)%r_s(m)
                 ENDDO
              ENDIF
@@ -5975,9 +6088,9 @@
           CASE ( 't_soil' )
              IF ( ALLOCATED( t_soil_av ) ) THEN
-                DO  m = 1, surf_lsm_h%ns
-                   i   = surf_lsm_h%i(m)
-                   j   = surf_lsm_h%j(m)
+                DO  m = 1, surf_lsm_h(0)%ns
+                   i   = surf_lsm_h(0)%i(m)
+                   j   = surf_lsm_h(0)%j(m)
                    DO  k = nzb_soil, nzt_soil
-                      t_soil_av(k,j,i) = t_soil_av(k,j,i) + t_soil_h%var_2d(k,m)
+                      t_soil_av(k,j,i) = t_soil_av(k,j,i) + t_soil_h(0)%var_2d(k,m)
                    ENDDO
                 ENDDO
@@ -6196,8 +6309,8 @@
        CASE ( 'c_liq*_xy' )        ! 2d-array
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) = surf_lsm_h%c_liq(m) * surf_lsm_h%c_veg(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) = surf_lsm_h(0)%c_liq(m) * surf_lsm_h(0)%c_veg(m)
              ENDDO
           ELSE
@@ -6218,8 +6331,8 @@
        CASE ( 'c_soil*_xy' )        ! 2d-array
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) = 1.0_wp - surf_lsm_h%c_veg(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) = 1.0_wp - surf_lsm_h(0)%c_veg(m)
              ENDDO
           ELSE
@@ -6240,8 +6353,8 @@
        CASE ( 'c_veg*_xy' )        ! 2d-array
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) = surf_lsm_h%c_veg(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) = surf_lsm_h(0)%c_veg(m)
              ENDDO
           ELSE
@@ -6262,8 +6375,8 @@
        CASE ( 'lai*_xy' )        ! 2d-array
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) = surf_lsm_h%lai(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) = surf_lsm_h(0)%lai(m)
              ENDDO
           ELSE
@@ -6284,8 +6397,8 @@
        CASE ( 'm_liq*_xy' )        ! 2d-array
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) = m_liq_h%var_1d(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) = m_liq_h(0)%var_1d(m)
              ENDDO
           ELSE
@@ -6306,9 +6419,9 @@
        CASE ( 'm_soil_xy', 'm_soil_xz', 'm_soil_yz' )
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i   = surf_lsm_h%i(m)
-                j   = surf_lsm_h%j(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i   = surf_lsm_h(0)%i(m)
+                j   = surf_lsm_h(0)%j(m)
                 DO k = nzb_soil, nzt_soil
-                   local_pf(i,j,k) = m_soil_h%var_2d(k,m)
+                   local_pf(i,j,k) = m_soil_h(0)%var_2d(k,m)
                 ENDDO
              ENDDO
@@ -6334,8 +6447,8 @@
        CASE ( 'qsws_liq*_xy' )        ! 2d-array
           IF ( av == 0 ) THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) = surf_lsm_h%qsws_liq(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) = surf_lsm_h(0)%qsws_liq(m)
              ENDDO
           ELSE
@@ -6356,8 +6469,8 @@
        CASE ( 'qsws_soil*_xy' )        ! 2d-array
           IF ( av == 0 ) THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) =  surf_lsm_h%qsws_soil(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) =  surf_lsm_h(0)%qsws_soil(m)
              ENDDO
           ELSE
@@ -6378,8 +6491,8 @@
        CASE ( 'qsws_veg*_xy' )        ! 2d-array
           IF ( av == 0 ) THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) =  surf_lsm_h%qsws_veg(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) =  surf_lsm_h(0)%qsws_veg(m)
              ENDDO
           ELSE
@@ -6401,8 +6514,8 @@
        CASE ( 'r_s*_xy' )        ! 2d-array
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i                   = surf_lsm_h%i(m)
-                j                   = surf_lsm_h%j(m)
-                local_pf(i,j,nzb+1) = surf_lsm_h%r_s(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i                   = surf_lsm_h(0)%i(m)
+                j                   = surf_lsm_h(0)%j(m)
+                local_pf(i,j,nzb+1) = surf_lsm_h(0)%r_s(m)
              ENDDO
           ELSE
@@ -6423,9 +6536,9 @@
        CASE ( 't_soil_xy', 't_soil_xz', 't_soil_yz' )
           IF ( av == 0 )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i   = surf_lsm_h%i(m)
-                j   = surf_lsm_h%j(m)
+             DO  m = 1, surf_lsm_h(0)%ns
+                i   = surf_lsm_h(0)%i(m)
+                j   = surf_lsm_h(0)%j(m)
                 DO k = nzb_soil, nzt_soil
-                   local_pf(i,j,k) = t_soil_h%var_2d(k,m)
+                   local_pf(i,j,k) = t_soil_h(0)%var_2d(k,m)
                 ENDDO
              ENDDO
@@ -6498,9 +6611,9 @@
 
          IF ( av == 0 )  THEN
-            DO  m = 1, surf_lsm_h%ns
-                i   = surf_lsm_h%i(m)
-                j   = surf_lsm_h%j(m)
+            DO  m = 1, surf_lsm_h(0)%ns
+                i   = surf_lsm_h(0)%i(m)
+                j   = surf_lsm_h(0)%j(m)
                 DO  k = nzb_soil, nzt_soil
-                   local_pf(i,j,k) = m_soil_h%var_2d(k,m)
+                   local_pf(i,j,k) = m_soil_h(0)%var_2d(k,m)
                 ENDDO
             ENDDO
@@ -6522,9 +6635,9 @@
 
          IF ( av == 0 )  THEN
-            DO  m = 1, surf_lsm_h%ns
-               i   = surf_lsm_h%i(m)
-               j   = surf_lsm_h%j(m)
+            DO  m = 1, surf_lsm_h(0)%ns
+               i   = surf_lsm_h(0)%i(m)
+               j   = surf_lsm_h(0)%j(m)
                DO  k = nzb_soil, nzt_soil
-                  local_pf(i,j,k) = t_soil_h%var_2d(k,m)
+                  local_pf(i,j,k) = t_soil_h(0)%var_2d(k,m)
                ENDDO
             ENDDO
@@ -6577,5 +6690,5 @@
 
        CALL wrd_write_string( 'ns_h_on_file_lsm' )
-       WRITE ( 14 )  surf_lsm_h%ns
+       WRITE ( 14 )  surf_lsm_h(0:1)%ns
 
        CALL wrd_write_string( 'ns_v_on_file_lsm' )
@@ -6633,12 +6746,15 @@
        ENDIF
 
-       CALL wrd_write_string( 'lsm_start_index_h' )
-       WRITE ( 14 )  surf_lsm_h%start_index
-
-       CALL wrd_write_string( 'lsm_end_index_h' )
-       WRITE ( 14 )  surf_lsm_h%end_index
-
-       CALL wrd_write_string( 't_soil_h' )
-       WRITE ( 14 )  t_soil_h%var_2d
+       DO  l = 0, 1
+          CALL wrd_write_string( 'lsm_start_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%start_index
+
+          CALL wrd_write_string( 'lsm_end_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%end_index
+
+          WRITE( dum, '(I1)')  l
+          CALL wrd_write_string( 't_soil_h(' // dum // ')' )
+          WRITE ( 14 )  t_soil_h(l)%var_2d
+       ENDDO
 
        DO  l = 0, 3
@@ -6656,12 +6772,15 @@
        ENDDO
 
-       CALL wrd_write_string( 'lsm_start_index_h' )
-       WRITE ( 14 )  surf_lsm_h%start_index
-
-       CALL wrd_write_string( 'lsm_end_index_h' )
-       WRITE ( 14 )  surf_lsm_h%end_index
-
-       CALL wrd_write_string( 'm_soil_h' )
-       WRITE ( 14 )  m_soil_h%var_2d
+       DO  l = 0, 1
+          CALL wrd_write_string( 'lsm_start_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%start_index
+
+          CALL wrd_write_string( 'lsm_end_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%end_index
+
+          WRITE( dum, '(I1)')  l
+          CALL wrd_write_string( 'm_soil_h(' // dum // ')' )
+          WRITE ( 14 )  m_soil_h(l)%var_2d
+       ENDDO
 
        DO  l = 0, 3
@@ -6679,12 +6798,15 @@
        ENDDO
 
-       CALL wrd_write_string( 'lsm_start_index_h' )
-       WRITE ( 14 )  surf_lsm_h%start_index
-
-       CALL wrd_write_string( 'lsm_end_index_h' )
-       WRITE ( 14 )  surf_lsm_h%end_index
-
-       CALL wrd_write_string( 'm_liq_h' )
-       WRITE ( 14 )  m_liq_h%var_1d
+       DO  l = 0, 1
+          CALL wrd_write_string( 'lsm_start_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%start_index
+
+          CALL wrd_write_string( 'lsm_end_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%end_index
+
+          WRITE( dum, '(I1)')  l
+          CALL wrd_write_string( 'm_liq_h(' // dum // ')' )
+          WRITE ( 14 )  m_liq_h(l)%var_1d
+       ENDDO
 
        DO  l = 0, 3
@@ -6702,12 +6824,15 @@
        ENDDO
 
-       CALL wrd_write_string( 'lsm_start_index_h' )
-       WRITE ( 14 )  surf_lsm_h%start_index
-
-       CALL wrd_write_string( 'lsm_end_index_h' )
-       WRITE ( 14 )  surf_lsm_h%end_index
-
-       CALL wrd_write_string( 't_surface_h' )
-       WRITE ( 14 )  t_surface_h%var_1d
+       DO  l = 0, 1
+          CALL wrd_write_string( 'lsm_start_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%start_index
+
+          CALL wrd_write_string( 'lsm_end_index_h' )
+          WRITE ( 14 )  surf_lsm_h(l)%end_index
+
+          WRITE( dum, '(I1)')  l
+          CALL wrd_write_string( 't_surface_h(' // dum // ')' )
+          WRITE ( 14 )  t_surface_h(l)%var_1d
+       ENDDO
 
        DO  l = 0, 3
@@ -6738,14 +6863,22 @@
        IF ( ALLOCATED( t_soil_av ) )  CALL wrd_mpi_io( 't_soil_av', t_soil_av, nzb_soil, nzt_soil )
 
-       CALL rd_mpi_io_surface_filetypes( surf_lsm_h%start_index, surf_lsm_h%end_index,             &
-                                         surface_data_to_write, global_start_index )
-
-       CALL wrd_mpi_io( 'lsm_start_index_h',  surf_lsm_h%start_index )
-       CALL wrd_mpi_io( 'lsm_end_index_h',  surf_lsm_h%end_index )
-       CALL wrd_mpi_io( 'lsm_global_start_index_h', global_start_index )
-       CALL wrd_mpi_io_surface( 't_soil_h', t_soil_h%var_2d )
-       CALL wrd_mpi_io_surface( 'm_soil_h',  m_soil_h%var_2d )
-       CALL wrd_mpi_io_surface( 'm_liq_h', m_liq_h%var_1d )
-       CALL wrd_mpi_io_surface( 't_surface_h', t_surface_h%var_1d )
+       DO  l = 0, 1
+
+          WRITE( dum, '(I1)' )  l
+
+          CALL rd_mpi_io_surface_filetypes( surf_lsm_h(l)%start_index, surf_lsm_h(l)%end_index,             &
+                                            surface_data_to_write, global_start_index )
+
+          CALL wrd_mpi_io( 'lsm_start_index_h_' // dum,  surf_lsm_h(l)%start_index )
+          CALL wrd_mpi_io( 'lsm_end_index_h_' // dum,  surf_lsm_h(l)%end_index )
+          CALL wrd_mpi_io( 'lsm_global_start_index_h_' // dum, global_start_index )
+
+          IF ( .NOT. surface_data_to_write )  CYCLE
+
+          CALL wrd_mpi_io_surface( 't_soil_h(' // dum // ')', t_soil_h(l)%var_2d )
+          CALL wrd_mpi_io_surface( 'm_soil_h(' // dum // ')',  m_soil_h(l)%var_2d )
+          CALL wrd_mpi_io_surface( 'm_liq_h(' // dum // ')', m_liq_h(l)%var_1d )
+          CALL wrd_mpi_io_surface( 't_surface_h(' // dum // ')', t_surface_h(l)%var_1d )
+       ENDDO
 
        DO  l = 0, 3
@@ -6796,5 +6929,4 @@
     INTEGER(iwp) ::  k                 !<
     INTEGER(iwp) ::  l                 !< running index surface orientation
-    INTEGER(iwp) ::  ns_h_on_file_lsm  !< number of horizontal surface elements (natural type) on file
     INTEGER(iwp) ::  nxlc              !<
     INTEGER(iwp) ::  nxlf              !<
@@ -6810,4 +6942,5 @@
     INTEGER(iwp) ::  nys_on_file       !< index of south boundary on former local domain
 
+    INTEGER(iwp) ::  ns_h_on_file_lsm(0:1) !< number of horizontal surface elements (natural type) on file
     INTEGER(iwp) ::  ns_v_on_file_lsm(0:3) !< number of vertical surface elements (natural type) on file
 
@@ -6821,7 +6954,7 @@
     REAL(wp), DIMENSION(nzb_soil:nzt_soil,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
 
-    TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_1d   !< temporary 1D array containing the respective surface variable stored on file, horizontal surfaces
-    TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_2d   !< temporary 2D array containing the respective surface variable stored on file, horizontal surfaces
-    TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_2d2  !< temporary 2D array containing the respective surface variable stored on file, horizontal surfaces
+    TYPE(surf_type_lsm), DIMENSION(0:1), SAVE :: tmp_walltype_h_1d   !< temporary 1D array containing the respective surface variable stored on file, horizontal surfaces
+    TYPE(surf_type_lsm), DIMENSION(0:1), SAVE :: tmp_walltype_h_2d   !< temporary 2D array containing the respective surface variable stored on file, horizontal surfaces
+    TYPE(surf_type_lsm), DIMENSION(0:1), SAVE :: tmp_walltype_h_2d2  !< temporary 2D array containing the respective surface variable stored on file, horizontal surfaces
 
     TYPE(surf_type_lsm), DIMENSION(0:3), SAVE :: tmp_walltype_v_1d   !< temporary 1D array containing the respective surface variable stored on file, vertical surfaces
@@ -6839,18 +6972,23 @@
              READ ( 13 ) ns_h_on_file_lsm
 
-             IF ( ALLOCATED( tmp_walltype_h_1d%var_1d ) )                      &
-                DEALLOCATE( tmp_walltype_h_1d%var_1d )
-             IF ( ALLOCATED( tmp_walltype_h_2d%var_2d ) )                      &
-                DEALLOCATE( tmp_walltype_h_2d%var_2d )
-             IF ( ALLOCATED( tmp_walltype_h_2d2%var_2d ) )                     &
-                DEALLOCATE( tmp_walltype_h_2d2%var_2d )
+             DO l = 0, 1
+                IF ( ALLOCATED( tmp_walltype_h_1d(l)%var_1d ) )                   &
+                   DEALLOCATE( tmp_walltype_h_1d(l)%var_1d )
+                IF ( ALLOCATED( tmp_walltype_h_2d(l)%var_2d ) )                   &
+                   DEALLOCATE( tmp_walltype_h_2d(l)%var_2d )
+                IF ( ALLOCATED( tmp_walltype_h_2d2(l)%var_2d ) )                  &
+                   DEALLOCATE( tmp_walltype_h_2d2(l)%var_2d )
+             ENDDO
 
 !
 !--          Allocate temporary arrays to store surface data
-             ALLOCATE( tmp_walltype_h_1d%var_1d(1:ns_h_on_file_lsm) )
-             ALLOCATE( tmp_walltype_h_2d%var_2d(nzb_soil:nzt_soil+1,           &
-                                                1:ns_h_on_file_lsm) )
-             ALLOCATE( tmp_walltype_h_2d2%var_2d(nzb_soil:nzt_soil,            &
-                       1:ns_h_on_file_lsm)  )
+             DO l = 0, 1
+                ALLOCATE( tmp_walltype_h_1d(l)                                    &
+                             %var_1d(1:ns_h_on_file_lsm(l)) )
+                ALLOCATE( tmp_walltype_h_2d(l)                                    &
+                             %var_2d(nzb_soil:nzt_soil+1, 1:ns_h_on_file_lsm(l)) )
+                ALLOCATE( tmp_walltype_h_2d2(l)                                   &
+                             %var_2d(nzb_soil:nzt_soil,1:ns_h_on_file_lsm(l))  )
+             ENDDO
 
           ENDIF
@@ -6991,16 +7129,36 @@
             ENDIF
 
-       CASE ( 't_soil_h' )
+       CASE ( 't_soil_h(0)' )
 
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_soil_h%var_2d ) )                        &
-                ALLOCATE( t_soil_h%var_2d(nzb_soil:nzt_soil+1,                 &
-                                          1:surf_lsm_h%ns) )
-             READ ( 13 )  tmp_walltype_h_2d%var_2d
+             IF ( .NOT.  ALLOCATED( t_soil_h(0)%var_2d ) )                     &
+                ALLOCATE( t_soil_h(0)%var_2d(nzb_soil:nzt_soil+1,              &
+                                          1:surf_lsm_h(0)%ns) )
+             READ ( 13 )  tmp_walltype_h_2d(0)%var_2d
           ENDIF
           CALL surface_restore_elements(                                       &
-                                     t_soil_h%var_2d,                          &
-                                     tmp_walltype_h_2d%var_2d,                 &
-                                     surf_lsm_h%start_index,                   &
+                                     t_soil_h(0)%var_2d,                       &
+                                     tmp_walltype_h_2d(0)%var_2d,              &
+                                     surf_lsm_h(0)%start_index,                &
+                                     start_index_on_file,                      &
+                                     end_index_on_file,                        &
+                                     nxlc, nysc,                               &
+                                     nxlf, nxrf, nysf, nynf,                   &
+                                     nys_on_file, nyn_on_file,                 &
+                                     nxl_on_file,nxr_on_file )
+
+       CASE ( 't_soil_h(1)' )
+
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_soil_h(1)%var_2d ) )                     &
+                ALLOCATE( t_soil_h(1)%var_2d(nzb_soil:nzt_soil+1,              &
+                                          1:surf_lsm_h(1)%ns) )
+             write(9,*) surf_lsm_h(1)%ns
+             READ ( 13 )  tmp_walltype_h_2d(1)%var_2d
+          ENDIF
+          CALL surface_restore_elements(                                       &
+                                     t_soil_h(1)%var_2d,                       &
+                                     tmp_walltype_h_2d(1)%var_2d,              &
+                                     surf_lsm_h(1)%start_index,                &
                                      start_index_on_file,                      &
                                      end_index_on_file,                        &
@@ -7086,16 +7244,35 @@
                                   nxl_on_file,nxr_on_file )
 
-       CASE ( 'm_soil_h' )
+       CASE ( 'm_soil_h(0)' )
 
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( m_soil_h%var_2d ) )                        &
-                ALLOCATE( m_soil_h%var_2d(nzb_soil:nzt_soil+1,                 &
-                                          1:surf_lsm_h%ns) )
-             READ ( 13 )  tmp_walltype_h_2d2%var_2d
+             IF ( .NOT.  ALLOCATED( m_soil_h(0)%var_2d ) )                     &
+                ALLOCATE( m_soil_h(0)%var_2d(nzb_soil:nzt_soil+1,              &
+                                          1:surf_lsm_h(0)%ns) )
+             READ ( 13 )  tmp_walltype_h_2d2(0)%var_2d
           ENDIF
           CALL surface_restore_elements(                                       &
-                                    m_soil_h%var_2d,                           &
-                                    tmp_walltype_h_2d2%var_2d,                 &
-                                    surf_lsm_h%start_index,                    &
+                                    m_soil_h(0)%var_2d,                        &
+                                    tmp_walltype_h_2d2(0)%var_2d,              &
+                                    surf_lsm_h(0)%start_index,                 &
+                                    start_index_on_file,                       &
+                                    end_index_on_file,                         &
+                                    nxlc, nysc,                                &
+                                    nxlf, nxrf, nysf, nynf,                    &
+                                    nys_on_file, nyn_on_file,                  &
+                                    nxl_on_file,nxr_on_file )
+
+       CASE ( 'm_soil_h(1)' )
+
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( m_soil_h(1)%var_2d ) )                     &
+                ALLOCATE( m_soil_h(1)%var_2d(nzb_soil:nzt_soil+1,              &
+                                          1:surf_lsm_h(1)%ns) )
+             READ ( 13 )  tmp_walltype_h_2d2(1)%var_2d
+          ENDIF
+          CALL surface_restore_elements(                                       &
+                                    m_soil_h(1)%var_2d,                        &
+                                    tmp_walltype_h_2d2(1)%var_2d,              &
+                                    surf_lsm_h(1)%start_index,                 &
                                     start_index_on_file,                       &
                                     end_index_on_file,                         &
@@ -7184,15 +7361,33 @@
 
 
-       CASE ( 'm_liq_h' )
+       CASE ( 'm_liq_h(0)' )
 
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( m_liq_h%var_1d ) )                         &
-                ALLOCATE( m_liq_h%var_1d(1:surf_lsm_h%ns) )
-             READ ( 13 )  tmp_walltype_h_1d%var_1d
+             IF ( .NOT.  ALLOCATED( m_liq_h(0)%var_1d ) )                      &
+                ALLOCATE( m_liq_h(0)%var_1d(1:surf_lsm_h(0)%ns) )
+             READ ( 13 )  tmp_walltype_h_1d(0)%var_1d
           ENDIF
           CALL surface_restore_elements(                                       &
-                                     m_liq_h%var_1d,                           &
-                                     tmp_walltype_h_1d%var_1d,                 &
-                                     surf_lsm_h%start_index,                   &
+                                     m_liq_h(0)%var_1d,                        &
+                                     tmp_walltype_h_1d(0)%var_1d,              &
+                                     surf_lsm_h(0)%start_index,                &
+                                     start_index_on_file,                      &
+                                     end_index_on_file,                        &
+                                     nxlc, nysc,                               &
+                                     nxlf, nxrf, nysf, nynf,                   &
+                                     nys_on_file, nyn_on_file,                 &
+                                     nxl_on_file,nxr_on_file )
+
+       CASE ( 'm_liq_h(1)' )
+
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( m_liq_h(1)%var_1d ) )                      &
+                ALLOCATE( m_liq_h(1)%var_1d(1:surf_lsm_h(1)%ns) )
+             READ ( 13 )  tmp_walltype_h_1d(1)%var_1d
+          ENDIF
+          CALL surface_restore_elements(                                       &
+                                     m_liq_h(1)%var_1d,                        &
+                                     tmp_walltype_h_1d(1)%var_1d,              &
+                                     surf_lsm_h(1)%start_index,                &
                                      start_index_on_file,                      &
                                      end_index_on_file,                        &
@@ -7278,15 +7473,33 @@
 
 
-       CASE ( 't_surface_h' )
+       CASE ( 't_surface_h(0)' )
 
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surface_h%var_1d ) )                     &
-                ALLOCATE( t_surface_h%var_1d(1:surf_lsm_h%ns) )
-             READ ( 13 )  tmp_walltype_h_1d%var_1d
+             IF ( .NOT.  ALLOCATED( t_surface_h(0)%var_1d ) )                  &
+                ALLOCATE( t_surface_h(0)%var_1d(1:surf_lsm_h(0)%ns) )
+             READ ( 13 )  tmp_walltype_h_1d(0)%var_1d
           ENDIF
           CALL surface_restore_elements(                                       &
-                                     t_surface_h%var_1d,                       &
-                                     tmp_walltype_h_1d%var_1d,                 &
-                                     surf_lsm_h%start_index,                   &
+                                     t_surface_h(0)%var_1d,                    &
+                                     tmp_walltype_h_1d(0)%var_1d,              &
+                                     surf_lsm_h(0)%start_index,                &
+                                     start_index_on_file,                      &
+                                     end_index_on_file,                        &
+                                     nxlc, nysc,                               &
+                                     nxlf, nxrf, nysf, nynf,                   &
+                                     nys_on_file, nyn_on_file,                 &
+                                     nxl_on_file,nxr_on_file )
+
+       CASE ( 't_surface_h(1)' )
+
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surface_h(1)%var_1d ) )                  &
+                ALLOCATE( t_surface_h(1)%var_1d(1:surf_lsm_h(1)%ns) )
+             READ ( 13 )  tmp_walltype_h_1d(1)%var_1d
+          ENDIF
+          CALL surface_restore_elements(                                       &
+                                     t_surface_h(1)%var_1d,                    &
+                                     tmp_walltype_h_1d(1)%var_1d,              &
+                                     surf_lsm_h(1)%start_index,                &
                                      start_index_on_file,                      &
                                      end_index_on_file,                        &
@@ -7466,16 +7679,20 @@
     ENDIF
 
-    CALL rrd_mpi_io( 'lsm_start_index_h',  surf_lsm_h%start_index )
-    CALL rrd_mpi_io( 'lsm_end_index_h',  surf_lsm_h%end_index )
-    CALL rrd_mpi_io( 'lsm_global_start_index_h', global_start )
-
-    CALL rd_mpi_io_surface_filetypes ( surf_lsm_h%start_index, surf_lsm_h%end_index, ldum,         &
-                                       global_start )
-
-    CALL rrd_mpi_io_surface( 't_soil_h', t_soil_h%var_2d )
-    CALL rrd_mpi_io_surface( 'm_soil_h',  m_soil_h%var_2d )
-    CALL rrd_mpi_io_surface( 'm_liq_h', m_liq_h%var_1d )
-    CALL rrd_mpi_io_surface( 't_surface_h', t_surface_h%var_1d )
-
+    DO l = 0, 1
+
+       WRITE( dum, '(I1)')  l
+
+       CALL rrd_mpi_io( 'lsm_start_index_h_' // dum,  surf_lsm_h(l)%start_index )
+       CALL rrd_mpi_io( 'lsm_end_index_h_' // dum,  surf_lsm_h(l)%end_index )
+       CALL rrd_mpi_io( 'lsm_global_start_index_h_' // dum, global_start )
+
+       CALL rd_mpi_io_surface_filetypes ( surf_lsm_h(l)%start_index, surf_lsm_h(l)%end_index, ldum,         &
+                                          global_start )
+
+       CALL rrd_mpi_io_surface( 't_soil_h(' // dum // ')', t_soil_h(l)%var_2d )
+       CALL rrd_mpi_io_surface( 'm_soil_h(' // dum // ')',  m_soil_h(l)%var_2d )
+       CALL rrd_mpi_io_surface( 'm_liq_h(' // dum // ')', m_liq_h(l)%var_1d )
+       CALL rrd_mpi_io_surface( 't_surface_h(' // dum // ')', t_surface_h(l)%var_1d )
+    ENDDO
 
     DO  l = 0, 3
@@ -7531,10 +7748,10 @@
 !       REAL(wp) :: re_0 !< near-surface roughness Reynolds number
 
-       DO  m = 1, surf_lsm_h%ns
-
-          i   = surf_lsm_h%i(m)
-          j   = surf_lsm_h%j(m)
-
-          IF ( surf_lsm_h%water_surface(m) )  THEN
+       DO  m = 1, surf_lsm_h(0)%ns
+!--       only upward facin horizontal surfaces are considered for water surface processing
+          i   = surf_lsm_h(0)%i(m)
+          j   = surf_lsm_h(0)%j(m)
+
+          IF ( surf_lsm_h(0)%water_surface(m) )  THEN
 
 !
@@ -7563,26 +7780,26 @@
 !--          Charnock relation is used. Add a security factor of 1E-8 to avoid
 !--          divisions by zero.
-             surf_lsm_h%z0(m)  = ( 0.11_wp * molecular_viscosity /             &
-                                 ( surf_lsm_h%us(m) + 1E-8_wp ) )              &
-                               + ( alpha_ch * surf_lsm_h%us(m)**2 / g )
-
-             surf_lsm_h%z0h(m) = 0.40_wp * molecular_viscosity /               &
-                                 ( surf_lsm_h%us(m) + 1E-8_wp )
-             surf_lsm_h%z0q(m) = 0.62_wp * molecular_viscosity /               &
-                                 ( surf_lsm_h%us(m) + 1E-8_wp )
-
-
-             IF ( surf_lsm_h%z0(m) > 0.1_wp * surf_lsm_h%z_mo(m) )  THEN
-                surf_lsm_h%z0(m) = 0.1_wp * surf_lsm_h%z_mo(m)
+             surf_lsm_h(0)%z0(m)  = ( 0.11_wp * molecular_viscosity /             &
+                                 ( surf_lsm_h(0)%us(m) + 1E-8_wp ) )              &
+                               + ( alpha_ch * surf_lsm_h(0)%us(m)**2 / g )
+
+             surf_lsm_h(0)%z0h(m) = 0.40_wp * molecular_viscosity /               &
+                                 ( surf_lsm_h(0)%us(m) + 1E-8_wp )
+             surf_lsm_h(0)%z0q(m) = 0.62_wp * molecular_viscosity /               &
+                                 ( surf_lsm_h(0)%us(m) + 1E-8_wp )
+
+
+             IF ( surf_lsm_h(0)%z0(m) > 0.1_wp * surf_lsm_h(0)%z_mo(m) )  THEN
+                surf_lsm_h(0)%z0(m) = 0.1_wp * surf_lsm_h(0)%z_mo(m)
                 flag_exceed_z0   = .TRUE.
              ENDIF
 
-             IF ( surf_lsm_h%z0h(m) >= 0.1_wp * surf_lsm_h%z_mo(m) )  THEN
-                surf_lsm_h%z0h(m) = 0.1_wp * surf_lsm_h%z_mo(m)
+             IF ( surf_lsm_h(0)%z0h(m) >= 0.1_wp * surf_lsm_h(0)%z_mo(m) )  THEN
+                surf_lsm_h(0)%z0h(m) = 0.1_wp * surf_lsm_h(0)%z_mo(m)
                 flag_exceed_z0h   = .TRUE.
              ENDIF
 
-             IF ( surf_lsm_h%z0q(m) >= 0.1_wp * surf_lsm_h%z_mo(m) )  THEN
-                surf_lsm_h%z0q(m) = 0.1_wp * surf_lsm_h%z_mo(m)
+             IF ( surf_lsm_h(0)%z0q(m) >= 0.1_wp * surf_lsm_h(0)%z_mo(m) )  THEN
+                surf_lsm_h(0)%z0q(m) = 0.1_wp * surf_lsm_h(0)%z_mo(m)
                 flag_exceed_z0h   = .TRUE.
              ENDIF
Index: palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90
===================================================================
--- palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90	(revision 4671)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 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
@@ -681,6 +684,6 @@
 !--       type, if required 
           IF ( surf_def_h(0)%ns >= 1 )  surf_def_h(0)%shf(:) = dum_surf_flux
-          IF ( surf_lsm_h%ns    >= 1 )  surf_lsm_h%shf(:)    = dum_surf_flux
-          IF ( surf_usm_h%ns    >= 1 )  surf_usm_h%shf(:)    = dum_surf_flux
+          IF ( surf_lsm_h(0)%ns >= 1 )  surf_lsm_h(0)%shf(:) = dum_surf_flux
+          IF ( surf_usm_h(0)%ns >= 1 )  surf_usm_h(0)%shf(:) = dum_surf_flux
 
           pt_surface    = pt_surf(nt) + fac * ( pt_surf(nt+1) - pt_surf(nt) )
@@ -702,6 +705,6 @@
 !--       type, if required 
           IF ( surf_def_h(0)%ns >= 1 )  surf_def_h(0)%qsws(:) = dum_surf_flux
-          IF ( surf_lsm_h%ns    >= 1 )  surf_lsm_h%qsws(:)    = dum_surf_flux
-          IF ( surf_usm_h%ns    >= 1 )  surf_usm_h%qsws(:)    = dum_surf_flux
+          IF ( surf_lsm_h(0)%ns >= 1 )  surf_lsm_h(0)%qsws(:) = dum_surf_flux
+          IF ( surf_usm_h(0)%ns >= 1 )  surf_usm_h(0)%qsws(:) = dum_surf_flux
 
        ENDIF
Index: palm/trunk/SOURCE/ocean_mod.f90
===================================================================
--- palm/trunk/SOURCE/ocean_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/ocean_mod.f90	(revision 4671)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4535 2020-05-15 12:07:23Z raasch
 ! bugfix for restart data format query
 ! 
@@ -1683,5 +1686,6 @@
                          surf_def_h(0)%sasws, surf_def_h(1)%sasws,             &
                          surf_def_h(2)%sasws,                                  &
-                         surf_lsm_h%sasws,    surf_usm_h%sasws,                &
+                         surf_lsm_h(0)%sasws, surf_lsm_h(1)%sasws,             &
+                         surf_usm_h(0)%sasws, surf_usm_h(1)%sasws,             &
                          surf_def_v(0)%sasws, surf_def_v(1)%sasws,             &
                          surf_def_v(2)%sasws, surf_def_v(3)%sasws,             &
@@ -1833,5 +1837,6 @@
                          surf_def_h(0)%sasws, surf_def_h(1)%sasws,             &
                          surf_def_h(2)%sasws,                                  &
-                         surf_lsm_h%sasws,    surf_usm_h%sasws,                &
+                         surf_lsm_h(0)%sasws, surf_lsm_h(1)%sasws,             &
+                         surf_usm_h(0)%sasws, surf_usm_h(1)%sasws,             &
                          surf_def_v(0)%sasws, surf_def_v(1)%sasws,             &
                          surf_def_v(2)%sasws, surf_def_v(3)%sasws,             &
Index: palm/trunk/SOURCE/plant_canopy_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4671)
@@ -22,9 +22,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4535 2020-05-15 12:07:23Z raasch
 ! bugfix for restart data format query
 ! 
@@ -1442,17 +1445,17 @@
 !
 !--       Natural surfaces
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
+          DO  m = 1, surf_lsm_h(0)%ns
+             i = surf_lsm_h(0)%i(m)
+             j = surf_lsm_h(0)%j(m)
              IF ( cum_lai_hf(0,j,i) /= 0.0_wp )                                &
-                surf_lsm_h%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) )
+                surf_lsm_h(0)%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) )
           ENDDO
 !
 !--       Urban surfaces
-          DO  m = 1, surf_usm_h%ns
-             i = surf_usm_h%i(m)
-             j = surf_usm_h%j(m)
+          DO  m = 1, surf_usm_h(0)%ns
+             i = surf_usm_h(0)%i(m)
+             j = surf_usm_h(0)%j(m)
              IF ( cum_lai_hf(0,j,i) /= 0.0_wp )                                &
-                surf_usm_h%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) )
+                surf_usm_h(0)%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) )
           ENDDO
 !
Index: palm/trunk/SOURCE/poisfft_mod.f90
===================================================================
--- palm/trunk/SOURCE/poisfft_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/poisfft_mod.f90	(revision 4671)
@@ -25,6 +25,8 @@
 ! -----------------
 ! $Id$
+! OMP bugfix
+!
+! 4649 2020-08-25 12:11:17Z raasch
 ! File re-formatted to follow the PALM coding standard
-!
 !
 ! 4429 2020-02-27 15:24:30Z raasch
@@ -985,5 +987,5 @@
     INTEGER(iwp) ::  m                   !<
     INTEGER(iwp) ::  n                   !<
-!   INTEGER(iwp) ::  omp_get_thread_num  !<
+!$  INTEGER(iwp) ::  omp_get_thread_num  !<
     INTEGER(iwp) ::  tn                  !<
 
Index: palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- palm/trunk/SOURCE/prognostic_equations.f90	(revision 4670)
+++ palm/trunk/SOURCE/prognostic_equations.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4649 2020-08-25 12:11:17Z raasch
 ! File re-formatted to follow the PALM coding standard
 !
@@ -650,9 +653,10 @@
              ENDIF
              CALL diffusion_s( i, j, pt, surf_def_h(0)%shf, surf_def_h(1)%shf, surf_def_h(2)%shf,  &
-                               surf_lsm_h%shf, surf_usm_h%shf, surf_def_v(0)%shf,                  &
-                               surf_def_v(1)%shf, surf_def_v(2)%shf, surf_def_v(3)%shf,            &
-                               surf_lsm_v(0)%shf, surf_lsm_v(1)%shf, surf_lsm_v(2)%shf,            &
-                               surf_lsm_v(3)%shf, surf_usm_v(0)%shf, surf_usm_v(1)%shf,            &
-                               surf_usm_v(2)%shf, surf_usm_v(3)%shf )
+                               surf_lsm_h(0)%shf, surf_lsm_h(1)%shf,                               &
+                               surf_usm_h(0)%shf, surf_usm_h(1)%shf,                               &
+                               surf_def_v(0)%shf, surf_def_v(1)%shf, surf_def_v(2)%shf,            &
+                               surf_def_v(3)%shf, surf_lsm_v(0)%shf, surf_lsm_v(1)%shf,            &
+                               surf_lsm_v(2)%shf, surf_lsm_v(3)%shf, surf_usm_v(0)%shf,            &
+                               surf_usm_v(1)%shf, surf_usm_v(2)%shf, surf_usm_v(3)%shf )
 
 !
@@ -736,5 +740,6 @@
              ENDIF
              CALL diffusion_s( i, j, q, surf_def_h(0)%qsws, surf_def_h(1)%qsws,                    &
-                               surf_def_h(2)%qsws, surf_lsm_h%qsws, surf_usm_h%qsws,               &
+                               surf_def_h(2)%qsws, surf_lsm_h(0)%qsws, surf_lsm_h(1)%qsws,         &
+                               surf_usm_h(0)%qsws, surf_usm_h(1)%qsws,                             &
                                surf_def_v(0)%qsws, surf_def_v(1)%qsws, surf_def_v(2)%qsws,         &
                                surf_def_v(3)%qsws, surf_lsm_v(0)%qsws, surf_lsm_v(1)%qsws,         &
@@ -815,5 +820,6 @@
              ENDIF
              CALL diffusion_s( i, j, s, surf_def_h(0)%ssws, surf_def_h(1)%ssws,                    &
-                               surf_def_h(2)%ssws, surf_lsm_h%ssws, surf_usm_h%ssws,               &
+                               surf_def_h(2)%ssws, surf_lsm_h(0)%ssws, surf_lsm_h(1)%ssws,         &
+                               surf_usm_h(0)%ssws, surf_usm_h(1)%ssws,                             &
                                surf_def_v(0)%ssws, surf_def_v(1)%ssws, surf_def_v(2)%ssws,         &
                                surf_def_v(3)%ssws, surf_lsm_v(0)%ssws, surf_lsm_v(1)%ssws,         &
@@ -1245,5 +1251,6 @@
 
        CALL diffusion_s( pt, surf_def_h(0)%shf, surf_def_h(1)%shf, surf_def_h(2)%shf,              &
-                         surf_lsm_h%shf, surf_usm_h%shf, surf_def_v(0)%shf, surf_def_v(1)%shf,     &
+                         surf_lsm_h(0)%shf, surf_lsm_h(1)%shf, surf_usm_h(0)%shf,                  &
+                         surf_usm_h(1)%shf, surf_def_v(0)%shf, surf_def_v(1)%shf,                  &
                          surf_def_v(2)%shf, surf_def_v(3)%shf, surf_lsm_v(0)%shf,                  &
                          surf_lsm_v(1)%shf, surf_lsm_v(2)%shf, surf_lsm_v(3)%shf,                  &
@@ -1375,5 +1382,6 @@
 
        CALL diffusion_s( q, surf_def_h(0)%qsws, surf_def_h(1)%qsws, surf_def_h(2)%qsws,            &
-                         surf_lsm_h%qsws, surf_usm_h%qsws, surf_def_v(0)%qsws, surf_def_v(1)%qsws, &
+                         surf_lsm_h(0)%qsws, surf_lsm_h(1)%qsws, surf_usm_h(0)%qsws,               &
+                         surf_usm_h(0)%qsws, surf_def_v(0)%qsws, surf_def_v(1)%qsws,               &
                          surf_def_v(2)%qsws, surf_def_v(3)%qsws, surf_lsm_v(0)%qsws,               &
                          surf_lsm_v(1)%qsws, surf_lsm_v(2)%qsws, surf_lsm_v(3)%qsws,               &
@@ -1486,5 +1494,6 @@
 
        CALL diffusion_s( s, surf_def_h(0)%ssws, surf_def_h(1)%ssws, surf_def_h(2)%ssws,            &
-                         surf_lsm_h%ssws, surf_usm_h%ssws, surf_def_v(0)%ssws, surf_def_v(1)%ssws, &
+                         surf_lsm_h(0)%ssws, surf_lsm_h(1)%ssws, surf_usm_h(0)%ssws,               &
+                         surf_usm_h(1)%ssws, surf_def_v(0)%ssws, surf_def_v(1)%ssws,               &
                          surf_def_v(2)%ssws, surf_def_v(3)%ssws, surf_lsm_v(0)%ssws,               &
                          surf_lsm_v(1)%ssws, surf_lsm_v(2)%ssws, surf_lsm_v(3)%ssws,               &
Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4671)
@@ -28,4 +28,11 @@
 ! -----------------
 ! $Id$
+! Radiative transfer model RTM version 4.1
+! - Implementation of downward facing USM and LSM surfaces
+! - Removal of deprecated CSV inputs
+! - Bugfixes
+! Authors: J. Resler, P. Krc  (Institute of Computer Science, Prague)
+!
+! 4668 2020-09-09 13:00:16Z pavelkrc
 ! Improve debug messages during timestepping
 !
@@ -758,7 +765,10 @@
 
 !-- indices needed for RTM netcdf output subroutines
-    INTEGER(iwp), PARAMETER                        :: nd = 5
-    CHARACTER(LEN=6), DIMENSION(0:nd-1), PARAMETER :: dirname = (/ '_roof ', '_south', '_north', '_west ', '_east ' /)
-    INTEGER(iwp), DIMENSION(0:nd-1), PARAMETER     :: dirint = (/ iup, isouth, inorth, iwest, ieast /)
+    INTEGER(iwp), PARAMETER                        ::  nd = 6                                  !< number of directions
+    CHARACTER(LEN=6), DIMENSION(0:nd-1), PARAMETER ::  dirname = (/ '_up   ', '_down ', '_south', '_north', '_west ', '_east ' /)
+    INTEGER(iwp), DIMENSION(0:nd-1), PARAMETER     ::  dirint = (/ iup, idown, isouth, inorth, iwest, ieast /) !< direction integers
+    INTEGER(iwp), DIMENSION(0:nd-1), PARAMETER     ::  diridx =  (/  0,     1,      1,      0,     3,     2 /) !< mapping to surf_h and surf_v
+    INTEGER(iwp), DIMENSION(0:1), PARAMETER        ::  dirint_h = (/ iup, idown /)                             !< mapping to surf_h directions
+    INTEGER(iwp), DIMENSION(0:3), PARAMETER        ::  dirint_v = (/ inorth, isouth, ieast, iwest /)           !< mapping to surf_v directions
 
 !-- indices and sizes of urban and land surface models
@@ -798,5 +808,5 @@
     REAL(wp), PARAMETER                            ::  ext_coef = 0.6_wp                  !< extinction coefficient (a.k.a. alpha)
     INTEGER(iwp), PARAMETER                        ::  rad_version_len = 10               !< length of identification string of rad version
-    CHARACTER(rad_version_len), PARAMETER          ::  rad_version = 'RAD v. 4.0'         !< identification of version of binary svf and restart files
+    CHARACTER(rad_version_len), PARAMETER          ::  rad_version = 'RAD v. 4.1'         !< identification of version of binary svf and restart files
     INTEGER(iwp)                                   ::  raytrace_discrete_elevs = 40       !< number of discretization steps for elevation (nadir to zenith)
     INTEGER(iwp)                                   ::  raytrace_discrete_azims = 80       !< number of discretization steps for azimuth (out of 360 degrees)
@@ -1107,5 +1117,6 @@
            cos_zenith, calc_zenith, sun_direction, sun_dir_lat, sun_dir_lon,   &
            idir, jdir, kdir, id, iz, iy, ix,                                   &
-           iup, inorth, isouth, ieast, iwest,                                  &
+           iup, idown, inorth, isouth, ieast, iwest,                           &
+           nd, dirname, diridx, dirint,                                        &
            nsurf_type, nz_urban_b, nz_urban_t, nz_urban, pch, nsurf,           &
            idsvf, ndsvf, idcsf, ndcsf, kdcsf, pct,                             &
@@ -1183,4 +1194,5 @@
        INTEGER(iwp)                 ::  ilast_word
        INTEGER(iwp)                 ::  ilen
+       INTEGER(iwp)                 ::  id
 
        var = TRIM(variable)
@@ -1188,19 +1200,14 @@
 !--    Identify directional variables
        ilast_word = SCAN(var, '_', back=.TRUE.)
+       directional = .FALSE.
        IF ( ilast_word > 0 )  THEN
-          SELECT CASE ( var(ilast_word:) )
-             CASE ( '_roof', '_south', '_north', '_west', '_east' )
+          DO id = 0, nd-1
+             IF ( TRIM(var(ilast_word:)) == TRIM(dirname(id)) ) THEN
                 directional = .TRUE.
-                write(9, *) 'vardir', var
-                flush(9)
                 var = var(1:ilast_word-1)
-             CASE DEFAULT
-                directional = .FALSE.
-                write(9, *) 'varnd', var
-                flush(9)
-          END SELECT
-       ELSE
-          directional = .FALSE.
-       END IF
+                EXIT
+             ENDIF
+          ENDDO
+       ENDIF
 
        IF ( directional )  THEN
@@ -1213,5 +1220,5 @@
              unit = '1'
           ELSE
-             SELECT CASE ( var )
+             SELECT CASE ( TRIM(var) )
                 CASE ( 'rtm_rad_net', 'rtm_rad_insw', 'rtm_rad_inlw',             &
                        'rtm_rad_inswdir', 'rtm_rad_inswdif', 'rtm_rad_inswref',   &
@@ -1689,14 +1696,16 @@
 !
 !--    Allocate array for storing the surface net radiation
-       IF ( .NOT. ALLOCATED ( surf_lsm_h%rad_net )  .AND.                      &
-                  surf_lsm_h%ns > 0  )   THEN
-          ALLOCATE( surf_lsm_h%rad_net(1:surf_lsm_h%ns) )
-          surf_lsm_h%rad_net = 0.0_wp
-       ENDIF
-       IF ( .NOT. ALLOCATED ( surf_usm_h%rad_net )  .AND.                      &
-                  surf_usm_h%ns > 0  )  THEN
-          ALLOCATE( surf_usm_h%rad_net(1:surf_usm_h%ns) )
-          surf_usm_h%rad_net = 0.0_wp
-       ENDIF
+       DO  l = 0, 1
+          IF ( .NOT. ALLOCATED ( surf_lsm_h(l)%rad_net )  .AND.                      &
+                     surf_lsm_h(l)%ns > 0  )   THEN
+             ALLOCATE( surf_lsm_h(l)%rad_net(1:surf_lsm_h(l)%ns) )
+             surf_lsm_h(l)%rad_net = 0.0_wp
+          ENDIF
+          IF ( .NOT. ALLOCATED ( surf_usm_h(l)%rad_net )  .AND.                      &
+                     surf_usm_h(l)%ns > 0  )  THEN
+             ALLOCATE( surf_usm_h(l)%rad_net(1:surf_usm_h(l)%ns) )
+             surf_usm_h(l)%rad_net = 0.0_wp
+          ENDIF
+       ENDDO
        DO  l = 0, 3
           IF ( .NOT. ALLOCATED ( surf_lsm_v(l)%rad_net )  .AND.                &
@@ -1715,14 +1724,16 @@
 !
 !--    Allocate array for storing the surface longwave (out) radiation change
-       IF ( .NOT. ALLOCATED ( surf_lsm_h%rad_lw_out_change_0 )  .AND.          &
-                  surf_lsm_h%ns > 0  )   THEN
-          ALLOCATE( surf_lsm_h%rad_lw_out_change_0(1:surf_lsm_h%ns) )
-          surf_lsm_h%rad_lw_out_change_0 = 0.0_wp
-       ENDIF
-       IF ( .NOT. ALLOCATED ( surf_usm_h%rad_lw_out_change_0 )  .AND.          &
-                  surf_usm_h%ns > 0  )  THEN
-          ALLOCATE( surf_usm_h%rad_lw_out_change_0(1:surf_usm_h%ns) )
-          surf_usm_h%rad_lw_out_change_0 = 0.0_wp
-       ENDIF
+       DO  l = 0, 1
+          IF ( .NOT. ALLOCATED ( surf_lsm_h(l)%rad_lw_out_change_0 )  .AND.          &
+                     surf_lsm_h(l)%ns > 0  )   THEN
+             ALLOCATE( surf_lsm_h(l)%rad_lw_out_change_0(1:surf_lsm_h(l)%ns) )
+             surf_lsm_h(l)%rad_lw_out_change_0 = 0.0_wp
+          ENDIF
+          IF ( .NOT. ALLOCATED ( surf_usm_h(l)%rad_lw_out_change_0 )  .AND.          &
+                     surf_usm_h(l)%ns > 0  )  THEN
+             ALLOCATE( surf_usm_h(l)%rad_lw_out_change_0(1:surf_usm_h(l)%ns) )
+             surf_usm_h(l)%rad_lw_out_change_0 = 0.0_wp
+          ENDIF
+       ENDDO
        DO  l = 0, 3
           IF ( .NOT. ALLOCATED ( surf_lsm_v(l)%rad_lw_out_change_0 )  .AND.    &
@@ -1740,54 +1751,56 @@
 !
 !--    Allocate surface arrays for incoming/outgoing short/longwave radiation
-       IF ( .NOT. ALLOCATED ( surf_lsm_h%rad_sw_in )  .AND.                    &
-                  surf_lsm_h%ns > 0  )   THEN
-          ALLOCATE( surf_lsm_h%rad_sw_in(1:surf_lsm_h%ns)  )
-          ALLOCATE( surf_lsm_h%rad_sw_out(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_sw_dir(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_sw_dif(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_sw_ref(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_sw_res(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_lw_in(1:surf_lsm_h%ns)  )
-          ALLOCATE( surf_lsm_h%rad_lw_out(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_lw_dif(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_lw_ref(1:surf_lsm_h%ns) )
-          ALLOCATE( surf_lsm_h%rad_lw_res(1:surf_lsm_h%ns) )
-          surf_lsm_h%rad_sw_in  = 0.0_wp
-          surf_lsm_h%rad_sw_out = 0.0_wp
-          surf_lsm_h%rad_sw_dir = 0.0_wp
-          surf_lsm_h%rad_sw_dif = 0.0_wp
-          surf_lsm_h%rad_sw_ref = 0.0_wp
-          surf_lsm_h%rad_sw_res = 0.0_wp
-          surf_lsm_h%rad_lw_in  = 0.0_wp
-          surf_lsm_h%rad_lw_out = 0.0_wp
-          surf_lsm_h%rad_lw_dif = 0.0_wp
-          surf_lsm_h%rad_lw_ref = 0.0_wp
-          surf_lsm_h%rad_lw_res = 0.0_wp
-       ENDIF
-       IF ( .NOT. ALLOCATED ( surf_usm_h%rad_sw_in )  .AND.                    &
-                  surf_usm_h%ns > 0  )  THEN
-          ALLOCATE( surf_usm_h%rad_sw_in(1:surf_usm_h%ns)  )
-          ALLOCATE( surf_usm_h%rad_sw_out(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_sw_dir(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_sw_dif(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_sw_ref(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_sw_res(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_lw_in(1:surf_usm_h%ns)  )
-          ALLOCATE( surf_usm_h%rad_lw_out(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_lw_dif(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_lw_ref(1:surf_usm_h%ns) )
-          ALLOCATE( surf_usm_h%rad_lw_res(1:surf_usm_h%ns) )
-          surf_usm_h%rad_sw_in  = 0.0_wp
-          surf_usm_h%rad_sw_out = 0.0_wp
-          surf_usm_h%rad_sw_dir = 0.0_wp
-          surf_usm_h%rad_sw_dif = 0.0_wp
-          surf_usm_h%rad_sw_ref = 0.0_wp
-          surf_usm_h%rad_sw_res = 0.0_wp
-          surf_usm_h%rad_lw_in  = 0.0_wp
-          surf_usm_h%rad_lw_out = 0.0_wp
-          surf_usm_h%rad_lw_dif = 0.0_wp
-          surf_usm_h%rad_lw_ref = 0.0_wp
-          surf_usm_h%rad_lw_res = 0.0_wp
-       ENDIF
+       DO  l = 0, 1
+          IF ( .NOT. ALLOCATED ( surf_lsm_h(l)%rad_sw_in )  .AND.                    &
+                     surf_lsm_h(l)%ns > 0  )   THEN
+             ALLOCATE( surf_lsm_h(l)%rad_sw_in(1:surf_lsm_h(l)%ns)  )
+             ALLOCATE( surf_lsm_h(l)%rad_sw_out(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_sw_dir(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_sw_dif(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_sw_ref(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_sw_res(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_lw_in(1:surf_lsm_h(l)%ns)  )
+             ALLOCATE( surf_lsm_h(l)%rad_lw_out(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_lw_dif(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_lw_ref(1:surf_lsm_h(l)%ns) )
+             ALLOCATE( surf_lsm_h(l)%rad_lw_res(1:surf_lsm_h(l)%ns) )
+             surf_lsm_h(l)%rad_sw_in  = 0.0_wp
+             surf_lsm_h(l)%rad_sw_out = 0.0_wp
+             surf_lsm_h(l)%rad_sw_dir = 0.0_wp
+             surf_lsm_h(l)%rad_sw_dif = 0.0_wp
+             surf_lsm_h(l)%rad_sw_ref = 0.0_wp
+             surf_lsm_h(l)%rad_sw_res = 0.0_wp
+             surf_lsm_h(l)%rad_lw_in  = 0.0_wp
+             surf_lsm_h(l)%rad_lw_out = 0.0_wp
+             surf_lsm_h(l)%rad_lw_dif = 0.0_wp
+             surf_lsm_h(l)%rad_lw_ref = 0.0_wp
+             surf_lsm_h(l)%rad_lw_res = 0.0_wp
+          ENDIF
+          IF ( .NOT. ALLOCATED ( surf_usm_h(l)%rad_sw_in )  .AND.                    &
+                     surf_usm_h(l)%ns > 0  )  THEN
+             ALLOCATE( surf_usm_h(l)%rad_sw_in(1:surf_usm_h(l)%ns)  )
+             ALLOCATE( surf_usm_h(l)%rad_sw_out(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_sw_dir(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_sw_dif(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_sw_ref(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_sw_res(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_lw_in(1:surf_usm_h(l)%ns)  )
+             ALLOCATE( surf_usm_h(l)%rad_lw_out(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_lw_dif(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_lw_ref(1:surf_usm_h(l)%ns) )
+             ALLOCATE( surf_usm_h(l)%rad_lw_res(1:surf_usm_h(l)%ns) )
+             surf_usm_h(l)%rad_sw_in  = 0.0_wp
+             surf_usm_h(l)%rad_sw_out = 0.0_wp
+             surf_usm_h(l)%rad_sw_dir = 0.0_wp
+             surf_usm_h(l)%rad_sw_dif = 0.0_wp
+             surf_usm_h(l)%rad_sw_ref = 0.0_wp
+             surf_usm_h(l)%rad_sw_res = 0.0_wp
+             surf_usm_h(l)%rad_lw_in  = 0.0_wp
+             surf_usm_h(l)%rad_lw_out = 0.0_wp
+             surf_usm_h(l)%rad_lw_dif = 0.0_wp
+             surf_usm_h(l)%rad_lw_ref = 0.0_wp
+             surf_usm_h(l)%rad_lw_res = 0.0_wp
+          ENDIF
+       ENDDO
        DO  l = 0, 3
           IF ( .NOT. ALLOCATED ( surf_lsm_v(l)%rad_sw_in )  .AND.              &
@@ -1848,8 +1861,10 @@
 !--    Fix net radiation in case of radiation_scheme = 'constant'
        IF ( radiation_scheme == 'constant' )  THEN
-          IF ( ALLOCATED( surf_lsm_h%rad_net ) )                               &
-             surf_lsm_h%rad_net    = net_radiation
-          IF ( ALLOCATED( surf_usm_h%rad_net ) )                               &
-             surf_usm_h%rad_net    = net_radiation
+          DO  l = 0, 1
+             IF ( ALLOCATED( surf_lsm_h(l)%rad_net ) )                               &
+                surf_lsm_h(l)%rad_net    = net_radiation
+             IF ( ALLOCATED( surf_usm_h(l)%rad_net ) )                               &
+                surf_usm_h(l)%rad_net    = net_radiation
+          ENDDO
 !
 !--       Todo: weight with inclination angle
@@ -1912,13 +1927,14 @@
 !--       Allocate arrays for broadband albedo, and level 1 initialization
 !--       via namelist paramter, unless not already allocated.
-          IF ( .NOT. ALLOCATED(surf_lsm_h%albedo) )  THEN
-             ALLOCATE( surf_lsm_h%albedo(1:surf_lsm_h%ns,0:2)     )
-             surf_lsm_h%albedo    = albedo
-          ENDIF
-          IF ( .NOT. ALLOCATED(surf_usm_h%albedo) )  THEN
-             ALLOCATE( surf_usm_h%albedo(1:surf_usm_h%ns,0:2)     )
-             surf_usm_h%albedo    = albedo
-          ENDIF
-
+          DO  l = 0, 1
+             IF ( .NOT. ALLOCATED(surf_lsm_h(l)%albedo) )  THEN
+                ALLOCATE( surf_lsm_h(l)%albedo(1:surf_lsm_h(l)%ns,0:2)     )
+                surf_lsm_h(l)%albedo    = albedo
+             ENDIF
+             IF ( .NOT. ALLOCATED(surf_usm_h(l)%albedo) )  THEN
+                ALLOCATE( surf_usm_h(l)%albedo(1:surf_usm_h(l)%ns,0:2)     )
+                surf_usm_h(l)%albedo    = albedo
+             ENDIF
+          ENDDO
           DO  l = 0, 3
              IF ( .NOT. ALLOCATED( surf_lsm_v(l)%albedo ) )  THEN
@@ -1936,27 +1952,28 @@
 !--       input data is read from ASCII file, albedo_type will be zero, so that
 !--       albedo won't be overwritten.
-          DO  m = 1, surf_lsm_h%ns
-             IF ( surf_lsm_h%albedo_type(m,ind_veg_wall) /= 0 )                &
-                surf_lsm_h%albedo(m,ind_veg_wall) =                            &
-                           albedo_pars(0,surf_lsm_h%albedo_type(m,ind_veg_wall))
-             IF ( surf_lsm_h%albedo_type(m,ind_pav_green) /= 0 )               &
-                surf_lsm_h%albedo(m,ind_pav_green) =                           &
-                           albedo_pars(0,surf_lsm_h%albedo_type(m,ind_pav_green))
-             IF ( surf_lsm_h%albedo_type(m,ind_wat_win) /= 0 )                 &
-                surf_lsm_h%albedo(m,ind_wat_win) =                             &
-                           albedo_pars(0,surf_lsm_h%albedo_type(m,ind_wat_win))
+          DO  l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                IF ( surf_lsm_h(l)%albedo_type(m,ind_veg_wall) /= 0 )                &
+                   surf_lsm_h(l)%albedo(m,ind_veg_wall) =                            &
+                              albedo_pars(0,surf_lsm_h(l)%albedo_type(m,ind_veg_wall))
+                IF ( surf_lsm_h(l)%albedo_type(m,ind_pav_green) /= 0 )               &
+                   surf_lsm_h(l)%albedo(m,ind_pav_green) =                           &
+                              albedo_pars(0,surf_lsm_h(l)%albedo_type(m,ind_pav_green))
+                IF ( surf_lsm_h(l)%albedo_type(m,ind_wat_win) /= 0 )                 &
+                   surf_lsm_h(l)%albedo(m,ind_wat_win) =                             &
+                              albedo_pars(0,surf_lsm_h(l)%albedo_type(m,ind_wat_win))
+             ENDDO
+             DO  m = 1, surf_usm_h(l)%ns
+                IF ( surf_usm_h(l)%albedo_type(m,ind_veg_wall) /= 0 )                &
+                   surf_usm_h(l)%albedo(m,ind_veg_wall) =                            &
+                              albedo_pars(0,surf_usm_h(l)%albedo_type(m,ind_veg_wall))
+                IF ( surf_usm_h(l)%albedo_type(m,ind_pav_green) /= 0 )               &
+                   surf_usm_h(l)%albedo(m,ind_pav_green) =                           &
+                              albedo_pars(0,surf_usm_h(l)%albedo_type(m,ind_pav_green))
+                IF ( surf_usm_h(l)%albedo_type(m,ind_wat_win) /= 0 )                 &
+                   surf_usm_h(l)%albedo(m,ind_wat_win) =                             &
+                              albedo_pars(0,surf_usm_h(l)%albedo_type(m,ind_wat_win))
+             ENDDO
           ENDDO
-          DO  m = 1, surf_usm_h%ns
-             IF ( surf_usm_h%albedo_type(m,ind_veg_wall) /= 0 )                &
-                surf_usm_h%albedo(m,ind_veg_wall) =                            &
-                           albedo_pars(0,surf_usm_h%albedo_type(m,ind_veg_wall))
-             IF ( surf_usm_h%albedo_type(m,ind_pav_green) /= 0 )               &
-                surf_usm_h%albedo(m,ind_pav_green) =                           &
-                           albedo_pars(0,surf_usm_h%albedo_type(m,ind_pav_green))
-             IF ( surf_usm_h%albedo_type(m,ind_wat_win) /= 0 )                 &
-                surf_usm_h%albedo(m,ind_wat_win) =                             &
-                           albedo_pars(0,surf_usm_h%albedo_type(m,ind_wat_win))
-          ENDDO
-
           DO  l = 0, 3
              DO  m = 1, surf_lsm_v(l)%ns
@@ -1991,21 +2008,23 @@
 !
 !--          Horizontal surfaces
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-                IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                   surf_lsm_h%albedo(m,ind_veg_wall)  = albedo_pars_f%pars_xy(0,j,i)
-                   surf_lsm_h%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
-                   surf_lsm_h%albedo(m,ind_wat_win)   = albedo_pars_f%pars_xy(0,j,i)
-                ENDIF
-             ENDDO
-             DO  m = 1, surf_usm_h%ns
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                   surf_usm_h%albedo(m,ind_veg_wall)  = albedo_pars_f%pars_xy(0,j,i)
-                   surf_usm_h%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
-                   surf_usm_h%albedo(m,ind_wat_win)   = albedo_pars_f%pars_xy(0,j,i)
-                ENDIF
+             DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+                   IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
+                      surf_lsm_h(l)%albedo(m,ind_veg_wall)  = albedo_pars_f%pars_xy(0,j,i)
+                      surf_lsm_h(l)%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_lsm_h(l)%albedo(m,ind_wat_win)   = albedo_pars_f%pars_xy(0,j,i)
+                   ENDIF
+                ENDDO
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
+                      surf_usm_h(l)%albedo(m,ind_veg_wall)  = albedo_pars_f%pars_xy(0,j,i)
+                      surf_usm_h(l)%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_usm_h(l)%albedo(m,ind_wat_win)   = albedo_pars_f%pars_xy(0,j,i)
+                   ENDIF
+                ENDDO
              ENDDO
 !
@@ -2044,38 +2063,40 @@
 !--       to zero in order to take effect.
           IF ( building_surface_pars_f%from_file )  THEN
-             DO  m = 1, surf_usm_h%ns
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                k = surf_usm_h%k(m)
-!
-!--             Iterate over surfaces in column, check height and orientation
-                DO  is = building_surface_pars_f%index_ji(1,j,i), &
-                         building_surface_pars_f%index_ji(2,j,i)
-                   IF ( building_surface_pars_f%coords(4,is) == -surf_usm_h%koff .AND. &
-                        building_surface_pars_f%coords(1,is) == k )  THEN
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=      &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(m,ind_veg_wall) =                         &
-                                  building_surface_pars_f%pars(ind_s_alb_b_wall,is)
-                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
+             DO l = 0, 1
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+!
+!--                Iterate over surfaces in column, check height and orientation
+                   DO  is = building_surface_pars_f%index_ji(1,j,i), &
+                            building_surface_pars_f%index_ji(2,j,i)
+                      IF ( building_surface_pars_f%coords(4,is) == -surf_usm_h(l)%koff .AND. &
+                           building_surface_pars_f%coords(1,is) == k )  THEN
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=           &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%albedo(m,ind_veg_wall) =                           &
+                                     building_surface_pars_f%pars(ind_s_alb_b_wall,is)
+                            surf_usm_h(l)%albedo_type(m,ind_veg_wall) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=            &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%albedo(m,ind_wat_win) =                            &
+                                     building_surface_pars_f%pars(ind_s_alb_b_win,is)
+                            surf_usm_h(l)%albedo_type(m,ind_wat_win) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=          &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%albedo(m,ind_pav_green) =                          &
+                                     building_surface_pars_f%pars(ind_s_alb_b_green,is)
+                            surf_usm_h(l)%albedo_type(m,ind_pav_green) = 0
+                         ENDIF
+
+                         EXIT ! surface was found and processed
                       ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=       &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(m,ind_wat_win) =                          &
-                                  building_surface_pars_f%pars(ind_s_alb_b_win,is)
-                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=     &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(m,ind_pav_green) =                        &
-                                  building_surface_pars_f%pars(ind_s_alb_b_green,is)
-                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
-                      ENDIF
-
-                      EXIT ! surface was found and processed
-                   ENDIF
+                   ENDDO
                 ENDDO
              ENDDO
@@ -2129,30 +2150,31 @@
 !--       for wall/green/window (USM) or vegetation/pavement/water surfaces
 !--       (LSM).
-          ALLOCATE ( surf_lsm_h%aldif(1:surf_lsm_h%ns,0:2)       )
-          ALLOCATE ( surf_lsm_h%aldir(1:surf_lsm_h%ns,0:2)       )
-          ALLOCATE ( surf_lsm_h%asdif(1:surf_lsm_h%ns,0:2)       )
-          ALLOCATE ( surf_lsm_h%asdir(1:surf_lsm_h%ns,0:2)       )
-          ALLOCATE ( surf_lsm_h%rrtm_aldif(1:surf_lsm_h%ns,0:2)  )
-          ALLOCATE ( surf_lsm_h%rrtm_aldir(1:surf_lsm_h%ns,0:2)  )
-          ALLOCATE ( surf_lsm_h%rrtm_asdif(1:surf_lsm_h%ns,0:2)  )
-          ALLOCATE ( surf_lsm_h%rrtm_asdir(1:surf_lsm_h%ns,0:2)  )
-
-          ALLOCATE ( surf_usm_h%aldif(1:surf_usm_h%ns,0:2)       )
-          ALLOCATE ( surf_usm_h%aldir(1:surf_usm_h%ns,0:2)       )
-          ALLOCATE ( surf_usm_h%asdif(1:surf_usm_h%ns,0:2)       )
-          ALLOCATE ( surf_usm_h%asdir(1:surf_usm_h%ns,0:2)       )
-          ALLOCATE ( surf_usm_h%rrtm_aldif(1:surf_usm_h%ns,0:2)  )
-          ALLOCATE ( surf_usm_h%rrtm_aldir(1:surf_usm_h%ns,0:2)  )
-          ALLOCATE ( surf_usm_h%rrtm_asdif(1:surf_usm_h%ns,0:2)  )
-          ALLOCATE ( surf_usm_h%rrtm_asdir(1:surf_usm_h%ns,0:2)  )
-
-!
-!--       Allocate broadband albedo (temporary for the current radiation
-!--       implementations)
-          IF ( .NOT. ALLOCATED(surf_lsm_h%albedo) )                            &
-             ALLOCATE( surf_lsm_h%albedo(1:surf_lsm_h%ns,0:2)     )
-          IF ( .NOT. ALLOCATED(surf_usm_h%albedo) )                            &
-             ALLOCATE( surf_usm_h%albedo(1:surf_usm_h%ns,0:2)     )
-
+          DO  l = 0, 1
+             ALLOCATE ( surf_lsm_h(l)%aldif(1:surf_lsm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_lsm_h(l)%aldir(1:surf_lsm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_lsm_h(l)%asdif(1:surf_lsm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_lsm_h(l)%asdir(1:surf_lsm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_lsm_h(l)%rrtm_aldif(1:surf_lsm_h(l)%ns,0:2)  )
+             ALLOCATE ( surf_lsm_h(l)%rrtm_aldir(1:surf_lsm_h(l)%ns,0:2)  )
+             ALLOCATE ( surf_lsm_h(l)%rrtm_asdif(1:surf_lsm_h(l)%ns,0:2)  )
+             ALLOCATE ( surf_lsm_h(l)%rrtm_asdir(1:surf_lsm_h(l)%ns,0:2)  )
+
+             ALLOCATE ( surf_usm_h(l)%aldif(1:surf_usm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_usm_h(l)%aldir(1:surf_usm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_usm_h(l)%asdif(1:surf_usm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_usm_h(l)%asdir(1:surf_usm_h(l)%ns,0:2)       )
+             ALLOCATE ( surf_usm_h(l)%rrtm_aldif(1:surf_usm_h(l)%ns,0:2)  )
+             ALLOCATE ( surf_usm_h(l)%rrtm_aldir(1:surf_usm_h(l)%ns,0:2)  )
+             ALLOCATE ( surf_usm_h(l)%rrtm_asdif(1:surf_usm_h(l)%ns,0:2)  )
+             ALLOCATE ( surf_usm_h(l)%rrtm_asdir(1:surf_usm_h(l)%ns,0:2)  )
+
+!
+!--          Allocate broadband albedo (temporary for the current radiation
+!--          implementations)
+             IF ( .NOT. ALLOCATED(surf_lsm_h(l)%albedo) )                            &
+                ALLOCATE( surf_lsm_h(l)%albedo(1:surf_lsm_h(l)%ns,0:2)     )
+             IF ( .NOT. ALLOCATED(surf_usm_h(l)%albedo) )                            &
+                ALLOCATE( surf_usm_h(l)%albedo(1:surf_usm_h(l)%ns,0:2)     )
+          ENDDO
 !
 !--       Allocate albedos for short/longwave radiation, vertical surfaces
@@ -2191,26 +2213,27 @@
 !--       paramters. Please note, this case all surface tiles are initialized
 !--       the same.
-          IF ( surf_lsm_h%ns > 0 )  THEN
-             surf_lsm_h%aldif  = albedo_lw_dif
-             surf_lsm_h%aldir  = albedo_lw_dir
-             surf_lsm_h%asdif  = albedo_sw_dif
-             surf_lsm_h%asdir  = albedo_sw_dir
-             surf_lsm_h%albedo = albedo_sw_dif
-          ENDIF
-          IF ( surf_usm_h%ns > 0 )  THEN
-             IF ( surf_usm_h%albedo_from_ascii )  THEN
-                surf_usm_h%aldif  = surf_usm_h%albedo
-                surf_usm_h%aldir  = surf_usm_h%albedo
-                surf_usm_h%asdif  = surf_usm_h%albedo
-                surf_usm_h%asdir  = surf_usm_h%albedo
-             ELSE
-                surf_usm_h%aldif  = albedo_lw_dif
-                surf_usm_h%aldir  = albedo_lw_dir
-                surf_usm_h%asdif  = albedo_sw_dif
-                surf_usm_h%asdir  = albedo_sw_dir
-                surf_usm_h%albedo = albedo_sw_dif
+          DO  l = 0, 1
+             IF ( surf_lsm_h(l)%ns > 0 )  THEN
+                surf_lsm_h(l)%aldif  = albedo_lw_dif
+                surf_lsm_h(l)%aldir  = albedo_lw_dir
+                surf_lsm_h(l)%asdif  = albedo_sw_dif
+                surf_lsm_h(l)%asdir  = albedo_sw_dir
+                surf_lsm_h(l)%albedo = albedo_sw_dif
              ENDIF
-          ENDIF
-
+             IF ( surf_usm_h(l)%ns > 0 )  THEN
+                IF ( surf_usm_h(l)%albedo_from_ascii )  THEN
+                   surf_usm_h(l)%aldif  = surf_usm_h(l)%albedo
+                   surf_usm_h(l)%aldir  = surf_usm_h(l)%albedo
+                   surf_usm_h(l)%asdif  = surf_usm_h(l)%albedo
+                   surf_usm_h(l)%asdir  = surf_usm_h(l)%albedo
+                ELSE
+                   surf_usm_h(l)%aldif  = albedo_lw_dif
+                   surf_usm_h(l)%aldir  = albedo_lw_dir
+                   surf_usm_h(l)%asdif  = albedo_sw_dif
+                   surf_usm_h(l)%asdir  = albedo_sw_dir
+                   surf_usm_h(l)%albedo = albedo_sw_dif
+                ENDIF
+             ENDIF
+          ENDDO
           DO  l = 0, 3
 
@@ -2243,50 +2266,50 @@
 !--       is applied so that the resulting albedo is calculated via the weighted
 !--       average of respective surface fractions.
-          DO  m = 1, surf_lsm_h%ns
-!
-!--          Spectral albedos for vegetation/pavement/water surfaces
-             DO  ind_type = 0, 2
-                IF ( surf_lsm_h%albedo_type(m,ind_type) /= 0 )  THEN
-                   surf_lsm_h%aldif(m,ind_type) =                              &
-                               albedo_pars(1,surf_lsm_h%albedo_type(m,ind_type))
-                   surf_lsm_h%asdif(m,ind_type) =                              &
-                               albedo_pars(2,surf_lsm_h%albedo_type(m,ind_type))
-                   surf_lsm_h%aldir(m,ind_type) =                              &
-                               albedo_pars(1,surf_lsm_h%albedo_type(m,ind_type))
-                   surf_lsm_h%asdir(m,ind_type) =                              &
-                               albedo_pars(2,surf_lsm_h%albedo_type(m,ind_type))
-                   surf_lsm_h%albedo(m,ind_type) =                             &
-                               albedo_pars(0,surf_lsm_h%albedo_type(m,ind_type))
-                ENDIF
-             ENDDO
-
-          ENDDO
-!
-!--       For urban surface only if albedo has not been already initialized
-!--       in the urban-surface model via the ASCII file.
-          IF ( .NOT. surf_usm_h%albedo_from_ascii )  THEN
-             DO  m = 1, surf_usm_h%ns
-!
-!--             Spectral albedos for wall/green/window surfaces
+          DO l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+!
+!--             Spectral albedos for vegetation/pavement/water surfaces
                 DO  ind_type = 0, 2
-                   IF ( surf_usm_h%albedo_type(m,ind_type) /= 0 )  THEN
-                      surf_usm_h%aldif(m,ind_type) =                           &
-                               albedo_pars(1,surf_usm_h%albedo_type(m,ind_type))
-                      surf_usm_h%asdif(m,ind_type) =                           &
-                               albedo_pars(2,surf_usm_h%albedo_type(m,ind_type))
-                      surf_usm_h%aldir(m,ind_type) =                           &
-                               albedo_pars(1,surf_usm_h%albedo_type(m,ind_type))
-                      surf_usm_h%asdir(m,ind_type) =                           &
-                               albedo_pars(2,surf_usm_h%albedo_type(m,ind_type))
-                      surf_usm_h%albedo(m,ind_type) =                          &
-                               albedo_pars(0,surf_usm_h%albedo_type(m,ind_type))
+                   IF ( surf_lsm_h(l)%albedo_type(m,ind_type) /= 0 )  THEN
+                      surf_lsm_h(l)%aldif(m,ind_type) =                              &
+                                  albedo_pars(1,surf_lsm_h(l)%albedo_type(m,ind_type))
+                      surf_lsm_h(l)%asdif(m,ind_type) =                              &
+                                  albedo_pars(2,surf_lsm_h(l)%albedo_type(m,ind_type))
+                      surf_lsm_h(l)%aldir(m,ind_type) =                              &
+                                  albedo_pars(1,surf_lsm_h(l)%albedo_type(m,ind_type))
+                      surf_lsm_h(l)%asdir(m,ind_type) =                              &
+                                  albedo_pars(2,surf_lsm_h(l)%albedo_type(m,ind_type))
+                      surf_lsm_h(l)%albedo(m,ind_type) =                             &
+                                  albedo_pars(0,surf_lsm_h(l)%albedo_type(m,ind_type))
                    ENDIF
                 ENDDO
 
              ENDDO
-          ENDIF
+!
+!--          For urban surface only if albedo has not been already initialized
+!--          in the urban-surface model via the ASCII file.
+             IF ( .NOT. surf_usm_h(l)%albedo_from_ascii )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+!
+!--                Spectral albedos for wall/green/window surfaces
+                   DO  ind_type = 0, 2
+                      IF ( surf_usm_h(l)%albedo_type(m,ind_type) /= 0 )  THEN
+                         surf_usm_h(l)%aldif(m,ind_type) =                           &
+                                  albedo_pars(1,surf_usm_h(l)%albedo_type(m,ind_type))
+                         surf_usm_h(l)%asdif(m,ind_type) =                           &
+                                  albedo_pars(2,surf_usm_h(l)%albedo_type(m,ind_type))
+                         surf_usm_h(l)%aldir(m,ind_type) =                           &
+                                  albedo_pars(1,surf_usm_h(l)%albedo_type(m,ind_type))
+                         surf_usm_h(l)%asdir(m,ind_type) =                           &
+                                  albedo_pars(2,surf_usm_h(l)%albedo_type(m,ind_type))
+                         surf_usm_h(l)%albedo(m,ind_type) =                          &
+                                  albedo_pars(0,surf_usm_h(l)%albedo_type(m,ind_type))
+                      ENDIF
+                   ENDDO
+                ENDDO
+             ENDIF
+          ENDDO
 
           DO l = 0, 3
-
              DO  m = 1, surf_lsm_v(l)%ns
 !
@@ -2338,86 +2361,88 @@
 !
 !--          Horizontal
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-!
-!--             Spectral albedos for vegetation/pavement/water surfaces
-                DO  ind_type = 0, 2
-                   IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%albedo(m,ind_type) =                          &
-                                             albedo_pars_f%pars_xy(0,j,i)
-                   IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%aldir(m,ind_type) =                           &
-                                             albedo_pars_f%pars_xy(1,j,i)
-                   IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%aldif(m,ind_type) =                           &
-                                             albedo_pars_f%pars_xy(1,j,i)
-                   IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%asdir(m,ind_type) =                           &
-                                             albedo_pars_f%pars_xy(2,j,i)
-                   IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%asdif(m,ind_type) =                           &
-                                             albedo_pars_f%pars_xy(2,j,i)
+             DO l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+   !
+   !--             Spectral albedos for vegetation/pavement/water surfaces
+                   DO  ind_type = 0, 2
+                      IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )   &
+                         surf_lsm_h(l)%albedo(m,ind_type) =                          &
+                                                albedo_pars_f%pars_xy(0,j,i)
+                      IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )   &
+                         surf_lsm_h(l)%aldir(m,ind_type) =                           &
+                                                albedo_pars_f%pars_xy(1,j,i)
+                      IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )   &
+                         surf_lsm_h(l)%aldif(m,ind_type) =                           &
+                                                albedo_pars_f%pars_xy(1,j,i)
+                      IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )   &
+                         surf_lsm_h(l)%asdir(m,ind_type) =                           &
+                                                albedo_pars_f%pars_xy(2,j,i)
+                      IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )   &
+                         surf_lsm_h(l)%asdif(m,ind_type) =                           &
+                                                albedo_pars_f%pars_xy(2,j,i)
+                   ENDDO
                 ENDDO
+!
+!--             For urban surface only if albedo has not been already initialized
+!--             in the urban-surface model via the ASCII file.
+                IF ( .NOT. surf_usm_h(l)%albedo_from_ascii )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      i = surf_usm_h(l)%i(m)
+                      j = surf_usm_h(l)%j(m)
+!
+!--                   Broadband albedos for wall/green/window surfaces
+                      DO  ind_type = 0, 2
+                         IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )&
+                            surf_usm_h(l)%albedo(m,ind_type) =                       &
+                                                albedo_pars_f%pars_xy(0,j,i)
+                      ENDDO
+!
+!--                   Spectral albedos especially for building wall surfaces
+                      IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )  THEN
+                         surf_usm_h(l)%aldir(m,ind_veg_wall) =                       &
+                                                   albedo_pars_f%pars_xy(1,j,i)
+                         surf_usm_h(l)%aldif(m,ind_veg_wall) =                       &
+                                                   albedo_pars_f%pars_xy(1,j,i)
+                      ENDIF
+                      IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )  THEN
+                         surf_usm_h(l)%asdir(m,ind_veg_wall) =                       &
+                                                   albedo_pars_f%pars_xy(2,j,i)
+                         surf_usm_h(l)%asdif(m,ind_veg_wall) =                       &
+                                                   albedo_pars_f%pars_xy(2,j,i)
+                      ENDIF
+!
+!--                   Spectral albedos especially for building green surfaces
+                      IF ( albedo_pars_f%pars_xy(3,j,i) /= albedo_pars_f%fill )  THEN
+                         surf_usm_h(l)%aldir(m,ind_pav_green) =                      &
+                                                   albedo_pars_f%pars_xy(3,j,i)
+                         surf_usm_h(l)%aldif(m,ind_pav_green) =                      &
+                                                   albedo_pars_f%pars_xy(3,j,i)
+                      ENDIF
+                      IF ( albedo_pars_f%pars_xy(4,j,i) /= albedo_pars_f%fill )  THEN
+                         surf_usm_h(l)%asdir(m,ind_pav_green) =                      &
+                                                   albedo_pars_f%pars_xy(4,j,i)
+                         surf_usm_h(l)%asdif(m,ind_pav_green) =                      &
+                                                   albedo_pars_f%pars_xy(4,j,i)
+                      ENDIF
+!
+!--                   Spectral albedos especially for building window surfaces
+                      IF ( albedo_pars_f%pars_xy(5,j,i) /= albedo_pars_f%fill )  THEN
+                         surf_usm_h(l)%aldir(m,ind_wat_win) =                        &
+                                                   albedo_pars_f%pars_xy(5,j,i)
+                         surf_usm_h(l)%aldif(m,ind_wat_win) =                        &
+                                                   albedo_pars_f%pars_xy(5,j,i)
+                      ENDIF
+                      IF ( albedo_pars_f%pars_xy(6,j,i) /= albedo_pars_f%fill )  THEN
+                         surf_usm_h(l)%asdir(m,ind_wat_win) =                        &
+                                                   albedo_pars_f%pars_xy(6,j,i)
+                         surf_usm_h(l)%asdif(m,ind_wat_win) =                        &
+                                                   albedo_pars_f%pars_xy(6,j,i)
+                      ENDIF
+
+                   ENDDO
+                ENDIF
              ENDDO
-!
-!--          For urban surface only if albedo has not been already initialized
-!--          in the urban-surface model via the ASCII file.
-             IF ( .NOT. surf_usm_h%albedo_from_ascii )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-!
-!--                Broadband albedos for wall/green/window surfaces
-                   DO  ind_type = 0, 2
-                      IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )&
-                         surf_usm_h%albedo(m,ind_type) =                       &
-                                             albedo_pars_f%pars_xy(0,j,i)
-                   ENDDO
-!
-!--                Spectral albedos especially for building wall surfaces
-                   IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%aldir(m,ind_veg_wall) =                       &
-                                                albedo_pars_f%pars_xy(1,j,i)
-                      surf_usm_h%aldif(m,ind_veg_wall) =                       &
-                                                albedo_pars_f%pars_xy(1,j,i)
-                   ENDIF
-                   IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%asdir(m,ind_veg_wall) =                       &
-                                                albedo_pars_f%pars_xy(2,j,i)
-                      surf_usm_h%asdif(m,ind_veg_wall) =                       &
-                                                albedo_pars_f%pars_xy(2,j,i)
-                   ENDIF
-!
-!--                Spectral albedos especially for building green surfaces
-                   IF ( albedo_pars_f%pars_xy(3,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%aldir(m,ind_pav_green) =                      &
-                                                albedo_pars_f%pars_xy(3,j,i)
-                      surf_usm_h%aldif(m,ind_pav_green) =                      &
-                                                albedo_pars_f%pars_xy(3,j,i)
-                   ENDIF
-                   IF ( albedo_pars_f%pars_xy(4,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%asdir(m,ind_pav_green) =                      &
-                                                albedo_pars_f%pars_xy(4,j,i)
-                      surf_usm_h%asdif(m,ind_pav_green) =                      &
-                                                albedo_pars_f%pars_xy(4,j,i)
-                   ENDIF
-!
-!--                Spectral albedos especially for building window surfaces
-                   IF ( albedo_pars_f%pars_xy(5,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%aldir(m,ind_wat_win) =                        &
-                                                albedo_pars_f%pars_xy(5,j,i)
-                      surf_usm_h%aldif(m,ind_wat_win) =                        &
-                                                albedo_pars_f%pars_xy(5,j,i)
-                   ENDIF
-                   IF ( albedo_pars_f%pars_xy(6,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%asdir(m,ind_wat_win) =                        &
-                                                albedo_pars_f%pars_xy(6,j,i)
-                      surf_usm_h%asdif(m,ind_wat_win) =                        &
-                                                albedo_pars_f%pars_xy(6,j,i)
-                   ENDIF
-
-                ENDDO
-             ENDIF
 !
 !--          Vertical
@@ -2530,95 +2555,96 @@
 !--       to zero in order to take effect.
           IF ( building_surface_pars_f%from_file )  THEN
-             DO  m = 1, surf_usm_h%ns
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                k = surf_usm_h%k(m)
-!
-!--             Iterate over surfaces in column, check height and orientation
-                DO  is = building_surface_pars_f%index_ji(1,j,i), &
-                         building_surface_pars_f%index_ji(2,j,i)
-                   IF ( building_surface_pars_f%coords(4,is) == -surf_usm_h%koff .AND. &
-                        building_surface_pars_f%coords(1,is) == k )  THEN
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=      &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(m,ind_veg_wall) =                         &
-                                  building_surface_pars_f%pars(ind_s_alb_b_wall,is)
-                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
+             DO l = 0, 1
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+   !
+   !--             Iterate over surfaces in column, check height and orientation
+                   DO  is = building_surface_pars_f%index_ji(1,j,i), &
+                            building_surface_pars_f%index_ji(2,j,i)
+                      IF ( building_surface_pars_f%coords(4,is) == -surf_usm_h(l)%koff .AND. &
+                           building_surface_pars_f%coords(1,is) == k )  THEN
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=      &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%albedo(m,ind_veg_wall) =                         &
+                                     building_surface_pars_f%pars(ind_s_alb_b_wall,is)
+                            surf_usm_h(l)%albedo_type(m,ind_veg_wall) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_l_wall,is) /=      &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%aldir(m,ind_veg_wall) =                          &
+                                     building_surface_pars_f%pars(ind_s_alb_l_wall,is)
+                            surf_usm_h(l)%aldif(m,ind_veg_wall) =                          &
+                                     building_surface_pars_f%pars(ind_s_alb_l_wall,is)
+                            surf_usm_h(l)%albedo_type(m,ind_veg_wall) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_s_wall,is) /=      &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%asdir(m,ind_veg_wall) =                          &
+                                     building_surface_pars_f%pars(ind_s_alb_s_wall,is)
+                            surf_usm_h(l)%asdif(m,ind_veg_wall) =                          &
+                                     building_surface_pars_f%pars(ind_s_alb_s_wall,is)
+                            surf_usm_h(l)%albedo_type(m,ind_veg_wall) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=       &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%albedo(m,ind_wat_win) =                          &
+                                     building_surface_pars_f%pars(ind_s_alb_b_win,is)
+                            surf_usm_h(l)%albedo_type(m,ind_wat_win) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_l_win,is) /=       &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%aldir(m,ind_wat_win) =                           &
+                                     building_surface_pars_f%pars(ind_s_alb_l_win,is)
+                            surf_usm_h(l)%aldif(m,ind_wat_win) =                           &
+                                     building_surface_pars_f%pars(ind_s_alb_l_win,is)
+                            surf_usm_h(l)%albedo_type(m,ind_wat_win) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_s_win,is) /=       &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%asdir(m,ind_wat_win) =                           &
+                                     building_surface_pars_f%pars(ind_s_alb_s_win,is)
+                            surf_usm_h(l)%asdif(m,ind_wat_win) =                           &
+                                     building_surface_pars_f%pars(ind_s_alb_s_win,is)
+                            surf_usm_h(l)%albedo_type(m,ind_wat_win) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=     &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%albedo(m,ind_pav_green) =                        &
+                                     building_surface_pars_f%pars(ind_s_alb_b_green,is)
+                            surf_usm_h(l)%albedo_type(m,ind_pav_green) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_l_green,is) /=     &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%aldir(m,ind_pav_green) =                         &
+                                     building_surface_pars_f%pars(ind_s_alb_l_green,is)
+                            surf_usm_h(l)%aldif(m,ind_pav_green) =                         &
+                                     building_surface_pars_f%pars(ind_s_alb_l_green,is)
+                            surf_usm_h(l)%albedo_type(m,ind_pav_green) = 0
+                         ENDIF
+
+                         IF ( building_surface_pars_f%pars(ind_s_alb_s_green,is) /=     &
+                              building_surface_pars_f%fill )  THEN
+                            surf_usm_h(l)%asdir(m,ind_pav_green) =                         &
+                                     building_surface_pars_f%pars(ind_s_alb_s_green,is)
+                            surf_usm_h(l)%asdif(m,ind_pav_green) =                         &
+                                     building_surface_pars_f%pars(ind_s_alb_s_green,is)
+                            surf_usm_h(l)%albedo_type(m,ind_pav_green) = 0
+                         ENDIF
+
+                         EXIT ! surface was found and processed
                       ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_l_wall,is) /=      &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%aldir(m,ind_veg_wall) =                          &
-                                  building_surface_pars_f%pars(ind_s_alb_l_wall,is)
-                         surf_usm_h%aldif(m,ind_veg_wall) =                          &
-                                  building_surface_pars_f%pars(ind_s_alb_l_wall,is)
-                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_s_wall,is) /=      &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%asdir(m,ind_veg_wall) =                          &
-                                  building_surface_pars_f%pars(ind_s_alb_s_wall,is)
-                         surf_usm_h%asdif(m,ind_veg_wall) =                          &
-                                  building_surface_pars_f%pars(ind_s_alb_s_wall,is)
-                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=       &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(m,ind_wat_win) =                          &
-                                  building_surface_pars_f%pars(ind_s_alb_b_win,is)
-                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_l_win,is) /=       &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%aldir(m,ind_wat_win) =                           &
-                                  building_surface_pars_f%pars(ind_s_alb_l_win,is)
-                         surf_usm_h%aldif(m,ind_wat_win) =                           &
-                                  building_surface_pars_f%pars(ind_s_alb_l_win,is)
-                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_s_win,is) /=       &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%asdir(m,ind_wat_win) =                           &
-                                  building_surface_pars_f%pars(ind_s_alb_s_win,is)
-                         surf_usm_h%asdif(m,ind_wat_win) =                           &
-                                  building_surface_pars_f%pars(ind_s_alb_s_win,is)
-                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=     &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(m,ind_pav_green) =                        &
-                                  building_surface_pars_f%pars(ind_s_alb_b_green,is)
-                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_l_green,is) /=     &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%aldir(m,ind_pav_green) =                         &
-                                  building_surface_pars_f%pars(ind_s_alb_l_green,is)
-                         surf_usm_h%aldif(m,ind_pav_green) =                         &
-                                  building_surface_pars_f%pars(ind_s_alb_l_green,is)
-                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
-                      ENDIF
-
-                      IF ( building_surface_pars_f%pars(ind_s_alb_s_green,is) /=     &
-                           building_surface_pars_f%fill )  THEN
-                         surf_usm_h%asdir(m,ind_pav_green) =                         &
-                                  building_surface_pars_f%pars(ind_s_alb_s_green,is)
-                         surf_usm_h%asdif(m,ind_pav_green) =                         &
-                                  building_surface_pars_f%pars(ind_s_alb_s_green,is)
-                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
-                      ENDIF
-
-                      EXIT ! surface was found and processed
-                   ENDIF
+                   ENDDO
                 ENDDO
              ENDDO
-
              DO  l = 0, 3
                 DO  m = 1, surf_usm_v(l)%ns
@@ -2729,6 +2755,8 @@
 !
 !--          Horizontally aligned natural and urban surfaces
-             CALL calc_albedo( surf_lsm_h )
-             CALL calc_albedo( surf_usm_h )
+             DO l = 0, 1
+                CALL calc_albedo( surf_lsm_h(l) )
+                CALL calc_albedo( surf_usm_h(l) )
+             ENDDO
 !
 !--          Vertically aligned natural and urban surfaces
@@ -2742,16 +2770,18 @@
 !--          Initialize sun-inclination independent spectral albedos
 !--          Horizontal surfaces
-             IF ( surf_lsm_h%ns > 0 )  THEN
-                surf_lsm_h%rrtm_aldir = surf_lsm_h%aldir
-                surf_lsm_h%rrtm_asdir = surf_lsm_h%asdir
-                surf_lsm_h%rrtm_aldif = surf_lsm_h%aldif
-                surf_lsm_h%rrtm_asdif = surf_lsm_h%asdif
-             ENDIF
-             IF ( surf_usm_h%ns > 0 )  THEN
-                surf_usm_h%rrtm_aldir = surf_usm_h%aldir
-                surf_usm_h%rrtm_asdir = surf_usm_h%asdir
-                surf_usm_h%rrtm_aldif = surf_usm_h%aldif
-                surf_usm_h%rrtm_asdif = surf_usm_h%asdif
-             ENDIF
+             DO  l = 0, 1
+                IF ( surf_lsm_h(l)%ns > 0 )  THEN
+                   surf_lsm_h(l)%rrtm_aldir = surf_lsm_h(l)%aldir
+                   surf_lsm_h(l)%rrtm_asdir = surf_lsm_h(l)%asdir
+                   surf_lsm_h(l)%rrtm_aldif = surf_lsm_h(l)%aldif
+                   surf_lsm_h(l)%rrtm_asdif = surf_lsm_h(l)%asdif
+                ENDIF
+                IF ( surf_usm_h(l)%ns > 0 )  THEN
+                   surf_usm_h(l)%rrtm_aldir = surf_usm_h(l)%aldir
+                   surf_usm_h(l)%rrtm_asdir = surf_usm_h(l)%asdir
+                   surf_usm_h(l)%rrtm_aldif = surf_usm_h(l)%aldif
+                   surf_usm_h(l)%rrtm_asdif = surf_usm_h(l)%asdif
+                ENDIF
+             ENDDO
 !
 !--          Vertical surfaces
@@ -3287,8 +3317,10 @@
 !--    First, horizontal surfaces
        horizontal = .TRUE.
-       surf => surf_lsm_h
-       CALL radiation_external_surf
-       surf => surf_usm_h
-       CALL radiation_external_surf
+       DO  l = 0, 1
+          surf => surf_lsm_h(l)
+          CALL radiation_external_surf
+          surf => surf_usm_h(l)
+          CALL radiation_external_surf
+       ENDDO
        horizontal = .FALSE.
 !
@@ -3567,8 +3599,10 @@
 !--    First, horizontal surfaces
        horizontal = .TRUE.
-       surf => surf_lsm_h
-       CALL radiation_clearsky_surf
-       surf => surf_usm_h
-       CALL radiation_clearsky_surf
+       DO  l = 0, 1
+          surf => surf_lsm_h(l)
+          CALL radiation_clearsky_surf
+          surf => surf_usm_h(l)
+          CALL radiation_clearsky_surf
+       ENDDO
        horizontal = .FALSE.
 !
@@ -3752,8 +3786,10 @@
 !--    First, horizontal surfaces
        horizontal = .TRUE.
-       surf => surf_lsm_h
-       CALL radiation_constant_surf
-       surf => surf_usm_h
-       CALL radiation_constant_surf
+       DO  l = 0, 1
+          surf => surf_lsm_h(l)
+          CALL radiation_constant_surf
+          surf => surf_usm_h(l)
+          CALL radiation_constant_surf
+       ENDDO
        horizontal = .FALSE.
 !
@@ -4125,6 +4161,8 @@
 !
 !--       Horizontally aligned default, natural and urban surfaces
-          CALL calc_albedo( surf_lsm_h    )
-          CALL calc_albedo( surf_usm_h    )
+          DO  l = 0, 1
+             CALL calc_albedo( surf_lsm_h(l) )
+             CALL calc_albedo( surf_usm_h(l) )
+          ENDDO
 !
 !--       Vertically aligned default, natural and urban surfaces
@@ -4472,9 +4510,9 @@
 !
 !--             Prepare profiles of temperature and H2O volume mixing ratio
-                DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                   rrtm_tlev(0,nzb+1) = surf_lsm_h%pt_surface(m) * exner(nzb)
+                DO  m = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                   rrtm_tlev(0,nzb+1) = surf_lsm_h(0)%pt_surface(m) * exner(nzb)
                 ENDDO
-                DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                   rrtm_tlev(0,nzb+1) = surf_usm_h%pt_surface(m) * exner(nzb)
+                DO  m = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                   rrtm_tlev(0,nzb+1) = surf_usm_h(0)%pt_surface(m) * exner(nzb)
                 ENDDO
 
@@ -4608,6 +4646,6 @@
 !--             surface element on RRTMG-shaped array.
 !--             Please note, as RRTMG is a single column model, surface attributes
-!--             are only obtained from horizontally aligned surfaces (for
-!--             simplicity). Taking surface attributes from horizontal and
+!--             are only obtained from upward facing horizontally aligned surfaces
+!--             (for simplicity). Taking surface attributes from horizontal and
 !--             vertical walls would lead to multiple solutions.
 !--             Moreover, for natural- and urban-type surfaces, several surface
@@ -4615,21 +4653,21 @@
 !--             To obtain bulk parameters, apply a weighted average for these
 !--             surfaces.
-                DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                   rrtm_emis = surf_lsm_h%frac(m,ind_veg_wall)  *              &
-                               surf_lsm_h%emissivity(m,ind_veg_wall)  +        &
-                               surf_lsm_h%frac(m,ind_pav_green) *              &
-                               surf_lsm_h%emissivity(m,ind_pav_green) +        &
-                               surf_lsm_h%frac(m,ind_wat_win)   *              &
-                               surf_lsm_h%emissivity(m,ind_wat_win)
-                   rrtm_tsfc = surf_lsm_h%pt_surface(m) * exner(nzb)
+                DO  m = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                   rrtm_emis = surf_lsm_h(0)%frac(m,ind_veg_wall)  *              &
+                               surf_lsm_h(0)%emissivity(m,ind_veg_wall)  +        &
+                               surf_lsm_h(0)%frac(m,ind_pav_green) *              &
+                               surf_lsm_h(0)%emissivity(m,ind_pav_green) +        &
+                               surf_lsm_h(0)%frac(m,ind_wat_win)   *              &
+                               surf_lsm_h(0)%emissivity(m,ind_wat_win)
+                   rrtm_tsfc = surf_lsm_h(0)%pt_surface(m) * exner(nzb)
                 ENDDO
-                DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                   rrtm_emis = surf_usm_h%frac(m,ind_veg_wall)  *              &
-                               surf_usm_h%emissivity(m,ind_veg_wall)  +        &
-                               surf_usm_h%frac(m,ind_pav_green) *              &
-                               surf_usm_h%emissivity(m,ind_pav_green) +        &
-                               surf_usm_h%frac(m,ind_wat_win)   *              &
-                               surf_usm_h%emissivity(m,ind_wat_win)
-                   rrtm_tsfc = surf_usm_h%pt_surface(m) * exner(nzb)
+                DO  m = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                   rrtm_emis = surf_usm_h(0)%frac(m,ind_veg_wall)  *              &
+                               surf_usm_h(0)%emissivity(m,ind_veg_wall)  +        &
+                               surf_usm_h(0)%frac(m,ind_pav_green) *              &
+                               surf_usm_h(0)%emissivity(m,ind_pav_green) +        &
+                               surf_usm_h(0)%frac(m,ind_wat_win)   *              &
+                               surf_usm_h(0)%emissivity(m,ind_wat_win)
+                   rrtm_tsfc = surf_usm_h(0)%pt_surface(m) * exner(nzb)
                 ENDDO
 !
@@ -4713,15 +4751,17 @@
 !--                onto respective surface elements
 !--                Horizontal surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      surf_lsm_h%rad_lw_in(m)           = rrtm_lwdflx(0,k_topo)
-                      surf_lsm_h%rad_lw_out(m)          = rrtm_lwuflx(0,k_topo)
-                      surf_lsm_h%rad_lw_out_change_0(m) = rrtm_lwuflx_dt(0,k_topo)
-                   ENDDO
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      surf_usm_h%rad_lw_in(m)           = rrtm_lwdflx(0,k_topo)
-                      surf_usm_h%rad_lw_out(m)          = rrtm_lwuflx(0,k_topo)
-                      surf_usm_h%rad_lw_out_change_0(m) = rrtm_lwuflx_dt(0,k_topo)
+                   DO l = 0, 1
+                      DO  m = surf_lsm_h(l)%start_index(j,i),                        &
+                              surf_lsm_h(l)%end_index(j,i)
+                         surf_lsm_h(l)%rad_lw_in(m)           = rrtm_lwdflx(0,k_topo)
+                         surf_lsm_h(l)%rad_lw_out(m)          = rrtm_lwuflx(0,k_topo)
+                         surf_lsm_h(l)%rad_lw_out_change_0(m) = rrtm_lwuflx_dt(0,k_topo)
+                      ENDDO
+                      DO  m = surf_usm_h(l)%start_index(j,i),                        &
+                              surf_usm_h(l)%end_index(j,i)
+                         surf_usm_h(l)%rad_lw_in(m)           = rrtm_lwdflx(0,k_topo)
+                         surf_usm_h(l)%rad_lw_out(m)          = rrtm_lwuflx(0,k_topo)
+                         surf_usm_h(l)%rad_lw_out_change_0(m) = rrtm_lwuflx_dt(0,k_topo)
+                      ENDDO
                    ENDDO
 !
@@ -4751,29 +4791,28 @@
 !--                Get albedo for direct/diffusive long/shortwave radiation at
 !--                current (y,x)-location from surface variables.
-!--                Only obtain it from horizontal surfaces, as RRTMG is a single
-!--                column model
-!--                (Please note, only one loop will entered, controlled by
-!--                start-end index.)
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      rrtm_asdir(1)  = SUM( surf_lsm_h%frac(m,:) *             &
-                                            surf_lsm_h%rrtm_asdir(m,:) )
-                      rrtm_asdif(1)  = SUM( surf_lsm_h%frac(m,:) *             &
-                                            surf_lsm_h%rrtm_asdif(m,:) )
-                      rrtm_aldir(1)  = SUM( surf_lsm_h%frac(m,:) *             &
-                                            surf_lsm_h%rrtm_aldir(m,:) )
-                      rrtm_aldif(1)  = SUM( surf_lsm_h%frac(m,:) *             &
-                                            surf_lsm_h%rrtm_aldif(m,:) )
+!--                Only obtain it from upward facing horizontal surfaces,
+!--                as RRTMG is a single column model. (Please note, only
+!--                one loop will entered, controlled by start-end index.)
+                   DO  m = surf_lsm_h(0)%start_index(j,i),                        &
+                           surf_lsm_h(0)%end_index(j,i)
+                      rrtm_asdir(1)  = SUM( surf_lsm_h(0)%frac(m,:) *             &
+                                            surf_lsm_h(0)%rrtm_asdir(m,:) )
+                      rrtm_asdif(1)  = SUM( surf_lsm_h(0)%frac(m,:) *             &
+                                            surf_lsm_h(0)%rrtm_asdif(m,:) )
+                      rrtm_aldir(1)  = SUM( surf_lsm_h(0)%frac(m,:) *             &
+                                            surf_lsm_h(0)%rrtm_aldir(m,:) )
+                      rrtm_aldif(1)  = SUM( surf_lsm_h(0)%frac(m,:) *             &
+                                            surf_lsm_h(0)%rrtm_aldif(m,:) )
                    ENDDO
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      rrtm_asdir(1)  = SUM( surf_usm_h%frac(m,:) *             &
-                                            surf_usm_h%rrtm_asdir(m,:) )
-                      rrtm_asdif(1)  = SUM( surf_usm_h%frac(m,:) *             &
-                                            surf_usm_h%rrtm_asdif(m,:) )
-                      rrtm_aldir(1)  = SUM( surf_usm_h%frac(m,:) *             &
-                                            surf_usm_h%rrtm_aldir(m,:) )
-                      rrtm_aldif(1)  = SUM( surf_usm_h%frac(m,:) *             &
-                                            surf_usm_h%rrtm_aldif(m,:) )
+                   DO  m = surf_usm_h(0)%start_index(j,i),                        &
+                           surf_usm_h(0)%end_index(j,i)
+                      rrtm_asdir(1)  = SUM( surf_usm_h(0)%frac(m,:) *             &
+                                            surf_usm_h(0)%rrtm_asdir(m,:) )
+                      rrtm_asdif(1)  = SUM( surf_usm_h(0)%frac(m,:) *             &
+                                            surf_usm_h(0)%rrtm_asdif(m,:) )
+                      rrtm_aldir(1)  = SUM( surf_usm_h(0)%frac(m,:) *             &
+                                            surf_usm_h(0)%rrtm_aldir(m,:) )
+                      rrtm_aldif(1)  = SUM( surf_usm_h(0)%frac(m,:) *             &
+                                            surf_usm_h(0)%rrtm_aldif(m,:) )
                    ENDDO
 !
@@ -4876,13 +4915,15 @@
 !--                Save surface radiative fluxes onto respective surface elements
 !--                Horizontal surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      surf_lsm_h%rad_sw_in(m)     = rrtm_swdflx(0,k_topo)
-                      surf_lsm_h%rad_sw_out(m)    = rrtm_swuflx(0,k_topo)
-                   ENDDO
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      surf_usm_h%rad_sw_in(m)     = rrtm_swdflx(0,k_topo)
-                      surf_usm_h%rad_sw_out(m)    = rrtm_swuflx(0,k_topo)
+                   DO l = 0, 1
+                      DO  m = surf_lsm_h(l)%start_index(j,i),                        &
+                              surf_lsm_h(l)%end_index(j,i)
+                         surf_lsm_h(l)%rad_sw_in(m)     = rrtm_swdflx(0,k_topo)
+                         surf_lsm_h(l)%rad_sw_out(m)    = rrtm_swuflx(0,k_topo)
+                      ENDDO
+                      DO  m = surf_usm_h(l)%start_index(j,i),                        &
+                              surf_usm_h(l)%end_index(j,i)
+                         surf_usm_h(l)%rad_sw_in(m)     = rrtm_swdflx(0,k_topo)
+                         surf_usm_h(l)%rad_sw_out(m)    = rrtm_swuflx(0,k_topo)
+                      ENDDO
                    ENDDO
 !
@@ -4908,17 +4949,19 @@
                    rad_sw_in  = 0.0_wp
                    rad_sw_out = 0.0_wp
-!--             !!!!!!!! ATTENSION !!!!!!!!!!!!!!!
+!--             !!!!!!!! ATTENTION !!!!!!!!!!!!!!!
 !--             Surface radiative fluxes should be also set to zero here
 !--                Save surface radiative fluxes onto respective surface elements
 !--                Horizontal surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      surf_lsm_h%rad_sw_in(m)     = 0.0_wp
-                      surf_lsm_h%rad_sw_out(m)    = 0.0_wp
-                   ENDDO
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      surf_usm_h%rad_sw_in(m)     = 0.0_wp
-                      surf_usm_h%rad_sw_out(m)    = 0.0_wp
+                   DO l = 0, 1
+                      DO  m = surf_lsm_h(l)%start_index(j,i),                  &
+                              surf_lsm_h(l)%end_index(j,i)
+                         surf_lsm_h(l)%rad_sw_in(m)     = 0.0_wp
+                         surf_lsm_h(l)%rad_sw_out(m)    = 0.0_wp
+                      ENDDO
+                      DO  m = surf_usm_h(l)%start_index(j,i),                  &
+                              surf_usm_h(l)%end_index(j,i)
+                         surf_usm_h(l)%rad_sw_in(m)     = 0.0_wp
+                         surf_usm_h(l)%rad_sw_out(m)    = 0.0_wp
+                      ENDDO
                    ENDDO
 !
@@ -4949,15 +4992,17 @@
        IF (  .NOT.  radiation_interactions  ) THEN
 !--       First, for horizontal surfaces
-          DO  m = 1, surf_lsm_h%ns
-             surf_lsm_h%rad_net(m) = surf_lsm_h%rad_sw_in(m)                   &
-                                   - surf_lsm_h%rad_sw_out(m)                  &
-                                   + surf_lsm_h%rad_lw_in(m)                   &
-                                   - surf_lsm_h%rad_lw_out(m)
-          ENDDO
-          DO  m = 1, surf_usm_h%ns
-             surf_usm_h%rad_net(m) = surf_usm_h%rad_sw_in(m)                   &
-                                   - surf_usm_h%rad_sw_out(m)                  &
-                                   + surf_usm_h%rad_lw_in(m)                   &
-                                   - surf_usm_h%rad_lw_out(m)
+          DO l = 0, 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                surf_lsm_h(l)%rad_net(m) = surf_lsm_h(l)%rad_sw_in(m)                &
+                                      - surf_lsm_h(l)%rad_sw_out(m)                  &
+                                      + surf_lsm_h(l)%rad_lw_in(m)                   &
+                                      - surf_lsm_h(l)%rad_lw_out(m)
+             ENDDO
+             DO  m = 1, surf_usm_h(l)%ns
+                surf_usm_h(l)%rad_net(m) = surf_usm_h(l)%rad_sw_in(m)                &
+                                      - surf_usm_h(l)%rad_sw_out(m)                  &
+                                      + surf_usm_h(l)%rad_lw_in(m)                   &
+                                      - surf_usm_h(l)%rad_lw_out(m)
+             ENDDO
           ENDDO
 !
@@ -5986,40 +6031,30 @@
 !
 !--        Horizontal walls
-!--        urban
-           DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-              surfoutll(mm) = SUM ( surf_usm_h%frac(m,:) *                  &
-                                    surf_usm_h%emissivity(m,:) )            &
-                                  * sigma_sb                                &
-                                  * surf_usm_h%pt_surface(m)**4
-              albedo_surf(mm) = SUM ( surf_usm_h%frac(m,:) *                &
-                                      surf_usm_h%albedo(m,:) )
-              emiss_surf(mm)  = SUM ( surf_usm_h%frac(m,:) *                &
-                                      surf_usm_h%emissivity(m,:) )
-              mm = mm + 1
-           ENDDO
-!
-!--        land
-           DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-              surfoutll(mm) = SUM ( surf_lsm_h%frac(m,:) *                  &
-                                    surf_lsm_h%emissivity(m,:) )            &
-                                  * sigma_sb                                &
-                                  * surf_lsm_h%pt_surface(m)**4
-              albedo_surf(mm) = SUM ( surf_lsm_h%frac(m,:) *                &
-                                      surf_lsm_h%albedo(m,:) )
-              emiss_surf(mm)  = SUM ( surf_lsm_h%frac(m,:) *                &
-                                      surf_lsm_h%emissivity(m,:) )
-              mm = mm + 1
-           ENDDO
-!
-!--        Downward facing default surfaces
-!--        TODO: Downward-facing surfaces are only available as default surfaces which lack
-!--        temperature and heat balance, therefore they have to be simulated as neutral to
-!--        radiation, that means having sw/lw reflectivity=1, so they neither absorb nor emit
-!--        radiation and they have zero net heat flux.
-           DO  m = surf_def_h(1)%start_index(j,i), surf_def_h(1)%end_index(j,i)
-              surfoutll(mm) = 0.0_wp
-              albedo_surf(mm) = 1.0_wp
-              emiss_surf(mm)  = 0.0_wp
-              mm = mm + 1
+           DO l = 0, 1
+!--           urban
+              DO  m = surf_usm_h(l)%start_index(j,i), surf_usm_h(l)%end_index(j,i)
+                 surfoutll(mm) = SUM ( surf_usm_h(l)%frac(m,:) *                  &
+                                       surf_usm_h(l)%emissivity(m,:) )            &
+                                     * sigma_sb                                   &
+                                     * surf_usm_h(l)%pt_surface(m)**4
+                 albedo_surf(mm) = SUM ( surf_usm_h(l)%frac(m,:) *                &
+                                         surf_usm_h(l)%albedo(m,:) )
+                 emiss_surf(mm)  = SUM ( surf_usm_h(l)%frac(m,:) *                &
+                                         surf_usm_h(l)%emissivity(m,:) )
+                 mm = mm + 1
+              ENDDO
+!
+!--           land
+              DO  m = surf_lsm_h(l)%start_index(j,i), surf_lsm_h(l)%end_index(j,i)
+                 surfoutll(mm) = SUM ( surf_lsm_h(l)%frac(m,:) *                  &
+                                       surf_lsm_h(l)%emissivity(m,:) )            &
+                                     * sigma_sb                                   &
+                                     * surf_lsm_h(l)%pt_surface(m)**4
+                 albedo_surf(mm) = SUM ( surf_lsm_h(l)%frac(m,:) *                &
+                                         surf_lsm_h(l)%albedo(m,:) )
+                 emiss_surf(mm)  = SUM ( surf_lsm_h(l)%frac(m,:) *                &
+                                         surf_lsm_h(l)%emissivity(m,:) )
+                 mm = mm + 1
+              ENDDO
            ENDDO
 !
@@ -6428,50 +6463,43 @@
 !
 !--        Horizontal walls
-!--        urban
-           DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-              surf_usm_h%rad_sw_in(m)  = surfinsw(mm)
-              surf_usm_h%rad_sw_out(m) = surfoutsw(mm)
-              surf_usm_h%rad_sw_dir(m) = surfinswdir(mm)
-              surf_usm_h%rad_sw_dif(m) = surfinswdif(mm)
-              surf_usm_h%rad_sw_ref(m) = surfinsw(mm) - surfinswdir(mm) -        &
-                                         surfinswdif(mm)
-              surf_usm_h%rad_sw_res(m) = surfins(mm)
-              surf_usm_h%rad_lw_in(m)  = surfinlw(mm)
-              surf_usm_h%rad_lw_out(m) = surfoutlw(mm)
-              surf_usm_h%rad_net(m)    = surfinsw(mm) - surfoutsw(mm) +          &
-                                         surfinlw(mm) - surfoutlw(mm)
-              surf_usm_h%rad_net_l(m)  = surf_usm_h%rad_net(m)
-              surf_usm_h%rad_lw_dif(m) = surfinlwdif(mm)
-              surf_usm_h%rad_lw_ref(m) = surfinlw(mm) - surfinlwdif(mm)
-              surf_usm_h%rad_lw_res(m) = surfinl(mm)
-              mm = mm + 1
-           ENDDO
-!
-!--        land
-           DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-              surf_lsm_h%rad_sw_in(m)  = surfinsw(mm)
-              surf_lsm_h%rad_sw_out(m) = surfoutsw(mm)
-              surf_lsm_h%rad_sw_dir(m) = surfinswdir(mm)
-              surf_lsm_h%rad_sw_dif(m) = surfinswdif(mm)
-              surf_lsm_h%rad_sw_ref(m) = surfinsw(mm) - surfinswdir(mm) -        &
+           DO l = 0, 1
+!--           urban
+              DO  m = surf_usm_h(l)%start_index(j,i), surf_usm_h(l)%end_index(j,i)
+                 surf_usm_h(l)%rad_sw_in(m)  = surfinsw(mm)
+                 surf_usm_h(l)%rad_sw_out(m) = surfoutsw(mm)
+                 surf_usm_h(l)%rad_sw_dir(m) = surfinswdir(mm)
+                 surf_usm_h(l)%rad_sw_dif(m) = surfinswdif(mm)
+                 surf_usm_h(l)%rad_sw_ref(m) = surfinsw(mm) - surfinswdir(mm) -        &
                                             surfinswdif(mm)
-              surf_lsm_h%rad_sw_res(m) = surfins(mm)
-              surf_lsm_h%rad_lw_in(m)  = surfinlw(mm)
-              surf_lsm_h%rad_lw_out(m) = surfoutlw(mm)
-              surf_lsm_h%rad_net(m)    = surfinsw(mm) - surfoutsw(mm) +          &
-                                         surfinlw(mm) - surfoutlw(mm)
-              surf_lsm_h%rad_lw_dif(m) = surfinlwdif(mm)
-              surf_lsm_h%rad_lw_ref(m) = surfinlw(mm) - surfinlwdif(mm)
-              surf_lsm_h%rad_lw_res(m) = surfinl(mm)
-              mm = mm + 1
-           ENDDO
-!
-!--        Downward facing default surfaces
-!--        TODO: Downward-facing surfaces are only available as default surfaces which lack
-!--        temperature and heat balance, therefore they have to be simulated as neutral to
-!--        radiation, that means having sw/lw reflectivity=1, so they neither absorb nor emit
-!--        radiation and they have zero net heat flux.
-           DO  m = surf_def_h(1)%start_index(j,i), surf_def_h(1)%end_index(j,i)
-              mm = mm + 1
+                 surf_usm_h(l)%rad_sw_res(m) = surfins(mm)
+                 surf_usm_h(l)%rad_lw_in(m)  = surfinlw(mm)
+                 surf_usm_h(l)%rad_lw_out(m) = surfoutlw(mm)
+                 surf_usm_h(l)%rad_net(m)    = surfinsw(mm) - surfoutsw(mm) +          &
+                                            surfinlw(mm) - surfoutlw(mm)
+                 surf_usm_h(l)%rad_net_l(m)  = surf_usm_h(l)%rad_net(m)
+                 surf_usm_h(l)%rad_lw_dif(m) = surfinlwdif(mm)
+                 surf_usm_h(l)%rad_lw_ref(m) = surfinlw(mm) - surfinlwdif(mm)
+                 surf_usm_h(l)%rad_lw_res(m) = surfinl(mm)
+                 mm = mm + 1
+              ENDDO
+!
+!--           land
+              DO  m = surf_lsm_h(l)%start_index(j,i), surf_lsm_h(l)%end_index(j,i)
+                 surf_lsm_h(l)%rad_sw_in(m)  = surfinsw(mm)
+                 surf_lsm_h(l)%rad_sw_out(m) = surfoutsw(mm)
+                 surf_lsm_h(l)%rad_sw_dir(m) = surfinswdir(mm)
+                 surf_lsm_h(l)%rad_sw_dif(m) = surfinswdif(mm)
+                 surf_lsm_h(l)%rad_sw_ref(m) = surfinsw(mm) - surfinswdir(mm) -        &
+                                               surfinswdif(mm)
+                 surf_lsm_h(l)%rad_sw_res(m) = surfins(mm)
+                 surf_lsm_h(l)%rad_lw_in(m)  = surfinlw(mm)
+                 surf_lsm_h(l)%rad_lw_out(m) = surfoutlw(mm)
+                 surf_lsm_h(l)%rad_net(m)    = surfinsw(mm) - surfoutsw(mm) +          &
+                                            surfinlw(mm) - surfoutlw(mm)
+                 surf_lsm_h(l)%rad_lw_dif(m) = surfinlwdif(mm)
+                 surf_lsm_h(l)%rad_lw_ref(m) = surfinlw(mm) - surfinlwdif(mm)
+                 surf_lsm_h(l)%rad_lw_res(m) = surfinl(mm)
+                 mm = mm + 1
+              ENDDO
            ENDDO
 !
@@ -6538,17 +6566,18 @@
      ENDDO
 
-     DO  m = 1, surf_usm_h%ns
-        surf_usm_h%surfhf(m) = surf_usm_h%rad_sw_in(m)  +                   &
-                               surf_usm_h%rad_lw_in(m)  -                   &
-                               surf_usm_h%rad_sw_out(m) -                   &
-                               surf_usm_h%rad_lw_out(m)
+     DO l = 0, 1
+        DO  m = 1, surf_usm_h(l)%ns
+           surf_usm_h(l)%surfhf(m) = surf_usm_h(l)%rad_sw_in(m)  +          &
+                                  surf_usm_h(l)%rad_lw_in(m)  -             &
+                                  surf_usm_h(l)%rad_sw_out(m) -             &
+                                  surf_usm_h(l)%rad_lw_out(m)
+        ENDDO
+        DO  m = 1, surf_lsm_h(l)%ns
+           surf_lsm_h(l)%surfhf(m) = surf_lsm_h(l)%rad_sw_in(m)  +          &
+                                  surf_lsm_h(l)%rad_lw_in(m)  -             &
+                                  surf_lsm_h(l)%rad_sw_out(m) -             &
+                                  surf_lsm_h(l)%rad_lw_out(m)
+        ENDDO
      ENDDO
-     DO  m = 1, surf_lsm_h%ns
-        surf_lsm_h%surfhf(m) = surf_lsm_h%rad_sw_in(m)  +                   &
-                               surf_lsm_h%rad_lw_in(m)  -                   &
-                               surf_lsm_h%rad_sw_out(m) -                   &
-                               surf_lsm_h%rad_lw_out(m)
-     ENDDO
-
      DO  l = 0, 3
 !--     urban
@@ -7020,10 +7049,12 @@
 !--    Number of horizontal surfaces including land- and roof surfaces in both USM and LSM. Note that
 !--    All horizontal surface elements are already counted in surface_mod.
-       nsurfl    = surf_usm_h%ns + surf_lsm_h%ns + surf_def_h(1)%ns
+       DO l = 0, 1
+          nsurfl = nsurfl + surf_usm_h(l)%ns + surf_lsm_h(l)%ns
+       ENDDO
 !
 !--    Number of vertical surfaces in both USM and LSM. Note that all vertical surface elements are
 !--    already counted in surface_mod.
-       DO  i = 0,3
-          nsurfl = nsurfl + surf_usm_v(i)%ns + surf_lsm_v(i)%ns
+       DO  l = 0,3
+          nsurfl = nsurfl + surf_usm_v(l)%ns + surf_lsm_v(l)%ns
        ENDDO
 
@@ -7144,82 +7175,47 @@
 !
 !--           Horizontal surfaces
-              DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                 k = surf_usm_h%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/iup,k,j,i/)
+              DO l = 0, 1
+                 DO  m = surf_usm_h(l)%start_index(j,i), surf_usm_h(l)%end_index(j,i)
+                    k = surf_usm_h(l)%k(m)
+                    isurf = isurf + 1
+                    surfl(:,isurf) = (/dirint_h(l),k,j,i/)
+                 ENDDO
+                 DO  m = surf_lsm_h(l)%start_index(j,i), surf_lsm_h(l)%end_index(j,i)
+                    k = surf_lsm_h(l)%k(m)
+                    isurf = isurf + 1
+                    surfl(:,isurf) = (/dirint_h(l),k,j,i/)
+                 ENDDO
               ENDDO
-
-              DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                 k = surf_lsm_h%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/iup,k,j,i/)
+!
+!--           Vertical surfaces
+              DO l = 0, 3
+                 DO  m = surf_usm_v(l)%start_index(j,i), surf_usm_v(l)%end_index(j,i)
+                    k = surf_usm_v(l)%k(m)
+                    isurf = isurf + 1
+                    surfl(:,isurf) = (/dirint_v(l),k,j,i/)
+                 ENDDO
+                 DO  m = surf_lsm_v(l)%start_index(j,i), surf_lsm_v(l)%end_index(j,i)
+                    k = surf_lsm_v(l)%k(m)
+                    isurf = isurf + 1
+                    surfl(:,isurf) = (/dirint_v(l),k,j,i/)
+                 ENDDO
               ENDDO
 
-              DO  m = surf_def_h(1)%start_index(j,i), surf_def_h(1)%end_index(j,i)
-                 k = surf_def_h(1)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/idown,k,j,i/)
-              ENDDO
-!
-!--           Vertical surfaces
-              l = 0
-              DO  m = surf_usm_v(l)%start_index(j,i), surf_usm_v(l)%end_index(j,i)
-                 k = surf_usm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/inorth,k,j,i/)
-              ENDDO
-              DO  m = surf_lsm_v(l)%start_index(j,i), surf_lsm_v(l)%end_index(j,i)
-                 k = surf_lsm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/inorth,k,j,i/)
-              ENDDO
-
-              l = 1
-              DO  m = surf_usm_v(l)%start_index(j,i), surf_usm_v(l)%end_index(j,i)
-                 k = surf_usm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/isouth,k,j,i/)
-              ENDDO
-              DO  m = surf_lsm_v(l)%start_index(j,i), surf_lsm_v(l)%end_index(j,i)
-                 k = surf_lsm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/isouth,k,j,i/)
-              ENDDO
-
-              l = 2
-              DO  m = surf_usm_v(l)%start_index(j,i), surf_usm_v(l)%end_index(j,i)
-                 k = surf_usm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/ieast,k,j,i/)
-              ENDDO
-              DO  m = surf_lsm_v(l)%start_index(j,i), surf_lsm_v(l)%end_index(j,i)
-                 k = surf_lsm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/ieast,k,j,i/)
-              ENDDO
-
-              l = 3
-              DO  m = surf_usm_v(l)%start_index(j,i), surf_usm_v(l)%end_index(j,i)
-                 k = surf_usm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/iwest,k,j,i/)
-              ENDDO
-              DO  m = surf_lsm_v(l)%start_index(j,i), surf_lsm_v(l)%end_index(j,i)
-                 k = surf_lsm_v(l)%k(m)
-                 isurf = isurf + 1
-                 surfl(:,isurf) = (/iwest,k,j,i/)
-              ENDDO
            ENDDO
        ENDDO
 !
-!--    Add local MRT boxes for specified number of levels
+!--    Add local MRT boxes for the specified number of levels
+!--    !!!! NEEDS TO RETHINK AGAIN - with full 3D structure, only the one
+!--    !!!! of the upward faced horizontal surfaces should be taken (the lowest one = ground?)
+!--    !!!! mrt_nlevels number of air grid boxes might not be available
+!--    !!!! in case of overhanging structures!
        nmrtbl = 0
        IF ( mrt_nlevels > 0 )  THEN
           DO  i = nxl, nxr
              DO  j = nys, nyn
-                DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
+                DO  m = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
 !
 !--                Skip roof if requested
-                   IF ( mrt_skip_roof  .AND.  surf_usm_h%isroof_surf(m) )  CYCLE
+                   IF ( mrt_skip_roof  .AND.  surf_usm_h(0)%isroof_surf(m) )  CYCLE
 !
 !--                Cycle over specified no of levels
@@ -7228,5 +7224,5 @@
 !
 !--             Dtto for LSM
-                DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
+                DO  m = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
                    nmrtbl = nmrtbl + mrt_nlevels
                 ENDDO
@@ -7240,11 +7236,11 @@
           DO  i = nxl, nxr
              DO  j = nys, nyn
-                DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
+                DO  m = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
 !
 !--                Skip roof if requested
-                   IF ( mrt_skip_roof  .AND.  surf_usm_h%isroof_surf(m) )  CYCLE
+                   IF ( mrt_skip_roof  .AND.  surf_usm_h(0)%isroof_surf(m) )  CYCLE
 !
 !--                Cycle over specified no of levels
-                   l = surf_usm_h%k(m)
+                   l = surf_usm_h(0)%k(m)
                    DO  k = l, l + mrt_nlevels - 1
                       imrt = imrt + 1
@@ -7254,6 +7250,6 @@
 !
 !--             Dtto for LSM
-                DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                   l = surf_lsm_h%k(m)
+                DO  m = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                   l = surf_lsm_h(0)%k(m)
                    DO  k = l, l + mrt_nlevels - 1
                       imrt = imrt + 1
@@ -10298,21 +10294,22 @@
        SELECT CASE ( TRIM( var ) )
 !--       block of large scale (e.g. RRTMG) radiation output variables
+!--       only upward faced horizontal surfaces are considered here
           CASE ( 'rad_net*' )
              IF ( ALLOCATED( rad_net_av ) ) THEN
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      match_lsm = surf_lsm_h%start_index(j,i) <=               &
-                                  surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <=               &
-                                  surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <=               &
+                                  surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <=               &
+                                  surf_usm_h(0)%end_index(j,i)
 
                      IF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
+                         m = surf_lsm_h(0)%end_index(j,i)
                          rad_net_av(j,i) = rad_net_av(j,i) +                   &
-                                         surf_lsm_h%rad_net(m)
+                                         surf_lsm_h(0)%rad_net(m)
                       ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
+                         m = surf_usm_h(0)%end_index(j,i)
                          rad_net_av(j,i) = rad_net_av(j,i) +                   &
-                                         surf_usm_h%rad_net(m)
+                                         surf_usm_h(0)%rad_net(m)
                       ENDIF
                    ENDDO
@@ -10324,17 +10321,17 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      match_lsm = surf_lsm_h%start_index(j,i) <=               &
-                                  surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <=               &
-                                  surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <=               &
+                                  surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <=               &
+                                  surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
+                         m = surf_lsm_h(0)%end_index(j,i)
                          rad_lw_in_xy_av(j,i) = rad_lw_in_xy_av(j,i) +         &
-                                         surf_lsm_h%rad_lw_in(m)
+                                         surf_lsm_h(0)%rad_lw_in(m)
                       ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
+                         m = surf_usm_h(0)%end_index(j,i)
                          rad_lw_in_xy_av(j,i) = rad_lw_in_xy_av(j,i) +         &
-                                         surf_usm_h%rad_lw_in(m)
+                                         surf_usm_h(0)%rad_lw_in(m)
                       ENDIF
                    ENDDO
@@ -10346,17 +10343,17 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      match_lsm = surf_lsm_h%start_index(j,i) <=               &
-                                  surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <=               &
-                                  surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <=               &
+                                  surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <=               &
+                                  surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
+                         m = surf_lsm_h(0)%end_index(j,i)
                          rad_lw_out_xy_av(j,i) = rad_lw_out_xy_av(j,i) +       &
-                                                 surf_lsm_h%rad_lw_out(m)
+                                                 surf_lsm_h(0)%rad_lw_out(m)
                       ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
+                         m = surf_usm_h(0)%end_index(j,i)
                          rad_lw_out_xy_av(j,i) = rad_lw_out_xy_av(j,i) +       &
-                                                 surf_usm_h%rad_lw_out(m)
+                                                 surf_usm_h(0)%rad_lw_out(m)
                       ENDIF
                    ENDDO
@@ -10368,17 +10365,17 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      match_lsm = surf_lsm_h%start_index(j,i) <=               &
-                                  surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <=               &
-                                  surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <=               &
+                                  surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <=               &
+                                  surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
+                         m = surf_lsm_h(0)%end_index(j,i)
                          rad_sw_in_xy_av(j,i) = rad_sw_in_xy_av(j,i) +         &
-                                                surf_lsm_h%rad_sw_in(m)
+                                                surf_lsm_h(0)%rad_sw_in(m)
                       ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
+                         m = surf_usm_h(0)%end_index(j,i)
                          rad_sw_in_xy_av(j,i) = rad_sw_in_xy_av(j,i) +         &
-                                                surf_usm_h%rad_sw_in(m)
+                                                surf_usm_h(0)%rad_sw_in(m)
                       ENDIF
                    ENDDO
@@ -10390,17 +10387,17 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      match_lsm = surf_lsm_h%start_index(j,i) <=               &
-                                  surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <=               &
-                                  surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <=               &
+                                  surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <=               &
+                                  surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
+                         m = surf_lsm_h(0)%end_index(j,i)
                          rad_sw_out_xy_av(j,i) = rad_sw_out_xy_av(j,i) +       &
-                                                 surf_lsm_h%rad_sw_out(m)
+                                                 surf_lsm_h(0)%rad_sw_out(m)
                       ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
+                         m = surf_usm_h(0)%end_index(j,i)
                          rad_sw_out_xy_av(j,i) = rad_sw_out_xy_av(j,i) +       &
-                                                 surf_usm_h%rad_sw_out(m)
+                                                 surf_usm_h(0)%rad_sw_out(m)
                       ENDIF
                    ENDDO
@@ -11072,14 +11069,15 @@
 !
 !--                Obtain rad_net from its respective surface type
+!--                Only upward faced horizontal outputs are considered here
 !--                Natural-type surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%rad_net(m)
+                   DO  m = surf_lsm_h(0)%start_index(j,i),                        &
+                           surf_lsm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%rad_net(m)
                    ENDDO
 !
 !--                Urban-type surfaces
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_usm_h%rad_net(m)
+                   DO  m = surf_usm_h(0)%start_index(j,i),                        &
+                           surf_usm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%rad_net(m)
                    ENDDO
                 ENDDO
@@ -11106,13 +11104,13 @@
 !--                Obtain rad_net from its respective surface type
 !--                Natural-type surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%rad_lw_in(m)
+                   DO  m = surf_lsm_h(0)%start_index(j,i),                        &
+                           surf_lsm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%rad_lw_in(m)
                    ENDDO
 !
 !--                Urban-type surfaces
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_usm_h%rad_lw_in(m)
+                   DO  m = surf_usm_h(0)%start_index(j,i),                        &
+                           surf_usm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%rad_lw_in(m)
                    ENDDO
                 ENDDO
@@ -11139,13 +11137,13 @@
 !--                Obtain rad_net from its respective surface type
 !--                Natural-type surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%rad_lw_out(m)
+                   DO  m = surf_lsm_h(0)%start_index(j,i),                        &
+                           surf_lsm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%rad_lw_out(m)
                    ENDDO
 !
 !--                Urban-type surfaces
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_usm_h%rad_lw_out(m)
+                   DO  m = surf_usm_h(0)%start_index(j,i),                        &
+                           surf_usm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%rad_lw_out(m)
                    ENDDO
                 ENDDO
@@ -11172,13 +11170,13 @@
 !--                Obtain rad_net from its respective surface type
 !--                Natural-type surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%rad_sw_in(m)
+                   DO  m = surf_lsm_h(0)%start_index(j,i),                        &
+                           surf_lsm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%rad_sw_in(m)
                    ENDDO
 !
 !--                Urban-type surfaces
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_usm_h%rad_sw_in(m)
+                   DO  m = surf_usm_h(0)%start_index(j,i),                        &
+                           surf_usm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%rad_sw_in(m)
                    ENDDO
                 ENDDO
@@ -11205,13 +11203,13 @@
 !--                Obtain rad_net from its respective surface type
 !--                Natural-type surfaces
-                   DO  m = surf_lsm_h%start_index(j,i),                        &
-                           surf_lsm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_lsm_h%rad_sw_out(m)
+                   DO  m = surf_lsm_h(0)%start_index(j,i),                        &
+                           surf_lsm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_lsm_h(0)%rad_sw_out(m)
                    ENDDO
 !
 !--                Urban-type surfaces
-                   DO  m = surf_usm_h%start_index(j,i),                        &
-                           surf_usm_h%end_index(j,i)
-                      local_pf(i,j,nzb+1) = surf_usm_h%rad_sw_out(m)
+                   DO  m = surf_usm_h(0)%start_index(j,i),                        &
+                           surf_usm_h(0)%end_index(j,i)
+                      local_pf(i,j,nzb+1) = surf_usm_h(0)%rad_sw_out(m)
                    ENDDO
                 ENDDO
Index: palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4617 2020-07-22 09:48:50Z raasch
 ! check, if boundary conditions in the prerun are both set to cyclic
 !
@@ -269,5 +272,5 @@
        READ ( 13 )  version_on_file
 
-       binary_version_global = '5.0'
+       binary_version_global = '5.1'
        IF ( TRIM( version_on_file ) /= TRIM( binary_version_global ) )  THEN
           WRITE( message_string, * ) 'version mismatch concerning ',           &
@@ -867,5 +870,5 @@
        CALL rrd_mpi_io( 'binary_version_global',  version_on_file )
 
-       binary_version_global = '5.0'
+       binary_version_global = '5.1'
        IF ( TRIM( version_on_file ) /= TRIM( binary_version_global ) )  THEN
           WRITE( message_string, * ) 'version mismatch concerning binary_version_global:',         &
@@ -1700,5 +1703,5 @@
           READ ( 13 )  version_on_file
 
-          binary_version_local = '5.0'
+          binary_version_local = '5.1'
           IF ( TRIM( version_on_file ) /= TRIM( binary_version_local ) )  THEN
              WRITE( message_string, * ) 'version mismatch concerning ',                               &
Index: palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- palm/trunk/SOURCE/salsa_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/salsa_mod.f90	(revision 4671)
@@ -21,9 +21,12 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4535 2020-05-15 12:07:23Z raasch
 ! bugfix for restart data format query
 ! 
@@ -850,6 +853,6 @@
     TYPE(t_section), DIMENSION(:), ALLOCATABLE ::  aero  !< local aerosol properties
 
-    TYPE(match_surface) ::  lsm_to_depo_h  !< to match the deposition module and horizontal LSM surfaces
-    TYPE(match_surface) ::  usm_to_depo_h  !< to match the deposition module and horizontal USM surfaces
+    TYPE(match_surface), DIMENSION(0:1) ::  lsm_to_depo_h  !< to match the deposition module and horizontal LSM surfaces
+    TYPE(match_surface), DIMENSION(0:1) ::  usm_to_depo_h  !< to match the deposition module and horizontal USM surfaces
 
     TYPE(match_surface), DIMENSION(0:3) ::  lsm_to_depo_v  !< to match the deposition mod. and vertical LSM surfaces
@@ -1695,16 +1698,16 @@
     ENDDO
 !
-!-- Horizontal surfaces: natural type
-    ALLOCATE( surf_lsm_h%answs( 1:surf_lsm_h%ns, nbins_aerosol ) )
-    ALLOCATE( surf_lsm_h%amsws( 1:surf_lsm_h%ns, nbins_aerosol*ncomponents_mass ) )
-    surf_lsm_h%answs = 0.0_wp
-    surf_lsm_h%amsws = 0.0_wp
-!
-!-- Horizontal surfaces: urban type
-    ALLOCATE( surf_usm_h%answs( 1:surf_usm_h%ns, nbins_aerosol ) )
-    ALLOCATE( surf_usm_h%amsws( 1:surf_usm_h%ns, nbins_aerosol*ncomponents_mass ) )
-    surf_usm_h%answs = 0.0_wp
-    surf_usm_h%amsws = 0.0_wp
-
+!-- Horizontal surfaces: natural and urban type
+    DO l = 0, 1
+       ALLOCATE( surf_lsm_h(l)%answs( 1:surf_lsm_h(l)%ns, nbins_aerosol ) )
+       ALLOCATE( surf_lsm_h(l)%amsws( 1:surf_lsm_h(l)%ns, nbins_aerosol*ncomponents_mass ) )
+       surf_lsm_h(l)%answs = 0.0_wp
+       surf_lsm_h(l)%amsws = 0.0_wp
+
+       ALLOCATE( surf_usm_h(l)%answs( 1:surf_usm_h(l)%ns, nbins_aerosol ) )
+       ALLOCATE( surf_usm_h(l)%amsws( 1:surf_usm_h(l)%ns, nbins_aerosol*ncomponents_mass ) )
+       surf_usm_h(l)%answs = 0.0_wp
+       surf_usm_h(l)%amsws = 0.0_wp
+    ENDDO
 !
 !-- Vertical surfaces: northward (l=0), southward (l=1), eastward (l=2) and westward (l=3) facing
@@ -1797,10 +1800,11 @@
           surf_def_h(l)%gtsws = 0.0_wp
        ENDDO
-!--    Horizontal surfaces: natural type
-       ALLOCATE( surf_lsm_h%gtsws( 1:surf_lsm_h%ns, ngases_salsa ) )
-       surf_lsm_h%gtsws = 0.0_wp
-!--    Horizontal surfaces: urban type
-       ALLOCATE( surf_usm_h%gtsws( 1:surf_usm_h%ns, ngases_salsa ) )
-       surf_usm_h%gtsws = 0.0_wp
+!--    Horizontal surfaces: natural and urban type
+       DO l = 0, 1
+          ALLOCATE( surf_lsm_h(l)%gtsws( 1:surf_lsm_h(l)%ns, ngases_salsa ) )
+          surf_lsm_h(l)%gtsws = 0.0_wp
+          ALLOCATE( surf_usm_h(l)%gtsws( 1:surf_usm_h(l)%ns, ngases_salsa ) )
+          surf_usm_h(l)%gtsws = 0.0_wp
+       ENDDO
 !
 !--    Vertical surfaces: northward (l=0), southward (l=1), eastward (l=2) and 
@@ -2747,12 +2751,14 @@
     IF ( nldepo_surf  .AND.  land_surface )  THEN
        match_lsm = .TRUE.
-       ALLOCATE( lsm_to_depo_h%match_lupg(1:surf_lsm_h%ns),                                         &
-                 lsm_to_depo_h%match_luvw(1:surf_lsm_h%ns),                                         &
-                 lsm_to_depo_h%match_luww(1:surf_lsm_h%ns) )
-       lsm_to_depo_h%match_lupg = 0
-       lsm_to_depo_h%match_luvw = 0
-       lsm_to_depo_h%match_luww = 0
-       CALL match_sm_zhang( surf_lsm_h, lsm_to_depo_h%match_lupg, lsm_to_depo_h%match_luvw,        &
-                            lsm_to_depo_h%match_luww, match_lsm )
+       DO l = 0, 1
+          ALLOCATE( lsm_to_depo_h(l)%match_lupg(1:surf_lsm_h(l)%ns),                               &
+                    lsm_to_depo_h(l)%match_luvw(1:surf_lsm_h(l)%ns),                               &
+                    lsm_to_depo_h(l)%match_luww(1:surf_lsm_h(l)%ns) )
+          lsm_to_depo_h(l)%match_lupg = 0
+          lsm_to_depo_h(l)%match_luvw = 0
+          lsm_to_depo_h(l)%match_luww = 0
+          CALL match_sm_zhang( surf_lsm_h(l), lsm_to_depo_h(l)%match_lupg,                         &
+                               lsm_to_depo_h(l)%match_luvw, lsm_to_depo_h(l)%match_luww, match_lsm )
+       ENDDO
        DO  l = 0, 3
           ALLOCATE( lsm_to_depo_v(l)%match_lupg(1:surf_lsm_v(l)%ns),                               &
@@ -2770,12 +2776,14 @@
     IF ( nldepo_surf  .AND.  urban_surface )  THEN
        match_lsm = .FALSE.
-       ALLOCATE( usm_to_depo_h%match_lupg(1:surf_usm_h%ns),                                        &
-                 usm_to_depo_h%match_luvw(1:surf_usm_h%ns),                                        &
-                 usm_to_depo_h%match_luww(1:surf_usm_h%ns) )
-       usm_to_depo_h%match_lupg = 0
-       usm_to_depo_h%match_luvw = 0
-       usm_to_depo_h%match_luww = 0
-       CALL match_sm_zhang( surf_usm_h, usm_to_depo_h%match_lupg, usm_to_depo_h%match_luvw,        &
-                            usm_to_depo_h%match_luww, match_lsm )
+       DO l = 0, 1
+          ALLOCATE( usm_to_depo_h(l)%match_lupg(1:surf_usm_h(l)%ns),                               &
+                    usm_to_depo_h(l)%match_luvw(1:surf_usm_h(l)%ns),                               &
+                    usm_to_depo_h(l)%match_luww(1:surf_usm_h(l)%ns) )
+          usm_to_depo_h(l)%match_lupg = 0
+          usm_to_depo_h(l)%match_luvw = 0
+          usm_to_depo_h(l)%match_luww = 0
+          CALL match_sm_zhang( surf_usm_h(l), usm_to_depo_h(l)%match_lupg,                         &
+                               usm_to_depo_h(l)%match_luvw, usm_to_depo_h(l)%match_luww, match_lsm )
+       ENDDO
        DO  l = 0, 3
           ALLOCATE( usm_to_depo_v(l)%match_lupg(1:surf_usm_v(l)%ns),                               &
@@ -4099,13 +4107,15 @@
           ENDDO
        ELSE
-          CALL depo_surf( i, j, surf_usm_h, vd, schmidt_num, kvis, in_u, .TRUE., usm_to_depo_h )
+          DO  l = 0, 1
+             CALL depo_surf( i, j, surf_usm_h(l), vd, schmidt_num, kvis, in_u, .TRUE., usm_to_depo_h(l) )
+          ENDDO
           DO  l = 0, 3
-             CALL depo_surf( i, j, surf_usm_v(l), vd, schmidt_num, kvis, in_u, .FALSE.,            &
-                             usm_to_depo_v(l) )
+             CALL depo_surf( i, j, surf_usm_v(l), vd, schmidt_num, kvis, in_u, .FALSE., usm_to_depo_v(l) )
           ENDDO
-          CALL depo_surf( i, j, surf_lsm_h, vd, schmidt_num, kvis, in_u, .TRUE., lsm_to_depo_h )
+          DO  l = 0, 1
+             CALL depo_surf( i, j, surf_lsm_h(l), vd, schmidt_num, kvis, in_u, .TRUE., lsm_to_depo_h(l) )
+          ENDDO
           DO  l = 0, 3
-             CALL depo_surf( i, j, surf_lsm_v(l), vd, schmidt_num, kvis, in_u, .FALSE.,            &
-                             lsm_to_depo_v(l) )
+             CALL depo_surf( i, j, surf_lsm_v(l), vd, schmidt_num, kvis, in_u, .FALSE., lsm_to_depo_v(l) )
           ENDDO
        ENDIF
@@ -8568,5 +8578,6 @@
           CALL diffusion_s( i, j, rs, surf_def_h(0)%answs(:,ib),                                   &
                                       surf_def_h(1)%answs(:,ib), surf_def_h(2)%answs(:,ib),        &
-                                      surf_lsm_h%answs(:,ib),    surf_usm_h%answs(:,ib),           &
+                                      surf_lsm_h(0)%answs(:,ib), surf_lsm_h(1)%answs(:,ib),        &
+                                      surf_usm_h(0)%answs(:,ib), surf_usm_h(1)%answs(:,ib),        &
                                       surf_def_v(0)%answs(:,ib), surf_def_v(1)%answs(:,ib),        &
                                       surf_def_v(2)%answs(:,ib), surf_def_v(3)%answs(:,ib),        &
@@ -8578,5 +8589,6 @@
           CALL diffusion_s( i, j, rs, surf_def_h(0)%amsws(:,icc),                                  &
                                       surf_def_h(1)%amsws(:,icc), surf_def_h(2)%amsws(:,icc),      &
-                                      surf_lsm_h%amsws(:,icc),    surf_usm_h%amsws(:,icc),         &
+                                      surf_lsm_h(0)%amsws(:,icc), surf_lsm_h(1)%amsws(:,icc),      &
+                                      surf_usm_h(0)%amsws(:,icc), surf_usm_h(1)%amsws(:,icc),      &
                                       surf_def_v(0)%amsws(:,icc), surf_def_v(1)%amsws(:,icc),      &
                                       surf_def_v(2)%amsws(:,icc), surf_def_v(3)%amsws(:,icc),      &
@@ -8588,5 +8600,6 @@
           CALL diffusion_s( i, j, rs, surf_def_h(0)%gtsws(:,ib),                                   &
                                       surf_def_h(1)%gtsws(:,ib), surf_def_h(2)%gtsws(:,ib),        &
-                                      surf_lsm_h%gtsws(:,ib), surf_usm_h%gtsws(:,ib),              &
+                                      surf_lsm_h(0)%gtsws(:,ib), surf_lsm_h(1)%gtsws(:,ib),        &
+                                      surf_usm_h(0)%gtsws(:,ib), surf_usm_h(1)%gtsws(:,ib),        &
                                       surf_def_v(0)%gtsws(:,ib), surf_def_v(1)%gtsws(:,ib),        &
                                       surf_def_v(2)%gtsws(:,ib), surf_def_v(3)%gtsws(:,ib),        &
@@ -8703,5 +8716,6 @@
           CALL diffusion_s( rs, surf_def_h(0)%answs(:,ib),                                         &
                                 surf_def_h(1)%answs(:,ib), surf_def_h(2)%answs(:,ib),              &
-                                surf_lsm_h%answs(:,ib),    surf_usm_h%answs(:,ib),                 &
+                                surf_lsm_h(0)%answs(:,ib), surf_lsm_h(1)%answs(:,ib),              &
+                                surf_usm_h(0)%answs(:,ib), surf_usm_h(1)%answs(:,ib),              &
                                 surf_def_v(0)%answs(:,ib), surf_def_v(1)%answs(:,ib),              &
                                 surf_def_v(2)%answs(:,ib), surf_def_v(3)%answs(:,ib),              &
@@ -8713,5 +8727,6 @@
           CALL diffusion_s( rs, surf_def_h(0)%amsws(:,icc),                                        &
                                 surf_def_h(1)%amsws(:,icc), surf_def_h(2)%amsws(:,icc),            &
-                                surf_lsm_h%amsws(:,icc),    surf_usm_h%amsws(:,icc),               &
+                                surf_lsm_h(0)%amsws(:,icc), surf_lsm_h(1)%amsws(:,icc),            &
+                                surf_usm_h(0)%amsws(:,icc), surf_usm_h(1)%amsws(:,icc),            &
                                 surf_def_v(0)%amsws(:,icc), surf_def_v(1)%amsws(:,icc),            &
                                 surf_def_v(2)%amsws(:,icc), surf_def_v(3)%amsws(:,icc),            &
@@ -8723,5 +8738,6 @@
           CALL diffusion_s( rs, surf_def_h(0)%gtsws(:,ib),                                         &
                                 surf_def_h(1)%gtsws(:,ib), surf_def_h(2)%gtsws(:,ib),              &
-                                surf_lsm_h%gtsws(:,ib),    surf_usm_h%gtsws(:,ib),                 &
+                                surf_lsm_h(0)%gtsws(:,ib), surf_lsm_h(1)%gtsws(:,ib),              &
+                                surf_usm_h(0)%gtsws(:,ib), surf_usm_h(1)%gtsws(:,ib),              &
                                 surf_def_v(0)%gtsws(:,ib), surf_def_v(1)%gtsws(:,ib),              &
                                 surf_def_v(2)%gtsws(:,ib), surf_def_v(3)%gtsws(:,ib),              &
@@ -9641,5 +9657,5 @@
 !
 !--             Set fluxes normalised based on the street type on land surfaces
-                CALL set_flux( surf_lsm_h, cc_i2m, aerosol_flux_mass_fracs_a, source_array )
+                CALL set_flux( surf_lsm_h(0), cc_i2m, aerosol_flux_mass_fracs_a, source_array )
              ENDIF
 
@@ -9652,8 +9668,8 @@
           surf_def_h(0)%answs = 0.0_wp
           surf_def_h(0)%amsws = 0.0_wp
-          surf_lsm_h%answs = 0.0_wp
-          surf_lsm_h%amsws = 0.0_wp
-          surf_usm_h%answs = 0.0_wp
-          surf_usm_h%amsws = 0.0_wp
+          surf_lsm_h(0)%answs = 0.0_wp
+          surf_lsm_h(0)%amsws = 0.0_wp
+          surf_usm_h(0)%answs = 0.0_wp
+          surf_usm_h(0)%amsws = 0.0_wp
 
 !
@@ -10025,7 +10041,7 @@
                                   aero_emission%mass_fracs(in,:), source_array )
                 ELSE
-                   CALL set_flux( surf_usm_h, aero_emission_att%cc_in2mod,                         &
+                   CALL set_flux( surf_usm_h(0), aero_emission_att%cc_in2mod,                      &
                                   aero_emission%mass_fracs(in,:), source_array )
-                   CALL set_flux( surf_lsm_h, aero_emission_att%cc_in2mod,                         &
+                   CALL set_flux( surf_lsm_h(0), aero_emission_att%cc_in2mod,                      &
                                   aero_emission%mass_fracs(in,:), source_array )
                 ENDIF
@@ -10068,7 +10084,7 @@
                                   aero_emission%mass_fracs(in,:), source_array )
                 ELSE
-                   CALL set_flux( surf_usm_h, aero_emission_att%cc_in2mod,                         &
+                   CALL set_flux( surf_usm_h(0), aero_emission_att%cc_in2mod,                      &
                                   aero_emission%mass_fracs(in,:), source_array )
-                   CALL set_flux( surf_lsm_h, aero_emission_att%cc_in2mod,                         &
+                   CALL set_flux( surf_lsm_h(0), aero_emission_att%cc_in2mod,                      &
                                   aero_emission%mass_fracs(in,:), source_array )
                 ENDIF
@@ -10340,6 +10356,6 @@
 !-- Reset surface fluxes
     surf_def_h(0)%gtsws = 0.0_wp
-    surf_lsm_h%gtsws = 0.0_wp
-    surf_usm_h%gtsws = 0.0_wp
+    surf_lsm_h(0)%gtsws = 0.0_wp
+    surf_usm_h(0)%gtsws = 0.0_wp
 
 #if defined( __netcdf )
@@ -10534,7 +10550,7 @@
                                 dum_var_3d, time_factor(in) )
           ELSE
-             CALL set_gas_flux( surf_usm_h, emission_index_chem, chem_emission_att%units,       &
+             CALL set_gas_flux( surf_usm_h(0), emission_index_chem, chem_emission_att%units,    &
                                 dum_var_3d, time_factor(in) )
-             CALL set_gas_flux( surf_lsm_h, emission_index_chem, chem_emission_att%units,       &
+             CALL set_gas_flux( surf_lsm_h(0), emission_index_chem, chem_emission_att%units,    &
                                 dum_var_3d, time_factor(in) )
           ENDIF
@@ -10565,7 +10581,7 @@
                              dum_var_5d(1,1,:,:,:) )
        ELSE
-          CALL set_gas_flux( surf_usm_h, emission_index_chem, chem_emission_att%units,             &
+          CALL set_gas_flux( surf_usm_h(0), emission_index_chem, chem_emission_att%units,          &
                              dum_var_5d(1,1,:,:,:) )
-          CALL set_gas_flux( surf_lsm_h, emission_index_chem, chem_emission_att%units,             &
+          CALL set_gas_flux( surf_lsm_h(0), emission_index_chem, chem_emission_att%units,          &
                              dum_var_5d(1,1,:,:,:) )
        ENDIF
Index: palm/trunk/SOURCE/sum_up_3d_data.f90
===================================================================
--- palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 4670)
+++ palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4591 2020-07-06 15:56:08Z raasch
 ! File re-formatted to follow the PALM coding standard
 !
@@ -441,6 +444,6 @@
 !
 !--                   Check whether grid point is a natural- or urban-type surface.
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 !
 !--                   In order to avoid double-counting of surface properties, always assume that
@@ -449,14 +452,14 @@
 !--                   would be visible from above
                       IF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         ghf_av(j,i) = ghf_av(j,i) + surf_lsm_h%ghf(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         ghf_av(j,i) = ghf_av(j,i) + 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)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         ghf_av(j,i) = ghf_av(j,i) + surf_lsm_h(0)%ghf(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         ghf_av(j,i) = ghf_av(j,i) + surf_usm_h(0)%frac(m,ind_veg_wall)  *            &
+                                                     surf_usm_h(0)%wghf_eb(m)        +                &
+                                                     surf_usm_h(0)%frac(m,ind_pav_green) *            &
+                                                     surf_usm_h(0)%wghf_eb_green(m)  +                &
+                                                     surf_usm_h(0)%frac(m,ind_wat_win)   *            &
+                                                     surf_usm_h(0)%wghf_eb_window(m)
                       ENDIF
                    ENDDO
@@ -501,6 +504,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -508,9 +511,9 @@
                          ol_av(j,i) = ol_av(j,i) + surf_def_h(0)%ol(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         ol_av(j,i) = ol_av(j,i) + surf_lsm_h%ol(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         ol_av(j,i) = ol_av(j,i) + surf_usm_h%ol(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         ol_av(j,i) = ol_av(j,i) + surf_lsm_h(0)%ol(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         ol_av(j,i) = ol_av(j,i) + surf_usm_h(0)%ol(m)
                       ENDIF
                    ENDDO
@@ -659,6 +662,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -666,9 +669,9 @@
                          qsurf_av(j,i) = qsurf_av(j,i) + surf_def_h(0)%q_surface(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         qsurf_av(j,i) = qsurf_av(j,i) + surf_lsm_h%q_surface(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         qsurf_av(j,i) = qsurf_av(j,i) + surf_usm_h%q_surface(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         qsurf_av(j,i) = qsurf_av(j,i) + surf_lsm_h(0)%q_surface(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         qsurf_av(j,i) = qsurf_av(j,i) + surf_usm_h(0)%q_surface(m)
                       ENDIF
                    ENDDO
@@ -685,6 +688,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -693,9 +696,9 @@
                                         waterflux_output_conversion(nzb)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         qsws_av(j,i) = qsws_av(j,i) + surf_lsm_h%qsws(m) * l_v
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         qsws_av(j,i) = qsws_av(j,i) + surf_lsm_h(0)%qsws(m) * l_v
                       ELSEIF ( match_usm  .AND.  .NOT. match_lsm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         qsws_av(j,i) = qsws_av(j,i) + surf_usm_h%qsws(m) * l_v
+                         m = surf_usm_h(0)%end_index(j,i)
+                         qsws_av(j,i) = qsws_av(j,i) + surf_usm_h(0)%qsws(m) * l_v
                       ENDIF
                    ENDDO
@@ -718,18 +721,18 @@
                 DO  i = nxl, nxr
                    DO  j = nys, nyn
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         r_a_av(j,i) = r_a_av(j,i) + surf_lsm_h%r_a(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         r_a_av(j,i) = r_a_av(j,i) + surf_usm_h%frac(m,ind_veg_wall)  *            &
-                                                     surf_usm_h%r_a(m)       +                     &
-                                                     surf_usm_h%frac(m,ind_pav_green) *            &
-                                                     surf_usm_h%r_a_green(m) +                     &
-                                                     surf_usm_h%frac(m,ind_wat_win)   *            &
-                                                     surf_usm_h%r_a_window(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         r_a_av(j,i) = r_a_av(j,i) + surf_lsm_h(0)%r_a(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         r_a_av(j,i) = r_a_av(j,i) + surf_usm_h(0)%frac(m,ind_veg_wall)  *            &
+                                                     surf_usm_h(0)%r_a(m)       +                     &
+                                                     surf_usm_h(0)%frac(m,ind_pav_green) *            &
+                                                     surf_usm_h(0)%r_a_green(m) +                     &
+                                                     surf_usm_h(0)%frac(m,ind_wat_win)   *            &
+                                                     surf_usm_h(0)%r_a_window(m)
                       ENDIF
                    ENDDO
@@ -756,6 +759,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -764,9 +767,9 @@
                                        heatflux_output_conversion(nzb)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         shf_av(j,i) = shf_av(j,i) + surf_lsm_h%shf(m) * c_p
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         shf_av(j,i) = shf_av(j,i) + surf_usm_h%shf(m) * c_p
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         shf_av(j,i) = shf_av(j,i) + surf_lsm_h(0)%shf(m) * c_p
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         shf_av(j,i) = shf_av(j,i) + surf_usm_h(0)%shf(m) * c_p
                       ENDIF
                    ENDDO
@@ -789,6 +792,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -796,9 +799,9 @@
                          ssws_av(j,i) = ssws_av(j,i) + surf_def_h(0)%ssws(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         ssws_av(j,i) = ssws_av(j,i) + surf_lsm_h%ssws(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         ssws_av(j,i) = ssws_av(j,i) + surf_usm_h%ssws(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         ssws_av(j,i) = ssws_av(j,i) + surf_lsm_h(0)%ssws(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         ssws_av(j,i) = ssws_av(j,i) + surf_usm_h(0)%ssws(m)
                       ENDIF
                    ENDDO
@@ -811,6 +814,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -818,9 +821,9 @@
                          ts_av(j,i) = ts_av(j,i) + surf_def_h(0)%ts(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         ts_av(j,i) = ts_av(j,i) + surf_lsm_h%ts(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         ts_av(j,i) = ts_av(j,i) + surf_usm_h%ts(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         ts_av(j,i) = ts_av(j,i) + surf_lsm_h(0)%ts(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         ts_av(j,i) = ts_av(j,i) + surf_usm_h(0)%ts(m)
                       ENDIF
                    ENDDO
@@ -833,6 +836,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -840,9 +843,9 @@
                          tsurf_av(j,i) = tsurf_av(j,i) + surf_def_h(0)%pt_surface(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         tsurf_av(j,i) = tsurf_av(j,i) + surf_lsm_h%pt_surface(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         tsurf_av(j,i) = tsurf_av(j,i) + surf_usm_h%pt_surface(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         tsurf_av(j,i) = tsurf_av(j,i) + surf_lsm_h(0)%pt_surface(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         tsurf_av(j,i) = tsurf_av(j,i) + surf_usm_h(0)%pt_surface(m)
                       ENDIF
                    ENDDO
@@ -866,6 +869,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -873,9 +876,9 @@
                          us_av(j,i) = us_av(j,i) + surf_def_h(0)%us(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         us_av(j,i) = us_av(j,i) + surf_lsm_h%us(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         us_av(j,i) = us_av(j,i) + surf_usm_h%us(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         us_av(j,i) = us_av(j,i) + surf_lsm_h(0)%us(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         us_av(j,i) = us_av(j,i) + surf_usm_h(0)%us(m)
                       ENDIF
                    ENDDO
@@ -921,6 +924,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -928,9 +931,9 @@
                          z0_av(j,i) = z0_av(j,i) + surf_def_h(0)%z0(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         z0_av(j,i) = z0_av(j,i) + surf_lsm_h%z0(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         z0_av(j,i) = z0_av(j,i) + surf_usm_h%z0(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         z0_av(j,i) = z0_av(j,i) + surf_lsm_h(0)%z0(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         z0_av(j,i) = z0_av(j,i) + surf_usm_h(0)%z0(m)
                       ENDIF
                    ENDDO
@@ -943,6 +946,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -950,9 +953,9 @@
                          z0h_av(j,i) = z0h_av(j,i) + surf_def_h(0)%z0h(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         z0h_av(j,i) = z0h_av(j,i) + surf_lsm_h%z0h(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         z0h_av(j,i) = z0h_av(j,i) + surf_usm_h%z0h(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         z0h_av(j,i) = z0h_av(j,i) + surf_lsm_h(0)%z0h(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         z0h_av(j,i) = z0h_av(j,i) + surf_usm_h(0)%z0h(m)
                       ENDIF
                    ENDDO
@@ -965,6 +968,6 @@
                    DO  j = nys, nyn
                       match_def = surf_def_h(0)%start_index(j,i) <= surf_def_h(0)%end_index(j,i)
-                      match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                      match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                      match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                      match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                       IF ( match_def )  THEN
@@ -972,9 +975,9 @@
                          z0q_av(j,i) = z0q_av(j,i) + surf_def_h(0)%z0q(m)
                       ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
-                         m = surf_lsm_h%end_index(j,i)
-                         z0q_av(j,i) = z0q_av(j,i) + surf_lsm_h%z0q(m)
-                      ELSEIF ( match_usm )  THEN
-                         m = surf_usm_h%end_index(j,i)
-                         z0q_av(j,i) = z0q_av(j,i) + surf_usm_h%z0q(m)
+                         m = surf_lsm_h(0)%end_index(j,i)
+                         z0q_av(j,i) = z0q_av(j,i) + surf_lsm_h(0)%z0q(m)
+                      ELSEIF ( match_usm )  THEN
+                         m = surf_usm_h(0)%end_index(j,i)
+                         z0q_av(j,i) = z0q_av(j,i) + surf_usm_h(0)%z0q(m)
                       ENDIF
                    ENDDO
Index: palm/trunk/SOURCE/surface_coupler.f90
===================================================================
--- palm/trunk/SOURCE/surface_coupler.f90	(revision 4670)
+++ palm/trunk/SOURCE/surface_coupler.f90	(revision 4671)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4429 2020-02-27 15:24:30Z raasch
 ! bugfix: preprocessor directives rearranged for serial mode
 ! 
@@ -168,6 +171,6 @@
 !--       Send heat flux at bottom surface to the ocean. First, transfer from 
 !--       1D surface type to 2D grid.
-          CALL transfer_1D_to_2D_equal( surf_def_h(0)%shf, surf_lsm_h%shf,     &
-                                        surf_usm_h%shf )
+          CALL transfer_1D_to_2D_equal( surf_def_h(0)%shf, surf_lsm_h(0)%shf,     &
+                                        surf_usm_h(0)%shf )
           CALL MPI_SEND( surface_flux(nysg,nxlg), ngp_xy, MPI_REAL, target_id, &
                          12, comm_inter, ierr )
@@ -175,6 +178,6 @@
 !--       Send humidity flux at bottom surface to the ocean. First, transfer
 !--       from 1D surface type to 2D grid.
-          CALL transfer_1D_to_2D_equal( surf_def_h(0)%qsws, surf_lsm_h%qsws,   &
-                                        surf_usm_h%qsws )
+          CALL transfer_1D_to_2D_equal( surf_def_h(0)%qsws, surf_lsm_h(0)%qsws,   &
+                                        surf_usm_h(0)%qsws )
           IF ( humidity )  THEN
              CALL MPI_SEND( surface_flux(nysg,nxlg), ngp_xy, MPI_REAL,         &
@@ -188,6 +191,6 @@
 !--       Send the momentum flux (u) at bottom surface to the ocean. First, 
 !--       transfer from 1D surface type to 2D grid.
-          CALL transfer_1D_to_2D_equal( surf_def_h(0)%usws, surf_lsm_h%usws,   &
-                                        surf_usm_h%usws )
+          CALL transfer_1D_to_2D_equal( surf_def_h(0)%usws, surf_lsm_h(0)%usws,   &
+                                        surf_usm_h(0)%usws )
           CALL MPI_SEND( surface_flux(nysg,nxlg), ngp_xy, MPI_REAL, target_id, &
                          15, comm_inter, ierr )
@@ -195,6 +198,6 @@
 !--       Send the momentum flux (v) at bottom surface to the ocean. First, 
 !--       transfer from 1D surface type to 2D grid.
-          CALL transfer_1D_to_2D_equal( surf_def_h(0)%vsws, surf_lsm_h%vsws,   &
-                                        surf_usm_h%vsws )
+          CALL transfer_1D_to_2D_equal( surf_def_h(0)%vsws, surf_lsm_h(0)%vsws,   &
+                                        surf_usm_h(0)%vsws )
           CALL MPI_SEND( surface_flux(nysg,nxlg), ngp_xy, MPI_REAL, target_id, &
                          16, comm_inter, ierr )
@@ -218,6 +221,6 @@
 !
 !--       Transfer from 1D surface type to 2D grid.
-          CALL transfer_1D_to_2D_unequal( surf_def_h(0)%shf, surf_lsm_h%shf,   &
-                                          surf_usm_h%shf )
+          CALL transfer_1D_to_2D_unequal( surf_def_h(0)%shf, surf_lsm_h(0)%shf,   &
+                                          surf_usm_h(0)%shf )
 
           CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0,  &
@@ -232,6 +235,6 @@
 !--          Transfer from 1D surface type to 2D grid.
              CALL transfer_1D_to_2D_unequal( surf_def_h(0)%qsws,              &
-                                             surf_lsm_h%qsws,                 &
-                                             surf_usm_h%qsws )
+                                             surf_lsm_h(0)%qsws,                 &
+                                             surf_usm_h(0)%qsws )
 
              CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, &
@@ -255,6 +258,6 @@
 !
 !--       Transfer from 1D surface type to 2D grid.
-          CALL transfer_1D_to_2D_unequal( surf_def_h(0)%usws, surf_lsm_h%usws, &
-                                          surf_usm_h%usws )
+          CALL transfer_1D_to_2D_unequal( surf_def_h(0)%usws, surf_lsm_h(0)%usws, &
+                                          surf_usm_h(0)%usws )
           CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0, &
                            comm2d, ierr )
@@ -266,6 +269,6 @@
 !
 !--       Transfer from 1D surface type to 2D grid.
-          CALL transfer_1D_to_2D_unequal( surf_def_h(0)%usws, surf_lsm_h%usws, &
-                                          surf_usm_h%usws )
+          CALL transfer_1D_to_2D_unequal( surf_def_h(0)%usws, surf_lsm_h(0)%usws, &
+                                          surf_usm_h(0)%usws )
           CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0, &
                            comm2d, ierr )
@@ -473,6 +476,6 @@
 
             REAL(wp), DIMENSION(1:surf_def_h(0)%ns) ::  def_1d !< 1D surface flux, default surfaces
-            REAL(wp), DIMENSION(1:surf_lsm_h%ns)    ::  lsm_1d !< 1D surface flux, natural surfaces
-            REAL(wp), DIMENSION(1:surf_usm_h%ns)    ::  usm_1d !< 1D surface flux, urban surfaces
+            REAL(wp), DIMENSION(1:surf_lsm_h(0)%ns) ::  lsm_1d !< 1D surface flux, natural surfaces
+            REAL(wp), DIMENSION(1:surf_usm_h(0)%ns) ::  usm_1d !< 1D surface flux, urban surfaces
 !
 !--         Transfer surface flux at default surfaces to 2D grid 
@@ -486,6 +489,6 @@
             IF ( land_surface )  THEN 
                DO  m = 1, SIZE(lsm_1d)
-                  i = surf_lsm_h%i(m)
-                  j = surf_lsm_h%j(m)
+                  i = surf_lsm_h(0)%i(m)
+                  j = surf_lsm_h(0)%j(m)
                   surface_flux(j,i) = lsm_1d(m)
                ENDDO
@@ -495,6 +498,6 @@
             IF ( urban_surface )  THEN 
                DO  m = 1, SIZE(usm_1d)
-                  i = surf_usm_h%i(m)
-                  j = surf_usm_h%j(m)
+                  i = surf_usm_h(0)%i(m)
+                  j = surf_usm_h(0)%j(m)
                   surface_flux(j,i) = usm_1d(m)
                ENDDO
@@ -541,6 +544,6 @@
 
             REAL(wp), DIMENSION(1:surf_def_h(0)%ns) ::  def_1d !< 1D surface flux, default surfaces
-            REAL(wp), DIMENSION(1:surf_lsm_h%ns)    ::  lsm_1d !< 1D surface flux, natural surfaces
-            REAL(wp), DIMENSION(1:surf_usm_h%ns)    ::  usm_1d !< 1D surface flux, urban surfaces
+            REAL(wp), DIMENSION(1:surf_lsm_h(0)%ns)    ::  lsm_1d !< 1D surface flux, natural surfaces
+            REAL(wp), DIMENSION(1:surf_usm_h(0)%ns)    ::  usm_1d !< 1D surface flux, urban surfaces
 !
 !--         Transfer surface flux at default surfaces to 2D grid. Transfer no
@@ -559,6 +562,6 @@
             IF ( land_surface )  THEN 
                DO  m = 1, SIZE(lsm_1d)
-                  i = surf_lsm_h%i(m)
-                  j = surf_lsm_h%j(m)
+                  i = surf_lsm_h(0)%i(m)
+                  j = surf_lsm_h(0)%j(m)
 
                   IF ( i >= nxl  .AND.  i <= nxr  .AND.                        &
@@ -572,6 +575,6 @@
             IF ( urban_surface )  THEN 
                DO  m = 1, SIZE(usm_1d)
-                  i = surf_usm_h%i(m)
-                  j = surf_usm_h%j(m)
+                  i = surf_usm_h(0)%i(m)
+                  j = surf_usm_h(0)%j(m)
 
                   IF ( i >= nxl  .AND.  i <= nxr  .AND.                        &
Index: palm/trunk/SOURCE/surface_data_output_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4601 2020-07-14 12:06:09Z suehring
 ! Minor simplification in name creation for IO variables in restart files.
 !
@@ -372,6 +375,6 @@
 !
 !-- Determine the number of surface elements on subdomain
-    surfaces%ns = surf_def_h(0)%ns + surf_lsm_h%ns + surf_usm_h%ns           & !horizontal upward-facing
-                + surf_def_h(1)%ns                                           & !horizontal downard-facing
+    surfaces%ns = surf_def_h(0)%ns + surf_lsm_h(0)%ns + surf_usm_h(0)%ns     & !horizontal upward-facing
+                + surf_def_h(1)%ns + surf_lsm_h(1)%ns + surf_usm_h(1)%ns     & !horizontal downard-facing
                 + surf_def_v(0)%ns + surf_lsm_v(0)%ns + surf_usm_v(0)%ns     & !northward-facing
                 + surf_def_v(1)%ns + surf_lsm_v(1)%ns + surf_usm_v(1)%ns     & !southward-facing
@@ -474,48 +477,48 @@
              ENDIF
           ENDDO
-       ENDDO
-       DO  m = 1, surf_lsm_h%ns
-          i = surf_lsm_h%i(m) + surf_lsm_h%ioff
-          j = surf_lsm_h%j(m) + surf_lsm_h%joff
-          k = surf_lsm_h%k(m) + surf_lsm_h%koff
-
-          IF ( point_index(k,j,i) < 0 )  THEN
-             surfaces%npoints   = surfaces%npoints + 1
-             point_index(k,j,i) = surfaces%npoints - 1
-          ENDIF
-          IF ( point_index(k,j,i+1) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j,i+1) = surfaces%npoints - 1
-          ENDIF
-          IF ( point_index(k,j+1,i+1) < 0 )  THEN
-             surfaces%npoints       = surfaces%npoints + 1
-             point_index(k,j+1,i+1) = surfaces%npoints - 1
-          ENDIF
-          IF ( point_index(k,j+1,i) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j+1,i) = surfaces%npoints - 1
-          ENDIF
-       ENDDO
-       DO  m = 1, surf_usm_h%ns
-          i = surf_usm_h%i(m) + surf_usm_h%ioff
-          j = surf_usm_h%j(m) + surf_usm_h%joff
-          k = surf_usm_h%k(m) + surf_usm_h%koff
-
-          IF ( point_index(k,j,i) < 0 )  THEN
-             surfaces%npoints   = surfaces%npoints + 1
-             point_index(k,j,i) = surfaces%npoints - 1
-          ENDIF
-          IF ( point_index(k,j,i+1) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j,i+1) = surfaces%npoints - 1
-          ENDIF
-          IF ( point_index(k,j+1,i+1) < 0 )  THEN
-             surfaces%npoints       = surfaces%npoints + 1
-             point_index(k,j+1,i+1) = surfaces%npoints - 1
-          ENDIF
-          IF ( point_index(k,j+1,i) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j+1,i) = surfaces%npoints - 1
-          ENDIF
+          DO  m = 1, surf_lsm_h(l)%ns
+             i = surf_lsm_h(l)%i(m) + surf_lsm_h(l)%ioff
+             j = surf_lsm_h(l)%j(m) + surf_lsm_h(l)%joff
+             k = surf_lsm_h(l)%k(m) + surf_lsm_h(l)%koff
+
+             IF ( point_index(k,j,i) < 0 )  THEN
+                surfaces%npoints   = surfaces%npoints + 1
+                point_index(k,j,i) = surfaces%npoints - 1
+             ENDIF
+             IF ( point_index(k,j,i+1) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j,i+1) = surfaces%npoints - 1
+             ENDIF
+             IF ( point_index(k,j+1,i+1) < 0 )  THEN
+                surfaces%npoints       = surfaces%npoints + 1
+                point_index(k,j+1,i+1) = surfaces%npoints - 1
+             ENDIF
+             IF ( point_index(k,j+1,i) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j+1,i) = surfaces%npoints - 1
+             ENDIF
+          ENDDO
+          DO  m = 1, surf_usm_h(l)%ns
+             i = surf_usm_h(l)%i(m) + surf_usm_h(l)%ioff
+             j = surf_usm_h(l)%j(m) + surf_usm_h(l)%joff
+             k = surf_usm_h(l)%k(m) + surf_usm_h(l)%koff
+
+             IF ( point_index(k,j,i) < 0 )  THEN
+                surfaces%npoints   = surfaces%npoints + 1
+                point_index(k,j,i) = surfaces%npoints - 1
+             ENDIF
+             IF ( point_index(k,j,i+1) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j,i+1) = surfaces%npoints - 1
+             ENDIF
+             IF ( point_index(k,j+1,i+1) < 0 )  THEN
+                surfaces%npoints       = surfaces%npoints + 1
+                point_index(k,j+1,i+1) = surfaces%npoints - 1
+             ENDIF
+             IF ( point_index(k,j+1,i) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j+1,i) = surfaces%npoints - 1
+             ENDIF
+          ENDDO
        ENDDO
 !
@@ -731,94 +734,94 @@
              surfaces%polygons(5,npg)   = point_index(k,j+1,i)
           ENDDO
-       ENDDO
-       DO  m = 1, surf_lsm_h%ns
-          i = surf_lsm_h%i(m) + surf_lsm_h%ioff
-          j = surf_lsm_h%j(m) + surf_lsm_h%joff
-          k = surf_lsm_h%k(m) + surf_lsm_h%koff
-          IF ( point_index(k,j,i) < 0 )  THEN
-             surfaces%npoints   = surfaces%npoints + 1
-             point_index(k,j,i) = point_index_count
-             point_index_count  = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-          IF ( point_index(k,j,i+1) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j,i+1) = point_index_count
-             point_index_count    = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j     - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-          IF ( point_index(k,j+1,i+1) < 0 )  THEN
-             surfaces%npoints       = surfaces%npoints + 1
-             point_index(k,j+1,i+1) = point_index_count
-             point_index_count      = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-          IF ( point_index(k,j+1,i) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j+1,i) = point_index_count
-             point_index_count    = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i     - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-
-          npg                        = npg + 1
-          surfaces%polygons(1,npg)   = 4
-          surfaces%polygons(2,npg)   = point_index(k,j,i)
-          surfaces%polygons(3,npg)   = point_index(k,j,i+1)
-          surfaces%polygons(4,npg)   = point_index(k,j+1,i+1)
-          surfaces%polygons(5,npg)   = point_index(k,j+1,i)
-       ENDDO
-
-       DO  m = 1, surf_usm_h%ns
-          i = surf_usm_h%i(m) + surf_usm_h%ioff
-          j = surf_usm_h%j(m) + surf_usm_h%joff
-          k = surf_usm_h%k(m) + surf_usm_h%koff
-
-          IF ( point_index(k,j,i) < 0 )  THEN
-             surfaces%npoints   = surfaces%npoints + 1
-             point_index(k,j,i) = point_index_count
-             point_index_count  = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-          IF ( point_index(k,j,i+1) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j,i+1) = point_index_count
-             point_index_count    = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j     - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-          IF ( point_index(k,j+1,i+1) < 0 )  THEN
-             surfaces%npoints       = surfaces%npoints + 1
-             point_index(k,j+1,i+1) = point_index_count
-             point_index_count      = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-          IF ( point_index(k,j+1,i) < 0 )  THEN
-             surfaces%npoints     = surfaces%npoints + 1
-             point_index(k,j+1,i) = point_index_count
-             point_index_count    = point_index_count + 1
-             surfaces%points(1,surfaces%npoints) = ( i     - 0.5_wp ) * dx
-             surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
-             surfaces%points(3,surfaces%npoints) = zw(k)
-          ENDIF
-
-          npg                        = npg + 1
-          surfaces%polygons(1,npg)   = 4
-          surfaces%polygons(2,npg)   = point_index(k,j,i)
-          surfaces%polygons(3,npg)   = point_index(k,j,i+1)
-          surfaces%polygons(4,npg)   = point_index(k,j+1,i+1)
-          surfaces%polygons(5,npg)   = point_index(k,j+1,i)
+          DO  m = 1, surf_lsm_h(l)%ns
+             i = surf_lsm_h(l)%i(m) + surf_lsm_h(l)%ioff
+             j = surf_lsm_h(l)%j(m) + surf_lsm_h(l)%joff
+             k = surf_lsm_h(l)%k(m) + surf_lsm_h(l)%koff
+             IF ( point_index(k,j,i) < 0 )  THEN
+                surfaces%npoints   = surfaces%npoints + 1
+                point_index(k,j,i) = point_index_count
+                point_index_count  = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+             IF ( point_index(k,j,i+1) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j,i+1) = point_index_count
+                point_index_count    = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j     - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+             IF ( point_index(k,j+1,i+1) < 0 )  THEN
+                surfaces%npoints       = surfaces%npoints + 1
+                point_index(k,j+1,i+1) = point_index_count
+                point_index_count      = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+             IF ( point_index(k,j+1,i) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j+1,i) = point_index_count
+                point_index_count    = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i     - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+
+             npg                        = npg + 1
+             surfaces%polygons(1,npg)   = 4
+             surfaces%polygons(2,npg)   = point_index(k,j,i)
+             surfaces%polygons(3,npg)   = point_index(k,j,i+1)
+             surfaces%polygons(4,npg)   = point_index(k,j+1,i+1)
+             surfaces%polygons(5,npg)   = point_index(k,j+1,i)
+          ENDDO
+
+          DO  m = 1, surf_usm_h(l)%ns
+             i = surf_usm_h(l)%i(m) + surf_usm_h(l)%ioff
+             j = surf_usm_h(l)%j(m) + surf_usm_h(l)%joff
+             k = surf_usm_h(l)%k(m) + surf_usm_h(l)%koff
+
+             IF ( point_index(k,j,i) < 0 )  THEN
+                surfaces%npoints   = surfaces%npoints + 1
+                point_index(k,j,i) = point_index_count
+                point_index_count  = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+             IF ( point_index(k,j,i+1) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j,i+1) = point_index_count
+                point_index_count    = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j     - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+             IF ( point_index(k,j+1,i+1) < 0 )  THEN
+                surfaces%npoints       = surfaces%npoints + 1
+                point_index(k,j+1,i+1) = point_index_count
+                point_index_count      = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+             IF ( point_index(k,j+1,i) < 0 )  THEN
+                surfaces%npoints     = surfaces%npoints + 1
+                point_index(k,j+1,i) = point_index_count
+                point_index_count    = point_index_count + 1
+                surfaces%points(1,surfaces%npoints) = ( i     - 0.5_wp ) * dx
+                surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy
+                surfaces%points(3,surfaces%npoints) = zw(k)
+             ENDIF
+
+             npg                        = npg + 1
+             surfaces%polygons(1,npg)   = 4
+             surfaces%polygons(2,npg)   = point_index(k,j,i)
+             surfaces%polygons(3,npg)   = point_index(k,j,i+1)
+             surfaces%polygons(4,npg)   = point_index(k,j+1,i+1)
+             surfaces%polygons(5,npg)   = point_index(k,j+1,i)
+          ENDDO
        ENDDO
 
@@ -1119,43 +1122,35 @@
         i  = start_count
         mm = 1
-        DO  m = 1, surf_def_h(0)%ns
-           surfaces%s(mm)       = i
-           surfaces%xs(mm)      = ( surf_def_h(0)%i(m) + 0.5_wp ) * dx
-           surfaces%ys(mm)      = ( surf_def_h(0)%j(m) + 0.5_wp ) * dy
-           surfaces%zs(mm)      = zw(surf_def_h(0)%k(m)+surf_def_h(0)%koff)
-           surfaces%azimuth(mm) = surfaces%fillvalue
-           surfaces%zenith(mm)  = 0.0
-           i                    = i + 1
-           mm                   = mm + 1
-        ENDDO
-        DO  m = 1, surf_lsm_h%ns
-           surfaces%s(mm)       = i
-           surfaces%xs(mm)      = ( surf_lsm_h%i(m) + 0.5_wp ) * dx
-           surfaces%ys(mm)      = ( surf_lsm_h%j(m) + 0.5_wp ) * dy
-           surfaces%zs(mm)      = zw(surf_lsm_h%k(m)+surf_lsm_h%koff)
-           surfaces%azimuth(mm) = surfaces%fillvalue
-           surfaces%zenith(mm)  = 0.0
-           i                    = i + 1
-           mm                   = mm + 1
-        ENDDO
-        DO  m = 1, surf_usm_h%ns
-           surfaces%s(mm)       = i
-           surfaces%xs(mm)      = ( surf_usm_h%i(m) + 0.5_wp ) * dx
-           surfaces%ys(mm)      = ( surf_usm_h%j(m) + 0.5_wp ) * dy
-           surfaces%zs(mm)      = zw(surf_usm_h%k(m)+surf_usm_h%koff)
-           surfaces%azimuth(mm) = surfaces%fillvalue
-           surfaces%zenith(mm)  = 0.0
-           i                    = i + 1
-           mm                   = mm + 1
-        ENDDO
-        DO  m = 1, surf_def_h(1)%ns
-           surfaces%s(mm)       = i
-           surfaces%xs(mm)      = ( surf_def_h(1)%i(m) + 0.5_wp ) * dx
-           surfaces%ys(mm)      = ( surf_def_h(1)%j(m) + 0.5_wp ) * dy
-           surfaces%zs(mm)      = zw(surf_def_h(1)%k(m)+surf_def_h(1)%koff)
-           surfaces%azimuth(mm) = surfaces%fillvalue
-           surfaces%zenith(mm)  = 180.0
-           i                    = i + 1
-           mm                   = mm + 1
+        DO l = 0, 1
+           DO  m = 1, surf_def_h(l)%ns
+              surfaces%s(mm)       = i
+              surfaces%xs(mm)      = ( surf_def_h(l)%i(m) + 0.5_wp ) * dx
+              surfaces%ys(mm)      = ( surf_def_h(l)%j(m) + 0.5_wp ) * dy
+              surfaces%zs(mm)      = zw(surf_def_h(l)%k(m)+surf_def_h(l)%koff)
+              surfaces%azimuth(mm) = surfaces%fillvalue
+              surfaces%zenith(mm)  = 180.0_wp * l
+              i                    = i + 1
+              mm                   = mm + 1
+           ENDDO
+           DO  m = 1, surf_lsm_h(l)%ns
+              surfaces%s(mm)       = i
+              surfaces%xs(mm)      = ( surf_lsm_h(l)%i(m) + 0.5_wp ) * dx
+              surfaces%ys(mm)      = ( surf_lsm_h(l)%j(m) + 0.5_wp ) * dy
+              surfaces%zs(mm)      = zw(surf_lsm_h(l)%k(m)+surf_lsm_h(l)%koff)
+              surfaces%azimuth(mm) = surfaces%fillvalue
+              surfaces%zenith(mm)  = 180.0_wp * l
+              i                    = i + 1
+              mm                   = mm + 1
+           ENDDO
+           DO  m = 1, surf_usm_h(l)%ns
+              surfaces%s(mm)       = i
+              surfaces%xs(mm)      = ( surf_usm_h(l)%i(m) + 0.5_wp ) * dx
+              surfaces%ys(mm)      = ( surf_usm_h(l)%j(m) + 0.5_wp ) * dy
+              surfaces%zs(mm)      = zw(surf_usm_h(l)%k(m)+surf_usm_h(l)%koff)
+              surfaces%azimuth(mm) = surfaces%fillvalue
+              surfaces%zenith(mm)  = 180.0_wp * l
+              i                    = i + 1
+              mm                   = mm + 1
+           ENDDO
         ENDDO
 !
@@ -1528,12 +1523,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%us, surf_def_h(1)%us,              &
-                                                  surf_lsm_h%us, surf_usm_h%us, surf_def_v(0)%us,  &
-                                                  surf_lsm_v(0)%us, surf_usm_v(0)%us,              &
-                                                  surf_def_v(1)%us, surf_lsm_v(1)%us,              &
-                                                  surf_usm_v(1)%us, surf_def_v(2)%us,              &
-                                                  surf_lsm_v(2)%us, surf_usm_v(2)%us,              &
-                                                  surf_def_v(3)%us, surf_lsm_v(3)%us,              &
-                                                  surf_usm_v(3)%us )
+                CALL surface_data_output_collect(                                  &
+                          surf_def_h(0)%us, surf_lsm_h(0)%us, surf_usm_h(0)%us,    &
+                          surf_def_h(1)%us, surf_lsm_h(1)%us, surf_usm_h(1)%us,    &
+                          surf_def_v(0)%us, surf_lsm_v(0)%us, surf_usm_v(0)%us,    &
+                          surf_def_v(1)%us, surf_lsm_v(1)%us, surf_usm_v(1)%us,    &
+                          surf_def_v(2)%us, surf_lsm_v(2)%us, surf_usm_v(2)%us,    &
+                          surf_def_v(3)%us, surf_lsm_v(3)%us, surf_usm_v(3)%us )
              ELSE
 !
@@ -1548,12 +1542,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%ts, surf_def_h(1)%ts,              &
-                                                  surf_lsm_h%ts, surf_usm_h%ts, surf_def_v(0)%ts,  &
-                                                  surf_lsm_v(0)%ts, surf_usm_v(0)%ts,              &
-                                                  surf_def_v(1)%ts, surf_lsm_v(1)%ts,              &
-                                                  surf_usm_v(1)%ts, surf_def_v(2)%ts,              &
-                                                  surf_lsm_v(2)%ts, surf_usm_v(2)%ts,              &
-                                                  surf_def_v(3)%ts, surf_lsm_v(3)%ts,              &
-                                                  surf_usm_v(3)%ts )
+                CALL surface_data_output_collect(                                   &
+                          surf_def_h(0)%ts, surf_lsm_h(0)%ts, surf_usm_h(0)%ts,    &
+                          surf_def_h(1)%ts, surf_lsm_h(1)%ts, surf_usm_h(1)%ts,    &
+                          surf_def_v(0)%ts, surf_lsm_v(0)%ts, surf_usm_v(0)%ts,    &
+                          surf_def_v(1)%ts, surf_lsm_v(1)%ts, surf_usm_v(1)%ts,    &
+                          surf_def_v(2)%ts, surf_lsm_v(2)%ts, surf_usm_v(2)%ts,    &
+                          surf_def_v(3)%ts, surf_lsm_v(3)%ts, surf_usm_v(3)%ts )
              ELSE
 !
@@ -1568,12 +1561,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qs, surf_def_h(1)%qs,              &
-                                                  surf_lsm_h%qs, surf_usm_h%qs, surf_def_v(0)%qs,  &
-                                                  surf_lsm_v(0)%qs, surf_usm_v(0)%qs,              &
-                                                  surf_def_v(1)%qs, surf_lsm_v(1)%qs,              &
-                                                  surf_usm_v(1)%qs, surf_def_v(2)%qs,              &
-                                                  surf_lsm_v(2)%qs, surf_usm_v(2)%qs,              &
-                                                  surf_def_v(3)%qs, surf_lsm_v(3)%qs,              &
-                                                  surf_usm_v(3)%qs )
+                CALL surface_data_output_collect(                                  &
+                          surf_def_h(0)%qs, surf_lsm_h(0)%qs, surf_usm_h(0)%qs,    &
+                          surf_def_h(1)%qs, surf_lsm_h(1)%qs, surf_usm_h(1)%qs,    &
+                          surf_def_v(0)%qs, surf_lsm_v(0)%qs, surf_usm_v(0)%qs,    &
+                          surf_def_v(1)%qs, surf_lsm_v(1)%qs, surf_usm_v(1)%qs,    &
+                          surf_def_v(2)%qs, surf_lsm_v(2)%qs, surf_usm_v(2)%qs,    &
+                          surf_def_v(3)%qs, surf_lsm_v(3)%qs, surf_usm_v(3)%qs )
              ELSE
 !
@@ -1588,12 +1580,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%ss, surf_def_h(1)%ss,              &
-                                                  surf_lsm_h%ss, surf_usm_h%ss, surf_def_v(0)%ss,  &
-                                                  surf_lsm_v(0)%ss, surf_usm_v(0)%ss,              &
-                                                  surf_def_v(1)%ss, surf_lsm_v(1)%ss,              &
-                                                  surf_usm_v(1)%ss, surf_def_v(2)%ss,              &
-                                                  surf_lsm_v(2)%ss, surf_usm_v(2)%ss,              &
-                                                  surf_def_v(3)%ss, surf_lsm_v(3)%ss,              &
-                                                  surf_usm_v(3)%ss )
+                CALL surface_data_output_collect(                                  &
+                          surf_def_h(0)%ss, surf_lsm_h(0)%ss, surf_usm_h(0)%ss,    &
+                          surf_def_h(1)%ss, surf_lsm_h(1)%ss, surf_usm_h(1)%ss,    &
+                          surf_def_v(0)%ss, surf_lsm_v(0)%ss, surf_usm_v(0)%ss,    &
+                          surf_def_v(1)%ss, surf_lsm_v(1)%ss, surf_usm_v(1)%ss,    &
+                          surf_def_v(2)%ss, surf_lsm_v(2)%ss, surf_usm_v(2)%ss,    &
+                          surf_def_v(3)%ss, surf_lsm_v(3)%ss, surf_usm_v(3)%ss )
              ELSE
 !
@@ -1608,12 +1599,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qcs, surf_def_h(1)%qcs,            &
-                                                  surf_lsm_h%qcs, surf_usm_h%qcs,                  &
-                                                  surf_def_v(0)%qcs, surf_lsm_v(0)%qcs,            &
-                                                  surf_usm_v(0)%qcs, surf_def_v(1)%qcs,            &
-                                                  surf_lsm_v(1)%qcs, surf_usm_v(1)%qcs,            &
-                                                  surf_def_v(2)%qcs, surf_lsm_v(2)%qcs,            &
-                                                  surf_usm_v(2)%qcs, surf_def_v(3)%qcs,            &
-                                                  surf_lsm_v(3)%qcs, surf_usm_v(3)%qcs )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%qcs, surf_lsm_h(0)%qcs, surf_usm_h(0)%qcs,    &
+                          surf_def_h(1)%qcs, surf_lsm_h(1)%qcs, surf_usm_h(1)%qcs,    &
+                          surf_def_v(0)%qcs, surf_lsm_v(0)%qcs, surf_usm_v(0)%qcs,    &
+                          surf_def_v(1)%qcs, surf_lsm_v(1)%qcs, surf_usm_v(1)%qcs,    &
+                          surf_def_v(2)%qcs, surf_lsm_v(2)%qcs, surf_usm_v(2)%qcs,    &
+                          surf_def_v(3)%qcs, surf_lsm_v(3)%qcs, surf_usm_v(3)%qcs )
              ELSE
 !
@@ -1628,12 +1618,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%ncs, surf_def_h(1)%ncs,            &
-                                                 surf_lsm_h%ncs, surf_usm_h%ncs,                   &
-                                                 surf_def_v(0)%ncs, surf_lsm_v(0)%ncs,             &
-                                                 surf_usm_v(0)%ncs, surf_def_v(1)%ncs,             &
-                                                 surf_lsm_v(1)%ncs, surf_usm_v(1)%ncs,             &
-                                                 surf_def_v(2)%ncs, surf_lsm_v(2)%ncs,             &
-                                                 surf_usm_v(2)%ncs, surf_def_v(3)%ncs,             &
-                                                 surf_lsm_v(3)%ncs, surf_usm_v(3)%ncs )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%ncs, surf_lsm_h(0)%ncs, surf_usm_h(0)%ncs,    &
+                          surf_def_h(1)%ncs, surf_lsm_h(1)%ncs, surf_usm_h(1)%ncs,    &
+                          surf_def_v(0)%ncs, surf_lsm_v(0)%ncs, surf_usm_v(0)%ncs,    &
+                          surf_def_v(1)%ncs, surf_lsm_v(1)%ncs, surf_usm_v(1)%ncs,    &
+                          surf_def_v(2)%ncs, surf_lsm_v(2)%ncs, surf_usm_v(2)%ncs,    &
+                          surf_def_v(3)%ncs, surf_lsm_v(3)%ncs, surf_usm_v(3)%ncs )
              ELSE
 !
@@ -1648,12 +1637,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qis, surf_def_h(1)%qis,            &
-                                                  surf_lsm_h%qis, surf_usm_h%qis,                  &
-                                                  surf_def_v(0)%qis, surf_lsm_v(0)%qis,            &
-                                                  surf_usm_v(0)%qis, surf_def_v(1)%qis,            &
-                                                  surf_lsm_v(1)%qis, surf_usm_v(1)%qis,            &
-                                                  surf_def_v(2)%qis, surf_lsm_v(2)%qis,            &
-                                                  surf_usm_v(2)%qis, surf_def_v(3)%qis,            &
-                                                  surf_lsm_v(3)%qis, surf_usm_v(3)%qis )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%qis, surf_lsm_h(0)%qis, surf_usm_h(0)%qis,    &
+                          surf_def_h(1)%qis, surf_lsm_h(1)%qis, surf_usm_h(1)%qis,    &
+                          surf_def_v(0)%qis, surf_lsm_v(0)%qis, surf_usm_v(0)%qis,    &
+                          surf_def_v(1)%qis, surf_lsm_v(1)%qis, surf_usm_v(1)%qis,    &
+                          surf_def_v(2)%qis, surf_lsm_v(2)%qis, surf_usm_v(2)%qis,    &
+                          surf_def_v(3)%qis, surf_lsm_v(3)%qis, surf_usm_v(3)%qis )
              ELSE
 !
@@ -1668,12 +1656,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%nis, surf_def_h(1)%nis,            &
-                                                  surf_lsm_h%nis, surf_usm_h%nis,                  &
-                                                  surf_def_v(0)%nis, surf_lsm_v(0)%nis,            &
-                                                  surf_usm_v(0)%nis, surf_def_v(1)%nis,            &
-                                                  surf_lsm_v(1)%nis, surf_usm_v(1)%nis,            &
-                                                  surf_def_v(2)%nis, surf_lsm_v(2)%nis,            &
-                                                  surf_usm_v(2)%nis, surf_def_v(3)%nis,            &
-                                                  surf_lsm_v(3)%nis, surf_usm_v(3)%nis )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%nis, surf_lsm_h(0)%nis, surf_usm_h(0)%nis,    &
+                          surf_def_h(1)%nis, surf_lsm_h(1)%nis, surf_usm_h(1)%nis,    &
+                          surf_def_v(0)%nis, surf_lsm_v(0)%nis, surf_usm_v(0)%nis,    &
+                          surf_def_v(1)%nis, surf_lsm_v(1)%nis, surf_usm_v(1)%nis,    &
+                          surf_def_v(2)%nis, surf_lsm_v(2)%nis, surf_usm_v(2)%nis,    &
+                          surf_def_v(3)%nis, surf_lsm_v(3)%nis, surf_usm_v(3)%nis )
              ELSE
 !
@@ -1688,12 +1675,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qrs, surf_def_h(1)%qrs,            &
-                                                  surf_lsm_h%qrs, surf_usm_h%qrs,                  &
-                                                  surf_def_v(0)%qrs, surf_lsm_v(0)%qrs,            &
-                                                  surf_usm_v(0)%qrs, surf_def_v(1)%qrs,            &
-                                                  surf_lsm_v(1)%qrs, surf_usm_v(1)%qrs,            &
-                                                  surf_def_v(2)%qrs, surf_lsm_v(2)%qrs,            &
-                                                  surf_usm_v(2)%qrs, surf_def_v(3)%qrs,            &
-                                                  surf_lsm_v(3)%qrs, surf_usm_v(3)%qrs )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%qrs, surf_lsm_h(0)%qrs, surf_usm_h(0)%qrs,    &
+                          surf_def_h(1)%qrs, surf_lsm_h(1)%qrs, surf_usm_h(1)%qrs,    &
+                          surf_def_v(0)%qrs, surf_lsm_v(0)%qrs, surf_usm_v(0)%qrs,    &
+                          surf_def_v(1)%qrs, surf_lsm_v(1)%qrs, surf_usm_v(1)%qrs,    &
+                          surf_def_v(2)%qrs, surf_lsm_v(2)%qrs, surf_usm_v(2)%qrs,    &
+                          surf_def_v(3)%qrs, surf_lsm_v(3)%qrs, surf_usm_v(3)%qrs )
              ELSE
 !
@@ -1708,12 +1694,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%nrs, surf_def_h(1)%nrs,            &
-                                                  surf_lsm_h%nrs, surf_usm_h%nrs,                  &
-                                                  surf_def_v(0)%nrs, surf_lsm_v(0)%nrs,            &
-                                                  surf_usm_v(0)%nrs, surf_def_v(1)%nrs,            &
-                                                  surf_lsm_v(1)%nrs, surf_usm_v(1)%nrs,            &
-                                                  surf_def_v(2)%nrs, surf_lsm_v(2)%nrs,            &
-                                                  surf_usm_v(2)%nrs, surf_def_v(3)%nrs,            &
-                                                  surf_lsm_v(3)%nrs, surf_usm_v(3)%nrs )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%nrs, surf_lsm_h(0)%nrs, surf_usm_h(0)%nrs,    &
+                          surf_def_h(1)%nrs, surf_lsm_h(1)%nrs, surf_usm_h(1)%nrs,    &
+                          surf_def_v(0)%nrs, surf_lsm_v(0)%nrs, surf_usm_v(0)%nrs,    &
+                          surf_def_v(1)%nrs, surf_lsm_v(1)%nrs, surf_usm_v(1)%nrs,    &
+                          surf_def_v(2)%nrs, surf_lsm_v(2)%nrs, surf_usm_v(2)%nrs,    &
+                          surf_def_v(3)%nrs, surf_lsm_v(3)%nrs, surf_usm_v(3)%nrs )
              ELSE
 !
@@ -1728,12 +1713,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%ol, surf_def_h(1)%ol,              &
-                                                  surf_lsm_h%ol, surf_usm_h%ol, surf_def_v(0)%ol,  &
-                                                  surf_lsm_v(0)%ol, surf_usm_v(0)%ol,              &
-                                                  surf_def_v(1)%ol, surf_lsm_v(1)%ol,              &
-                                                  surf_usm_v(1)%ol, surf_def_v(2)%ol,              &
-                                                  surf_lsm_v(2)%ol, surf_usm_v(2)%ol,              &
-                                                  surf_def_v(3)%ol, surf_lsm_v(3)%ol,              &
-                                                  surf_usm_v(3)%ol )
+                CALL surface_data_output_collect(                                  &
+                          surf_def_h(0)%ol, surf_lsm_h(0)%ol, surf_usm_h(0)%ol,    &
+                          surf_def_h(1)%ol, surf_lsm_h(1)%ol, surf_usm_h(1)%ol,    &
+                          surf_def_v(0)%ol, surf_lsm_v(0)%ol, surf_usm_v(0)%ol,    &
+                          surf_def_v(1)%ol, surf_lsm_v(1)%ol, surf_usm_v(1)%ol,    &
+                          surf_def_v(2)%ol, surf_lsm_v(2)%ol, surf_usm_v(2)%ol,    &
+                          surf_def_v(3)%ol, surf_lsm_v(3)%ol, surf_usm_v(3)%ol )
              ELSE
 !
@@ -1748,12 +1732,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%z0, surf_def_h(1)%z0,              &
-                                                  surf_lsm_h%z0, surf_usm_h%z0, surf_def_v(0)%z0,  &
-                                                  surf_lsm_v(0)%z0, surf_usm_v(0)%z0,              &
-                                                  surf_def_v(1)%z0, surf_lsm_v(1)%z0,              &
-                                                  surf_usm_v(1)%z0, surf_def_v(2)%z0,              &
-                                                  surf_lsm_v(2)%z0, surf_usm_v(2)%z0,              &
-                                                  surf_def_v(3)%z0, surf_lsm_v(3)%z0,              &
-                                                  surf_usm_v(3)%z0 )
+                CALL surface_data_output_collect(                                  &
+                          surf_def_h(0)%z0, surf_lsm_h(0)%z0, surf_usm_h(0)%z0,    &
+                          surf_def_h(1)%z0, surf_lsm_h(1)%z0, surf_usm_h(1)%z0,    &
+                          surf_def_v(0)%z0, surf_lsm_v(0)%z0, surf_usm_v(0)%z0,    &
+                          surf_def_v(1)%z0, surf_lsm_v(1)%z0, surf_usm_v(1)%z0,    &
+                          surf_def_v(2)%z0, surf_lsm_v(2)%z0, surf_usm_v(2)%z0,    &
+                          surf_def_v(3)%z0, surf_lsm_v(3)%z0, surf_usm_v(3)%z0 )
              ELSE
 !
@@ -1768,12 +1751,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%z0h, surf_def_h(1)%z0h,            &
-                                                  surf_lsm_h%z0h, surf_usm_h%z0h,                  &
-                                                  surf_def_v(0)%z0h, surf_lsm_v(0)%z0h,            &
-                                                  surf_usm_v(0)%z0h, surf_def_v(1)%z0h,            &
-                                                  surf_lsm_v(1)%z0h, surf_usm_v(1)%z0h,            &
-                                                  surf_def_v(2)%z0h, surf_lsm_v(2)%z0h,            &
-                                                  surf_usm_v(2)%z0h, surf_def_v(3)%z0h,            &
-                                                  surf_lsm_v(3)%z0h, surf_usm_v(3)%z0h )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%z0h, surf_lsm_h(0)%z0h, surf_usm_h(0)%z0h,    &
+                          surf_def_h(1)%z0h, surf_lsm_h(1)%z0h, surf_usm_h(1)%z0h,    &
+                          surf_def_v(0)%z0h, surf_lsm_v(0)%z0h, surf_usm_v(0)%z0h,    &
+                          surf_def_v(1)%z0h, surf_lsm_v(1)%z0h, surf_usm_v(1)%z0h,    &
+                          surf_def_v(2)%z0h, surf_lsm_v(2)%z0h, surf_usm_v(2)%z0h,    &
+                          surf_def_v(3)%z0h, surf_lsm_v(3)%z0h, surf_usm_v(3)%z0h )
              ELSE
 !
@@ -1788,12 +1770,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%z0q, surf_def_h(1)%z0q,            &
-                                                  surf_lsm_h%z0q, surf_usm_h%z0q,                  &
-                                                  surf_def_v(0)%z0q, surf_lsm_v(0)%z0q,            &
-                                                  surf_usm_v(0)%z0q, surf_def_v(1)%z0q,            &
-                                                  surf_lsm_v(1)%z0q, surf_usm_v(1)%z0q,            &
-                                                  surf_def_v(2)%z0q, surf_lsm_v(2)%z0q,            &
-                                                  surf_usm_v(2)%z0q, surf_def_v(3)%z0q,            &
-                                                  surf_lsm_v(3)%z0q, surf_usm_v(3)%z0q )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%z0q, surf_lsm_h(0)%z0q, surf_usm_h(0)%z0q,    &
+                          surf_def_h(1)%z0q, surf_lsm_h(1)%z0q, surf_usm_h(1)%z0q,    &
+                          surf_def_v(0)%z0q, surf_lsm_v(0)%z0q, surf_usm_v(0)%z0q,    &
+                          surf_def_v(1)%z0q, surf_lsm_v(1)%z0q, surf_usm_v(1)%z0q,    &
+                          surf_def_v(2)%z0q, surf_lsm_v(2)%z0q, surf_usm_v(2)%z0q,    &
+                          surf_def_v(3)%z0q, surf_lsm_v(3)%z0q, surf_usm_v(3)%z0q )
              ELSE
 !
@@ -1808,12 +1789,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%pt1, surf_def_h(1)%pt1,            &
-                                                  surf_lsm_h%pt1, surf_usm_h%pt1,                  &
-                                                  surf_def_v(0)%pt1, surf_lsm_v(0)%pt1,            &
-                                                  surf_usm_v(0)%pt1, surf_def_v(1)%pt1,            &
-                                                  surf_lsm_v(1)%pt1, surf_usm_v(1)%pt1,            &
-                                                  surf_def_v(2)%pt1, surf_lsm_v(2)%pt1,            &
-                                                  surf_usm_v(2)%pt1, surf_def_v(3)%pt1,            &
-                                                  surf_lsm_v(3)%pt1, surf_usm_v(3)%pt1 )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%pt1, surf_lsm_h(0)%pt1, surf_usm_h(0)%pt1,    &
+                          surf_def_h(1)%pt1, surf_lsm_h(1)%pt1, surf_usm_h(1)%pt1,    &
+                          surf_def_v(0)%pt1, surf_lsm_v(0)%pt1, surf_usm_v(0)%pt1,    &
+                          surf_def_v(1)%pt1, surf_lsm_v(1)%pt1, surf_usm_v(1)%pt1,    &
+                          surf_def_v(2)%pt1, surf_lsm_v(2)%pt1, surf_usm_v(2)%pt1,    &
+                          surf_def_v(3)%pt1, surf_lsm_v(3)%pt1, surf_usm_v(3)%pt1 )
              ELSE
 !
@@ -1828,12 +1808,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qv1, surf_def_h(1)%qv1,            &
-                                                  surf_lsm_h%qv1, surf_usm_h%qv1,                  &
-                                                  surf_def_v(0)%qv1, surf_lsm_v(0)%qv1,            &
-                                                  surf_usm_v(0)%qv1, surf_def_v(1)%qv1,            &
-                                                  surf_lsm_v(1)%qv1, surf_usm_v(1)%qv1,            &
-                                                  surf_def_v(2)%qv1, surf_lsm_v(2)%qv1,            &
-                                                  surf_usm_v(2)%qv1, surf_def_v(3)%qv1,            &
-                                                  surf_lsm_v(3)%qv1, surf_usm_v(3)%qv1 )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%qv1, surf_lsm_h(0)%qv1, surf_usm_h(0)%qv1,    &
+                          surf_def_h(1)%qv1, surf_lsm_h(1)%qv1, surf_usm_h(1)%qv1,    &
+                          surf_def_v(0)%qv1, surf_lsm_v(0)%qv1, surf_usm_v(0)%qv1,    &
+                          surf_def_v(1)%qv1, surf_lsm_v(1)%qv1, surf_usm_v(1)%qv1,    &
+                          surf_def_v(2)%qv1, surf_lsm_v(2)%qv1, surf_usm_v(2)%qv1,    &
+                          surf_def_v(3)%qv1, surf_lsm_v(3)%qv1, surf_usm_v(3)%qv1 )
              ELSE
 !
@@ -1848,12 +1827,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%vpt1, surf_def_h(1)%vpt1,          &
-                                                  surf_lsm_h%vpt1, surf_usm_h%vpt1,                &
-                                                  surf_def_v(0)%vpt1, surf_lsm_v(0)%vpt1,          &
-                                                  surf_usm_v(0)%vpt1, surf_def_v(1)%vpt1,          &
-                                                  surf_lsm_v(1)%vpt1, surf_usm_v(1)%vpt1,          &
-                                                  surf_def_v(2)%vpt1, surf_lsm_v(2)%vpt1,          &
-                                                  surf_usm_v(2)%vpt1, surf_def_v(3)%vpt1,          &
-                                                  surf_lsm_v(3)%vpt1, surf_usm_v(3)%vpt1 )
+                CALL surface_data_output_collect(                                        &
+                          surf_def_h(0)%vpt1, surf_lsm_h(0)%vpt1, surf_usm_h(0)%vpt1,    &
+                          surf_def_h(1)%vpt1, surf_lsm_h(1)%vpt1, surf_usm_h(1)%vpt1,    &
+                          surf_def_v(0)%vpt1, surf_lsm_v(0)%vpt1, surf_usm_v(0)%vpt1,    &
+                          surf_def_v(1)%vpt1, surf_lsm_v(1)%vpt1, surf_usm_v(1)%vpt1,    &
+                          surf_def_v(2)%vpt1, surf_lsm_v(2)%vpt1, surf_usm_v(2)%vpt1,    &
+                          surf_def_v(3)%vpt1, surf_lsm_v(3)%vpt1, surf_usm_v(3)%vpt1 )
              ELSE
 !
@@ -1868,13 +1846,12 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%usws, surf_def_h(1)%usws,          &
-                                                  surf_lsm_h%usws, surf_usm_h%usws,                &
-                                                  surf_def_v(0)%usws, surf_lsm_v(0)%usws,          &
-                                                  surf_usm_v(0)%usws, surf_def_v(1)%usws,          &
-                                                  surf_lsm_v(1)%usws, surf_usm_v(1)%usws,          &
-                                                  surf_def_v(2)%usws, surf_lsm_v(2)%usws,          &
-                                                  surf_usm_v(2)%usws, surf_def_v(3)%usws,          &
-                                                  surf_lsm_v(3)%usws, surf_usm_v(3)%usws,          &
-                                                  momentumflux_output_conversion )
+                CALL surface_data_output_collect(                                        &
+                          surf_def_h(0)%usws, surf_lsm_h(0)%usws, surf_usm_h(0)%usws,    &
+                          surf_def_h(1)%usws, surf_lsm_h(1)%usws, surf_usm_h(1)%usws,    &
+                          surf_def_v(0)%usws, surf_lsm_v(0)%usws, surf_usm_v(0)%usws,    &
+                          surf_def_v(1)%usws, surf_lsm_v(1)%usws, surf_usm_v(1)%usws,    &
+                          surf_def_v(2)%usws, surf_lsm_v(2)%usws, surf_usm_v(2)%usws,    &
+                          surf_def_v(3)%usws, surf_lsm_v(3)%usws, surf_usm_v(3)%usws,    &
+                          momentumflux_output_conversion )
              ELSE
 !
@@ -1889,13 +1866,12 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%vsws, surf_def_h(1)%vsws,          &
-                                                  surf_lsm_h%vsws, surf_usm_h%vsws,                &
-                                                  surf_def_v(0)%vsws, surf_lsm_v(0)%vsws,          &
-                                                  surf_usm_v(0)%vsws, surf_def_v(1)%vsws,          &
-                                                  surf_lsm_v(1)%vsws, surf_usm_v(1)%vsws,          &
-                                                  surf_def_v(2)%vsws, surf_lsm_v(2)%vsws,          &
-                                                  surf_usm_v(2)%vsws, surf_def_v(3)%vsws,          &
-                                                  surf_lsm_v(3)%vsws, surf_usm_v(3)%vsws,          &
-                                                  momentumflux_output_conversion )
+                CALL surface_data_output_collect(                                        &
+                          surf_def_h(0)%vsws, surf_lsm_h(0)%vsws, surf_usm_h(0)%vsws,    &
+                          surf_def_h(1)%vsws, surf_lsm_h(1)%vsws, surf_usm_h(1)%vsws,    &
+                          surf_def_v(0)%vsws, surf_lsm_v(0)%vsws, surf_usm_v(0)%vsws,    &
+                          surf_def_v(1)%vsws, surf_lsm_v(1)%vsws, surf_usm_v(1)%vsws,    &
+                          surf_def_v(2)%vsws, surf_lsm_v(2)%vsws, surf_usm_v(2)%vsws,    &
+                          surf_def_v(3)%vsws, surf_lsm_v(3)%vsws, surf_usm_v(3)%vsws,    &
+                          momentumflux_output_conversion )
              ELSE
 !
@@ -1910,13 +1886,12 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%shf, surf_def_h(1)%shf,            &
-                                                  surf_lsm_h%shf, surf_usm_h%shf,                  &
-                                                  surf_def_v(0)%shf, surf_lsm_v(0)%shf,            &
-                                                  surf_usm_v(0)%shf, surf_def_v(1)%shf,            &
-                                                  surf_lsm_v(1)%shf, surf_usm_v(1)%shf,            &
-                                                  surf_def_v(2)%shf, surf_lsm_v(2)%shf,            &
-                                                  surf_usm_v(2)%shf, surf_def_v(3)%shf,            &
-                                                  surf_lsm_v(3)%shf, surf_usm_v(3)%shf,            &
-                                                  heatflux_output_conversion )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%shf, surf_lsm_h(0)%shf, surf_usm_h(0)%shf,    &
+                          surf_def_h(1)%shf, surf_lsm_h(1)%shf, surf_usm_h(1)%shf,    &
+                          surf_def_v(0)%shf, surf_lsm_v(0)%shf, surf_usm_v(0)%shf,    &
+                          surf_def_v(1)%shf, surf_lsm_v(1)%shf, surf_usm_v(1)%shf,    &
+                          surf_def_v(2)%shf, surf_lsm_v(2)%shf, surf_usm_v(2)%shf,    &
+                          surf_def_v(3)%shf, surf_lsm_v(3)%shf, surf_usm_v(3)%shf,    &
+                          heatflux_output_conversion )
              ELSE
 !
@@ -1930,13 +1905,12 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qsws, surf_def_h(1)%qsws,          &
-                                                  surf_lsm_h%qsws, surf_usm_h%qsws,                &
-                                                  surf_def_v(0)%qsws, surf_lsm_v(0)%qsws,          &
-                                                  surf_usm_v(0)%qsws, surf_def_v(1)%qsws,          &
-                                                  surf_lsm_v(1)%qsws, surf_usm_v(1)%qsws,          &
-                                                  surf_def_v(2)%qsws, surf_lsm_v(2)%qsws,          &
-                                                  surf_usm_v(2)%qsws, surf_def_v(3)%qsws,          &
-                                                  surf_lsm_v(3)%qsws, surf_usm_v(3)%qsws,          &
-                                                  waterflux_output_conversion )
+                CALL surface_data_output_collect(                                        &
+                          surf_def_h(0)%qsws, surf_lsm_h(0)%qsws, surf_usm_h(0)%qsws,    &
+                          surf_def_h(1)%qsws, surf_lsm_h(1)%qsws, surf_usm_h(1)%qsws,    &
+                          surf_def_v(0)%qsws, surf_lsm_v(0)%qsws, surf_usm_v(0)%qsws,    &
+                          surf_def_v(1)%qsws, surf_lsm_v(1)%qsws, surf_usm_v(1)%qsws,    &
+                          surf_def_v(2)%qsws, surf_lsm_v(2)%qsws, surf_usm_v(2)%qsws,    &
+                          surf_def_v(3)%qsws, surf_lsm_v(3)%qsws, surf_usm_v(3)%qsws,    &
+                          waterflux_output_conversion )
              ELSE
 !
@@ -1951,12 +1925,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%ssws, surf_def_h(1)%ssws,          &
-                                                  surf_lsm_h%ssws, surf_usm_h%ssws,                &
-                                                  surf_def_v(0)%ssws, surf_lsm_v(0)%ssws,          &
-                                                  surf_usm_v(0)%ssws, surf_def_v(1)%ssws,          &
-                                                  surf_lsm_v(1)%ssws, surf_usm_v(1)%ssws,          &
-                                                  surf_def_v(2)%ssws, surf_lsm_v(2)%ssws,          &
-                                                  surf_usm_v(2)%ssws, surf_def_v(3)%ssws,          &
-                                                  surf_lsm_v(3)%ssws, surf_usm_v(3)%ssws )
+                CALL surface_data_output_collect(                                        &
+                          surf_def_h(0)%ssws, surf_lsm_h(0)%ssws, surf_usm_h(0)%ssws,    &
+                          surf_def_h(1)%ssws, surf_lsm_h(1)%ssws, surf_usm_h(1)%ssws,    &
+                          surf_def_v(0)%ssws, surf_lsm_v(0)%ssws, surf_usm_v(0)%ssws,    &
+                          surf_def_v(1)%ssws, surf_lsm_v(1)%ssws, surf_usm_v(1)%ssws,    &
+                          surf_def_v(2)%ssws, surf_lsm_v(2)%ssws, surf_usm_v(2)%ssws,    &
+                          surf_def_v(3)%ssws, surf_lsm_v(3)%ssws, surf_usm_v(3)%ssws )
              ELSE
 !
@@ -1971,12 +1944,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,        &
-                                                  surf_lsm_h%qcsws, surf_usm_h%qcsws,              &
-                                                  surf_def_v(0)%qcsws, surf_lsm_v(0)%qcsws,        &
-                                                  surf_usm_v(0)%qcsws, surf_def_v(1)%qcsws,        &
-                                                  surf_lsm_v(1)%qcsws, surf_usm_v(1)%qcsws,        &
-                                                  surf_def_v(2)%qcsws, surf_lsm_v(2)%qcsws,        &
-                                                  surf_usm_v(2)%qcsws, surf_def_v(3)%qcsws,        &
-                                                  surf_lsm_v(3)%qcsws, surf_usm_v(3)%qcsws )
+                CALL surface_data_output_collect(                                           &
+                          surf_def_h(0)%qcsws, surf_lsm_h(0)%qcsws, surf_usm_h(0)%qcsws,    &
+                          surf_def_h(1)%qcsws, surf_lsm_h(1)%qcsws, surf_usm_h(1)%qcsws,    &
+                          surf_def_v(0)%qcsws, surf_lsm_v(0)%qcsws, surf_usm_v(0)%qcsws,    &
+                          surf_def_v(1)%qcsws, surf_lsm_v(1)%qcsws, surf_usm_v(1)%qcsws,    &
+                          surf_def_v(2)%qcsws, surf_lsm_v(2)%qcsws, surf_usm_v(2)%qcsws,    &
+                          surf_def_v(3)%qcsws, surf_lsm_v(3)%qcsws, surf_usm_v(3)%qcsws )
              ELSE
 !
@@ -1991,12 +1963,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,        &
-                                                  surf_lsm_h%ncsws, surf_usm_h%ncsws,              &
-                                                  surf_def_v(0)%ncsws, surf_lsm_v(0)%ncsws,        &
-                                                  surf_usm_v(0)%ncsws, surf_def_v(1)%ncsws,        &
-                                                  surf_lsm_v(1)%ncsws, surf_usm_v(1)%ncsws,        &
-                                                  surf_def_v(2)%ncsws, surf_lsm_v(2)%ncsws,        &
-                                                  surf_usm_v(2)%ncsws, surf_def_v(3)%ncsws,        &
-                                                  surf_lsm_v(3)%ncsws, surf_usm_v(3)%ncsws )
+                CALL surface_data_output_collect(                                           &
+                          surf_def_h(0)%ncsws, surf_lsm_h(0)%ncsws, surf_usm_h(0)%ncsws,    &
+                          surf_def_h(1)%ncsws, surf_lsm_h(1)%ncsws, surf_usm_h(1)%ncsws,    &
+                          surf_def_v(0)%ncsws, surf_lsm_v(0)%ncsws, surf_usm_v(0)%ncsws,    &
+                          surf_def_v(1)%ncsws, surf_lsm_v(1)%ncsws, surf_usm_v(1)%ncsws,    &
+                          surf_def_v(2)%ncsws, surf_lsm_v(2)%ncsws, surf_usm_v(2)%ncsws,    &
+                          surf_def_v(3)%ncsws, surf_lsm_v(3)%ncsws, surf_usm_v(3)%ncsws )
              ELSE
 !
@@ -2012,12 +1983,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qisws, surf_def_h(1)%qisws,        &
-                                                  surf_lsm_h%qisws, surf_usm_h%qisws,              &
-                                                  surf_def_v(0)%qisws, surf_lsm_v(0)%qisws,        &
-                                                  surf_usm_v(0)%qisws, surf_def_v(1)%qisws,        &
-                                                  surf_lsm_v(1)%qisws, surf_usm_v(1)%qisws,        &
-                                                  surf_def_v(2)%qisws, surf_lsm_v(2)%qisws,        &
-                                                  surf_usm_v(2)%qisws, surf_def_v(3)%qisws,        &
-                                                  surf_lsm_v(3)%qisws, surf_usm_v(3)%qisws )
+                CALL surface_data_output_collect(                                           &
+                          surf_def_h(0)%qisws, surf_lsm_h(0)%qisws, surf_usm_h(0)%qisws,    &
+                          surf_def_h(1)%qisws, surf_lsm_h(1)%qisws, surf_usm_h(1)%qisws,    &
+                          surf_def_v(0)%qisws, surf_lsm_v(0)%qisws, surf_usm_v(0)%qisws,    &
+                          surf_def_v(1)%qisws, surf_lsm_v(1)%qisws, surf_usm_v(1)%qisws,    &
+                          surf_def_v(2)%qisws, surf_lsm_v(2)%qisws, surf_usm_v(2)%qisws,    &
+                          surf_def_v(3)%qisws, surf_lsm_v(3)%qisws, surf_usm_v(3)%qisws )
              ELSE
 !
@@ -2032,12 +2002,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%nisws, surf_def_h(1)%nisws,        &
-                                                  surf_lsm_h%nisws, surf_usm_h%nisws,              &
-                                                  surf_def_v(0)%nisws, surf_lsm_v(0)%nisws,        &
-                                                  surf_usm_v(0)%nisws, surf_def_v(1)%nisws,        &
-                                                  surf_lsm_v(1)%nisws, surf_usm_v(1)%nisws,        &
-                                                  surf_def_v(2)%nisws, surf_lsm_v(2)%nisws,        &
-                                                  surf_usm_v(2)%nisws, surf_def_v(3)%nisws,        &
-                                                  surf_lsm_v(3)%nisws, surf_usm_v(3)%nisws )
+                CALL surface_data_output_collect(                                           &
+                          surf_def_h(0)%nisws, surf_lsm_h(0)%nisws, surf_usm_h(0)%nisws,    &
+                          surf_def_h(1)%nisws, surf_lsm_h(1)%nisws, surf_usm_h(1)%nisws,    &
+                          surf_def_v(0)%nisws, surf_lsm_v(0)%nisws, surf_usm_v(0)%nisws,    &
+                          surf_def_v(1)%nisws, surf_lsm_v(1)%nisws, surf_usm_v(1)%nisws,    &
+                          surf_def_v(2)%nisws, surf_lsm_v(2)%nisws, surf_usm_v(2)%nisws,    &
+                          surf_def_v(3)%nisws, surf_lsm_v(3)%nisws, surf_usm_v(3)%nisws )
              ELSE
 !
@@ -2052,12 +2021,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,        &
-                                                  surf_lsm_h%qrsws, surf_usm_h%qrsws,              &
-                                                  surf_def_v(0)%qrsws, surf_lsm_v(0)%qrsws,        &
-                                                  surf_usm_v(0)%qrsws, surf_def_v(1)%qrsws,        &
-                                                  surf_lsm_v(1)%qrsws, surf_usm_v(1)%qrsws,        &
-                                                  surf_def_v(2)%qrsws, surf_lsm_v(2)%qrsws,        &
-                                                  surf_usm_v(2)%qrsws, surf_def_v(3)%qrsws,        &
-                                                  surf_lsm_v(3)%qrsws, surf_usm_v(3)%qrsws )
+                CALL surface_data_output_collect(                                           &
+                          surf_def_h(0)%qrsws, surf_lsm_h(0)%qrsws, surf_usm_h(0)%qrsws,    &
+                          surf_def_h(1)%qrsws, surf_lsm_h(1)%qrsws, surf_usm_h(1)%qrsws,    &
+                          surf_def_v(0)%qrsws, surf_lsm_v(0)%qrsws, surf_usm_v(0)%qrsws,    &
+                          surf_def_v(1)%qrsws, surf_lsm_v(1)%qrsws, surf_usm_v(1)%qrsws,    &
+                          surf_def_v(2)%qrsws, surf_lsm_v(2)%qrsws, surf_usm_v(2)%qrsws,    &
+                          surf_def_v(3)%qrsws, surf_lsm_v(3)%qrsws, surf_usm_v(3)%qrsws )
              ELSE
 !
@@ -2072,12 +2040,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,        &
-                                                  surf_lsm_h%nrsws, surf_usm_h%nrsws,              &
-                                                  surf_def_v(0)%nrsws, surf_lsm_v(0)%nrsws,        &
-                                                  surf_usm_v(0)%nrsws, surf_def_v(1)%nrsws,        &
-                                                  surf_lsm_v(1)%nrsws, surf_usm_v(1)%nrsws,        &
-                                                  surf_def_v(2)%nrsws, surf_lsm_v(2)%nrsws,        &
-                                                  surf_usm_v(2)%nrsws, surf_def_v(3)%nrsws,        &
-                                                  surf_lsm_v(3)%nrsws, surf_usm_v(3)%nrsws )
+                CALL surface_data_output_collect(                                           &
+                          surf_def_h(0)%nrsws, surf_lsm_h(0)%nrsws, surf_usm_h(0)%nrsws,    &
+                          surf_def_h(1)%nrsws, surf_lsm_h(1)%nrsws, surf_usm_h(1)%nrsws,    &
+                          surf_def_v(0)%nrsws, surf_lsm_v(0)%nrsws, surf_usm_v(0)%nrsws,    &
+                          surf_def_v(1)%nrsws, surf_lsm_v(1)%nrsws, surf_usm_v(1)%nrsws,    &
+                          surf_def_v(2)%nrsws, surf_lsm_v(2)%nrsws, surf_usm_v(2)%nrsws,    &
+                          surf_def_v(3)%nrsws, surf_lsm_v(3)%nrsws, surf_usm_v(3)%nrsws )
              ELSE
 !
@@ -2092,12 +2059,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%sasws, surf_def_h(1)%sasws,        &
-                                                  surf_lsm_h%sasws, surf_usm_h%sasws,              &
-                                                  surf_def_v(0)%sasws, surf_lsm_v(0)%sasws,        &
-                                                  surf_usm_v(0)%sasws, surf_def_v(1)%sasws,        &
-                                                  surf_lsm_v(1)%sasws, surf_usm_v(1)%sasws,        &
-                                                  surf_def_v(2)%sasws, surf_lsm_v(2)%sasws,        &
-                                                  surf_usm_v(2)%sasws, surf_def_v(3)%sasws,        &
-                                                  surf_lsm_v(3)%sasws, surf_usm_v(3)%sasws )
+                CALL surface_data_output_collect(                                           &
+                          surf_def_h(0)%sasws, surf_lsm_h(0)%sasws, surf_usm_h(0)%sasws,    &
+                          surf_def_h(1)%sasws, surf_lsm_h(1)%sasws, surf_usm_h(1)%sasws,    &
+                          surf_def_v(0)%sasws, surf_lsm_v(0)%sasws, surf_usm_v(0)%sasws,    &
+                          surf_def_v(1)%sasws, surf_lsm_v(1)%sasws, surf_usm_v(1)%sasws,    &
+                          surf_def_v(2)%sasws, surf_lsm_v(2)%sasws, surf_usm_v(2)%sasws,    &
+                          surf_def_v(3)%sasws, surf_lsm_v(3)%sasws, surf_usm_v(3)%sasws )
              ELSE
 !
@@ -2112,12 +2078,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%q_surface, surf_def_h(1)%q_surface,&
-                                                  surf_lsm_h%q_surface, surf_usm_h%q_surface,      &
-                                                  surf_def_v(0)%q_surface, surf_lsm_v(0)%q_surface,&
-                                                  surf_usm_v(0)%q_surface, surf_def_v(1)%q_surface,&
-                                                  surf_lsm_v(1)%q_surface, surf_usm_v(1)%q_surface,&
-                                                  surf_def_v(2)%q_surface, surf_lsm_v(2)%q_surface,&
-                                                  surf_usm_v(2)%q_surface, surf_def_v(3)%q_surface,&
-                                                  surf_lsm_v(3)%q_surface, surf_usm_v(3)%q_surface )
+                CALL surface_data_output_collect(                                              &
+                    surf_def_h(0)%q_surface, surf_lsm_h(0)%q_surface, surf_usm_h(0)%q_surface, &
+                    surf_def_h(1)%q_surface, surf_lsm_h(1)%q_surface, surf_usm_h(1)%q_surface, &
+                    surf_def_v(0)%q_surface, surf_lsm_v(0)%q_surface, surf_usm_v(0)%q_surface, &
+                    surf_def_v(1)%q_surface, surf_lsm_v(1)%q_surface, surf_usm_v(1)%q_surface, &
+                    surf_def_v(2)%q_surface, surf_lsm_v(2)%q_surface, surf_usm_v(2)%q_surface, &
+                    surf_def_v(3)%q_surface, surf_lsm_v(3)%q_surface, surf_usm_v(3)%q_surface )
              ELSE
 !
@@ -2132,19 +2097,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%pt_surface,                        &
-                                                  surf_def_h(1)%pt_surface,                        &
-                                                  surf_lsm_h%pt_surface, surf_usm_h%pt_surface,    &
-                                                  surf_def_v(0)%pt_surface,                        &
-                                                  surf_lsm_v(0)%pt_surface,                        &
-                                                  surf_usm_v(0)%pt_surface,                        &
-                                                  surf_def_v(1)%pt_surface,                        &
-                                                  surf_lsm_v(1)%pt_surface,                        &
-                                                  surf_usm_v(1)%pt_surface,                        &
-                                                  surf_def_v(2)%pt_surface,                        &
-                                                  surf_lsm_v(2)%pt_surface,                        &
-                                                  surf_usm_v(2)%pt_surface,                        &
-                                                  surf_def_v(3)%pt_surface,                        &
-                                                  surf_lsm_v(3)%pt_surface,                        &
-                                                  surf_usm_v(3)%pt_surface )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%pt_surface, surf_lsm_h(0)%pt_surface, surf_usm_h(0)%pt_surface, &
+                    surf_def_h(1)%pt_surface, surf_lsm_h(1)%pt_surface, surf_usm_h(1)%pt_surface, &
+                    surf_def_v(0)%pt_surface, surf_lsm_v(0)%pt_surface, surf_usm_v(0)%pt_surface, &
+                    surf_def_v(1)%pt_surface, surf_lsm_v(1)%pt_surface, surf_usm_v(1)%pt_surface, &
+                    surf_def_v(2)%pt_surface, surf_lsm_v(2)%pt_surface, surf_usm_v(2)%pt_surface, &
+                    surf_def_v(3)%pt_surface, surf_lsm_v(3)%pt_surface, surf_usm_v(3)%pt_surface )
              ELSE
 !
@@ -2159,19 +2116,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%vpt_surface,                       &
-                                                  surf_def_h(1)%vpt_surface,                       &
-                                                  surf_lsm_h%vpt_surface, surf_usm_h%vpt_surface,  &
-                                                  surf_def_v(0)%vpt_surface,                       &
-                                                  surf_lsm_v(0)%vpt_surface,                       &
-                                                  surf_usm_v(0)%vpt_surface,                       &
-                                                  surf_def_v(1)%vpt_surface,                       &
-                                                  surf_lsm_v(1)%vpt_surface,                       &
-                                                  surf_usm_v(1)%vpt_surface,                       &
-                                                  surf_def_v(2)%vpt_surface,                       &
-                                                  surf_lsm_v(2)%vpt_surface,                       &
-                                                  surf_usm_v(2)%vpt_surface,                       &
-                                                  surf_def_v(3)%vpt_surface,                       &
-                                                  surf_lsm_v(3)%vpt_surface,                       &
-                                                  surf_usm_v(3)%vpt_surface)
+                CALL surface_data_output_collect(                                                  &
+                  surf_def_h(0)%vpt_surface, surf_lsm_h(0)%vpt_surface, surf_usm_h(0)%vpt_surface, &
+                  surf_def_h(1)%vpt_surface, surf_lsm_h(1)%vpt_surface, surf_usm_h(1)%vpt_surface, &
+                  surf_def_v(0)%vpt_surface, surf_lsm_v(0)%vpt_surface, surf_usm_v(0)%vpt_surface, &
+                  surf_def_v(1)%vpt_surface, surf_lsm_v(1)%vpt_surface, surf_usm_v(1)%vpt_surface, &
+                  surf_def_v(2)%vpt_surface, surf_lsm_v(2)%vpt_surface, surf_usm_v(2)%vpt_surface, &
+                  surf_def_v(3)%vpt_surface, surf_lsm_v(3)%vpt_surface, surf_usm_v(3)%vpt_surface )
              ELSE
 !
@@ -2186,12 +2135,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_net, surf_def_h(1)%rad_net,    &
-                                                  surf_lsm_h%rad_net, surf_usm_h%rad_net,          &
-                                                  surf_def_v(0)%rad_net, surf_lsm_v(0)%rad_net,    &
-                                                  surf_usm_v(0)%rad_net, surf_def_v(1)%rad_net,    &
-                                                  surf_lsm_v(1)%rad_net, surf_usm_v(1)%rad_net,    &
-                                                  surf_def_v(2)%rad_net, surf_lsm_v(2)%rad_net,    &
-                                                  surf_usm_v(2)%rad_net, surf_def_v(3)%rad_net,    &
-                                                  surf_lsm_v(3)%rad_net, surf_usm_v(3)%rad_net )
+                CALL surface_data_output_collect(                                        &
+                    surf_def_h(0)%rad_net, surf_lsm_h(0)%rad_net, surf_usm_h(0)%rad_net, &
+                    surf_def_h(1)%rad_net, surf_lsm_h(1)%rad_net, surf_usm_h(1)%rad_net, &
+                    surf_def_v(0)%rad_net, surf_lsm_v(0)%rad_net, surf_usm_v(0)%rad_net, &
+                    surf_def_v(1)%rad_net, surf_lsm_v(1)%rad_net, surf_usm_v(1)%rad_net, &
+                    surf_def_v(2)%rad_net, surf_lsm_v(2)%rad_net, surf_usm_v(2)%rad_net, &
+                    surf_def_v(3)%rad_net, surf_lsm_v(3)%rad_net, surf_usm_v(3)%rad_net )
              ELSE
 !
@@ -2206,18 +2154,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_lw_in,                         &
-                                                  surf_def_h(1)%rad_lw_in, surf_lsm_h%rad_lw_in,   &
-                                                  surf_usm_h%rad_lw_in, surf_def_v(0)%rad_lw_in,   &
-                                                  surf_lsm_v(0)%rad_lw_in,                         &
-                                                  surf_usm_v(0)%rad_lw_in,                         &
-                                                  surf_def_v(1)%rad_lw_in,                         &
-                                                  surf_lsm_v(1)%rad_lw_in,                         &
-                                                  surf_usm_v(1)%rad_lw_in,                         &
-                                                  surf_def_v(2)%rad_lw_in,                         &
-                                                  surf_lsm_v(2)%rad_lw_in,                         &
-                                                  surf_usm_v(2)%rad_lw_in,                         &
-                                                  surf_def_v(3)%rad_lw_in,                         &
-                                                  surf_lsm_v(3)%rad_lw_in,                         &
-                                                  surf_usm_v(3)%rad_lw_in )
+                CALL surface_data_output_collect(                                              &
+                    surf_def_h(0)%rad_lw_in, surf_lsm_h(0)%rad_lw_in, surf_usm_h(0)%rad_lw_in, &
+                    surf_def_h(1)%rad_lw_in, surf_lsm_h(1)%rad_lw_in, surf_usm_h(1)%rad_lw_in, &
+                    surf_def_v(0)%rad_lw_in, surf_lsm_v(0)%rad_lw_in, surf_usm_v(0)%rad_lw_in, &
+                    surf_def_v(1)%rad_lw_in, surf_lsm_v(1)%rad_lw_in, surf_usm_v(1)%rad_lw_in, &
+                    surf_def_v(2)%rad_lw_in, surf_lsm_v(2)%rad_lw_in, surf_usm_v(2)%rad_lw_in, &
+                    surf_def_v(3)%rad_lw_in, surf_lsm_v(3)%rad_lw_in, surf_usm_v(3)%rad_lw_in )
              ELSE
 !
@@ -2232,18 +2173,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_lw_out,                        &
-                                                  surf_def_h(1)%rad_lw_out, surf_lsm_h%rad_lw_out, &
-                                                  surf_usm_h%rad_lw_out, surf_def_v(0)%rad_lw_out, &
-                                                  surf_lsm_v(0)%rad_lw_out,                        &
-                                                  surf_usm_v(0)%rad_lw_out,                        &
-                                                  surf_def_v(1)%rad_lw_out,                        &
-                                                  surf_lsm_v(1)%rad_lw_out,                        &
-                                                  surf_usm_v(1)%rad_lw_out,                        &
-                                                  surf_def_v(2)%rad_lw_out,                        &
-                                                  surf_lsm_v(2)%rad_lw_out,                        &
-                                                  surf_usm_v(2)%rad_lw_out,                        &
-                                                  surf_def_v(3)%rad_lw_out,                        &
-                                                  surf_lsm_v(3)%rad_lw_out,                        &
-                                                  surf_usm_v(3)%rad_lw_out )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_lw_out, surf_lsm_h(0)%rad_lw_out, surf_usm_h(0)%rad_lw_out, &
+                    surf_def_h(1)%rad_lw_out, surf_lsm_h(1)%rad_lw_out, surf_usm_h(1)%rad_lw_out, &
+                    surf_def_v(0)%rad_lw_out, surf_lsm_v(0)%rad_lw_out, surf_usm_v(0)%rad_lw_out, &
+                    surf_def_v(1)%rad_lw_out, surf_lsm_v(1)%rad_lw_out, surf_usm_v(1)%rad_lw_out, &
+                    surf_def_v(2)%rad_lw_out, surf_lsm_v(2)%rad_lw_out, surf_usm_v(2)%rad_lw_out, &
+                    surf_def_v(3)%rad_lw_out, surf_lsm_v(3)%rad_lw_out, surf_usm_v(3)%rad_lw_out )
              ELSE
 !
@@ -2258,18 +2192,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_sw_in,                         &
-                                                  surf_def_h(1)%rad_sw_in, surf_lsm_h%rad_sw_in,   &
-                                                  surf_usm_h%rad_sw_in, surf_def_v(0)%rad_sw_in,   &
-                                                  surf_lsm_v(0)%rad_sw_in,                         &
-                                                  surf_usm_v(0)%rad_sw_in,                         &
-                                                  surf_def_v(1)%rad_sw_in,                         &
-                                                  surf_lsm_v(1)%rad_sw_in,                         &
-                                                  surf_usm_v(1)%rad_sw_in,                         &
-                                                  surf_def_v(2)%rad_sw_in,                         &
-                                                  surf_lsm_v(2)%rad_sw_in,                         &
-                                                  surf_usm_v(2)%rad_sw_in,                         &
-                                                  surf_def_v(3)%rad_sw_in,                         &
-                                                  surf_lsm_v(3)%rad_sw_in,                         &
-                                                  surf_usm_v(3)%rad_sw_in )
+                CALL surface_data_output_collect(                                              &
+                    surf_def_h(0)%rad_sw_in, surf_lsm_h(0)%rad_sw_in, surf_usm_h(0)%rad_sw_in, &
+                    surf_def_h(1)%rad_sw_in, surf_lsm_h(1)%rad_sw_in, surf_usm_h(1)%rad_sw_in, &
+                    surf_def_v(0)%rad_sw_in, surf_lsm_v(0)%rad_sw_in, surf_usm_v(0)%rad_sw_in, &
+                    surf_def_v(1)%rad_sw_in, surf_lsm_v(1)%rad_sw_in, surf_usm_v(1)%rad_sw_in, &
+                    surf_def_v(2)%rad_sw_in, surf_lsm_v(2)%rad_sw_in, surf_usm_v(2)%rad_sw_in, &
+                    surf_def_v(3)%rad_sw_in, surf_lsm_v(3)%rad_sw_in, surf_usm_v(3)%rad_sw_in )
              ELSE
 !
@@ -2284,18 +2211,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_sw_out,                        &
-                                                  surf_def_h(1)%rad_sw_out, surf_lsm_h%rad_sw_out, &
-                                                  surf_usm_h%rad_sw_out, surf_def_v(0)%rad_sw_out, &
-                                                  surf_lsm_v(0)%rad_sw_out,                        &
-                                                  surf_usm_v(0)%rad_sw_out,                        &
-                                                  surf_def_v(1)%rad_sw_out,                        &
-                                                  surf_lsm_v(1)%rad_sw_out,                        &
-                                                  surf_usm_v(1)%rad_sw_out,                        &
-                                                  surf_def_v(2)%rad_sw_out,                        &
-                                                  surf_lsm_v(2)%rad_sw_out,                        &
-                                                  surf_usm_v(2)%rad_sw_out,                        &
-                                                  surf_def_v(3)%rad_sw_out,                        &
-                                                  surf_lsm_v(3)%rad_sw_out,                        &
-                                                  surf_usm_v(3)%rad_sw_out )
+                CALL surface_data_output_collect(                                                    &
+                    surf_def_h(0)%rad_sw_out, surf_lsm_h(0)%rad_sw_out, surf_usm_h(0)%rad_sw_out,    &
+                    surf_def_h(1)%rad_sw_out, surf_lsm_h(1)%rad_sw_out, surf_usm_h(1)%rad_sw_out,    &
+                    surf_def_v(0)%rad_sw_out, surf_lsm_v(0)%rad_sw_out, surf_usm_v(0)%rad_sw_out,    &
+                    surf_def_v(1)%rad_sw_out, surf_lsm_v(1)%rad_sw_out, surf_usm_v(1)%rad_sw_out,    &
+                    surf_def_v(2)%rad_sw_out, surf_lsm_v(2)%rad_sw_out, surf_usm_v(2)%rad_sw_out,    &
+                    surf_def_v(3)%rad_sw_out, surf_lsm_v(3)%rad_sw_out, surf_usm_v(3)%rad_sw_out )
              ELSE
 !
@@ -2313,10 +2233,13 @@
 !--             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)
+                DO  l = 0, 1
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%ghf(m) = surf_usm_h(l)%frac(m,ind_veg_wall) *                 &
+                                          surf_usm_h(l)%wghf_eb(m) +                              &
+                                          surf_usm_h(l)%frac(m,ind_pav_green) *                   &
+                                          surf_usm_h(l)%wghf_eb_green(m) +                        &
+                                          surf_usm_h(l)%frac(m,ind_wat_win) *                     &
+                                          surf_usm_h(l)%wghf_eb_window(m)
+                   ENDDO
                 ENDDO
                 DO  l = 0, 3
@@ -2331,12 +2254,11 @@
                 ENDDO
 
-                CALL surface_data_output_collect( surf_def_h(0)%ghf, surf_def_h(1)%ghf,            &
-                                                  surf_lsm_h%ghf, surf_usm_h%ghf,                  &
-                                                  surf_def_v(0)%ghf, surf_lsm_v(0)%ghf,            &
-                                                  surf_usm_v(0)%ghf, surf_def_v(1)%ghf,            &
-                                                  surf_lsm_v(1)%ghf, surf_usm_v(1)%ghf,            &
-                                                  surf_def_v(2)%ghf, surf_lsm_v(2)%ghf,            &
-                                                  surf_usm_v(2)%ghf, surf_def_v(3)%ghf,            &
-                                                  surf_lsm_v(3)%ghf, surf_usm_v(3)%ghf )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%ghf, surf_lsm_h(0)%ghf, surf_usm_h(0)%ghf,    &
+                          surf_def_h(1)%ghf, surf_lsm_h(1)%ghf, surf_usm_h(1)%ghf,    &
+                          surf_def_v(0)%ghf, surf_lsm_v(0)%ghf, surf_usm_v(0)%ghf,    &
+                          surf_def_v(1)%ghf, surf_lsm_v(1)%ghf, surf_usm_v(1)%ghf,    &
+                          surf_def_v(2)%ghf, surf_lsm_v(2)%ghf, surf_usm_v(2)%ghf,    &
+                          surf_def_v(3)%ghf, surf_lsm_v(3)%ghf, surf_usm_v(3)%ghf )
              ELSE
 !
@@ -2351,12 +2273,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%r_a, surf_def_h(1)%r_a,            &
-                                                  surf_lsm_h%r_a, surf_usm_h%r_a,                  &
-                                                  surf_def_v(0)%r_a, surf_lsm_v(0)%r_a,            &
-                                                  surf_usm_v(0)%r_a, surf_def_v(1)%r_a,            &
-                                                  surf_lsm_v(1)%r_a, surf_usm_v(1)%r_a,            &
-                                                  surf_def_v(2)%r_a, surf_lsm_v(2)%r_a,            &
-                                                  surf_usm_v(2)%r_a, surf_def_v(3)%r_a,            &
-                                                  surf_lsm_v(3)%r_a, surf_usm_v(3)%r_a )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%r_a, surf_lsm_h(0)%r_a, surf_usm_h(0)%r_a,    &
+                          surf_def_h(1)%r_a, surf_lsm_h(1)%r_a, surf_usm_h(1)%r_a,    &
+                          surf_def_v(0)%r_a, surf_lsm_v(0)%r_a, surf_usm_v(0)%r_a,    &
+                          surf_def_v(1)%r_a, surf_lsm_v(1)%r_a, surf_usm_v(1)%r_a,    &
+                          surf_def_v(2)%r_a, surf_lsm_v(2)%r_a, surf_usm_v(2)%r_a,    &
+                          surf_def_v(3)%r_a, surf_lsm_v(3)%r_a, surf_usm_v(3)%r_a )
              ELSE
 !
@@ -2371,12 +2292,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%r_soil, surf_def_h(1)%r_soil,      &
-                                                  surf_lsm_h%r_soil, surf_usm_h%r_soil,            &
-                                                  surf_def_v(0)%r_soil, surf_lsm_v(0)%r_soil,      &
-                                                  surf_usm_v(0)%r_soil, surf_def_v(1)%r_soil,      &
-                                                  surf_lsm_v(1)%r_soil, surf_usm_v(1)%r_soil,      &
-                                                  surf_def_v(2)%r_soil, surf_lsm_v(2)%r_soil,      &
-                                                  surf_usm_v(2)%r_soil, surf_def_v(3)%r_soil,      &
-                                                  surf_lsm_v(3)%r_soil, surf_usm_v(3)%r_soil )
+                CALL surface_data_output_collect(                                              &
+                          surf_def_h(0)%r_soil, surf_lsm_h(0)%r_soil, surf_usm_h(0)%r_soil,    &
+                          surf_def_h(1)%r_soil, surf_lsm_h(1)%r_soil, surf_usm_h(1)%r_soil,    &
+                          surf_def_v(0)%r_soil, surf_lsm_v(0)%r_soil, surf_usm_v(0)%r_soil,    &
+                          surf_def_v(1)%r_soil, surf_lsm_v(1)%r_soil, surf_usm_v(1)%r_soil,    &
+                          surf_def_v(2)%r_soil, surf_lsm_v(2)%r_soil, surf_usm_v(2)%r_soil,    &
+                          surf_def_v(3)%r_soil, surf_lsm_v(3)%r_soil, surf_usm_v(3)%r_soil )
              ELSE
 !
@@ -2391,12 +2311,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%r_canopy, surf_def_h(1)%r_canopy,  &
-                                                  surf_lsm_h%r_canopy, surf_usm_h%r_canopy,        &
-                                                  surf_def_v(0)%r_canopy, surf_lsm_v(0)%r_canopy,  &
-                                                  surf_usm_v(0)%r_canopy, surf_def_v(1)%r_canopy,  &
-                                                  surf_lsm_v(1)%r_canopy, surf_usm_v(1)%r_canopy,  &
-                                                  surf_def_v(2)%r_canopy, surf_lsm_v(2)%r_canopy,  &
-                                                  surf_usm_v(2)%r_canopy, surf_def_v(3)%r_canopy,  &
-                                                  surf_lsm_v(3)%r_canopy, surf_usm_v(3)%r_canopy )
+                CALL surface_data_output_collect(                                                 &
+                          surf_def_h(0)%r_canopy, surf_lsm_h(0)%r_canopy, surf_usm_h(0)%r_canopy, &
+                          surf_def_h(1)%r_canopy, surf_lsm_h(1)%r_canopy, surf_usm_h(1)%r_canopy, &
+                          surf_def_v(0)%r_canopy, surf_lsm_v(0)%r_canopy, surf_usm_v(0)%r_canopy, &
+                          surf_def_v(1)%r_canopy, surf_lsm_v(1)%r_canopy, surf_usm_v(1)%r_canopy, &
+                          surf_def_v(2)%r_canopy, surf_lsm_v(2)%r_canopy, surf_usm_v(2)%r_canopy, &
+                          surf_def_v(3)%r_canopy, surf_lsm_v(3)%r_canopy, surf_usm_v(3)%r_canopy )
              ELSE
 !
@@ -2411,12 +2330,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%r_s, surf_def_h(1)%r_s,            &
-                                                  surf_lsm_h%r_s, surf_usm_h%r_s,                  &
-                                                  surf_def_v(0)%r_s, surf_lsm_v(0)%r_s,            &
-                                                  surf_usm_v(0)%r_s, surf_def_v(1)%r_s,            &
-                                                  surf_lsm_v(1)%r_s, surf_usm_v(1)%r_s,            &
-                                                  surf_def_v(2)%r_s, surf_lsm_v(2)%r_s,            &
-                                                  surf_usm_v(2)%r_s, surf_def_v(3)%r_s,            &
-                                                  surf_lsm_v(3)%r_s, surf_usm_v(3)%r_s )
+                CALL surface_data_output_collect(                                     &
+                          surf_def_h(0)%r_s, surf_lsm_h(0)%r_s, surf_usm_h(0)%r_s,    &
+                          surf_def_h(1)%r_s, surf_lsm_h(1)%r_s, surf_usm_h(1)%r_s,    &
+                          surf_def_v(0)%r_s, surf_lsm_v(0)%r_s, surf_usm_v(0)%r_s,    &
+                          surf_def_v(1)%r_s, surf_lsm_v(1)%r_s, surf_usm_v(1)%r_s,    &
+                          surf_def_v(2)%r_s, surf_lsm_v(2)%r_s, surf_usm_v(2)%r_s,    &
+                          surf_def_v(3)%r_s, surf_lsm_v(3)%r_s, surf_usm_v(3)%r_s )
              ELSE
 !
@@ -2431,18 +2349,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_sw_dir,                        &
-                                                  surf_def_h(1)%rad_sw_dir, surf_lsm_h%rad_sw_dir, &
-                                                  surf_usm_h%rad_sw_dir, surf_def_v(0)%rad_sw_dir, &
-                                                  surf_lsm_v(0)%rad_sw_dir,                        &
-                                                  surf_usm_v(0)%rad_sw_dir,                        &
-                                                  surf_def_v(1)%rad_sw_dir,                        &
-                                                  surf_lsm_v(1)%rad_sw_dir,                        &
-                                                  surf_usm_v(1)%rad_sw_dir,                        &
-                                                  surf_def_v(2)%rad_sw_dir,                        &
-                                                  surf_lsm_v(2)%rad_sw_dir,                        &
-                                                  surf_usm_v(2)%rad_sw_dir,                        &
-                                                  surf_def_v(3)%rad_sw_dir,                        &
-                                                  surf_lsm_v(3)%rad_sw_dir,                        &
-                                                  surf_usm_v(3)%rad_sw_dir )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_sw_dir, surf_lsm_h(0)%rad_sw_dir, surf_usm_h(0)%rad_sw_dir, &
+                    surf_def_h(1)%rad_sw_dir, surf_lsm_h(1)%rad_sw_dir, surf_usm_h(1)%rad_sw_dir, &
+                    surf_def_v(0)%rad_sw_dir, surf_lsm_v(0)%rad_sw_dir, surf_usm_v(0)%rad_sw_dir, &
+                    surf_def_v(1)%rad_sw_dir, surf_lsm_v(1)%rad_sw_dir, surf_usm_v(1)%rad_sw_dir, &
+                    surf_def_v(2)%rad_sw_dir, surf_lsm_v(2)%rad_sw_dir, surf_usm_v(2)%rad_sw_dir, &
+                    surf_def_v(3)%rad_sw_dir, surf_lsm_v(3)%rad_sw_dir, surf_usm_v(3)%rad_sw_dir )
              ELSE
 !
@@ -2457,18 +2368,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_sw_dif,                        &
-                                                  surf_def_h(1)%rad_sw_dif, surf_lsm_h%rad_sw_dif, &
-                                                  surf_usm_h%rad_sw_dif, surf_def_v(0)%rad_sw_dif, &
-                                                  surf_lsm_v(0)%rad_sw_dif,                        &
-                                                  surf_usm_v(0)%rad_sw_dif,                        &
-                                                  surf_def_v(1)%rad_sw_dif,                        &
-                                                  surf_lsm_v(1)%rad_sw_dif,                        &
-                                                  surf_usm_v(1)%rad_sw_dif,                        &
-                                                  surf_def_v(2)%rad_sw_dif,                        &
-                                                  surf_lsm_v(2)%rad_sw_dif,                        &
-                                                  surf_usm_v(2)%rad_sw_dif,                        &
-                                                  surf_def_v(3)%rad_sw_dif,                        &
-                                                  surf_lsm_v(3)%rad_sw_dif,                        &
-                                                  surf_usm_v(3)%rad_sw_dif )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_sw_dif, surf_lsm_h(0)%rad_sw_dif, surf_usm_h(0)%rad_sw_dif, &
+                    surf_def_h(1)%rad_sw_dif, surf_lsm_h(1)%rad_sw_dif, surf_usm_h(1)%rad_sw_dif, &
+                    surf_def_v(0)%rad_sw_dif, surf_lsm_v(0)%rad_sw_dif, surf_usm_v(0)%rad_sw_dif, &
+                    surf_def_v(1)%rad_sw_dif, surf_lsm_v(1)%rad_sw_dif, surf_usm_v(1)%rad_sw_dif, &
+                    surf_def_v(2)%rad_sw_dif, surf_lsm_v(2)%rad_sw_dif, surf_usm_v(2)%rad_sw_dif, &
+                    surf_def_v(3)%rad_sw_dif, surf_lsm_v(3)%rad_sw_dif, surf_usm_v(3)%rad_sw_dif )
              ELSE
 !
@@ -2483,18 +2387,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_sw_ref,                        &
-                                                  surf_def_h(1)%rad_sw_ref, surf_lsm_h%rad_sw_ref, &
-                                                  surf_usm_h%rad_sw_ref, surf_def_v(0)%rad_sw_ref, &
-                                                  surf_lsm_v(0)%rad_sw_ref,                        &
-                                                  surf_usm_v(0)%rad_sw_ref,                        &
-                                                  surf_def_v(1)%rad_sw_ref,                        &
-                                                  surf_lsm_v(1)%rad_sw_ref,                        &
-                                                  surf_usm_v(1)%rad_sw_ref,                        &
-                                                  surf_def_v(2)%rad_sw_ref,                        &
-                                                  surf_lsm_v(2)%rad_sw_ref,                        &
-                                                  surf_usm_v(2)%rad_sw_ref,                        &
-                                                  surf_def_v(3)%rad_sw_ref,                        &
-                                                  surf_lsm_v(3)%rad_sw_ref,                        &
-                                                  surf_usm_v(3)%rad_sw_ref )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_sw_ref, surf_lsm_h(0)%rad_sw_ref, surf_usm_h(0)%rad_sw_ref, &
+                    surf_def_h(1)%rad_sw_ref, surf_lsm_h(1)%rad_sw_ref, surf_usm_h(1)%rad_sw_ref, &
+                    surf_def_v(0)%rad_sw_ref, surf_lsm_v(0)%rad_sw_ref, surf_usm_v(0)%rad_sw_ref, &
+                    surf_def_v(1)%rad_sw_ref, surf_lsm_v(1)%rad_sw_ref, surf_usm_v(1)%rad_sw_ref, &
+                    surf_def_v(2)%rad_sw_ref, surf_lsm_v(2)%rad_sw_ref, surf_usm_v(2)%rad_sw_ref, &
+                    surf_def_v(3)%rad_sw_ref, surf_lsm_v(3)%rad_sw_ref, surf_usm_v(3)%rad_sw_ref )
              ELSE
 !
@@ -2509,18 +2406,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_sw_res,                        &
-                                                  surf_def_h(1)%rad_sw_res, surf_lsm_h%rad_sw_res, &
-                                                  surf_usm_h%rad_sw_res, surf_def_v(0)%rad_sw_res, &
-                                                  surf_lsm_v(0)%rad_sw_res,                        &
-                                                  surf_usm_v(0)%rad_sw_res,                        &
-                                                  surf_def_v(1)%rad_sw_res,                        &
-                                                  surf_lsm_v(1)%rad_sw_res,                        &
-                                                  surf_usm_v(1)%rad_sw_res,                        &
-                                                  surf_def_v(2)%rad_sw_res,                        &
-                                                  surf_lsm_v(2)%rad_sw_res,                        &
-                                                  surf_usm_v(2)%rad_sw_res,                        &
-                                                  surf_def_v(3)%rad_sw_res,                        &
-                                                  surf_lsm_v(3)%rad_sw_res,                        &
-                                                  surf_usm_v(3)%rad_sw_res )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_sw_res, surf_lsm_h(0)%rad_sw_res, surf_usm_h(0)%rad_sw_res, &
+                    surf_def_h(1)%rad_sw_res, surf_lsm_h(1)%rad_sw_res, surf_usm_h(1)%rad_sw_res, &
+                    surf_def_v(0)%rad_sw_res, surf_lsm_v(0)%rad_sw_res, surf_usm_v(0)%rad_sw_res, &
+                    surf_def_v(1)%rad_sw_res, surf_lsm_v(1)%rad_sw_res, surf_usm_v(1)%rad_sw_res, &
+                    surf_def_v(2)%rad_sw_res, surf_lsm_v(2)%rad_sw_res, surf_usm_v(2)%rad_sw_res, &
+                    surf_def_v(3)%rad_sw_res, surf_lsm_v(3)%rad_sw_res, surf_usm_v(3)%rad_sw_res )
              ELSE
 !
@@ -2535,18 +2425,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_lw_dif,                        &
-                                                  surf_def_h(1)%rad_lw_dif, surf_lsm_h%rad_lw_dif, &
-                                                  surf_usm_h%rad_lw_dif, surf_def_v(0)%rad_lw_dif, &
-                                                  surf_lsm_v(0)%rad_lw_dif,                        &
-                                                  surf_usm_v(0)%rad_lw_dif,                        &
-                                                  surf_def_v(1)%rad_lw_dif,                        &
-                                                  surf_lsm_v(1)%rad_lw_dif,                        &
-                                                  surf_usm_v(1)%rad_lw_dif,                        &
-                                                  surf_def_v(2)%rad_lw_dif,                        &
-                                                  surf_lsm_v(2)%rad_lw_dif,                        &
-                                                  surf_usm_v(2)%rad_lw_dif,                        &
-                                                  surf_def_v(3)%rad_lw_dif,                        &
-                                                  surf_lsm_v(3)%rad_lw_dif,                        &
-                                                  surf_usm_v(3)%rad_lw_dif )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_lw_dif, surf_lsm_h(0)%rad_lw_dif, surf_usm_h(0)%rad_lw_dif, &
+                    surf_def_h(1)%rad_lw_dif, surf_lsm_h(1)%rad_lw_dif, surf_usm_h(1)%rad_lw_dif, &
+                    surf_def_v(0)%rad_lw_dif, surf_lsm_v(0)%rad_lw_dif, surf_usm_v(0)%rad_lw_dif, &
+                    surf_def_v(1)%rad_lw_dif, surf_lsm_v(1)%rad_lw_dif, surf_usm_v(1)%rad_lw_dif, &
+                    surf_def_v(2)%rad_lw_dif, surf_lsm_v(2)%rad_lw_dif, surf_usm_v(2)%rad_lw_dif, &
+                    surf_def_v(3)%rad_lw_dif, surf_lsm_v(3)%rad_lw_dif, surf_usm_v(3)%rad_lw_dif )
              ELSE
 !
@@ -2561,18 +2444,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_lw_ref,                        &
-                                                  surf_def_h(1)%rad_lw_ref, surf_lsm_h%rad_lw_ref, &
-                                                  surf_usm_h%rad_lw_ref, surf_def_v(0)%rad_lw_ref, &
-                                                  surf_lsm_v(0)%rad_lw_ref,                        &
-                                                  surf_usm_v(0)%rad_lw_ref,                        &
-                                                  surf_def_v(1)%rad_lw_ref,                        &
-                                                  surf_lsm_v(1)%rad_lw_ref,                        &
-                                                  surf_usm_v(1)%rad_lw_ref,                        &
-                                                  surf_def_v(2)%rad_lw_ref,                        &
-                                                  surf_lsm_v(2)%rad_lw_ref,                        &
-                                                  surf_usm_v(2)%rad_lw_ref,                        &
-                                                  surf_def_v(3)%rad_lw_ref,                        &
-                                                  surf_lsm_v(3)%rad_lw_ref,                        &
-                                                  surf_usm_v(3)%rad_lw_ref )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_lw_ref, surf_lsm_h(0)%rad_lw_ref, surf_usm_h(0)%rad_lw_ref, &
+                    surf_def_h(1)%rad_lw_ref, surf_lsm_h(1)%rad_lw_ref, surf_usm_h(1)%rad_lw_ref, &
+                    surf_def_v(0)%rad_lw_ref, surf_lsm_v(0)%rad_lw_ref, surf_usm_v(0)%rad_lw_ref, &
+                    surf_def_v(1)%rad_lw_ref, surf_lsm_v(1)%rad_lw_ref, surf_usm_v(1)%rad_lw_ref, &
+                    surf_def_v(2)%rad_lw_ref, surf_lsm_v(2)%rad_lw_ref, surf_usm_v(2)%rad_lw_ref, &
+                    surf_def_v(3)%rad_lw_ref, surf_lsm_v(3)%rad_lw_ref, surf_usm_v(3)%rad_lw_ref )
              ELSE
 !
@@ -2587,18 +2463,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%rad_lw_res,                        &
-                                                  surf_def_h(1)%rad_lw_res, surf_lsm_h%rad_lw_res, &
-                                                  surf_usm_h%rad_lw_res, surf_def_v(0)%rad_lw_res, &
-                                                  surf_lsm_v(0)%rad_lw_res,                        &
-                                                  surf_usm_v(0)%rad_lw_res,                        &
-                                                  surf_def_v(1)%rad_lw_res,                        &
-                                                  surf_lsm_v(1)%rad_lw_res,                        &
-                                                  surf_usm_v(1)%rad_lw_res,                        &
-                                                  surf_def_v(2)%rad_lw_res,                        &
-                                                  surf_lsm_v(2)%rad_lw_res,                        &
-                                                  surf_usm_v(2)%rad_lw_res,                        &
-                                                  surf_def_v(3)%rad_lw_res,                        &
-                                                  surf_lsm_v(3)%rad_lw_res,                        &
-                                                  surf_usm_v(3)%rad_lw_res )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%rad_lw_res, surf_lsm_h(0)%rad_lw_res, surf_usm_h(0)%rad_lw_res, &
+                    surf_def_h(1)%rad_lw_res, surf_lsm_h(1)%rad_lw_res, surf_usm_h(1)%rad_lw_res, &
+                    surf_def_v(0)%rad_lw_res, surf_lsm_v(0)%rad_lw_res, surf_usm_v(0)%rad_lw_res, &
+                    surf_def_v(1)%rad_lw_res, surf_lsm_v(1)%rad_lw_res, surf_usm_v(1)%rad_lw_res, &
+                    surf_def_v(2)%rad_lw_res, surf_lsm_v(2)%rad_lw_res, surf_usm_v(2)%rad_lw_res, &
+                    surf_def_v(3)%rad_lw_res, surf_lsm_v(3)%rad_lw_res, surf_usm_v(3)%rad_lw_res )
              ELSE
 !
@@ -2613,18 +2482,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%uvw_abs,                           &
-                                                  surf_def_h(1)%uvw_abs, surf_lsm_h%uvw_abs,       &
-                                                  surf_usm_h%uvw_abs, surf_def_v(0)%uvw_abs,       &
-                                                  surf_lsm_v(0)%uvw_abs,                           &
-                                                  surf_usm_v(0)%uvw_abs,                           &
-                                                  surf_def_v(1)%uvw_abs,                           &
-                                                  surf_lsm_v(1)%uvw_abs,                           &
-                                                  surf_usm_v(1)%uvw_abs,                           &
-                                                  surf_def_v(2)%uvw_abs,                           &
-                                                  surf_lsm_v(2)%uvw_abs,                           &
-                                                  surf_usm_v(2)%uvw_abs,                           &
-                                                  surf_def_v(3)%uvw_abs,                           &
-                                                  surf_lsm_v(3)%uvw_abs,                           &
-                                                  surf_usm_v(3)%uvw_abs )
+                CALL surface_data_output_collect(                                                 &
+                          surf_def_h(0)%uvw_abs, surf_lsm_h(0)%uvw_abs, surf_usm_h(0)%uvw_abs,    &
+                          surf_def_h(1)%uvw_abs, surf_lsm_h(1)%uvw_abs, surf_usm_h(1)%uvw_abs,    &
+                          surf_def_v(0)%uvw_abs, surf_lsm_v(0)%uvw_abs, surf_usm_v(0)%uvw_abs,    &
+                          surf_def_v(1)%uvw_abs, surf_lsm_v(1)%uvw_abs, surf_usm_v(1)%uvw_abs,    &
+                          surf_def_v(2)%uvw_abs, surf_lsm_v(2)%uvw_abs, surf_usm_v(2)%uvw_abs,    &
+                          surf_def_v(3)%uvw_abs, surf_lsm_v(3)%uvw_abs, surf_usm_v(3)%uvw_abs )
              ELSE
 !
@@ -2640,18 +2502,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%waste_heat,                        &
-                                                  surf_def_h(1)%waste_heat, surf_lsm_h%waste_heat, &
-                                                  surf_usm_h%waste_heat, surf_def_v(0)%waste_heat, &
-                                                  surf_lsm_v(0)%waste_heat,                        &
-                                                  surf_usm_v(0)%waste_heat,                        &
-                                                  surf_def_v(1)%waste_heat,                        &
-                                                  surf_lsm_v(1)%waste_heat,                        &
-                                                  surf_usm_v(1)%waste_heat,                        &
-                                                  surf_def_v(2)%waste_heat,                        &
-                                                  surf_lsm_v(2)%waste_heat,                        &
-                                                  surf_usm_v(2)%waste_heat,                        &
-                                                  surf_def_v(3)%waste_heat,                        &
-                                                  surf_lsm_v(3)%waste_heat,                        &
-                                                  surf_usm_v(3)%waste_heat )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%waste_heat, surf_lsm_h(0)%waste_heat, surf_usm_h(0)%waste_heat, &
+                    surf_def_h(1)%waste_heat, surf_lsm_h(1)%waste_heat, surf_usm_h(1)%waste_heat, &
+                    surf_def_v(0)%waste_heat, surf_lsm_v(0)%waste_heat, surf_usm_v(0)%waste_heat, &
+                    surf_def_v(1)%waste_heat, surf_lsm_v(1)%waste_heat, surf_usm_v(1)%waste_heat, &
+                    surf_def_v(2)%waste_heat, surf_lsm_v(2)%waste_heat, surf_usm_v(2)%waste_heat, &
+                    surf_def_v(3)%waste_heat, surf_lsm_v(3)%waste_heat, surf_usm_v(3)%waste_heat )
              ELSE
 !
@@ -2667,12 +2522,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%iwghf_eb, surf_def_h(1)%iwghf_eb,  &
-                                                  surf_lsm_h%iwghf_eb, surf_usm_h%iwghf_eb,        &
-                                                  surf_def_v(0)%iwghf_eb, surf_lsm_v(0)%iwghf_eb,  &
-                                                  surf_usm_v(0)%iwghf_eb, surf_def_v(1)%iwghf_eb,  &
-                                                  surf_lsm_v(1)%iwghf_eb, surf_usm_v(1)%iwghf_eb,  &
-                                                  surf_def_v(2)%iwghf_eb, surf_lsm_v(2)%iwghf_eb,  &
-                                                  surf_usm_v(2)%iwghf_eb, surf_def_v(3)%iwghf_eb,  &
-                                                  surf_lsm_v(3)%iwghf_eb, surf_usm_v(3)%iwghf_eb )
+                CALL surface_data_output_collect(                                                 &
+                          surf_def_h(0)%iwghf_eb, surf_lsm_h(0)%iwghf_eb, surf_usm_h(0)%iwghf_eb, &
+                          surf_def_h(1)%iwghf_eb, surf_lsm_h(1)%iwghf_eb, surf_usm_h(1)%iwghf_eb, &
+                          surf_def_v(0)%iwghf_eb, surf_lsm_v(0)%iwghf_eb, surf_usm_v(0)%iwghf_eb, &
+                          surf_def_v(1)%iwghf_eb, surf_lsm_v(1)%iwghf_eb, surf_usm_v(1)%iwghf_eb, &
+                          surf_def_v(2)%iwghf_eb, surf_lsm_v(2)%iwghf_eb, surf_usm_v(2)%iwghf_eb, &
+                          surf_def_v(3)%iwghf_eb, surf_lsm_v(3)%iwghf_eb, surf_usm_v(3)%iwghf_eb )
              ELSE
 !
@@ -2688,12 +2542,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%albedo, surf_def_h(1)%albedo,      &
-                                                  surf_lsm_h%albedo, surf_usm_h%albedo,            &
-                                                  surf_def_v(0)%albedo, surf_lsm_v(0)%albedo,      &
-                                                  surf_usm_v(0)%albedo, surf_def_v(1)%albedo,      &
-                                                  surf_lsm_v(1)%albedo, surf_usm_v(1)%albedo,      &
-                                                  surf_def_v(2)%albedo, surf_lsm_v(2)%albedo,      &
-                                                  surf_usm_v(2)%albedo, surf_def_v(3)%albedo,      &
-                                                  surf_lsm_v(3)%albedo, surf_usm_v(3)%albedo )
+                CALL surface_data_output_collect(                                              &
+                          surf_def_h(0)%albedo, surf_lsm_h(0)%albedo, surf_usm_h(0)%albedo,    &
+                          surf_def_h(1)%albedo, surf_lsm_h(1)%albedo, surf_usm_h(1)%albedo,    &
+                          surf_def_v(0)%albedo, surf_lsm_v(0)%albedo, surf_usm_v(0)%albedo,    &
+                          surf_def_v(1)%albedo, surf_lsm_v(1)%albedo, surf_usm_v(1)%albedo,    &
+                          surf_def_v(2)%albedo, surf_lsm_v(2)%albedo, surf_usm_v(2)%albedo,    &
+                          surf_def_v(3)%albedo, surf_lsm_v(3)%albedo, surf_usm_v(3)%albedo )
              ELSE
 !
@@ -2709,18 +2562,11 @@
 !--          Output of instantaneous data
              IF ( av == 0 )  THEN
-                CALL surface_data_output_collect( surf_def_h(0)%emissivity,                        &
-                                                  surf_def_h(1)%emissivity, surf_lsm_h%emissivity, &
-                                                  surf_usm_h%emissivity, surf_def_v(0)%emissivity, &
-                                                  surf_lsm_v(0)%emissivity,                        &
-                                                  surf_usm_v(0)%emissivity,                        &
-                                                  surf_def_v(1)%emissivity,                        &
-                                                  surf_lsm_v(1)%emissivity,                        &
-                                                  surf_usm_v(1)%emissivity,                        &
-                                                  surf_def_v(2)%emissivity,                        &
-                                                  surf_lsm_v(2)%emissivity,                        &
-                                                  surf_usm_v(2)%emissivity,                        &
-                                                  surf_def_v(3)%emissivity,                        &
-                                                  surf_lsm_v(3)%emissivity,                        &
-                                                  surf_usm_v(3)%emissivity )
+                CALL surface_data_output_collect(                                                 &
+                    surf_def_h(0)%emissivity, surf_lsm_h(0)%emissivity, surf_usm_h(0)%emissivity, &
+                    surf_def_h(1)%emissivity, surf_lsm_h(1)%emissivity, surf_usm_h(1)%emissivity, &
+                    surf_def_v(0)%emissivity, surf_lsm_v(0)%emissivity, surf_usm_v(0)%emissivity, &
+                    surf_def_v(1)%emissivity, surf_lsm_v(1)%emissivity, surf_usm_v(1)%emissivity, &
+                    surf_def_v(2)%emissivity, surf_lsm_v(2)%emissivity, surf_usm_v(2)%emissivity, &
+                    surf_def_v(3)%emissivity, surf_lsm_v(3)%emissivity, surf_usm_v(3)%emissivity )
              ELSE
 !
@@ -2801,382 +2647,347 @@
 
           CASE ( 'us' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%us, surf_def_h(1)%us, surf_lsm_h%us,   &
-                                              surf_usm_h%us, surf_def_v(0)%us, surf_lsm_v(0)%us,   &
-                                              surf_usm_v(0)%us, surf_def_v(1)%us,                  &
-                                              surf_lsm_v(1)%us, surf_usm_v(1)%us,                  &
-                                              surf_def_v(2)%us, surf_lsm_v(2)%us,                  &
-                                              surf_usm_v(2)%us, surf_def_v(3)%us,                  &
-                                              surf_lsm_v(3)%us, surf_usm_v(3)%us, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%us, surf_lsm_h(0)%us, surf_usm_h(0)%us,                        &
+                     surf_def_h(1)%us, surf_lsm_h(1)%us, surf_usm_h(1)%us,                        &
+                     surf_def_v(0)%us, surf_lsm_v(0)%us, surf_usm_v(0)%us,                        &
+                     surf_def_v(1)%us, surf_lsm_v(1)%us, surf_usm_v(1)%us,                        &
+                     surf_def_v(2)%us, surf_lsm_v(2)%us, surf_usm_v(2)%us,                        &
+                     surf_def_v(3)%us, surf_lsm_v(3)%us, surf_usm_v(3)%us, n_out )
 
           CASE ( 'ts' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%ts, surf_def_h(1)%ts, surf_lsm_h%ts,   &
-                                              surf_usm_h%ts, surf_def_v(0)%ts, surf_lsm_v(0)%ts,   &
-                                              surf_usm_v(0)%ts, surf_def_v(1)%ts,                  &
-                                              surf_lsm_v(1)%ts, surf_usm_v(1)%ts,                  &
-                                              surf_def_v(2)%ts, surf_lsm_v(2)%ts,                  &
-                                              surf_usm_v(2)%ts, surf_def_v(3)%ts,                  &
-                                              surf_lsm_v(3)%ts, surf_usm_v(3)%ts, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%ts, surf_lsm_h(0)%ts, surf_usm_h(0)%ts,                        &
+                     surf_def_h(1)%ts, surf_lsm_h(1)%ts, surf_usm_h(1)%ts,                        &
+                     surf_def_v(0)%ts, surf_lsm_v(0)%ts, surf_usm_v(0)%ts,                        &
+                     surf_def_v(1)%ts, surf_lsm_v(1)%ts, surf_usm_v(1)%ts,                        &
+                     surf_def_v(2)%ts, surf_lsm_v(2)%ts, surf_usm_v(2)%ts,                        &
+                     surf_def_v(3)%ts, surf_lsm_v(3)%ts, surf_usm_v(3)%ts, n_out )
 
           CASE ( 'qs' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qs, surf_def_h(1)%qs, surf_lsm_h%qs,   &
-                                              surf_usm_h%qs, surf_def_v(0)%qs, surf_lsm_v(0)%qs,   &
-                                              surf_usm_v(0)%qs, surf_def_v(1)%qs,                  &
-                                              surf_lsm_v(1)%qs, surf_usm_v(1)%qs,                  &
-                                              surf_def_v(2)%qs, surf_lsm_v(2)%qs,                  &
-                                              surf_usm_v(2)%qs, surf_def_v(3)%qs,                  &
-                                              surf_lsm_v(3)%qs, surf_usm_v(3)%qs, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qs, surf_lsm_h(0)%qs, surf_usm_h(0)%qs,                        &
+                     surf_def_h(1)%qs, surf_lsm_h(1)%qs, surf_usm_h(1)%qs,                        &
+                     surf_def_v(0)%qs, surf_lsm_v(0)%qs, surf_usm_v(0)%qs,                        &
+                     surf_def_v(1)%qs, surf_lsm_v(1)%qs, surf_usm_v(1)%qs,                        &
+                     surf_def_v(2)%qs, surf_lsm_v(2)%qs, surf_usm_v(2)%qs,                        &
+                     surf_def_v(3)%qs, surf_lsm_v(3)%qs, surf_usm_v(3)%qs, n_out )
 
           CASE ( 'ss' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%ss, surf_def_h(1)%ss, surf_lsm_h%ss,   &
-                                              surf_usm_h%ss, surf_def_v(0)%ss, surf_lsm_v(0)%ss,   &
-                                              surf_usm_v(0)%ss, surf_def_v(1)%ss,                  &
-                                              surf_lsm_v(1)%ss, surf_usm_v(1)%ss,                  &
-                                              surf_def_v(2)%ss, surf_lsm_v(2)%ss,                  &
-                                              surf_usm_v(2)%ss, surf_def_v(3)%ss,                  &
-                                              surf_lsm_v(3)%ss, surf_usm_v(3)%ss, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%ss, surf_lsm_h(0)%ss, surf_usm_h(0)%ss,                        &
+                     surf_def_h(1)%ss, surf_lsm_h(1)%ss, surf_usm_h(1)%ss,                        &
+                     surf_def_v(0)%ss, surf_lsm_v(0)%ss, surf_usm_v(0)%ss,                        &
+                     surf_def_v(1)%ss, surf_lsm_v(1)%ss, surf_usm_v(1)%ss,                        &
+                     surf_def_v(2)%ss, surf_lsm_v(2)%ss, surf_usm_v(2)%ss,                        &
+                     surf_def_v(3)%ss, surf_lsm_v(3)%ss, surf_usm_v(3)%ss, n_out )
 
           CASE ( 'qcs' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qcs, surf_def_h(1)%qcs,                &
-                                              surf_lsm_h%qcs, surf_usm_h%qcs, surf_def_v(0)%qcs,   &
-                                              surf_lsm_v(0)%qcs, surf_usm_v(0)%qcs,                &
-                                              surf_def_v(1)%qcs, surf_lsm_v(1)%qcs,                &
-                                              surf_usm_v(1)%qcs, surf_def_v(2)%qcs,                &
-                                              surf_lsm_v(2)%qcs, surf_usm_v(2)%qcs,                &
-                                              surf_def_v(3)%qcs, surf_lsm_v(3)%qcs,                &
-                                              surf_usm_v(3)%qcs, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qcs, surf_lsm_h(0)%qcs, surf_usm_h(0)%qcs,                     &
+                     surf_def_h(1)%qcs, surf_lsm_h(1)%qcs, surf_usm_h(1)%qcs,                     &
+                     surf_def_v(0)%qcs, surf_lsm_v(0)%qcs, surf_usm_v(0)%qcs,                     &
+                     surf_def_v(1)%qcs, surf_lsm_v(1)%qcs, surf_usm_v(1)%qcs,                     &
+                     surf_def_v(2)%qcs, surf_lsm_v(2)%qcs, surf_usm_v(2)%qcs,                     &
+                     surf_def_v(3)%qcs, surf_lsm_v(3)%qcs, surf_usm_v(3)%qcs, n_out )
 
           CASE ( 'ncs' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%ncs, surf_def_h(1)%ncs, surf_lsm_h%ncs,&
-                                              surf_usm_h%ncs, surf_def_v(0)%ncs,                   &
-                                              surf_lsm_v(0)%ncs, surf_usm_v(0)%ncs,                &
-                                              surf_def_v(1)%ncs, surf_lsm_v(1)%ncs,                &
-                                              surf_usm_v(1)%ncs, surf_def_v(2)%ncs,                &
-                                              surf_lsm_v(2)%ncs, surf_usm_v(2)%ncs,                &
-                                              surf_def_v(3)%ncs, surf_lsm_v(3)%ncs,                &
-                                              surf_usm_v(3)%ncs, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%ncs, surf_lsm_h(0)%ncs, surf_usm_h(0)%ncs,                     &
+                     surf_def_h(1)%ncs, surf_lsm_h(1)%ncs, surf_usm_h(1)%ncs,                     &
+                     surf_def_v(0)%ncs, surf_lsm_v(0)%ncs, surf_usm_v(0)%ncs,                     &
+                     surf_def_v(1)%ncs, surf_lsm_v(1)%ncs, surf_usm_v(1)%ncs,                     &
+                     surf_def_v(2)%ncs, surf_lsm_v(2)%ncs, surf_usm_v(2)%ncs,                     &
+                     surf_def_v(3)%ncs, surf_lsm_v(3)%ncs, surf_usm_v(3)%ncs, n_out )
 
           CASE ( 'qis' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qis, surf_def_h(1)%qis,                &
-                                              surf_lsm_h%qis, surf_usm_h%qis, surf_def_v(0)%qis,   &
-                                              surf_lsm_v(0)%qis, surf_usm_v(0)%qis,                &
-                                              surf_def_v(1)%qis, surf_lsm_v(1)%qis,                &
-                                              surf_usm_v(1)%qis, surf_def_v(2)%qis,                &
-                                              surf_lsm_v(2)%qis, surf_usm_v(2)%qis,                &
-                                              surf_def_v(3)%qis, surf_lsm_v(3)%qis,                &
-                                              surf_usm_v(3)%qrs, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qis, surf_lsm_h(0)%qis, surf_usm_h(0)%qis,                     &
+                     surf_def_h(1)%qis, surf_lsm_h(1)%qis, surf_usm_h(1)%qis,                     &
+                     surf_def_v(0)%qis, surf_lsm_v(0)%qis, surf_usm_v(0)%qis,                     &
+                     surf_def_v(1)%qis, surf_lsm_v(1)%qis, surf_usm_v(1)%qis,                     &
+                     surf_def_v(2)%qis, surf_lsm_v(2)%qis, surf_usm_v(2)%qis,                     &
+                     surf_def_v(3)%qis, surf_lsm_v(3)%qis, surf_usm_v(3)%qis, n_out )
 
           CASE ( 'nis' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%nis, surf_def_h(1)%nis,                &
-                                              surf_lsm_h%nis, surf_usm_h%nis, surf_def_v(0)%nis,   &
-                                              surf_lsm_v(0)%nis, surf_usm_v(0)%nis,                &
-                                              surf_def_v(1)%nis, surf_lsm_v(1)%nis,                &
-                                              surf_usm_v(1)%nis, surf_def_v(2)%nis,                &
-                                              surf_lsm_v(2)%nis, surf_usm_v(2)%nis,                &
-                                              surf_def_v(3)%nis, surf_lsm_v(3)%nis,                &
-                                              surf_usm_v(3)%nis, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%nis, surf_lsm_h(0)%nis, surf_usm_h(0)%nis,                     &
+                     surf_def_h(1)%nis, surf_lsm_h(1)%nis, surf_usm_h(1)%nis,                     &
+                     surf_def_v(0)%nis, surf_lsm_v(0)%nis, surf_usm_v(0)%nis,                     &
+                     surf_def_v(1)%nis, surf_lsm_v(1)%nis, surf_usm_v(1)%nis,                     &
+                     surf_def_v(2)%nis, surf_lsm_v(2)%nis, surf_usm_v(2)%nis,                     &
+                     surf_def_v(3)%nis, surf_lsm_v(3)%nis, surf_usm_v(3)%nis, n_out )
 
           CASE ( 'qrs' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qrs, surf_def_h(1)%qrs,                &
-                                              surf_lsm_h%qrs, surf_usm_h%qrs, surf_def_v(0)%qrs,   &
-                                              surf_lsm_v(0)%qrs, surf_usm_v(0)%qrs,                &
-                                              surf_def_v(1)%qrs, surf_lsm_v(1)%qrs,                &
-                                              surf_usm_v(1)%qrs, surf_def_v(2)%qrs,                &
-                                              surf_lsm_v(2)%qrs, surf_usm_v(2)%qrs,                &
-                                              surf_def_v(3)%qrs, surf_lsm_v(3)%qrs,                &
-                                              surf_usm_v(3)%qrs, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qrs, surf_lsm_h(0)%qrs, surf_usm_h(0)%qrs,                     &
+                     surf_def_h(1)%qrs, surf_lsm_h(1)%qrs, surf_usm_h(1)%qrs,                     &
+                     surf_def_v(0)%qrs, surf_lsm_v(0)%qrs, surf_usm_v(0)%qrs,                     &
+                     surf_def_v(1)%qrs, surf_lsm_v(1)%qrs, surf_usm_v(1)%qrs,                     &
+                     surf_def_v(2)%qrs, surf_lsm_v(2)%qrs, surf_usm_v(2)%qrs,                     &
+                     surf_def_v(3)%qrs, surf_lsm_v(3)%qrs, surf_usm_v(3)%qrs, n_out )
 
           CASE ( 'nrs' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%nrs, surf_def_h(1)%nrs,                &
-                                              surf_lsm_h%nrs, surf_usm_h%nrs, surf_def_v(0)%nrs,   &
-                                              surf_lsm_v(0)%nrs, surf_usm_v(0)%nrs,                &
-                                              surf_def_v(1)%nrs, surf_lsm_v(1)%nrs,                &
-                                              surf_usm_v(1)%nrs, surf_def_v(2)%nrs,                &
-                                              surf_lsm_v(2)%nrs, surf_usm_v(2)%nrs,                &
-                                              surf_def_v(3)%nrs, surf_lsm_v(3)%nrs,                &
-                                              surf_usm_v(3)%nrs, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%nrs, surf_lsm_h(0)%nrs, surf_usm_h(0)%nrs,                     &
+                     surf_def_h(1)%nrs, surf_lsm_h(1)%nrs, surf_usm_h(1)%nrs,                     &
+                     surf_def_v(0)%nrs, surf_lsm_v(0)%nrs, surf_usm_v(0)%nrs,                     &
+                     surf_def_v(1)%nrs, surf_lsm_v(1)%nrs, surf_usm_v(1)%nrs,                     &
+                     surf_def_v(2)%nrs, surf_lsm_v(2)%nrs, surf_usm_v(2)%nrs,                     &
+                     surf_def_v(3)%nrs, surf_lsm_v(3)%nrs, surf_usm_v(3)%nrs, n_out )
 
           CASE ( 'ol' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%ol, surf_def_h(1)%ol, surf_lsm_h%ol,   &
-                                              surf_usm_h%ol, surf_def_v(0)%ol, surf_lsm_v(0)%ol,   &
-                                              surf_usm_v(0)%ol, surf_def_v(1)%ol,                  &
-                                              surf_lsm_v(1)%ol, surf_usm_v(1)%ol,                  &
-                                              surf_def_v(2)%ol, surf_lsm_v(2)%ol,                  &
-                                              surf_usm_v(2)%ol, surf_def_v(3)%ol,                  &
-                                              surf_lsm_v(3)%ol, surf_usm_v(3)%ol, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%ol, surf_lsm_h(0)%ol, surf_usm_h(0)%ol,                        &
+                     surf_def_h(1)%ol, surf_lsm_h(1)%ol, surf_usm_h(1)%ol,                        &
+                     surf_def_v(0)%ol, surf_lsm_v(0)%ol, surf_usm_v(0)%ol,                        &
+                     surf_def_v(1)%ol, surf_lsm_v(1)%ol, surf_usm_v(1)%ol,                        &
+                     surf_def_v(2)%ol, surf_lsm_v(2)%ol, surf_usm_v(2)%ol,                        &
+                     surf_def_v(3)%ol, surf_lsm_v(3)%ol, surf_usm_v(3)%ol, n_out )
 
           CASE ( 'z0' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%z0, surf_def_h(1)%z0, surf_lsm_h%z0,   &
-                                              surf_usm_h%z0, surf_def_v(0)%z0, surf_lsm_v(0)%z0,   &
-                                              surf_usm_v(0)%z0, surf_def_v(1)%z0,                  &
-                                              surf_lsm_v(1)%z0, surf_usm_v(1)%z0,                  &
-                                              surf_def_v(2)%z0, surf_lsm_v(2)%z0,                  &
-                                              surf_usm_v(2)%z0, surf_def_v(3)%z0,                  &
-                                              surf_lsm_v(3)%z0, surf_usm_v(3)%z0, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%z0, surf_lsm_h(0)%z0, surf_usm_h(0)%z0,                        &
+                     surf_def_h(1)%z0, surf_lsm_h(1)%z0, surf_usm_h(1)%z0,                        &
+                     surf_def_v(0)%z0, surf_lsm_v(0)%z0, surf_usm_v(0)%z0,                        &
+                     surf_def_v(1)%z0, surf_lsm_v(1)%z0, surf_usm_v(1)%z0,                        &
+                     surf_def_v(2)%z0, surf_lsm_v(2)%z0, surf_usm_v(2)%z0,                        &
+                     surf_def_v(3)%z0, surf_lsm_v(3)%z0, surf_usm_v(3)%z0, n_out )
 
           CASE ( 'z0h' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%z0h, surf_def_h(1)%z0h,                &
-                                              surf_lsm_h%z0h, surf_usm_h%z0h, surf_def_v(0)%z0h,   &
-                                              surf_lsm_v(0)%z0h, surf_usm_v(0)%z0h,                &
-                                              surf_def_v(1)%z0h, surf_lsm_v(1)%z0h,                &
-                                              surf_usm_v(1)%z0h, surf_def_v(2)%z0h,                &
-                                              surf_lsm_v(2)%z0h, surf_usm_v(2)%z0h,                &
-                                              surf_def_v(3)%z0h, surf_lsm_v(3)%z0h,                &
-                                              surf_usm_v(3)%z0h, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%z0h, surf_lsm_h(0)%z0h, surf_usm_h(0)%z0h,                     &
+                     surf_def_h(1)%z0h, surf_lsm_h(1)%z0h, surf_usm_h(1)%z0h,                     &
+                     surf_def_v(0)%z0h, surf_lsm_v(0)%z0h, surf_usm_v(0)%z0h,                     &
+                     surf_def_v(1)%z0h, surf_lsm_v(1)%z0h, surf_usm_v(1)%z0h,                     &
+                     surf_def_v(2)%z0h, surf_lsm_v(2)%z0h, surf_usm_v(2)%z0h,                     &
+                     surf_def_v(3)%z0h, surf_lsm_v(3)%z0h, surf_usm_v(3)%z0h, n_out )
 
           CASE ( 'z0q' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%z0q, surf_def_h(1)%z0q,                &
-                                              surf_lsm_h%z0q, surf_usm_h%z0q, surf_def_v(0)%z0q,   &
-                                              surf_lsm_v(0)%z0q, surf_usm_v(0)%z0q,                &
-                                              surf_def_v(1)%z0q, surf_lsm_v(1)%z0q,                &
-                                              surf_usm_v(1)%z0q, surf_def_v(2)%z0q,                &
-                                              surf_lsm_v(2)%z0q, surf_usm_v(2)%z0q,                &
-                                              surf_def_v(3)%z0q, surf_lsm_v(3)%z0q,                &
-                                              surf_usm_v(3)%z0q, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%z0q, surf_lsm_h(0)%z0q, surf_usm_h(0)%z0q,                     &
+                     surf_def_h(1)%z0q, surf_lsm_h(1)%z0q, surf_usm_h(1)%z0q,                     &
+                     surf_def_v(0)%z0q, surf_lsm_v(0)%z0q, surf_usm_v(0)%z0q,                     &
+                     surf_def_v(1)%z0q, surf_lsm_v(1)%z0q, surf_usm_v(1)%z0q,                     &
+                     surf_def_v(2)%z0q, surf_lsm_v(2)%z0q, surf_usm_v(2)%z0q,                     &
+                     surf_def_v(3)%z0q, surf_lsm_v(3)%z0q, surf_usm_v(3)%z0q, n_out )
 
           CASE ( 'theta1' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%pt1, surf_def_h(1)%pt1,                &
-                                              surf_lsm_h%pt1, surf_usm_h%pt1, surf_def_v(0)%pt1,   &
-                                              surf_lsm_v(0)%pt1, surf_usm_v(0)%pt1,                &
-                                              surf_def_v(1)%pt1, surf_lsm_v(1)%pt1,                &
-                                              surf_usm_v(1)%pt1, surf_def_v(2)%pt1,                &
-                                              surf_lsm_v(2)%pt1, surf_usm_v(2)%pt1,                &
-                                              surf_def_v(3)%pt1, surf_lsm_v(3)%pt1,                &
-                                              surf_usm_v(3)%pt1, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%pt1, surf_lsm_h(0)%pt1, surf_usm_h(0)%pt1,                     &
+                     surf_def_h(1)%pt1, surf_lsm_h(1)%pt1, surf_usm_h(1)%pt1,                     &
+                     surf_def_v(0)%pt1, surf_lsm_v(0)%pt1, surf_usm_v(0)%pt1,                     &
+                     surf_def_v(1)%pt1, surf_lsm_v(1)%pt1, surf_usm_v(1)%pt1,                     &
+                     surf_def_v(2)%pt1, surf_lsm_v(2)%pt1, surf_usm_v(2)%pt1,                     &
+                     surf_def_v(3)%pt1, surf_lsm_v(3)%pt1, surf_usm_v(3)%pt1, n_out )
 
           CASE ( 'qv1' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qv1, surf_def_h(1)%qv1,                &
-                                              surf_lsm_h%qv1, surf_usm_h%qv1, surf_def_v(0)%qv1,   &
-                                              surf_lsm_v(0)%qv1, surf_usm_v(0)%qv1,                &
-                                              surf_def_v(1)%qv1, surf_lsm_v(1)%qv1,                &
-                                              surf_usm_v(1)%qv1, surf_def_v(2)%qv1,                &
-                                              surf_lsm_v(2)%qv1, surf_usm_v(2)%qv1,                &
-                                              surf_def_v(3)%qv1, surf_lsm_v(3)%qv1,                &
-                                              surf_usm_v(3)%qv1, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qv1, surf_lsm_h(0)%qv1, surf_usm_h(0)%qv1,                     &
+                     surf_def_h(1)%qv1, surf_lsm_h(1)%qv1, surf_usm_h(1)%qv1,                     &
+                     surf_def_v(0)%qv1, surf_lsm_v(0)%qv1, surf_usm_v(0)%qv1,                     &
+                     surf_def_v(1)%qv1, surf_lsm_v(1)%qv1, surf_usm_v(1)%qv1,                     &
+                     surf_def_v(2)%qv1, surf_lsm_v(2)%qv1, surf_usm_v(2)%qv1,                     &
+                     surf_def_v(3)%qv1, surf_lsm_v(3)%qv1, surf_usm_v(3)%qv1, n_out )
 
           CASE ( 'thetav1' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%vpt1, surf_def_h(1)%vpt1,              &
-                                              surf_lsm_h%vpt1, surf_usm_h%vpt1,                    &
-                                              surf_def_v(0)%vpt1, surf_lsm_v(0)%vpt1,              &
-                                              surf_usm_v(0)%vpt1, surf_def_v(1)%vpt1,              &
-                                              surf_lsm_v(1)%vpt1, surf_usm_v(1)%vpt1,              &
-                                              surf_def_v(2)%vpt1, surf_lsm_v(2)%vpt1,              &
-                                              surf_usm_v(2)%vpt1, surf_def_v(3)%vpt1,              &
-                                              surf_lsm_v(3)%vpt1, surf_usm_v(3)%vpt1, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%vpt1, surf_lsm_h(0)%vpt1, surf_usm_h(0)%vpt1,                  &
+                     surf_def_h(1)%vpt1, surf_lsm_h(1)%vpt1, surf_usm_h(1)%vpt1,                  &
+                     surf_def_v(0)%vpt1, surf_lsm_v(0)%vpt1, surf_usm_v(0)%vpt1,                  &
+                     surf_def_v(1)%vpt1, surf_lsm_v(1)%vpt1, surf_usm_v(1)%vpt1,                  &
+                     surf_def_v(2)%vpt1, surf_lsm_v(2)%vpt1, surf_usm_v(2)%vpt1,                  &
+                     surf_def_v(3)%vpt1, surf_lsm_v(3)%vpt1, surf_usm_v(3)%vpt1, n_out )
 
           CASE ( 'usws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%usws, surf_def_h(1)%usws,              &
-                                              surf_lsm_h%usws, surf_usm_h%usws,                    &
-                                              surf_def_v(0)%usws, surf_lsm_v(0)%usws,              &
-                                              surf_usm_v(0)%usws, surf_def_v(1)%usws,              &
-                                              surf_lsm_v(1)%usws, surf_usm_v(1)%usws,              &
-                                              surf_def_v(2)%usws, surf_lsm_v(2)%usws,              &
-                                              surf_usm_v(2)%usws, surf_def_v(3)%usws,              &
-                                              surf_lsm_v(3)%usws, surf_usm_v(3)%usws, n_out,       &
-                                              momentumflux_output_conversion )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%usws, surf_lsm_h(0)%usws, surf_usm_h(0)%usws,                  &
+                     surf_def_h(1)%usws, surf_lsm_h(1)%usws, surf_usm_h(1)%usws,                  &
+                     surf_def_v(0)%usws, surf_lsm_v(0)%usws, surf_usm_v(0)%usws,                  &
+                     surf_def_v(1)%usws, surf_lsm_v(1)%usws, surf_usm_v(1)%usws,                  &
+                     surf_def_v(2)%usws, surf_lsm_v(2)%usws, surf_usm_v(2)%usws,                  &
+                     surf_def_v(3)%usws, surf_lsm_v(3)%usws, surf_usm_v(3)%usws, n_out,           &
+                     momentumflux_output_conversion )
 
           CASE ( 'vsws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%vsws, surf_def_h(1)%vsws,              &
-                                              surf_lsm_h%vsws, surf_usm_h%vsws,                    &
-                                              surf_def_v(0)%vsws, surf_lsm_v(0)%vsws,              &
-                                              surf_usm_v(0)%vsws, surf_def_v(1)%vsws,              &
-                                              surf_lsm_v(1)%vsws, surf_usm_v(1)%vsws,              &
-                                              surf_def_v(2)%vsws, surf_lsm_v(2)%vsws,              &
-                                              surf_usm_v(2)%vsws, surf_def_v(3)%vsws,              &
-                                              surf_lsm_v(3)%vsws, surf_usm_v(3)%vsws, n_out,       &
-                                              momentumflux_output_conversion )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%vsws, surf_lsm_h(0)%vsws, surf_usm_h(0)%vsws,                  &
+                     surf_def_h(1)%vsws, surf_lsm_h(1)%vsws, surf_usm_h(1)%vsws,                  &
+                     surf_def_v(0)%vsws, surf_lsm_v(0)%vsws, surf_usm_v(0)%vsws,                  &
+                     surf_def_v(1)%vsws, surf_lsm_v(1)%vsws, surf_usm_v(1)%vsws,                  &
+                     surf_def_v(2)%vsws, surf_lsm_v(2)%vsws, surf_usm_v(2)%vsws,                  &
+                     surf_def_v(3)%vsws, surf_lsm_v(3)%vsws, surf_usm_v(3)%vsws, n_out,           &
+                     momentumflux_output_conversion )
 
           CASE ( 'shf' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%shf, surf_def_h(1)%shf,                &
-                                              surf_lsm_h%shf, surf_usm_h%shf, surf_def_v(0)%shf,   &
-                                              surf_lsm_v(0)%shf, surf_usm_v(0)%shf,                &
-                                              surf_def_v(1)%shf, surf_lsm_v(1)%shf,                &
-                                              surf_usm_v(1)%shf, surf_def_v(2)%shf,                &
-                                              surf_lsm_v(2)%shf, surf_usm_v(2)%shf,                &
-                                              surf_def_v(3)%shf, surf_lsm_v(3)%shf,                &
-                                              surf_usm_v(3)%shf, n_out, heatflux_output_conversion )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%shf, surf_lsm_h(0)%shf, surf_usm_h(0)%shf,                     &
+                     surf_def_h(1)%shf, surf_lsm_h(1)%shf, surf_usm_h(1)%shf,                     &
+                     surf_def_v(0)%shf, surf_lsm_v(0)%shf, surf_usm_v(0)%shf,                     &
+                     surf_def_v(1)%shf, surf_lsm_v(1)%shf, surf_usm_v(1)%shf,                     &
+                     surf_def_v(2)%shf, surf_lsm_v(2)%shf, surf_usm_v(2)%shf,                     &
+                     surf_def_v(3)%shf, surf_lsm_v(3)%shf, surf_usm_v(3)%shf, n_out,              &
+                     heatflux_output_conversion )
 
           CASE ( 'qsws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qsws, surf_def_h(1)%qsws,              &
-                                              surf_lsm_h%qsws, surf_usm_h%qsws,                    &
-                                              surf_def_v(0)%qsws, surf_lsm_v(0)%qsws,              &
-                                              surf_usm_v(0)%qsws, surf_def_v(1)%qsws,              &
-                                              surf_lsm_v(1)%qsws, surf_usm_v(1)%qsws,              &
-                                              surf_def_v(2)%qsws, surf_lsm_v(2)%qsws,              &
-                                              surf_usm_v(2)%qsws, surf_def_v(3)%qsws,              &
-                                              surf_lsm_v(3)%qsws, surf_usm_v(3)%qsws, n_out,       &
-                                              waterflux_output_conversion )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qsws, surf_lsm_h(0)%qsws, surf_usm_h(0)%qsws,                  &
+                     surf_def_h(1)%qsws, surf_lsm_h(1)%qsws, surf_usm_h(1)%qsws,                  &
+                     surf_def_v(0)%qsws, surf_lsm_v(0)%qsws, surf_usm_v(0)%qsws,                  &
+                     surf_def_v(1)%qsws, surf_lsm_v(1)%qsws, surf_usm_v(1)%qsws,                  &
+                     surf_def_v(2)%qsws, surf_lsm_v(2)%qsws, surf_usm_v(2)%qsws,                  &
+                     surf_def_v(3)%qsws, surf_lsm_v(3)%qsws, surf_usm_v(3)%qsws, n_out,           &
+                     waterflux_output_conversion )
 
           CASE ( 'ssws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%ssws, surf_def_h(1)%ssws,              &
-                                              surf_lsm_h%ssws, surf_usm_h%ssws,                    &
-                                              surf_def_v(0)%ssws, surf_lsm_v(0)%ssws,              &
-                                              surf_usm_v(0)%ssws, surf_def_v(1)%ssws,              &
-                                              surf_lsm_v(1)%ssws, surf_usm_v(1)%ssws,              &
-                                              surf_def_v(2)%ssws, surf_lsm_v(2)%ssws,              &
-                                              surf_usm_v(2)%ssws, surf_def_v(3)%ssws,              &
-                                              surf_lsm_v(3)%ssws, surf_usm_v(3)%ssws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%ssws, surf_lsm_h(0)%ssws, surf_usm_h(0)%ssws,                  &
+                     surf_def_h(1)%ssws, surf_lsm_h(1)%ssws, surf_usm_h(1)%ssws,                  &
+                     surf_def_v(0)%ssws, surf_lsm_v(0)%ssws, surf_usm_v(0)%ssws,                  &
+                     surf_def_v(1)%ssws, surf_lsm_v(1)%ssws, surf_usm_v(1)%ssws,                  &
+                     surf_def_v(2)%ssws, surf_lsm_v(2)%ssws, surf_usm_v(2)%ssws,                  &
+                     surf_def_v(3)%ssws, surf_lsm_v(3)%ssws, surf_usm_v(3)%ssws, n_out )
 
           CASE ( 'qcsws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,            &
-                                              surf_lsm_h%qcsws, surf_usm_h%qcsws,                  &
-                                              surf_def_v(0)%qcsws, surf_lsm_v(0)%qcsws,            &
-                                              surf_usm_v(0)%qcsws, surf_def_v(1)%qcsws,            &
-                                              surf_lsm_v(1)%qcsws, surf_usm_v(1)%qcsws,            &
-                                              surf_def_v(2)%qcsws, surf_lsm_v(2)%qcsws,            &
-                                              surf_usm_v(2)%qcsws, surf_def_v(3)%qcsws,            &
-                                              surf_lsm_v(3)%qcsws, surf_usm_v(3)%qcsws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qcsws, surf_lsm_h(0)%qcsws, surf_usm_h(0)%qcsws,               &
+                     surf_def_h(1)%qcsws, surf_lsm_h(1)%qcsws, surf_usm_h(1)%qcsws,               &
+                     surf_def_v(0)%qcsws, surf_lsm_v(0)%qcsws, surf_usm_v(0)%qcsws,               &
+                     surf_def_v(1)%qcsws, surf_lsm_v(1)%qcsws, surf_usm_v(1)%qcsws,               &
+                     surf_def_v(2)%qcsws, surf_lsm_v(2)%qcsws, surf_usm_v(2)%qcsws,               &
+                     surf_def_v(3)%qcsws, surf_lsm_v(3)%qcsws, surf_usm_v(3)%qcsws, n_out )
 
           CASE ( 'ncsws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,            &
-                                              surf_lsm_h%ncsws, surf_usm_h%ncsws,                  &
-                                              surf_def_v(0)%ncsws, surf_lsm_v(0)%ncsws,            &
-                                              surf_usm_v(0)%ncsws, surf_def_v(1)%ncsws,            &
-                                              surf_lsm_v(1)%ncsws, surf_usm_v(1)%ncsws,            &
-                                              surf_def_v(2)%ncsws, surf_lsm_v(2)%ncsws,            &
-                                              surf_usm_v(2)%ncsws, surf_def_v(3)%ncsws,            &
-                                              surf_lsm_v(3)%ncsws, surf_usm_v(3)%ncsws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%ncsws, surf_lsm_h(0)%ncsws, surf_usm_h(0)%ncsws,               &
+                     surf_def_h(1)%ncsws, surf_lsm_h(1)%ncsws, surf_usm_h(1)%ncsws,               &
+                     surf_def_v(0)%ncsws, surf_lsm_v(0)%ncsws, surf_usm_v(0)%ncsws,               &
+                     surf_def_v(1)%ncsws, surf_lsm_v(1)%ncsws, surf_usm_v(1)%ncsws,               &
+                     surf_def_v(2)%ncsws, surf_lsm_v(2)%ncsws, surf_usm_v(2)%ncsws,               &
+                     surf_def_v(3)%ncsws, surf_lsm_v(3)%ncsws, surf_usm_v(3)%ncsws, n_out )
 
           CASE ( 'qisws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qisws, surf_def_h(1)%qisws,            &
-                                              surf_lsm_h%qisws, surf_usm_h%qisws,                  &
-                                              surf_def_v(0)%qisws, surf_lsm_v(0)%qisws,            &
-                                              surf_usm_v(0)%qisws, surf_def_v(1)%qisws,            &
-                                              surf_lsm_v(1)%qisws, surf_usm_v(1)%qisws,            &
-                                              surf_def_v(2)%qisws, surf_lsm_v(2)%qisws,            &
-                                              surf_usm_v(2)%qisws, surf_def_v(3)%qisws,            &
-                                              surf_lsm_v(3)%qisws, surf_usm_v(3)%qisws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qisws, surf_lsm_h(0)%qisws, surf_usm_h(0)%qisws,               &
+                     surf_def_h(1)%qisws, surf_lsm_h(1)%qisws, surf_usm_h(1)%qisws,               &
+                     surf_def_v(0)%qisws, surf_lsm_v(0)%qisws, surf_usm_v(0)%qisws,               &
+                     surf_def_v(1)%qisws, surf_lsm_v(1)%qisws, surf_usm_v(1)%qisws,               &
+                     surf_def_v(2)%qisws, surf_lsm_v(2)%qisws, surf_usm_v(2)%qisws,               &
+                     surf_def_v(3)%qisws, surf_lsm_v(3)%qisws, surf_usm_v(3)%qisws, n_out )
 
           CASE ( 'nisws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%nisws, surf_def_h(1)%nisws,            &
-                                              surf_lsm_h%nisws, surf_usm_h%nisws,                  &
-                                              surf_def_v(0)%nisws, surf_lsm_v(0)%nisws,            &
-                                              surf_usm_v(0)%nisws, surf_def_v(1)%nisws,            &
-                                              surf_lsm_v(1)%nisws, surf_usm_v(1)%nisws,            &
-                                              surf_def_v(2)%nisws, surf_lsm_v(2)%nisws,            &
-                                              surf_usm_v(2)%nisws, surf_def_v(3)%nisws,            &
-                                              surf_lsm_v(3)%nisws, surf_usm_v(3)%nisws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%nisws, surf_lsm_h(0)%nisws, surf_usm_h(0)%nisws,               &
+                     surf_def_h(1)%nisws, surf_lsm_h(1)%nisws, surf_usm_h(1)%nisws,               &
+                     surf_def_v(0)%nisws, surf_lsm_v(0)%nisws, surf_usm_v(0)%nisws,               &
+                     surf_def_v(1)%nisws, surf_lsm_v(1)%nisws, surf_usm_v(1)%nisws,               &
+                     surf_def_v(2)%nisws, surf_lsm_v(2)%nisws, surf_usm_v(2)%nisws,               &
+                     surf_def_v(3)%nisws, surf_lsm_v(3)%nisws, surf_usm_v(3)%nisws, n_out )
 
           CASE ( 'qrsws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,            &
-                                              surf_lsm_h%qrsws, surf_usm_h%qrsws,                  &
-                                              surf_def_v(0)%qrsws, surf_lsm_v(0)%qrsws,            &
-                                              surf_usm_v(0)%qrsws, surf_def_v(1)%qrsws,            &
-                                              surf_lsm_v(1)%qrsws, surf_usm_v(1)%qrsws,            &
-                                              surf_def_v(2)%qrsws, surf_lsm_v(2)%qrsws,            &
-                                              surf_usm_v(2)%qrsws, surf_def_v(3)%qrsws,            &
-                                              surf_lsm_v(3)%qrsws, surf_usm_v(3)%qrsws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%qrsws, surf_lsm_h(0)%qrsws, surf_usm_h(0)%qrsws,               &
+                     surf_def_h(1)%qrsws, surf_lsm_h(1)%qrsws, surf_usm_h(1)%qrsws,               &
+                     surf_def_v(0)%qrsws, surf_lsm_v(0)%qrsws, surf_usm_v(0)%qrsws,               &
+                     surf_def_v(1)%qrsws, surf_lsm_v(1)%qrsws, surf_usm_v(1)%qrsws,               &
+                     surf_def_v(2)%qrsws, surf_lsm_v(2)%qrsws, surf_usm_v(2)%qrsws,               &
+                     surf_def_v(3)%qrsws, surf_lsm_v(3)%qrsws, surf_usm_v(3)%qrsws, n_out )
 
           CASE ( 'nrsws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,            &
-                                              surf_lsm_h%nrsws, surf_usm_h%nrsws,                  &
-                                              surf_def_v(0)%nrsws, surf_lsm_v(0)%nrsws,            &
-                                              surf_usm_v(0)%nrsws, surf_def_v(1)%nrsws,            &
-                                              surf_lsm_v(1)%nrsws, surf_usm_v(1)%nrsws,            &
-                                              surf_def_v(2)%nrsws, surf_lsm_v(2)%nrsws,            &
-                                              surf_usm_v(2)%nrsws, surf_def_v(3)%nrsws,            &
-                                              surf_lsm_v(3)%nrsws, surf_usm_v(3)%nrsws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%nrsws, surf_lsm_h(0)%nrsws, surf_usm_h(0)%nrsws,               &
+                     surf_def_h(1)%nrsws, surf_lsm_h(1)%nrsws, surf_usm_h(1)%nrsws,               &
+                     surf_def_v(0)%nrsws, surf_lsm_v(0)%nrsws, surf_usm_v(0)%nrsws,               &
+                     surf_def_v(1)%nrsws, surf_lsm_v(1)%nrsws, surf_usm_v(1)%nrsws,               &
+                     surf_def_v(2)%nrsws, surf_lsm_v(2)%nrsws, surf_usm_v(2)%nrsws,               &
+                     surf_def_v(3)%nrsws, surf_lsm_v(3)%nrsws, surf_usm_v(3)%nrsws, n_out )
 
           CASE ( 'sasws' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%sasws, surf_def_h(1)%sasws,            &
-                                              surf_lsm_h%sasws, surf_usm_h%sasws,                  &
-                                              surf_def_v(0)%sasws, surf_lsm_v(0)%sasws,            &
-                                              surf_usm_v(0)%sasws, surf_def_v(1)%sasws,            &
-                                              surf_lsm_v(1)%sasws, surf_usm_v(1)%sasws,            &
-                                              surf_def_v(2)%sasws, surf_lsm_v(2)%sasws,            &
-                                              surf_usm_v(2)%sasws, surf_def_v(3)%sasws,            &
-                                              surf_lsm_v(3)%sasws, surf_usm_v(3)%sasws, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%sasws, surf_lsm_h(0)%sasws, surf_usm_h(0)%sasws,               &
+                     surf_def_h(1)%sasws, surf_lsm_h(1)%sasws, surf_usm_h(1)%sasws,               &
+                     surf_def_v(0)%sasws, surf_lsm_v(0)%sasws, surf_usm_v(0)%sasws,               &
+                     surf_def_v(1)%sasws, surf_lsm_v(1)%sasws, surf_usm_v(1)%sasws,               &
+                     surf_def_v(2)%sasws, surf_lsm_v(2)%sasws, surf_usm_v(2)%sasws,               &
+                     surf_def_v(3)%sasws, surf_lsm_v(3)%sasws, surf_usm_v(3)%sasws, n_out )
 
           CASE ( 'q_surface' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%q_surface, surf_def_h(1)%q_surface,    &
-                                              surf_lsm_h%q_surface, surf_usm_h%q_surface,          &
-                                              surf_def_v(0)%q_surface, surf_lsm_v(0)%q_surface,    &
-                                              surf_usm_v(0)%q_surface, surf_def_v(1)%q_surface,    &
-                                              surf_lsm_v(1)%q_surface, surf_usm_v(1)%q_surface,    &
-                                              surf_def_v(2)%q_surface, surf_lsm_v(2)%q_surface,    &
-                                              surf_usm_v(2)%q_surface, surf_def_v(3)%q_surface,    &
-                                              surf_lsm_v(3)%q_surface, surf_usm_v(3)%q_surface,    &
-                                              n_out )
-
+             CALL surface_data_output_sum_up(                                                    &
+                     surf_def_h(0)%q_surface, surf_lsm_h(0)%q_surface, surf_usm_h(0)%q_surface,  &
+                     surf_def_h(1)%q_surface, surf_lsm_h(1)%q_surface, surf_usm_h(1)%q_surface,  &
+                     surf_def_v(0)%q_surface, surf_lsm_v(0)%q_surface, surf_usm_v(0)%q_surface,  &
+                     surf_def_v(1)%q_surface, surf_lsm_v(1)%q_surface, surf_usm_v(1)%q_surface,  &
+                     surf_def_v(2)%q_surface, surf_lsm_v(2)%q_surface, surf_usm_v(2)%q_surface,  &
+                     surf_def_v(3)%q_surface, surf_lsm_v(3)%q_surface, surf_usm_v(3)%q_surface,  &
+                     n_out )
 
           CASE ( 'theta_surface' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%pt_surface, surf_def_h(1)%pt_surface,  &
-                                              surf_lsm_h%pt_surface, surf_usm_h%pt_surface,        &
-                                              surf_def_v(0)%pt_surface, surf_lsm_v(0)%pt_surface,  &
-                                              surf_usm_v(0)%pt_surface, surf_def_v(1)%pt_surface,  &
-                                              surf_lsm_v(1)%pt_surface, surf_usm_v(1)%pt_surface,  &
-                                              surf_def_v(2)%pt_surface, surf_lsm_v(2)%pt_surface,  &
-                                              surf_usm_v(2)%pt_surface, surf_def_v(3)%pt_surface,  &
-                                              surf_lsm_v(3)%pt_surface, surf_usm_v(3)%pt_surface,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%pt_surface, surf_lsm_h(0)%pt_surface, surf_usm_h(0)%pt_surface,  &
+                  surf_def_h(1)%pt_surface, surf_lsm_h(1)%pt_surface, surf_usm_h(1)%pt_surface,  &
+                  surf_def_v(0)%pt_surface, surf_lsm_v(0)%pt_surface, surf_usm_v(0)%pt_surface,  &
+                  surf_def_v(1)%pt_surface, surf_lsm_v(1)%pt_surface, surf_usm_v(1)%pt_surface,  &
+                  surf_def_v(2)%pt_surface, surf_lsm_v(2)%pt_surface, surf_usm_v(2)%pt_surface,  &
+                  surf_def_v(3)%pt_surface, surf_lsm_v(3)%pt_surface, surf_usm_v(3)%pt_surface,  &
+                  n_out )
 
           CASE ( 'thetav_surface' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%vpt_surface,                           &
-                                              surf_def_h(1)%vpt_surface, surf_lsm_h%vpt_surface,   &
-                                              surf_usm_h%vpt_surface, surf_def_v(0)%vpt_surface,   &
-                                              surf_lsm_v(0)%vpt_surface,                           &
-                                              surf_usm_v(0)%vpt_surface,                           &
-                                              surf_def_v(1)%vpt_surface,                           &
-                                              surf_lsm_v(1)%vpt_surface,                           &
-                                              surf_usm_v(1)%vpt_surface,                           &
-                                              surf_def_v(2)%vpt_surface,                           &
-                                              surf_lsm_v(2)%vpt_surface,                           &
-                                              surf_usm_v(2)%vpt_surface,                           &
-                                              surf_def_v(3)%vpt_surface,                           &
-                                              surf_lsm_v(3)%vpt_surface,                           &
-                                              surf_usm_v(3)%vpt_surface, n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                surf_def_h(0)%vpt_surface, surf_lsm_h(0)%vpt_surface, surf_usm_h(0)%vpt_surface, &
+                surf_def_h(1)%vpt_surface, surf_lsm_h(1)%vpt_surface, surf_usm_h(1)%vpt_surface, &
+                surf_def_v(0)%vpt_surface, surf_lsm_v(0)%vpt_surface, surf_usm_v(0)%vpt_surface, &
+                surf_def_v(1)%vpt_surface, surf_lsm_v(1)%vpt_surface, surf_usm_v(1)%vpt_surface, &
+                surf_def_v(2)%vpt_surface, surf_lsm_v(2)%vpt_surface, surf_usm_v(2)%vpt_surface, &
+                surf_def_v(3)%vpt_surface, surf_lsm_v(3)%vpt_surface, surf_usm_v(3)%pt_surface,  &
+                n_out )
 
           CASE ( 'rad_net' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_net, surf_def_h(1)%rad_net,        &
-                                              surf_lsm_h%rad_net, surf_usm_h%rad_net,              &
-                                              surf_def_v(0)%rad_net, surf_lsm_v(0)%rad_net,        &
-                                              surf_usm_v(0)%rad_net, surf_def_v(1)%rad_net,        &
-                                              surf_lsm_v(1)%rad_net, surf_usm_v(1)%rad_net,        &
-                                              surf_def_v(2)%rad_net, surf_lsm_v(2)%rad_net,        &
-                                              surf_usm_v(2)%rad_net, surf_def_v(3)%rad_net,        &
-                                              surf_lsm_v(3)%rad_net, surf_usm_v(3)%rad_net, n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                     surf_def_h(0)%rad_net, surf_lsm_h(0)%rad_net, surf_usm_h(0)%rad_net,        &
+                     surf_def_h(1)%rad_net, surf_lsm_h(1)%rad_net, surf_usm_h(1)%rad_net,        &
+                     surf_def_v(0)%rad_net, surf_lsm_v(0)%rad_net, surf_usm_v(0)%rad_net,        &
+                     surf_def_v(1)%rad_net, surf_lsm_v(1)%rad_net, surf_usm_v(1)%rad_net,        &
+                     surf_def_v(2)%rad_net, surf_lsm_v(2)%rad_net, surf_usm_v(2)%rad_net,        &
+                     surf_def_v(3)%rad_net, surf_lsm_v(3)%rad_net, surf_usm_v(3)%rad_net,        &
+                     n_out )
 
           CASE ( 'rad_lw_in' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_lw_in, surf_def_h(1)%rad_lw_in,    &
-                                              surf_lsm_h%rad_lw_in, surf_usm_h%rad_lw_in,          &
-                                              surf_def_v(0)%rad_lw_in, surf_lsm_v(0)%rad_lw_in,    &
-                                              surf_usm_v(0)%rad_lw_in, surf_def_v(1)%rad_lw_in,    &
-                                              surf_lsm_v(1)%rad_lw_in, surf_usm_v(1)%rad_lw_in,    &
-                                              surf_def_v(2)%rad_lw_in, surf_lsm_v(2)%rad_lw_in,    &
-                                              surf_usm_v(2)%rad_lw_in, surf_def_v(3)%rad_lw_in,    &
-                                              surf_lsm_v(3)%rad_lw_in, surf_usm_v(3)%rad_lw_in,    &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_lw_in, surf_lsm_h(0)%rad_lw_in, surf_usm_h(0)%rad_lw_in,     &
+                  surf_def_h(1)%rad_lw_in, surf_lsm_h(1)%rad_lw_in, surf_usm_h(1)%rad_lw_in,     &
+                  surf_def_v(0)%rad_lw_in, surf_lsm_v(0)%rad_lw_in, surf_usm_v(0)%rad_lw_in,     &
+                  surf_def_v(1)%rad_lw_in, surf_lsm_v(1)%rad_lw_in, surf_usm_v(1)%rad_lw_in,     &
+                  surf_def_v(2)%rad_lw_in, surf_lsm_v(2)%rad_lw_in, surf_usm_v(2)%rad_lw_in,     &
+                  surf_def_v(3)%rad_lw_in, surf_lsm_v(3)%rad_lw_in, surf_usm_v(3)%rad_lw_in,     &
+                  n_out )
 
           CASE ( 'rad_lw_out' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_lw_out, surf_def_h(1)%rad_lw_out,  &
-                                              surf_lsm_h%rad_lw_out, surf_usm_h%rad_lw_out,        &
-                                              surf_def_v(0)%rad_lw_out, surf_lsm_v(0)%rad_lw_out,  &
-                                              surf_usm_v(0)%rad_lw_out, surf_def_v(1)%rad_lw_out,  &
-                                              surf_lsm_v(1)%rad_lw_out, surf_usm_v(1)%rad_lw_out,  &
-                                              surf_def_v(2)%rad_lw_out, surf_lsm_v(2)%rad_lw_out,  &
-                                              surf_usm_v(2)%rad_lw_out, surf_def_v(3)%rad_lw_out,  &
-                                              surf_lsm_v(3)%rad_lw_out, surf_usm_v(3)%rad_lw_out,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_lw_out, surf_lsm_h(0)%rad_lw_out, surf_usm_h(0)%rad_lw_out,  &
+                  surf_def_h(1)%rad_lw_out, surf_lsm_h(1)%rad_lw_out, surf_usm_h(1)%rad_lw_out,  &
+                  surf_def_v(0)%rad_lw_out, surf_lsm_v(0)%rad_lw_out, surf_usm_v(0)%rad_lw_out,  &
+                  surf_def_v(1)%rad_lw_out, surf_lsm_v(1)%rad_lw_out, surf_usm_v(1)%rad_lw_out,  &
+                  surf_def_v(2)%rad_lw_out, surf_lsm_v(2)%rad_lw_out, surf_usm_v(2)%rad_lw_out,  &
+                  surf_def_v(3)%rad_lw_out, surf_lsm_v(3)%rad_lw_out, surf_usm_v(3)%rad_lw_out,  &
+                  n_out )
 
           CASE ( 'rad_sw_in' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_sw_in, surf_def_h(1)%rad_sw_in,    &
-                                              surf_lsm_h%rad_sw_in, surf_usm_h%rad_sw_in,          &
-                                              surf_def_v(0)%rad_sw_in, surf_lsm_v(0)%rad_sw_in,    &
-                                              surf_usm_v(0)%rad_sw_in, surf_def_v(1)%rad_sw_in,    &
-                                              surf_lsm_v(1)%rad_sw_in, surf_usm_v(1)%rad_sw_in,    &
-                                              surf_def_v(2)%rad_sw_in, surf_lsm_v(2)%rad_sw_in,    &
-                                              surf_usm_v(2)%rad_sw_in, surf_def_v(3)%rad_sw_in,    &
-                                              surf_lsm_v(3)%rad_sw_in, surf_usm_v(3)%rad_sw_in,    &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_sw_in, surf_lsm_h(0)%rad_sw_in, surf_usm_h(0)%rad_sw_in,     &
+                  surf_def_h(1)%rad_sw_in, surf_lsm_h(1)%rad_sw_in, surf_usm_h(1)%rad_sw_in,     &
+                  surf_def_v(0)%rad_sw_in, surf_lsm_v(0)%rad_sw_in, surf_usm_v(0)%rad_sw_in,     &
+                  surf_def_v(1)%rad_sw_in, surf_lsm_v(1)%rad_sw_in, surf_usm_v(1)%rad_sw_in,     &
+                  surf_def_v(2)%rad_sw_in, surf_lsm_v(2)%rad_sw_in, surf_usm_v(2)%rad_sw_in,     &
+                  surf_def_v(3)%rad_sw_in, surf_lsm_v(3)%rad_sw_in, surf_usm_v(3)%rad_sw_in,     &
+                  n_out )
 
           CASE ( 'rad_sw_out' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_sw_out, surf_def_h(1)%rad_sw_out,  &
-                                              surf_lsm_h%rad_sw_out, surf_usm_h%rad_sw_out,        &
-                                              surf_def_v(0)%rad_sw_out, surf_lsm_v(0)%rad_sw_out,  &
-                                              surf_usm_v(0)%rad_sw_out, surf_def_v(1)%rad_sw_out,  &
-                                              surf_lsm_v(1)%rad_sw_out, surf_usm_v(1)%rad_sw_out,  &
-                                              surf_def_v(2)%rad_sw_out, surf_lsm_v(2)%rad_sw_out,  &
-                                              surf_usm_v(2)%rad_sw_out, surf_def_v(3)%rad_sw_out,  &
-                                              surf_lsm_v(3)%rad_sw_out, surf_usm_v(3)%rad_sw_out,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_sw_out, surf_lsm_h(0)%rad_sw_out, surf_usm_h(0)%rad_sw_out,  &
+                  surf_def_h(1)%rad_sw_out, surf_lsm_h(1)%rad_sw_out, surf_usm_h(1)%rad_sw_out,  &
+                  surf_def_v(0)%rad_sw_out, surf_lsm_v(0)%rad_sw_out, surf_usm_v(0)%rad_sw_out,  &
+                  surf_def_v(1)%rad_sw_out, surf_lsm_v(1)%rad_sw_out, surf_usm_v(1)%rad_sw_out,  &
+                  surf_def_v(2)%rad_sw_out, surf_lsm_v(2)%rad_sw_out, surf_usm_v(2)%rad_sw_out,  &
+                  surf_def_v(3)%rad_sw_out, surf_lsm_v(3)%rad_sw_out, surf_usm_v(3)%rad_sw_out,  &
+                  n_out )
 
           CASE ( 'ghf' )
@@ -3184,9 +2995,13 @@
 !--          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)
+             DO  l = 0, 1
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%ghf(m) = surf_usm_h(l)%frac(m,ind_veg_wall) *                    &
+                                       surf_usm_h(l)%wghf_eb(m) +                                 &
+                                       surf_usm_h(l)%frac(m,ind_pav_green) *                      &
+                                       surf_usm_h(l)%wghf_eb_green(m) +                           &
+                                       surf_usm_h(l)%frac(m,ind_wat_win) *                        &
+                                       surf_usm_h(l)%wghf_eb_window(m)
+                ENDDO
              ENDDO
              DO  l = 0, 3
@@ -3201,183 +3016,167 @@
              ENDDO
 
-             CALL surface_data_output_sum_up( surf_def_h(0)%ghf, surf_def_h(1)%ghf,                &
-                                              surf_lsm_h%ghf, surf_usm_h%ghf, surf_def_v(0)%ghf,   &
-                                              surf_lsm_v(0)%ghf, surf_usm_v(0)%ghf,                &
-                                              surf_def_v(1)%ghf, surf_lsm_v(1)%ghf,                &
-                                              surf_usm_v(1)%ghf, surf_def_v(2)%ghf,                &
-                                              surf_lsm_v(2)%ghf, surf_usm_v(2)%ghf,                &
-                                              surf_def_v(3)%ghf, surf_lsm_v(3)%ghf,                &
-                                              surf_usm_v(3)%ghf, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%ghf, surf_lsm_h(0)%ghf, surf_usm_h(0)%ghf,                     &
+                     surf_def_h(1)%ghf, surf_lsm_h(1)%ghf, surf_usm_h(1)%ghf,                     &
+                     surf_def_v(0)%ghf, surf_lsm_v(0)%ghf, surf_usm_v(0)%ghf,                     &
+                     surf_def_v(1)%ghf, surf_lsm_v(1)%ghf, surf_usm_v(1)%ghf,                     &
+                     surf_def_v(2)%ghf, surf_lsm_v(2)%ghf, surf_usm_v(2)%ghf,                     &
+                     surf_def_v(3)%ghf, surf_lsm_v(3)%ghf, surf_usm_v(3)%ghf, n_out )
 
           CASE ( 'r_a' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%r_a, surf_def_h(1)%r_a,                &
-                                              surf_lsm_h%r_a, surf_usm_h%r_a,                      &
-                                              surf_def_v(0)%r_a, surf_lsm_v(0)%r_a,                &
-                                              surf_usm_v(0)%r_a, surf_def_v(1)%r_a,                &
-                                              surf_lsm_v(1)%r_a, surf_usm_v(1)%r_a,                &
-                                              surf_def_v(2)%r_a, surf_lsm_v(2)%r_a,                &
-                                              surf_usm_v(2)%r_a, surf_def_v(3)%r_a,                &
-                                              surf_lsm_v(3)%r_a, surf_usm_v(3)%r_a, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%r_a, surf_lsm_h(0)%r_a, surf_usm_h(0)%r_a,                     &
+                     surf_def_h(1)%r_a, surf_lsm_h(1)%r_a, surf_usm_h(1)%r_a,                     &
+                     surf_def_v(0)%r_a, surf_lsm_v(0)%r_a, surf_usm_v(0)%r_a,                     &
+                     surf_def_v(1)%r_a, surf_lsm_v(1)%r_a, surf_usm_v(1)%r_a,                     &
+                     surf_def_v(2)%r_a, surf_lsm_v(2)%r_a, surf_usm_v(2)%r_a,                     &
+                     surf_def_v(3)%r_a, surf_lsm_v(3)%r_a, surf_usm_v(3)%r_a, n_out )
 
           CASE ( 'r_soil' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%r_soil, surf_def_h(1)%r_soil,          &
-                                              surf_lsm_h%r_soil, surf_usm_h%r_soil,                &
-                                              surf_def_v(0)%r_soil, surf_lsm_v(0)%r_soil,          &
-                                              surf_usm_v(0)%r_soil, surf_def_v(1)%r_soil,          &
-                                              surf_lsm_v(1)%r_soil, surf_usm_v(1)%r_soil,          &
-                                              surf_def_v(2)%r_soil, surf_lsm_v(2)%r_soil,          &
-                                              surf_usm_v(2)%r_soil, surf_def_v(3)%r_soil,          &
-                                              surf_lsm_v(3)%r_soil, surf_usm_v(3)%r_soil, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%r_soil, surf_lsm_h(0)%r_soil, surf_usm_h(0)%r_soil,            &
+                     surf_def_h(1)%r_soil, surf_lsm_h(1)%r_soil, surf_usm_h(1)%r_soil,            &
+                     surf_def_v(0)%r_soil, surf_lsm_v(0)%r_soil, surf_usm_v(0)%r_soil,            &
+                     surf_def_v(1)%r_soil, surf_lsm_v(1)%r_soil, surf_usm_v(1)%r_soil,            &
+                     surf_def_v(2)%r_soil, surf_lsm_v(2)%r_soil, surf_usm_v(2)%r_soil,            &
+                     surf_def_v(3)%r_soil, surf_lsm_v(3)%r_soil, surf_usm_v(3)%r_soil, n_out )
 
           CASE ( 'r_canopy' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%r_canopy, surf_def_h(1)%r_canopy,      &
-                                              surf_lsm_h%r_canopy, surf_usm_h%r_canopy,            &
-                                              surf_def_v(0)%r_canopy, surf_lsm_v(0)%r_canopy,      &
-                                              surf_usm_v(0)%r_canopy, surf_def_v(1)%r_canopy,      &
-                                              surf_lsm_v(1)%r_canopy, surf_usm_v(1)%r_canopy,      &
-                                              surf_def_v(2)%r_canopy, surf_lsm_v(2)%r_canopy,      &
-                                              surf_usm_v(2)%r_canopy, surf_def_v(3)%r_canopy,      &
-                                              surf_lsm_v(3)%r_canopy, surf_usm_v(3)%r_canopy,      &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%r_canopy, surf_lsm_h(0)%r_canopy, surf_usm_h(0)%r_canopy,      &
+                     surf_def_h(1)%r_canopy, surf_lsm_h(1)%r_canopy, surf_usm_h(1)%r_canopy,      &
+                     surf_def_v(0)%r_canopy, surf_lsm_v(0)%r_canopy, surf_usm_v(0)%r_canopy,      &
+                     surf_def_v(1)%r_canopy, surf_lsm_v(1)%r_canopy, surf_usm_v(1)%r_canopy,      &
+                     surf_def_v(2)%r_canopy, surf_lsm_v(2)%r_canopy, surf_usm_v(2)%r_canopy,      &
+                     surf_def_v(3)%r_canopy, surf_lsm_v(3)%r_canopy, surf_usm_v(3)%r_canopy,      &
+                     n_out )
 
           CASE ( 'r_s' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%r_s, surf_def_h(1)%r_s,                &
-                                              surf_lsm_h%r_s, surf_usm_h%r_s, surf_def_v(0)%r_s,   &
-                                              surf_lsm_v(0)%r_s, surf_usm_v(0)%r_s,                &
-                                              surf_def_v(1)%r_s, surf_lsm_v(1)%r_s,                &
-                                              surf_usm_v(1)%r_s, surf_def_v(2)%r_s,                &
-                                              surf_lsm_v(2)%r_s, surf_usm_v(2)%r_s,                &
-                                              surf_def_v(3)%r_s, surf_lsm_v(3)%r_s,                &
-                                              surf_usm_v(3)%r_s, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%r_s, surf_lsm_h(0)%r_s, surf_usm_h(0)%r_s,                     &
+                     surf_def_h(1)%r_s, surf_lsm_h(1)%r_s, surf_usm_h(1)%r_s,                     &
+                     surf_def_v(0)%r_s, surf_lsm_v(0)%r_s, surf_usm_v(0)%r_s,                     &
+                     surf_def_v(1)%r_s, surf_lsm_v(1)%r_s, surf_usm_v(1)%r_s,                     &
+                     surf_def_v(2)%r_s, surf_lsm_v(2)%r_s, surf_usm_v(2)%r_s,                     &
+                     surf_def_v(3)%r_s, surf_lsm_v(3)%r_s, surf_usm_v(3)%r_s, n_out )
 
 
           CASE ( 'rad_sw_dir' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_sw_dir, surf_def_h(1)%rad_sw_dir,  &
-                                              surf_lsm_h%rad_sw_dir, surf_usm_h%rad_sw_dir,        &
-                                              surf_def_v(0)%rad_sw_dir, surf_lsm_v(0)%rad_sw_dir,  &
-                                              surf_usm_v(0)%rad_sw_dir, surf_def_v(1)%rad_sw_dir,  &
-                                              surf_lsm_v(1)%rad_sw_dir, surf_usm_v(1)%rad_sw_dir,  &
-                                              surf_def_v(2)%rad_sw_dir, surf_lsm_v(2)%rad_sw_dir,  &
-                                              surf_usm_v(2)%rad_sw_dir, surf_def_v(3)%rad_sw_dir,  &
-                                              surf_lsm_v(3)%rad_sw_dir, surf_usm_v(3)%rad_sw_dir,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_sw_dir, surf_lsm_h(0)%rad_sw_dir, surf_usm_h(0)%rad_sw_dir,  &
+                  surf_def_h(1)%rad_sw_dir, surf_lsm_h(1)%rad_sw_dir, surf_usm_h(1)%rad_sw_dir,  &
+                  surf_def_v(0)%rad_sw_dir, surf_lsm_v(0)%rad_sw_dir, surf_usm_v(0)%rad_sw_dir,  &
+                  surf_def_v(1)%rad_sw_dir, surf_lsm_v(1)%rad_sw_dir, surf_usm_v(1)%rad_sw_dir,  &
+                  surf_def_v(2)%rad_sw_dir, surf_lsm_v(2)%rad_sw_dir, surf_usm_v(2)%rad_sw_dir,  &
+                  surf_def_v(3)%rad_sw_dir, surf_lsm_v(3)%rad_sw_dir, surf_usm_v(3)%rad_sw_dir,  &
+                  n_out )
           CASE ( 'rad_sw_dif' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_sw_dif, surf_def_h(1)%rad_sw_dif,  &
-                                              surf_lsm_h%rad_sw_dif, surf_usm_h%rad_sw_dif,        &
-                                              surf_def_v(0)%rad_sw_dif, surf_lsm_v(0)%rad_sw_dif,  &
-                                              surf_usm_v(0)%rad_sw_dif, surf_def_v(1)%rad_sw_dif,  &
-                                              surf_lsm_v(1)%rad_sw_dif, surf_usm_v(1)%rad_sw_dif,  &
-                                              surf_def_v(2)%rad_sw_dif, surf_lsm_v(2)%rad_sw_dif,  &
-                                              surf_usm_v(2)%rad_sw_dif, surf_def_v(3)%rad_sw_dif,  &
-                                              surf_lsm_v(3)%rad_sw_dif, surf_usm_v(3)%rad_sw_dif,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_sw_dif, surf_lsm_h(0)%rad_sw_dif, surf_usm_h(0)%rad_sw_dif,  &
+                  surf_def_h(1)%rad_sw_dif, surf_lsm_h(1)%rad_sw_dif, surf_usm_h(1)%rad_sw_dif,  &
+                  surf_def_v(0)%rad_sw_dif, surf_lsm_v(0)%rad_sw_dif, surf_usm_v(0)%rad_sw_dif,  &
+                  surf_def_v(1)%rad_sw_dif, surf_lsm_v(1)%rad_sw_dif, surf_usm_v(1)%rad_sw_dif,  &
+                  surf_def_v(2)%rad_sw_dif, surf_lsm_v(2)%rad_sw_dif, surf_usm_v(2)%rad_sw_dif,  &
+                  surf_def_v(3)%rad_sw_dif, surf_lsm_v(3)%rad_sw_dif, surf_usm_v(3)%rad_sw_dif,  &
+                  n_out )
 
           CASE ( 'rad_sw_ref' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_sw_ref, surf_def_h(1)%rad_sw_ref,  &
-                                              surf_lsm_h%rad_sw_ref, surf_usm_h%rad_sw_ref,        &
-                                              surf_def_v(0)%rad_sw_ref, surf_lsm_v(0)%rad_sw_ref,  &
-                                              surf_usm_v(0)%rad_sw_ref, surf_def_v(1)%rad_sw_ref,  &
-                                              surf_lsm_v(1)%rad_sw_ref, surf_usm_v(1)%rad_sw_ref,  &
-                                              surf_def_v(2)%rad_sw_ref, surf_lsm_v(2)%rad_sw_ref,  &
-                                              surf_usm_v(2)%rad_sw_ref, surf_def_v(3)%rad_sw_ref,  &
-                                              surf_lsm_v(3)%rad_sw_ref, surf_usm_v(3)%rad_sw_ref,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_sw_ref, surf_lsm_h(0)%rad_sw_ref, surf_usm_h(0)%rad_sw_ref,  &
+                  surf_def_h(1)%rad_sw_ref, surf_lsm_h(1)%rad_sw_ref, surf_usm_h(1)%rad_sw_ref,  &
+                  surf_def_v(0)%rad_sw_ref, surf_lsm_v(0)%rad_sw_ref, surf_usm_v(0)%rad_sw_ref,  &
+                  surf_def_v(1)%rad_sw_ref, surf_lsm_v(1)%rad_sw_ref, surf_usm_v(1)%rad_sw_ref,  &
+                  surf_def_v(2)%rad_sw_ref, surf_lsm_v(2)%rad_sw_ref, surf_usm_v(2)%rad_sw_ref,  &
+                  surf_def_v(3)%rad_sw_ref, surf_lsm_v(3)%rad_sw_ref, surf_usm_v(3)%rad_sw_ref,  &
+                  n_out )
 
           CASE ( 'rad_sw_res' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_sw_res, surf_def_h(1)%rad_sw_res,  &
-                                              surf_lsm_h%rad_sw_res, surf_usm_h%rad_sw_res,        &
-                                              surf_def_v(0)%rad_sw_res, surf_lsm_v(0)%rad_sw_res,  &
-                                              surf_usm_v(0)%rad_sw_res, surf_def_v(1)%rad_sw_res,  &
-                                              surf_lsm_v(1)%rad_sw_res, surf_usm_v(1)%rad_sw_res,  &
-                                              surf_def_v(2)%rad_sw_res, surf_lsm_v(2)%rad_sw_res,  &
-                                              surf_usm_v(2)%rad_sw_res, surf_def_v(3)%rad_sw_res,  &
-                                              surf_lsm_v(3)%rad_sw_res, surf_usm_v(3)%rad_sw_res,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_sw_res, surf_lsm_h(0)%rad_sw_res, surf_usm_h(0)%rad_sw_res,  &
+                  surf_def_h(1)%rad_sw_res, surf_lsm_h(1)%rad_sw_res, surf_usm_h(1)%rad_sw_res,  &
+                  surf_def_v(0)%rad_sw_res, surf_lsm_v(0)%rad_sw_res, surf_usm_v(0)%rad_sw_res,  &
+                  surf_def_v(1)%rad_sw_res, surf_lsm_v(1)%rad_sw_res, surf_usm_v(1)%rad_sw_res,  &
+                  surf_def_v(2)%rad_sw_res, surf_lsm_v(2)%rad_sw_res, surf_usm_v(2)%rad_sw_res,  &
+                  surf_def_v(3)%rad_sw_res, surf_lsm_v(3)%rad_sw_res, surf_usm_v(3)%rad_sw_res,  &
+                  n_out )
 
           CASE ( 'rad_lw_dif' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_lw_dif, surf_def_h(1)%rad_lw_dif,  &
-                                              surf_lsm_h%rad_lw_dif, surf_usm_h%rad_lw_dif,        &
-                                              surf_def_v(0)%rad_lw_dif, surf_lsm_v(0)%rad_lw_dif,  &
-                                              surf_usm_v(0)%rad_lw_dif, surf_def_v(1)%rad_lw_dif,  &
-                                              surf_lsm_v(1)%rad_lw_dif, surf_usm_v(1)%rad_lw_dif,  &
-                                              surf_def_v(2)%rad_lw_dif, surf_lsm_v(2)%rad_lw_dif,  &
-                                              surf_usm_v(2)%rad_lw_dif, surf_def_v(3)%rad_lw_dif,  &
-                                              surf_lsm_v(3)%rad_lw_dif, surf_usm_v(3)%rad_lw_dif,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_lw_dif, surf_lsm_h(0)%rad_lw_dif, surf_usm_h(0)%rad_lw_dif,  &
+                  surf_def_h(1)%rad_lw_dif, surf_lsm_h(1)%rad_lw_dif, surf_usm_h(1)%rad_lw_dif,  &
+                  surf_def_v(0)%rad_lw_dif, surf_lsm_v(0)%rad_lw_dif, surf_usm_v(0)%rad_lw_dif,  &
+                  surf_def_v(1)%rad_lw_dif, surf_lsm_v(1)%rad_lw_dif, surf_usm_v(1)%rad_lw_dif,  &
+                  surf_def_v(2)%rad_lw_dif, surf_lsm_v(2)%rad_lw_dif, surf_usm_v(2)%rad_lw_dif,  &
+                  surf_def_v(3)%rad_lw_dif, surf_lsm_v(3)%rad_lw_dif, surf_usm_v(3)%rad_lw_dif,  &
+                  n_out )
 
           CASE ( 'rad_lw_ref' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_lw_ref, surf_def_h(1)%rad_lw_ref,  &
-                                              surf_lsm_h%rad_lw_ref, surf_usm_h%rad_lw_ref,        &
-                                              surf_def_v(0)%rad_lw_ref, surf_lsm_v(0)%rad_lw_ref,  &
-                                              surf_usm_v(0)%rad_lw_ref, surf_def_v(1)%rad_lw_ref,  &
-                                              surf_lsm_v(1)%rad_lw_ref, surf_usm_v(1)%rad_lw_ref,  &
-                                              surf_def_v(2)%rad_lw_ref, surf_lsm_v(2)%rad_lw_ref,  &
-                                              surf_usm_v(2)%rad_lw_ref, surf_def_v(3)%rad_lw_ref,  &
-                                              surf_lsm_v(3)%rad_lw_ref, surf_usm_v(3)%rad_lw_ref,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                  surf_def_h(0)%rad_lw_ref, surf_lsm_h(0)%rad_lw_ref, surf_usm_h(0)%rad_lw_ref,  &
+                  surf_def_h(1)%rad_lw_ref, surf_lsm_h(1)%rad_lw_ref, surf_usm_h(1)%rad_lw_ref,  &
+                  surf_def_v(0)%rad_lw_ref, surf_lsm_v(0)%rad_lw_ref, surf_usm_v(0)%rad_lw_ref,  &
+                  surf_def_v(1)%rad_lw_ref, surf_lsm_v(1)%rad_lw_ref, surf_usm_v(1)%rad_lw_ref,  &
+                  surf_def_v(2)%rad_lw_ref, surf_lsm_v(2)%rad_lw_ref, surf_usm_v(2)%rad_lw_ref,  &
+                  surf_def_v(3)%rad_lw_ref, surf_lsm_v(3)%rad_lw_ref, surf_usm_v(3)%rad_lw_ref,  &
+                  n_out )
 
           CASE ( 'rad_lw_res' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%rad_lw_res, surf_def_h(1)%rad_lw_res,  &
-                                              surf_lsm_h%rad_lw_res, surf_usm_h%rad_lw_res,        &
-                                              surf_def_v(0)%rad_lw_res, surf_lsm_v(0)%rad_lw_res,  &
-                                              surf_usm_v(0)%rad_lw_res, surf_def_v(1)%rad_lw_res,  &
-                                              surf_lsm_v(1)%rad_lw_res, surf_usm_v(1)%rad_lw_res,  &
-                                              surf_def_v(2)%rad_lw_res, surf_lsm_v(2)%rad_lw_res,  &
-                                              surf_usm_v(2)%rad_lw_res, surf_def_v(3)%rad_lw_res,  &
-                                              surf_lsm_v(3)%rad_lw_res, surf_usm_v(3)%rad_lw_res,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                  surf_def_h(0)%rad_lw_res, surf_lsm_h(0)%rad_lw_res, surf_usm_h(0)%rad_lw_res,  &
+                  surf_def_h(1)%rad_lw_res, surf_lsm_h(1)%rad_lw_res, surf_usm_h(1)%rad_lw_res,  &
+                  surf_def_v(0)%rad_lw_res, surf_lsm_v(0)%rad_lw_res, surf_usm_v(0)%rad_lw_res,  &
+                  surf_def_v(1)%rad_lw_res, surf_lsm_v(1)%rad_lw_res, surf_usm_v(1)%rad_lw_res,  &
+                  surf_def_v(2)%rad_lw_res, surf_lsm_v(2)%rad_lw_res, surf_usm_v(2)%rad_lw_res,  &
+                  surf_def_v(3)%rad_lw_res, surf_lsm_v(3)%rad_lw_res, surf_usm_v(3)%rad_lw_res,  &
+                  n_out )
 
           CASE ( 'uvw1' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%uvw_abs, surf_def_h(1)%uvw_abs,        &
-                                              surf_lsm_h%uvw_abs, surf_usm_h%uvw_abs,              &
-                                              surf_def_v(0)%uvw_abs, surf_lsm_v(0)%uvw_abs,        &
-                                              surf_usm_v(0)%uvw_abs, surf_def_v(1)%uvw_abs,        &
-                                              surf_lsm_v(1)%uvw_abs, surf_usm_v(1)%uvw_abs,        &
-                                              surf_def_v(2)%uvw_abs, surf_lsm_v(2)%uvw_abs,        &
-                                              surf_usm_v(2)%uvw_abs, surf_def_v(3)%uvw_abs,        &
-                                              surf_lsm_v(3)%uvw_abs, surf_usm_v(3)%uvw_abs, n_out )
+             CALL surface_data_output_sum_up(                                                    &
+                     surf_def_h(0)%uvw_abs, surf_lsm_h(0)%uvw_abs, surf_usm_h(0)%uvw_abs,        &
+                     surf_def_h(1)%uvw_abs, surf_lsm_h(1)%uvw_abs, surf_usm_h(1)%uvw_abs,        &
+                     surf_def_v(0)%uvw_abs, surf_lsm_v(0)%uvw_abs, surf_usm_v(0)%uvw_abs,        &
+                     surf_def_v(1)%uvw_abs, surf_lsm_v(1)%uvw_abs, surf_usm_v(1)%uvw_abs,        &
+                     surf_def_v(2)%uvw_abs, surf_lsm_v(2)%uvw_abs, surf_usm_v(2)%uvw_abs,        &
+                     surf_def_v(3)%uvw_abs, surf_lsm_v(3)%uvw_abs, surf_usm_v(3)%uvw_abs, n_out )
 
           CASE ( 'waste_heat' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%waste_heat, surf_def_h(1)%waste_heat,  &
-                                              surf_lsm_h%waste_heat, surf_usm_h%waste_heat,        &
-                                              surf_def_v(0)%waste_heat, surf_lsm_v(0)%waste_heat,  &
-                                              surf_usm_v(0)%waste_heat, surf_def_v(1)%waste_heat,  &
-                                              surf_lsm_v(1)%waste_heat, surf_usm_v(1)%waste_heat,  &
-                                              surf_def_v(2)%waste_heat, surf_lsm_v(2)%waste_heat,  &
-                                              surf_usm_v(2)%waste_heat, surf_def_v(3)%waste_heat,  &
-                                              surf_lsm_v(3)%waste_heat, surf_usm_v(3)%waste_heat,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%waste_heat, surf_lsm_h(0)%waste_heat, surf_usm_h(0)%waste_heat,&
+                     surf_def_h(1)%waste_heat, surf_lsm_h(1)%waste_heat, surf_usm_h(1)%waste_heat,&
+                     surf_def_v(0)%waste_heat, surf_lsm_v(0)%waste_heat, surf_usm_v(0)%waste_heat,&
+                     surf_def_v(1)%waste_heat, surf_lsm_v(1)%waste_heat, surf_usm_v(1)%waste_heat,&
+                     surf_def_v(2)%waste_heat, surf_lsm_v(2)%waste_heat, surf_usm_v(2)%waste_heat,&
+                     surf_def_v(3)%waste_heat, surf_lsm_v(3)%waste_heat, surf_usm_v(3)%waste_heat,&
+                     n_out )
 
           CASE ( 'im_hf' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%iwghf_eb, surf_def_h(1)%iwghf_eb,      &
-                                              surf_lsm_h%iwghf_eb, surf_usm_h%iwghf_eb,            &
-                                              surf_def_v(0)%iwghf_eb, surf_lsm_v(0)%iwghf_eb,      &
-                                              surf_usm_v(0)%iwghf_eb, surf_def_v(1)%iwghf_eb,      &
-                                              surf_lsm_v(1)%iwghf_eb, surf_usm_v(1)%iwghf_eb,      &
-                                              surf_def_v(2)%iwghf_eb, surf_lsm_v(2)%iwghf_eb,      &
-                                              surf_usm_v(2)%iwghf_eb, surf_def_v(3)%iwghf_eb,      &
-                                              surf_lsm_v(3)%iwghf_eb, surf_usm_v(3)%iwghf_eb, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%iwghf_eb, surf_lsm_h(0)%iwghf_eb, surf_usm_h(0)%iwghf_eb,      &
+                     surf_def_h(1)%iwghf_eb, surf_lsm_h(1)%iwghf_eb, surf_usm_h(1)%iwghf_eb,      &
+                     surf_def_v(0)%iwghf_eb, surf_lsm_v(0)%iwghf_eb, surf_usm_v(0)%iwghf_eb,      &
+                     surf_def_v(1)%iwghf_eb, surf_lsm_v(1)%iwghf_eb, surf_usm_v(1)%iwghf_eb,      &
+                     surf_def_v(2)%iwghf_eb, surf_lsm_v(2)%iwghf_eb, surf_usm_v(2)%iwghf_eb,      &
+                     surf_def_v(3)%iwghf_eb, surf_lsm_v(3)%iwghf_eb, surf_usm_v(3)%iwghf_eb,      &
+                     n_out )
 
           CASE ( 'albedo' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%albedo, surf_def_h(1)%albedo,          &
-                                              surf_lsm_h%albedo, surf_usm_h%albedo,                &
-                                              surf_def_v(0)%albedo, surf_lsm_v(0)%albedo,          &
-                                              surf_usm_v(0)%albedo, surf_def_v(1)%albedo,          &
-                                              surf_lsm_v(1)%albedo, surf_usm_v(1)%albedo,          &
-                                              surf_def_v(2)%albedo, surf_lsm_v(2)%albedo,          &
-                                              surf_usm_v(2)%albedo, surf_def_v(3)%albedo,          &
-                                              surf_lsm_v(3)%albedo, surf_usm_v(3)%albedo, n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%albedo, surf_lsm_h(0)%albedo, surf_usm_h(0)%albedo,            &
+                     surf_def_h(1)%albedo, surf_lsm_h(1)%albedo, surf_usm_h(1)%albedo,            &
+                     surf_def_v(0)%albedo, surf_lsm_v(0)%albedo, surf_usm_v(0)%albedo,            &
+                     surf_def_v(1)%albedo, surf_lsm_v(1)%albedo, surf_usm_v(1)%albedo,            &
+                     surf_def_v(2)%albedo, surf_lsm_v(2)%albedo, surf_usm_v(2)%albedo,            &
+                     surf_def_v(3)%albedo, surf_lsm_v(3)%albedo, surf_usm_v(3)%albedo, n_out )
 
 
           CASE ( 'emissivity' )
-             CALL surface_data_output_sum_up( surf_def_h(0)%emissivity, surf_def_h(1)%emissivity,  &
-                                              surf_lsm_h%emissivity, surf_usm_h%emissivity,        &
-                                              surf_def_v(0)%emissivity, surf_lsm_v(0)%emissivity,  &
-                                              surf_usm_v(0)%emissivity, surf_def_v(1)%emissivity,  &
-                                              surf_lsm_v(1)%emissivity, surf_usm_v(1)%emissivity,  &
-                                              surf_def_v(2)%emissivity, surf_lsm_v(2)%emissivity,  &
-                                              surf_usm_v(2)%emissivity, surf_def_v(3)%emissivity,  &
-                                              surf_lsm_v(3)%emissivity, surf_usm_v(3)%emissivity,  &
-                                              n_out )
+             CALL surface_data_output_sum_up(                                                     &
+                     surf_def_h(0)%emissivity, surf_lsm_h(0)%emissivity, surf_usm_h(0)%emissivity,&
+                     surf_def_h(1)%emissivity, surf_lsm_h(1)%emissivity, surf_usm_h(1)%emissivity,&
+                     surf_def_v(0)%emissivity, surf_lsm_v(0)%emissivity, surf_usm_v(0)%emissivity,&
+                     surf_def_v(1)%emissivity, surf_lsm_v(1)%emissivity, surf_usm_v(1)%emissivity,&
+                     surf_def_v(2)%emissivity, surf_lsm_v(2)%emissivity, surf_usm_v(2)%emissivity,&
+                     surf_def_v(3)%emissivity, surf_lsm_v(3)%emissivity, surf_usm_v(3)%emissivity,&
+                     n_out )
 
        END SELECT
@@ -3392,9 +3191,11 @@
 !> Sum-up the surface data for average output variables.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE surface_data_output_sum_up_1d( var_def_h0, var_def_h1, var_lsm_h, var_usm_h,           &
-                                           var_def_v0, var_lsm_v0, var_usm_v0, 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,  &
-                                           fac )
+ SUBROUTINE surface_data_output_sum_up_1d(  var_def_h0, var_lsm_h0, var_usm_h0,        &
+                                            var_def_h1, var_lsm_h1, var_usm_h1,        &
+                                            var_def_v0, var_lsm_v0, var_usm_v0,        &
+                                            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, fac )
 
     IMPLICIT NONE
@@ -3409,7 +3210,9 @@
 
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_h0  !< output variable at upward-facing default-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h0  !< output variable at upward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_usm_h0  !< output variable at upward-facing urban-type surfaces
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_h1  !< output variable at downward-facing default-type surfaces
-    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h   !< output variable at upward-facing natural-type surfaces
-    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_usm_h   !< output variable at upward-facing urban-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h1  !< output variable at downward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_usm_h1  !< output variable at downward-facing urban-type surfaces
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_v0  !< output variable at northward-facing default-type surfaces
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_v1  !< output variable at southward-facing default-type surfaces
@@ -3454,4 +3257,24 @@
        n_surf = n_surf + surf_def_h(0)%ns
     ENDIF
+    IF ( ALLOCATED( var_lsm_h0 ) )  THEN
+       DO  m = 1, surf_lsm_h(0)%ns
+          n_surf                        = n_surf + 1
+          k                             = surf_lsm_h(0)%k(m)
+          surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) + var_lsm_h0(m) *        &
+                                          conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_lsm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h0 ) )  THEN
+       DO  m = 1, surf_usm_h(0)%ns
+          n_surf                        = n_surf + 1
+          k                             = surf_usm_h(0)%k(m)
+          surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) + var_usm_h0(m) *          &
+                                          conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_usm_h(0)%ns
+    ENDIF
     IF ( ALLOCATED( var_def_h1 ) )  THEN
        DO  m = 1, surf_def_h(1)%ns
@@ -3464,23 +3287,23 @@
        n_surf = n_surf + surf_def_h(1)%ns
     ENDIF
-    IF ( ALLOCATED( var_lsm_h ) )  THEN
-       DO  m = 1, surf_lsm_h%ns
+    IF ( ALLOCATED( var_lsm_h1 ) )  THEN
+       DO  m = 1, surf_lsm_h(1)%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) *           &
+          k                             = surf_lsm_h(1)%k(m)
+          surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) + var_lsm_h1(m) *         &
                                           conversion_factor(k)
        ENDDO
     ELSE
-       n_surf = n_surf + surf_lsm_h%ns
-    ENDIF
-    IF ( ALLOCATED( var_usm_h ) )  THEN
-       DO  m = 1, surf_usm_h%ns
+       n_surf = n_surf + surf_lsm_h(1)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h1 ) )  THEN
+       DO  m = 1, surf_usm_h(1)%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) *           &
+          k                             = surf_usm_h(1)%k(m)
+          surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) + var_usm_h1(m) *          &
                                           conversion_factor(k)
        ENDDO
     ELSE
-       n_surf = n_surf + surf_usm_h%ns
+       n_surf = n_surf + surf_usm_h(1)%ns
     ENDIF
 !
@@ -3621,9 +3444,11 @@
 !> approach.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE surface_data_output_sum_up_2d( var_def_h0, var_def_h1, var_lsm_h, var_usm_h,           &
-                                           var_def_v0, var_lsm_v0, var_usm_v0, 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,  &
-                                           fac )
+ SUBROUTINE surface_data_output_sum_up_2d(  var_def_h0, var_lsm_h0, var_usm_h0,        &
+                                            var_def_h1, var_lsm_h1, var_usm_h1,        &
+                                            var_def_v0, var_lsm_v0, var_usm_v0,        &
+                                            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, fac )
 
     IMPLICIT NONE
@@ -3638,7 +3463,9 @@
 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h0  !< output variable at upward-facing default-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h0  !< output variable at upward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h0  !< output variable at upward-facing urban-type surfaces
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h1  !< output variable at downward-facing default-type surfaces
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h   !< output variable at upward-facing natural-type surfaces
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h   !< output variable at upward-facing urban-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h1  !< output variable at downward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h1  !< output variable at downward-facing urban-type surfaces
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v0  !< output variable at northward-facing default-type surfaces
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v1  !< output variable at southward-facing default-type surfaces
@@ -3695,25 +3522,47 @@
        n_surf = n_surf + surf_def_h(1)%ns
     ENDIF
-    IF ( ALLOCATED( var_lsm_h ) )  THEN
-       DO  m = 1, surf_lsm_h%ns
+    IF ( ALLOCATED( var_lsm_h0 ) )  THEN
+       DO  m = 1, surf_lsm_h(0)%ns
           n_surf                        = n_surf + 1
-          k                             = surf_lsm_h%k(m)
+          k                             = surf_lsm_h(0)%k(m)
           surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)                            &
-                                        + SUM ( surf_lsm_h%frac(m,:) *                             &
-                                          var_lsm_h(m,:) ) * conversion_factor(k)
-       ENDDO
-    ELSE
-       n_surf = n_surf + surf_lsm_h%ns
-    ENDIF
-    IF ( ALLOCATED( var_usm_h ) )  THEN
-       DO  m = 1, surf_usm_h%ns
+                                        + SUM ( surf_lsm_h(0)%frac(m,:) *                          &
+                                          var_lsm_h0(m,:) ) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_lsm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_lsm_h1 ) )  THEN
+       DO  m = 1, surf_lsm_h(1)%ns
           n_surf                        = n_surf + 1
-          k                             = surf_usm_h%k(m)
+          k                             = surf_lsm_h(1)%k(m)
           surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)                            &
-                                        + SUM ( surf_usm_h%frac(m,:) *                             &
-                                          var_usm_h(m,:) ) * conversion_factor(k)
-       ENDDO
-    ELSE
-       n_surf = n_surf + surf_usm_h%ns
+                                        + SUM ( surf_lsm_h(1)%frac(m,:) *                          &
+                                          var_lsm_h1(m,:) ) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_lsm_h(1)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h0 ) )  THEN
+       DO  m = 1, surf_usm_h(0)%ns
+          n_surf                        = n_surf + 1
+          k                             = surf_usm_h(0)%k(m)
+          surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)                            &
+                                        + SUM ( surf_usm_h(0)%frac(m,:) *                          &
+                                          var_usm_h0(m,:) ) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_usm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h1 ) )  THEN
+       DO  m = 1, surf_usm_h(1)%ns
+          n_surf                        = n_surf + 1
+          k                             = surf_usm_h(1)%k(m)
+          surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)                            &
+                                        + SUM ( surf_usm_h(1)%frac(m,:) *                          &
+                                          var_usm_h1(m,:) ) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_usm_h(1)%ns
     ENDIF
 !
@@ -3865,8 +3714,10 @@
 !> Collect the surface data from different types and different orientation.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE surface_data_output_collect_1d( var_def_h0, var_def_h1, var_lsm_h, var_usm_h,          &
-                                           var_def_v0, var_lsm_v0, var_usm_v0, 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, fac )
+ SUBROUTINE surface_data_output_collect_1d( var_def_h0, var_lsm_h0, var_usm_h0,        &
+                                            var_def_h1, var_lsm_h1, var_usm_h1,        &
+                                            var_def_v0, var_lsm_v0, var_usm_v0,        &
+                                            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, fac )
 
     IMPLICIT NONE
@@ -3881,6 +3732,8 @@
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_h0  !< output variable at upward-facing default-type surfaces
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_h1  !< output variable at downward-facing default-type surfaces
-    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h   !< output variable at upward-facing natural-type surfaces
-    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_usm_h   !< output variable at upward-facing urban-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h0  !< output variable at upward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h1  !< output variable at downward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_usm_h0  !< output variable at upward-facing urban-type surfaces
+    REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_usm_h1  !< output variable at downward-facing urban-type surfaces
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_v0  !< output variable at northward-facing default-type surfaces
     REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) ::  var_def_v1  !< output variable at southward-facing default-type surfaces
@@ -3932,21 +3785,39 @@
        n_surf = n_surf + surf_def_h(1)%ns
     ENDIF
-    IF ( ALLOCATED( var_lsm_h ) )  THEN
-       DO  m = 1, surf_lsm_h%ns
+    IF ( ALLOCATED( var_lsm_h0 ) )  THEN
+       DO  m = 1, surf_lsm_h(0)%ns
           n_surf                   = n_surf + 1
-          k                        = surf_lsm_h%k(m)
-          surfaces%var_out(n_surf) = var_lsm_h(m) * conversion_factor(k)
-       ENDDO
-    ELSE
-       n_surf = n_surf + surf_lsm_h%ns
-    ENDIF
-    IF ( ALLOCATED( var_usm_h ) )  THEN
-       DO  m = 1, surf_usm_h%ns
+          k                        = surf_lsm_h(0)%k(m)
+          surfaces%var_out(n_surf) = var_lsm_h0(m) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_lsm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_lsm_h1 ) )  THEN
+       DO  m = 1, surf_lsm_h(1)%ns
           n_surf                   = n_surf + 1
-          k                        = surf_usm_h%k(m)
-          surfaces%var_out(n_surf) = var_usm_h(m) * conversion_factor(k)
-       ENDDO
-    ELSE
-       n_surf = n_surf + surf_usm_h%ns
+          k                        = surf_lsm_h(1)%k(m)
+          surfaces%var_out(n_surf) = var_lsm_h1(m) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_lsm_h(1)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h0 ) )  THEN
+       DO  m = 1, surf_usm_h(0)%ns
+          n_surf                   = n_surf + 1
+          k                        = surf_usm_h(0)%k(m)
+          surfaces%var_out(n_surf) = var_usm_h0(m) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_usm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h1 ) )  THEN
+       DO  m = 1, surf_usm_h(1)%ns
+          n_surf                   = n_surf + 1
+          k                        = surf_usm_h(1)%k(m)
+          surfaces%var_out(n_surf) = var_usm_h1(m) * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_usm_h(1)%ns
     ENDIF
 !
@@ -4075,8 +3946,10 @@
 !> defined using tile approach.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE surface_data_output_collect_2d( var_def_h0, var_def_h1, var_lsm_h, var_usm_h,          &
-                                            var_def_v0, var_lsm_v0, var_usm_v0, 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, fac )
+ SUBROUTINE surface_data_output_collect_2d( var_def_h0, var_lsm_h0, var_usm_h0,       &
+                                            var_def_h1, var_lsm_h1, var_usm_h1,       &
+                                            var_def_v0, var_lsm_v0, var_usm_v0,       &
+                                            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, fac )
 
     IMPLICIT NONE
@@ -4091,6 +3964,8 @@
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h0  !< output variable at upward-facing default-type surfaces
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h1  !< output variable at downward-facing default-type surfaces
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h   !< output variable at upward-facing natural-type surfaces
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h   !< output variable at upward-facing urban-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h0  !< output variable at upward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h1  !< output variable at downward-facing natural-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h0  !< output variable at upward-facing urban-type surfaces
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h1  !< output variable at downward-facing urban-type surfaces
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v0  !< output variable at northward-facing default-type surfaces
     REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v1  !< output variable at southward-facing default-type surfaces
@@ -4138,5 +4013,5 @@
           n_surf                   = n_surf + 1
           k                        = surf_def_h(1)%k(m)
-          surfaces%var_out(n_surf) = SUM ( surf_def_h(1)%frac(m,:) * var_def_h1(m,:) ) *           &
+          surfaces%var_out(n_surf) = SUM ( surf_def_h(1)%frac(m,:) * var_def_h1(m,:) ) *          &
                                      conversion_factor(k)
        ENDDO
@@ -4144,23 +4019,43 @@
        n_surf = n_surf + surf_def_h(1)%ns
     ENDIF
-    IF ( ALLOCATED( var_lsm_h ) )  THEN
-       DO  m = 1, surf_lsm_h%ns
+    IF ( ALLOCATED( var_lsm_h0 ) )  THEN
+       DO  m = 1, surf_lsm_h(0)%ns
           n_surf                   = n_surf + 1
-          k                        = surf_lsm_h%k(m)
-          surfaces%var_out(n_surf) = SUM ( surf_lsm_h%frac(m,:) * var_lsm_h(m,:) ) *               &
+          k                        = surf_lsm_h(0)%k(m)
+          surfaces%var_out(n_surf) = SUM ( surf_lsm_h(0)%frac(m,:) * var_lsm_h0(m,:) ) *          &
                                      conversion_factor(k)
        ENDDO
     ELSE
-       n_surf = n_surf + surf_lsm_h%ns
-    ENDIF
-    IF ( ALLOCATED( var_usm_h ) )  THEN
-       DO  m = 1, surf_usm_h%ns
+       n_surf = n_surf + surf_lsm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_lsm_h1 ) )  THEN
+       DO  m = 1, surf_lsm_h(1)%ns
           n_surf                   = n_surf + 1
-          k                        = surf_usm_h%k(m)
-          surfaces%var_out(n_surf) = SUM ( surf_usm_h%frac(m,:) * var_usm_h(m,:) )                 &
+          k                        = surf_lsm_h(1)%k(m)
+          surfaces%var_out(n_surf) = SUM ( surf_lsm_h(1)%frac(m,:) * var_lsm_h1(m,:) ) *         &
+                                     conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_lsm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h0 ) )  THEN
+       DO  m = 1, surf_usm_h(0)%ns
+          n_surf                   = n_surf + 1
+          k                        = surf_usm_h(0)%k(m)
+          surfaces%var_out(n_surf) = SUM ( surf_usm_h(0)%frac(m,:) * var_usm_h0(m,:) )            &
                                      * conversion_factor(k)
        ENDDO
     ELSE
-       n_surf = n_surf + surf_usm_h%ns
+       n_surf = n_surf + surf_usm_h(0)%ns
+    ENDIF
+    IF ( ALLOCATED( var_usm_h1 ) )  THEN
+       DO  m = 1, surf_usm_h(1)%ns
+          n_surf                   = n_surf + 1
+          k                        = surf_usm_h(1)%k(m)
+          surfaces%var_out(n_surf) = SUM ( surf_usm_h(1)%frac(m,:) * var_usm_h1(m,:) )            &
+                                     * conversion_factor(k)
+       ENDDO
+    ELSE
+       n_surf = n_surf + surf_usm_h(1)%ns
     ENDIF
 !
@@ -4723,18 +4618,18 @@
                 num_surf(j,i)         = num_surf(j,i) + 1
              ENDDO
-          ENDDO
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-             n                     = n + 1
-             surfaces%var_av(n,nv) = surf_in(start_index(j,i)+num_surf(j,i))
-             num_surf(j,i)         = num_surf(j,i) + 1
-          ENDDO
-          DO  m = 1, surf_usm_h%ns 
-             i = surf_usm_h%i(m)
-             j = surf_usm_h%j(m)
-             n                     = n + 1
-             surfaces%var_av(n,nv) = surf_in(start_index(j,i)+num_surf(j,i))
-             num_surf(j,i)         = num_surf(j,i) + 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+                n                     = n + 1
+                surfaces%var_av(n,nv) = surf_in(start_index(j,i)+num_surf(j,i))
+                num_surf(j,i)         = num_surf(j,i) + 1
+             ENDDO
+             DO  m = 1, surf_usm_h(l)%ns
+                i = surf_usm_h(l)%i(m)
+                j = surf_usm_h(l)%j(m)
+                n                     = n + 1
+                surfaces%var_av(n,nv) = surf_in(start_index(j,i)+num_surf(j,i))
+                num_surf(j,i)         = num_surf(j,i) + 1
+             ENDDO
           ENDDO
 
@@ -4857,14 +4752,14 @@
                 num_surf(j,i) = num_surf(j,i) + 1
              ENDDO
-          ENDDO
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-             num_surf(j,i) = num_surf(j,i) + 1
-          ENDDO
-          DO  m = 1, surf_usm_h%ns
-             i = surf_usm_h%i(m)
-             j = surf_usm_h%j(m)
-             num_surf(j,i) = num_surf(j,i) + 1
+             DO  m = 1, surf_lsm_h(l)%ns
+                i = surf_lsm_h(l)%i(m)
+                j = surf_lsm_h(l)%j(m)
+                num_surf(j,i) = num_surf(j,i) + 1
+             ENDDO
+             DO  m = 1, surf_usm_h(l)%ns
+                i = surf_usm_h(l)%i(m)
+                j = surf_usm_h(l)%j(m)
+                num_surf(j,i) = num_surf(j,i) + 1
+             ENDDO
           ENDDO
 
@@ -4915,18 +4810,18 @@
                    num_surf(j,i)                              = num_surf(j,i) + 1
                 ENDDO
-             ENDDO
-             DO  m = 1, surf_lsm_h%ns
-                i = surf_lsm_h%i(m)
-                j = surf_lsm_h%j(m)
-                n                                          = n + 1
-                surf_out(start_index(j,i)+num_surf(j,i)) = surfaces%var_av(n,nv)
-                num_surf(j,i)                              = num_surf(j,i) + 1
-             ENDDO
-             DO  m = 1, surf_usm_h%ns
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                n                                          = n + 1
-                surf_out(start_index(j,i)+num_surf(j,i)) = surfaces%var_av(n,nv)
-                num_surf(j,i)                              = num_surf(j,i) + 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i = surf_lsm_h(l)%i(m)
+                   j = surf_lsm_h(l)%j(m)
+                   n                                          = n + 1
+                   surf_out(start_index(j,i)+num_surf(j,i)) = surfaces%var_av(n,nv)
+                   num_surf(j,i)                              = num_surf(j,i) + 1
+                ENDDO
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   n                                          = n + 1
+                   surf_out(start_index(j,i)+num_surf(j,i)) = surfaces%var_av(n,nv)
+                   num_surf(j,i)                              = num_surf(j,i) + 1
+                ENDDO
              ENDDO
 
Index: palm/trunk/SOURCE/surface_layer_fluxes_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_layer_fluxes_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/surface_layer_fluxes_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4594 2020-07-09 15:01:00Z suehring
 ! Include k index in OMP PRIVATE statements
 !
@@ -285,13 +288,13 @@
           CALL calc_ln
        ENDIF
+       IF ( surf_lsm_h(l)%ns >= 1 )  THEN
+          surf => surf_lsm_h(l)
+          CALL calc_ln
+       ENDIF
+       IF ( surf_usm_h(l)%ns >= 1 )  THEN
+          surf => surf_usm_h(l)
+          CALL calc_ln
+       ENDIF
     ENDDO
-    IF ( surf_lsm_h%ns >= 1 )  THEN
-       surf => surf_lsm_h
-       CALL calc_ln
-    ENDIF
-    IF ( surf_usm_h%ns >= 1 )  THEN
-       surf => surf_usm_h
-       CALL calc_ln
-    ENDIF
 
     DO  l = 0, 3
@@ -311,6 +314,6 @@
 !
 !-- Derive potential temperature and specific humidity at first grid level from the fields pt and q
-!-- First call for horizontal default-type surfaces (l=0 - upward facing, l=1 - downward facing)
     DO  l = 0, 1
+!--    First call for horizontal default-type surfaces (l=0 - upward facing, l=1 - downward facing)
        IF ( surf_def_h(l)%ns >= 1  )  THEN
           surf => surf_def_h(l)
@@ -324,19 +327,17 @@
           ENDIF
        ENDIF
+!
+!--    Call for natural-type horizontal surfaces
+       IF ( surf_lsm_h(l)%ns >= 1  )  THEN
+          surf => surf_lsm_h(l)
+          CALL calc_pt_q
+       ENDIF
+!
+!--    Call for urban-type horizontal surfaces
+       IF ( surf_usm_h(l)%ns >= 1  )  THEN
+          surf => surf_usm_h(l)
+          CALL calc_pt_q
+       ENDIF
     ENDDO
-!
-!-- Call for natural-type horizontal surfaces
-    IF ( surf_lsm_h%ns >= 1  )  THEN
-       surf => surf_lsm_h
-       CALL calc_pt_q
-    ENDIF
-
-!
-!-- Call for urban-type horizontal surfaces
-    IF ( surf_usm_h%ns >= 1  )  THEN
-       surf => surf_usm_h
-       CALL calc_pt_q
-    ENDIF
-
 !
 !-- Call for natural-type vertical surfaces
@@ -373,6 +374,6 @@
 !
 !-- Natural-type horizontal surfaces
-    IF ( surf_lsm_h%ns >= 1 )  THEN
-       surf => surf_lsm_h
+    IF ( surf_lsm_h(0)%ns >= 1 )  THEN
+       surf => surf_lsm_h(0)
        CALL calc_uvw_abs
        IF ( .NOT. neutral )  CALL calc_ol
@@ -383,6 +384,6 @@
 !
 !-- Urban-type horizontal surfaces
-    IF ( surf_usm_h%ns >= 1 )  THEN
-       surf => surf_usm_h
+    IF ( surf_usm_h(0)%ns >= 1 )  THEN
+       surf => surf_usm_h(0)
        CALL calc_uvw_abs
        IF ( .NOT. neutral )  CALL calc_ol
@@ -396,15 +397,30 @@
 
 !
-!-- Treat downward-facing horizontal surfaces. Note, so far, these are always default type.
+!-- Treat downward-facing horizontal surfaces.
 !-- Stratification is not considered in this case, hence, no further distinction between different
 !-- most_method is required.
+    downward = .TRUE.
+!-- Default type.
     IF ( surf_def_h(1)%ns >= 1 )  THEN
-       downward = .TRUE.
        surf => surf_def_h(1)
        CALL calc_uvw_abs
        CALL calc_us
        CALL calc_surface_fluxes
-       downward = .FALSE.
-    ENDIF
+    ENDIF
+!-- Natural surface type.
+    IF ( surf_lsm_h(1)%ns >= 1 )  THEN
+       surf => surf_lsm_h(1)
+       CALL calc_uvw_abs
+       CALL calc_us
+       CALL calc_surface_fluxes
+    ENDIF
+!-- Urban surface type.
+    IF ( surf_usm_h(1)%ns >= 1 )  THEN
+       surf => surf_usm_h(1)
+       CALL calc_uvw_abs
+       CALL calc_us
+       CALL calc_surface_fluxes
+    ENDIF
+    downward = .FALSE.
 !
 !-- Calculate surfaces fluxes at vertical surfaces for momentum and subgrid-scale TKE. No stability
@@ -664,8 +680,12 @@
 !-- In case of runs with neutral statification, set Obukhov length to a large value
     IF ( neutral )  THEN
-       IF ( surf_def_h(0)%ns >= 1 )  surf_def_h(0)%ol = 1.0E10_wp
-       IF ( surf_lsm_h%ns    >= 1 )  surf_lsm_h%ol    = 1.0E10_wp
-       IF ( surf_usm_h%ns    >= 1 )  surf_usm_h%ol    = 1.0E10_wp
-
+       DO  l = 0, 1
+          IF ( surf_def_h(l)%ns >= 1  .AND.                                                        &
+               ALLOCATED( surf_def_h(l)%ol ) )  surf_def_h(l)%ol = 1.0E10_wp
+          IF ( surf_lsm_h(l)%ns    >= 1  .AND.                                                     &
+               ALLOCATED( surf_lsm_h(l)%ol ) )  surf_lsm_h(l)%ol = 1.0E10_wp
+          IF ( surf_usm_h(l)%ns    >= 1  .AND.                                                     &
+               ALLOCATED( surf_usm_h(l)%ol ) )  surf_usm_h(l)%ol = 1.0E10_wp
+       ENDDO
        DO  l = 0, 3
           IF ( surf_def_v(l)%ns >= 1  .AND.                                                        &
Index: palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/surface_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4598 2020-07-10 10:13:23Z suehring
 ! Revise surface-element mapping in mpi-io restart branch
 !
@@ -543,7 +546,7 @@
     TYPE (surf_type), DIMENSION(0:2), TARGET ::  surf_def_h  !< horizontal default surfaces (Up, Down, and Top)
     TYPE (surf_type), DIMENSION(0:3), TARGET ::  surf_def_v  !< vertical default surfaces (North, South, East, West)
-    TYPE (surf_type)                , TARGET ::  surf_lsm_h  !< horizontal natural land surfaces, so far only upward-facing
+    TYPE (surf_type), DIMENSION(0:1), TARGET ::  surf_lsm_h  !< horizontal natural land surfaces (Up, Down)
     TYPE (surf_type), DIMENSION(0:3), TARGET ::  surf_lsm_v  !< vertical land surfaces (North, South, East, West)
-    TYPE (surf_type)                , TARGET ::  surf_usm_h  !< horizontal urban surfaces, so far only upward-facing
+    TYPE (surf_type), DIMENSION(0:1), TARGET ::  surf_usm_h  !< horizontal urban surfaces (Up, Down)
     TYPE (surf_type), DIMENSION(0:3), TARGET ::  surf_usm_v  !< vertical urban surfaces (North, South, East, West)
 
@@ -855,8 +858,10 @@
     INTEGER(iwp) ::  k         !< running index z-direction
     INTEGER(iwp) ::  l         !< index variable for surface facing
-    INTEGER(iwp) ::  num_lsm_h !< number of horizontally-aligned natural surfaces
-    INTEGER(iwp) ::  num_usm_h !< number of horizontally-aligned urban surfaces
+    INTEGER(iwp) ::  kk        !< auxiliary index z-direction
+    INTEGER(iwp) ::  kd        !< direction index
 
     INTEGER(iwp), DIMENSION(0:2) ::  num_def_h !< number of horizontally-aligned default surfaces
+    INTEGER(iwp), DIMENSION(0:1) ::  num_lsm_h !< number of horizontally-aligned natural surfaces
+    INTEGER(iwp), DIMENSION(0:1) ::  num_usm_h !< number of horizontally-aligned urban surfaces
     INTEGER(iwp), DIMENSION(0:3) ::  num_def_v !< number of vertically-aligned default surfaces
     INTEGER(iwp), DIMENSION(0:3) ::  num_lsm_v !< number of vertically-aligned natural surfaces
@@ -891,49 +896,51 @@
              IF ( BTEST( wall_flags_total_0(k,j,i), 0 ) )  THEN
 !
-!--             Check if grid point adjoins to any upward-facing horizontal surface, e.g. the Earth
-!--             surface, plane roofs, or ceilings.
-
-                IF ( .NOT. BTEST( wall_flags_total_0(k-1,j,i), 0 ) )  THEN
-!
-!--                Determine flags indicating a terrain surface, a building surface,
-                   terrain  = BTEST( wall_flags_total_0(k-1,j,i), 5 )  .OR.  topo_no_distinct
-                   building = BTEST( wall_flags_total_0(k-1,j,i), 6 )  .OR.  topo_no_distinct
-!
-!--                Unresolved_building indicates a surface with equal height as terrain but with a
-!--                non-grid resolved building on top. These surfaces will be flagged as urban
-!--                surfaces.
-                   unresolved_building = BTEST( wall_flags_total_0(k-1,j,i), 5 )  .AND.            &
-                                         BTEST( wall_flags_total_0(k-1,j,i), 6 )
-!
-!--                Land-surface type
-                   IF ( land_surface  .AND.  terrain  .AND.  .NOT. unresolved_building )  THEN
-                      num_lsm_h    = num_lsm_h    + 1
-!
-!--                Urban surface tpye
-                   ELSEIF ( urban_surface  .AND.  building )  THEN
-                      num_usm_h = num_usm_h + 1
-!
-!--                Default-surface type
-                   ELSEIF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
-                      num_def_h(0) = num_def_h(0) + 1
-!
-!--                Unclassifified surface-grid point. Give error message.
+!--             Check if grid point adjoins to any upward- and downward-facing horizontal surface,
+!--             e.g. the Earth surface, plane roofs, or ceilings.
+                DO kk = k-1, k+1, 2
+!
+!--                Check for top-fluxes
+                   IF ( kk == nzt+1  .AND.  use_top_fluxes )  THEN
+                      num_def_h(2) = num_def_h(2) + 1
                    ELSE
-                      WRITE( message_string, * ) 'Unclassified upward-facing surface element '//   &
-                                                 'at grid point (k,j,i) = ', k, j, i
-                      CALL message( 'surface_mod', 'PA0698', 1, 2, myid, 6, 0 )
+!
+!--                   set direction index of the potential surface
+                      kd = MERGE( 0, 1, kk == k-1 )
+!
+!--                   test the adjacent grid cell
+                      IF ( .NOT. BTEST( wall_flags_total_0(kk,j,i), 0 ) )  THEN
+!
+!--                      Determine flags indicating a terrain surface, a building surface,
+                         terrain  = BTEST( wall_flags_total_0(kk,j,i), 5 )  .OR.  topo_no_distinct
+                         building = BTEST( wall_flags_total_0(kk,j,i), 6 )  .OR.  topo_no_distinct
+!
+!--                      Unresolved_building indicates a surface with equal height as terrain but with a
+!--                      non-grid resolved building on top. These surfaces will be flagged as urban
+!--                      surfaces.
+                         unresolved_building = BTEST( wall_flags_total_0(kk,j,i), 5 )  .AND.            &
+                                               BTEST( wall_flags_total_0(kk,j,i), 6 )
+!
+!--                      Land-surface type
+                         IF ( land_surface  .AND.  terrain  .AND.  .NOT. unresolved_building )  THEN
+                            num_lsm_h(kd)    = num_lsm_h(kd)    + 1
+!
+!--                      Urban surface tpye
+                         ELSEIF ( urban_surface  .AND.  building )  THEN
+                            num_usm_h(kd) = num_usm_h(kd) + 1
+!
+!--                      Default-surface type
+                         ELSEIF ( .NOT. land_surface  .AND.  .NOT. urban_surface )  THEN
+                            num_def_h(kd) = num_def_h(kd) + 1
+!
+!--                      Unclassifified surface-grid point. Give error message.
+                         ELSE
+                            WRITE( message_string, * ) 'Unclassified ',                            &
+                                  TRIM(MERGE('  upward','downward',kk==0)),                        &
+                                  '-facing surface element at grid point (k,j,i) = ', k, j, i
+                            CALL message( 'surface_mod', 'PA0698', 1, 2, myid, 6, 0 )
+                         ENDIF
+                      ENDIF
                    ENDIF
-
-                ENDIF
-!
-!--             Check for top-fluxes
-                IF ( k == nzt  .AND.  use_top_fluxes )  THEN
-                   num_def_h(2) = num_def_h(2) + 1
-!
-!--             Check for any other downward-facing surface. So far only for default surface type.
-                ELSEIF ( .NOT. BTEST( wall_flags_total_0(k+1,j,i), 0 ) )  THEN
-                   num_def_h(1) = num_def_h(1) + 1
-                ENDIF
-
+                ENDDO
              ENDIF
           ENDDO
@@ -1075,9 +1082,15 @@
     surf_def_h(2)%ns = num_def_h(2)
 !
-!-- Horizontal surface, natural type, so far only upward-facing
-    surf_lsm_h%ns    = num_lsm_h
-!
-!-- Horizontal surface, urban type, so far only upward-facing
-    surf_usm_h%ns    = num_usm_h
+!-- Horizontal surface, natural type, upward facing
+    surf_lsm_h(0)%ns    = num_lsm_h(0)
+!
+!-- Horizontal surface, natural type, downward facing
+    surf_lsm_h(1)%ns    = num_lsm_h(1)
+!
+!-- Horizontal surface, urban type, upward facing
+    surf_usm_h(0)%ns    = num_usm_h(0)
+!
+!-- Horizontal surface, urban type, downward facing
+    surf_usm_h(1)%ns    = num_usm_h(1)
 !
 !-- Vertical surface, default type, northward facing
@@ -1127,8 +1140,12 @@
 !
 !-- Allocate required attributes for horizontal surfaces - natural type.
-    CALL allocate_surface_attributes_h ( surf_lsm_h, nys, nyn, nxl, nxr )
+    DO  l = 0, 1
+       CALL allocate_surface_attributes_h ( surf_lsm_h(l), nys, nyn, nxl, nxr )
+    ENDDO
 !
 !-- Allocate required attributes for horizontal surfaces - urban type.
-    CALL allocate_surface_attributes_h ( surf_usm_h, nys, nyn, nxl, nxr )
+    DO  l = 0, 1
+       CALL allocate_surface_attributes_h ( surf_usm_h(l), nys, nyn, nxl, nxr )
+    ENDDO
 
 !
@@ -1182,7 +1199,7 @@
     !$ACC COPYIN(surf_def_h(0:2)) &
     !$ACC COPYIN(surf_def_v(0:3)) &
-    !$ACC COPYIN(surf_lsm_h) &
+    !$ACC COPYIN(surf_lsm_h(0:1)) &
     !$ACC COPYIN(surf_lsm_v(0:3)) &
-    !$ACC COPYIN(surf_usm_h) &
+    !$ACC COPYIN(surf_usm_h(0:1)) &
     !$ACC COPYIN(surf_usm_v(0:3))
 !
@@ -1199,5 +1216,7 @@
 !
 !-- Copy data in surf_lsm_h
-    CALL enter_surface_attributes_h( surf_lsm_h )
+    DO  l = 0, 1
+       CALL enter_surface_attributes_h( surf_lsm_h(l) )
+    ENDDO
 !
 !-- Copy data in surf_lsm_v(0:3)
@@ -1207,5 +1226,7 @@
 !
 !-- Copy data in surf_usm_h
-    CALL enter_surface_attributes_h( surf_usm_h )
+    DO  l = 0, 1
+       CALL enter_surface_attributes_h( surf_usm_h(l) )
+    ENDDO
 !
 !-- Copy data in surf_usm_v(0:3)
@@ -1241,5 +1262,7 @@
 !
 !-- Delete data in surf_lsm_h
-    CALL exit_surface_attributes_h( surf_lsm_h )
+    DO  l = 0, 1
+       CALL exit_surface_attributes_h( surf_lsm_h(l) )
+    ENDDO
 !
 !-- Delete data in surf_lsm_v(0:3)
@@ -1249,5 +1272,7 @@
 !
 !-- Delete data in surf_usm_h
-    CALL exit_surface_attributes_h( surf_usm_h )
+    DO  l = 0, 1
+       CALL exit_surface_attributes_h( surf_usm_h(l) )
+    ENDDO
 !
 !-- Delete data in surf_usm_v(0:3)
@@ -1259,7 +1284,7 @@
     !$ACC DELETE(surf_def_h(0:2)) &
     !$ACC DELETE(surf_def_v(0:3)) &
-    !$ACC DELETE(surf_lsm_h) &
+    !$ACC DELETE(surf_lsm_h(0:1)) &
     !$ACC DELETE(surf_lsm_v(0:3)) &
-    !$ACC DELETE(surf_usm_h) &
+    !$ACC DELETE(surf_usm_h(0:1)) &
     !$ACC DELETE(surf_usm_v(0:3))
 
@@ -2178,16 +2203,18 @@
     INTEGER(iwp) ::  j  !< running index y-direction
     INTEGER(iwp) ::  k  !< running index z-direction
-
-    INTEGER(iwp)  ::  start_index_lsm_h  !< dummy to determing local start index in surface type for given (j,i), for horizontal
-                                         !< natural surfaces
-    INTEGER(iwp)  ::  start_index_usm_h  !< dummy to determing local start index in surface type for given (j,i), for horizontal
-                                         !< urban surfaces
-
-    INTEGER(iwp)  ::  num_lsm_h      !< current number of horizontal surface element, natural type
-    INTEGER(iwp)  ::  num_lsm_h_kji  !< dummy to determing local end index in surface type for given (j,i), for for horizonal
-                                     !< natural surfaces
-    INTEGER(iwp)  ::  num_usm_h      !< current number of horizontal surface element, urban type
-    INTEGER(iwp)  ::  num_usm_h_kji  !< dummy to determing local end index in surface type for given (j,i), for for horizonal urban
-                                     !< surfaces
+    INTEGER(iwp) ::  kk !< auxiliary index z-direction
+    INTEGER(iwp) ::  l  !< direction index
+
+
+    INTEGER(iwp), DIMENSION(0:1)  ::  start_index_lsm_h !< dummy to determing local start index in surface type for given (j,i), for horizontal
+                                                        !< natural surfaces
+    INTEGER(iwp), DIMENSION(0:1)  ::  start_index_usm_h !< dummy to determing local start index in surface type for given (j,i), for horizontal
+                                                        !< urban surfaces
+    INTEGER(iwp), DIMENSION(0:1)  ::  num_lsm_h         !< current number of horizontal surface element, natural type
+    INTEGER(iwp), DIMENSION(0:1)  ::  num_lsm_h_kji     !< dummy to determing local end index in surface type for given (j,i), for for horizonal
+                                                        !< natural surfaces
+    INTEGER(iwp), DIMENSION(0:1)  ::  num_usm_h         !< current number of horizontal surface element, urban type
+    INTEGER(iwp), DIMENSION(0:1)  ::  num_usm_h_kji     !< dummy to determing local end index in surface type for given (j,i), for for horizonal urban
+                                                        !< surfaces
 
     INTEGER(iwp), DIMENSION(0:2) ::  num_def_h          !< current number of horizontal surface element, default type
@@ -2197,13 +2224,13 @@
                                                         !< for horizontal default surfaces
 
-    INTEGER(iwp), DIMENSION(0:3) ::  num_def_v      !< current number of vertical surface element, default type
-    INTEGER(iwp), DIMENSION(0:3) ::  num_def_v_kji  !< dummy to determing local end index in surface type for given (j,i),
-                                                    !< for vertical default surfaces
-    INTEGER(iwp), DIMENSION(0:3) ::  num_lsm_v      !< current number of vertical surface element, natural type
-    INTEGER(iwp), DIMENSION(0:3) ::  num_lsm_v_kji  !< dummy to determing local end index in surface type for given (j,i),
-                                                    !< for vertical natural surfaces
-    INTEGER(iwp), DIMENSION(0:3) ::  num_usm_v      !< current number of vertical surface element, urban type
-    INTEGER(iwp), DIMENSION(0:3) ::  num_usm_v_kji  !< dummy to determing local end index in surface type for given (j,i),
-                                                    !< for vertical urban surfaces
+    INTEGER(iwp), DIMENSION(0:3) ::  num_def_v          !< current number of vertical surface element, default type
+    INTEGER(iwp), DIMENSION(0:3) ::  num_def_v_kji      !< dummy to determing local end index in surface type for given (j,i),
+                                                        !< for vertical default surfaces
+    INTEGER(iwp), DIMENSION(0:3) ::  num_lsm_v          !< current number of vertical surface element, natural type
+    INTEGER(iwp), DIMENSION(0:3) ::  num_lsm_v_kji      !< dummy to determing local end index in surface type for given (j,i),
+                                                        !< for vertical natural surfaces
+    INTEGER(iwp), DIMENSION(0:3) ::  num_usm_v          !< current number of vertical surface element, urban type
+    INTEGER(iwp), DIMENSION(0:3) ::  num_usm_v_kji      !< dummy to determing local end index in surface type for given (j,i),
+                                                        !< for vertical urban surfaces
 
     INTEGER(iwp), DIMENSION(0:3) ::  start_index_def_v  !< dummy to determing local start index in surface type for given (j,i),
@@ -2214,8 +2241,8 @@
                                                         !< for vertical urban surfaces
 
-    LOGICAL ::  building             !< flag indicating building grid point
-    LOGICAL ::  terrain              !< flag indicating natural terrain grid point
-    LOGICAL ::  unresolved_building  !< flag indicating a grid point where actually a building is defined but not resolved by the
-                                     !< vertical grid
+    LOGICAL ::  building                                !< flag indicating building grid point
+    LOGICAL ::  terrain                                 !< flag indicating natural terrain grid point
+    LOGICAL ::  unresolved_building                     !< flag indicating a grid point where actually a building is defined but not resolved by the
+                                                        !< vertical grid
 !
 !-- Set offset indices, i.e. index difference between surface element and surface-bounded grid point.
@@ -2224,17 +2251,19 @@
     surf_def_h(0:2)%joff = 0
 
-    surf_lsm_h%ioff = 0
-    surf_lsm_h%joff = 0
-
-    surf_usm_h%ioff = 0
-    surf_usm_h%joff = 0
+    surf_lsm_h(0:1)%ioff = 0
+    surf_lsm_h(0:1)%joff = 0
+
+    surf_usm_h(0:1)%ioff = 0
+    surf_usm_h(0:1)%joff = 0
 !
 !-- Upward facing vertical offsets
     surf_def_h(0)%koff = -1
-    surf_lsm_h%koff    = -1
-    surf_usm_h%koff    = -1
+    surf_lsm_h(0)%koff = -1
+    surf_usm_h(0)%koff = -1
 !
 !-- Downward facing vertical offset
     surf_def_h(1:2)%koff = 1
+    surf_lsm_h(1)%koff   = 1
+    surf_usm_h(1)%koff   = 1
 !
 !-- Vertical surfaces - no vertical offset
@@ -2279,8 +2308,8 @@
     num_def_v(0:3) = 1
 
-    num_lsm_h      = 1
+    num_lsm_h(0:1) = 1
     num_lsm_v(0:3) = 1
 
-    num_usm_h      = 1
+    num_usm_h(0:1) = 1
     num_usm_v(0:3) = 1
 
@@ -2288,8 +2317,8 @@
     start_index_def_v(0:3) = 1
 
-    start_index_lsm_h      = 1
+    start_index_lsm_h(0:1) = 1
     start_index_lsm_v(0:3) = 1
 
-    start_index_usm_h      = 1
+    start_index_usm_h(0:1) = 1
     start_index_usm_v(0:3) = 1
 
@@ -2308,46 +2337,48 @@
              IF ( BTEST( wall_flags_total_0(k,j,i), 0 ) )  THEN
 !
-!--             Upward-facing surface. Distinguish between differet surface types.
-!--             To do, think about method to flag natural and non-natural surfaces.
-                IF ( .NOT. BTEST( wall_flags_total_0(k-1,j,i), 0 ) )  THEN
-!
-!--                Determine flags indicating terrain or building
-                   terrain  = BTEST( wall_flags_total_0(k-1,j,i), 5 )  .OR.  topo_no_distinct
-                   building = BTEST( wall_flags_total_0(k-1,j,i), 6 )  .OR.  topo_no_distinct
-
-!
-!--                Unresolved_building indicates a surface with equal height as terrain but with a
-!--                non-grid resolved building on top. These surfaces will be flagged as urban
-!--                surfaces.
-                   unresolved_building = BTEST( wall_flags_total_0(k-1,j,i), 5 ) .AND.             &
-                                         BTEST( wall_flags_total_0(k-1,j,i), 6 )
-!
-!--                Natural surface type
-                   IF ( land_surface  .AND.  terrain  .AND.  .NOT. unresolved_building )  THEN
-                      CALL initialize_horizontal_surfaces( k, j, i, surf_lsm_h, num_lsm_h,         &
-                                                           num_lsm_h_kji, .TRUE., .FALSE. )
-!
-!--                Urban surface tpye
-                   ELSEIF ( urban_surface  .AND.  building )  THEN
-                      CALL initialize_horizontal_surfaces( k, j, i, surf_usm_h, num_usm_h,         &
-                                                           num_usm_h_kji, .TRUE., .FALSE. )
-!
-!--                Default surface type
+!--             Check if grid point adjoins to any upward- and downward-facing horizontal surface,
+!--             e.g. the Earth surface, plane roofs, or ceilings.
+                DO kk = k-1, k+1, 2
+!
+!--                Check for top-fluxes first
+                   IF ( kk == nzt+1  .AND.  use_top_fluxes )  THEN
+                      CALL initialize_top( k, j, i, surf_def_h(2), num_def_h(2), num_def_h_kji(2) )
                    ELSE
-                      CALL initialize_horizontal_surfaces( k, j, i, surf_def_h(0), num_def_h(0),   &
-                                                           num_def_h_kji(0), .TRUE., .FALSE. )
+!
+!--                   set direction index of the potential surface
+                      l = MERGE( 0, 1, kk == k-1 )
+!
+!--                   Upward- or donward facing surface. Distinguish between differet surface types.
+!--                   To do, think about method to flag natural and non-natural surfaces.
+                      IF ( .NOT. BTEST( wall_flags_total_0(kk,j,i), 0 ) )  THEN
+!
+!--                      Determine flags indicating terrain or building
+                         terrain  = BTEST( wall_flags_total_0(kk,j,i), 5 )  .OR.  topo_no_distinct
+                         building = BTEST( wall_flags_total_0(kk,j,i), 6 )  .OR.  topo_no_distinct
+!
+!--                      Unresolved_building indicates a surface with equal height as terrain but with a
+!--                      non-grid resolved building on top. These surfaces will be flagged as urban
+!--                      surfaces.
+                         unresolved_building = BTEST( wall_flags_total_0(kk,j,i), 5 ) .AND.       &
+                                               BTEST( wall_flags_total_0(kk,j,i), 6 )
+!
+!--                      Natural surface type
+                         IF ( land_surface  .AND.  terrain  .AND.  .NOT. unresolved_building )  THEN
+                            CALL initialize_horizontal_surfaces( k, j, i, surf_lsm_h(l), num_lsm_h(l), &
+                                                                 num_lsm_h_kji(l), .TRUE., .FALSE. )
+!
+!--                      Urban surface tpye
+                         ELSEIF ( urban_surface  .AND.  building )  THEN
+                            CALL initialize_horizontal_surfaces( k, j, i, surf_usm_h(l), num_usm_h(l), &
+                                                                 num_usm_h_kji(l), .TRUE., .FALSE. )
+!
+!--                      Default surface type
+                         ELSE
+                            CALL initialize_horizontal_surfaces( k, j, i, surf_def_h(l), num_def_h(l), &
+                                                                 num_def_h_kji(l), .TRUE., .FALSE. )
+                         ENDIF
+                      ENDIF
                    ENDIF
-                ENDIF
-!
-!--             Downward-facing surface, first, model top. Please note, for the moment,
-!--             downward-facing surfaces are always of default type
-                IF ( k == nzt  .AND.  use_top_fluxes )  THEN
-                   CALL initialize_top( k, j, i, surf_def_h(2), num_def_h(2), num_def_h_kji(2) )
-!
-!--             Check for any other downward-facing surface. So far only for default surface type.
-                ELSEIF ( .NOT. BTEST( wall_flags_total_0(k+1,j,i), 0 ) )  THEN
-                   CALL initialize_horizontal_surfaces( k, j, i, surf_def_h(1), num_def_h(1),      &
-                                                        num_def_h_kji(1), .FALSE., .TRUE. )
-                ENDIF
+                ENDDO
 !
 !--             Check for vertical walls and, if required, initialize it.
@@ -2485,13 +2516,17 @@
           start_index_def_h(2)           = surf_def_h(2)%end_index(j,i) + 1
 !
-!--       Horizontal natural land surfaces
-          surf_lsm_h%start_index(j,i)    = start_index_lsm_h
-          surf_lsm_h%end_index(j,i)      = surf_lsm_h%start_index(j,i) + num_lsm_h_kji - 1
-          start_index_lsm_h              = surf_lsm_h%end_index(j,i) + 1
-!
-!--       Horizontal urban surfaces
-          surf_usm_h%start_index(j,i)    = start_index_usm_h
-          surf_usm_h%end_index(j,i)      = surf_usm_h%start_index(j,i) + num_usm_h_kji - 1
-          start_index_usm_h              = surf_usm_h%end_index(j,i) + 1
+!--       Upward- and downward-facing horizontal land and urban surfaces
+          DO l = 0, 1
+!
+!--          Horizontal natural land surfaces
+             surf_lsm_h(l)%start_index(j,i) = start_index_lsm_h(l)
+             surf_lsm_h(l)%end_index(j,i)   = surf_lsm_h(l)%start_index(j,i) + num_lsm_h_kji(l) - 1
+             start_index_lsm_h(l)           = surf_lsm_h(l)%end_index(j,i) + 1
+!
+!--          Horizontal urban surfaces
+             surf_usm_h(l)%start_index(j,i) = start_index_usm_h(l)
+             surf_usm_h(l)%end_index(j,i)   = surf_usm_h(l)%start_index(j,i) + num_usm_h_kji(l) - 1
+             start_index_usm_h(l)           = surf_usm_h(l)%end_index(j,i) + 1
+          ENDDO
 
 !
@@ -3138,125 +3173,125 @@
              ENDDO
 
-             IF ( l == 0 )  THEN
-                DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                   IF ( ALLOCATED( surf_lsm_h%us ) )  surf_h(0)%us(mm(0)) = surf_lsm_h%us(m)
-                   IF ( ALLOCATED( surf_lsm_h%ts ) )  surf_h(0)%ts(mm(0)) = surf_lsm_h%ts(m)
-                   IF ( ALLOCATED( surf_lsm_h%qs ) )  surf_h(0)%qs(mm(0)) = surf_lsm_h%qs(m)
-                   IF ( ALLOCATED( surf_lsm_h%ss ) )  surf_h(0)%ss(mm(0)) = surf_lsm_h%ss(m)
-                   IF ( ALLOCATED( surf_lsm_h%qcs ) )  surf_h(0)%qcs(mm(0)) = surf_lsm_h%qcs(m)
-                   IF ( ALLOCATED( surf_lsm_h%ncs ) )  surf_h(0)%ncs(mm(0)) = surf_lsm_h%ncs(m)
-                   IF ( ALLOCATED( surf_lsm_h%qis ) )  surf_h(0)%qis(mm(0)) = surf_lsm_h%qis(m)
-                   IF ( ALLOCATED( surf_lsm_h%nis ) )  surf_h(0)%nis(mm(0)) = surf_lsm_h%nis(m)
-                   IF ( ALLOCATED( surf_lsm_h%qrs ) )  surf_h(0)%qrs(mm(0)) = surf_lsm_h%qrs(m)
-                   IF ( ALLOCATED( surf_lsm_h%nrs ) )  surf_h(0)%nrs(mm(0)) = surf_lsm_h%nrs(m)
-                   IF ( ALLOCATED( surf_lsm_h%ol ) )  surf_h(0)%ol(mm(0)) = surf_lsm_h%ol(m)
-                   IF ( ALLOCATED( surf_lsm_h%rib ) )  surf_h(0)%rib(mm(0)) = surf_lsm_h%rib(m)
-                   IF ( ALLOCATED( surf_lsm_h%pt_surface ) )                                       &
-                      surf_h(l)%pt_surface(mm(l)) = surf_lsm_h%pt_surface(m)
-                   IF ( ALLOCATED( surf_def_h(l)%q_surface ) )                                     &
-                      surf_h(l)%q_surface(mm(l)) = surf_lsm_h%q_surface(m)
-                   IF ( ALLOCATED( surf_def_h(l)%vpt_surface ) )                                   &
-                      surf_h(l)%vpt_surface(mm(l)) = surf_lsm_h%vpt_surface(m)
-                   IF ( ALLOCATED( surf_lsm_h%usws ) )  surf_h(0)%usws(mm(0)) = surf_lsm_h%usws(m)
-                   IF ( ALLOCATED( surf_lsm_h%vsws ) )  surf_h(0)%vsws(mm(0)) = surf_lsm_h%vsws(m)
-                   IF ( ALLOCATED( surf_lsm_h%shf ) )  surf_h(0)%shf(mm(0)) = surf_lsm_h%shf(m)
-                   IF ( ALLOCATED( surf_lsm_h%qsws ) )  surf_h(0)%qsws(mm(0)) = surf_lsm_h%qsws(m)
-                   IF ( ALLOCATED( surf_lsm_h%ssws ) )  surf_h(0)%ssws(mm(0)) = surf_lsm_h%ssws(m)
-                   IF ( ALLOCATED( surf_lsm_h%css ) )  THEN
+             IF ( l < 2 )  THEN
+                DO  m = surf_lsm_h(l)%start_index(j,i), surf_lsm_h(l)%end_index(j,i)
+                   IF ( ALLOCATED( surf_lsm_h(l)%us ) )  surf_h(0)%us(mm(0)) = surf_lsm_h(l)%us(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%ts ) )  surf_h(0)%ts(mm(0)) = surf_lsm_h(l)%ts(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%qs ) )  surf_h(0)%qs(mm(0)) = surf_lsm_h(l)%qs(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%ss ) )  surf_h(0)%ss(mm(0)) = surf_lsm_h(l)%ss(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%qcs ) )  surf_h(0)%qcs(mm(0)) = surf_lsm_h(l)%qcs(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%ncs ) )  surf_h(0)%ncs(mm(0)) = surf_lsm_h(l)%ncs(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%qis ) )  surf_h(0)%qis(mm(0)) = surf_lsm_h(l)%qis(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%nis ) )  surf_h(0)%nis(mm(0)) = surf_lsm_h(l)%nis(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%qrs ) )  surf_h(0)%qrs(mm(0)) = surf_lsm_h(l)%qrs(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%nrs ) )  surf_h(0)%nrs(mm(0)) = surf_lsm_h(l)%nrs(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%ol ) )  surf_h(0)%ol(mm(0)) = surf_lsm_h(l)%ol(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%rib ) )  surf_h(0)%rib(mm(0)) = surf_lsm_h(l)%rib(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%pt_surface ) )                                       &
+                      surf_h(l)%pt_surface(mm(l)) = surf_lsm_h(l)%pt_surface(m)
+                   IF ( ALLOCATED( surf_def_h(l)%q_surface ) )                                        &
+                      surf_h(l)%q_surface(mm(l)) = surf_lsm_h(l)%q_surface(m)
+                   IF ( ALLOCATED( surf_def_h(l)%vpt_surface ) )                                      &
+                      surf_h(l)%vpt_surface(mm(l)) = surf_lsm_h(l)%vpt_surface(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%usws ) )  surf_h(0)%usws(mm(0)) = surf_lsm_h(l)%usws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%vsws ) )  surf_h(0)%vsws(mm(0)) = surf_lsm_h(l)%vsws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%shf ) )  surf_h(0)%shf(mm(0)) = surf_lsm_h(l)%shf(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%qsws ) )  surf_h(0)%qsws(mm(0)) = surf_lsm_h(l)%qsws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%ssws ) )  surf_h(0)%ssws(mm(0)) = surf_lsm_h(l)%ssws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%css ) )  THEN
                       DO  lsp = 1, nvar
-                         surf_h(0)%css(lsp,mm(0)) = surf_lsm_h%css(lsp,m)
+                         surf_h(0)%css(lsp,mm(0)) = surf_lsm_h(l)%css(lsp,m)
                       ENDDO
                    ENDIF
-                   IF ( ALLOCATED( surf_lsm_h%cssws ) )  THEN
+                   IF ( ALLOCATED( surf_lsm_h(l)%cssws ) )  THEN
                       DO  lsp = 1, nvar
-                         surf_h(0)%cssws(lsp,mm(0)) = surf_lsm_h%cssws(lsp,m)
+                         surf_h(0)%cssws(lsp,mm(0)) = surf_lsm_h(l)%cssws(lsp,m)
                       ENDDO
                    ENDIF
-                   IF ( ALLOCATED( surf_lsm_h%qcsws ) )                                            &
-                      surf_h(0)%qcsws(mm(0)) = surf_lsm_h%qcsws(m)
-                   IF ( ALLOCATED( surf_lsm_h%qisws ) )                                            &
-                      surf_h(0)%qisws(mm(0)) = surf_lsm_h%qisws(m)
-                   IF ( ALLOCATED( surf_lsm_h%qrsws ) )                                            &
-                      surf_h(0)%qrsws(mm(0)) = surf_lsm_h%qrsws(m)
-                   IF ( ALLOCATED( surf_lsm_h%ncsws ) )                                            &
-                      surf_h(0)%ncsws(mm(0)) = surf_lsm_h%ncsws(m)
-                   IF ( ALLOCATED( surf_lsm_h%nisws ) )                                            &
-                      surf_h(0)%nisws(mm(0)) = surf_lsm_h%nisws(m)
-                   IF ( ALLOCATED( surf_lsm_h%nrsws ) )                                            &
-                      surf_h(0)%nrsws(mm(0)) = surf_lsm_h%nrsws(m)
-                   IF ( ALLOCATED( surf_lsm_h%sasws ) )                                            &
-                     surf_h(0)%sasws(mm(0)) = surf_lsm_h%sasws(m)
-
-                   mm(0) = mm(0) + 1
+                   IF ( ALLOCATED( surf_lsm_h(l)%qcsws ) )                                            &
+                      surf_h(0)%qcsws(mm(0)) = surf_lsm_h(l)%qcsws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%qisws ) )                                            &
+                      surf_h(0)%qisws(mm(0)) = surf_lsm_h(l)%qisws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%qrsws ) )                                            &
+                      surf_h(0)%qrsws(mm(0)) = surf_lsm_h(l)%qrsws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%ncsws ) )                                            &
+                      surf_h(0)%ncsws(mm(0)) = surf_lsm_h(l)%ncsws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%nisws ) )                                            &
+                      surf_h(0)%nisws(mm(0)) = surf_lsm_h(l)%nisws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%nrsws ) )                                            &
+                      surf_h(0)%nrsws(mm(0)) = surf_lsm_h(l)%nrsws(m)
+                   IF ( ALLOCATED( surf_lsm_h(l)%sasws ) )                                            &
+                     surf_h(0)%sasws(mm(0)) = surf_lsm_h(l)%sasws(m)
+
+                   mm(l) = mm(l) + 1
 
                 ENDDO
 
-                DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                   IF ( ALLOCATED( surf_usm_h%us ) )                                               &
-                      surf_h(0)%us(mm(0)) = surf_usm_h%us(m)
-                   IF ( ALLOCATED( surf_usm_h%ts ) )                                               &
-                      surf_h(0)%ts(mm(0)) = surf_usm_h%ts(m)
-                   IF ( ALLOCATED( surf_usm_h%qs ) )                                               &
-                      surf_h(0)%qs(mm(0)) = surf_usm_h%qs(m)
-                   IF ( ALLOCATED( surf_usm_h%ss ) )                                               &
-                      surf_h(0)%ss(mm(0)) = surf_usm_h%ss(m)
-                   IF ( ALLOCATED( surf_usm_h%qcs ) )                                              &
-                      surf_h(0)%qcs(mm(0)) = surf_usm_h%qcs(m)
-                   IF ( ALLOCATED( surf_usm_h%ncs ) )                                              &
-                      surf_h(0)%ncs(mm(0)) = surf_usm_h%ncs(m)
-                   IF ( ALLOCATED( surf_usm_h%qis ) )                                              &
-                      surf_h(0)%qis(mm(0)) = surf_usm_h%qis(m)
-                   IF ( ALLOCATED( surf_usm_h%nis ) )                                              &
-                      surf_h(0)%nis(mm(0)) = surf_usm_h%nis(m)
-                   IF ( ALLOCATED( surf_usm_h%qrs ) )                                              &
-                      surf_h(0)%qrs(mm(0)) = surf_usm_h%qrs(m)
-                   IF ( ALLOCATED( surf_usm_h%nrs ) )                                              &
-                      surf_h(0)%nrs(mm(0)) = surf_usm_h%nrs(m)
-                   IF ( ALLOCATED( surf_usm_h%ol ) )                                               &
-                      surf_h(0)%ol(mm(0)) = surf_usm_h%ol(m)
-                   IF ( ALLOCATED( surf_usm_h%rib ) )                                              &
-                      surf_h(0)%rib(mm(0)) = surf_usm_h%rib(m)
-                   IF ( ALLOCATED( surf_usm_h%pt_surface ) )                                       &
-                      surf_h(l)%pt_surface(mm(l)) = surf_usm_h%pt_surface(m)
-                    IF ( ALLOCATED( surf_usm_h%q_surface ) )                                       &
-                      surf_h(l)%q_surface(mm(l)) = surf_usm_h%q_surface(m)
-                   IF ( ALLOCATED( surf_usm_h%vpt_surface ) )                                      &
-                      surf_h(l)%vpt_surface(mm(l)) = surf_usm_h%vpt_surface(m)
-                   IF ( ALLOCATED( surf_usm_h%usws ) )                                             &
-                      surf_h(0)%usws(mm(0)) = surf_usm_h%usws(m)
-                   IF ( ALLOCATED( surf_usm_h%vsws ) )                                             &
-                      surf_h(0)%vsws(mm(0)) = surf_usm_h%vsws(m)
-                   IF ( ALLOCATED( surf_usm_h%shf ) )                                              &
-                      surf_h(0)%shf(mm(0)) = surf_usm_h%shf(m)
-                   IF ( ALLOCATED( surf_usm_h%qsws ) )                                             &
-                      surf_h(0)%qsws(mm(0)) = surf_usm_h%qsws(m)
-                   IF ( ALLOCATED( surf_usm_h%ssws ) )                                             &
-                      surf_h(0)%ssws(mm(0)) = surf_usm_h%ssws(m)
-                   IF ( ALLOCATED( surf_usm_h%css ) )  THEN
+                DO  m = surf_usm_h(l)%start_index(j,i), surf_usm_h(l)%end_index(j,i)
+                   IF ( ALLOCATED( surf_usm_h(l)%us ) )                                               &
+                      surf_h(0)%us(mm(0)) = surf_usm_h(l)%us(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%ts ) )                                               &
+                      surf_h(0)%ts(mm(0)) = surf_usm_h(l)%ts(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%qs ) )                                               &
+                      surf_h(0)%qs(mm(0)) = surf_usm_h(l)%qs(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%ss ) )                                               &
+                      surf_h(0)%ss(mm(0)) = surf_usm_h(l)%ss(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%qcs ) )                                              &
+                      surf_h(0)%qcs(mm(0)) = surf_usm_h(l)%qcs(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%ncs ) )                                              &
+                      surf_h(0)%ncs(mm(0)) = surf_usm_h(l)%ncs(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%qis ) )                                              &
+                      surf_h(0)%qis(mm(0)) = surf_usm_h(l)%qis(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%nis ) )                                              &
+                      surf_h(0)%nis(mm(0)) = surf_usm_h(l)%nis(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%qrs ) )                                              &
+                      surf_h(0)%qrs(mm(0)) = surf_usm_h(l)%qrs(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%nrs ) )                                              &
+                      surf_h(0)%nrs(mm(0)) = surf_usm_h(l)%nrs(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%ol ) )                                               &
+                      surf_h(0)%ol(mm(0)) = surf_usm_h(l)%ol(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%rib ) )                                              &
+                      surf_h(0)%rib(mm(0)) = surf_usm_h(l)%rib(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%pt_surface ) )                                       &
+                      surf_h(l)%pt_surface(mm(l)) = surf_usm_h(l)%pt_surface(m)
+                    IF ( ALLOCATED( surf_usm_h(l)%q_surface ) )                                       &
+                      surf_h(l)%q_surface(mm(l)) = surf_usm_h(l)%q_surface(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%vpt_surface ) )                                      &
+                      surf_h(l)%vpt_surface(mm(l)) = surf_usm_h(l)%vpt_surface(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%usws ) )                                             &
+                      surf_h(0)%usws(mm(0)) = surf_usm_h(l)%usws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%vsws ) )                                             &
+                      surf_h(0)%vsws(mm(0)) = surf_usm_h(l)%vsws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%shf ) )                                              &
+                      surf_h(0)%shf(mm(0)) = surf_usm_h(l)%shf(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%qsws ) )                                             &
+                      surf_h(0)%qsws(mm(0)) = surf_usm_h(l)%qsws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%ssws ) )                                             &
+                      surf_h(0)%ssws(mm(0)) = surf_usm_h(l)%ssws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%css ) )  THEN
                       DO lsp = 1, nvar
-                         surf_h(0)%css(lsp,mm(0)) = surf_usm_h%css(lsp,m)
+                         surf_h(0)%css(lsp,mm(0)) = surf_usm_h(l)%css(lsp,m)
                       ENDDO
                    ENDIF
-                   IF ( ALLOCATED( surf_usm_h%cssws ) )  THEN
+                   IF ( ALLOCATED( surf_usm_h(l)%cssws ) )  THEN
                       DO lsp = 1, nvar
-                         surf_h(0)%cssws(lsp,mm(0)) = surf_usm_h%cssws(lsp,m)
+                         surf_h(0)%cssws(lsp,mm(0)) = surf_usm_h(l)%cssws(lsp,m)
                       ENDDO
                    ENDIF
-                   IF ( ALLOCATED( surf_usm_h%qcsws ) )                                            &
-                      surf_h(0)%qcsws(mm(0)) = surf_usm_h%qcsws(m)
-                   IF ( ALLOCATED( surf_usm_h%qisws ) )                                            &
-                      surf_h(0)%qisws(mm(0)) = surf_usm_h%qisws(m)
-                   IF ( ALLOCATED( surf_usm_h%qrsws ) )                                            &
-                      surf_h(0)%qrsws(mm(0)) = surf_usm_h%qrsws(m)
-                   IF ( ALLOCATED( surf_usm_h%ncsws ) )                                            &
-                      surf_h(0)%ncsws(mm(0))   = surf_usm_h%ncsws(m)
-                   IF ( ALLOCATED( surf_usm_h%nrsws ) )                                            &
-                      surf_h(0)%nrsws(mm(0)) = surf_usm_h%nrsws(m)
-                   IF ( ALLOCATED( surf_usm_h%nisws ) )                                            &
-                      surf_h(0)%nisws(mm(0)) = surf_usm_h%nisws(m)
-                   IF ( ALLOCATED( surf_usm_h%sasws ) )                                            &
-                     surf_h(0)%sasws(mm(0)) = surf_usm_h%sasws(m)
-
-                   mm(0) = mm(0) + 1
+                   IF ( ALLOCATED( surf_usm_h(l)%qcsws ) )                                            &
+                      surf_h(0)%qcsws(mm(0)) = surf_usm_h(l)%qcsws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%qisws ) )                                            &
+                      surf_h(0)%qisws(mm(0)) = surf_usm_h(l)%qisws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%qrsws ) )                                            &
+                      surf_h(0)%qrsws(mm(0)) = surf_usm_h(l)%qrsws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%ncsws ) )                                            &
+                      surf_h(0)%ncsws(mm(0))   = surf_usm_h(l)%ncsws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%nrsws ) )                                            &
+                      surf_h(0)%nrsws(mm(0)) = surf_usm_h(l)%nrsws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%nisws ) )                                            &
+                      surf_h(0)%nisws(mm(0)) = surf_usm_h(l)%nisws(m)
+                   IF ( ALLOCATED( surf_usm_h(l)%sasws ) )                                            &
+                     surf_h(0)%sasws(mm(0)) = surf_usm_h(l)%sasws(m)
+
+                   mm(l) = mm(l) + 1
 
                 ENDDO
@@ -3280,9 +3315,9 @@
                 surf_h(l)%end_index(j,i) = surf_h(l)%end_index(j,i) + 1
              ENDDO
-             IF ( l == 0 )  THEN
-                DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
+             IF ( l < 2 )  THEN
+                DO  m = surf_lsm_h(l)%start_index(j,i), surf_lsm_h(l)%end_index(j,i)
                    surf_h(l)%end_index(j,i) = surf_h(l)%end_index(j,i) + 1
                 ENDDO
-                DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
+                DO  m = surf_usm_h(l)%start_index(j,i), surf_usm_h(l)%end_index(j,i)
                    surf_h(l)%end_index(j,i) = surf_h(l)%end_index(j,i) + 1
                 ENDDO
@@ -4977,8 +5012,11 @@
 !--          Determine type of surface element, i.e. default, natural, urban, at current grid point.
              surf_match_def  = surf_def_h(l)%end_index(jc,ic) >= surf_def_h(l)%start_index(jc,ic)
-             surf_match_lsm  = ( surf_lsm_h%end_index(jc,ic)  >= surf_lsm_h%start_index(jc,ic) )   &
-                                .AND.  l == 0
-             surf_match_usm  = ( surf_usm_h%end_index(jc,ic)  >= surf_usm_h%start_index(jc,ic) )   &
-                                 .AND.  l == 0
+             IF ( l < 2 ) THEN
+                surf_match_lsm  = surf_lsm_h(l)%end_index(jc,ic) >= surf_lsm_h(l)%start_index(jc,ic)
+                surf_match_usm  = surf_usm_h(l)%end_index(jc,ic) >= surf_usm_h(l)%start_index(jc,ic)
+             ELSE
+                surf_match_lsm  = .FALSE.
+                surf_match_usm  = .FALSE.
+             ENDIF
 !
 !--          Write restart data onto default-type surfaces if required.
@@ -5002,8 +5040,8 @@
 !--          surfaces at (j,i). An example would be bridges.
              IF ( surf_match_lsm )  THEN
-                mm = surf_lsm_h%start_index(jc,ic)
+                mm = surf_lsm_h(l)%start_index(jc,ic)
                 DO  m = surf_h(l)%start_index(j,i), surf_h(l)%end_index(j,i)
-                   IF ( surf_lsm_h%end_index(jc,ic) >= mm )                                        &
-                      CALL restore_surface_elements( surf_lsm_h, mm, surf_h(l), m )
+                   IF ( surf_lsm_h(l)%end_index(jc,ic) >= mm )                                        &
+                      CALL restore_surface_elements( surf_lsm_h(l), mm, surf_h(l), m )
                    mm = mm + 1
                 ENDDO
@@ -5012,8 +5050,8 @@
 !--          Same for urban-type surfaces
              IF ( surf_match_usm )  THEN
-                mm = surf_usm_h%start_index(jc,ic)
+                mm = surf_usm_h(l)%start_index(jc,ic)
                 DO  m = surf_h(l)%start_index(j,i), surf_h(l)%end_index(j,i)
-                   IF ( surf_usm_h%end_index(jc,ic) >= mm )                                        &
-                      CALL restore_surface_elements( surf_usm_h, mm, surf_h(l), m )
+                   IF ( surf_usm_h(l)%end_index(jc,ic) >= mm )                                        &
+                      CALL restore_surface_elements( surf_usm_h(l), mm, surf_h(l), m )
                    mm = mm + 1
                 ENDDO
@@ -5606,12 +5644,12 @@
     DO  i = nxl, nxr
        DO  j = nys, nyn
-          surf_match_lsm  = surf_lsm_h%end_index(j,i) >= surf_lsm_h%start_index(j,i)
-          surf_match_usm  = surf_usm_h%end_index(j,i) >= surf_usm_h%start_index(j,i)
+          surf_match_lsm  = surf_lsm_h(l)%end_index(j,i) >= surf_lsm_h(l)%start_index(j,i)
+          surf_match_usm  = surf_usm_h(l)%end_index(j,i) >= surf_usm_h(l)%start_index(j,i)
 
           IF ( surf_match_lsm )  THEN
-             mm = surf_lsm_h%start_index(j,i)
+             mm = surf_lsm_h(l)%start_index(j,i)
              DO  m = surf_h(0)%start_index(j,i), surf_h(0)%end_index(j,i)
-                IF ( surf_lsm_h%end_index(j,i) >= mm )                                             &
-                   CALL restore_surface_elements( surf_lsm_h, mm, surf_h(0), m )
+                IF ( surf_lsm_h(l)%end_index(j,i) >= mm )                                             &
+                   CALL restore_surface_elements( surf_lsm_h(l), mm, surf_h(0), m )
                 mm = mm + 1
              ENDDO
@@ -5619,8 +5657,8 @@
 
           IF ( surf_match_usm )  THEN
-             mm = surf_usm_h%start_index(j,i)
+             mm = surf_usm_h(l)%start_index(j,i)
              DO  m = surf_h(0)%start_index(j,i), surf_h(0)%end_index(j,i)
-                IF ( surf_usm_h%end_index(j,i) >= mm )                                             &
-                   CALL restore_surface_elements( surf_usm_h, mm, surf_h(0), m )
+                IF ( surf_usm_h(l)%end_index(j,i) >= mm )                                             &
+                   CALL restore_surface_elements( surf_usm_h(l), mm, surf_h(0), m )
                 mm = mm + 1
              ENDDO
@@ -5802,6 +5840,6 @@
 !
 !-- Horizontal surfaces
-    ns_h_on_file(0) = surf_def_h(0)%ns + surf_lsm_h%ns + surf_usm_h%ns
-    ns_h_on_file(1) = surf_def_h(1)%ns
+    ns_h_on_file(0) = surf_def_h(0)%ns + surf_lsm_h(0)%ns + surf_usm_h(0)%ns
+    ns_h_on_file(1) = surf_def_h(1)%ns + surf_lsm_h(1)%ns + surf_usm_h(1)%ns
     ns_h_on_file(2) = surf_def_h(2)%ns
 !
Index: palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
===================================================================
--- palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4647 2020-08-24 16:36:18Z suehring
 ! Change default value of synthetic turbulence adjustment as well as compute_velocity_seeds_local 
 ! By default, the random-seed computation is now distributed among several cores. Especially for 
@@ -2410,20 +2413,20 @@
        pt_surf_mean_l = pt_surf_mean_l  + pt(k,j,i)
     ENDDO
-    DO  m = 1, surf_lsm_h%ns
-       i = surf_lsm_h%i(m)
-       j = surf_lsm_h%j(m)
-       k = surf_lsm_h%k(m)
-       friction_vel_l = friction_vel_l  + surf_lsm_h%us(m)
-       shf_mean_l     = shf_mean_l      + surf_lsm_h%shf(m) * drho_air(k)
-       scale_l_l      = scale_l_l       + surf_lsm_h%ol(m)
+    DO  m = 1, surf_lsm_h(0)%ns
+       i = surf_lsm_h(0)%i(m)
+       j = surf_lsm_h(0)%j(m)
+       k = surf_lsm_h(0)%k(m)
+       friction_vel_l = friction_vel_l  + surf_lsm_h(0)%us(m)
+       shf_mean_l     = shf_mean_l      + surf_lsm_h(0)%shf(m) * drho_air(k)
+       scale_l_l      = scale_l_l       + surf_lsm_h(0)%ol(m)
        pt_surf_mean_l = pt_surf_mean_l  + pt(k,j,i)
     ENDDO
-    DO  m = 1, surf_usm_h%ns
-       i = surf_usm_h%i(m)
-       j = surf_usm_h%j(m)
-       k = surf_usm_h%k(m)
-       friction_vel_l = friction_vel_l  + surf_usm_h%us(m)
-       shf_mean_l     = shf_mean_l      + surf_usm_h%shf(m) * drho_air(k)
-       scale_l_l      = scale_l_l       + surf_usm_h%ol(m)
+    DO  m = 1, surf_usm_h(0)%ns
+       i = surf_usm_h(0)%i(m)
+       j = surf_usm_h(0)%j(m)
+       k = surf_usm_h(0)%k(m)
+       friction_vel_l = friction_vel_l  + surf_usm_h(0)%us(m)
+       shf_mean_l     = shf_mean_l      + surf_usm_h(0)%shf(m) * drho_air(k)
+       scale_l_l      = scale_l_l       + surf_usm_h(0)%ol(m)
        pt_surf_mean_l = pt_surf_mean_l  + pt(k,j,i)
     ENDDO
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 4670)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4669 2020-09-09 13:43:47Z pavelkrc
 ! - Fix missing call of radiation after spinup
 ! - Fix calculation of force_radiation_call
@@ -339,5 +342,5 @@
 
     USE land_surface_model_mod,                                                                    &
-        ONLY:  lsm_boundary_condition, lsm_energy_balance, lsm_soil_model, skip_time_do_lsm
+        ONLY:  lsm_boundary_condition, lsm_energy_balance, skip_time_do_lsm
 
     USE lagrangian_particle_model_mod,                                                             &
@@ -423,6 +426,6 @@
 
     USE urban_surface_mod,                                                                         &
-        ONLY:  usm_boundary_condition, usm_material_heat_model, usm_material_model,                &
-               usm_surface_energy_balance, usm_green_heat_model
+        ONLY:  usm_boundary_condition,                                                             &
+               usm_energy_balance
 
     USE virtual_measurement_mod,                                                                   &
@@ -1108,24 +1111,5 @@
 
                 CALL cpu_log( log_point(54), 'land_surface', 'start' )
-!
-!--             Call for horizontal upward-facing surfaces
-                CALL lsm_energy_balance( .TRUE., -1 )
-                CALL lsm_soil_model( .TRUE., -1, .TRUE. )
-!
-!--             Call for northward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 0 )
-                CALL lsm_soil_model( .FALSE., 0, .TRUE. )
-!
-!--             Call for southward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 1 )
-                CALL lsm_soil_model( .FALSE., 1, .TRUE. )
-!
-!--             Call for eastward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 2 )
-                CALL lsm_soil_model( .FALSE., 2, .TRUE. )
-!
-!--             Call for westward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 3 )
-                CALL lsm_soil_model( .FALSE., 3, .TRUE. )
+                CALL lsm_energy_balance( .FALSE. )
 
 !
@@ -1143,10 +1127,5 @@
              IF (urban_surface) THEN
                 CALL cpu_log( log_point(74), 'urban_surface', 'start' )
-
-                CALL usm_surface_energy_balance( .FALSE. )
-                IF ( usm_material_model )  THEN
-                   CALL usm_green_heat_model
-                   CALL usm_material_heat_model ( .FALSE. )
-                ENDIF
+                CALL usm_energy_balance( .FALSE. )
 
 !
@@ -1655,12 +1634,12 @@
              CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
           ENDIF
-          IF ( surf_lsm_h%ns    >= 1 )  THEN
+          IF ( surf_lsm_h(0)%ns >= 1 )  THEN
              CALL cpu_log( log_point(23), 'disturb_heatflux', 'start' )
-             CALL disturb_heatflux( surf_lsm_h    )
+             CALL disturb_heatflux( surf_lsm_h(0) )
              CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
           ENDIF
-          IF ( surf_usm_h%ns    >= 1 )  THEN
+          IF ( surf_usm_h(0)%ns >= 1 )  THEN
              CALL cpu_log( log_point(23), 'disturb_heatflux', 'start' )
-             CALL disturb_heatflux( surf_usm_h    )
+             CALL disturb_heatflux( surf_usm_h(0) )
              CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
           ENDIF
Index: palm/trunk/SOURCE/time_integration_spinup.f90
===================================================================
--- palm/trunk/SOURCE/time_integration_spinup.f90	(revision 4670)
+++ palm/trunk/SOURCE/time_integration_spinup.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4669 2020-09-09 13:43:47Z pavelkrc
 ! - Fix missing call of radiation after spinup
 ! - Fix calculation of force_radiation_call
@@ -101,5 +104,4 @@
     USE control_parameters,                                                                        &
         ONLY:  averaging_interval_pr,                                                              &
-               calc_soil_moisture_during_spinup,                                                   &
                constant_diffusion,                                                                 &
                constant_flux_layer,                                                                &
@@ -161,5 +163,4 @@
     USE land_surface_model_mod,                                                                    &
         ONLY:  lsm_energy_balance,                                                                 &
-               lsm_soil_model,                                                                     &
                lsm_swap_timelevel
 
@@ -204,9 +205,6 @@
 
     USE urban_surface_mod,                                                                         &
-        ONLY:  usm_material_heat_model,                                                            &
-               usm_material_model,                                                                 &
-               usm_surface_energy_balance,                                                         &
-               usm_swap_timelevel,                                                                 &
-               usm_green_heat_model
+        ONLY:  usm_energy_balance,                                                                 &
+               usm_swap_timelevel
 
 
@@ -261,10 +259,12 @@
 !-- unknown. A minimum velocity of 0.1 m/s is used to maintain turbulent transfer at the surface.
     IF ( land_surface )  THEN
-       DO  m = 1, surf_lsm_h%ns
-          i   = surf_lsm_h%i(m)
-          j   = surf_lsm_h%j(m)
-          k   = surf_lsm_h%k(m)
-          u(k,j,i) = SIGN( 1.0_wp, u_init(k) ) * MAX( ABS( u_init(k) ), 0.1_wp)
-          v(k,j,i) = SIGN( 1.0_wp, v_init(k) ) * MAX( ABS( v_init(k) ), 0.1_wp)
+       DO  l = 0, 1
+          DO  m = 1, surf_lsm_h(l)%ns
+             i   = surf_lsm_h(l)%i(m)
+             j   = surf_lsm_h(l)%j(m)
+             k   = surf_lsm_h(l)%k(m)
+             u(k,j,i) = SIGN( 1.0_wp, u_init(k) ) * MAX( ABS( u_init(k) ), 0.1_wp)
+             v(k,j,i) = SIGN( 1.0_wp, v_init(k) ) * MAX( ABS( v_init(k) ), 0.1_wp)
+          ENDDO
        ENDDO
 
@@ -281,10 +281,12 @@
 
     IF ( urban_surface )  THEN
-       DO  m = 1, surf_usm_h%ns
-          i   = surf_usm_h%i(m)
-          j   = surf_usm_h%j(m)
-          k   = surf_usm_h%k(m)
-          u(k,j,i) = SIGN( 1.0_wp, u_init(k) ) * MAX( ABS( u_init(k) ), 0.1_wp)
-          v(k,j,i) = SIGN( 1.0_wp, v_init(k) ) * MAX( ABS( v_init(k) ), 0.1_wp)
+       DO  l = 0, 1
+          DO  m = 1, surf_usm_h(l)%ns
+             i   = surf_usm_h(l)%i(m)
+             j   = surf_usm_h(l)%j(m)
+             k   = surf_usm_h(l)%k(m)
+             u(k,j,i) = SIGN( 1.0_wp, u_init(k) ) * MAX( ABS( u_init(k) ), 0.1_wp)
+             v(k,j,i) = SIGN( 1.0_wp, v_init(k) ) * MAX( ABS( v_init(k) ), 0.1_wp)
+          ENDDO
        ENDDO
 
@@ -343,9 +345,11 @@
 !--       Map air temperature to all grid points in the vicinity of a surface element
           IF ( land_surface )  THEN
-             DO  m = 1, surf_lsm_h%ns
-                i   = surf_lsm_h%i(m)
-                j   = surf_lsm_h%j(m)
-                k   = surf_lsm_h%k(m)
-                pt(k,j,i) = pt_spinup
+             DO  l = 0, 1
+                DO  m = 1, surf_lsm_h(l)%ns
+                   i   = surf_lsm_h(l)%i(m)
+                   j   = surf_lsm_h(l)%j(m)
+                   k   = surf_lsm_h(l)%k(m)
+                   pt(k,j,i) = pt_spinup
+                ENDDO
              ENDDO
 
@@ -361,12 +365,14 @@
 
           IF ( urban_surface )  THEN
-             DO  m = 1, surf_usm_h%ns
-                i   = surf_usm_h%i(m)
-                j   = surf_usm_h%j(m)
-                k   = surf_usm_h%k(m)
-                pt(k,j,i) = pt_spinup
-                !!!!!!!!!!!!!!!!HACK!!!!!!!!!!!!!
-                surf_usm_h%pt1(m) = pt_spinup
-                !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+             DO  l = 0, 1
+                DO  m = 1, surf_usm_h(l)%ns
+                   i   = surf_usm_h(l)%i(m)
+                   j   = surf_usm_h(l)%j(m)
+                   k   = surf_usm_h(l)%k(m)
+                   pt(k,j,i) = pt_spinup
+                   !!!!!!!!!!!!!!!!HACK!!!!!!!!!!!!!
+                   surf_usm_h(l)%pt1(m) = pt_spinup
+                   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                ENDDO
              ENDDO
 
@@ -430,24 +436,5 @@
              IF ( land_surface )  THEN
 
-!
-!--             Call for horizontal upward-facing surfaces
-                CALL lsm_energy_balance( .TRUE., -1 )
-                CALL lsm_soil_model( .TRUE., -1, calc_soil_moisture_during_spinup )
-!
-!--             Call for northward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 0 )
-                CALL lsm_soil_model( .FALSE., 0, calc_soil_moisture_during_spinup )
-!
-!--             Call for southward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 1 )
-                CALL lsm_soil_model( .FALSE., 1, calc_soil_moisture_during_spinup )
-!
-!--             Call for eastward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 2 )
-                CALL lsm_soil_model( .FALSE., 2, calc_soil_moisture_during_spinup )
-!
-!--             Call for westward-facing surfaces
-                CALL lsm_energy_balance( .FALSE., 3 )
-                CALL lsm_soil_model( .FALSE., 3, calc_soil_moisture_during_spinup )
+                CALL lsm_energy_balance( .TRUE. )
 
              ENDIF
@@ -457,9 +444,5 @@
              IF (urban_surface) THEN
 
-                CALL usm_surface_energy_balance( .TRUE. )
-                IF ( usm_material_model )  THEN
-                   CALL usm_green_heat_model
-                   CALL usm_material_heat_model( .TRUE. )
-                ENDIF
+                CALL usm_energy_balance( .TRUE. )
 
              ENDIF
Index: palm/trunk/SOURCE/turbulence_closure_mod.f90
===================================================================
--- palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4625 2020-07-24 12:13:16Z oliver.maas
 ! for turbulence_closure = '1.5-order-dai': copy value of distance_to_wall to
 ! ghostpoints at dirichlet/radiation boundaries
@@ -268,5 +271,6 @@
                surf_lsm_v,                                                                         &
                surf_usm_h,                                                                         &
-               surf_usm_v
+               surf_usm_v,                                                                         &
+               surf_type
 
     IMPLICIT NONE
@@ -475,17 +479,17 @@
 !
 !--       Natural surfaces
-          DO  m = 1, surf_lsm_h%ns
-             i = surf_lsm_h%i(m)
-             j = surf_lsm_h%j(m)
-             k = surf_lsm_h%k(m)
-             e_p(k,j,i) = ( surf_lsm_h%us(m) / c_0 )**2
+          DO  m = 1, surf_lsm_h(0)%ns
+             i = surf_lsm_h(0)%i(m)
+             j = surf_lsm_h(0)%j(m)
+             k = surf_lsm_h(0)%k(m)
+             e_p(k,j,i) = ( surf_lsm_h(0)%us(m) / c_0 )**2
           ENDDO
 !
 !--       Urban surfaces
-          DO  m = 1, surf_usm_h%ns
-             i = surf_usm_h%i(m)
-             j = surf_usm_h%j(m)
-             k = surf_usm_h%k(m)
-             e_p(k,j,i) = ( surf_usm_h%us(m) / c_0 )**2
+          DO  m = 1, surf_usm_h(0)%ns
+             i = surf_usm_h(0)%i(m)
+             j = surf_usm_h(0)%j(m)
+             k = surf_usm_h(0)%k(m)
+             e_p(k,j,i) = ( surf_usm_h(0)%us(m) / c_0 )**2
           ENDDO
 !
@@ -579,17 +583,17 @@
 !
 !--    Natural surfaces
-       DO  m = 1, surf_lsm_h%ns
-          i = surf_lsm_h%i(m)
-          j = surf_lsm_h%j(m)
-          k = surf_lsm_h%k(m)
-          diss_p(k,j,i) = surf_lsm_h%us(m)**3 / ( kappa * surf_lsm_h%z_mo(m) )
+       DO  m = 1, surf_lsm_h(0)%ns
+          i = surf_lsm_h(0)%i(m)
+          j = surf_lsm_h(0)%j(m)
+          k = surf_lsm_h(0)%k(m)
+          diss_p(k,j,i) = surf_lsm_h(0)%us(m)**3 / ( kappa * surf_lsm_h(0)%z_mo(m) )
        ENDDO
 !
 !--    Urban surfaces
-       DO  m = 1, surf_usm_h%ns
-          i = surf_usm_h%i(m)
-          j = surf_usm_h%j(m)
-          k = surf_usm_h%k(m)
-          diss_p(k,j,i) = surf_usm_h%us(m)**3 / ( kappa * surf_usm_h%z_mo(m) )
+       DO  m = 1, surf_usm_h(0)%ns
+          i = surf_usm_h(0)%i(m)
+          j = surf_usm_h(0)%j(m)
+          k = surf_usm_h(0)%k(m)
+          diss_p(k,j,i) = surf_usm_h(0)%us(m)**3 / ( kappa * surf_usm_h(0)%z_mo(m) )
        ENDDO
 !
@@ -2150,30 +2154,56 @@
        ENDDO
 !
-!--    Natural surfaces, upward-facing
+!--    Natural surfaces, upward- and downward facing
        !$OMP PARALLEL DO PRIVATE(i,j,k,m)
        !$ACC PARALLEL LOOP PRIVATE(i, j, k, m, km_sfc) &
-       !$ACC PRESENT(surf_lsm_h, u, v, drho_air_zw, zu)
-       DO  m = 1, surf_lsm_h%ns
-
-          i = surf_lsm_h%i(m)
-          j = surf_lsm_h%j(m)
-          k = surf_lsm_h%k(m)
+       !$ACC PRESENT(surf_lsm_h(0), u, v, drho_air_zw, zu)
+       DO  m = 1, surf_lsm_h(0)%ns
+
+          i = surf_lsm_h(0)%i(m)
+          j = surf_lsm_h(0)%j(m)
+          k = surf_lsm_h(0)%k(m)
 !
 !--       Note, calculation of u_0 and v_0 is not fully accurate, as u/v and km are not on the same
 !--       grid. Actually, a further interpolation of km onto the u/v-grid is necessary. However, the
 !--       effect of this error is negligible.
-          km_sfc = kappa * surf_lsm_h%us(m) * surf_lsm_h%z_mo(m) /                                 &
-                   phi_m( surf_lsm_h%z_mo(m) / surf_lsm_h%ol(m) )
-
-          surf_lsm_h%u_0(m) = u(k+1,j,i) + surf_lsm_h%usws(m) * drho_air_zw(k-1) *                 &
+          km_sfc = kappa * surf_lsm_h(0)%us(m) * surf_lsm_h(0)%z_mo(m) /                                 &
+                   phi_m( surf_lsm_h(0)%z_mo(m) / surf_lsm_h(0)%ol(m) )
+
+          surf_lsm_h(0)%u_0(m) = u(k+1,j,i) + surf_lsm_h(0)%usws(m) * drho_air_zw(k-1) *                 &
                               ( zu(k+1) - zu(k-1) ) / ( km_sfc  + 1.0E-20_wp )
-          surf_lsm_h%v_0(m) = v(k+1,j,i) + surf_lsm_h%vsws(m) * drho_air_zw(k-1) *                 &
+          surf_lsm_h(0)%v_0(m) = v(k+1,j,i) + surf_lsm_h(0)%vsws(m) * drho_air_zw(k-1) *                 &
                                         ( zu(k+1) - zu(k-1)) / ( km_sfc  + 1.0E-20_wp )
 
-          IF ( ABS( u(k+1,j,i) - surf_lsm_h%u_0(m) ) > ABS( u(k+1,j,i) - u(k-1,j,i) ) )            &
-             surf_lsm_h%u_0(m) = u(k-1,j,i)
-
-          IF ( ABS( v(k+1,j,i) - surf_lsm_h%v_0(m) ) > ABS( v(k+1,j,i) - v(k-1,j,i) ) )            &
-             surf_lsm_h%v_0(m) = v(k-1,j,i)
+          IF ( ABS( u(k+1,j,i) - surf_lsm_h(0)%u_0(m) ) > ABS( u(k+1,j,i) - u(k-1,j,i) ) )            &
+             surf_lsm_h(0)%u_0(m) = u(k-1,j,i)
+
+          IF ( ABS( v(k+1,j,i) - surf_lsm_h(0)%v_0(m) ) > ABS( v(k+1,j,i) - v(k-1,j,i) ) )            &
+             surf_lsm_h(0)%v_0(m) = v(k-1,j,i)
+
+       ENDDO
+!
+!--    Natural surfaces, downward-facing surfaces
+       !$OMP PARALLEL DO PRIVATE(i,j,k,m)
+       !$ACC PARALLEL LOOP PRIVATE(i, j, k, m, km_sfc) &
+       !$ACC PRESENT(surf_lsm_h(1), u, v, drho_air_zw, zu, km)
+       DO  m = 1, surf_lsm_h(1)%ns
+
+          i = surf_lsm_h(1)%i(m)
+          j = surf_lsm_h(1)%j(m)
+          k = surf_lsm_h(1)%k(m)
+!
+!--       Note, calculation of u_0 and v_0 is not fully accurate, as u/v and km are not on the same
+!--       grid. Actually, a further interpolation of km onto the u/v-grid is necessary. However, the
+!--       effect of this error is negligible.
+          surf_lsm_h(1)%u_0(m) = u(k-1,j,i) - surf_lsm_h(1)%usws(m) * drho_air_zw(k-1) *           &
+                                     ( zu(k+1) - zu(k-1) ) / ( km(k,j,i) + 1.0E-20_wp )
+          surf_lsm_h(1)%v_0(m) = v(k-1,j,i) - surf_lsm_h(1)%vsws(m) * drho_air_zw(k-1) *           &
+                                     ( zu(k+1) - zu(k-1) ) / (km(k,j,i) + 1.0E-20_wp )
+
+          IF ( ABS( surf_lsm_h(1)%u_0(m) - u(k-1,j,i) ) > ABS( u(k+1,j,i) - u(k-1,j,i) ) )         &
+             surf_lsm_h(1)%u_0(m) = u(k+1,j,i)
+
+          IF ( ABS( surf_lsm_h(1)%v_0(m) - v(k-1,j,i) ) > ABS( v(k+1,j,i) - v(k-1,j,i) ) )         &
+             surf_lsm_h(1)%v_0(m) = v(k+1,j,i)
 
        ENDDO
@@ -2182,27 +2212,53 @@
        !$OMP PARALLEL DO PRIVATE(i,j,k,m)
        !$ACC PARALLEL LOOP PRIVATE(i, j, k, m, km_sfc) &
-       !$ACC PRESENT(surf_usm_h, u, v, drho_air_zw, zu)
-       DO  m = 1, surf_usm_h%ns
-
-          i = surf_usm_h%i(m)
-          j = surf_usm_h%j(m)
-          k = surf_usm_h%k(m)
+       !$ACC PRESENT(surf_usm_h(0), u, v, drho_air_zw, zu)
+       DO  m = 1, surf_usm_h(0)%ns
+
+          i = surf_usm_h(0)%i(m)
+          j = surf_usm_h(0)%j(m)
+          k = surf_usm_h(0)%k(m)
 !
 !--       Note, calculation of u_0 and v_0 is not fully accurate, as u/v and km are not on the same
 !--       grid. Actually, a further interpolation of km onto the u/v-grid is necessary. However, the
 !--       effect of this error is negligible.
-          km_sfc = kappa * surf_usm_h%us(m) * surf_usm_h%z_mo(m) /                                 &
-                   phi_m( surf_usm_h%z_mo(m) / surf_usm_h%ol(m) )
-
-          surf_usm_h%u_0(m) = u(k+1,j,i) + surf_usm_h%usws(m) * drho_air_zw(k-1) *                 &
+          km_sfc = kappa * surf_usm_h(0)%us(m) * surf_usm_h(0)%z_mo(m) /                                 &
+                   phi_m( surf_usm_h(0)%z_mo(m) / surf_usm_h(0)%ol(m) )
+
+          surf_usm_h(0)%u_0(m) = u(k+1,j,i) + surf_usm_h(0)%usws(m) * drho_air_zw(k-1) *                 &
                                         ( zu(k+1) - zu(k-1) ) / ( km_sfc  + 1.0E-20_wp )
-          surf_usm_h%v_0(m) = v(k+1,j,i) + surf_usm_h%vsws(m) * drho_air_zw(k-1) *                 &
+          surf_usm_h(0)%v_0(m) = v(k+1,j,i) + surf_usm_h(0)%vsws(m) * drho_air_zw(k-1) *                 &
                                         ( zu(k+1) - zu(k-1) ) / ( km_sfc  + 1.0E-20_wp )
 
-          IF ( ABS( u(k+1,j,i) - surf_usm_h%u_0(m) ) > ABS( u(k+1,j,i) - u(k-1,j,i) ) )            &
-             surf_usm_h%u_0(m) = u(k-1,j,i)
-
-          IF ( ABS( v(k+1,j,i) - surf_usm_h%v_0(m) ) > ABS( v(k+1,j,i) - v(k-1,j,i) ) )            &
-             surf_usm_h%v_0(m) = v(k-1,j,i)
+          IF ( ABS( u(k+1,j,i) - surf_usm_h(0)%u_0(m) ) > ABS( u(k+1,j,i) - u(k-1,j,i) ) )            &
+             surf_usm_h(0)%u_0(m) = u(k-1,j,i)
+
+          IF ( ABS( v(k+1,j,i) - surf_usm_h(0)%v_0(m) ) > ABS( v(k+1,j,i) - v(k-1,j,i) ) )            &
+             surf_usm_h(0)%v_0(m) = v(k-1,j,i)
+
+       ENDDO
+!
+!--    Urban surfaces, downward-facing surfaces
+       !$OMP PARALLEL DO PRIVATE(i,j,k,m)
+       !$ACC PARALLEL LOOP PRIVATE(i, j, k, m, km_sfc) &
+       !$ACC PRESENT(surf_usm_h(1), u, v, drho_air_zw, zu, km)
+       DO  m = 1, surf_usm_h(1)%ns
+
+          i = surf_usm_h(1)%i(m)
+          j = surf_usm_h(1)%j(m)
+          k = surf_usm_h(1)%k(m)
+!
+!--       Note, calculation of u_0 and v_0 is not fully accurate, as u/v and km are not on the same
+!--       grid. Actually, a further interpolation of km onto the u/v-grid is necessary. However, the
+!--       effect of this error is negligible.
+          surf_usm_h(1)%u_0(m) = u(k-1,j,i) - surf_usm_h(1)%usws(m) * drho_air_zw(k-1) *           &
+                                     ( zu(k+1) - zu(k-1) ) / ( km(k,j,i) + 1.0E-20_wp )
+          surf_usm_h(1)%v_0(m) = v(k-1,j,i) - surf_usm_h(1)%vsws(m) * drho_air_zw(k-1) *           &
+                                     ( zu(k+1) - zu(k-1) ) / (km(k,j,i) + 1.0E-20_wp )
+
+          IF ( ABS( surf_usm_h(1)%u_0(m) - u(k-1,j,i) ) > ABS( u(k+1,j,i) - u(k-1,j,i) ) )         &
+             surf_usm_h(1)%u_0(m) = u(k+1,j,i)
+
+          IF ( ABS( surf_usm_h(1)%v_0(m) - v(k-1,j,i) ) > ABS( v(k+1,j,i) - v(k-1,j,i) ) )         &
+             surf_usm_h(1)%v_0(m) = v(k+1,j,i)
 
        ENDDO
@@ -2963,28 +3019,28 @@
 !
 !--          Natural surfaces
-             surf_s = surf_lsm_h%start_index(j,i)
-             surf_e = surf_lsm_h%end_index(j,i)
+             surf_s = surf_lsm_h(0)%start_index(j,i)
+             surf_e = surf_lsm_h(0)%end_index(j,i)
              !$ACC LOOP PRIVATE(m, k)
              DO  m = surf_s, surf_e
-                k = surf_lsm_h%k(m)
-
-                dudz(k) = ( u(k+1,j,i) - surf_lsm_h%u_0(m) ) * dd2zu(k)
-                dvdz(k) = ( v(k+1,j,i) - surf_lsm_h%v_0(m) ) * dd2zu(k)
+                k = surf_lsm_h(0)%k(m)
+
+                dudz(k) = ( u(k+1,j,i) - surf_lsm_h(0)%u_0(m) ) * dd2zu(k)
+                dvdz(k) = ( v(k+1,j,i) - surf_lsm_h(0)%v_0(m) ) * dd2zu(k)
 
              ENDDO
 !
 !--          Urban surfaces
-             surf_s = surf_usm_h%start_index(j,i)
-             surf_e = surf_usm_h%end_index(j,i)
+             surf_s = surf_usm_h(0)%start_index(j,i)
+             surf_e = surf_usm_h(0)%end_index(j,i)
              !$ACC LOOP PRIVATE(m, k)
              DO  m = surf_s, surf_e
-                k = surf_usm_h%k(m)
-
-                dudz(k) = ( u(k+1,j,i) - surf_usm_h%u_0(m) ) * dd2zu(k)
-                dvdz(k) = ( v(k+1,j,i) - surf_usm_h%v_0(m) ) * dd2zu(k)
-
-             ENDDO
-!
-!--          Compute gradients at downward-facing walls, only for non-natural default surfaces
+                k = surf_usm_h(0)%k(m)
+
+                dudz(k) = ( u(k+1,j,i) - surf_usm_h(0)%u_0(m) ) * dd2zu(k)
+                dvdz(k) = ( v(k+1,j,i) - surf_usm_h(0)%v_0(m) ) * dd2zu(k)
+
+             ENDDO
+!
+!--          Compute gradients at downward-facing surfaces, default surfaces
              surf_s = surf_def_h(1)%start_index(j,i)
              surf_e = surf_def_h(1)%end_index(j,i)
@@ -2995,4 +3051,28 @@
                 dudz(k) = ( surf_def_h(1)%u_0(m) - u(k-1,j,i) ) * dd2zu(k)
                 dvdz(k) = ( surf_def_h(1)%v_0(m) - v(k-1,j,i) ) * dd2zu(k)
+
+             ENDDO
+!
+!--          Compute gradients at downward-facing surfaces, natural surfaces
+             surf_s = surf_lsm_h(1)%start_index(j,i)
+             surf_e = surf_lsm_h(1)%end_index(j,i)
+             !$ACC LOOP PRIVATE(m, k)
+             DO  m = surf_s, surf_e
+                k = surf_lsm_h(1)%k(m)
+
+                dudz(k) = ( surf_lsm_h(1)%u_0(m) - u(k-1,j,i) ) * dd2zu(k)
+                dvdz(k) = ( surf_lsm_h(1)%v_0(m) - v(k-1,j,i) ) * dd2zu(k)
+
+             ENDDO
+!
+!--          Compute gradients at downward-facing surfaces, urban surfaces
+             surf_s = surf_usm_h(1)%start_index(j,i)
+             surf_e = surf_usm_h(1)%end_index(j,i)
+             !$ACC LOOP PRIVATE(m, k)
+             DO  m = surf_s, surf_e
+                k = surf_usm_h(1)%k(m)
+
+                dudz(k) = ( surf_usm_h(1)%u_0(m) - u(k-1,j,i) ) * dd2zu(k)
+                dvdz(k) = ( surf_usm_h(1)%v_0(m) - v(k-1,j,i) ) * dd2zu(k)
 
              ENDDO
@@ -3125,22 +3205,22 @@
                             tmp_flux(k) = drho_air_zw(k-1) * surf_def_h(l)%shf(m)
                          ENDDO
-                      ENDDO
-!
-!--                   Natural surfaces
-                      surf_s = surf_lsm_h%start_index(j,i)
-                      surf_e = surf_lsm_h%end_index(j,i)
-                      !$ACC LOOP PRIVATE(m, k)
-                      DO  m = surf_s, surf_e
-                         k = surf_lsm_h%k(m)
-                         tmp_flux(k) = drho_air_zw(k-1) * surf_lsm_h%shf(m)
-                      ENDDO
-!
-!--                   Urban surfaces
-                      surf_s = surf_usm_h%start_index(j,i)
-                      surf_e = surf_usm_h%end_index(j,i)
-                      !$ACC LOOP PRIVATE(m, k)
-                      DO  m = surf_s, surf_e
-                         k = surf_usm_h%k(m)
-                         tmp_flux(k) = drho_air_zw(k-1) * surf_usm_h%shf(m)
+!
+!--                      Natural surfaces
+                         surf_s = surf_lsm_h(l)%start_index(j,i)
+                         surf_e = surf_lsm_h(l)%end_index(j,i)
+                         !$ACC LOOP PRIVATE(m, k)
+                         DO  m = surf_s, surf_e
+                            k = surf_lsm_h(l)%k(m)
+                            tmp_flux(k) = drho_air_zw(k-1) * surf_lsm_h(l)%shf(m)
+                         ENDDO
+!
+!--                      Urban surfaces
+                         surf_s = surf_usm_h(l)%start_index(j,i)
+                         surf_e = surf_usm_h(l)%end_index(j,i)
+                         !$ACC LOOP PRIVATE(m, k)
+                         DO  m = surf_s, surf_e
+                            k = surf_usm_h(l)%k(m)
+                            tmp_flux(k) = drho_air_zw(k-1) * surf_usm_h(l)%shf(m)
+                         ENDDO
                       ENDDO
                    ENDIF
@@ -3261,63 +3341,67 @@
 !
 !--                Treat horizontal natural surfaces
-                   surf_s = surf_lsm_h%start_index(j,i)
-                   surf_e = surf_lsm_h%end_index(j,i)
-                   DO  m = surf_s, surf_e
-                      k = surf_lsm_h%k(m)
-
-                      IF (  .NOT.  bulk_cloud_model  .AND.  .NOT.  cloud_droplets )  THEN
-                         k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-                         k2 = 0.61_wp * pt(k,j,i)
-                      ELSE IF ( bulk_cloud_model )  THEN
-                         IF ( ql(k,j,i) == 0.0_wp )  THEN
+                   DO  l = 0, 1
+                      surf_s = surf_lsm_h(l)%start_index(j,i)
+                      surf_e = surf_lsm_h(l)%end_index(j,i)
+                      DO  m = surf_s, surf_e
+                         k = surf_lsm_h(l)%k(m)
+
+                         IF (  .NOT.  bulk_cloud_model  .AND.  .NOT.  cloud_droplets )  THEN
                             k1 = 1.0_wp + 0.61_wp * q(k,j,i)
                             k2 = 0.61_wp * pt(k,j,i)
-                         ELSE
-                            theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
-                            temp  = theta * exner(k)
-                            k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *        &
-                                 ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                         &
-                                 ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                          &
-                                 ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
-                            k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                         ELSE IF ( bulk_cloud_model )  THEN
+                            IF ( ql(k,j,i) == 0.0_wp )  THEN
+                               k1 = 1.0_wp + 0.61_wp * q(k,j,i)
+                               k2 = 0.61_wp * pt(k,j,i)
+                            ELSE
+                               theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
+                               temp  = theta * exner(k)
+                               k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *        &
+                                    ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                         &
+                                    ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                          &
+                                    ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
+                               k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                            ENDIF
+                         ELSE IF ( cloud_droplets )  THEN
+                            k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
+                            k2 = 0.61_wp * pt(k,j,i)
                          ENDIF
-                      ELSE IF ( cloud_droplets )  THEN
-                         k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
-                         k2 = 0.61_wp * pt(k,j,i)
-                      ENDIF
-
-                      tmp_flux(k) = ( k1 * surf_lsm_h%shf(m) + k2 * surf_lsm_h%qsws(m) )           &
-                                    * drho_air_zw(k-1)
+
+                         tmp_flux(k) = ( k1 * surf_lsm_h(l)%shf(m) + k2 * surf_lsm_h(l)%qsws(m) )     &
+                                       * drho_air_zw(k-1)
+                      ENDDO
                    ENDDO
 !
 !--                Treat horizontal urban surfaces
-                   surf_s = surf_usm_h%start_index(j,i)
-                   surf_e = surf_usm_h%end_index(j,i)
-                   DO  m = surf_s, surf_e
-                      k = surf_usm_h%k(m)
-
-                      IF ( .NOT. bulk_cloud_model  .AND.  .NOT. cloud_droplets )  THEN
-                         k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-                         k2 = 0.61_wp * pt(k,j,i)
-                      ELSE IF ( bulk_cloud_model )  THEN
-                         IF ( ql(k,j,i) == 0.0_wp )  THEN
+                   DO  l = 0, 1
+                      surf_s = surf_usm_h(l)%start_index(j,i)
+                      surf_e = surf_usm_h(l)%end_index(j,i)
+                      DO  m = surf_s, surf_e
+                         k = surf_usm_h(l)%k(m)
+
+                         IF ( .NOT. bulk_cloud_model  .AND.  .NOT. cloud_droplets )  THEN
                             k1 = 1.0_wp + 0.61_wp * q(k,j,i)
                             k2 = 0.61_wp * pt(k,j,i)
-                         ELSE
-                            theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
-                            temp  = theta * exner(k)
-                            k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *        &
-                                 ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                         &
-                                 ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                          &
-                                 ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
-                            k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                         ELSE IF ( bulk_cloud_model )  THEN
+                            IF ( ql(k,j,i) == 0.0_wp )  THEN
+                               k1 = 1.0_wp + 0.61_wp * q(k,j,i)
+                               k2 = 0.61_wp * pt(k,j,i)
+                            ELSE
+                               theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
+                               temp  = theta * exner(k)
+                               k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *        &
+                                    ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                         &
+                                    ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                          &
+                                    ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
+                               k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                            ENDIF
+                         ELSE IF ( cloud_droplets )  THEN
+                            k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
+                            k2 = 0.61_wp * pt(k,j,i)
                          ENDIF
-                      ELSE IF ( cloud_droplets )  THEN
-                         k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
-                         k2 = 0.61_wp * pt(k,j,i)
-                      ENDIF
-
-                      tmp_flux(k) = ( k1 * surf_usm_h%shf(m) + k2 * surf_usm_h%qsws(m) )           &
-                                    * drho_air_zw(k-1)
+
+                         tmp_flux(k) = ( k1 * surf_usm_h(l)%shf(m) + k2 * surf_usm_h(l)%qsws(m) )     &
+                                       * drho_air_zw(k-1)
+                      ENDDO
                    ENDDO
 
@@ -3613,34 +3697,50 @@
 !
 !--    Natural surfaces
-       surf_s = surf_lsm_h%start_index(j,i)
-       surf_e = surf_lsm_h%end_index(j,i)
+       surf_s = surf_lsm_h(0)%start_index(j,i)
+       surf_e = surf_lsm_h(0)%end_index(j,i)
        DO  m = surf_s, surf_e
-          k = surf_lsm_h%k(m)
-
-          dudz(k) = ( u(k+1,j,i) - surf_lsm_h%u_0(m) ) * dd2zu(k)
-          dvdz(k) = ( v(k+1,j,i) - surf_lsm_h%v_0(m) ) * dd2zu(k)
+          k = surf_lsm_h(0)%k(m)
+
+          dudz(k) = ( u(k+1,j,i) - surf_lsm_h(0)%u_0(m) ) * dd2zu(k)
+          dvdz(k) = ( v(k+1,j,i) - surf_lsm_h(0)%v_0(m) ) * dd2zu(k)
 
        ENDDO
 !
 !--    Urban surfaces
-       surf_s = surf_usm_h%start_index(j,i)
-       surf_e = surf_usm_h%end_index(j,i)
+       surf_s = surf_usm_h(0)%start_index(j,i)
+       surf_e = surf_usm_h(0)%end_index(j,i)
        DO  m = surf_s, surf_e
-          k = surf_usm_h%k(m)
-
-          dudz(k) = ( u(k+1,j,i) - surf_usm_h%u_0(m) ) * dd2zu(k)
-          dvdz(k) = ( v(k+1,j,i) - surf_usm_h%v_0(m) ) * dd2zu(k)
+          k = surf_usm_h(0)%k(m)
+
+          dudz(k) = ( u(k+1,j,i) - surf_usm_h(0)%u_0(m) ) * dd2zu(k)
+          dvdz(k) = ( v(k+1,j,i) - surf_usm_h(0)%v_0(m) ) * dd2zu(k)
 
        ENDDO
 !
-!--    Compute gradients at downward-facing walls, only for non-natural default surfaces
+!--    Compute gradients at downward-facing surfaces, default surfaces
        surf_s = surf_def_h(1)%start_index(j,i)
        surf_e = surf_def_h(1)%end_index(j,i)
        DO  m = surf_s, surf_e
           k = surf_def_h(1)%k(m)
-
           dudz(k) = ( surf_def_h(1)%u_0(m) - u(k-1,j,i) ) * dd2zu(k)
           dvdz(k) = ( surf_def_h(1)%v_0(m) - v(k-1,j,i) ) * dd2zu(k)
-
+       ENDDO
+!
+!--    Compute gradients at downward-facing surfaces, natural surfaces
+       surf_s = surf_lsm_h(1)%start_index(j,i)
+       surf_e = surf_lsm_h(1)%end_index(j,i)
+       DO  m = surf_s, surf_e
+          k = surf_lsm_h(1)%k(m)
+          dudz(k) = ( surf_lsm_h(1)%u_0(m) - u(k-1,j,i) ) * dd2zu(k)
+          dvdz(k) = ( surf_lsm_h(1)%v_0(m) - v(k-1,j,i) ) * dd2zu(k)
+       ENDDO
+!
+!--    Compute gradients at downward-facing surfaces, urban surfaces
+       surf_s = surf_usm_h(1)%start_index(j,i)
+       surf_e = surf_usm_h(1)%end_index(j,i)
+       DO  m = surf_s, surf_e
+          k = surf_usm_h(1)%k(m)
+          dudz(k) = ( surf_usm_h(1)%u_0(m) - u(k-1,j,i) ) * dd2zu(k)
+          dvdz(k) = ( surf_usm_h(1)%v_0(m) - v(k-1,j,i) ) * dd2zu(k)
        ENDDO
 
@@ -3747,20 +3847,20 @@
                       tmp_flux(k) = drho_air_zw(k-1) * surf_def_h(l)%shf(m)
                    ENDDO
-                ENDDO
-!
-!--             Natural surfaces
-                surf_s = surf_lsm_h%start_index(j,i)
-                surf_e = surf_lsm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k = surf_lsm_h%k(m)
-                   tmp_flux(k) = drho_air_zw(k-1) * surf_lsm_h%shf(m)
-                ENDDO
-!
-!--             Urban surfaces
-                surf_s = surf_usm_h%start_index(j,i)
-                surf_e = surf_usm_h%end_index(j,i)
-                DO  m = surf_s, surf_e
-                   k = surf_usm_h%k(m)
-                   tmp_flux(k) = drho_air_zw(k-1) * surf_usm_h%shf(m)
+!
+!--                Natural surfaces
+                   surf_s = surf_lsm_h(l)%start_index(j,i)
+                   surf_e = surf_lsm_h(l)%end_index(j,i)
+                   DO  m = surf_s, surf_e
+                      k = surf_lsm_h(l)%k(m)
+                      tmp_flux(k) = drho_air_zw(k-1) * surf_lsm_h(l)%shf(m)
+                   ENDDO
+!
+!--                Urban surfaces
+                   surf_s = surf_usm_h(l)%start_index(j,i)
+                   surf_e = surf_usm_h(l)%end_index(j,i)
+                   DO  m = surf_s, surf_e
+                      k = surf_usm_h(l)%k(m)
+                      tmp_flux(k) = drho_air_zw(k-1) * surf_usm_h(l)%shf(m)
+                   ENDDO
                 ENDDO
              ENDIF
@@ -3836,6 +3936,7 @@
           IF ( use_surface_fluxes )  THEN
 !
-!--          Treat horizontal default surfaces
+!--          Treat horizontal surfaces
              DO  l = 0, 1
+!--             Default surfaces
                 surf_s = surf_def_h(l)%start_index(j,i)
                 surf_e = surf_def_h(l)%end_index(j,i)
@@ -3867,66 +3968,66 @@
                                  drho_air_zw(k-1)
                 ENDDO
-             ENDDO
-!
-!--          Treat horizontal natural surfaces
-             surf_s = surf_lsm_h%start_index(j,i)
-             surf_e = surf_lsm_h%end_index(j,i)
-             DO  m = surf_s, surf_e
-                k = surf_lsm_h%k(m)
-
-                IF ( .NOT. bulk_cloud_model  .AND.  .NOT. cloud_droplets )  THEN
-                   k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-                   k2 = 0.61_wp * pt(k,j,i)
-                ELSE IF ( bulk_cloud_model )  THEN
-                   IF ( ql(k,j,i) == 0.0_wp )  THEN
+!
+!--             natural surfaces
+                surf_s = surf_lsm_h(l)%start_index(j,i)
+                surf_e = surf_lsm_h(l)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k = surf_lsm_h(l)%k(m)
+
+                   IF ( .NOT. bulk_cloud_model  .AND.  .NOT. cloud_droplets )  THEN
                       k1 = 1.0_wp + 0.61_wp * q(k,j,i)
                       k2 = 0.61_wp * pt(k,j,i)
-                   ELSE
-                      theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
-                      temp  = theta * exner(k)
-                      k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *              &
-                           ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                               &
-                           ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                                &
-                           ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
-                      k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                   ELSE IF ( bulk_cloud_model )  THEN
+                      IF ( ql(k,j,i) == 0.0_wp )  THEN
+                         k1 = 1.0_wp + 0.61_wp * q(k,j,i)
+                         k2 = 0.61_wp * pt(k,j,i)
+                      ELSE
+                         theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
+                         temp  = theta * exner(k)
+                         k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *              &
+                              ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                               &
+                              ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                                &
+                              ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
+                         k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                      ENDIF
+                   ELSE IF ( cloud_droplets )  THEN
+                      k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
+                      k2 = 0.61_wp * pt(k,j,i)
                    ENDIF
-                ELSE IF ( cloud_droplets )  THEN
-                   k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
-                   k2 = 0.61_wp * pt(k,j,i)
-                ENDIF
-
-                tmp_flux(k) = ( k1 * surf_lsm_h%shf(m) + k2 * surf_lsm_h%qsws(m) ) *               &
-                              drho_air_zw(k-1)
-             ENDDO
-!
-!--          Treat horizontal urban surfaces
-             surf_s = surf_usm_h%start_index(j,i)
-             surf_e = surf_usm_h%end_index(j,i)
-             DO  m = surf_s, surf_e
-                k = surf_usm_h%k(m)
-
-                IF ( .NOT. bulk_cloud_model  .AND.  .NOT. cloud_droplets )  THEN
-                   k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-                   k2 = 0.61_wp * pt(k,j,i)
-                ELSE IF ( bulk_cloud_model )  THEN
-                   IF ( ql(k,j,i) == 0.0_wp )  THEN
+
+                   tmp_flux(k) = ( k1 * surf_lsm_h(l)%shf(m) + k2 * surf_lsm_h(l)%qsws(m) ) *         &
+                                 drho_air_zw(k-1)
+                ENDDO
+!
+!--             urban surfaces
+                surf_s = surf_usm_h(l)%start_index(j,i)
+                surf_e = surf_usm_h(l)%end_index(j,i)
+                DO  m = surf_s, surf_e
+                   k = surf_usm_h(l)%k(m)
+
+                   IF ( .NOT. bulk_cloud_model  .AND.  .NOT. cloud_droplets )  THEN
                       k1 = 1.0_wp + 0.61_wp * q(k,j,i)
                       k2 = 0.61_wp * pt(k,j,i)
-                   ELSE
-                      theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
-                      temp  = theta * exner(k)
-                      k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *              &
-                           ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                               &
-                           ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                                &
-                           ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
-                      k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                   ELSE IF ( bulk_cloud_model )  THEN
+                      IF ( ql(k,j,i) == 0.0_wp )  THEN
+                         k1 = 1.0_wp + 0.61_wp * q(k,j,i)
+                         k2 = 0.61_wp * pt(k,j,i)
+                      ELSE
+                         theta = pt(k,j,i) + d_exner(k) * lv_d_cp * ql(k,j,i)
+                         temp  = theta * exner(k)
+                         k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp * ( q(k,j,i) - ql(k,j,i) ) *              &
+                              ( 1.0_wp + rd_d_rv * lv_d_rd / temp ) ) /                               &
+                              ( 1.0_wp + rd_d_rv * lv_d_rd * lv_d_cp *                                &
+                              ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
+                         k2 = theta * ( lv_d_cp / temp * k1 - 1.0_wp )
+                      ENDIF
+                   ELSE IF ( cloud_droplets )  THEN
+                      k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
+                      k2 = 0.61_wp * pt(k,j,i)
                    ENDIF
-                ELSE IF ( cloud_droplets )  THEN
-                   k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
-                   k2 = 0.61_wp * pt(k,j,i)
-                ENDIF
-
-                tmp_flux(k) = ( k1 * surf_usm_h%shf(m) + k2 * surf_usm_h%qsws(m) ) *               &
-                              drho_air_zw(k-1)
+
+                   tmp_flux(k) = ( k1 * surf_usm_h(l)%shf(m) + k2 * surf_usm_h(l)%qsws(m) ) *         &
+                                 drho_air_zw(k-1)
+                ENDDO
              ENDDO
 
@@ -4610,6 +4711,6 @@
     INTEGER(iwp) ::  j  !< loop index
     INTEGER(iwp) ::  k  !< loop index
+    INTEGER(iwp) ::  l  !< loop index
     INTEGER(iwp) ::  m  !< loop index
-    INTEGER(iwp) ::  n  !< loop index
 
     REAL(wp) ::  var_reference  !< reference temperature
@@ -4647,49 +4748,49 @@
 !--    Upward facing surfaces
 !--    Default surfaces
-       n = 0
-       !$OMP PARALLEL DO PRIVATE(i,j,k,m)
-       DO  m = 1, surf_def_h(0)%ns
-          i = surf_def_h(0)%i(m)
-          j = surf_def_h(0)%j(m)
-          k = surf_def_h(0)%k(m)
-          km(k,j,i) = kappa * surf_def_h(0)%us(m) * surf_def_h(0)%z_mo(m) /                        &
-                      phi_m( surf_def_h(0)%z_mo(m) / surf_def_h(0)%ol(m) )
-          kh(k,j,i) = 1.35_wp * km(k,j,i)
+       DO l = 0, 1
+          !$OMP PARALLEL DO PRIVATE(i,j,k,m)
+          DO  m = 1, surf_def_h(l)%ns
+             i = surf_def_h(l)%i(m)
+             j = surf_def_h(l)%j(m)
+             k = surf_def_h(l)%k(m)
+             km(k,j,i) = kappa * surf_def_h(l)%us(m) * surf_def_h(l)%z_mo(m) /                        &
+                         phi_m( surf_def_h(l)%z_mo(m) / surf_def_h(l)%ol(m) )
+             kh(k,j,i) = 1.35_wp * km(k,j,i)
+          ENDDO
+!
+!--       Natural surfaces
+          !$OMP PARALLEL DO PRIVATE(i,j,k,m)
+          DO  m = 1, surf_lsm_h(l)%ns
+             i = surf_lsm_h(l)%i(m)
+             j = surf_lsm_h(l)%j(m)
+             k = surf_lsm_h(l)%k(m)
+             km(k,j,i) = kappa * surf_lsm_h(l)%us(m) * surf_lsm_h(l)%z_mo(m) /                              &
+                         phi_m( surf_lsm_h(l)%z_mo(m) / surf_lsm_h(l)%ol(m) )
+             kh(k,j,i) = 1.35_wp * km(k,j,i)
+          ENDDO
+!
+!--       Urban surfaces
+          !$OMP PARALLEL DO PRIVATE(i,j,k,m)
+          DO  m = 1, surf_usm_h(l)%ns
+             i = surf_usm_h(l)%i(m)
+             j = surf_usm_h(l)%j(m)
+             k = surf_usm_h(l)%k(m)
+             km(k,j,i) = kappa * surf_usm_h(l)%us(m) * surf_usm_h(l)%z_mo(m) /                              &
+                         phi_m( surf_usm_h(l)%z_mo(m) / surf_usm_h(l)%ol(m) )
+             kh(k,j,i) = 1.35_wp * km(k,j,i)
+          ENDDO
        ENDDO
-!
-!--    Natural surfaces
-       !$OMP PARALLEL DO PRIVATE(i,j,k,m)
-       DO  m = 1, surf_lsm_h%ns
-          i = surf_lsm_h%i(m)
-          j = surf_lsm_h%j(m)
-          k = surf_lsm_h%k(m)
-          km(k,j,i) = kappa * surf_lsm_h%us(m) * surf_lsm_h%z_mo(m) /                              &
-                      phi_m( surf_lsm_h%z_mo(m) / surf_lsm_h%ol(m) )
-          kh(k,j,i) = 1.35_wp * km(k,j,i)
-       ENDDO
-!
-!--    Urban surfaces
-       !$OMP PARALLEL DO PRIVATE(i,j,k,m)
-       DO  m = 1, surf_usm_h%ns
-          i = surf_usm_h%i(m)
-          j = surf_usm_h%j(m)
-          k = surf_usm_h%k(m)
-          km(k,j,i) = kappa * surf_usm_h%us(m) * surf_usm_h%z_mo(m) /                              &
-                      phi_m( surf_usm_h%z_mo(m) / surf_usm_h%ol(m) )
-          kh(k,j,i) = 1.35_wp * km(k,j,i)
-       ENDDO
-
 !
 !--    North-, south-, west and eastward facing surfaces
 !--    Do not consider stratification at these surfaces.
-       DO  n = 0, 3
+       DO  l = 0, 3
 !
 !--       Default surfaces
           !$OMP PARALLEL DO PRIVATE(i,j,k,m)
-          DO  m = 1, surf_def_v(n)%ns
-             i = surf_def_v(n)%i(m)
-             j = surf_def_v(n)%j(m)
-             k = surf_def_v(n)%k(m)
-             km(k,j,i) = kappa * surf_def_v(n)%us(m) * surf_def_v(n)%z_mo(m)
+          DO  m = 1, surf_def_v(l)%ns
+             i = surf_def_v(l)%i(m)
+             j = surf_def_v(l)%j(m)
+             k = surf_def_v(l)%k(m)
+             km(k,j,i) = kappa * surf_def_v(l)%us(m) * surf_def_v(l)%z_mo(m)
              kh(k,j,i) = 1.35_wp * km(k,j,i)
           ENDDO
@@ -4697,9 +4798,9 @@
 !--       Natural surfaces
           !$OMP PARALLEL DO PRIVATE(i,j,k,m)
-          DO  m = 1, surf_lsm_v(n)%ns
-             i = surf_lsm_v(n)%i(m)
-             j = surf_lsm_v(n)%j(m)
-             k = surf_lsm_v(n)%k(m)
-             km(k,j,i) = kappa * surf_lsm_v(n)%us(m) * surf_lsm_v(n)%z_mo(m)
+          DO  m = 1, surf_lsm_v(l)%ns
+             i = surf_lsm_v(l)%i(m)
+             j = surf_lsm_v(l)%j(m)
+             k = surf_lsm_v(l)%k(m)
+             km(k,j,i) = kappa * surf_lsm_v(l)%us(m) * surf_lsm_v(l)%z_mo(m)
              kh(k,j,i) = 1.35_wp * km(k,j,i)
           ENDDO
@@ -4707,9 +4808,9 @@
 !--       Urban surfaces
           !$OMP PARALLEL DO PRIVATE(i,j,k,m)
-          DO  m = 1, surf_usm_v(n)%ns
-             i = surf_usm_v(n)%i(m)
-             j = surf_usm_v(n)%j(m)
-             k = surf_usm_v(n)%k(m)
-             km(k,j,i) = kappa * surf_usm_v(n)%us(m) * surf_usm_v(n)%z_mo(m)
+          DO  m = 1, surf_usm_v(l)%ns
+             i = surf_usm_v(l)%i(m)
+             j = surf_usm_v(l)%j(m)
+             k = surf_usm_v(l)%k(m)
+             km(k,j,i) = kappa * surf_usm_v(l)%us(m) * surf_usm_v(l)%z_mo(m)
              kh(k,j,i) = 1.35_wp * km(k,j,i)
           ENDDO
Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4671)
@@ -27,4 +27,13 @@
 ! -----------------
 ! $Id$
+! Radiative transfer model RTM version 4.1
+! - Implementation of downward facing USM and LSM surfaces
+! - Restructuralization EB call
+! - Improved debug logging
+! - Removal of deprecated CSV inputs
+! - Bugfixes
+! Author: J. Resler (Institute of Computer Science, Prague)
+!
+! 4669 2020-09-09 13:43:47Z pavelkrc
 ! Fix calculation of force_radiation_call
 !
@@ -255,5 +264,4 @@
 !> fraq(0,m) + fraq(1,m) = 0?!
 !> @todo Use unit 90 for OPEN/CLOSE of input files (FK)
-!> @todo Remove reading of old csv inputs
 !--------------------------------------------------------------------------------------------------!
  MODULE urban_surface_mod
@@ -280,7 +288,9 @@
     USE basic_constants_and_equations_mod,                                                         &
         ONLY:  c_p,                                                                                &
+               degc_to_k,                                                                          &
                g,                                                                                  &
                kappa,                                                                              &
                l_v,                                                                                &
+               magnus_tl,                                                                       &
                pi,                                                                                 &
                r_d,                                                                                &
@@ -372,6 +382,10 @@
     USE radiation_model_mod,                                                                       &
         ONLY:  albedo_type,                                                                        &
+               dirname,                                                                            &
+               diridx,                                                                             &
+               dirint,                                                                             &
                force_radiation_call,                                                               &
                id,                                                                                 &
+               idown,                                                                              &
                ieast,                                                                              &
                inorth,                                                                             &
@@ -379,4 +393,5 @@
                iup,                                                                                &
                iwest,                                                                              &
+               nd,                                                                                 &
                nz_urban_b,                                                                         &
                nz_urban_t,                                                                         &
@@ -404,4 +419,5 @@
                ind_veg_wall,                                                                       &
                ind_wat_win,                                                                        &
+               surf_type,                                                                          &
                surf_usm_h,                                                                         &
                surf_usm_v,                                                                         &
@@ -461,14 +477,8 @@
 !-- Configuration parameters (they can be setup in PALM config)
     LOGICAL ::  force_radiation_call_l = .FALSE.   !< flag parameter for unscheduled radiation model calls
-    LOGICAL ::  read_wall_temp_3d = .FALSE.        !<
-    LOGICAL ::  usm_anthropogenic_heat = .FALSE.   !< flag parameter indicating wheather the anthropogenic heat sources
-                                                   !< (e.g.transportation) are used
-    LOGICAL ::  usm_material_model = .TRUE.        !< flag parameter indicating wheather the  model of heat in materials is used
     LOGICAL ::  usm_wall_mod = .FALSE.             !< reduces conductivity of the first 2 wall layers by factor 0.1
 
 
     INTEGER(iwp) ::  building_type = 1               !< default building type (preleminary setting)
-    INTEGER(iwp) ::  land_category = 2               !< default category for land surface
-    INTEGER(iwp) ::  pedestrian_category = 2         !< default category for wall surface in pedestrian zone
     INTEGER(iwp) ::  roof_category = 2               !< default category for root surface
     INTEGER(iwp) ::  wall_category = 2               !< default category for wall surface over pedestrian zone
@@ -640,6 +650,4 @@
 
     REAL(wp)  ::  ground_floor_level = 4.0_wp  !< default ground floor level
-    REAL(wp)  ::  roof_height_limit  = 4.0_wp  !< height to distinguish between land surfaces and roofs
-
 
 !
@@ -650,35 +658,13 @@
     REAL(wp), DIMENSION(0:135,1:7) ::  building_pars  !<
 !
-!-- Type for surface temperatures at vertical walls. Is not necessary for horizontal walls.
-    TYPE t_surf_vertical
-       REAL(wp), DIMENSION(:), ALLOCATABLE         ::  t  !<
-    END TYPE t_surf_vertical
-!
-!-- Type for wall temperatures at vertical walls. Is not necessary for horizontal walls.
-    TYPE t_wall_vertical
-       REAL(wp), DIMENSION(:,:), ALLOCATABLE       ::  t  !<
-    END TYPE t_wall_vertical
-
-    TYPE surf_type_usm
-       REAL(wp), DIMENSION(:),   ALLOCATABLE ::  var_usm_1d  !< 1D prognostic variable
-       REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  var_usm_2d  !< 2D prognostic variable
-    END TYPE surf_type_usm
-
-    TYPE(surf_type_usm), POINTER  ::  m_liq_usm_h    !< liquid water reservoir (m), horizontal surface elements
-    TYPE(surf_type_usm), POINTER  ::  m_liq_usm_h_p  !< progn. liquid water reservoir (m), horizontal surface elements
-
-    TYPE(surf_type_usm), TARGET   ::  m_liq_usm_h_1  !<
-    TYPE(surf_type_usm), TARGET   ::  m_liq_usm_h_2  !<
-
-    TYPE(surf_type_usm), TARGET   ::  tm_liq_usm_h_m  !< liquid water reservoir tendency (m), horizontal surface elements
-!
-!-- Anthropogenic heat sources
-    INTEGER(iwp)                                   ::  naheatlayers = 1  !< number of layers of anthropogenic heat
-
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE        ::  aheat             !< daily average of anthropogenic heat (W/m2)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE          ::  aheatprof         !< diurnal profiles of anthropogenic heat
-                                                                         !< for particular layers
-
-!
+!-- Type for 1d surface variables as surface temperature and liquid water reservoir
+    TYPE surf_type_1d_usm
+       REAL(wp), DIMENSION(:), ALLOCATABLE         ::  val  !<
+    END TYPE surf_type_1d_usm
+!
+!-- Type for 2d surface variables as wall temperature
+    TYPE surf_type_2d_usm
+       REAL(wp), DIMENSION(:,:), ALLOCATABLE       ::  val  !<
+    END TYPE surf_type_2d_usm
 !-- Wall surface model
 !-- Wall surface model constants
@@ -688,12 +674,4 @@
 
     INTEGER(iwp)                                   ::  soil_type     !<
-
-
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall)         ::  zwn_default        = (/0.0242_wp, 0.0969_wp, 0.346_wp, 1.0_wp /)
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall)         ::  zwn_default_green  = (/0.25_wp,   0.5_wp,    0.75_wp,  1.0_wp /)
-                                                                          !< normalized soil, wall and roof, window and
-                                                                          !< green layer depths (m/m)
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall)         ::  zwn_default_window = (/0.25_wp,   0.5_wp,    0.75_wp,  1.0_wp /)
-
 
     REAL(wp)  ::  m_total                  = 0.0_wp    !< weighted total water content of the soil (m3/m3)
@@ -706,116 +684,83 @@
     REAL(wp)  ::  window_inner_temperature = 295.0_wp  !< temperature of the inner window
                                                        !< surface (~22 degrees C) (K)
-
 !
 !-- Surface and material model variables for walls, ground, roofs
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  zwn                 !< normalized wall layer depths (m)
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  zwn_green           !< normalized green layer depths (m)
-    REAL(wp), DIMENSION(:), ALLOCATABLE            ::  zwn_window          !< normalized window layer depths (m)
-
-    REAL(wp), DIMENSION(:), POINTER                ::  t_surf_green_h      !<
-    REAL(wp), DIMENSION(:), POINTER                ::  t_surf_green_h_p    !<
-    REAL(wp), DIMENSION(:), POINTER                ::  t_surf_wall_h       !<
-    REAL(wp), DIMENSION(:), POINTER                ::  t_surf_wall_h_p     !<
-    REAL(wp), DIMENSION(:), POINTER                ::  t_surf_window_h     !<
-    REAL(wp), DIMENSION(:), POINTER                ::  t_surf_window_h_p   !<
-
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    ::  t_surf_green_h_1    !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    ::  t_surf_green_h_2    !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    ::  t_surf_wall_h_1     !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    ::  t_surf_wall_h_2     !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    ::  t_surf_window_h_1   !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, TARGET    ::  t_surf_window_h_2   !<
-
-    TYPE(t_surf_vertical), DIMENSION(:), POINTER   ::  t_surf_green_v      !<
-    TYPE(t_surf_vertical), DIMENSION(:), POINTER   ::  t_surf_green_v_p    !<
-    TYPE(t_surf_vertical), DIMENSION(:), POINTER   ::  t_surf_wall_v       !<
-    TYPE(t_surf_vertical), DIMENSION(:), POINTER   ::  t_surf_wall_v_p     !<
-    TYPE(t_surf_vertical), DIMENSION(:), POINTER   ::  t_surf_window_v     !<
-    TYPE(t_surf_vertical), DIMENSION(:), POINTER   ::  t_surf_window_v_p   !<
-
-    TYPE(t_surf_vertical), DIMENSION(0:3), TARGET  ::  t_surf_green_v_1    !<
-    TYPE(t_surf_vertical), DIMENSION(0:3), TARGET  ::  t_surf_green_v_2    !<
-    TYPE(t_surf_vertical), DIMENSION(0:3), TARGET  ::  t_surf_wall_v_1     !<
-    TYPE(t_surf_vertical), DIMENSION(0:3), TARGET  ::  t_surf_wall_v_2     !<
-    TYPE(t_surf_vertical), DIMENSION(0:3), TARGET  ::  t_surf_window_v_1   !<
-    TYPE(t_surf_vertical), DIMENSION(0:3), TARGET  ::  t_surf_window_v_2   !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_green_h      !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_green_h_p    !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_wall_h       !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_wall_h_p     !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_window_h     !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_window_h_p   !<
+
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  t_surf_green_h_1    !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  t_surf_green_h_2    !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  t_surf_wall_h_1     !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  t_surf_wall_h_2     !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  t_surf_window_h_1   !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  t_surf_window_h_2   !<
+
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_green_v      !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_green_v_p    !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_wall_v       !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_wall_v_p     !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_window_v     !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  t_surf_window_v_p   !<
+
+    TYPE(surf_type_1d_usm), DIMENSION(0:3), TARGET  ::  t_surf_green_v_1    !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:3), TARGET  ::  t_surf_green_v_2    !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:3), TARGET  ::  t_surf_wall_v_1     !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:3), TARGET  ::  t_surf_wall_v_2     !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:3), TARGET  ::  t_surf_window_v_1   !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:3), TARGET  ::  t_surf_window_v_2   !<
 
 !
 !-- Energy balance variables
-!-- Parameters of the land, roof and wall surfaces
-    REAL(wp), DIMENSION(:,:), POINTER                ::  fc_h          !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  rootfr_h      !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  swc_h         !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  swc_h_p       !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  swc_res_h     !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  swc_sat_h     !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  t_green_h     !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  t_green_h_p   !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  t_wall_h      !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  t_wall_h_p    !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  wilt_h        !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  t_window_h    !<
-    REAL(wp), DIMENSION(:,:), POINTER                ::  t_window_h_p  !<
-
-
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  fc_h_1        !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  rootfr_h_1    !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  swc_h_1       !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  swc_h_2       !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  swc_res_h_1   !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  swc_sat_h_1   !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  t_green_h_1   !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  t_green_h_2   !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  t_wall_h_1    !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  t_wall_h_2    !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  wilt_h_1      !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  t_window_h_1  !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, TARGET    ::  t_window_h_2  !<
-
-
-    TYPE(t_wall_vertical), DIMENSION(:), POINTER   ::  t_green_v     !<
-    TYPE(t_wall_vertical), DIMENSION(:), POINTER   ::  t_green_v_p   !<
-    TYPE(t_wall_vertical), DIMENSION(:), POINTER   ::  t_wall_v      !<
-    TYPE(t_wall_vertical), DIMENSION(:), POINTER   ::  t_wall_v_p    !<
-    TYPE(t_wall_vertical), DIMENSION(:), POINTER   ::  t_window_v    !<
-    TYPE(t_wall_vertical), DIMENSION(:), POINTER   ::  t_window_v_p  !<
-
-
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  ::  t_green_v_1   !<
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  ::  t_green_v_2   !<
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  ::  t_wall_v_1    !<
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  ::  t_wall_v_2    !<
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  ::  t_window_v_1  !<
-    TYPE(t_wall_vertical), DIMENSION(0:3), TARGET  ::  t_window_v_2  !<
-
-!
-!-- Surface and material parameter classes (surface_type)
-!-- Albedo, emissivity, lambda_surf, roughness, thickness, volumetric heat capacity, thermal conductivity
-    CHARACTER(12), DIMENSION(:), ALLOCATABLE  ::  surface_type_names    !< names of wall types (used only for reports)
-
-    INTEGER(iwp)                              ::  n_surface_types       !< number of the wall type categories
-
-    INTEGER(iwp), PARAMETER                   ::  ialbedo  = 1          !< albedo of the surface
-    INTEGER(iwp), PARAMETER                   ::  icsurf   = 6          !< Surface skin layer heat capacity (J m-2 K-1 )
-    INTEGER(iwp), PARAMETER                   ::  iemiss   = 2          !< emissivity of the surface
-    INTEGER(iwp), PARAMETER                   ::  ilambdah = 9          !< thermal conductivity lambda H
-                                                                        !< of the wall (W m-1 K-1 )
-    INTEGER(iwp), PARAMETER                   ::  ilambdas = 3          !< heat conductivity lambda S between surface
-                                                                        !< and material ( W m-2 K-1 )
-    INTEGER(iwp), PARAMETER                   ::  irhoC    = 8          !< volumetric heat capacity rho*C of
-                                                                        !< the material ( J m-3 K-1 )
-    INTEGER(iwp), PARAMETER                   ::  irough   = 4          !< roughness length z0 for movements
-    INTEGER(iwp), PARAMETER                   ::  iroughh  = 5          !< roughness length z0h for scalars
-                                                                        !< (heat, humidity,...)
-    INTEGER(iwp), PARAMETER                   ::  ithick   = 7          !< thickness of the surface (wall, roof, land) (m)
-    INTEGER(iwp), PARAMETER                   ::  n_surface_params = 9  !< number of parameters for each type of the wall
-
-
-    INTEGER(iwp), DIMENSION(:), ALLOCATABLE   ::  surface_type_codes    !< codes of wall types
-
-
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE     ::  surface_params        !< parameters of wall types
-
-!
+!-- Parameters of the land, roof and wall surfaces (only for horizontal upward surfaces)
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  fc_h          !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  rootfr_h      !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  swc_h         !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  swc_h_p       !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  swc_res_h     !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  swc_sat_h     !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_green_h     !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_green_h_p   !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_wall_h      !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_wall_h_p    !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  wilt_h        !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_window_h    !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_window_h_p  !<
+
+
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  fc_h_1        !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  rootfr_h_1    !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  swc_h_1       !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  swc_h_2       !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  swc_res_h_1   !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  swc_sat_h_1   !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  t_green_h_1   !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  t_green_h_2   !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  t_wall_h_1    !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  t_wall_h_2    !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  wilt_h_1      !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  t_window_h_1  !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:1), TARGET  ::  t_window_h_2  !<
+
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_green_v     !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_green_v_p   !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_wall_v      !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_wall_v_p    !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_window_v    !<
+    TYPE(surf_type_2d_usm), DIMENSION(:), POINTER   ::  t_window_v_p  !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:3), TARGET  ::  t_green_v_1   !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:3), TARGET  ::  t_green_v_2   !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:3), TARGET  ::  t_wall_v_1    !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:3), TARGET  ::  t_wall_v_2    !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:3), TARGET  ::  t_window_v_1  !<
+    TYPE(surf_type_2d_usm), DIMENSION(0:3), TARGET  ::  t_window_v_2  !<
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  m_liq_usm_h    !< liquid water reservoir (m), horizontal surface elements
+    TYPE(surf_type_1d_usm), DIMENSION(:), POINTER   ::  m_liq_usm_h_p  !< progn. liquid water reservoir (m), horizontal surface elements
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  m_liq_usm_h_1  !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  m_liq_usm_h_2  !<
+    TYPE(surf_type_1d_usm), DIMENSION(0:1), TARGET  ::  tm_liq_usm_h_m  !< liquid water reservoir tendency (m), horizontal surface elements
 !-- Interfaces of subroutines accessed from outside of this module
     INTERFACE usm_3d_data_averaging
@@ -851,12 +796,4 @@
     END INTERFACE usm_init_arrays
 
-    INTERFACE usm_material_heat_model
-       MODULE PROCEDURE usm_material_heat_model
-    END INTERFACE usm_material_heat_model
-
-    INTERFACE usm_green_heat_model
-       MODULE PROCEDURE usm_green_heat_model
-    END INTERFACE usm_green_heat_model
-
     INTERFACE usm_parin
        MODULE PROCEDURE usm_parin
@@ -868,7 +805,7 @@
     END INTERFACE usm_rrd_local
 
-    INTERFACE usm_surface_energy_balance
-       MODULE PROCEDURE usm_surface_energy_balance
-    END INTERFACE usm_surface_energy_balance
+    INTERFACE usm_energy_balance
+       MODULE PROCEDURE usm_energy_balance
+    END INTERFACE usm_energy_balance
 
     INTERFACE usm_swap_timelevel
@@ -894,8 +831,7 @@
            usm_init,                                                                               &
            usm_init_arrays,                                                                        &
-           usm_material_heat_model,                                                                &
            usm_parin,                                                                              &
            usm_rrd_local,                                                                          &
-           usm_surface_energy_balance,                                                             &
+           usm_energy_balance,                                                                     &
            usm_swap_timelevel,                                                                     &
            usm_wrd_local,                                                                          &
@@ -912,7 +848,4 @@
            t_window_h,                                                                             &
            t_window_v,                                                                             &
-           usm_anthropogenic_heat,                                                                 &
-           usm_green_heat_model,                                                                   &
-           usm_material_model,                                                                     &
            usm_wall_mod
 
@@ -941,6 +874,8 @@
 !-- Allocate radiation arrays which are part of the new data type.
 !-- For horizontal surfaces.
-    ALLOCATE ( surf_usm_h%surfhf(1:surf_usm_h%ns)    )
-    ALLOCATE ( surf_usm_h%rad_net_l(1:surf_usm_h%ns) )
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%surfhf(1:surf_usm_h(l)%ns)    )
+       ALLOCATE ( surf_usm_h(l)%rad_net_l(1:surf_usm_h(l)%ns) )
+    ENDDO
 !
 !-- For vertical surfaces
@@ -954,9 +889,11 @@
 !-- Allocate arrays for wall surface model and define pointers
 !-- Allocate array of wall types and wall parameters
-    ALLOCATE ( surf_usm_h%surface_types(1:surf_usm_h%ns)      )
-    ALLOCATE ( surf_usm_h%building_type(1:surf_usm_h%ns)      )
-    ALLOCATE ( surf_usm_h%building_type_name(1:surf_usm_h%ns) )
-    surf_usm_h%building_type      = 0
-    surf_usm_h%building_type_name = 'none'
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%surface_types(1:surf_usm_h(l)%ns)      )
+       ALLOCATE ( surf_usm_h(l)%building_type(1:surf_usm_h(l)%ns)      )
+       ALLOCATE ( surf_usm_h(l)%building_type_name(1:surf_usm_h(l)%ns) )
+       surf_usm_h(l)%building_type      = 0
+       surf_usm_h(l)%building_type_name = 'none'
+    ENDDO
     DO  l = 0, 3
        ALLOCATE ( surf_usm_v(l)%surface_types(1:surf_usm_v(l)%ns)      )
@@ -969,7 +906,9 @@
 !-- Allocate albedo_type and albedo. Each surface element has 3 values, 0: wall fraction,
 !-- 1: green fraction, 2: window fraction.
-    ALLOCATE ( surf_usm_h%albedo_type(1:surf_usm_h%ns,0:2) )
-    ALLOCATE ( surf_usm_h%albedo(1:surf_usm_h%ns,0:2)      )
-    surf_usm_h%albedo_type = albedo_type
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%albedo_type(1:surf_usm_h(l)%ns,0:2) )
+       ALLOCATE ( surf_usm_h(l)%albedo(1:surf_usm_h(l)%ns,0:2)      )
+       surf_usm_h(l)%albedo_type = albedo_type
+    ENDDO
     DO  l = 0, 3
        ALLOCATE ( surf_usm_v(l)%albedo_type(1:surf_usm_v(l)%ns,0:2) )
@@ -980,6 +919,8 @@
 !
 !-- Allocate indoor target temperature for summer and winter
-    ALLOCATE ( surf_usm_h%target_temp_summer(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%target_temp_winter(1:surf_usm_h%ns) )
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%target_temp_summer(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%target_temp_winter(1:surf_usm_h(l)%ns) )
+    ENDDO
     DO  l = 0, 3
        ALLOCATE ( surf_usm_v(l)%target_temp_summer(1:surf_usm_v(l)%ns) )
@@ -989,6 +930,8 @@
 !-- In case the indoor model is applied, allocate memory for waste heat and indoor temperature.
     IF ( indoor_model )  THEN
-       ALLOCATE ( surf_usm_h%waste_heat(1:surf_usm_h%ns) )
-       surf_usm_h%waste_heat = 0.0_wp
+       DO  l = 0, 1
+          ALLOCATE ( surf_usm_h(l)%waste_heat(1:surf_usm_h(l)%ns) )
+          surf_usm_h(l)%waste_heat = 0.0_wp
+       ENDDO
        DO  l = 0, 3
           ALLOCATE ( surf_usm_v(l)%waste_heat(1:surf_usm_v(l)%ns) )
@@ -998,36 +941,41 @@
 !
 !-- Allocate flag indicating ground floor level surface elements
-    ALLOCATE ( surf_usm_h%ground_level(1:surf_usm_h%ns) )
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%ground_level(1:surf_usm_h(l)%ns) )
+    ENDDO
     DO  l = 0, 3
        ALLOCATE ( surf_usm_v(l)%ground_level(1:surf_usm_v(l)%ns) )
     ENDDO
 !
-!--  Allocate arrays for relative surface fraction.
-!--  0 - wall fraction, 1 - green fraction, 2 - window fraction
-     ALLOCATE ( surf_usm_h%frac(1:surf_usm_h%ns,0:2) )
-     surf_usm_h%frac = 0.0_wp
-     DO  l = 0, 3
-        ALLOCATE ( surf_usm_v(l)%frac(1:surf_usm_v(l)%ns,0:2) )
-        surf_usm_v(l)%frac = 0.0_wp
-     ENDDO
+!-- Allocate arrays for relative surface fraction.
+!-- 0 - wall fraction, 1 - green fraction, 2 - window fraction
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%frac(1:surf_usm_h(l)%ns,0:2) )
+       surf_usm_h(l)%frac = 0.0_wp
+    ENDDO
+    DO  l = 0, 3
+       ALLOCATE ( surf_usm_v(l)%frac(1:surf_usm_v(l)%ns,0:2) )
+       surf_usm_v(l)%frac = 0.0_wp
+    ENDDO
 
 !
 !-- Wall and roof surface parameters. First for horizontal surfaces
-    ALLOCATE ( surf_usm_h%isroof_surf(1:surf_usm_h%ns)        )
-    ALLOCATE ( surf_usm_h%lambda_surf(1:surf_usm_h%ns)        )
-    ALLOCATE ( surf_usm_h%lambda_surf_window(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%lambda_surf_green(1:surf_usm_h%ns)  )
-    ALLOCATE ( surf_usm_h%c_surface(1:surf_usm_h%ns)          )
-    ALLOCATE ( surf_usm_h%c_surface_window(1:surf_usm_h%ns)   )
-    ALLOCATE ( surf_usm_h%c_surface_green(1:surf_usm_h%ns)    )
-    ALLOCATE ( surf_usm_h%transmissivity(1:surf_usm_h%ns)     )
-    ALLOCATE ( surf_usm_h%lai(1:surf_usm_h%ns)                )
-    ALLOCATE ( surf_usm_h%emissivity(1:surf_usm_h%ns,0:2)     )
-    ALLOCATE ( surf_usm_h%r_a(1:surf_usm_h%ns)                )
-    ALLOCATE ( surf_usm_h%r_a_green(1:surf_usm_h%ns)          )
-    ALLOCATE ( surf_usm_h%r_a_window(1:surf_usm_h%ns)         )
-    ALLOCATE ( surf_usm_h%green_type_roof(1:surf_usm_h%ns)    )
-    ALLOCATE ( surf_usm_h%r_s(1:surf_usm_h%ns)                )
-
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%isroof_surf(1:surf_usm_h(l)%ns)        )
+       ALLOCATE ( surf_usm_h(l)%lambda_surf(1:surf_usm_h(l)%ns)        )
+       ALLOCATE ( surf_usm_h(l)%lambda_surf_window(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%lambda_surf_green(1:surf_usm_h(l)%ns)  )
+       ALLOCATE ( surf_usm_h(l)%c_surface(1:surf_usm_h(l)%ns)          )
+       ALLOCATE ( surf_usm_h(l)%c_surface_window(1:surf_usm_h(l)%ns)   )
+       ALLOCATE ( surf_usm_h(l)%c_surface_green(1:surf_usm_h(l)%ns)    )
+       ALLOCATE ( surf_usm_h(l)%transmissivity(1:surf_usm_h(l)%ns)     )
+       ALLOCATE ( surf_usm_h(l)%lai(1:surf_usm_h(l)%ns)                )
+       ALLOCATE ( surf_usm_h(l)%emissivity(1:surf_usm_h(l)%ns,0:2)     )
+       ALLOCATE ( surf_usm_h(l)%r_a(1:surf_usm_h(l)%ns)                )
+       ALLOCATE ( surf_usm_h(l)%r_a_green(1:surf_usm_h(l)%ns)          )
+       ALLOCATE ( surf_usm_h(l)%r_a_window(1:surf_usm_h(l)%ns)         )
+       ALLOCATE ( surf_usm_h(l)%green_type_roof(1:surf_usm_h(l)%ns)    )
+       ALLOCATE ( surf_usm_h(l)%r_s(1:surf_usm_h(l)%ns)                )
+    ENDDO
 !
 !-- For vertical surfaces.
@@ -1050,23 +998,24 @@
 !
 !-- Allocate wall and roof material parameters. First for horizontal surfaces
-    ALLOCATE ( surf_usm_h%thickness_wall(1:surf_usm_h%ns)                    )
-    ALLOCATE ( surf_usm_h%thickness_window(1:surf_usm_h%ns)                  )
-    ALLOCATE ( surf_usm_h%thickness_green(1:surf_usm_h%ns)                   )
-    ALLOCATE ( surf_usm_h%lambda_h(nzb_wall:nzt_wall,1:surf_usm_h%ns)        )
-    ALLOCATE ( surf_usm_h%rho_c_wall(nzb_wall:nzt_wall,1:surf_usm_h%ns)      )
-    ALLOCATE ( surf_usm_h%lambda_h_window(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%rho_c_window(nzb_wall:nzt_wall,1:surf_usm_h%ns)    )
-    ALLOCATE ( surf_usm_h%lambda_h_green(nzb_wall:nzt_wall,1:surf_usm_h%ns)  )
-    ALLOCATE ( surf_usm_h%rho_c_green(nzb_wall:nzt_wall,1:surf_usm_h%ns)     )
-
-    ALLOCATE ( surf_usm_h%rho_c_total_green(nzb_wall:nzt_wall,1:surf_usm_h%ns)    )
-    ALLOCATE ( surf_usm_h%n_vg_green(1:surf_usm_h%ns)                             )
-    ALLOCATE ( surf_usm_h%alpha_vg_green(1:surf_usm_h%ns)                         )
-    ALLOCATE ( surf_usm_h%l_vg_green(1:surf_usm_h%ns)                             )
-    ALLOCATE ( surf_usm_h%gamma_w_green_sat(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)  )
-    ALLOCATE ( surf_usm_h%lambda_w_green(nzb_wall:nzt_wall,1:surf_usm_h%ns)       )
-    ALLOCATE ( surf_usm_h%gamma_w_green(nzb_wall:nzt_wall,1:surf_usm_h%ns)        )
-    ALLOCATE ( surf_usm_h%tswc_h_m(nzb_wall:nzt_wall,1:surf_usm_h%ns)             )
-
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%thickness_wall(1:surf_usm_h(l)%ns)                    )
+       ALLOCATE ( surf_usm_h(l)%thickness_window(1:surf_usm_h(l)%ns)                  )
+       ALLOCATE ( surf_usm_h(l)%thickness_green(1:surf_usm_h(l)%ns)                   )
+       ALLOCATE ( surf_usm_h(l)%lambda_h(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)        )
+       ALLOCATE ( surf_usm_h(l)%rho_c_wall(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)      )
+       ALLOCATE ( surf_usm_h(l)%lambda_h_window(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%rho_c_window(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)    )
+       ALLOCATE ( surf_usm_h(l)%lambda_h_green(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)  )
+       ALLOCATE ( surf_usm_h(l)%rho_c_green(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)     )
+
+       ALLOCATE ( surf_usm_h(l)%rho_c_total_green(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)    )
+       ALLOCATE ( surf_usm_h(l)%n_vg_green(1:surf_usm_h(l)%ns)                             )
+       ALLOCATE ( surf_usm_h(l)%alpha_vg_green(1:surf_usm_h(l)%ns)                         )
+       ALLOCATE ( surf_usm_h(l)%l_vg_green(1:surf_usm_h(l)%ns)                             )
+       ALLOCATE ( surf_usm_h(l)%gamma_w_green_sat(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)  )
+       ALLOCATE ( surf_usm_h(l)%lambda_w_green(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)       )
+       ALLOCATE ( surf_usm_h(l)%gamma_w_green(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)        )
+       ALLOCATE ( surf_usm_h(l)%tswc_h_m(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)             )
+    ENDDO
 !
 !-- For vertical surfaces.
@@ -1085,12 +1034,13 @@
 !
 !-- Allocate green wall and roof vegetation and soil parameters. First horizontal surfaces
-    ALLOCATE ( surf_usm_h%g_d(1:surf_usm_h%ns)              )
-    ALLOCATE ( surf_usm_h%c_liq(1:surf_usm_h%ns)            )
-    ALLOCATE ( surf_usm_h%qsws_liq(1:surf_usm_h%ns)         )
-    ALLOCATE ( surf_usm_h%qsws_veg(1:surf_usm_h%ns)         )
-    ALLOCATE ( surf_usm_h%r_canopy(1:surf_usm_h%ns)         )
-    ALLOCATE ( surf_usm_h%r_canopy_min(1:surf_usm_h%ns)     )
-    ALLOCATE ( surf_usm_h%pt_10cm(1:surf_usm_h%ns)          )
-
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%g_d(1:surf_usm_h(l)%ns)              )
+       ALLOCATE ( surf_usm_h(l)%c_liq(1:surf_usm_h(l)%ns)            )
+       ALLOCATE ( surf_usm_h(l)%qsws_liq(1:surf_usm_h(l)%ns)         )
+       ALLOCATE ( surf_usm_h(l)%qsws_veg(1:surf_usm_h(l)%ns)         )
+       ALLOCATE ( surf_usm_h(l)%r_canopy(1:surf_usm_h(l)%ns)         )
+       ALLOCATE ( surf_usm_h(l)%r_canopy_min(1:surf_usm_h(l)%ns)     )
+       ALLOCATE ( surf_usm_h(l)%pt_10cm(1:surf_usm_h(l)%ns)          )
+    ENDDO
 !
 !-- For vertical surfaces.
@@ -1107,22 +1057,21 @@
 !
 !-- Allocate wall and roof layers sizes. For horizontal surfaces.
-    ALLOCATE ( zwn(nzb_wall:nzt_wall)                                        )
-    ALLOCATE ( surf_usm_h%dz_wall(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)       )
-    ALLOCATE ( zwn_window(nzb_wall:nzt_wall)                                 )
-    ALLOCATE ( surf_usm_h%dz_window(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)     )
-    ALLOCATE ( zwn_green(nzb_wall:nzt_wall)                                  )
-    ALLOCATE ( surf_usm_h%dz_green(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)      )
-    ALLOCATE ( surf_usm_h%ddz_wall(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)      )
-    ALLOCATE ( surf_usm_h%dz_wall_stag(nzb_wall:nzt_wall,1:surf_usm_h%ns)    )
-    ALLOCATE ( surf_usm_h%ddz_wall_stag(nzb_wall:nzt_wall,1:surf_usm_h%ns)   )
-    ALLOCATE ( surf_usm_h%zw(nzb_wall:nzt_wall,1:surf_usm_h%ns)              )
-    ALLOCATE ( surf_usm_h%ddz_window(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)    )
-    ALLOCATE ( surf_usm_h%dz_window_stag(nzb_wall:nzt_wall,1:surf_usm_h%ns)  )
-    ALLOCATE ( surf_usm_h%ddz_window_stag(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%zw_window(nzb_wall:nzt_wall,1:surf_usm_h%ns)       )
-    ALLOCATE ( surf_usm_h%ddz_green(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)     )
-    ALLOCATE ( surf_usm_h%dz_green_stag(nzb_wall:nzt_wall,1:surf_usm_h%ns)   )
-    ALLOCATE ( surf_usm_h%ddz_green_stag(nzb_wall:nzt_wall,1:surf_usm_h%ns)  )
-    ALLOCATE ( surf_usm_h%zw_green(nzb_wall:nzt_wall,1:surf_usm_h%ns)        )
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%dz_wall(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)       )
+       ALLOCATE ( surf_usm_h(l)%dz_window(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)     )
+       ALLOCATE ( surf_usm_h(l)%dz_green(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)      )
+       ALLOCATE ( surf_usm_h(l)%ddz_wall(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)      )
+       ALLOCATE ( surf_usm_h(l)%dz_wall_stag(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)    )
+       ALLOCATE ( surf_usm_h(l)%ddz_wall_stag(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)   )
+       ALLOCATE ( surf_usm_h(l)%zw(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)              )
+       ALLOCATE ( surf_usm_h(l)%ddz_window(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)    )
+       ALLOCATE ( surf_usm_h(l)%dz_window_stag(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)  )
+       ALLOCATE ( surf_usm_h(l)%ddz_window_stag(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%zw_window(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)       )
+       ALLOCATE ( surf_usm_h(l)%ddz_green(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)     )
+       ALLOCATE ( surf_usm_h(l)%dz_green_stag(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)   )
+       ALLOCATE ( surf_usm_h(l)%ddz_green_stag(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)  )
+       ALLOCATE ( surf_usm_h(l)%zw_green(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns)        )
+    ENDDO
 
 !
@@ -1149,48 +1098,49 @@
 !-- Allocate wall and roof temperature arrays, for horizontal walls.
 !-- Allocate if required. Note, in case of restarts, some of these arrays might be already allocated.
-    IF ( .NOT. ALLOCATED( t_surf_wall_h_1 ) )                                                      &
-       ALLOCATE ( t_surf_wall_h_1(1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_surf_wall_h_2 ) )                                                      &
-       ALLOCATE ( t_surf_wall_h_2(1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_wall_h_1 ) )                                                           &
-       ALLOCATE ( t_wall_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_wall_h_2 ) )                                                           &
-       ALLOCATE ( t_wall_h_2(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_surf_window_h_1 ) )                                                    &
-       ALLOCATE ( t_surf_window_h_1(1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_surf_window_h_2 ) )                                                    &
-       ALLOCATE ( t_surf_window_h_2(1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_window_h_1 ) )                                                         &
-       ALLOCATE ( t_window_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_window_h_2 ) )                                                         &
-       ALLOCATE ( t_window_h_2(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_surf_green_h_1 ) )                                                     &
-       ALLOCATE ( t_surf_green_h_1(1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_surf_green_h_2 ) )                                                     &
-       ALLOCATE ( t_surf_green_h_2(1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_green_h_1 ) )                                                          &
-       ALLOCATE ( t_green_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( t_green_h_2 ) )                                                          &
-       ALLOCATE ( t_green_h_2(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( swc_h_1 ) )                                                              &
-       ALLOCATE ( swc_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( swc_sat_h_1 ) )                                                          &
-       ALLOCATE ( swc_sat_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( swc_res_h_1 ) )                                                          &
-       ALLOCATE ( swc_res_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( swc_h_2 ) )                                                              &
-       ALLOCATE ( swc_h_2(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( rootfr_h_1 ) )                                                           &
-       ALLOCATE ( rootfr_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( wilt_h_1 ) )                                                             &
-       ALLOCATE ( wilt_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( fc_h_1 ) )                                                               &
-       ALLOCATE ( fc_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-
-    IF ( .NOT. ALLOCATED( m_liq_usm_h_1%var_usm_1d ) )                                             &
-       ALLOCATE ( m_liq_usm_h_1%var_usm_1d(1:surf_usm_h%ns) )
-    IF ( .NOT. ALLOCATED( m_liq_usm_h_2%var_usm_1d ) )                                             &
-       ALLOCATE ( m_liq_usm_h_2%var_usm_1d(1:surf_usm_h%ns) )
-
+    DO l = 0, 1
+       IF ( .NOT. ALLOCATED( t_surf_wall_h_1(l)%val ) )                                                      &
+          ALLOCATE ( t_surf_wall_h_1(l)%val(1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_wall_h_2(l)%val ) )                                                      &
+          ALLOCATE ( t_surf_wall_h_2(l)%val(1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_wall_h_1(l)%val ) )                                                           &
+          ALLOCATE ( t_wall_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_wall_h_2(l)%val ) )                                                           &
+          ALLOCATE ( t_wall_h_2(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_window_h_1(l)%val ) )                                                    &
+          ALLOCATE ( t_surf_window_h_1(l)%val(1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_window_h_2(l)%val ) )                                                    &
+          ALLOCATE ( t_surf_window_h_2(l)%val(1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_window_h_1(l)%val ) )                                                         &
+          ALLOCATE ( t_window_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_window_h_2(l)%val ) )                                                         &
+          ALLOCATE ( t_window_h_2(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_green_h_1(l)%val ) )                                                     &
+          ALLOCATE ( t_surf_green_h_1(l)%val(1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_green_h_2(l)%val ) )                                                     &
+          ALLOCATE ( t_surf_green_h_2(l)%val(1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_green_h_1(l)%val ) )                                                          &
+          ALLOCATE ( t_green_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_green_h_2(l)%val ) )                                                          &
+          ALLOCATE ( t_green_h_2(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( swc_h_1(l)%val ) )                                                              &
+          ALLOCATE ( swc_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( swc_sat_h_1(l)%val ) )                                                          &
+          ALLOCATE ( swc_sat_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( swc_res_h_1(l)%val ) )                                                          &
+          ALLOCATE ( swc_res_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( swc_h_2(l)%val ) )                                                              &
+          ALLOCATE ( swc_h_2(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( rootfr_h_1(l)%val ) )                                                           &
+          ALLOCATE ( rootfr_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( wilt_h_1(l)%val ) )                                                             &
+          ALLOCATE ( wilt_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( fc_h_1(l)%val ) )                                                               &
+          ALLOCATE ( fc_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+
+       IF ( .NOT. ALLOCATED( m_liq_usm_h_1(l)%val ) )                                             &
+          ALLOCATE ( m_liq_usm_h_1(l)%val(1:surf_usm_h(l)%ns) )
+       IF ( .NOT. ALLOCATED( m_liq_usm_h_2(l)%val ) )                                             &
+          ALLOCATE ( m_liq_usm_h_2(l)%val(1:surf_usm_h(l)%ns) )
+    ENDDO
 !
 !-- Initial assignment of the pointers
@@ -1213,28 +1163,28 @@
 !-- Allocate if required. Note, in case of restarts, some of these arrays might be already allocated.
     DO  l = 0, 3
-       IF ( .NOT. ALLOCATED( t_surf_wall_v_1(l)%t ) )                                              &
-          ALLOCATE ( t_surf_wall_v_1(l)%t(1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_surf_wall_v_2(l)%t ) )                                              &
-          ALLOCATE ( t_surf_wall_v_2(l)%t(1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_wall_v_1(l)%t ) )                                                   &
-          ALLOCATE ( t_wall_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_wall_v_2(l)%t ) )                                                   &
-          ALLOCATE ( t_wall_v_2(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_surf_window_v_1(l)%t ) )                                            &
-          ALLOCATE ( t_surf_window_v_1(l)%t(1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_surf_window_v_2(l)%t ) )                                            &
-          ALLOCATE ( t_surf_window_v_2(l)%t(1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_window_v_1(l)%t ) )                                                 &
-          ALLOCATE ( t_window_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_window_v_2(l)%t ) )                                                 &
-          ALLOCATE ( t_window_v_2(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_surf_green_v_1(l)%t ) )                                             &
-          ALLOCATE ( t_surf_green_v_1(l)%t(1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_surf_green_v_2(l)%t ) )                                             &
-          ALLOCATE ( t_surf_green_v_2(l)%t(1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_green_v_1(l)%t ) )                                                  &
-          ALLOCATE ( t_green_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       IF ( .NOT. ALLOCATED( t_green_v_2(l)%t ) )                                                  &
-          ALLOCATE ( t_green_v_2(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_wall_v_1(l)%val ) )                                              &
+          ALLOCATE ( t_surf_wall_v_1(l)%val(1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_wall_v_2(l)%val ) )                                              &
+          ALLOCATE ( t_surf_wall_v_2(l)%val(1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_wall_v_1(l)%val ) )                                                   &
+          ALLOCATE ( t_wall_v_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_wall_v_2(l)%val ) )                                                   &
+          ALLOCATE ( t_wall_v_2(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_window_v_1(l)%val ) )                                            &
+          ALLOCATE ( t_surf_window_v_1(l)%val(1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_window_v_2(l)%val ) )                                            &
+          ALLOCATE ( t_surf_window_v_2(l)%val(1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_window_v_1(l)%val ) )                                                 &
+          ALLOCATE ( t_window_v_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_window_v_2(l)%val ) )                                                 &
+          ALLOCATE ( t_window_v_2(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_green_v_1(l)%val ) )                                             &
+          ALLOCATE ( t_surf_green_v_1(l)%val(1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_surf_green_v_2(l)%val ) )                                             &
+          ALLOCATE ( t_surf_green_v_2(l)%val(1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_green_v_1(l)%val ) )                                                  &
+          ALLOCATE ( t_green_v_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       IF ( .NOT. ALLOCATED( t_green_v_2(l)%val ) )                                                  &
+          ALLOCATE ( t_green_v_2(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
     ENDDO
 !
@@ -1249,24 +1199,25 @@
 !
 !-- Allocate intermediate timestep arrays. For horizontal surfaces.
-    ALLOCATE ( surf_usm_h%tt_surface_wall_m(1:surf_usm_h%ns)               )
-    ALLOCATE ( surf_usm_h%tt_wall_m(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)   )
-    ALLOCATE ( surf_usm_h%tt_surface_window_m(1:surf_usm_h%ns)             )
-    ALLOCATE ( surf_usm_h%tt_window_m(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%tt_green_m(nzb_wall:nzt_wall+1,1:surf_usm_h%ns)  )
-    ALLOCATE ( surf_usm_h%tt_surface_green_m(1:surf_usm_h%ns)              )
-
-!
-!-- Allocate intermediate timestep arrays
-!-- Horizontal surfaces
-    ALLOCATE ( tm_liq_usm_h_m%var_usm_1d(1:surf_usm_h%ns) )
-    tm_liq_usm_h_m%var_usm_1d = 0.0_wp
-!
-!-- Set inital values for prognostic quantities
-    IF ( ALLOCATED( surf_usm_h%tt_surface_wall_m )   )  surf_usm_h%tt_surface_wall_m   = 0.0_wp
-    IF ( ALLOCATED( surf_usm_h%tt_wall_m )           )  surf_usm_h%tt_wall_m           = 0.0_wp
-    IF ( ALLOCATED( surf_usm_h%tt_surface_window_m ) )  surf_usm_h%tt_surface_window_m = 0.0_wp
-    IF ( ALLOCATED( surf_usm_h%tt_window_m    )      )  surf_usm_h%tt_window_m         = 0.0_wp
-    IF ( ALLOCATED( surf_usm_h%tt_green_m    )       )  surf_usm_h%tt_green_m          = 0.0_wp
-    IF ( ALLOCATED( surf_usm_h%tt_surface_green_m )  )  surf_usm_h%tt_surface_green_m  = 0.0_wp
+    DO  l = 0, 1
+       ALLOCATE ( surf_usm_h(l)%tt_surface_wall_m(1:surf_usm_h(l)%ns)               )
+       ALLOCATE ( surf_usm_h(l)%tt_wall_m(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)   )
+       ALLOCATE ( surf_usm_h(l)%tt_surface_window_m(1:surf_usm_h(l)%ns)             )
+       ALLOCATE ( surf_usm_h(l)%tt_window_m(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%tt_green_m(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns)  )
+       ALLOCATE ( surf_usm_h(l)%tt_surface_green_m(1:surf_usm_h(l)%ns)              )
+!
+!--    Allocate intermediate timestep arrays
+!--    Horizontal surfaces
+       ALLOCATE ( tm_liq_usm_h_m(l)%val(1:surf_usm_h(l)%ns) )
+       tm_liq_usm_h_m(l)%val = 0.0_wp
+!
+!--    Set inital values for prognostic quantities
+       IF ( ALLOCATED( surf_usm_h(l)%tt_surface_wall_m )   )  surf_usm_h(l)%tt_surface_wall_m   = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%tt_wall_m )           )  surf_usm_h(l)%tt_wall_m           = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%tt_surface_window_m ) )  surf_usm_h(l)%tt_surface_window_m = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%tt_window_m    )      )  surf_usm_h(l)%tt_window_m         = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%tt_green_m    )       )  surf_usm_h(l)%tt_green_m          = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%tt_surface_green_m )  )  surf_usm_h(l)%tt_surface_green_m  = 0.0_wp
+    END DO
 !
 !-- Now, for vertical surfaces
@@ -1287,20 +1238,22 @@
 !
 !-- 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%ghf(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%wshf_eb(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%wghf_eb(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%wghf_eb_window(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%wghf_eb_green(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%iwghf_eb(1:surf_usm_h%ns) )
-    ALLOCATE ( surf_usm_h%iwghf_eb_window(1:surf_usm_h%ns) )
-    IF ( ALLOCATED( surf_usm_h%ghf     ) )  surf_usm_h%ghf     = 0.0_wp
-    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
-    IF ( ALLOCATED( surf_usm_h%wghf_eb ) )  surf_usm_h%wghf_eb = 0.0_wp
-    IF ( ALLOCATED( surf_usm_h%wghf_eb_window ) )   surf_usm_h%wghf_eb_window  = 0.0_wp
-    IF ( ALLOCATED( surf_usm_h%wghf_eb_green ) )    surf_usm_h%wghf_eb_green   = 0.0_wp
-    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
+    DO  l = 0, 1
+!      ALLOCATE ( surf_usm_h(l)%wshf(1:surf_usm_h(l)%ns)    )  !can be removed
+       ALLOCATE ( surf_usm_h(l)%ghf(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%wshf_eb(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%wghf_eb(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%wghf_eb_window(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%wghf_eb_green(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%iwghf_eb(1:surf_usm_h(l)%ns) )
+       ALLOCATE ( surf_usm_h(l)%iwghf_eb_window(1:surf_usm_h(l)%ns) )
+       IF ( ALLOCATED( surf_usm_h(l)%ghf     ) )  surf_usm_h(l)%ghf     = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%wshf    ) )  surf_usm_h(l)%wshf    = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%wshf_eb ) )  surf_usm_h(l)%wshf_eb = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%wghf_eb ) )  surf_usm_h(l)%wghf_eb = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%wghf_eb_window ) )   surf_usm_h(l)%wghf_eb_window  = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%wghf_eb_green ) )    surf_usm_h(l)%wghf_eb_green   = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%iwghf_eb ) )         surf_usm_h(l)%iwghf_eb        = 0.0_wp
+       IF ( ALLOCATED( surf_usm_h(l)%iwghf_eb_window ) )  surf_usm_h(l)%iwghf_eb_window = 0.0_wp
+    ENDDO
 !
 !-- Now, for vertical surfaces
@@ -1348,12 +1301,7 @@
     INTEGER(iwp)                                       ::  i, j, k, l, m, ids, idsint, iwl, istat  !< runnin indices
     CHARACTER(LEN=varnamelength)                       ::  var                                     !< trimmed variable
-    INTEGER(iwp), PARAMETER                            ::  nd = 5                                  !< number of directions
-    CHARACTER(LEN=6), DIMENSION(0:nd-1), PARAMETER     ::  dirname = (/ '_roof ', '_south', '_north', '_west ', '_east ' /)
-    INTEGER(iwp), DIMENSION(0:nd-1), PARAMETER         ::  dirint = (/ iup, isouth, inorth, iwest, ieast /)
-
-
-
-
-    IF ( variable(1:4) == 'usm_' )  THEN  ! Is such a check really required?
+    LOGICAL                                            ::  horizontal
+
+    IF ( .NOT. variable(1:4) == 'usm_' )  RETURN  ! Is such a check really required?
 
 !
@@ -1368,26 +1316,30 @@
            ids = i
            idsint = dirint(ids)
+           l = diridx(ids)  !> index of direction for _h and _v arrays
            var = var(:k-j)
            EXIT
        ENDIF
     ENDDO
-    l = idsint - 2  ! Horizontal direction index - terrible hack !
-    IF ( l < 0 .OR. l > 3 )  THEN
-       l = -1
-    ENDIF
     IF ( ids == -1 )  THEN
         var = TRIM( variable )
+    ELSE
+!--    Horizontal direction flag
+       IF ( idsint == iup .OR. idsint == idown )  THEN
+          horizontal = .TRUE.
+       ELSE
+          horizontal = .FALSE.
+       ENDIF
     ENDIF
     IF ( var(1:11) == 'usm_t_wall_'  .AND.  len( TRIM( var ) ) >= 12 )  THEN
 !
-!--      Wall layers
-        READ( var(12:12), '(I1)', iostat=istat ) iwl
-        IF ( istat == 0  .AND.  iwl >= nzb_wall  .AND.  iwl <= nzt_wall )  THEN
-            var = var(1:10)
-        ELSE
-!
-!--         Wrong wall layer index
-            RETURN
-        ENDIF
+!--    Wall layers
+       READ( var(12:12), '(I1)', iostat=istat ) iwl
+       IF ( istat == 0  .AND.  iwl >= nzb_wall  .AND.  iwl <= nzt_wall )  THEN
+          var = var(1:10)
+       ELSE
+!
+!--       Wrong wall layer index
+          RETURN
+       ENDIF
     ENDIF
     IF ( var(1:13) == 'usm_t_window_'  .AND.  len( TRIM(var) ) >= 14 )  THEN
@@ -1436,8 +1388,8 @@
 !--             Array of sensible heat flux from surfaces
 !--             Land surfaces
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%wshf_eb_av ) )  THEN
-                      ALLOCATE ( surf_usm_h%wshf_eb_av(1:surf_usm_h%ns) )
-                      surf_usm_h%wshf_eb_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%wshf_eb_av ) )  THEN
+                      ALLOCATE ( surf_usm_h(l)%wshf_eb_av(1:surf_usm_h(l)%ns) )
+                      surf_usm_h(l)%wshf_eb_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1452,7 +1404,7 @@
 !--             Array of latent heat flux from surfaces
 !--             Land surfaces
-                IF ( l == -1 .AND. .NOT.  ALLOCATED( surf_usm_h%qsws_av ) )  THEN
-                    ALLOCATE ( surf_usm_h%qsws_av(1:surf_usm_h%ns) )
-                    surf_usm_h%qsws_av = 0.0_wp
+                IF ( horizontal .AND. .NOT.  ALLOCATED( surf_usm_h(l)%qsws_av ) )  THEN
+                    ALLOCATE ( surf_usm_h(l)%qsws_av(1:surf_usm_h(l)%ns) )
+                    surf_usm_h(l)%qsws_av = 0.0_wp
                 ELSE
                    IF ( .NOT.  ALLOCATED( surf_usm_v(l)%qsws_av ) )  THEN
@@ -1466,7 +1418,7 @@
 !--             Array of latent heat flux from vegetation surfaces
 !--             Land surfaces
-                IF ( l == -1 .AND. .NOT.  ALLOCATED( surf_usm_h%qsws_veg_av ) )  THEN
-                    ALLOCATE ( surf_usm_h%qsws_veg_av(1:surf_usm_h%ns) )
-                    surf_usm_h%qsws_veg_av = 0.0_wp
+                IF ( horizontal .AND. .NOT.  ALLOCATED( surf_usm_h(l)%qsws_veg_av ) )  THEN
+                    ALLOCATE ( surf_usm_h(l)%qsws_veg_av(1:surf_usm_h(l)%ns) )
+                    surf_usm_h(l)%qsws_veg_av = 0.0_wp
                 ELSE
                    IF ( .NOT.  ALLOCATED( surf_usm_v(l)%qsws_veg_av ) )  THEN
@@ -1480,7 +1432,7 @@
 !--             Array of latent heat flux from surfaces with liquid
 !--             Land surfaces
-                IF ( l == -1 .AND. .NOT.  ALLOCATED( surf_usm_h%qsws_liq_av ) )  THEN
-                    ALLOCATE ( surf_usm_h%qsws_liq_av(1:surf_usm_h%ns) )
-                    surf_usm_h%qsws_liq_av = 0.0_wp
+                IF ( horizontal .AND. .NOT.  ALLOCATED( surf_usm_h(l)%qsws_liq_av ) )  THEN
+                    ALLOCATE ( surf_usm_h(l)%qsws_liq_av(1:surf_usm_h(l)%ns) )
+                    surf_usm_h(l)%qsws_liq_av = 0.0_wp
                 ELSE
                    IF ( .NOT.  ALLOCATED( surf_usm_v(l)%qsws_liq_av ) )  THEN
@@ -1496,8 +1448,8 @@
 !
 !--             Array of heat flux from ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%wghf_eb_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%wghf_eb_av(1:surf_usm_h%ns) )
-                       surf_usm_h%wghf_eb_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%wghf_eb_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%wghf_eb_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%wghf_eb_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1511,8 +1463,8 @@
 !
 !--             Array of heat flux from window ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%wghf_eb_window_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%wghf_eb_window_av(1:surf_usm_h%ns) )
-                       surf_usm_h%wghf_eb_window_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%wghf_eb_window_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%wghf_eb_window_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%wghf_eb_window_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1526,8 +1478,8 @@
 !
 !--             Array of heat flux from green ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%wghf_eb_green_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%wghf_eb_green_av(1:surf_usm_h%ns) )
-                       surf_usm_h%wghf_eb_green_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%wghf_eb_green_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%wghf_eb_green_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%wghf_eb_green_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1541,8 +1493,8 @@
 !
 !--             Array of heat flux from indoor ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%iwghf_eb_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%iwghf_eb_av(1:surf_usm_h%ns) )
-                       surf_usm_h%iwghf_eb_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%iwghf_eb_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%iwghf_eb_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%iwghf_eb_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1556,8 +1508,8 @@
 !
 !--             Array of heat flux from indoor window ground (wall, roof, land)
-                IF ( l == -1 ) THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%iwghf_eb_window_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%iwghf_eb_window_av(1:surf_usm_h%ns) )
-                       surf_usm_h%iwghf_eb_window_av = 0.0_wp
+                IF ( horizontal ) THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%iwghf_eb_window_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%iwghf_eb_window_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%iwghf_eb_window_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1571,8 +1523,8 @@
 !
 !--             Surface temperature for surfaces
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%t_surf_wall_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%t_surf_wall_av(1:surf_usm_h%ns) )
-                       surf_usm_h%t_surf_wall_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%t_surf_wall_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%t_surf_wall_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%t_surf_wall_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1586,8 +1538,8 @@
 !
 !--             Surface temperature for window surfaces
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%t_surf_window_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%t_surf_window_av(1:surf_usm_h%ns) )
-                       surf_usm_h%t_surf_window_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%t_surf_window_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%t_surf_window_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%t_surf_window_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1601,8 +1553,8 @@
 !
 !--             Surface temperature for green surfaces
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%t_surf_green_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%t_surf_green_av(1:surf_usm_h%ns) )
-                       surf_usm_h%t_surf_green_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%t_surf_green_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%t_surf_green_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%t_surf_green_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1616,8 +1568,8 @@
 !
 !--             Near surface (10cm) temperature for whole surfaces
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%pt_10cm_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%pt_10cm_av(1:surf_usm_h%ns) )
-                       surf_usm_h%pt_10cm_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%pt_10cm_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%pt_10cm_av(1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%pt_10cm_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1631,8 +1583,8 @@
 !
 !--             Wall temperature for iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%t_wall_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%t_wall_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-                       surf_usm_h%t_wall_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%t_wall_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%t_wall_av(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%t_wall_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1646,8 +1598,8 @@
 !
 !--             Window temperature for iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%t_window_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%t_window_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-                       surf_usm_h%t_window_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%t_window_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%t_window_av(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%t_window_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1661,8 +1613,8 @@
 !
 !--             Green temperature for iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   IF ( .NOT.  ALLOCATED( surf_usm_h%t_green_av ) )  THEN
-                       ALLOCATE ( surf_usm_h%t_green_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-                       surf_usm_h%t_green_av = 0.0_wp
+                IF ( horizontal )  THEN
+                   IF ( .NOT.  ALLOCATED( surf_usm_h(l)%t_green_av ) )  THEN
+                       ALLOCATE ( surf_usm_h(l)%t_green_av(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns) )
+                       surf_usm_h(l)%t_green_av = 0.0_wp
                    ENDIF
                 ELSE
@@ -1675,7 +1627,7 @@
 !
 !--             Soil water content for iwl layer of walls and land
-                IF ( l == -1 .AND. .NOT.  ALLOCATED( surf_usm_h%swc_av ) )  THEN
-                    ALLOCATE ( surf_usm_h%swc_av(nzb_wall:nzt_wall,1:surf_usm_h%ns) )
-                    surf_usm_h%swc_av = 0.0_wp
+                IF ( horizontal .AND. .NOT.  ALLOCATED( surf_usm_h(l)%swc_av ) )  THEN
+                    ALLOCATE ( surf_usm_h(l)%swc_av(nzb_wall:nzt_wall,1:surf_usm_h(l)%ns) )
+                    surf_usm_h(l)%swc_av = 0.0_wp
                 ELSE
                    IF ( .NOT.  ALLOCATED( surf_usm_v(l)%swc_av ) )  THEN
@@ -1697,7 +1649,7 @@
 !
 !--             Array of sensible heat flux from surfaces (land, roof, wall)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wshf_eb_av(m) = surf_usm_h%wshf_eb_av(m) + surf_usm_h%wshf_eb(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wshf_eb_av(m) = surf_usm_h(l)%wshf_eb_av(m) + surf_usm_h(l)%wshf_eb(m)
                    ENDDO
                 ELSE
@@ -1711,7 +1663,7 @@
 !
 !--             Array of latent heat flux from surfaces (land, roof, wall)
-                IF ( l == -1 ) THEN
-                DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%qsws_av(m) = surf_usm_h%qsws_av(m) + surf_usm_h%qsws(m) * l_v
+                IF ( horizontal ) THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%qsws_av(m) = surf_usm_h(l)%qsws_av(m) + surf_usm_h(l)%qsws(m) * l_v
                 ENDDO
                 ELSE
@@ -1725,7 +1677,7 @@
 !
 !--             Array of latent heat flux from vegetation surfaces (land, roof, wall)
-                IF ( l == -1 )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%qsws_veg_av(m) = surf_usm_h%qsws_veg_av(m) + surf_usm_h%qsws_veg(m)
+                IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%qsws_veg_av(m) = surf_usm_h(l)%qsws_veg_av(m) + surf_usm_h(l)%qsws_veg(m)
                 ENDDO
                 ELSE
@@ -1739,8 +1691,8 @@
 !
 !--             Array of latent heat flux from surfaces with liquid (land, roof, wall)
-                IF ( l == -1 ) THEN
-                DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%qsws_liq_av(m) = surf_usm_h%qsws_liq_av(m) +                         &
-                                               surf_usm_h%qsws_liq(m)
+                IF ( horizontal ) THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%qsws_liq_av(m) = surf_usm_h(l)%qsws_liq_av(m) +                         &
+                                               surf_usm_h(l)%qsws_liq(m)
                 ENDDO
                 ELSE
@@ -1754,8 +1706,8 @@
 !
 !--             Array of heat flux from ground (wall, roof, land)
-                IF ( l == -1 ) THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wghf_eb_av(m) = surf_usm_h%wghf_eb_av(m) +                        &
-                                                 surf_usm_h%wghf_eb(m)
+                IF ( horizontal ) THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wghf_eb_av(m) = surf_usm_h(l)%wghf_eb_av(m) +                        &
+                                                 surf_usm_h(l)%wghf_eb(m)
                    ENDDO
                 ELSE
@@ -1769,8 +1721,8 @@
 !
 !--             Array of heat flux from window ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wghf_eb_window_av(m) = surf_usm_h%wghf_eb_window_av(m) +          &
-                                                        surf_usm_h%wghf_eb_window(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wghf_eb_window_av(m) = surf_usm_h(l)%wghf_eb_window_av(m) +          &
+                                                        surf_usm_h(l)%wghf_eb_window(m)
                    ENDDO
                 ELSE
@@ -1784,8 +1736,8 @@
 !
 !--             Array of heat flux from green ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wghf_eb_green_av(m) = surf_usm_h%wghf_eb_green_av(m) +            &
-                                                       surf_usm_h%wghf_eb_green(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wghf_eb_green_av(m) = surf_usm_h(l)%wghf_eb_green_av(m) +            &
+                                                       surf_usm_h(l)%wghf_eb_green(m)
                    ENDDO
                 ELSE
@@ -1799,7 +1751,7 @@
 !
 !--             Array of heat flux from indoor ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%iwghf_eb_av(m) = surf_usm_h%iwghf_eb_av(m) + surf_usm_h%iwghf_eb(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%iwghf_eb_av(m) = surf_usm_h(l)%iwghf_eb_av(m) + surf_usm_h(l)%iwghf_eb(m)
                    ENDDO
                 ELSE
@@ -1813,8 +1765,8 @@
 !
 !--             Array of heat flux from indoor window ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%iwghf_eb_window_av(m) = surf_usm_h%iwghf_eb_window_av(m) +        &
-                                                         surf_usm_h%iwghf_eb_window(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%iwghf_eb_window_av(m) = surf_usm_h(l)%iwghf_eb_window_av(m) +        &
+                                                         surf_usm_h(l)%iwghf_eb_window(m)
                    ENDDO
                 ELSE
@@ -1828,12 +1780,12 @@
 !
 !--             Surface temperature for surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%t_surf_wall_av(m) = surf_usm_h%t_surf_wall_av(m) + t_surf_wall_h(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%t_surf_wall_av(m) = surf_usm_h(l)%t_surf_wall_av(m) + t_surf_wall_h(l)%val(m)
                    ENDDO
                 ELSE
                    DO  m = 1, surf_usm_v(l)%ns
                       surf_usm_v(l)%t_surf_wall_av(m) = surf_usm_v(l)%t_surf_wall_av(m) +          &
-                                                        t_surf_wall_v(l)%t(m)
+                                                        t_surf_wall_v(l)%val(m)
                    ENDDO
                 ENDIF
@@ -1842,13 +1794,13 @@
 !
 !--             Surface temperature for window surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_surf_window_av(m) = surf_usm_h%t_surf_window_av(m) +            &
-                                                       t_surf_window_h(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_surf_window_av(m) = surf_usm_h(l)%t_surf_window_av(m) +            &
+                                                       t_surf_window_h(l)%val(m)
                    ENDDO
                 ELSE
                    DO  m = 1, surf_usm_v(l)%ns
                       surf_usm_v(l)%t_surf_window_av(m) = surf_usm_v(l)%t_surf_window_av(m) +      &
-                                                          t_surf_window_v(l)%t(m)
+                                                          t_surf_window_v(l)%val(m)
                    ENDDO
                 ENDIF
@@ -1857,13 +1809,13 @@
 !
 !--             Surface temperature for green surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_surf_green_av(m) = surf_usm_h%t_surf_green_av(m) +              &
-                                                      t_surf_green_h(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_surf_green_av(m) = surf_usm_h(l)%t_surf_green_av(m) +              &
+                                                      t_surf_green_h(l)%val(m)
                    ENDDO
                 ELSE
                    DO  m = 1, surf_usm_v(l)%ns
                       surf_usm_v(l)%t_surf_green_av(m) = surf_usm_v(l)%t_surf_green_av(m) +        &
-                                                         t_surf_green_v(l)%t(m)
+                                                         t_surf_green_v(l)%val(m)
                    ENDDO
                 ENDIF
@@ -1872,8 +1824,8 @@
 !
 !--             Near surface temperature for whole surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%pt_10cm_av(m) = surf_usm_h%pt_10cm_av(m) +                        &
-                                                 surf_usm_h%pt_10cm(m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%pt_10cm_av(m) = surf_usm_h(l)%pt_10cm_av(m) +                        &
+                                                 surf_usm_h(l)%pt_10cm(m)
                    ENDDO
                 ELSE
@@ -1887,13 +1839,13 @@
 !
 !--             Wall temperature for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_wall_av(iwl,m) = surf_usm_h%t_wall_av(iwl,m) +                  &
-                                                    t_wall_h(iwl,m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_wall_av(iwl,m) = surf_usm_h(l)%t_wall_av(iwl,m) +                  &
+                                                    t_wall_h(l)%val(iwl,m)
                    ENDDO
                 ELSE
                    DO  m = 1, surf_usm_v(l)%ns
                       surf_usm_v(l)%t_wall_av(iwl,m) = surf_usm_v(l)%t_wall_av(iwl,m) +            &
-                                                       t_wall_v(l)%t(iwl,m)
+                                                       t_wall_v(l)%val(iwl,m)
                    ENDDO
                 ENDIF
@@ -1902,13 +1854,13 @@
 !
 !--             Window temperature for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_window_av(iwl,m) = surf_usm_h%t_window_av(iwl,m) +              &
-                                                      t_window_h(iwl,m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_window_av(iwl,m) = surf_usm_h(l)%t_window_av(iwl,m) +              &
+                                                         t_window_h(l)%val(iwl,m)
                    ENDDO
                 ELSE
                    DO  m = 1, surf_usm_v(l)%ns
                       surf_usm_v(l)%t_window_av(iwl,m) = surf_usm_v(l)%t_window_av(iwl,m) +        &
-                                                         t_window_v(l)%t(iwl,m)
+                                                         t_window_v(l)%val(iwl,m)
                    ENDDO
                 ENDIF
@@ -1917,12 +1869,12 @@
 !
 !--             Green temperature for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_green_av(iwl,m) = surf_usm_h%t_green_av(iwl,m) + t_green_h(iwl,m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_green_av(iwl,m) = surf_usm_h(l)%t_green_av(iwl,m) + t_green_h(l)%val(iwl,m)
                    ENDDO
                 ELSE
                    DO  m = 1, surf_usm_v(l)%ns
                       surf_usm_v(l)%t_green_av(iwl,m) = surf_usm_v(l)%t_green_av(iwl,m) +          &
-                                                        t_green_v(l)%t(iwl,m)
+                                                        t_green_v(l)%val(iwl,m)
                    ENDDO
                 ENDIF
@@ -1931,7 +1883,7 @@
 !
 !--             Soil water content for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%swc_av(iwl,m) = surf_usm_h%swc_av(iwl,m) + swc_h(iwl,m)
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%swc_av(iwl,m) = surf_usm_h(l)%swc_av(iwl,m) + swc_h(l)%val(iwl,m)
                    ENDDO
                 ELSE
@@ -1950,7 +1902,7 @@
 !
 !--             Array of sensible heat flux from surfaces (land, roof, wall)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wshf_eb_av(m) = surf_usm_h%wshf_eb_av(m) /                        &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wshf_eb_av(m) = surf_usm_h(l)%wshf_eb_av(m) /                        &
                                                  REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -1965,7 +1917,7 @@
 !
 !--             Array of latent heat flux from surfaces (land, roof, wall)
-                IF ( l == -1 )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%qsws_av(m) = surf_usm_h%qsws_av(m) /                                 &
+                IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%qsws_av(m) = surf_usm_h(l)%qsws_av(m) /                                 &
                                            REAL( average_count_3d, kind=wp )
                 ENDDO
@@ -1980,7 +1932,7 @@
 !
 !--             Array of latent heat flux from vegetation surfaces (land, roof, wall)
-                IF ( l == -1 )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%qsws_veg_av(m) = surf_usm_h%qsws_veg_av(m) /                         &
+                IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%qsws_veg_av(m) = surf_usm_h(l)%qsws_veg_av(m) /                         &
                                                REAL( average_count_3d, kind=wp )
                 ENDDO
@@ -1995,7 +1947,7 @@
 !
 !--             Array of latent heat flux from surfaces with liquid (land, roof, wall)
-                IF ( l == -1 )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%qsws_liq_av(m) = surf_usm_h%qsws_liq_av(m) /                         &
+                IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%qsws_liq_av(m) = surf_usm_h(l)%qsws_liq_av(m) /                         &
                                                REAL( average_count_3d, kind=wp )
                 ENDDO
@@ -2010,7 +1962,7 @@
 !
 !--             Array of heat flux from ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wghf_eb_av(m) = surf_usm_h%wghf_eb_av(m) /                        &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wghf_eb_av(m) = surf_usm_h(l)%wghf_eb_av(m) /                        &
                                                  REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2025,7 +1977,7 @@
 !
 !--             Array of heat flux from window ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wghf_eb_window_av(m) = surf_usm_h%wghf_eb_window_av(m) /          &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wghf_eb_window_av(m) = surf_usm_h(l)%wghf_eb_window_av(m) /          &
                                                         REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2040,7 +1992,7 @@
 !
 !--             Array of heat flux from green ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%wghf_eb_green_av(m) = surf_usm_h%wghf_eb_green_av(m) /            &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%wghf_eb_green_av(m) = surf_usm_h(l)%wghf_eb_green_av(m) /            &
                                                        REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2055,7 +2007,7 @@
 !
 !--             Array of heat flux from indoor ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%iwghf_eb_av(m) = surf_usm_h%iwghf_eb_av(m) /                      &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%iwghf_eb_av(m) = surf_usm_h(l)%iwghf_eb_av(m) /                      &
                                                   REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2070,7 +2022,7 @@
 !
 !--             Array of heat flux from indoor window ground (wall, roof, land)
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%iwghf_eb_window_av(m) = surf_usm_h%iwghf_eb_window_av(m) /        &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%iwghf_eb_window_av(m) = surf_usm_h(l)%iwghf_eb_window_av(m) /        &
                                                          REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2085,7 +2037,7 @@
 !
 !--             Surface temperature for surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%t_surf_wall_av(m) = surf_usm_h%t_surf_wall_av(m) /                   &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%t_surf_wall_av(m) = surf_usm_h(l)%t_surf_wall_av(m) /                   &
                                                   REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2100,7 +2052,7 @@
 !
 !--             Surface temperature for window surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_surf_window_av(m) = surf_usm_h%t_surf_window_av(m) /            &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_surf_window_av(m) = surf_usm_h(l)%t_surf_window_av(m) /            &
                                                        REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2115,7 +2067,7 @@
 !
 !--             Surface temperature for green surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_surf_green_av(m) = surf_usm_h%t_surf_green_av(m) /              &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_surf_green_av(m) = surf_usm_h(l)%t_surf_green_av(m) /              &
                                                       REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2130,7 +2082,7 @@
 !
 !--             Near surface temperature for whole surfaces
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%pt_10cm_av(m) = surf_usm_h%pt_10cm_av(m) /                        &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%pt_10cm_av(m) = surf_usm_h(l)%pt_10cm_av(m) /                        &
                                                  REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2146,7 +2098,7 @@
 !
 !--             Wall temperature for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_wall_av(iwl,m) = surf_usm_h%t_wall_av(iwl,m) /                  &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_wall_av(iwl,m) = surf_usm_h(l)%t_wall_av(iwl,m) /                  &
                                                     REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2161,7 +2113,7 @@
 !
 !--             Window temperature for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_window_av(iwl,m) = surf_usm_h%t_window_av(iwl,m) /              &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_window_av(iwl,m) = surf_usm_h(l)%t_window_av(iwl,m) /              &
                                                       REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2176,7 +2128,7 @@
 !
 !--             Green temperature for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                   DO  m = 1, surf_usm_h%ns
-                      surf_usm_h%t_green_av(iwl,m) = surf_usm_h%t_green_av(iwl,m) /                &
+                IF ( horizontal )  THEN
+                   DO  m = 1, surf_usm_h(l)%ns
+                      surf_usm_h(l)%t_green_av(iwl,m) = surf_usm_h(l)%t_green_av(iwl,m) /                &
                                                      REAL( average_count_3d, kind=wp )
                    ENDDO
@@ -2191,7 +2143,7 @@
 !
 !--             Soil water content for  iwl layer of walls and land
-                IF ( l == -1 )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   surf_usm_h%swc_av(iwl,m) = surf_usm_h%swc_av(iwl,m) /                           &
+                IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   surf_usm_h(l)%swc_av(iwl,m) = surf_usm_h(l)%swc_av(iwl,m) /                           &
                                               REAL( average_count_3d, kind=wp )
                 ENDDO
@@ -2208,6 +2160,4 @@
     ENDIF
 
-    ENDIF
-
  END SUBROUTINE usm_3d_data_averaging
 
@@ -2232,10 +2182,12 @@
     INTEGER(iwp) ::  m      !< running index surface elements
 
-    koff = surf_usm_h%koff
-    DO  m = 1, surf_usm_h%ns
-       i = surf_usm_h%i(m)
-       j = surf_usm_h%j(m)
-       k = surf_usm_h%k(m)
-       pt(k+koff,j,i) = pt(k,j,i)
+    DO  l = 0, 1
+       koff = surf_usm_h(l)%koff
+       DO  m = 1, surf_usm_h(l)%ns
+          i = surf_usm_h(l)%i(m)
+          j = surf_usm_h(l)%j(m)
+          k = surf_usm_h(l)%k(m)
+          pt(k+koff,j,i) = pt(k,j,i)
+       ENDDO
     ENDDO
 
@@ -2297,8 +2249,4 @@
                 'usm_t_window                  ', &
                 'usm_t_green                   '/)
-
-    INTEGER(iwp), PARAMETER                       ::  nd = 5     !< number of directions
-    CHARACTER(LEN=6), DIMENSION(nd), PARAMETER    ::  dirname = &  !< direction names
-              (/'_roof ','_south','_north','_west ','_east '/)
 
     LOGICAL                                       ::  lfound     !< flag if the variable is found
@@ -2415,11 +2363,4 @@
        message_string = 'topography /= "flat" is required when using the urban surface model'
        CALL message( 'usm_check_parameters', 'PA0592', 1, 2, 0, 6, 0 )
-    ENDIF
-!
-!-- Naheatlayers
-    IF ( naheatlayers > nzt )  THEN
-       message_string = 'number of anthropogenic heat layers "naheatlayers" can not be larger ' // &
-                        'than number of domain layers "nzt"'
-       CALL message( 'usm_check_parameters', 'PA0593', 1, 2, 0, 6, 0 )
     ENDIF
 !
@@ -2466,13 +2407,7 @@
     INTEGER(iwp), INTENT(IN)       ::  nzt_do    !< vertical upper limit of the data output (usually nz_do3d)
 
-    INTEGER(iwp), PARAMETER                            ::  nd = 5  !< number of directions
-    INTEGER(iwp), DIMENSION(0:nd-1), PARAMETER         ::  dirint =  (/      iup,   isouth,   inorth,    iwest,    ieast /)  !<
-    INTEGER(iwp), DIMENSION(0:nd-1), PARAMETER         ::  diridx =  (/       -1,        1,        0,        3,        2 /)
-                                                           !< index for surf_*_v: 0:3 = (North, South, East, West)
-    CHARACTER(LEN=6), DIMENSION(0:nd-1), PARAMETER     ::  dirname = (/ '_roof ', '_south', '_north', '_west ', '_east ' /)  !<
-
-
     INTEGER(iwp)  ::  ids, idsint, idsidx        !<
     INTEGER(iwp)  ::  i, j, k, iwl, istat, l, m  !< running indices
+    LOGICAL       ::  horizontal                 !< horizontal upward or downeard facing surface
 
     LOGICAL, INTENT(OUT)           ::  found     !<
@@ -2497,4 +2432,7 @@
         ENDIF
     ENDDO
+    horizontal = ( ( idsint == iup ) .OR. (idsint == idown ) )
+    l = idsidx !< shorter direction index name
+
     IF ( ids == -1 )  THEN
         var = TRIM( variable )
@@ -2538,13 +2476,12 @@
 !
 !--       Array of surface height (z)
-          IF ( idsint == iup )  THEN
-             DO  m = 1, surf_usm_h%ns
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                k = surf_usm_h%k(m)
+          IF ( horizontal )  THEN
+             DO  m = 1, surf_usm_h(l)%ns
+                i = surf_usm_h(l)%i(m)
+                j = surf_usm_h(l)%j(m)
+                k = surf_usm_h(l)%k(m)
                 temp_pf(0,j,i) = MAX( temp_pf(0,j,i), REAL( k, KIND = sp) )
              ENDDO
           ELSE
-             l = idsidx
              DO  m = 1, surf_usm_v(l)%ns
                 i = surf_usm_v(l)%i(m)
@@ -2558,13 +2495,12 @@
 !
 !--       Surface category
-          IF ( idsint == iup )  THEN
-             DO  m = 1, surf_usm_h%ns
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                k = surf_usm_h%k(m)
-                temp_pf(k,j,i) = surf_usm_h%surface_types(m)
+          IF ( horizontal )  THEN
+             DO  m = 1, surf_usm_h(l)%ns
+                i = surf_usm_h(l)%i(m)
+                j = surf_usm_h(l)%j(m)
+                k = surf_usm_h(l)%k(m)
+                temp_pf(k,j,i) = surf_usm_h(l)%surface_types(m)
              ENDDO
           ELSE
-             l = idsidx
              DO  m = 1, surf_usm_v(l)%ns
                 i = surf_usm_v(l)%i(m)
@@ -2578,13 +2514,12 @@
 !
 !--       Transmissivity window tiles
-          IF ( idsint == iup )  THEN
-             DO  m = 1, surf_usm_h%ns
-                i = surf_usm_h%i(m)
-                j = surf_usm_h%j(m)
-                k = surf_usm_h%k(m)
-                temp_pf(k,j,i) = surf_usm_h%transmissivity(m)
+          IF ( horizontal )  THEN
+             DO  m = 1, surf_usm_h(l)%ns
+                i = surf_usm_h(l)%i(m)
+                j = surf_usm_h(l)%j(m)
+                k = surf_usm_h(l)%k(m)
+                temp_pf(k,j,i) = surf_usm_h(l)%transmissivity(m)
              ENDDO
           ELSE
-             l = idsidx
              DO  m = 1, surf_usm_v(l)%ns
                 i = surf_usm_v(l)%i(m)
@@ -2599,13 +2534,12 @@
 !--       Array of sensible heat flux from surfaces
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wshf_eb(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wshf_eb(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2616,13 +2550,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wshf_eb_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wshf_eb_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2639,13 +2572,12 @@
 !--       Array of latent heat flux from surfaces
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%qsws(m) * l_v
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%qsws(m) * l_v
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2656,13 +2588,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%qsws_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%qsws_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2678,13 +2609,12 @@
 !--       Array of latent heat flux from vegetation surfaces
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%qsws_veg(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%qsws_veg(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2695,13 +2625,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%qsws_veg_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%qsws_veg_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2717,13 +2646,12 @@
 !--       Array of latent heat flux from surfaces with liquid
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%qsws_liq(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%qsws_liq(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2734,13 +2662,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%qsws_liq_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%qsws_liq_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2756,13 +2683,12 @@
 !--       Array of heat flux from ground (land, wall, roof)
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wghf_eb(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wghf_eb(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2773,13 +2699,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wghf_eb_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wghf_eb_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2795,13 +2720,12 @@
 !--       Array of heat flux from window ground (land, wall, roof)
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wghf_eb_window(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wghf_eb_window(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2812,13 +2736,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wghf_eb_window_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wghf_eb_window_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2834,10 +2757,10 @@
 !--       Array of heat flux from green ground (land, wall, roof)
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wghf_eb_green(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wghf_eb_green(m)
                 ENDDO
              ELSE
@@ -2851,13 +2774,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%wghf_eb_green_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%wghf_eb_green_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2873,13 +2795,12 @@
 !--       Array of heat flux from indoor ground (land, wall, roof)
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%iwghf_eb(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%iwghf_eb(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2890,13 +2811,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%iwghf_eb_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%iwghf_eb_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2912,13 +2832,12 @@
 !--       Array of heat flux from indoor window ground (land, wall, roof)
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%iwghf_eb_window(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%iwghf_eb_window(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2929,13 +2848,12 @@
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%iwghf_eb_window_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%iwghf_eb_window_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2951,30 +2869,28 @@
 !--       Surface temperature for surfaces
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = t_surf_wall_h(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = t_surf_wall_h(l)%val(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
                    j = surf_usm_v(l)%j(m)
                    k = surf_usm_v(l)%k(m)
-                   temp_pf(k,j,i) = t_surf_wall_v(l)%t(m)
+                   temp_pf(k,j,i) = t_surf_wall_v(l)%val(m)
                 ENDDO
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%t_surf_wall_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%t_surf_wall_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -2990,31 +2906,29 @@
 !--       Surface temperature for window surfaces
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = t_surf_window_h(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = t_surf_window_h(l)%val(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
                    j = surf_usm_v(l)%j(m)
                    k = surf_usm_v(l)%k(m)
-                   temp_pf(k,j,i) = t_surf_window_v(l)%t(m)
+                   temp_pf(k,j,i) = t_surf_window_v(l)%val(m)
                 ENDDO
              ENDIF
 
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%t_surf_window_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%t_surf_window_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3032,31 +2946,29 @@
 !--       Surface temperature for green surfaces
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = t_surf_green_h(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = t_surf_green_h(l)%val(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
                    j = surf_usm_v(l)%j(m)
                    k = surf_usm_v(l)%k(m)
-                   temp_pf(k,j,i) = t_surf_green_v(l)%t(m)
+                   temp_pf(k,j,i) = t_surf_green_v(l)%val(m)
                 ENDDO
              ENDIF
 
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%t_surf_green_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%t_surf_green_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3074,13 +2986,12 @@
 !--       Near surface temperature for whole surfaces
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%pt_10cm(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%pt_10cm(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3093,13 +3004,12 @@
 
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%pt_10cm_av(m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%pt_10cm_av(m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3116,30 +3026,28 @@
 !--       Wall temperature for  iwl layer of walls and land
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = t_wall_h(iwl,m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = t_wall_h(l)%val(iwl,m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
                    j = surf_usm_v(l)%j(m)
                    k = surf_usm_v(l)%k(m)
-                   temp_pf(k,j,i) = t_wall_v(l)%t(iwl,m)
+                   temp_pf(k,j,i) = t_wall_v(l)%val(iwl,m)
                 ENDDO
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%t_wall_av(iwl,m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%t_wall_av(iwl,m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3155,30 +3063,28 @@
 !--       Window temperature for iwl layer of walls and land
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = t_window_h(iwl,m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = t_window_h(l)%val(iwl,m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
                    j = surf_usm_v(l)%j(m)
                    k = surf_usm_v(l)%k(m)
-                   temp_pf(k,j,i) = t_window_v(l)%t(iwl,m)
+                   temp_pf(k,j,i) = t_window_v(l)%val(iwl,m)
                 ENDDO
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%t_window_av(iwl,m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%t_window_av(iwl,m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3194,30 +3100,28 @@
 !--       Green temperature for  iwl layer of walls and land
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = t_green_h(iwl,m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = t_green_h(l)%val(iwl,m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
                    j = surf_usm_v(l)%j(m)
                    k = surf_usm_v(l)%k(m)
-                   temp_pf(k,j,i) = t_green_v(l)%t(iwl,m)
+                   temp_pf(k,j,i) = t_green_v(l)%val(iwl,m)
                 ENDDO
              ENDIF
           ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%t_green_av(iwl,m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%t_green_av(iwl,m)
                 ENDDO
              ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3233,24 +3137,21 @@
 !--       Soil water content for  iwl layer of walls and land
           IF ( av == 0 )  THEN
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = swc_h(iwl,m)
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = swc_h(l)%val(iwl,m)
+                ENDDO
+             ENDIF
+          ELSE
+             IF ( horizontal )  THEN
+                DO  m = 1, surf_usm_h(l)%ns
+                   i = surf_usm_h(l)%i(m)
+                   j = surf_usm_h(l)%j(m)
+                   k = surf_usm_h(l)%k(m)
+                   temp_pf(k,j,i) = surf_usm_h(l)%swc_av(iwl,m)
                 ENDDO
              ELSE
-
-             ENDIF
-          ELSE
-             IF ( idsint == iup )  THEN
-                DO  m = 1, surf_usm_h%ns
-                   i = surf_usm_h%i(m)
-                   j = surf_usm_h%j(m)
-                   k = surf_usm_h%k(m)
-                   temp_pf(k,j,i) = surf_usm_h%swc_av(iwl,m)
-                ENDDO
-             ELSE
-                l = idsidx
                 DO  m = 1, surf_usm_v(l)%ns
                    i = surf_usm_v(l)%i(m)
@@ -3334,5 +3235,5 @@
 !> Initialization of the wall surface model
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_init_material_model
+ SUBROUTINE usm_init_wall_heat_model
 
     IMPLICIT NONE
@@ -3340,5 +3241,5 @@
     INTEGER(iwp) ::  k, l, m  !< running indices
 
-    IF ( debug_output )  CALL debug_message( 'usm_init_material_model', 'start' )
+    IF ( debug_output )  CALL debug_message( 'usm_init_wall_heat_model', 'start' )
 
 !
@@ -3346,120 +3247,122 @@
 !-- wall layers.
 !-- First for horizontal surfaces:
-    DO  m = 1, surf_usm_h%ns
-
-       surf_usm_h%dz_wall(nzb_wall,m) = surf_usm_h%zw(nzb_wall,m)
-       DO k = nzb_wall+1, nzt_wall
-          surf_usm_h%dz_wall(k,m) = surf_usm_h%zw(k,m) - surf_usm_h%zw(k-1,m)
+    DO  l = 0, 1
+       DO  m = 1, surf_usm_h(l)%ns
+
+          surf_usm_h(l)%dz_wall(nzb_wall,m) = surf_usm_h(l)%zw(nzb_wall,m)
+          DO k = nzb_wall+1, nzt_wall
+             surf_usm_h(l)%dz_wall(k,m) = surf_usm_h(l)%zw(k,m) - surf_usm_h(l)%zw(k-1,m)
+          ENDDO
+          surf_usm_h(l)%dz_window(nzb_wall,m) = surf_usm_h(l)%zw_window(nzb_wall,m)
+          DO  k = nzb_wall+1, nzt_wall
+             surf_usm_h(l)%dz_window(k,m) = surf_usm_h(l)%zw_window(k,m) - surf_usm_h(l)%zw_window(k-1,m)
+          ENDDO
+
+          surf_usm_h(l)%dz_wall(nzt_wall+1,m) = surf_usm_h(l)%dz_wall(nzt_wall,m)
+
+          DO k = nzb_wall, nzt_wall-1
+            surf_usm_h(l)%dz_wall_stag(k,m) = 0.5 * ( surf_usm_h(l)%dz_wall(k+1,m) +                        &
+                                                     surf_usm_h(l)%dz_wall(k,m) )
+          ENDDO
+          surf_usm_h(l)%dz_wall_stag(nzt_wall,m) = surf_usm_h(l)%dz_wall(nzt_wall,m)
+
+          surf_usm_h(l)%dz_window(nzt_wall+1,m) = surf_usm_h(l)%dz_window(nzt_wall,m)
+
+          DO  k = nzb_wall, nzt_wall-1
+             surf_usm_h(l)%dz_window_stag(k,m) = 0.5 * ( surf_usm_h(l)%dz_window(k+1,m) +                   &
+                                                      surf_usm_h(l)%dz_window(k,m) )
+          ENDDO
+          surf_usm_h(l)%dz_window_stag(nzt_wall,m) = surf_usm_h(l)%dz_window(nzt_wall,m)
+
+          IF (surf_usm_h(l)%green_type_roof(m) == 2.0_wp )  THEN
+!
+!--          Extensive green roof
+!--          Set ratio of substrate layer thickness, soil-type and LAI
+             soil_type = 3
+             surf_usm_h(l)%lai(m) = 2.0_wp
+
+             surf_usm_h(l)%zw_green(nzb_wall,m)   = 0.05_wp
+             surf_usm_h(l)%zw_green(nzb_wall+1,m) = 0.10_wp
+             surf_usm_h(l)%zw_green(nzb_wall+2,m) = 0.15_wp
+             surf_usm_h(l)%zw_green(nzb_wall+3,m) = 0.20_wp
+          ELSE
+!
+!--          Intensiv green roof
+!--          Set ratio of substrate layer thickness, soil-type and LAI
+             soil_type = 6
+             surf_usm_h(l)%lai(m) = 4.0_wp
+
+             surf_usm_h(l)%zw_green(nzb_wall,m)   = 0.05_wp
+             surf_usm_h(l)%zw_green(nzb_wall+1,m) = 0.10_wp
+             surf_usm_h(l)%zw_green(nzb_wall+2,m) = 0.40_wp
+             surf_usm_h(l)%zw_green(nzb_wall+3,m) = 0.80_wp
+          ENDIF
+
+          surf_usm_h(l)%dz_green(nzb_wall,m) = surf_usm_h(l)%zw_green(nzb_wall,m)
+          DO k = nzb_wall+1, nzt_wall
+              surf_usm_h(l)%dz_green(k,m) = surf_usm_h(l)%zw_green(k,m) - surf_usm_h(l)%zw_green(k-1,m)
+          ENDDO
+          surf_usm_h(l)%dz_green(nzt_wall+1,m) = surf_usm_h(l)%dz_green(nzt_wall,m)
+
+          DO k = nzb_wall, nzt_wall-1
+              surf_usm_h(l)%dz_green_stag(k,m) = 0.5 * ( surf_usm_h(l)%dz_green(k+1,m) +                    &
+                                                      surf_usm_h(l)%dz_green(k,m) )
+          ENDDO
+          surf_usm_h(l)%dz_green_stag(nzt_wall,m) = surf_usm_h(l)%dz_green(nzt_wall,m)
+
+         IF ( alpha_vangenuchten == 9999999.9_wp )  THEN
+            alpha_vangenuchten = soil_pars(0,soil_type)
+         ENDIF
+
+         IF ( l_vangenuchten == 9999999.9_wp )  THEN
+            l_vangenuchten = soil_pars(1,soil_type)
+         ENDIF
+
+         IF ( n_vangenuchten == 9999999.9_wp )  THEN
+            n_vangenuchten = soil_pars(2,soil_type)
+         ENDIF
+
+         IF ( hydraulic_conductivity == 9999999.9_wp )  THEN
+            hydraulic_conductivity = soil_pars(3,soil_type)
+         ENDIF
+
+         IF ( saturation_moisture == 9999999.9_wp )  THEN
+            saturation_moisture = m_soil_pars(0,soil_type)
+         ENDIF
+
+         IF ( field_capacity == 9999999.9_wp )  THEN
+            field_capacity = m_soil_pars(1,soil_type)
+         ENDIF
+
+         IF ( wilting_point == 9999999.9_wp )  THEN
+            wilting_point = m_soil_pars(2,soil_type)
+         ENDIF
+
+         IF ( residual_moisture == 9999999.9_wp )  THEN
+            residual_moisture = m_soil_pars(3,soil_type)
+         ENDIF
+
+         DO  k = nzb_wall, nzt_wall+1
+            swc_h(l)%val(k,m) = field_capacity
+            rootfr_h(l)%val(k,m) = 0.5_wp
+            surf_usm_h(l)%alpha_vg_green(m)      = alpha_vangenuchten
+            surf_usm_h(l)%l_vg_green(m)          = l_vangenuchten
+            surf_usm_h(l)%n_vg_green(m)          = n_vangenuchten
+            surf_usm_h(l)%gamma_w_green_sat(k,m) = hydraulic_conductivity
+            swc_sat_h(l)%val(k,m)                = saturation_moisture
+            fc_h(l)%val(k,m)                     = field_capacity
+            wilt_h(l)%val(k,m)                   = wilting_point
+            swc_res_h(l)%val(k,m)                = residual_moisture
+         ENDDO
+
        ENDDO
-       surf_usm_h%dz_window(nzb_wall,m) = surf_usm_h%zw_window(nzb_wall,m)
-       DO  k = nzb_wall+1, nzt_wall
-          surf_usm_h%dz_window(k,m) = surf_usm_h%zw_window(k,m) - surf_usm_h%zw_window(k-1,m)
-       ENDDO
-
-       surf_usm_h%dz_wall(nzt_wall+1,m) = surf_usm_h%dz_wall(nzt_wall,m)
-
-       DO k = nzb_wall, nzt_wall-1
-         surf_usm_h%dz_wall_stag(k,m) = 0.5 * ( surf_usm_h%dz_wall(k+1,m) +                        &
-                                                  surf_usm_h%dz_wall(k,m) )
-       ENDDO
-       surf_usm_h%dz_wall_stag(nzt_wall,m) = surf_usm_h%dz_wall(nzt_wall,m)
-
-       surf_usm_h%dz_window(nzt_wall+1,m) = surf_usm_h%dz_window(nzt_wall,m)
-
-       DO  k = nzb_wall, nzt_wall-1
-          surf_usm_h%dz_window_stag(k,m) = 0.5 * ( surf_usm_h%dz_window(k+1,m) +                   &
-                                                   surf_usm_h%dz_window(k,m) )
-       ENDDO
-       surf_usm_h%dz_window_stag(nzt_wall,m) = surf_usm_h%dz_window(nzt_wall,m)
-
-       IF (surf_usm_h%green_type_roof(m) == 2.0_wp )  THEN
-!
-!-- Extensive green roof
-!-- Set ratio of substrate layer thickness, soil-type and LAI
-          soil_type = 3
-          surf_usm_h%lai(m) = 2.0_wp
-
-          surf_usm_h%zw_green(nzb_wall,m)   = 0.05_wp
-          surf_usm_h%zw_green(nzb_wall+1,m) = 0.10_wp
-          surf_usm_h%zw_green(nzb_wall+2,m) = 0.15_wp
-          surf_usm_h%zw_green(nzb_wall+3,m) = 0.20_wp
-       ELSE
-!
-!-- Intensiv green roof
-!-- Set ratio of substrate layer thickness, soil-type and LAI
-          soil_type = 6
-          surf_usm_h%lai(m) = 4.0_wp
-
-          surf_usm_h%zw_green(nzb_wall,m)   = 0.05_wp
-          surf_usm_h%zw_green(nzb_wall+1,m) = 0.10_wp
-          surf_usm_h%zw_green(nzb_wall+2,m) = 0.40_wp
-          surf_usm_h%zw_green(nzb_wall+3,m) = 0.80_wp
-       ENDIF
-
-       surf_usm_h%dz_green(nzb_wall,m) = surf_usm_h%zw_green(nzb_wall,m)
-       DO k = nzb_wall+1, nzt_wall
-           surf_usm_h%dz_green(k,m) = surf_usm_h%zw_green(k,m) - surf_usm_h%zw_green(k-1,m)
-       ENDDO
-       surf_usm_h%dz_green(nzt_wall+1,m) = surf_usm_h%dz_green(nzt_wall,m)
-
-       DO k = nzb_wall, nzt_wall-1
-           surf_usm_h%dz_green_stag(k,m) = 0.5 * ( surf_usm_h%dz_green(k+1,m) +                    &
-                                                   surf_usm_h%dz_green(k,m) )
-       ENDDO
-       surf_usm_h%dz_green_stag(nzt_wall,m) = surf_usm_h%dz_green(nzt_wall,m)
-
-      IF ( alpha_vangenuchten == 9999999.9_wp )  THEN
-         alpha_vangenuchten = soil_pars(0,soil_type)
-      ENDIF
-
-      IF ( l_vangenuchten == 9999999.9_wp )  THEN
-         l_vangenuchten = soil_pars(1,soil_type)
-      ENDIF
-
-      IF ( n_vangenuchten == 9999999.9_wp )  THEN
-         n_vangenuchten = soil_pars(2,soil_type)
-      ENDIF
-
-      IF ( hydraulic_conductivity == 9999999.9_wp )  THEN
-         hydraulic_conductivity = soil_pars(3,soil_type)
-      ENDIF
-
-      IF ( saturation_moisture == 9999999.9_wp )  THEN
-         saturation_moisture = m_soil_pars(0,soil_type)
-      ENDIF
-
-      IF ( field_capacity == 9999999.9_wp )  THEN
-         field_capacity = m_soil_pars(1,soil_type)
-      ENDIF
-
-      IF ( wilting_point == 9999999.9_wp )  THEN
-         wilting_point = m_soil_pars(2,soil_type)
-      ENDIF
-
-      IF ( residual_moisture == 9999999.9_wp )  THEN
-         residual_moisture = m_soil_pars(3,soil_type)
-      ENDIF
-
-      DO  k = nzb_wall, nzt_wall+1
-         swc_h(k,m) = field_capacity
-         rootfr_h(k,m) = 0.5_wp
-         surf_usm_h%alpha_vg_green(m)      = alpha_vangenuchten
-         surf_usm_h%l_vg_green(m)          = l_vangenuchten
-         surf_usm_h%n_vg_green(m)          = n_vangenuchten
-         surf_usm_h%gamma_w_green_sat(k,m) = hydraulic_conductivity
-         swc_sat_h(k,m)                    = saturation_moisture
-         fc_h(k,m)                         = field_capacity
-         wilt_h(k,m)                       = wilting_point
-         swc_res_h(k,m)                    = residual_moisture
-      ENDDO
-
+
+       surf_usm_h(l)%ddz_wall        = 1.0_wp / surf_usm_h(l)%dz_wall
+       surf_usm_h(l)%ddz_wall_stag   = 1.0_wp / surf_usm_h(l)%dz_wall_stag
+       surf_usm_h(l)%ddz_window      = 1.0_wp / surf_usm_h(l)%dz_window
+       surf_usm_h(l)%ddz_window_stag = 1.0_wp / surf_usm_h(l)%dz_window_stag
+       surf_usm_h(l)%ddz_green       = 1.0_wp / surf_usm_h(l)%dz_green
+       surf_usm_h(l)%ddz_green_stag  = 1.0_wp / surf_usm_h(l)%dz_green_stag
     ENDDO
-
-    surf_usm_h%ddz_wall        = 1.0_wp / surf_usm_h%dz_wall
-    surf_usm_h%ddz_wall_stag   = 1.0_wp / surf_usm_h%dz_wall_stag
-    surf_usm_h%ddz_window      = 1.0_wp / surf_usm_h%dz_window
-    surf_usm_h%ddz_window_stag = 1.0_wp / surf_usm_h%dz_window_stag
-    surf_usm_h%ddz_green       = 1.0_wp / surf_usm_h%dz_green
-    surf_usm_h%ddz_green_stag  = 1.0_wp / surf_usm_h%dz_green_stag
 !
 !-- For vertical surfaces
@@ -3512,7 +3415,7 @@
 
 
-    IF ( debug_output )  CALL debug_message( 'usm_init_material_model', 'end' )
-
- END SUBROUTINE usm_init_material_model
+    IF ( debug_output )  CALL debug_message( 'usm_init_wall_heat_model', 'end' )
+
+ END SUBROUTINE usm_init_wall_heat_model
 
 
@@ -3601,5 +3504,7 @@
 !-- from file, if available. This flag is later used to control initialization of surface attributes.
 !-- Todo: for the moment disable initialization of building roofs with ground-floor-level properties.
-    surf_usm_h%ground_level = .FALSE.
+    DO  l = 0, 1
+      surf_usm_h(l)%ground_level = .FALSE.
+    ENDDO
 
     DO  l = 0, 3
@@ -3640,8 +3545,10 @@
 !
 !-- Initialization of resistances.
-    DO  m = 1, surf_usm_h%ns
-       surf_usm_h%r_a(m)        = 50.0_wp
-       surf_usm_h%r_a_green(m)  = 50.0_wp
-       surf_usm_h%r_a_window(m) = 50.0_wp
+    DO  l = 0, 1
+       DO  m = 1, surf_usm_h(l)%ns
+          surf_usm_h(l)%r_a(m)        = 50.0_wp
+          surf_usm_h(l)%r_a_green(m)  = 50.0_wp
+          surf_usm_h(l)%r_a_window(m) = 50.0_wp
+       ENDDO
     ENDDO
     DO  l = 0, 3
@@ -3655,8 +3562,10 @@
 !
 !-- Map values onto horizontal elemements
-    DO  m = 1, surf_usm_h%ns
-       surf_usm_h%r_canopy(m)     = 200.0_wp !< canopy_resistance
-       surf_usm_h%r_canopy_min(m) = 200.0_wp !< min_canopy_resistance
-       surf_usm_h%g_d(m)          = 0.0_wp   !< canopy_resistance_coefficient
+    DO  l = 0, 1
+       DO  m = 1, surf_usm_h(l)%ns
+          surf_usm_h(l)%r_canopy(m)     = 200.0_wp !< canopy_resistance
+          surf_usm_h(l)%r_canopy_min(m) = 200.0_wp !< min_canopy_resistance
+          surf_usm_h(l)%g_d(m)          = 0.0_wp   !< canopy_resistance_coefficient
+       ENDDO
     ENDDO
 !
@@ -3674,90 +3583,91 @@
 !--  follow a 3-level approach.
 !--  Level 1 - initialization via default attributes
-     DO  m = 1, surf_usm_h%ns
-!
-!--     Now, all horizontal surfaces are roof surfaces (?)
-        surf_usm_h%isroof_surf(m)   = .TRUE.
-        surf_usm_h%surface_types(m) = roof_category         !< default category for root surface
-!
-!--     In order to distinguish between ground floor level and above-ground-floor level surfaces,
-!--     set input indices.
-
-        ind_green_frac_r = MERGE( ind_green_frac_r_gfl, ind_green_frac_r_agfl,                     &
-                                  surf_usm_h%ground_level(m) )
-        ind_lai_r        = MERGE( ind_lai_r_gfl, ind_lai_r_agfl, surf_usm_h%ground_level(m) )
-        ind_z0           = MERGE( ind_z0_gfl, ind_z0_agfl, surf_usm_h%ground_level(m) )
-        ind_z0qh         = MERGE( ind_z0qh_gfl, ind_z0qh_agfl, surf_usm_h%ground_level(m) )
-!
-!--     Store building type and its name on each surface element
-        surf_usm_h%building_type(m)      = building_type
-        surf_usm_h%building_type_name(m) = building_type_name(building_type)
-!
-!--     Initialize relatvie wall- (0), green- (1) and window (2) fractions
-        surf_usm_h%frac(m,ind_veg_wall)  = building_pars(ind_wall_frac_r,building_type)
-        surf_usm_h%frac(m,ind_pav_green) = building_pars(ind_green_frac_r,building_type)
-        surf_usm_h%frac(m,ind_wat_win)   = building_pars(ind_win_frac_r,building_type)
-        surf_usm_h%lai(m)                = building_pars(ind_lai_r,building_type)
-
-        surf_usm_h%rho_c_wall(nzb_wall,m)        = building_pars(ind_hc1_wall_r,building_type)
-        surf_usm_h%rho_c_wall(nzb_wall+1,m)      = building_pars(ind_hc1_wall_r,building_type)
-        surf_usm_h%rho_c_wall(nzb_wall+2,m)      = building_pars(ind_hc2_wall_r,building_type)
-        surf_usm_h%rho_c_wall(nzb_wall+3,m)      = building_pars(ind_hc3_wall_r,building_type)
-        surf_usm_h%lambda_h(nzb_wall,m)          = building_pars(ind_tc1_wall_r,building_type)
-        surf_usm_h%lambda_h(nzb_wall+1,m)        = building_pars(ind_tc1_wall_r,building_type)
-        surf_usm_h%lambda_h(nzb_wall+2,m)        = building_pars(ind_tc2_wall_r,building_type)
-        surf_usm_h%lambda_h(nzb_wall+3,m)        = building_pars(ind_tc3_wall_r,building_type)
-        surf_usm_h%rho_c_green(nzb_wall,m)       = rho_c_soil !building_pars(ind_hc1_wall_r,building_type)
-        surf_usm_h%rho_c_green(nzb_wall+1,m)     = rho_c_soil !building_pars(ind_hc1_wall_r,building_type)
-        surf_usm_h%rho_c_green(nzb_wall+2,m)     = rho_c_soil !building_pars(ind_hc2_wall_r,building_type)
-        surf_usm_h%rho_c_green(nzb_wall+3,m)     = rho_c_soil !building_pars(ind_hc3_wall_r,building_type)
-        surf_usm_h%lambda_h_green(nzb_wall,m)    = lambda_h_green_sm !building_pars(ind_tc1_wall_r,building_type)
-        surf_usm_h%lambda_h_green(nzb_wall+1,m)  = lambda_h_green_sm !building_pars(ind_tc1_wall_r,building_type)
-        surf_usm_h%lambda_h_green(nzb_wall+2,m)  = lambda_h_green_sm !building_pars(ind_tc2_wall_r,building_type)
-        surf_usm_h%lambda_h_green(nzb_wall+3,m)  = lambda_h_green_sm !building_pars(ind_tc3_wall_r,building_type)
-        surf_usm_h%rho_c_window(nzb_wall,m)      = building_pars(ind_hc1_win_r,building_type)
-        surf_usm_h%rho_c_window(nzb_wall+1,m)    = building_pars(ind_hc1_win_r,building_type)
-        surf_usm_h%rho_c_window(nzb_wall+2,m)    = building_pars(ind_hc2_win_r,building_type)
-        surf_usm_h%rho_c_window(nzb_wall+3,m)    = building_pars(ind_hc3_win_r,building_type)
-        surf_usm_h%lambda_h_window(nzb_wall,m)   = building_pars(ind_tc1_win_r,building_type)
-        surf_usm_h%lambda_h_window(nzb_wall+1,m) = building_pars(ind_tc1_win_r,building_type)
-        surf_usm_h%lambda_h_window(nzb_wall+2,m) = building_pars(ind_tc2_win_r,building_type)
-        surf_usm_h%lambda_h_window(nzb_wall+3,m) = building_pars(ind_tc3_win_r,building_type)
-
-        surf_usm_h%target_temp_summer(m)  = building_pars(ind_indoor_target_temp_summer,building_type)
-        surf_usm_h%target_temp_winter(m)  = building_pars(ind_indoor_target_temp_winter,building_type)
-!
-!--     Emissivity of wall-, green- and window fraction
-        surf_usm_h%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall_r,building_type)
-        surf_usm_h%emissivity(m,ind_pav_green) = building_pars(ind_emis_green_r,building_type)
-        surf_usm_h%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win_r,building_type)
-
-        surf_usm_h%transmissivity(m)           = building_pars(ind_trans_r,building_type)
-
-        surf_usm_h%z0(m)                       = building_pars(ind_z0,building_type)
-        surf_usm_h%z0h(m)                      = building_pars(ind_z0qh,building_type)
-        surf_usm_h%z0q(m)                      = building_pars(ind_z0qh,building_type)
-!
-!--     Albedo type for wall fraction, green fraction, window fraction
-        surf_usm_h%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall_r,building_type) )
-        surf_usm_h%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green_r,building_type) )
-        surf_usm_h%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win_r,building_type) )
-
-        surf_usm_h%zw(nzb_wall,m)         = building_pars(ind_thick_1_wall_r,building_type)
-        surf_usm_h%zw(nzb_wall+1,m)       = building_pars(ind_thick_2_wall_r,building_type)
-        surf_usm_h%zw(nzb_wall+2,m)       = building_pars(ind_thick_3_wall_r,building_type)
-        surf_usm_h%zw(nzb_wall+3,m)       = building_pars(ind_thick_4_wall_r,building_type)
-
-        surf_usm_h%zw_green(nzb_wall,m)         = building_pars(ind_thick_1_wall_r,building_type)
-        surf_usm_h%zw_green(nzb_wall+1,m)       = building_pars(ind_thick_2_wall_r,building_type)
-        surf_usm_h%zw_green(nzb_wall+2,m)       = building_pars(ind_thick_3_wall_r,building_type)
-        surf_usm_h%zw_green(nzb_wall+3,m)       = building_pars(ind_thick_4_wall_r,building_type)
-
-        surf_usm_h%zw_window(nzb_wall,m)         = building_pars(ind_thick_1_win_r,building_type)
-        surf_usm_h%zw_window(nzb_wall+1,m)       = building_pars(ind_thick_2_win_r,building_type)
-        surf_usm_h%zw_window(nzb_wall+2,m)       = building_pars(ind_thick_3_win_r,building_type)
-        surf_usm_h%zw_window(nzb_wall+3,m)       = building_pars(ind_thick_4_win_r,building_type)
-
-        surf_usm_h%green_type_roof(m)     = building_pars(ind_green_type_roof,building_type)
-
+     DO  l = 0, 1
+        DO  m = 1, surf_usm_h(l)%ns
+!
+!--        Now, all horizontal surfaces are roof surfaces (?)
+           surf_usm_h(l)%isroof_surf(m)   = .TRUE.
+           surf_usm_h(l)%surface_types(m) = roof_category         !< default category for root surface
+!
+!--        In order to distinguish between ground floor level and above-ground-floor level surfaces,
+!--        set input indices.
+
+           ind_green_frac_r = MERGE( ind_green_frac_r_gfl, ind_green_frac_r_agfl,                     &
+                                     surf_usm_h(l)%ground_level(m) )
+           ind_lai_r        = MERGE( ind_lai_r_gfl, ind_lai_r_agfl, surf_usm_h(l)%ground_level(m) )
+           ind_z0           = MERGE( ind_z0_gfl, ind_z0_agfl, surf_usm_h(l)%ground_level(m) )
+           ind_z0qh         = MERGE( ind_z0qh_gfl, ind_z0qh_agfl, surf_usm_h(l)%ground_level(m) )
+!
+!--        Store building type and its name on each surface element
+           surf_usm_h(l)%building_type(m)      = building_type
+           surf_usm_h(l)%building_type_name(m) = building_type_name(building_type)
+!
+!--        Initialize relatvie wall- (0), green- (1) and window (2) fractions
+           surf_usm_h(l)%frac(m,ind_veg_wall)  = building_pars(ind_wall_frac_r,building_type)
+           surf_usm_h(l)%frac(m,ind_pav_green) = building_pars(ind_green_frac_r,building_type)
+           surf_usm_h(l)%frac(m,ind_wat_win)   = building_pars(ind_win_frac_r,building_type)
+           surf_usm_h(l)%lai(m)                = building_pars(ind_lai_r,building_type)
+
+           surf_usm_h(l)%rho_c_wall(nzb_wall,m)        = building_pars(ind_hc1_wall_r,building_type)
+           surf_usm_h(l)%rho_c_wall(nzb_wall+1,m)      = building_pars(ind_hc1_wall_r,building_type)
+           surf_usm_h(l)%rho_c_wall(nzb_wall+2,m)      = building_pars(ind_hc2_wall_r,building_type)
+           surf_usm_h(l)%rho_c_wall(nzb_wall+3,m)      = building_pars(ind_hc3_wall_r,building_type)
+           surf_usm_h(l)%lambda_h(nzb_wall,m)          = building_pars(ind_tc1_wall_r,building_type)
+           surf_usm_h(l)%lambda_h(nzb_wall+1,m)        = building_pars(ind_tc1_wall_r,building_type)
+           surf_usm_h(l)%lambda_h(nzb_wall+2,m)        = building_pars(ind_tc2_wall_r,building_type)
+           surf_usm_h(l)%lambda_h(nzb_wall+3,m)        = building_pars(ind_tc3_wall_r,building_type)
+           surf_usm_h(l)%rho_c_green(nzb_wall,m)       = rho_c_soil !building_pars(ind_hc1_wall_r,building_type)
+           surf_usm_h(l)%rho_c_green(nzb_wall+1,m)     = rho_c_soil !building_pars(ind_hc1_wall_r,building_type)
+           surf_usm_h(l)%rho_c_green(nzb_wall+2,m)     = rho_c_soil !building_pars(ind_hc2_wall_r,building_type)
+           surf_usm_h(l)%rho_c_green(nzb_wall+3,m)     = rho_c_soil !building_pars(ind_hc3_wall_r,building_type)
+           surf_usm_h(l)%lambda_h_green(nzb_wall,m)    = lambda_h_green_sm !building_pars(ind_tc1_wall_r,building_type)
+           surf_usm_h(l)%lambda_h_green(nzb_wall+1,m)  = lambda_h_green_sm !building_pars(ind_tc1_wall_r,building_type)
+           surf_usm_h(l)%lambda_h_green(nzb_wall+2,m)  = lambda_h_green_sm !building_pars(ind_tc2_wall_r,building_type)
+           surf_usm_h(l)%lambda_h_green(nzb_wall+3,m)  = lambda_h_green_sm !building_pars(ind_tc3_wall_r,building_type)
+           surf_usm_h(l)%rho_c_window(nzb_wall,m)      = building_pars(ind_hc1_win_r,building_type)
+           surf_usm_h(l)%rho_c_window(nzb_wall+1,m)    = building_pars(ind_hc1_win_r,building_type)
+           surf_usm_h(l)%rho_c_window(nzb_wall+2,m)    = building_pars(ind_hc2_win_r,building_type)
+           surf_usm_h(l)%rho_c_window(nzb_wall+3,m)    = building_pars(ind_hc3_win_r,building_type)
+           surf_usm_h(l)%lambda_h_window(nzb_wall,m)   = building_pars(ind_tc1_win_r,building_type)
+           surf_usm_h(l)%lambda_h_window(nzb_wall+1,m) = building_pars(ind_tc1_win_r,building_type)
+           surf_usm_h(l)%lambda_h_window(nzb_wall+2,m) = building_pars(ind_tc2_win_r,building_type)
+           surf_usm_h(l)%lambda_h_window(nzb_wall+3,m) = building_pars(ind_tc3_win_r,building_type)
+
+           surf_usm_h(l)%target_temp_summer(m)  = building_pars(ind_indoor_target_temp_summer,building_type)
+           surf_usm_h(l)%target_temp_winter(m)  = building_pars(ind_indoor_target_temp_winter,building_type)
+!
+!--        Emissivity of wall-, green- and window fraction
+           surf_usm_h(l)%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall_r,building_type)
+           surf_usm_h(l)%emissivity(m,ind_pav_green) = building_pars(ind_emis_green_r,building_type)
+           surf_usm_h(l)%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win_r,building_type)
+
+           surf_usm_h(l)%transmissivity(m)           = building_pars(ind_trans_r,building_type)
+
+           surf_usm_h(l)%z0(m)                       = building_pars(ind_z0,building_type)
+           surf_usm_h(l)%z0h(m)                      = building_pars(ind_z0qh,building_type)
+           surf_usm_h(l)%z0q(m)                      = building_pars(ind_z0qh,building_type)
+!
+!--        Albedo type for wall fraction, green fraction, window fraction
+           surf_usm_h(l)%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall_r,building_type) )
+           surf_usm_h(l)%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green_r,building_type) )
+           surf_usm_h(l)%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win_r,building_type) )
+
+           surf_usm_h(l)%zw(nzb_wall,m)         = building_pars(ind_thick_1_wall_r,building_type)
+           surf_usm_h(l)%zw(nzb_wall+1,m)       = building_pars(ind_thick_2_wall_r,building_type)
+           surf_usm_h(l)%zw(nzb_wall+2,m)       = building_pars(ind_thick_3_wall_r,building_type)
+           surf_usm_h(l)%zw(nzb_wall+3,m)       = building_pars(ind_thick_4_wall_r,building_type)
+
+           surf_usm_h(l)%zw_green(nzb_wall,m)         = building_pars(ind_thick_1_wall_r,building_type)
+           surf_usm_h(l)%zw_green(nzb_wall+1,m)       = building_pars(ind_thick_2_wall_r,building_type)
+           surf_usm_h(l)%zw_green(nzb_wall+2,m)       = building_pars(ind_thick_3_wall_r,building_type)
+           surf_usm_h(l)%zw_green(nzb_wall+3,m)       = building_pars(ind_thick_4_wall_r,building_type)
+
+           surf_usm_h(l)%zw_window(nzb_wall,m)         = building_pars(ind_thick_1_win_r,building_type)
+           surf_usm_h(l)%zw_window(nzb_wall+1,m)       = building_pars(ind_thick_2_win_r,building_type)
+           surf_usm_h(l)%zw_window(nzb_wall+2,m)       = building_pars(ind_thick_3_win_r,building_type)
+           surf_usm_h(l)%zw_window(nzb_wall+3,m)       = building_pars(ind_thick_4_win_r,building_type)
+
+           surf_usm_h(l)%green_type_roof(m)     = building_pars(ind_green_type_roof,building_type)
+        ENDDO
      ENDDO
 
@@ -3918,96 +3828,98 @@
 !--  Level 2 - initialization via building type read from file
      IF ( building_type_f%from_file )  THEN
-        DO  m = 1, surf_usm_h%ns
-           i = surf_usm_h%i(m)
-           j = surf_usm_h%j(m)
-!
-!--        For the moment, limit building type to 6 (to overcome errors in input file).
-           st = building_type_f%var(j,i)
-           IF ( st /= building_type_f%fill )  THEN
-
-!
-!--           In order to distinguish between ground floor level and above-ground-floor level
-!--           surfaces, set input indices.
-
-              ind_green_frac_r = MERGE( ind_green_frac_r_gfl, ind_green_frac_r_agfl,               &
-                                        surf_usm_h%ground_level(m) )
-              ind_lai_r        = MERGE( ind_lai_r_gfl, ind_lai_r_agfl, surf_usm_h%ground_level(m) )
-              ind_z0           = MERGE( ind_z0_gfl, ind_z0_agfl, surf_usm_h%ground_level(m) )
-              ind_z0qh         = MERGE( ind_z0qh_gfl, ind_z0qh_agfl, surf_usm_h%ground_level(m) )
-!
-!--           Store building type and its name on each surface element
-              surf_usm_h%building_type(m)      = st
-              surf_usm_h%building_type_name(m) = building_type_name(st)
-!
-!--           Initialize relatvie wall- (0), green- (1) and window (2) fractions
-              surf_usm_h%frac(m,ind_veg_wall)  = building_pars(ind_wall_frac_r,st)
-              surf_usm_h%frac(m,ind_pav_green) = building_pars(ind_green_frac_r,st)
-              surf_usm_h%frac(m,ind_wat_win)   = building_pars(ind_win_frac_r,st)
-              surf_usm_h%lai(m)                = building_pars(ind_lai_r,st)
-
-              surf_usm_h%rho_c_wall(nzb_wall,m)   = building_pars(ind_hc1_wall_r,st)
-              surf_usm_h%rho_c_wall(nzb_wall+1,m) = building_pars(ind_hc1_wall_r,st)
-              surf_usm_h%rho_c_wall(nzb_wall+2,m) = building_pars(ind_hc2_wall_r,st)
-              surf_usm_h%rho_c_wall(nzb_wall+3,m) = building_pars(ind_hc3_wall_r,st)
-              surf_usm_h%lambda_h(nzb_wall,m)     = building_pars(ind_tc1_wall_r,st)
-              surf_usm_h%lambda_h(nzb_wall+1,m)   = building_pars(ind_tc1_wall_r,st)
-              surf_usm_h%lambda_h(nzb_wall+2,m)   = building_pars(ind_tc2_wall_r,st)
-              surf_usm_h%lambda_h(nzb_wall+3,m)   = building_pars(ind_tc3_wall_r,st)
-
-              surf_usm_h%rho_c_green(nzb_wall,m)      = rho_c_soil !building_pars(ind_hc1_wall_r,st)
-              surf_usm_h%rho_c_green(nzb_wall+1,m)    = rho_c_soil !building_pars(ind_hc1_wall_r,st)
-              surf_usm_h%rho_c_green(nzb_wall+2,m)    = rho_c_soil !building_pars(ind_hc2_wall_r,st)
-              surf_usm_h%rho_c_green(nzb_wall+3,m)    = rho_c_soil !building_pars(ind_hc3_wall_r,st)
-              surf_usm_h%lambda_h_green(nzb_wall,m)   = lambda_h_green_sm !building_pars(ind_tc1_wall_r,st)
-              surf_usm_h%lambda_h_green(nzb_wall+1,m) = lambda_h_green_sm !building_pars(ind_tc1_wall_r,st)
-              surf_usm_h%lambda_h_green(nzb_wall+2,m) = lambda_h_green_sm !building_pars(ind_tc2_wall_r,st)
-              surf_usm_h%lambda_h_green(nzb_wall+3,m) = lambda_h_green_sm !building_pars(ind_tc3_wall_r,st)
-
-              surf_usm_h%rho_c_window(nzb_wall,m)      = building_pars(ind_hc1_win_r,st)
-              surf_usm_h%rho_c_window(nzb_wall+1,m)    = building_pars(ind_hc1_win_r,st)
-              surf_usm_h%rho_c_window(nzb_wall+2,m)    = building_pars(ind_hc2_win_r,st)
-              surf_usm_h%rho_c_window(nzb_wall+3,m)    = building_pars(ind_hc3_win_r,st)
-              surf_usm_h%lambda_h_window(nzb_wall,m)   = building_pars(ind_tc1_win_r,st)
-              surf_usm_h%lambda_h_window(nzb_wall+1,m) = building_pars(ind_tc1_win_r,st)
-              surf_usm_h%lambda_h_window(nzb_wall+2,m) = building_pars(ind_tc2_win_r,st)
-              surf_usm_h%lambda_h_window(nzb_wall+3,m) = building_pars(ind_tc3_win_r,st)
-
-              surf_usm_h%target_temp_summer(m)  = building_pars(ind_indoor_target_temp_summer,st)
-              surf_usm_h%target_temp_winter(m)  = building_pars(ind_indoor_target_temp_winter,st)
-!
-!--           Emissivity of wall-, green- and window fraction
-              surf_usm_h%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall_r,st)
-              surf_usm_h%emissivity(m,ind_pav_green) = building_pars(ind_emis_green_r,st)
-              surf_usm_h%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win_r,st)
-
-              surf_usm_h%transmissivity(m)      = building_pars(ind_trans_r,st)
-
-              surf_usm_h%z0(m)                  = building_pars(ind_z0,st)
-              surf_usm_h%z0h(m)                 = building_pars(ind_z0qh,st)
-              surf_usm_h%z0q(m)                 = building_pars(ind_z0qh,st)
-!
-!--           Albedo type for wall fraction, green fraction, window fraction
-              surf_usm_h%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall_r,st) )
-              surf_usm_h%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green_r,st) )
-              surf_usm_h%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win_r,st) )
-
-              surf_usm_h%zw(nzb_wall,m)   = building_pars(ind_thick_1_wall_r,st)
-              surf_usm_h%zw(nzb_wall+1,m) = building_pars(ind_thick_2_wall_r,st)
-              surf_usm_h%zw(nzb_wall+2,m) = building_pars(ind_thick_3_wall_r,st)
-              surf_usm_h%zw(nzb_wall+3,m) = building_pars(ind_thick_4_wall_r,st)
-
-              surf_usm_h%zw_green(nzb_wall,m)   = building_pars(ind_thick_1_wall_r,st)
-              surf_usm_h%zw_green(nzb_wall+1,m) = building_pars(ind_thick_2_wall_r,st)
-              surf_usm_h%zw_green(nzb_wall+2,m) = building_pars(ind_thick_3_wall_r,st)
-              surf_usm_h%zw_green(nzb_wall+3,m) = building_pars(ind_thick_4_wall_r,st)
-
-              surf_usm_h%zw_window(nzb_wall,m)   = building_pars(ind_thick_1_win_r,st)
-              surf_usm_h%zw_window(nzb_wall+1,m) = building_pars(ind_thick_2_win_r,st)
-              surf_usm_h%zw_window(nzb_wall+2,m) = building_pars(ind_thick_3_win_r,st)
-              surf_usm_h%zw_window(nzb_wall+3,m) = building_pars(ind_thick_4_win_r,st)
-
-              surf_usm_h%green_type_roof(m) = building_pars(ind_green_type_roof,st)
-
-           ENDIF
+        DO  l = 0, 1
+           DO  m = 1, surf_usm_h(l)%ns
+              i = surf_usm_h(l)%i(m)
+              j = surf_usm_h(l)%j(m)
+!
+!--           For the moment, limit building type to 6 (to overcome errors in input file).
+              st = building_type_f%var(j,i)
+              IF ( st /= building_type_f%fill )  THEN
+
+!
+!--              In order to distinguish between ground floor level and above-ground-floor level
+!--              surfaces, set input indices.
+
+                 ind_green_frac_r = MERGE( ind_green_frac_r_gfl, ind_green_frac_r_agfl,               &
+                                           surf_usm_h(l)%ground_level(m) )
+                 ind_lai_r        = MERGE( ind_lai_r_gfl, ind_lai_r_agfl, surf_usm_h(l)%ground_level(m) )
+                 ind_z0           = MERGE( ind_z0_gfl, ind_z0_agfl, surf_usm_h(l)%ground_level(m) )
+                 ind_z0qh         = MERGE( ind_z0qh_gfl, ind_z0qh_agfl, surf_usm_h(l)%ground_level(m) )
+!
+!--              Store building type and its name on each surface element
+                 surf_usm_h(l)%building_type(m)      = st
+                 surf_usm_h(l)%building_type_name(m) = building_type_name(st)
+!
+!--              Initialize relatvie wall- (0), green- (1) and window (2) fractions
+                 surf_usm_h(l)%frac(m,ind_veg_wall)  = building_pars(ind_wall_frac_r,st)
+                 surf_usm_h(l)%frac(m,ind_pav_green) = building_pars(ind_green_frac_r,st)
+                 surf_usm_h(l)%frac(m,ind_wat_win)   = building_pars(ind_win_frac_r,st)
+                 surf_usm_h(l)%lai(m)                = building_pars(ind_lai_r,st)
+
+                 surf_usm_h(l)%rho_c_wall(nzb_wall,m)   = building_pars(ind_hc1_wall_r,st)
+                 surf_usm_h(l)%rho_c_wall(nzb_wall+1,m) = building_pars(ind_hc1_wall_r,st)
+                 surf_usm_h(l)%rho_c_wall(nzb_wall+2,m) = building_pars(ind_hc2_wall_r,st)
+                 surf_usm_h(l)%rho_c_wall(nzb_wall+3,m) = building_pars(ind_hc3_wall_r,st)
+                 surf_usm_h(l)%lambda_h(nzb_wall,m)     = building_pars(ind_tc1_wall_r,st)
+                 surf_usm_h(l)%lambda_h(nzb_wall+1,m)   = building_pars(ind_tc1_wall_r,st)
+                 surf_usm_h(l)%lambda_h(nzb_wall+2,m)   = building_pars(ind_tc2_wall_r,st)
+                 surf_usm_h(l)%lambda_h(nzb_wall+3,m)   = building_pars(ind_tc3_wall_r,st)
+
+                 surf_usm_h(l)%rho_c_green(nzb_wall,m)      = rho_c_soil !building_pars(ind_hc1_wall_r,st)
+                 surf_usm_h(l)%rho_c_green(nzb_wall+1,m)    = rho_c_soil !building_pars(ind_hc1_wall_r,st)
+                 surf_usm_h(l)%rho_c_green(nzb_wall+2,m)    = rho_c_soil !building_pars(ind_hc2_wall_r,st)
+                 surf_usm_h(l)%rho_c_green(nzb_wall+3,m)    = rho_c_soil !building_pars(ind_hc3_wall_r,st)
+                 surf_usm_h(l)%lambda_h_green(nzb_wall,m)   = lambda_h_green_sm !building_pars(ind_tc1_wall_r,st)
+                 surf_usm_h(l)%lambda_h_green(nzb_wall+1,m) = lambda_h_green_sm !building_pars(ind_tc1_wall_r,st)
+                 surf_usm_h(l)%lambda_h_green(nzb_wall+2,m) = lambda_h_green_sm !building_pars(ind_tc2_wall_r,st)
+                 surf_usm_h(l)%lambda_h_green(nzb_wall+3,m) = lambda_h_green_sm !building_pars(ind_tc3_wall_r,st)
+
+                 surf_usm_h(l)%rho_c_window(nzb_wall,m)      = building_pars(ind_hc1_win_r,st)
+                 surf_usm_h(l)%rho_c_window(nzb_wall+1,m)    = building_pars(ind_hc1_win_r,st)
+                 surf_usm_h(l)%rho_c_window(nzb_wall+2,m)    = building_pars(ind_hc2_win_r,st)
+                 surf_usm_h(l)%rho_c_window(nzb_wall+3,m)    = building_pars(ind_hc3_win_r,st)
+                 surf_usm_h(l)%lambda_h_window(nzb_wall,m)   = building_pars(ind_tc1_win_r,st)
+                 surf_usm_h(l)%lambda_h_window(nzb_wall+1,m) = building_pars(ind_tc1_win_r,st)
+                 surf_usm_h(l)%lambda_h_window(nzb_wall+2,m) = building_pars(ind_tc2_win_r,st)
+                 surf_usm_h(l)%lambda_h_window(nzb_wall+3,m) = building_pars(ind_tc3_win_r,st)
+
+                 surf_usm_h(l)%target_temp_summer(m)  = building_pars(ind_indoor_target_temp_summer,st)
+                 surf_usm_h(l)%target_temp_winter(m)  = building_pars(ind_indoor_target_temp_winter,st)
+!
+!--              Emissivity of wall-, green- and window fraction
+                 surf_usm_h(l)%emissivity(m,ind_veg_wall)  = building_pars(ind_emis_wall_r,st)
+                 surf_usm_h(l)%emissivity(m,ind_pav_green) = building_pars(ind_emis_green_r,st)
+                 surf_usm_h(l)%emissivity(m,ind_wat_win)   = building_pars(ind_emis_win_r,st)
+
+                 surf_usm_h(l)%transmissivity(m)      = building_pars(ind_trans_r,st)
+
+                 surf_usm_h(l)%z0(m)                  = building_pars(ind_z0,st)
+                 surf_usm_h(l)%z0h(m)                 = building_pars(ind_z0qh,st)
+                 surf_usm_h(l)%z0q(m)                 = building_pars(ind_z0qh,st)
+!
+!--              Albedo type for wall fraction, green fraction, window fraction
+                 surf_usm_h(l)%albedo_type(m,ind_veg_wall)  = INT( building_pars(ind_alb_wall_r,st) )
+                 surf_usm_h(l)%albedo_type(m,ind_pav_green) = INT( building_pars(ind_alb_green_r,st) )
+                 surf_usm_h(l)%albedo_type(m,ind_wat_win)   = INT( building_pars(ind_alb_win_r,st) )
+
+                 surf_usm_h(l)%zw(nzb_wall,m)   = building_pars(ind_thick_1_wall_r,st)
+                 surf_usm_h(l)%zw(nzb_wall+1,m) = building_pars(ind_thick_2_wall_r,st)
+                 surf_usm_h(l)%zw(nzb_wall+2,m) = building_pars(ind_thick_3_wall_r,st)
+                 surf_usm_h(l)%zw(nzb_wall+3,m) = building_pars(ind_thick_4_wall_r,st)
+
+                 surf_usm_h(l)%zw_green(nzb_wall,m)   = building_pars(ind_thick_1_wall_r,st)
+                 surf_usm_h(l)%zw_green(nzb_wall+1,m) = building_pars(ind_thick_2_wall_r,st)
+                 surf_usm_h(l)%zw_green(nzb_wall+2,m) = building_pars(ind_thick_3_wall_r,st)
+                 surf_usm_h(l)%zw_green(nzb_wall+3,m) = building_pars(ind_thick_4_wall_r,st)
+
+                 surf_usm_h(l)%zw_window(nzb_wall,m)   = building_pars(ind_thick_1_win_r,st)
+                 surf_usm_h(l)%zw_window(nzb_wall+1,m) = building_pars(ind_thick_2_win_r,st)
+                 surf_usm_h(l)%zw_window(nzb_wall+2,m) = building_pars(ind_thick_3_win_r,st)
+                 surf_usm_h(l)%zw_window(nzb_wall+3,m) = building_pars(ind_thick_4_win_r,st)
+
+                 surf_usm_h(l)%green_type_roof(m) = building_pars(ind_green_type_roof,st)
+
+              ENDIF
+           ENDDO
         ENDDO
 
@@ -4179,176 +4091,178 @@
 !--  on level 1 or 2.
      IF ( building_pars_f%from_file )  THEN
-        DO  m = 1, surf_usm_h%ns
-           i = surf_usm_h%i(m)
-           j = surf_usm_h%j(m)
-
-!
-!--        In order to distinguish between ground floor level and above-ground-floor level surfaces,
-!--        set input indices.
-           ind_wall_frac    = MERGE( ind_wall_frac_gfl, ind_wall_frac_agfl,                        &
-                                     surf_usm_h%ground_level(m) )
-           ind_green_frac_r = MERGE( ind_green_frac_r_gfl, ind_green_frac_r_agfl,                  &
-                                     surf_usm_h%ground_level(m) )
-           ind_win_frac     = MERGE( ind_win_frac_gfl, ind_win_frac_agfl,                          &
-                                     surf_usm_h%ground_level(m) )
-           ind_lai_r        = MERGE( ind_lai_r_gfl, ind_lai_r_agfl, surf_usm_h%ground_level(m) )
-           ind_z0           = MERGE( ind_z0_gfl, ind_z0_agfl, surf_usm_h%ground_level(m) )
-           ind_z0qh         = MERGE( ind_z0qh_gfl, ind_z0qh_agfl, surf_usm_h%ground_level(m) )
-           ind_hc1          = MERGE( ind_hc1_gfl, ind_hc1_agfl, surf_usm_h%ground_level(m) )
-           ind_hc2          = MERGE( ind_hc2_gfl, ind_hc2_agfl, surf_usm_h%ground_level(m) )
-           ind_hc3          = MERGE( ind_hc3_gfl, ind_hc3_agfl, surf_usm_h%ground_level(m) )
-           ind_tc1          = MERGE( ind_tc1_gfl, ind_tc1_agfl, surf_usm_h%ground_level(m) )
-           ind_tc2          = MERGE( ind_tc2_gfl, ind_tc2_agfl, surf_usm_h%ground_level(m) )
-           ind_tc3          = MERGE( ind_tc3_gfl, ind_tc3_agfl, surf_usm_h%ground_level(m) )
-           ind_emis_wall    = MERGE( ind_emis_wall_gfl, ind_emis_wall_agfl,                        &
-                                     surf_usm_h%ground_level(m) )
-           ind_emis_green   = MERGE( ind_emis_green_gfl, ind_emis_green_agfl,                      &
-                                     surf_usm_h%ground_level(m) )
-           ind_emis_win     = MERGE( ind_emis_win_gfl, ind_emis_win_agfl,                          &
-                                     surf_usm_h%ground_level(m) )
-           ind_trans        = MERGE( ind_trans_gfl, ind_trans_agfl, surf_usm_h%ground_level(m) )
-
-!
-!--        Initialize relatvie wall- (0), green- (1) and window (2) fractions
-           IF ( building_pars_f%pars_xy(ind_wall_frac,j,i) /= building_pars_f%fill )               &
-              surf_usm_h%frac(m,ind_veg_wall) = building_pars_f%pars_xy(ind_wall_frac,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_green_frac_r,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%frac(m,ind_pav_green) = building_pars_f%pars_xy(ind_green_frac_r,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_win_frac,j,i) /= building_pars_f%fill )                &
-              surf_usm_h%frac(m,ind_wat_win) = building_pars_f%pars_xy(ind_win_frac,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_lai_r,j,i) /= building_pars_f%fill )                   &
-              surf_usm_h%lai(m) = building_pars_f%pars_xy(ind_lai_r,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_hc1,j,i) /= building_pars_f%fill )  THEN
-              surf_usm_h%rho_c_wall(nzb_wall,m) = building_pars_f%pars_xy(ind_hc1,j,i)
-              surf_usm_h%rho_c_wall(nzb_wall+1,m) = building_pars_f%pars_xy(ind_hc1,j,i)
-           ENDIF
-
-
-           IF ( building_pars_f%pars_xy(ind_hc2,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%rho_c_wall(nzb_wall+2,m) = building_pars_f%pars_xy(ind_hc2,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_hc3,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%rho_c_wall(nzb_wall+3,m) = building_pars_f%pars_xy(ind_hc3,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_hc1,j,i) /= building_pars_f%fill )  THEN
-              surf_usm_h%rho_c_green(nzb_wall,m) = building_pars_f%pars_xy(ind_hc1,j,i)
-              surf_usm_h%rho_c_green(nzb_wall+1,m) = building_pars_f%pars_xy(ind_hc1,j,i)
-           ENDIF
-           IF ( building_pars_f%pars_xy(ind_hc2,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%rho_c_green(nzb_wall+2,m) = building_pars_f%pars_xy(ind_hc2,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_hc3,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%rho_c_green(nzb_wall+3,m) = building_pars_f%pars_xy(ind_hc3,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_hc1,j,i) /= building_pars_f%fill )  THEN
-              surf_usm_h%rho_c_window(nzb_wall,m) = building_pars_f%pars_xy(ind_hc1,j,i)
-              surf_usm_h%rho_c_window(nzb_wall+1,m) = building_pars_f%pars_xy(ind_hc1,j,i)
-           ENDIF
-           IF ( building_pars_f%pars_xy(ind_hc2,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%rho_c_window(nzb_wall+2,m) = building_pars_f%pars_xy(ind_hc2,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_hc3,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%rho_c_window(nzb_wall+3,m) = building_pars_f%pars_xy(ind_hc3,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_tc1,j,i) /= building_pars_f%fill )  THEN
-              surf_usm_h%lambda_h(nzb_wall,m)   = building_pars_f%pars_xy(ind_tc1,j,i)
-              surf_usm_h%lambda_h(nzb_wall+1,m) = building_pars_f%pars_xy(ind_tc1,j,i)
-           ENDIF
-           IF ( building_pars_f%pars_xy(ind_tc2,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%lambda_h(nzb_wall+2,m) = building_pars_f%pars_xy(ind_tc2,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_tc3,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%lambda_h(nzb_wall+3,m) = building_pars_f%pars_xy(ind_tc3,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_tc1,j,i) /= building_pars_f%fill )  THEN
-              surf_usm_h%lambda_h_green(nzb_wall,m) = building_pars_f%pars_xy(ind_tc1,j,i)
-              surf_usm_h%lambda_h_green(nzb_wall+1,m) = building_pars_f%pars_xy(ind_tc1,j,i)
-           ENDIF
-           IF ( building_pars_f%pars_xy(ind_tc2,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%lambda_h_green(nzb_wall+2,m) = building_pars_f%pars_xy(ind_tc2,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_tc3,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%lambda_h_green(nzb_wall+3,m) = building_pars_f%pars_xy(ind_tc3,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_tc1,j,i) /= building_pars_f%fill )  THEN
-              surf_usm_h%lambda_h_window(nzb_wall,m) = building_pars_f%pars_xy(ind_tc1,j,i)
-              surf_usm_h%lambda_h_window(nzb_wall+1,m) = building_pars_f%pars_xy(ind_tc1,j,i)
-           ENDIF
-           IF ( building_pars_f%pars_xy(ind_tc2,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%lambda_h_window(nzb_wall+2,m) = building_pars_f%pars_xy(ind_tc2,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_tc3,j,i) /= building_pars_f%fill )                     &
-              surf_usm_h%lambda_h_window(nzb_wall+3,m) = building_pars_f%pars_xy(ind_tc3,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_indoor_target_temp_summer,j,i) /=                      &
-                building_pars_f%fill )                                                             &
-              surf_usm_h%target_temp_summer(m) =                                                   &
-              building_pars_f%pars_xy(ind_indoor_target_temp_summer,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_indoor_target_temp_winter,j,i) /=                      &
-                building_pars_f%fill )                                                             &
-              surf_usm_h%target_temp_winter(m) =                                                   &
-              building_pars_f%pars_xy(ind_indoor_target_temp_winter,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_emis_wall,j,i) /= building_pars_f%fill )               &
-              surf_usm_h%emissivity(m,ind_veg_wall) = building_pars_f%pars_xy(ind_emis_wall,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_emis_green,j,i) /= building_pars_f%fill )              &
-              surf_usm_h%emissivity(m,ind_pav_green) = building_pars_f%pars_xy(ind_emis_green,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_emis_win,j,i) /= building_pars_f%fill )                &
-              surf_usm_h%emissivity(m,ind_wat_win) = building_pars_f%pars_xy(ind_emis_win,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_trans,j,i) /= building_pars_f%fill )                   &
-              surf_usm_h%transmissivity(m) = building_pars_f%pars_xy(ind_trans,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_z0,j,i) /= building_pars_f%fill )                      &
-              surf_usm_h%z0(m) = building_pars_f%pars_xy(ind_z0,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_z0qh,j,i) /= building_pars_f%fill )                    &
-              surf_usm_h%z0h(m) = building_pars_f%pars_xy(ind_z0qh,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_z0qh,j,i) /= building_pars_f%fill )                    &
-              surf_usm_h%z0q(m) = building_pars_f%pars_xy(ind_z0qh,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_alb_wall_agfl,j,i) /= building_pars_f%fill )           &
-              surf_usm_h%albedo_type(m,ind_veg_wall)  =                                            &
-              building_pars_f%pars_xy(ind_alb_wall_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_alb_green_agfl,j,i) /= building_pars_f%fill )          &
-              surf_usm_h%albedo_type(m,ind_pav_green) =                                            &
-              building_pars_f%pars_xy(ind_alb_green_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_alb_win_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%albedo_type(m,ind_wat_win)   =                                            &
-              building_pars_f%pars_xy(ind_alb_win_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_1_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw(nzb_wall,m) = building_pars_f%pars_xy(ind_thick_1_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_2_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw(nzb_wall+1,m) = building_pars_f%pars_xy(ind_thick_2_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_3_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw(nzb_wall+2,m) = building_pars_f%pars_xy(ind_thick_3_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_4_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw(nzb_wall+3,m) = building_pars_f%pars_xy(ind_thick_4_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_1_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw_green(nzb_wall,m) = building_pars_f%pars_xy(ind_thick_1_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_2_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw_green(nzb_wall+1,m) = building_pars_f%pars_xy(ind_thick_2_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_3_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw_green(nzb_wall+2,m) = building_pars_f%pars_xy(ind_thick_3_agfl,j,i)
-
-           IF ( building_pars_f%pars_xy(ind_thick_4_agfl,j,i) /= building_pars_f%fill )            &
-              surf_usm_h%zw_green(nzb_wall+3,m) = building_pars_f%pars_xy(ind_thick_4_agfl,j,i)
+        DO  l = 0, 1
+           DO  m = 1, surf_usm_h(l)%ns
+              i = surf_usm_h(l)%i(m)
+              j = surf_usm_h(l)%j(m)
+
+!
+!--           In order to distinguish between ground floor level and above-ground-floor level surfaces,
+!--           set input indices.
+              ind_wall_frac    = MERGE( ind_wall_frac_gfl, ind_wall_frac_agfl,                        &
+                                        surf_usm_h(l)%ground_level(m) )
+              ind_green_frac_r = MERGE( ind_green_frac_r_gfl, ind_green_frac_r_agfl,                  &
+                                        surf_usm_h(l)%ground_level(m) )
+              ind_win_frac     = MERGE( ind_win_frac_gfl, ind_win_frac_agfl,                          &
+                                        surf_usm_h(l)%ground_level(m) )
+              ind_lai_r        = MERGE( ind_lai_r_gfl, ind_lai_r_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_z0           = MERGE( ind_z0_gfl, ind_z0_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_z0qh         = MERGE( ind_z0qh_gfl, ind_z0qh_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_hc1          = MERGE( ind_hc1_gfl, ind_hc1_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_hc2          = MERGE( ind_hc2_gfl, ind_hc2_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_hc3          = MERGE( ind_hc3_gfl, ind_hc3_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_tc1          = MERGE( ind_tc1_gfl, ind_tc1_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_tc2          = MERGE( ind_tc2_gfl, ind_tc2_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_tc3          = MERGE( ind_tc3_gfl, ind_tc3_agfl, surf_usm_h(l)%ground_level(m) )
+              ind_emis_wall    = MERGE( ind_emis_wall_gfl, ind_emis_wall_agfl,                        &
+                                        surf_usm_h(l)%ground_level(m) )
+              ind_emis_green   = MERGE( ind_emis_green_gfl, ind_emis_green_agfl,                      &
+                                        surf_usm_h(l)%ground_level(m) )
+              ind_emis_win     = MERGE( ind_emis_win_gfl, ind_emis_win_agfl,                          &
+                                        surf_usm_h(l)%ground_level(m) )
+              ind_trans        = MERGE( ind_trans_gfl, ind_trans_agfl, surf_usm_h(l)%ground_level(m) )
+
+!
+!--           Initialize relatvie wall- (0), green- (1) and window (2) fractions
+              IF ( building_pars_f%pars_xy(ind_wall_frac,j,i) /= building_pars_f%fill )               &
+                 surf_usm_h(l)%frac(m,ind_veg_wall) = building_pars_f%pars_xy(ind_wall_frac,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_green_frac_r,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%frac(m,ind_pav_green) = building_pars_f%pars_xy(ind_green_frac_r,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_win_frac,j,i) /= building_pars_f%fill )                &
+                 surf_usm_h(l)%frac(m,ind_wat_win) = building_pars_f%pars_xy(ind_win_frac,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_lai_r,j,i) /= building_pars_f%fill )                   &
+                 surf_usm_h(l)%lai(m) = building_pars_f%pars_xy(ind_lai_r,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_hc1,j,i) /= building_pars_f%fill )  THEN
+                 surf_usm_h(l)%rho_c_wall(nzb_wall,m) = building_pars_f%pars_xy(ind_hc1,j,i)
+                 surf_usm_h(l)%rho_c_wall(nzb_wall+1,m) = building_pars_f%pars_xy(ind_hc1,j,i)
+              ENDIF
+
+
+              IF ( building_pars_f%pars_xy(ind_hc2,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%rho_c_wall(nzb_wall+2,m) = building_pars_f%pars_xy(ind_hc2,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_hc3,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%rho_c_wall(nzb_wall+3,m) = building_pars_f%pars_xy(ind_hc3,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_hc1,j,i) /= building_pars_f%fill )  THEN
+                 surf_usm_h(l)%rho_c_green(nzb_wall,m) = building_pars_f%pars_xy(ind_hc1,j,i)
+                 surf_usm_h(l)%rho_c_green(nzb_wall+1,m) = building_pars_f%pars_xy(ind_hc1,j,i)
+              ENDIF
+              IF ( building_pars_f%pars_xy(ind_hc2,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%rho_c_green(nzb_wall+2,m) = building_pars_f%pars_xy(ind_hc2,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_hc3,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%rho_c_green(nzb_wall+3,m) = building_pars_f%pars_xy(ind_hc3,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_hc1,j,i) /= building_pars_f%fill )  THEN
+                 surf_usm_h(l)%rho_c_window(nzb_wall,m) = building_pars_f%pars_xy(ind_hc1,j,i)
+                 surf_usm_h(l)%rho_c_window(nzb_wall+1,m) = building_pars_f%pars_xy(ind_hc1,j,i)
+              ENDIF
+              IF ( building_pars_f%pars_xy(ind_hc2,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%rho_c_window(nzb_wall+2,m) = building_pars_f%pars_xy(ind_hc2,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_hc3,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%rho_c_window(nzb_wall+3,m) = building_pars_f%pars_xy(ind_hc3,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_tc1,j,i) /= building_pars_f%fill )  THEN
+                 surf_usm_h(l)%lambda_h(nzb_wall,m)   = building_pars_f%pars_xy(ind_tc1,j,i)
+                 surf_usm_h(l)%lambda_h(nzb_wall+1,m) = building_pars_f%pars_xy(ind_tc1,j,i)
+              ENDIF
+              IF ( building_pars_f%pars_xy(ind_tc2,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%lambda_h(nzb_wall+2,m) = building_pars_f%pars_xy(ind_tc2,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_tc3,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%lambda_h(nzb_wall+3,m) = building_pars_f%pars_xy(ind_tc3,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_tc1,j,i) /= building_pars_f%fill )  THEN
+                 surf_usm_h(l)%lambda_h_green(nzb_wall,m) = building_pars_f%pars_xy(ind_tc1,j,i)
+                 surf_usm_h(l)%lambda_h_green(nzb_wall+1,m) = building_pars_f%pars_xy(ind_tc1,j,i)
+              ENDIF
+              IF ( building_pars_f%pars_xy(ind_tc2,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%lambda_h_green(nzb_wall+2,m) = building_pars_f%pars_xy(ind_tc2,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_tc3,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%lambda_h_green(nzb_wall+3,m) = building_pars_f%pars_xy(ind_tc3,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_tc1,j,i) /= building_pars_f%fill )  THEN
+                 surf_usm_h(l)%lambda_h_window(nzb_wall,m) = building_pars_f%pars_xy(ind_tc1,j,i)
+                 surf_usm_h(l)%lambda_h_window(nzb_wall+1,m) = building_pars_f%pars_xy(ind_tc1,j,i)
+              ENDIF
+              IF ( building_pars_f%pars_xy(ind_tc2,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%lambda_h_window(nzb_wall+2,m) = building_pars_f%pars_xy(ind_tc2,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_tc3,j,i) /= building_pars_f%fill )                     &
+                 surf_usm_h(l)%lambda_h_window(nzb_wall+3,m) = building_pars_f%pars_xy(ind_tc3,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_indoor_target_temp_summer,j,i) /=                      &
+                   building_pars_f%fill )                                                             &
+                 surf_usm_h(l)%target_temp_summer(m) =                                                &
+                 building_pars_f%pars_xy(ind_indoor_target_temp_summer,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_indoor_target_temp_winter,j,i) /=                      &
+                   building_pars_f%fill )                                                             &
+                 surf_usm_h(l)%target_temp_winter(m) =                                                &
+                 building_pars_f%pars_xy(ind_indoor_target_temp_winter,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_emis_wall,j,i) /= building_pars_f%fill )               &
+                 surf_usm_h(l)%emissivity(m,ind_veg_wall) = building_pars_f%pars_xy(ind_emis_wall,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_emis_green,j,i) /= building_pars_f%fill )              &
+                 surf_usm_h(l)%emissivity(m,ind_pav_green) = building_pars_f%pars_xy(ind_emis_green,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_emis_win,j,i) /= building_pars_f%fill )                &
+                 surf_usm_h(l)%emissivity(m,ind_wat_win) = building_pars_f%pars_xy(ind_emis_win,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_trans,j,i) /= building_pars_f%fill )                   &
+                 surf_usm_h(l)%transmissivity(m) = building_pars_f%pars_xy(ind_trans,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_z0,j,i) /= building_pars_f%fill )                      &
+                 surf_usm_h(l)%z0(m) = building_pars_f%pars_xy(ind_z0,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_z0qh,j,i) /= building_pars_f%fill )                    &
+                 surf_usm_h(l)%z0h(m) = building_pars_f%pars_xy(ind_z0qh,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_z0qh,j,i) /= building_pars_f%fill )                    &
+                 surf_usm_h(l)%z0q(m) = building_pars_f%pars_xy(ind_z0qh,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_alb_wall_agfl,j,i) /= building_pars_f%fill )           &
+                 surf_usm_h(l)%albedo_type(m,ind_veg_wall)  =                                         &
+                 building_pars_f%pars_xy(ind_alb_wall_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_alb_green_agfl,j,i) /= building_pars_f%fill )          &
+                 surf_usm_h(l)%albedo_type(m,ind_pav_green) =                                         &
+                 building_pars_f%pars_xy(ind_alb_green_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_alb_win_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%albedo_type(m,ind_wat_win)   =                                         &
+                 building_pars_f%pars_xy(ind_alb_win_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_1_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw(nzb_wall,m) = building_pars_f%pars_xy(ind_thick_1_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_2_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw(nzb_wall+1,m) = building_pars_f%pars_xy(ind_thick_2_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_3_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw(nzb_wall+2,m) = building_pars_f%pars_xy(ind_thick_3_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_4_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw(nzb_wall+3,m) = building_pars_f%pars_xy(ind_thick_4_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_1_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw_green(nzb_wall,m) = building_pars_f%pars_xy(ind_thick_1_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_2_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw_green(nzb_wall+1,m) = building_pars_f%pars_xy(ind_thick_2_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_3_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw_green(nzb_wall+2,m) = building_pars_f%pars_xy(ind_thick_3_agfl,j,i)
+
+              IF ( building_pars_f%pars_xy(ind_thick_4_agfl,j,i) /= building_pars_f%fill )            &
+                 surf_usm_h(l)%zw_green(nzb_wall+3,m) = building_pars_f%pars_xy(ind_thick_4_agfl,j,i)
+           ENDDO
         ENDDO
 
@@ -4558,140 +4472,142 @@
 !--  Read building surface pars. If present, they override LOD1-LOD3 building pars where applicable
      IF ( building_surface_pars_f%from_file )  THEN
-        DO  m = 1, surf_usm_h%ns
-           i = surf_usm_h%i(m)
-           j = surf_usm_h%j(m)
-           k = surf_usm_h%k(m)
-!
-!--        Iterate over surfaces in column, check height and orientation
-           DO  is = building_surface_pars_f%index_ji(1,j,i), &
-                    building_surface_pars_f%index_ji(2,j,i)
-              IF ( building_surface_pars_f%coords(4,is) == -surf_usm_h%koff .AND.                  &
-                   building_surface_pars_f%coords(1,is) == k )  THEN
-
-                 IF ( building_surface_pars_f%pars(ind_s_wall_frac,is) /=                          &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%frac(m,ind_veg_wall) =                                              &
-                    building_surface_pars_f%pars(ind_s_wall_frac,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_green_frac_w,is) /=                       &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%frac(m,ind_pav_green) =                                             &
-                    building_surface_pars_f%pars(ind_s_green_frac_w,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_green_frac_r,is) /=                       &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%frac(m,ind_pav_green) =                                             &
-                    building_surface_pars_f%pars(ind_s_green_frac_r,is)
-                    !TODO clarify: why should _w and _r be on the same surface?
-
-                 IF ( building_surface_pars_f%pars(ind_s_win_frac,is) /=                           &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%frac(m,ind_wat_win) = building_surface_pars_f%pars(ind_s_win_frac,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_lai_r,is) /=                              &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%lai(m) = building_surface_pars_f%pars(ind_s_lai_r,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_hc1,is) /=                                &
-                      building_surface_pars_f%fill )  THEN
-                    surf_usm_h%rho_c_wall(nzb_wall:nzb_wall+1,m) =                                 &
-                    building_surface_pars_f%pars(ind_s_hc1,is)
-                    surf_usm_h%rho_c_green(nzb_wall:nzb_wall+1,m) =                                &
-                    building_surface_pars_f%pars(ind_s_hc1,is)
-                    surf_usm_h%rho_c_window(nzb_wall:nzb_wall+1,m) =                               &
-                    building_surface_pars_f%pars(ind_s_hc1,is)
+        DO  l = 0, 1
+           DO  m = 1, surf_usm_h(l)%ns
+              i = surf_usm_h(l)%i(m)
+              j = surf_usm_h(l)%j(m)
+              k = surf_usm_h(l)%k(m)
+!
+!--           Iterate over surfaces in column, check height and orientation
+              DO  is = building_surface_pars_f%index_ji(1,j,i), &
+                       building_surface_pars_f%index_ji(2,j,i)
+                 IF ( building_surface_pars_f%coords(4,is) == -surf_usm_h(l)%koff .AND.               &
+                      building_surface_pars_f%coords(1,is) == k )  THEN
+
+                    IF ( building_surface_pars_f%pars(ind_s_wall_frac,is) /=                          &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%frac(m,ind_veg_wall) =                                           &
+                       building_surface_pars_f%pars(ind_s_wall_frac,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_green_frac_w,is) /=                       &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%frac(m,ind_pav_green) =                                          &
+                       building_surface_pars_f%pars(ind_s_green_frac_w,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_green_frac_r,is) /=                       &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%frac(m,ind_pav_green) =                                          &
+                       building_surface_pars_f%pars(ind_s_green_frac_r,is)
+                       !TODO clarify: why should _w and _r be on the same surface?
+
+                    IF ( building_surface_pars_f%pars(ind_s_win_frac,is) /=                           &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%frac(m,ind_wat_win) = building_surface_pars_f%pars(ind_s_win_frac,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_lai_r,is) /=                              &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%lai(m) = building_surface_pars_f%pars(ind_s_lai_r,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_hc1,is) /=                                &
+                         building_surface_pars_f%fill )  THEN
+                       surf_usm_h(l)%rho_c_wall(nzb_wall:nzb_wall+1,m) =                              &
+                       building_surface_pars_f%pars(ind_s_hc1,is)
+                       surf_usm_h(l)%rho_c_green(nzb_wall:nzb_wall+1,m) =                             &
+                       building_surface_pars_f%pars(ind_s_hc1,is)
+                       surf_usm_h(l)%rho_c_window(nzb_wall:nzb_wall+1,m) =                            &
+                       building_surface_pars_f%pars(ind_s_hc1,is)
+                    ENDIF
+
+                    IF ( building_surface_pars_f%pars(ind_s_hc2,is) /=                                &
+                         building_surface_pars_f%fill )  THEN
+                       surf_usm_h(l)%rho_c_wall(nzb_wall+2,m) =                                       &
+                       building_surface_pars_f%pars(ind_s_hc2,is)
+                       surf_usm_h(l)%rho_c_green(nzb_wall+2,m) =                                      &
+                       building_surface_pars_f%pars(ind_s_hc2,is)
+                       surf_usm_h(l)%rho_c_window(nzb_wall+2,m) =                                     &
+                       building_surface_pars_f%pars(ind_s_hc2,is)
+                    ENDIF
+
+                    IF ( building_surface_pars_f%pars(ind_s_hc3,is) /=                                &
+                         building_surface_pars_f%fill )  THEN
+                       surf_usm_h(l)%rho_c_wall(nzb_wall+3,m) =                                       &
+                       building_surface_pars_f%pars(ind_s_hc3,is)
+                       surf_usm_h(l)%rho_c_green(nzb_wall+3,m) =                                      &
+                       building_surface_pars_f%pars(ind_s_hc3,is)
+                       surf_usm_h(l)%rho_c_window(nzb_wall+3,m) =                                     &
+                       building_surface_pars_f%pars(ind_s_hc3,is)
+                    ENDIF
+
+                    IF ( building_surface_pars_f%pars(ind_s_tc1,is) /=                                &
+                         building_surface_pars_f%fill )  THEN
+                       surf_usm_h(l)%lambda_h(nzb_wall:nzb_wall+1,m) =                                &
+                       building_surface_pars_f%pars(ind_s_tc1,is)
+                       surf_usm_h(l)%lambda_h_green(nzb_wall:nzb_wall+1,m) =                          &
+                       building_surface_pars_f%pars(ind_s_tc1,is)
+                       surf_usm_h(l)%lambda_h_window(nzb_wall:nzb_wall+1,m) =                         &
+                       building_surface_pars_f%pars(ind_s_tc1,is)
+                    ENDIF
+
+                    IF ( building_surface_pars_f%pars(ind_s_tc2,is) /=                                &
+                         building_surface_pars_f%fill )  THEN
+                       surf_usm_h(l)%lambda_h(nzb_wall+2,m) =                                         &
+                       building_surface_pars_f%pars(ind_s_tc2,is)
+                       surf_usm_h(l)%lambda_h_green(nzb_wall+2,m) =                                   &
+                       building_surface_pars_f%pars(ind_s_tc2,is)
+                       surf_usm_h(l)%lambda_h_window(nzb_wall+2,m) =                                  &
+                       building_surface_pars_f%pars(ind_s_tc2,is)
+                    ENDIF
+
+                    IF ( building_surface_pars_f%pars(ind_s_tc3,is) /=                                &
+                         building_surface_pars_f%fill )  THEN
+                       surf_usm_h(l)%lambda_h(nzb_wall+3,m) =                                         &
+                       building_surface_pars_f%pars(ind_s_tc3,is)
+                       surf_usm_h(l)%lambda_h_green(nzb_wall+3,m) =                                   &
+                       building_surface_pars_f%pars(ind_s_tc3,is)
+                       surf_usm_h(l)%lambda_h_window(nzb_wall+3,m) =                                  &
+                       building_surface_pars_f%pars(ind_s_tc3,is)
+                    ENDIF
+
+                    IF ( building_surface_pars_f%pars(ind_s_indoor_target_temp_summer,is) /=          &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%target_temp_summer(m) =                                          &
+                       building_surface_pars_f%pars(ind_s_indoor_target_temp_summer,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_indoor_target_temp_winter,is) /=          &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%target_temp_winter(m) =                                          &
+                       building_surface_pars_f%pars(ind_s_indoor_target_temp_winter,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_emis_wall,is) /=                          &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%emissivity(m,ind_veg_wall) =                                     &
+                       building_surface_pars_f%pars(ind_s_emis_wall,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_emis_green,is) /=                         &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%emissivity(m,ind_pav_green) =                                    &
+                       building_surface_pars_f%pars(ind_s_emis_green,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_emis_win,is) /=                           &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%emissivity(m,ind_wat_win) =                                      &
+                       building_surface_pars_f%pars(ind_s_emis_win,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_trans,is) /=                              &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%transmissivity(m) = building_surface_pars_f%pars(ind_s_trans,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_z0,is) /=                                 &
+                         building_surface_pars_f%fill )                                               &
+                       surf_usm_h(l)%z0(m) = building_surface_pars_f%pars(ind_s_z0,is)
+
+                    IF ( building_surface_pars_f%pars(ind_s_z0qh,is) /=                               &
+                         building_surface_pars_f%fill )  THEN
+                       surf_usm_h(l)%z0q(m) = building_surface_pars_f%pars(ind_s_z0qh,is)
+                       surf_usm_h(l)%z0h(m) = building_surface_pars_f%pars(ind_s_z0qh,is)
+                    ENDIF
+
+                    EXIT ! Surface was found and processed
                  ENDIF
-
-                 IF ( building_surface_pars_f%pars(ind_s_hc2,is) /=                                &
-                      building_surface_pars_f%fill )  THEN
-                    surf_usm_h%rho_c_wall(nzb_wall+2,m) =                                          &
-                    building_surface_pars_f%pars(ind_s_hc2,is)
-                    surf_usm_h%rho_c_green(nzb_wall+2,m) =                                         &
-                    building_surface_pars_f%pars(ind_s_hc2,is)
-                    surf_usm_h%rho_c_window(nzb_wall+2,m) =                                        &
-                    building_surface_pars_f%pars(ind_s_hc2,is)
-                 ENDIF
-
-                 IF ( building_surface_pars_f%pars(ind_s_hc3,is) /=                                &
-                      building_surface_pars_f%fill )  THEN
-                    surf_usm_h%rho_c_wall(nzb_wall+3,m) =                                          &
-                    building_surface_pars_f%pars(ind_s_hc3,is)
-                    surf_usm_h%rho_c_green(nzb_wall+3,m) =                                         &
-                    building_surface_pars_f%pars(ind_s_hc3,is)
-                    surf_usm_h%rho_c_window(nzb_wall+3,m) =                                        &
-                    building_surface_pars_f%pars(ind_s_hc3,is)
-                 ENDIF
-
-                 IF ( building_surface_pars_f%pars(ind_s_tc1,is) /=                                &
-                      building_surface_pars_f%fill )  THEN
-                    surf_usm_h%lambda_h(nzb_wall:nzb_wall+1,m) =                                   &
-                    building_surface_pars_f%pars(ind_s_tc1,is)
-                    surf_usm_h%lambda_h_green(nzb_wall:nzb_wall+1,m) =                             &
-                    building_surface_pars_f%pars(ind_s_tc1,is)
-                    surf_usm_h%lambda_h_window(nzb_wall:nzb_wall+1,m) =                            &
-                    building_surface_pars_f%pars(ind_s_tc1,is)
-                 ENDIF
-
-                 IF ( building_surface_pars_f%pars(ind_s_tc2,is) /=                                &
-                      building_surface_pars_f%fill )  THEN
-                    surf_usm_h%lambda_h(nzb_wall+2,m) =                                            &
-                    building_surface_pars_f%pars(ind_s_tc2,is)
-                    surf_usm_h%lambda_h_green(nzb_wall+2,m) =                                      &
-                    building_surface_pars_f%pars(ind_s_tc2,is)
-                    surf_usm_h%lambda_h_window(nzb_wall+2,m) =                                     &
-                    building_surface_pars_f%pars(ind_s_tc2,is)
-                 ENDIF
-
-                 IF ( building_surface_pars_f%pars(ind_s_tc3,is) /=                                &
-                      building_surface_pars_f%fill )  THEN
-                    surf_usm_h%lambda_h(nzb_wall+3,m) =                                            &
-                    building_surface_pars_f%pars(ind_s_tc3,is)
-                    surf_usm_h%lambda_h_green(nzb_wall+3,m) =                                      &
-                    building_surface_pars_f%pars(ind_s_tc3,is)
-                    surf_usm_h%lambda_h_window(nzb_wall+3,m) =                                     &
-                    building_surface_pars_f%pars(ind_s_tc3,is)
-                 ENDIF
-
-                 IF ( building_surface_pars_f%pars(ind_s_indoor_target_temp_summer,is) /=          &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%target_temp_summer(m) =                                             &
-                    building_surface_pars_f%pars(ind_s_indoor_target_temp_summer,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_indoor_target_temp_winter,is) /=          &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%target_temp_winter(m) =                                             &
-                    building_surface_pars_f%pars(ind_s_indoor_target_temp_winter,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_emis_wall,is) /=                          &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%emissivity(m,ind_veg_wall) =                                        &
-                    building_surface_pars_f%pars(ind_s_emis_wall,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_emis_green,is) /=                         &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%emissivity(m,ind_pav_green) =                                       &
-                    building_surface_pars_f%pars(ind_s_emis_green,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_emis_win,is) /=                           &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%emissivity(m,ind_wat_win) =                                         &
-                    building_surface_pars_f%pars(ind_s_emis_win,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_trans,is) /=                              &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%transmissivity(m) = building_surface_pars_f%pars(ind_s_trans,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_z0,is) /=                                 &
-                      building_surface_pars_f%fill )                                               &
-                    surf_usm_h%z0(m) = building_surface_pars_f%pars(ind_s_z0,is)
-
-                 IF ( building_surface_pars_f%pars(ind_s_z0qh,is) /=                               &
-                      building_surface_pars_f%fill )  THEN
-                    surf_usm_h%z0q(m) = building_surface_pars_f%pars(ind_s_z0qh,is)
-                    surf_usm_h%z0h(m) = building_surface_pars_f%pars(ind_s_z0qh,is)
-                 ENDIF
-
-                 EXIT ! Surface was found and processed
-              ENDIF
+              ENDDO
            ENDDO
         ENDDO
@@ -4842,44 +4758,47 @@
      ENDIF
 !
-!--    Initialize albedo type via given type from static input file. Please note, even though
-!--    the albedo type has been already given by the pars, albedo_type overwrites these values.
-       IF ( albedo_type_f%from_file )  THEN
-          DO  m = 1, surf_usm_h%ns
-             i = surf_usm_h%i(m)
-             j = surf_usm_h%j(m)
-             IF ( albedo_type_f%var(j,i) /= albedo_type_f%fill )                                   &
-                surf_usm_h%albedo_type(m,:) = albedo_type_f%var(j,i)
-          ENDDO
-          DO  l = 0, 3
-             DO  m = 1, surf_usm_v(l)%ns
-                i = surf_usm_v(l)%i(m) + surf_usm_v(l)%ioff
-                j = surf_usm_v(l)%j(m) + surf_usm_v(l)%joff
-
-                IF ( albedo_type_f%var(j,i) /= albedo_type_f%fill )                                &
-                   surf_usm_v(l)%albedo_type(m,:) = albedo_type_f%var(j,i)
-             ENDDO
-          ENDDO
-       ENDIF
+!--  Initialize albedo type via given type from static input file. Please note, even though
+!--  the albedo type has been already given by the pars, albedo_type overwrites these values.
+     IF ( albedo_type_f%from_file )  THEN
+        DO  l = 0, 1
+           DO  m = 1, surf_usm_h(l)%ns
+              i = surf_usm_h(l)%i(m)
+              j = surf_usm_h(l)%j(m)
+              IF ( albedo_type_f%var(j,i) /= albedo_type_f%fill )                               &
+                 surf_usm_h(l)%albedo_type(m,:) = albedo_type_f%var(j,i)
+           ENDDO
+        ENDDO
+        DO  l = 0, 3
+           DO  m = 1, surf_usm_v(l)%ns
+              i = surf_usm_v(l)%i(m) + surf_usm_v(l)%ioff
+              j = surf_usm_v(l)%j(m) + surf_usm_v(l)%joff
+             IF ( albedo_type_f%var(j,i) /= albedo_type_f%fill )                                &
+                 surf_usm_v(l)%albedo_type(m,:) = albedo_type_f%var(j,i)
+           ENDDO
+        ENDDO
+     ENDIF
 !
 !--  Run further checks to ensure that the respecitve material fractions are prescribed properly.
 !--  Start with horizontal surfaces (roofs).
      relative_fractions_corrected = .FALSE.
-     DO  m = 1, surf_usm_h%ns
-        sum_frac = SUM( surf_usm_h%frac(m,:) )
-        IF ( sum_frac /= 1.0_wp )  THEN
-           relative_fractions_corrected = .TRUE.
-!
-!--        Normalize relative fractions to 1. Deviations from 1 can arise, e.g. by rounding errors
-!--        but also by inconsistent driver creation.
-           IF ( sum_frac /= 0.0_wp )  THEN
-              surf_usm_h%frac(m,:) = surf_usm_h%frac(m,:) / sum_frac
-!
-!--        In case all relative fractions are erroneously set to zero, set wall fraction to 1.
-           ELSE
-              surf_usm_h%frac(m,ind_veg_wall)  = 1.0_wp
-              surf_usm_h%frac(m,ind_wat_win)   = 0.0_wp
-              surf_usm_h%frac(m,ind_pav_green) = 0.0_wp
+     DO  l = 0, 1
+        DO  m = 1, surf_usm_h(l)%ns
+           sum_frac = SUM( surf_usm_h(l)%frac(m,:) )
+           IF ( sum_frac /= 1.0_wp )  THEN
+              relative_fractions_corrected = .TRUE.
+!
+!--           Normalize relative fractions to 1. Deviations from 1 can arise, e.g. by rounding errors
+!--           but also by inconsistent driver creation.
+              IF ( sum_frac /= 0.0_wp )  THEN
+                 surf_usm_h(l)%frac(m,:) = surf_usm_h(l)%frac(m,:) / sum_frac
+!
+!--           In case all relative fractions are erroneously set to zero, set wall fraction to 1.
+              ELSE
+                 surf_usm_h(l)%frac(m,ind_veg_wall)  = 1.0_wp
+                 surf_usm_h(l)%frac(m,ind_wat_win)   = 0.0_wp
+                 surf_usm_h(l)%frac(m,ind_pav_green) = 0.0_wp
+              ENDIF
            ENDIF
-        ENDIF
+        ENDDO
      ENDDO
 !
@@ -4928,30 +4847,26 @@
      ENDIF
 !
-!--  Read the surface_types array.
-!--  Please note, here also initialization of surface attributes is done as long as _urbsurf and
-!--  _surfpar files are available. Values from above will be overwritten. This might be removed
-!--  later, but is still in the code to enable compatibility with older model version.
-     CALL usm_read_urban_surface_types()
-
-     CALL usm_init_material_model()
+!--  Initialization of the wall/roof materials
+     CALL usm_init_wall_heat_model()
 
 !--  Init skin layer properties (can be done after initialization of wall layers)
-
-     DO  m = 1, surf_usm_h%ns
-        i = surf_usm_h%i(m)
-        j = surf_usm_h%j(m)
-
-         surf_usm_h%c_surface(m)           = surf_usm_h%rho_c_wall(nzb_wall,m) *                   &
-                                             surf_usm_h%dz_wall(nzb_wall,m) * 0.25_wp
-         surf_usm_h%lambda_surf(m)         = surf_usm_h%lambda_h(nzb_wall,m) *                     &
-                                             surf_usm_h%ddz_wall(nzb_wall,m) * 2.0_wp
-         surf_usm_h%c_surface_green(m)     = surf_usm_h%rho_c_wall(nzb_wall,m) *                   &
-                                             surf_usm_h%dz_wall(nzb_wall,m) * 0.25_wp
-         surf_usm_h%lambda_surf_green(m)   = surf_usm_h%lambda_h_green(nzb_wall,m) *               &
-                                             surf_usm_h%ddz_green(nzb_wall,m) * 2.0_wp
-         surf_usm_h%c_surface_window(m)    = surf_usm_h%rho_c_window(nzb_wall,m) *                 &
-                                             surf_usm_h%dz_window(nzb_wall,m) * 0.25_wp
-         surf_usm_h%lambda_surf_window(m)  = surf_usm_h%lambda_h_window(nzb_wall,m) *              &
-                                             surf_usm_h%ddz_window(nzb_wall,m) * 2.0_wp
+     DO  l = 0, 1
+        DO  m = 1, surf_usm_h(l)%ns
+           i = surf_usm_h(l)%i(m)
+           j = surf_usm_h(l)%j(m)
+
+            surf_usm_h(l)%c_surface(m)           = surf_usm_h(l)%rho_c_wall(nzb_wall,m) *          &
+                                                surf_usm_h(l)%dz_wall(nzb_wall,m) * 0.25_wp
+            surf_usm_h(l)%lambda_surf(m)         = surf_usm_h(l)%lambda_h(nzb_wall,m) *            &
+                                                surf_usm_h(l)%ddz_wall(nzb_wall,m) * 2.0_wp
+            surf_usm_h(l)%c_surface_green(m)     = surf_usm_h(l)%rho_c_wall(nzb_wall,m) *          &
+                                                surf_usm_h(l)%dz_wall(nzb_wall,m) * 0.25_wp
+            surf_usm_h(l)%lambda_surf_green(m)   = surf_usm_h(l)%lambda_h_green(nzb_wall,m) *      &
+                                                surf_usm_h(l)%ddz_green(nzb_wall,m) * 2.0_wp
+            surf_usm_h(l)%c_surface_window(m)    = surf_usm_h(l)%rho_c_window(nzb_wall,m) *        &
+                                                surf_usm_h(l)%dz_window(nzb_wall,m) * 0.25_wp
+            surf_usm_h(l)%lambda_surf_window(m)  = surf_usm_h(l)%lambda_h_window(nzb_wall,m) *     &
+                                                surf_usm_h(l)%ddz_window(nzb_wall,m) * 2.0_wp
+        ENDDO
      ENDDO
 
@@ -4977,35 +4892,29 @@
 
 !
-!--  Init anthropogenic sources of heat
-     IF ( usm_anthropogenic_heat )  THEN
-!
-!--      Init anthropogenic sources of heat (from transportation for now)
-         CALL usm_read_anthropogenic_heat()
-     ENDIF
-
-!
 !-- Check for consistent initialization.
 !-- Check if roughness length for momentum, or heat, exceed surface-layer height and decrease local
 !-- roughness length where necessary.
-    DO  m = 1, surf_usm_h%ns
-       IF ( surf_usm_h%z0(m) >= surf_usm_h%z_mo(m) )  THEN
-
-          surf_usm_h%z0(m) = 0.9_wp * surf_usm_h%z_mo(m)
-
-          WRITE( message_string, * ) 'z0 exceeds surface-layer height at horizontal urban ' //     &
-                                     'surface and is decreased appropriately at grid point ' //    &
-                                     '(i,j) = ',  surf_usm_h%i(m), surf_usm_h%j(m)
-          CALL message( 'urban_surface_model_mod', 'PA0503', 0, 0, myid, 6, 0 )
-       ENDIF
-       IF ( surf_usm_h%z0h(m) >= surf_usm_h%z_mo(m) )  THEN
-
-          surf_usm_h%z0h(m) = 0.9_wp * surf_usm_h%z_mo(m)
-          surf_usm_h%z0q(m) = 0.9_wp * surf_usm_h%z_mo(m)
-
-          WRITE( message_string, * ) 'z0h exceeds surface-layer height at horizontal urban ' //    &
-                                     'surface and is decreased appropriately at grid point ' //    &
-                                     '(i,j) = ', surf_usm_h%i(m), surf_usm_h%j(m)
-          CALL message( 'urban_surface_model_mod', 'PA0507', 0, 0, myid, 6, 0 )
-       ENDIF
+    DO  l = 0, 1
+       DO  m = 1, surf_usm_h(l)%ns
+          IF ( surf_usm_h(l)%z0(m) >= surf_usm_h(l)%z_mo(m) )  THEN
+
+             surf_usm_h(l)%z0(m) = 0.9_wp * surf_usm_h(l)%z_mo(m)
+
+             WRITE( message_string, * ) 'z0 exceeds surface-layer height at horizontal urban ' //     &
+                                        'surface and is decreased appropriately at grid point ' //    &
+                                        '(i,j) = ',  surf_usm_h(l)%i(m), surf_usm_h(l)%j(m)
+             CALL message( 'urban_surface_model_mod', 'PA0503', 0, 0, myid, 6, 0 )
+          ENDIF
+          IF ( surf_usm_h(l)%z0h(m) >= surf_usm_h(l)%z_mo(m) )  THEN
+
+             surf_usm_h(l)%z0h(m) = 0.9_wp * surf_usm_h(l)%z_mo(m)
+             surf_usm_h(l)%z0q(m) = 0.9_wp * surf_usm_h(l)%z_mo(m)
+
+             WRITE( message_string, * ) 'z0h exceeds surface-layer height at horizontal urban ' //    &
+                                        'surface and is decreased appropriately at grid point ' //    &
+                                        '(i,j) = ', surf_usm_h(l)%i(m), surf_usm_h(l)%j(m)
+             CALL message( 'urban_surface_model_mod', 'PA0507', 0, 0, myid, 6, 0 )
+          ENDIF
+       ENDDO
     ENDDO
 
@@ -5044,13 +4953,15 @@
 !--     At horizontal surfaces. Please note, t_surf_wall_h is defined on a different data type,
 !--     but with the same dimension.
-         DO  m = 1, surf_usm_h%ns
-            i = surf_usm_h%i(m)
-            j = surf_usm_h%j(m)
-            k = surf_usm_h%k(m)
-
-            t_surf_wall_h(m) = pt(k,j,i) * exner(k)
-            t_surf_window_h(m) = pt(k,j,i) * exner(k)
-            t_surf_green_h(m) = pt(k,j,i) * exner(k)
-            surf_usm_h%pt_surface(m) = pt(k,j,i) * exner(k)
+         DO  l = 0, 1
+            DO  m = 1, surf_usm_h(l)%ns
+               i = surf_usm_h(l)%i(m)
+               j = surf_usm_h(l)%j(m)
+               k = surf_usm_h(l)%k(m)
+
+               t_surf_wall_h(l)%val(m) = pt(k,j,i) * exner(k)
+               t_surf_window_h(l)%val(m) = pt(k,j,i) * exner(k)
+               t_surf_green_h(l)%val(m) = pt(k,j,i) * exner(k)
+               surf_usm_h(l)%pt_surface(m) = pt(k,j,i) * exner(k)
+            ENDDO
          ENDDO
 !
@@ -5062,7 +4973,7 @@
                k = surf_usm_v(l)%k(m)
 
-               t_surf_wall_v(l)%t(m) = pt(k,j,i) * exner(k)
-               t_surf_window_v(l)%t(m) = pt(k,j,i) * exner(k)
-               t_surf_green_v(l)%t(m) = pt(k,j,i) * exner(k)
+               t_surf_wall_v(l)%val(m) = pt(k,j,i) * exner(k)
+               t_surf_window_v(l)%val(m) = pt(k,j,i) * exner(k)
+               t_surf_green_v(l)%val(m) = pt(k,j,i) * exner(k)
                surf_usm_v(l)%pt_surface(m) = pt(k,j,i) * exner(k)
             ENDDO
@@ -5073,6 +4984,8 @@
 !--      Note, at urban surfaces q_surface is initialized with 0.
          IF ( humidity )  THEN
-            DO  m = 1, surf_usm_h%ns
-               surf_usm_h%q_surface(m) = 0.0_wp
+            DO  l = 0, 1
+               DO  m = 1, surf_usm_h(l)%ns
+                  surf_usm_h(l)%q_surface(m) = 0.0_wp
+               ENDDO
             ENDDO
             DO  l = 0, 3
@@ -5087,29 +5000,31 @@
 !--      and profile is logaritmic (linear in nz).
 !--      Horizontal surfaces
-         DO  m = 1, surf_usm_h%ns
-!
-!--         Roof
-            IF ( surf_usm_h%isroof_surf(m) )  THEN
-                tin = roof_inner_temperature
-                twin = window_inner_temperature
-!
-!--         Normal land surface
-            ELSE
-                tin = soil_inner_temperature
-                twin = window_inner_temperature
-            ENDIF
-
-            DO k = nzb_wall, nzt_wall+1
-                c = REAL( k - nzb_wall, wp ) / REAL( nzt_wall + 1 - nzb_wall , wp )
-
-                t_wall_h(k,m) = ( 1.0_wp - c ) * t_surf_wall_h(m) + c * tin
-                t_window_h(k,m) = ( 1.0_wp - c ) * t_surf_window_h(m) + c * twin
-                t_green_h(k,m) = t_surf_wall_h(m)
-                swc_h(k,m) = 0.5_wp
-                swc_sat_h(k,m) = 0.95_wp
-                swc_res_h(k,m) = 0.05_wp
-                rootfr_h(k,m) = 0.1_wp
-                wilt_h(k,m) = 0.1_wp
-                fc_h(k,m) = 0.9_wp
+         DO  l = 0, 1
+            DO  m = 1, surf_usm_h(l)%ns
+!
+!--            Roof
+               IF ( surf_usm_h(l)%isroof_surf(m) )  THEN
+                   tin = roof_inner_temperature
+                   twin = window_inner_temperature
+!
+!--            Normal land surface
+               ELSE
+                   tin = soil_inner_temperature
+                   twin = window_inner_temperature
+               ENDIF
+
+               DO k = nzb_wall, nzt_wall+1
+                   c = REAL( k - nzb_wall, wp ) / REAL( nzt_wall + 1 - nzb_wall , wp )
+
+                   t_wall_h(l)%val(k,m) = ( 1.0_wp - c ) * t_surf_wall_h(l)%val(m) + c * tin
+                   t_window_h(l)%val(k,m) = ( 1.0_wp - c ) * t_surf_window_h(l)%val(m) + c * twin
+                   t_green_h(l)%val(k,m) = t_surf_wall_h(l)%val(m)
+                   swc_h(l)%val(k,m) = 0.5_wp
+                   swc_sat_h(l)%val(k,m) = 0.95_wp
+                   swc_res_h(l)%val(k,m) = 0.05_wp
+                   rootfr_h(l)%val(k,m) = 0.1_wp
+                   wilt_h(l)%val(k,m) = 0.1_wp
+                   fc_h(l)%val(k,m) = 0.9_wp
+               ENDDO
             ENDDO
          ENDDO
@@ -5125,15 +5040,11 @@
                DO k = nzb_wall, nzt_wall+1
                   c = REAL( k - nzb_wall, wp ) / REAL( nzt_wall + 1 - nzb_wall , wp )
-                  t_wall_v(l)%t(k,m) = ( 1.0_wp - c ) * t_surf_wall_v(l)%t(m) + c * tin
-                  t_window_v(l)%t(k,m) = ( 1.0_wp - c ) * t_surf_window_v(l)%t(m) + c * twin
-                  t_green_v(l)%t(k,m) = t_surf_wall_v(l)%t(m)
+                  t_wall_v(l)%val(k,m) = ( 1.0_wp - c ) * t_surf_wall_v(l)%val(m) + c * tin
+                  t_window_v(l)%val(k,m) = ( 1.0_wp - c ) * t_surf_window_v(l)%val(m) + c * twin
+                  t_green_v(l)%val(k,m) = t_surf_wall_v(l)%val(m)
                ENDDO
             ENDDO
          ENDDO
      ENDIF
-
-!
-!--  If specified, replace constant wall temperatures with fully 3D values from file
-     IF ( read_wall_temp_3d )  CALL usm_read_wall_temperature()
 
 !--
@@ -5159,14 +5070,16 @@
 !
 !-- Set initial values for prognostic soil quantities
-    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
-       m_liq_usm_h%var_usm_1d  = 0.0_wp
-    ENDIF
-    m_liq_usm_h_p = m_liq_usm_h
-!
-!-- Set initial values for prognostic quantities
-!-- Horizontal surfaces
-    surf_usm_h%c_liq     = 0.0_wp
-    surf_usm_h%qsws_liq  = 0.0_wp
-    surf_usm_h%qsws_veg  = 0.0_wp
+    DO  l = 0, 1
+       IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
+          m_liq_usm_h(l)%val  = 0.0_wp
+       ENDIF
+       m_liq_usm_h_p(l)%val = m_liq_usm_h(l)%val
+!
+!--    Set initial values for prognostic quantities
+!--    Horizontal surfaces
+       surf_usm_h(l)%c_liq     = 0.0_wp
+       surf_usm_h(l)%qsws_liq  = 0.0_wp
+       surf_usm_h(l)%qsws_veg  = 0.0_wp
+    ENDDO
 
 !
@@ -5195,12 +5108,14 @@
 !> during spinup to increase possible timestep.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_material_heat_model( during_spinup )
+ SUBROUTINE usm_wall_heat_model( horizontal, l, during_spinup )
 
 
     IMPLICIT NONE
 
-    INTEGER(iwp)  ::  i,j,k,l,kw, m  !< running indices
-
-    LOGICAL  ::  during_spinup  !< if true, no calculation of window temperatures
+    LOGICAL       ::  horizontal     !< Flag indicating horizontal or vertical surfaces
+    INTEGER(iwp)  ::  l              !< direction index
+    LOGICAL       ::  during_spinup  !< if true, no calculation of window temperatures
+
+    INTEGER(iwp)  ::  i,j,k,kw, m    !< running indices
 
     REAL(wp)  ::  win_absorp  !< absorption coefficient from transmissivity
@@ -5209,8 +5124,13 @@
     REAL(wp), DIMENSION(nzb_wall:nzt_wall)  ::  wtend, wintend  !< tendency
 
-
+    TYPE(surf_type),        POINTER         ::  surf            !< surface-date type variable
+    TYPE(surf_type_2d_usm), POINTER         ::  t_wall
+    TYPE(surf_type_2d_usm), POINTER         ::  t_wall_p
+    TYPE(surf_type_2d_usm), POINTER         ::  t_window
+    TYPE(surf_type_2d_usm), POINTER         ::  t_window_p
+    TYPE(surf_type_2d_usm), POINTER         ::  t_green
 
     IF ( debug_output_timestep )  THEN
-       WRITE( debug_string, * ) 'usm_material_heat_model | during_spinup: ', during_spinup
+       WRITE( debug_string, * ) 'usm_wall_heat_model: ', horizontal, l, during_spinup
        CALL debug_message( debug_string, 'start' )
     ENDIF
@@ -5224,140 +5144,157 @@
     ENDIF
 
-!
-!-- For horizontal surfaces
+    IF ( horizontal )  THEN
+       surf         => surf_usm_h(l)
+       t_wall       => t_wall_h(l)
+       t_wall_p     => t_wall_h_p(l)
+       t_window     => t_window_h(l)
+       t_window_p   => t_window_h_p(l)
+       t_green      => t_green_h(l)
+    ELSE
+       surf         => surf_usm_v(l)
+       t_wall       => t_wall_v(l)
+       t_wall_p     => t_wall_v_p(l)
+       t_window     => t_window_v(l)
+       t_window_p   => t_window_v_p(l)
+       t_green      => t_green_v(l)
+    ENDIF
+!
+!-- Cycle for all surfaces in given direction
     !$OMP DO SCHEDULE (STATIC)
-    DO  m = 1, surf_usm_h%ns
+    DO  m = 1, surf%ns
 !
 !--    Obtain indices
-       i = surf_usm_h%i(m)
-       j = surf_usm_h%j(m)
-       k = surf_usm_h%k(m)
-!
-!--    Prognostic equation for ground/roof temperature t_wall_h
+       i = surf%i(m)
+       j = surf%j(m)
+       k = surf%k(m)
+!
+!--    Prognostic equation for ground/roof temperature t_wall
        wtend(:) = 0.0_wp
-       wtend(nzb_wall) = ( 1.0_wp / surf_usm_h%rho_c_wall(nzb_wall,m) )                            &
-                          * ( surf_usm_h%lambda_h(nzb_wall,m) * wall_mod(nzb_wall)                 &
-                              * ( t_wall_h(nzb_wall+1,m) - t_wall_h(nzb_wall,m) )                  &
-                              * surf_usm_h%ddz_wall(nzb_wall+1,m)                                  &
-                              + surf_usm_h%frac(m,ind_veg_wall)                                    &
-                              / ( surf_usm_h%frac(m,ind_veg_wall)                                  &
-                                  + surf_usm_h%frac(m,ind_pav_green) )                             &
-                              * surf_usm_h%wghf_eb(m)                                              &
-                              - surf_usm_h%frac(m,ind_pav_green)                                   &
-                              / ( surf_usm_h%frac(m,ind_veg_wall)                                  &
-                                  + surf_usm_h%frac(m,ind_pav_green) )                             &
-                              * ( surf_usm_h%lambda_h_green(nzt_wall,m)                            &
-                              * wall_mod(nzt_wall)                                                 &
-                              * surf_usm_h%ddz_green(nzt_wall,m)                                   &
-                              + surf_usm_h%lambda_h(nzb_wall,m)                                    &
-                              * wall_mod(nzb_wall)                                                 &
-                              * surf_usm_h%ddz_wall(nzb_wall,m) )                                  &
-                              / ( surf_usm_h%ddz_green(nzt_wall,m)                                 &
-                              + surf_usm_h%ddz_wall(nzb_wall,m) )                                  &
-                              * ( t_wall_h(nzb_wall,m) - t_green_h(nzt_wall,m) )                   &
-                            ) * surf_usm_h%ddz_wall_stag(nzb_wall,m)
-!
-!-- If indoor model is used inner wall layer is calculated by using iwghf (indoor wall ground heat flux)
+       wtend(nzb_wall) = ( 1.0_wp / surf%rho_c_wall(nzb_wall,m) )                     &
+                          * ( surf%lambda_h(nzb_wall,m) * wall_mod(nzb_wall)          &
+                              * ( t_wall%val(nzb_wall+1,m) - t_wall%val(nzb_wall,m) )              &
+                              * surf%ddz_wall(nzb_wall+1,m)                           &
+                              + surf%frac(m,ind_veg_wall)                             &
+                              / ( surf%frac(m,ind_veg_wall)                           &
+                                  + surf%frac(m,ind_pav_green) )                      &
+                              * surf%wghf_eb(m)                                       &
+                              - surf%frac(m,ind_pav_green)                            &
+                              / ( surf%frac(m,ind_veg_wall)                           &
+                                  + surf%frac(m,ind_pav_green) )                      &
+                              * ( surf%lambda_h_green(nzt_wall,m)                     &
+                              * wall_mod(nzt_wall)                                             &
+                              * surf%ddz_green(nzt_wall,m)                            &
+                              + surf%lambda_h(nzb_wall,m)                             &
+                              * wall_mod(nzb_wall)                                             &
+                              * surf%ddz_wall(nzb_wall,m) )                           &
+                              / ( surf%ddz_green(nzt_wall,m)                          &
+                              + surf%ddz_wall(nzb_wall,m) )                           &
+                              * ( t_wall%val(nzb_wall,m) - t_green%val(nzt_wall,m) )               &
+                            ) * surf%ddz_wall_stag(nzb_wall,m)
+!
+!--    If indoor model is used inner wall layer is calculated by using iwghf (indoor wall ground heat flux)
        IF ( indoor_model )  THEN
           DO  kw = nzb_wall+1, nzt_wall-1
-             wtend(kw) = ( 1.0_wp / surf_usm_h%rho_c_wall(kw,m) )                                  &
-                         * ( surf_usm_h%lambda_h(kw,m)                                             &
-                             * wall_mod(kw)                                                        &
-                             * ( t_wall_h(kw+1,m) - t_wall_h(kw,m) )                               &
-                             * surf_usm_h%ddz_wall(kw+1,m)                                         &
-                             - surf_usm_h%lambda_h(kw-1,m)                                         &
-                             * wall_mod(kw-1)                                                      &
-                             * ( t_wall_h(kw,m) - t_wall_h(kw-1,m) )                               &
-                             * surf_usm_h%ddz_wall(kw,m)                                           &
-                           ) * surf_usm_h%ddz_wall_stag(kw,m)
+             wtend(kw) = ( 1.0_wp / surf%rho_c_wall(kw,m) )                           &
+                         * ( surf%lambda_h(kw,m) * wall_mod(kw)                       &
+                             * ( t_wall%val(kw+1,m) - t_wall%val(kw,m) )                           &
+                             * surf%ddz_wall(kw+1,m)                                  &
+                             - surf%lambda_h(kw-1,m) * wall_mod(kw-1)                 &
+                             * ( t_wall%val(kw,m) - t_wall%val(kw-1,m) )                           &
+                             * surf%ddz_wall(kw,m)                                    &
+                           ) * surf%ddz_wall_stag(kw,m)
           ENDDO
-          wtend(nzt_wall) = ( 1.0_wp / surf_usm_h%rho_c_wall(nzt_wall,m) )                         &
-                            * ( -surf_usm_h%lambda_h(nzt_wall-1,m) * wall_mod(nzt_wall-1)          &
-                                * ( t_wall_h(nzt_wall,m) - t_wall_h(nzt_wall-1,m) )                &
-                                * surf_usm_h%ddz_wall(nzt_wall,m)                                  &
-                                + surf_usm_h%iwghf_eb(m)                                           &
-                              ) * surf_usm_h%ddz_wall_stag(nzt_wall,m)
+          wtend(nzt_wall) = ( 1.0_wp / surf%rho_c_wall(nzt_wall,m) )                  &
+                            * ( -surf%lambda_h(nzt_wall-1,m) * wall_mod(nzt_wall-1)   &
+                                * ( t_wall%val(nzt_wall,m) - t_wall%val(nzt_wall-1,m) )            &
+                                * surf%ddz_wall(nzt_wall,m)                           &
+                                + surf%iwghf_eb(m)                                    &
+                              ) * surf%ddz_wall_stag(nzt_wall,m)
        ELSE
           DO  kw = nzb_wall+1, nzt_wall
-             wtend(kw) = ( 1.0_wp / surf_usm_h%rho_c_wall(kw,m) )                                  &
-                        * ( surf_usm_h%lambda_h(kw,m)  * wall_mod(kw)                              &
-                            * ( t_wall_h(kw+1,m) - t_wall_h(kw,m) )                                &
-                            * surf_usm_h%ddz_wall(kw+1,m)                                          &
-                            - surf_usm_h%lambda_h(kw-1,m)                                          &
-                            * wall_mod(kw-1)                                                       &
-                            * ( t_wall_h(kw,m) - t_wall_h(kw-1,m) )                                &
-                            * surf_usm_h%ddz_wall(kw,m)                                            &
-                          ) * surf_usm_h%ddz_wall_stag(kw,m)
+             wtend(kw) = ( 1.0_wp / surf%rho_c_wall(kw,m) )                           &
+                        * ( surf%lambda_h(kw,m)  * wall_mod(kw)                       &
+                            * ( t_wall%val(kw+1,m) - t_wall%val(kw,m) )                            &
+                            * surf%ddz_wall(kw+1,m)                                   &
+                            - surf%lambda_h(kw-1,m) * wall_mod(kw-1)                  &
+                            * ( t_wall%val(kw,m) - t_wall%val(kw-1,m) )                            &
+                            * surf%ddz_wall(kw,m)                                     &
+                          ) * surf%ddz_wall_stag(kw,m)
           ENDDO
        ENDIF
 
-       t_wall_h_p(nzb_wall:nzt_wall,m) = t_wall_h(nzb_wall:nzt_wall,m) + dt_3d                     &
-                                         * ( tsc(2) * wtend(nzb_wall:nzt_wall) + tsc(3)            &
-                                             * surf_usm_h%tt_wall_m(nzb_wall:nzt_wall,m) )
-
-!
-!-- During spinup the tempeature inside window layers is not calculated to make larger timesteps possible
+       t_wall_p%val(nzb_wall:nzt_wall,m) = t_wall%val(nzb_wall:nzt_wall,m) + dt_3d                 &
+                                         * ( tsc(2) * wtend(nzb_wall:nzt_wall) + tsc(3)        &
+                                             * surf%tt_wall_m(nzb_wall:nzt_wall,m) )
+
+!
+!--    During spinup the tempeature inside window layers is not calculated to make larger timesteps possible
        IF ( .NOT. during_spinup )  THEN
-          win_absorp = -log( surf_usm_h%transmissivity(m) ) / surf_usm_h%zw_window(nzt_wall,m)
-!
-!--       Prognostic equation for ground/roof window temperature t_window_h takes absorption of
-!--       shortwave radiation into account
+          win_absorp = -log( surf%transmissivity(m) ) /                                &
+                        surf%zw_window(nzt_wall,m)
+!
+!--       Prognostic equation for ground/roof window temperature t_window takes absorption
+!--       of shortwave radiation into account
           wintend(:) = 0.0_wp
-          wintend(nzb_wall) = ( 1.0_wp / surf_usm_h%rho_c_window(nzb_wall,m) ) *                   &
-                              ( surf_usm_h%lambda_h_window(nzb_wall,m)                             &
-                                * ( t_window_h(nzb_wall+1,m) - t_window_h(nzb_wall,m) )            &
-                                * surf_usm_h%ddz_window(nzb_wall+1,m)                              &
-                                + surf_usm_h%wghf_eb_window(m)                                     &
-                                + surf_usm_h%rad_sw_in(m)                                          &
-                                * ( 1.0_wp - exp( -win_absorp * surf_usm_h%zw_window(nzb_wall,m) ) ) &
-                              ) * surf_usm_h%ddz_window_stag(nzb_wall,m)
+          wintend(nzb_wall) = ( 1.0_wp / surf%rho_c_window(nzb_wall,m) )               &
+                                * ( surf%lambda_h_window(nzb_wall,m)                   &
+                                * ( t_window%val(nzb_wall+1,m) - t_window%val(nzb_wall,m) )         &
+                                * surf%ddz_window(nzb_wall+1,m)                        &
+                                + surf%wghf_eb_window(m)                               &
+                                + surf%rad_sw_in(m)                                    &
+                                * ( 1.0_wp - exp( -win_absorp                                   &
+                                    * surf%zw_window(nzb_wall,m) ) )                   &
+                              ) * surf%ddz_window_stag(nzb_wall,m)
 
           IF ( indoor_model ) THEN
              DO  kw = nzb_wall+1, nzt_wall-1
-                wintend(kw) = ( 1.0_wp / surf_usm_h%rho_c_window(kw,m) )                           &
-                              * ( surf_usm_h%lambda_h_window(kw,m)                                 &
-                                  * ( t_window_h(kw+1,m) - t_window_h(kw,m) )                      &
-                                  * surf_usm_h%ddz_window(kw+1,m)                                  &
-                                  - surf_usm_h%lambda_h_window(kw-1,m)                             &
-                                 * ( t_window_h(kw,m) - t_window_h(kw-1,m) )                       &
-                                 * surf_usm_h%ddz_window(kw,m)                                     &
-                                 + surf_usm_h%rad_sw_in(m)                                         &
-                                 * ( exp( -win_absorp * surf_usm_h%zw_window(kw-1,m) )             &
-                                     - exp(-win_absorp * surf_usm_h%zw_window(kw,m) )              &
-                                   )                                                               &
-                                 ) * surf_usm_h%ddz_window_stag(kw,m)
+                wintend(kw) = ( 1.0_wp / surf%rho_c_window(kw,m) )                     &
+                              * ( surf%lambda_h_window(kw,m)                           &
+                                  * ( t_window%val(kw+1,m) - t_window%val(kw,m) )                   &
+                                  * surf%ddz_window(kw+1,m)                            &
+                                  - surf%lambda_h_window(kw-1,m)                       &
+                                 * ( t_window%val(kw,m) - t_window%val(kw-1,m) )                    &
+                                 * surf%ddz_window(kw,m)                               &
+                                 + surf%rad_sw_in(m)                                   &
+                                 * ( exp( -win_absorp * surf%zw_window(kw-1,m) )       &
+                                     - exp(-win_absorp * surf%zw_window(kw,m) )        &
+                                   )                                                            &
+                                 ) * surf%ddz_window_stag(kw,m)
 
              ENDDO
-             wintend(nzt_wall) = ( 1.0_wp / surf_usm_h%rho_c_window(nzt_wall,m) )                  &
-                                 * ( -surf_usm_h%lambda_h_window(nzt_wall-1,m)                     &
-                                    * ( t_window_h(nzt_wall,m) - t_window_h(nzt_wall-1,m) )        &
-                                    * surf_usm_h%ddz_window(nzt_wall,m)                            &
-                                    + surf_usm_h%iwghf_eb_window(m)                                &
-                                    + surf_usm_h%rad_sw_in(m)                                      &
-                                    * ( exp( -win_absorp * surf_usm_h%zw_window(nzt_wall-1,m) )    &
-                                        - exp( -win_absorp * surf_usm_h%zw_window(nzt_wall,m) )    &
-                                      )                                                            &
-                                    ) * surf_usm_h%ddz_window_stag(nzt_wall,m)
+             wintend(nzt_wall) = ( 1.0_wp / surf%rho_c_window(nzt_wall,m) )            &
+                                 * ( -surf%lambda_h_window(nzt_wall-1,m)               &
+                                    * ( t_window%val(nzt_wall,m) - t_window%val(nzt_wall-1,m) )     &
+                                    * surf%ddz_window(nzt_wall,m)                      &
+                                    + surf%iwghf_eb_window(m)                          &
+                                    + surf%rad_sw_in(m)                                &
+                                    * ( exp( -win_absorp                                        &
+                                        * surf%zw_window(nzt_wall-1,m) )               &
+                                      - exp( -win_absorp                                        &
+                                        * surf%zw_window(nzt_wall,m) )                 &
+                                      )                                                         &
+                                    ) * surf%ddz_window_stag(nzt_wall,m)
           ELSE
              DO  kw = nzb_wall+1, nzt_wall
-                wintend(kw) = ( 1.0_wp / surf_usm_h%rho_c_window(kw,m) )                           &
-                              * ( surf_usm_h%lambda_h_window(kw,m)                                 &
-                                  * ( t_window_h(kw+1,m) - t_window_h(kw,m) )                      &
-                                  * surf_usm_h%ddz_window(kw+1,m)                                  &
-                                  - surf_usm_h%lambda_h_window(kw-1,m)                             &
-                                  * ( t_window_h(kw,m)                                             &
-                                  - t_window_h(kw-1,m) )                                           &
-                                  * surf_usm_h%ddz_window(kw,m) + surf_usm_h%rad_sw_in(m)          &
-                                   * ( exp( -win_absorp * surf_usm_h%zw_window(kw-1,m) )           &
-                                       - exp(-win_absorp * surf_usm_h%zw_window(kw,m) )            &
-                                     )                                                             &
-                                 ) * surf_usm_h%ddz_window_stag(kw,m)
+                wintend(kw) = ( 1.0_wp / surf%rho_c_window(kw,m) )                     &
+                              * ( surf%lambda_h_window(kw,m)                           &
+                                  * ( t_window%val(kw+1,m) - t_window%val(kw,m) )                   &
+                                  * surf%ddz_window(kw+1,m)                            &
+                                  - surf%lambda_h_window(kw-1,m)                       &
+                                  * ( t_window%val(kw,m)                                          &
+                                  - t_window%val(kw-1,m) )                                        &
+                                  * surf%ddz_window(kw,m)                              &
+                                  + surf%rad_sw_in(m)                                  &
+                                   * ( exp( -win_absorp * surf%zw_window(kw-1,m) )     &
+                                       - exp(-win_absorp * surf%zw_window(kw,m) )      &
+                                     )                                                          &
+                                 ) * surf%ddz_window_stag(kw,m)
 
              ENDDO
           ENDIF
 
-          t_window_h_p(nzb_wall:nzt_wall,m) = t_window_h(nzb_wall:nzt_wall,m) + dt_3d              &
-                                              * ( tsc(2) * wintend(nzb_wall:nzt_wall) + tsc(3)     &
-                                                  * surf_usm_h%tt_window_m(nzb_wall:nzt_wall,m) )
+          t_window_p%val(nzb_wall:nzt_wall,m) = t_window%val(nzb_wall:nzt_wall,m) + dt_3d           &
+                                              * ( tsc(2) * wintend(nzb_wall:nzt_wall) + tsc(3)  &
+                                              * surf%tt_window_m(nzb_wall:nzt_wall,m) )
 
        ENDIF
@@ -5368,10 +5305,10 @@
            IF ( intermediate_timestep_count == 1 )  THEN
               DO  kw = nzb_wall, nzt_wall
-                 surf_usm_h%tt_wall_m(kw,m) = wtend(kw)
+                 surf%tt_wall_m(kw,m) = wtend(kw)
               ENDDO
            ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
                DO  kw = nzb_wall, nzt_wall
-                  surf_usm_h%tt_wall_m(kw,m) = -9.5625_wp * wtend(kw) +                            &
-                                               5.3125_wp * surf_usm_h%tt_wall_m(kw,m)
+                  surf%tt_wall_m(kw,m) = -9.5625_wp * wtend(kw) +                            &
+                                               5.3125_wp * surf%tt_wall_m(kw,m)
                ENDDO
            ENDIF
@@ -5384,508 +5321,344 @@
               IF ( intermediate_timestep_count == 1 )  THEN
                  DO  kw = nzb_wall, nzt_wall
-                    surf_usm_h%tt_window_m(kw,m) = wintend(kw)
+                    surf%tt_window_m(kw,m) = wintend(kw)
                  ENDDO
               ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
                   DO  kw = nzb_wall, nzt_wall
-                     surf_usm_h%tt_window_m(kw,m) = -9.5625_wp * wintend(kw) +                     &
-                                                    5.3125_wp * surf_usm_h%tt_window_m(kw,m)
+                     surf%tt_window_m(kw,m) = -9.5625_wp * wintend(kw) +                     &
+                                                    5.3125_wp * surf%tt_window_m(kw,m)
                   ENDDO
               ENDIF
           ENDIF
        ENDIF
-
     ENDDO
-
-!
-!-- For vertical surfaces
-    !$OMP DO SCHEDULE (STATIC)
-    DO  l = 0, 3
-       DO  m = 1, surf_usm_v(l)%ns
-!
-!--       Obtain indices
-          i = surf_usm_v(l)%i(m)
-          j = surf_usm_v(l)%j(m)
-          k = surf_usm_v(l)%k(m)
-!
-!--       Prognostic equation for wall temperature t_wall_v
-          wtend(:) = 0.0_wp
-
-          wtend(nzb_wall) = ( 1.0_wp / surf_usm_v(l)%rho_c_wall(nzb_wall,m) )                      &
-                            * ( surf_usm_v(l)%lambda_h(nzb_wall,m)                                 &
-                                * wall_mod(nzb_wall)                                               &
-                                * ( t_wall_v(l)%t(nzb_wall+1,m)                                    &
-                                - t_wall_v(l)%t(nzb_wall,m) )                                      &
-                                * surf_usm_v(l)%ddz_wall(nzb_wall+1,m)                             &
-                                + surf_usm_v(l)%frac(m,ind_veg_wall)                               &
-                                / (surf_usm_v(l)%frac(m,ind_veg_wall)                              &
-                                + surf_usm_v(l)%frac(m,ind_pav_green) )                            &
-                                * surf_usm_v(l)%wghf_eb(m)                                         &
-                                - surf_usm_v(l)%frac(m,ind_pav_green)                              &
-                                / (surf_usm_v(l)%frac(m,ind_veg_wall)                              &
-                                + surf_usm_v(l)%frac(m,ind_pav_green) )                            &
-                                * ( surf_usm_v(l)%lambda_h_green(nzt_wall,m)                       &
-                                * wall_mod(nzt_wall)                                               &
-                                * surf_usm_v(l)%ddz_green(nzt_wall,m)                              &
-                                + surf_usm_v(l)%lambda_h(nzb_wall,m)                               &
-                                * wall_mod(nzb_wall)                                               &
-                                * surf_usm_v(l)%ddz_wall(nzb_wall,m) )                             &
-                                / ( surf_usm_v(l)%ddz_green(nzt_wall,m)                            &
-                                + surf_usm_v(l)%ddz_wall(nzb_wall,m) )                             &
-                                * ( t_wall_v(l)%t(nzb_wall,m)                                      &
-                                - t_green_v(l)%t(nzt_wall,m) )                                     &
-                              ) * surf_usm_v(l)%ddz_wall_stag(nzb_wall,m)
-
-          IF ( indoor_model )  THEN
-             DO  kw = nzb_wall+1, nzt_wall-1
-                wtend(kw) = ( 1.0_wp / surf_usm_v(l)%rho_c_wall(kw,m) )                            &
-                          * ( surf_usm_v(l)%lambda_h(kw,m)  * wall_mod(kw)                         &
-                              * ( t_wall_v(l)%t(kw+1,m) - t_wall_v(l)%t(kw,m) )                    &
-                              * surf_usm_v(l)%ddz_wall(kw+1,m)                                     &
-                              - surf_usm_v(l)%lambda_h(kw-1,m)                                     &
-                              * wall_mod(kw-1)                                                     &
-                              * ( t_wall_v(l)%t(kw,m) - t_wall_v(l)%t(kw-1,m) )                    &
-                              * surf_usm_v(l)%ddz_wall(kw,m)                                       &
-                            ) * surf_usm_v(l)%ddz_wall_stag(kw,m)
+    !$OMP END PARALLEL
+
+    IF ( debug_output_timestep )  THEN
+       WRITE( debug_string, * ) 'usm_wall_heat_model: ', horizontal, l, during_spinup
+       CALL debug_message( debug_string, 'end' )
+    ENDIF
+
+ END SUBROUTINE usm_wall_heat_model
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!
+!> Green and substrate model as part of the urban surface model. The model predicts ground
+!> temperatures.
+!>
+!> Important: green-heat model crashes due to unknown reason. Green fraction is thus set to zero
+!> (in favor of wall fraction).
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE usm_green_heat_model( horizontal, l )
+
+
+    IMPLICIT NONE
+
+    LOGICAL       ::  horizontal          !< Flag indicating horizontal or vertical surfaces
+    INTEGER(iwp)  ::  l                   !< direction index
+
+    INTEGER(iwp)  ::  i, j, k, kw, m      !< running indices
+
+    LOGICAL  ::  conserve_water_content = .TRUE.  !<
+
+    REAL(wp)  ::  drho_l_lv               !< frequently used parameter
+    REAL(wp)  ::  h_vg                    !< Van Genuchten coef. h
+    REAL(wp)  ::  ke, lambda_h_green_sat  !< heat conductivity for saturated soil
+
+    REAL(wp), DIMENSION(nzb_wall:nzt_wall)   ::  gtend,tend         !< tendency
+    REAL(wp), DIMENSION(nzb_wall:nzt_wall)   ::  root_extr_green    !<
+
+    REAL(wp), DIMENSION(nzb_wall:nzt_wall+1) ::  gamma_green_temp   !< temp. gamma
+    REAL(wp), DIMENSION(nzb_wall:nzt_wall+1) ::  lambda_green_temp  !< temp. lambda
+
+    TYPE(surf_type), POINTER                 ::  surf               !< surface-date type variable
+    TYPE(surf_type_2d_usm), POINTER          ::  t_wall
+    TYPE(surf_type_2d_usm), POINTER          ::  t_green
+
+    IF ( debug_output_timestep )  THEN
+       WRITE( debug_string, * ) 'usm_green_heat_model: ', horizontal, l
+       CALL debug_message( debug_string, 'start' )
+    ENDIF
+
+    drho_l_lv = 1.0_wp / (rho_l * l_v)
+
+!
+!-- For horizontal upward surfaces.
+    IF ( horizontal .AND. l==0 )  THEN
+       surf => surf_usm_h(l)
+       t_wall       => t_wall_h(l)
+       t_green      => t_green_h(l)
+
+!--    Set tendency array for soil moisture to zero
+       IF ( surf%ns > 0 )  THEN
+          IF ( intermediate_timestep_count == 1 )  surf%tswc_h_m = 0.0_wp
+       ENDIF
+
+       !$OMP PARALLEL PRIVATE (m, i, j, k, kw, lambda_h_green_sat, ke, lambda_green_temp, gtend,    &
+       !$OMP&                  tend, h_vg, gamma_green_temp, m_total, root_extr_green)
+       !$OMP DO SCHEDULE (STATIC)
+       DO  m = 1, surf%ns
+          IF (surf%frac(m,ind_pav_green) > 0.0_wp)  THEN
+!
+!--         Obtain indices
+             i = surf%i(m)
+             j = surf%j(m)
+             k = surf%k(m)
+
+             DO  kw = nzb_wall, nzt_wall
+!
+!--             Calculate volumetric heat capacity of the soil, taking into account water content
+                surf%rho_c_total_green(kw,m) = (surf%rho_c_green(kw,m)              &
+                                                     * (1.0_wp - swc_sat_h(l)%val(kw,m))                     &
+                                                     + rho_c_water * swc_h(l)%val(kw,m))
+
+!
+!--             Calculate soil heat conductivity at the center of the soil layers
+                lambda_h_green_sat = lambda_h_green_sm ** ( 1.0_wp - swc_sat_h(l)%val(kw,m) )                &
+                                     * lambda_h_water ** swc_h(l)%val(kw,m)
+
+                ke = 1.0_wp + LOG10( MAX( 0.1_wp,swc_h(l)%val(kw,m) / swc_sat_h(l)%val(kw,m) ) )
+
+                lambda_green_temp(kw) = ke * (lambda_h_green_sat - lambda_h_green_dry)                &
+                                        + lambda_h_green_dry
+
              ENDDO
-             wtend(nzt_wall) = ( 1.0_wp / surf_usm_v(l)%rho_c_wall(nzt_wall,m) )                   &
-                               * ( -surf_usm_v(l)%lambda_h(nzt_wall-1,m) * wall_mod(nzt_wall-1)    &
-                                   * ( t_wall_v(l)%t(nzt_wall,m) - t_wall_v(l)%t(nzt_wall-1,m) )   &
-                                   * surf_usm_v(l)%ddz_wall(nzt_wall,m)                            &
-                                   + surf_usm_v(l)%iwghf_eb(m)                                     &
-                                 ) * surf_usm_v(l)%ddz_wall_stag(nzt_wall,m)
-          ELSE
+             lambda_green_temp(nzt_wall+1) = lambda_green_temp(nzt_wall)
+
+
+!
+!--          Calculate soil heat conductivity (lambda_h) at the _stag level using linear interpolation.
+!--          For pavement surface, the true pavement depth is considered
+             DO  kw = nzb_wall, nzt_wall
+                surf%lambda_h_green(kw,m) = ( lambda_green_temp(kw+1) + lambda_green_temp(kw) ) &
+                                                  * 0.5_wp
+             ENDDO
+
+             t_green_h(l)%val(nzt_wall+1,m) = t_wall_h(l)%val(nzb_wall,m)
+!
+!--          Prognostic equation for ground/roof temperature t_green_h
+             gtend(:) = 0.0_wp
+             gtend(nzb_wall) = ( 1.0_wp / surf%rho_c_total_green(nzb_wall,m) )                &
+                               * ( surf%lambda_h_green(nzb_wall,m)                            &
+                                   * ( t_green_h(l)%val(nzb_wall+1,m)                                         &
+                                   - t_green_h(l)%val(nzb_wall,m) )                                           &
+                                   * surf%ddz_green(nzb_wall+1,m)                             &
+                                   + surf%wghf_eb_green(m)                                    &
+                                 ) * surf%ddz_green_stag(nzb_wall,m)
+
              DO  kw = nzb_wall+1, nzt_wall
-                 wtend(kw) = ( 1.0_wp / surf_usm_v(l)%rho_c_wall(kw,m) )                           &
-                             * ( surf_usm_v(l)%lambda_h(kw,m) * wall_mod(kw)                       &
-                                 * ( t_wall_v(l)%t(kw+1,m) - t_wall_v(l)%t(kw,m) )                 &
-                                 * surf_usm_v(l)%ddz_wall(kw+1,m)                                  &
-                                 - surf_usm_v(l)%lambda_h(kw-1,m)                                  &
-                                 * wall_mod(kw-1)                                                  &
-                                 * ( t_wall_v(l)%t(kw,m) - t_wall_v(l)%t(kw-1,m) )                 &
-                                 * surf_usm_v(l)%ddz_wall(kw,m)                                    &
-                               ) * surf_usm_v(l)%ddz_wall_stag(kw,m)
+                gtend(kw) = ( 1.0_wp / surf%rho_c_total_green(kw,m) )                         &
+                            * ( surf%lambda_h_green(kw,m)                                     &
+                                * ( t_green_h(l)%val(kw+1,m) - t_green_h(l)%val(kw,m) )                              &
+                                * surf%ddz_green(kw+1,m)                                      &
+                                - surf%lambda_h_green(kw-1,m)                                 &
+                                * ( t_green_h(l)%val(kw,m) - t_green_h(l)%val(kw-1,m) )                              &
+                                * surf%ddz_green(kw,m)                                        &
+                              ) * surf%ddz_green_stag(kw,m)
              ENDDO
-          ENDIF
-
-          t_wall_v_p(l)%t(nzb_wall:nzt_wall,m) =  t_wall_v(l)%t(nzb_wall:nzt_wall,m) + dt_3d       &
-                                                  * ( tsc(2) * wtend(nzb_wall:nzt_wall) + tsc(3)   &
-                                                      * surf_usm_v(l)%tt_wall_m(nzb_wall:nzt_wall, &
-                                                      m) )
-
-          IF ( .NOT. during_spinup )  THEN
-             win_absorp = -log( surf_usm_v(l)%transmissivity(m) ) /                                &
-                          surf_usm_v(l)%zw_window(nzt_wall,m)
-!
-!--          Prognostic equation for window temperature t_window_v
-             wintend(:) = 0.0_wp
-             wintend(nzb_wall) = ( 1.0_wp / surf_usm_v(l)%rho_c_window(nzb_wall,m) )               &
-                                 * ( surf_usm_v(l)%lambda_h_window(nzb_wall,m)                     &
-                                     * ( t_window_v(l)%t(nzb_wall+1,m)                             &
-                                     - t_window_v(l)%t(nzb_wall,m) )                               &
-                                     * surf_usm_v(l)%ddz_window(nzb_wall+1,m)                      &
-                                     + surf_usm_v(l)%wghf_eb_window(m)                             &
-                                     + surf_usm_v(l)%rad_sw_in(m)                                  &
-                                     * ( 1.0_wp - exp( -win_absorp                                 &
-                                         * surf_usm_v(l)%zw_window(nzb_wall,m) ) )                 &
-                                   ) * surf_usm_v(l)%ddz_window_stag(nzb_wall,m)
-
-             IF ( indoor_model ) THEN
-                DO  kw = nzb_wall+1, nzt_wall -1
-                   wintend(kw) = ( 1.0_wp / surf_usm_v(l)%rho_c_window(kw,m) )                     &
-                                 * ( surf_usm_v(l)%lambda_h_window(kw,m)                           &
-                                     * ( t_window_v(l)%t(kw+1,m) - t_window_v(l)%t(kw,m) )         &
-                                     * surf_usm_v(l)%ddz_window(kw+1,m)                            &
-                                     - surf_usm_v(l)%lambda_h_window(kw-1,m)                       &
-                                     * ( t_window_v(l)%t(kw,m) - t_window_v(l)%t(kw-1,m) )         &
-                                     * surf_usm_v(l)%ddz_window(kw,m)                              &
-                                     + surf_usm_v(l)%rad_sw_in(m)                                  &
-                                     * ( exp( -win_absorp * surf_usm_v(l)%zw_window(kw-1,m) )      &
-                                         - exp(-win_absorp * surf_usm_v(l)%zw_window(kw,m) )       &
-                                       )                                                           &
-                                 ) * surf_usm_v(l)%ddz_window_stag(kw,m)
-                 ENDDO
-                 wintend(nzt_wall) = ( 1.0_wp / surf_usm_v(l)%rho_c_window(nzt_wall,m) )           &
-                                     * ( -surf_usm_v(l)%lambda_h_window(nzt_wall-1,m)              &
-                                         * ( t_window_v(l)%t(nzt_wall,m)                           &
-                                             - t_window_v(l)%t(nzt_wall-1,m) )                     &
-                                         * surf_usm_v(l)%ddz_window(nzt_wall,m)                    &
-                                         + surf_usm_v(l)%iwghf_eb_window(m)                        &
-                                         + surf_usm_v(l)%rad_sw_in(m)                              &
-                                         * ( exp( -win_absorp                                      &
-                                             * surf_usm_v(l)%zw_window(nzt_wall-1,m) )             &
-                                             - exp(-win_absorp                                     &
-                                             * surf_usm_v(l)%zw_window(nzt_wall,m) )               &
-                                           )                                                       &
-                                        ) * surf_usm_v(l)%ddz_window_stag(nzt_wall,m)
-             ELSE
-                DO  kw = nzb_wall+1, nzt_wall
-                   wintend(kw) = ( 1.0_wp / surf_usm_v(l)%rho_c_window(kw,m) )                     &
-                                 * ( surf_usm_v(l)%lambda_h_window(kw,m)                           &
-                                     * ( t_window_v(l)%t(kw+1,m) - t_window_v(l)%t(kw,m) )         &
-                                     * surf_usm_v(l)%ddz_window(kw+1,m)                            &
-                                     - surf_usm_v(l)%lambda_h_window(kw-1,m)                       &
-                                     * ( t_window_v(l)%t(kw,m) - t_window_v(l)%t(kw-1,m) )         &
-                                     * surf_usm_v(l)%ddz_window(kw,m)                              &
-                                     + surf_usm_v(l)%rad_sw_in(m)                                  &
-                                     * ( exp( -win_absorp * surf_usm_v(l)%zw_window(kw-1,m) )      &
-                                         - exp(-win_absorp                                         &
-                                         * surf_usm_v(l)%zw_window(kw,m) )                         &
-                                       )                                                           &
-                                   ) * surf_usm_v(l)%ddz_window_stag(kw,m)
-                ENDDO
-             ENDIF
-
-             t_window_v_p(l)%t(nzb_wall:nzt_wall,m) =  t_window_v(l)%t(nzb_wall:nzt_wall,m)        &
-                                                       + dt_3d * ( tsc(2)                          &
-                                                       * wintend(nzb_wall:nzt_wall)                &
-                                                       + tsc(3)                                    &
-                                                 * surf_usm_v(l)%tt_window_m(nzb_wall:nzt_wall,m) )
-          ENDIF
-
-!
-!--       Calculate t_wall tendencies for the next Runge-Kutta step
-          IF ( timestep_scheme(1:5) == 'runge' )  THEN
-              IF ( intermediate_timestep_count == 1 )  THEN
-                 DO  kw = nzb_wall, nzt_wall
-                    surf_usm_v(l)%tt_wall_m(kw,m) = wtend(kw)
-                 ENDDO
-              ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
-                  DO  kw = nzb_wall, nzt_wall
-                     surf_usm_v(l)%tt_wall_m(kw,m) = - 9.5625_wp * wtend(kw) +                     &
-                                                     5.3125_wp * surf_usm_v(l)%tt_wall_m(kw,m)
-                  ENDDO
-              ENDIF
-          ENDIF
-
-
-          IF ( .NOT. during_spinup )  THEN
-!
-!--          Calculate t_window tendencies for the next Runge-Kutta step
+
+             t_green_h_p(l)%val(nzb_wall:nzt_wall,m) = t_green_h(l)%val(nzb_wall:nzt_wall,m)  &
+                            + dt_3d * ( tsc(2) * gtend(nzb_wall:nzt_wall) + tsc(3)            &
+                            * surf%tt_green_m(nzb_wall:nzt_wall,m) )
+
+
+!
+!--          Calculate t_green tendencies for the next Runge-Kutta step
              IF ( timestep_scheme(1:5) == 'runge' )  THEN
                  IF ( intermediate_timestep_count == 1 )  THEN
                     DO  kw = nzb_wall, nzt_wall
-                       surf_usm_v(l)%tt_window_m(kw,m) = wintend(kw)
+                       surf%tt_green_m(kw,m) = gtend(kw)
                     ENDDO
-                 ELSEIF ( intermediate_timestep_count <  intermediate_timestep_count_max )  THEN
+                 ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
                      DO  kw = nzb_wall, nzt_wall
-                        surf_usm_v(l)%tt_window_m(kw,m) =  - 9.5625_wp * wintend(kw) + 5.3125_wp * &
-                                                           surf_usm_v(l)%tt_window_m(kw,m)
+                        surf%tt_green_m(kw,m) = -9.5625_wp * gtend(kw) + 5.3125_wp             &
+                                                      * surf%tt_green_m(kw,m)
                      ENDDO
                  ENDIF
              ENDIF
-          ENDIF
-
-       ENDDO
-    ENDDO
-    !$OMP END PARALLEL
-
-    IF ( debug_output_timestep )  THEN
-       WRITE( debug_string, * ) 'usm_material_heat_model | during_spinup: ', during_spinup
-       CALL debug_message( debug_string, 'end' )
-    ENDIF
-
- END SUBROUTINE usm_material_heat_model
-
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!
-!> Green and substrate model as part of the urban surface model. The model predicts ground
-!> temperatures.
-!>
-!> Important: gree-heat model crashes due to unknown reason. Green fraction is thus set to zero
-!> (in favor of wall fraction).
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_green_heat_model
-
-
-    IMPLICIT NONE
-
-    INTEGER(iwp)  ::  i, j, k, l, kw, m  !< running indices
-
-    LOGICAL  ::  conserve_water_content = .TRUE.  !<
-
-    REAL(wp)  ::  drho_l_lv               !< frequently used parameter
-    REAL(wp)  ::  h_vg                    !< Van Genuchten coef. h
-    REAL(wp)  ::  ke, lambda_h_green_sat  !< heat conductivity for saturated soil
-
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall)  ::  gtend,tend       !< tendency
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall)  ::  root_extr_green  !<
-
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall+1)  ::  gamma_green_temp   !< temp. gamma
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall+1)  ::  lambda_green_temp  !< temp. lambda
-
-
-
-
-
-    IF ( debug_output_timestep )  CALL debug_message( 'usm_green_heat_model', 'start' )
-
-    drho_l_lv = 1.0_wp / (rho_l * l_v)
-
-!
-!-- For horizontal surfaces.
-!-- Set tendency array for soil moisture to zero
-    IF ( surf_usm_h%ns > 0 )  THEN
-       IF ( intermediate_timestep_count == 1 )  surf_usm_h%tswc_h_m = 0.0_wp
-    ENDIF
-
-    !$OMP PARALLEL PRIVATE (m, i, j, k, kw, lambda_h_green_sat, ke, lambda_green_temp, gtend,       &
-    !$OMP&                  tend, h_vg, gamma_green_temp, m_total, root_extr_green)
-    !$OMP DO SCHEDULE (STATIC)
-    DO  m = 1, surf_usm_h%ns
-       IF (surf_usm_h%frac(m,ind_pav_green) > 0.0_wp)  THEN
-!
-!--       Obtain indices
-          i = surf_usm_h%i(m)
-          j = surf_usm_h%j(m)
-          k = surf_usm_h%k(m)
-
-          DO  kw = nzb_wall, nzt_wall
-!
-!--          Calculate volumetric heat capacity of the soil, taking into account water content
-             surf_usm_h%rho_c_total_green(kw,m) = (surf_usm_h%rho_c_green(kw,m)                    &
-                                                  * (1.0_wp - swc_sat_h(kw,m))                     &
-                                                  + rho_c_water * swc_h(kw,m))
-
-!
-!--          Calculate soil heat conductivity at the center of the soil layers
-             lambda_h_green_sat = lambda_h_green_sm ** ( 1.0_wp - swc_sat_h(kw,m) )                &
-                                  * lambda_h_water ** swc_h(kw,m)
-
-             ke = 1.0_wp + LOG10( MAX( 0.1_wp,swc_h(kw,m) / swc_sat_h(kw,m) ) )
-
-             lambda_green_temp(kw) = ke * (lambda_h_green_sat - lambda_h_green_dry)                &
-                                     + lambda_h_green_dry
-
-          ENDDO
-          lambda_green_temp(nzt_wall+1) = lambda_green_temp(nzt_wall)
-
-
-!
-!--       Calculate soil heat conductivity (lambda_h) at the _stag level using linear interpolation.
-!--       For pavement surface, the true pavement depth is considered
-          DO  kw = nzb_wall, nzt_wall
-             surf_usm_h%lambda_h_green(kw,m) = ( lambda_green_temp(kw+1) + lambda_green_temp(kw) ) &
-                                               * 0.5_wp
-          ENDDO
-
-          t_green_h(nzt_wall+1,m) = t_wall_h(nzb_wall,m)
-!
-!--       Prognostic equation for ground/roof temperature t_green_h
-          gtend(:) = 0.0_wp
-          gtend(nzb_wall) = ( 1.0_wp / surf_usm_h%rho_c_total_green(nzb_wall,m) )                  &
-                            * ( surf_usm_h%lambda_h_green(nzb_wall,m)                              &
-                                * ( t_green_h(nzb_wall+1,m)                                        &
-                                - t_green_h(nzb_wall,m) )                                          &
-                                * surf_usm_h%ddz_green(nzb_wall+1,m)                               &
-                                + surf_usm_h%wghf_eb_green(m)                                      &
-                              ) * surf_usm_h%ddz_green_stag(nzb_wall,m)
-
-           DO  kw = nzb_wall+1, nzt_wall
-              gtend(kw) = ( 1.0_wp / surf_usm_h%rho_c_total_green(kw,m) )                          &
-                          * ( surf_usm_h%lambda_h_green(kw,m)                                      &
-                              * ( t_green_h(kw+1,m) - t_green_h(kw,m) )                            &
-                              * surf_usm_h%ddz_green(kw+1,m)                                       &
-                              - surf_usm_h%lambda_h_green(kw-1,m)                                  &
-                              * ( t_green_h(kw,m) - t_green_h(kw-1,m) )                            &
-                              * surf_usm_h%ddz_green(kw,m)                                         &
-                            ) * surf_usm_h%ddz_green_stag(kw,m)
-           ENDDO
-
-           t_green_h_p(nzb_wall:nzt_wall,m) = t_green_h(nzb_wall:nzt_wall,m) + dt_3d               &
-                                              * ( tsc(2) * gtend(nzb_wall:nzt_wall) + tsc(3)       &
-                                                  * surf_usm_h%tt_green_m(nzb_wall:nzt_wall,m) )
-
-
-!
-!--       Calculate t_green tendencies for the next Runge-Kutta step
-          IF ( timestep_scheme(1:5) == 'runge' )  THEN
-              IF ( intermediate_timestep_count == 1 )  THEN
-                 DO  kw = nzb_wall, nzt_wall
-                    surf_usm_h%tt_green_m(kw,m) = gtend(kw)
-                 ENDDO
-              ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
-                  DO  kw = nzb_wall, nzt_wall
-                     surf_usm_h%tt_green_m(kw,m) = -9.5625_wp * gtend(kw) + 5.3125_wp              &
-                                                   * surf_usm_h%tt_green_m(kw,m)
-                  ENDDO
-              ENDIF
-          ENDIF
-
-          DO  kw = nzb_wall, nzt_wall
-
-!
-!--          Calculate soil diffusivity at the center of the soil layers
-             lambda_green_temp(kw) = ( - b_ch * surf_usm_h%gamma_w_green_sat(kw,m) * psi_sat       &
-                                       / swc_sat_h(kw,m) )                                         &
-                                     * ( MAX( swc_h(kw,m), wilt_h(kw,m) ) / swc_sat_h(kw,m) )**    &
-                                       ( b_ch + 2.0_wp )
-
-!
-!--          Parametrization of Van Genuchten
-             IF ( soil_type /= 7 )  THEN
-!
-!--             Calculate the hydraulic conductivity after Van Genuchten (1980)
-                h_vg = ( ( (swc_res_h(kw,m) - swc_sat_h(kw,m)) / ( swc_res_h(kw,m) -               &
-                           MAX( swc_h(kw,m), wilt_h(kw,m) ) ) )**                                  &
-                           ( surf_usm_h%n_vg_green(m) / (surf_usm_h%n_vg_green(m) - 1.0_wp ) )     &
-                           - 1.0_wp                                                                &
-                       )** ( 1.0_wp / surf_usm_h%n_vg_green(m) ) / surf_usm_h%alpha_vg_green(m)
-
-
-                gamma_green_temp(kw) = surf_usm_h%gamma_w_green_sat(kw,m)                          &
-                                       * ( ( ( 1.0_wp + ( surf_usm_h%alpha_vg_green(m) * h_vg )**  &
-                                             surf_usm_h%n_vg_green(m) )**                          &
-                                             ( 1.0_wp - 1.0_wp / surf_usm_h%n_vg_green(m) )        &
-                                             - ( surf_usm_h%alpha_vg_green(m) * h_vg )**           &
-                                             ( surf_usm_h%n_vg_green(m) - 1.0_wp) )**2             &
-                                         ) / ( ( 1.0_wp + ( surf_usm_h%alpha_vg_green(m) * h_vg )**&
-                                               surf_usm_h%n_vg_green(m) )**                        &
-                                               ( ( 1.0_wp  - 1.0_wp / surf_usm_h%n_vg_green(m) )   &
-                                                 *( surf_usm_h%l_vg_green(m) + 2.0_wp) )           &
-                                             )
-
-!
-!--          Parametrization of Clapp & Hornberger
-             ELSE
-                gamma_green_temp(kw) = surf_usm_h%gamma_w_green_sat(kw,m) * ( swc_h(kw,m)          &
-                                       / swc_sat_h(kw,m) )**( 2.0_wp * b_ch + 3.0_wp )
-             ENDIF
-
-          ENDDO
-
-!
-!--       Prognostic equation for soil moisture content. Only performed, when humidity is enabled in
-!--       the atmosphere
-          IF ( humidity )  THEN
-!
-!--          Calculate soil diffusivity (lambda_w) at the _stag level using linear interpolation.
-!--          To do: replace this with ECMWF-IFS Eq. 8.81
-             DO  kw = nzb_wall, nzt_wall-1
-
-                surf_usm_h%lambda_w_green(kw,m) = ( lambda_green_temp(kw+1)                        &
-                                                    + lambda_green_temp(kw) )                      &
-                                                  * 0.5_wp
-                surf_usm_h%gamma_w_green(kw,m)  = ( gamma_green_temp(kw+1)                         &
-                                                    + gamma_green_temp(kw) )                       &
-                                                  * 0.5_wp
+
+             DO  kw = nzb_wall, nzt_wall
+
+!
+!--             Calculate soil diffusivity at the center of the soil layers
+                lambda_green_temp(kw) = ( - b_ch * surf%gamma_w_green_sat(kw,m) * psi_sat      &
+                                          / swc_sat_h(l)%val(kw,m) )                           &
+                                        * ( MAX( swc_h(l)%val(kw,m), wilt_h(l)%val(kw,m) )     &
+                                          / swc_sat_h(l)%val(kw,m) )**( b_ch + 2.0_wp )
+
+!
+!--             Parametrization of Van Genuchten
+                IF ( soil_type /= 7 )  THEN
+!
+!--                Calculate the hydraulic conductivity after Van Genuchten (1980)
+                   h_vg = ( ( (swc_res_h(l)%val(kw,m) - swc_sat_h(l)%val(kw,m))                &
+                              / ( swc_res_h(l)%val(kw,m) -                 &
+                              MAX( swc_h(l)%val(kw,m), wilt_h(l)%val(kw,m) ) ) )**                                    &
+                              ( surf%n_vg_green(m) / (surf%n_vg_green(m) - 1.0_wp ) ) &
+                              - 1.0_wp                                                                  &
+                          )** ( 1.0_wp / surf%n_vg_green(m) ) / surf%alpha_vg_green(m)
+
+
+                   gamma_green_temp(kw) = surf%gamma_w_green_sat(kw,m)                          &
+                                          * ( ( ( 1.0_wp + ( surf%alpha_vg_green(m) * h_vg )**  &
+                                                surf%n_vg_green(m) )**                          &
+                                                ( 1.0_wp - 1.0_wp / surf%n_vg_green(m) )        &
+                                                - ( surf%alpha_vg_green(m) * h_vg )**           &
+                                                ( surf%n_vg_green(m) - 1.0_wp) )**2             &
+                                            ) / ( ( 1.0_wp + ( surf%alpha_vg_green(m) * h_vg )**&
+                                                  surf%n_vg_green(m) )**                        &
+                                                  ( ( 1.0_wp  - 1.0_wp / surf%n_vg_green(m) )   &
+                                                    *( surf%l_vg_green(m) + 2.0_wp) )           &
+                                                )
+
+!
+!--             Parametrization of Clapp & Hornberger
+                ELSE
+                   gamma_green_temp(kw) = surf%gamma_w_green_sat(kw,m) * ( swc_h(l)%val(kw,m)   &
+                                          / swc_sat_h(l)%val(kw,m) )**( 2.0_wp * b_ch + 3.0_wp )
+                ENDIF
 
              ENDDO
 
 !
-!--          In case of a closed bottom (= water content is conserved), set hydraulic conductivity
-!--          to zero so that no water will be lost in the bottom layer.
-             IF ( conserve_water_content )  THEN
-                surf_usm_h%gamma_w_green(kw,m) = 0.0_wp
-             ELSE
-                surf_usm_h%gamma_w_green(kw,m) = gamma_green_temp(nzt_wall)
-             ENDIF
-
-!--          The root extraction (= root_extr * qsws_veg / (rho_l * l_v)) ensures the mass
-!--          conservation for water. The transpiration of plants equals the cumulative withdrawals
-!--          by the roots in the soil. The scheme takes into account the availability of water in
-!--          the soil layers as well as the root fraction in the respective layer. Layer with
-!--          moisture below wilting point will not contribute, which reflects the preference of
-!--          plants to take water from moister layers.
-
-!
-!--          Calculate the root extraction (ECMWF 7.69, the sum of root_extr = 1). The energy
-!--          balance solver guarantees a positive transpiration, so that there is no need for an
-!--          additional check.
-             m_total = 0.0_wp
-             DO  kw = nzb_wall, nzt_wall
-                 IF ( swc_h(kw,m) > wilt_h(kw,m) )  THEN
-                    m_total = m_total + rootfr_h(kw,m) * swc_h(kw,m)
-                 ENDIF
-             ENDDO
-
-             IF ( m_total > 0.0_wp )  THEN
+!--          Prognostic equation for soil moisture content. Only performed, when humidity is enabled in
+!--          the atmosphere
+             IF ( humidity )  THEN
+!
+!--             Calculate soil diffusivity (lambda_w) at the _stag level using linear interpolation.
+!--             To do: replace this with ECMWF-IFS Eq. 8.81
+                DO  kw = nzb_wall, nzt_wall-1
+
+                   surf%lambda_w_green(kw,m) = ( lambda_green_temp(kw+1)                     &
+                                                       + lambda_green_temp(kw) )                      &
+                                                     * 0.5_wp
+                   surf%gamma_w_green(kw,m)  = ( gamma_green_temp(kw+1)                      &
+                                                       + gamma_green_temp(kw) )                       &
+                                                     * 0.5_wp
+
+                ENDDO
+
+!
+!--             In case of a closed bottom (= water content is conserved), set hydraulic conductivity
+!--             to zero so that no water will be lost in the bottom layer.
+                IF ( conserve_water_content )  THEN
+                   surf%gamma_w_green(kw,m) = 0.0_wp
+                ELSE
+                   surf%gamma_w_green(kw,m) = gamma_green_temp(nzt_wall)
+                ENDIF
+
+!--             The root extraction (= root_extr * qsws_veg / (rho_l * l_v)) ensures the mass
+!--             conservation for water. The transpiration of plants equals the cumulative withdrawals
+!--             by the roots in the soil. The scheme takes into account the availability of water in
+!--             the soil layers as well as the root fraction in the respective layer. Layer with
+!--             moisture below wilting point will not contribute, which reflects the preference of
+!--             plants to take water from moister layers.
+
+!
+!--             Calculate the root extraction (ECMWF 7.69, the sum of root_extr = 1). The energy
+!--             balance solver guarantees a positive transpiration, so that there is no need for an
+!--             additional check.
+                m_total = 0.0_wp
                 DO  kw = nzb_wall, nzt_wall
-                   IF ( swc_h(kw,m) > wilt_h(kw,m) )  THEN
-                      root_extr_green(kw) = rootfr_h(kw,m) * swc_h(kw,m) / m_total
-                   ELSE
-                      root_extr_green(kw) = 0.0_wp
-                   ENDIF
+                    IF ( swc_h(l)%val(kw,m) > wilt_h(l)%val(kw,m) )  THEN
+                       m_total = m_total + rootfr_h(l)%val(kw,m) * swc_h(l)%val(kw,m)
+                    ENDIF
                 ENDDO
-             ENDIF
-
-!
-!--          Prognostic equation for soil water content m_soil.
-             tend(:) = 0.0_wp
-
-             tend(nzb_wall) = ( surf_usm_h%lambda_w_green(nzb_wall,m)                              &
-                              * ( swc_h(nzb_wall+1,m) - swc_h(nzb_wall,m) )                        &
-                              * surf_usm_h%ddz_green(nzb_wall+1,m)                                 &
-                              - surf_usm_h%gamma_w_green(nzb_wall,m)                               &
-                              - ( root_extr_green(nzb_wall) * surf_usm_h%qsws_veg(m)               &
-!                                 + surf_usm_h%qsws_soil_green(m)                                  &
-                                ) * drho_l_lv )                                                    &
-                              * surf_usm_h%ddz_green_stag(nzb_wall,m)
-
-             DO  kw = nzb_wall+1, nzt_wall-1
-                tend(kw) = ( surf_usm_h%lambda_w_green(kw,m)                                       &
-                             * ( swc_h(kw+1,m) - swc_h(kw,m) )                                     &
-                             * surf_usm_h%ddz_green(kw+1,m)                                        &
-                             - surf_usm_h%gamma_w_green(kw,m)                                      &
-                             - surf_usm_h%lambda_w_green(kw-1,m)                                   &
-                             * ( swc_h(kw,m) - swc_h(kw-1,m) )                                     &
-                             * surf_usm_h%ddz_green(kw,m)                                          &
-                             + surf_usm_h%gamma_w_green(kw-1,m)                                    &
-                             - (root_extr_green(kw)                                                &
-                             * surf_usm_h%qsws_veg(m)                                              &
-                             * drho_l_lv)                                                          &
-                          ) * surf_usm_h%ddz_green_stag(kw,m)
-
-             ENDDO
-             tend(nzt_wall) = ( - surf_usm_h%gamma_w_green(nzt_wall,m)                             &
-                                - surf_usm_h%lambda_w_green(nzt_wall-1,m)                          &
-                                * (swc_h(nzt_wall,m)                                               &
-                                - swc_h(nzt_wall-1,m))                                             &
-                                * surf_usm_h%ddz_green(nzt_wall,m)                                 &
-                                + surf_usm_h%gamma_w_green(nzt_wall-1,m)                           &
-                                - ( root_extr_green(nzt_wall)                                      &
-                                * surf_usm_h%qsws_veg(m)                                           &
-                                * drho_l_lv  )                                                     &
-                              ) * surf_usm_h%ddz_green_stag(nzt_wall,m)
-
-             swc_h_p(nzb_wall:nzt_wall,m) = swc_h(nzb_wall:nzt_wall,m) + dt_3d                     &
-                                            * ( tsc(2) * tend(:) + tsc(3)                          &
-                                                * surf_usm_h%tswc_h_m(:,m)                         &
-                                               )
-
-!
-!--          Account for dry soils (find a better solution here!)
-             DO  kw = nzb_wall, nzt_wall
-                IF ( swc_h_p(kw,m) < 0.0_wp )  swc_h_p(kw,m) = 0.0_wp
-             ENDDO
-
-!
-!--          Calculate m_soil tendencies for the next Runge-Kutta step
-             IF ( timestep_scheme(1:5) == 'runge' )  THEN
-                IF ( intermediate_timestep_count == 1 )  THEN
+
+                IF ( m_total > 0.0_wp )  THEN
                    DO  kw = nzb_wall, nzt_wall
-                      surf_usm_h%tswc_h_m(kw,m) = tend(kw)
-                   ENDDO
-                ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
-                   DO  kw = nzb_wall, nzt_wall
-                      surf_usm_h%tswc_h_m(kw,m) = -9.5625_wp * tend(kw) + 5.3125_wp                &
-                                                  * surf_usm_h%tswc_h_m(kw,m)
+                      IF ( swc_h(l)%val(kw,m) > wilt_h(l)%val(kw,m) )  THEN
+                         root_extr_green(kw) = rootfr_h(l)%val(kw,m) * swc_h(l)%val(kw,m) / m_total
+                      ELSE
+                         root_extr_green(kw) = 0.0_wp
+                      ENDIF
                    ENDDO
                 ENDIF
+
+!
+!--             Prognostic equation for soil water content m_soil.
+                tend(:) = 0.0_wp
+
+                tend(nzb_wall) = ( surf_usm_h(l)%lambda_w_green(nzb_wall,m)                           &
+                                 * ( swc_h(l)%val(nzb_wall+1,m) - swc_h(l)%val(nzb_wall,m) )          &
+                                 * surf_usm_h(l)%ddz_green(nzb_wall+1,m)                              &
+                                 - surf_usm_h(l)%gamma_w_green(nzb_wall,m)                            &
+                                 - ( root_extr_green(nzb_wall) * surf_usm_h(l)%qsws_veg(m)            &
+!                                    + surf_usm_h(l)%qsws_soil_green(m)                               &
+                                   ) * drho_l_lv )                                                    &
+                                 * surf_usm_h(l)%ddz_green_stag(nzb_wall,m)
+
+                DO  kw = nzb_wall+1, nzt_wall-1
+                   tend(kw) = ( surf_usm_h(l)%lambda_w_green(kw,m)                                    &
+                                * ( swc_h(l)%val(kw+1,m) - swc_h(l)%val(kw,m) )                       &
+                                * surf_usm_h(l)%ddz_green(kw+1,m)                                     &
+                                - surf_usm_h(l)%gamma_w_green(kw,m)                                   &
+                                - surf_usm_h(l)%lambda_w_green(kw-1,m)                                &
+                                * ( swc_h(l)%val(kw,m) - swc_h(l)%val(kw-1,m) )                       &
+                                * surf_usm_h(l)%ddz_green(kw,m)                                       &
+                                + surf_usm_h(l)%gamma_w_green(kw-1,m)                                 &
+                                - (root_extr_green(kw)                                                &
+                                * surf_usm_h(l)%qsws_veg(m)                                           &
+                                * drho_l_lv)                                                          &
+                             ) * surf_usm_h(l)%ddz_green_stag(kw,m)
+
+                ENDDO
+                tend(nzt_wall) = ( - surf_usm_h(l)%gamma_w_green(nzt_wall,m)                          &
+                                   - surf_usm_h(l)%lambda_w_green(nzt_wall-1,m)                       &
+                                   * (swc_h(l)%val(nzt_wall,m)                                        &
+                                   - swc_h(l)%val(nzt_wall-1,m))                                      &
+                                   * surf_usm_h(l)%ddz_green(nzt_wall,m)                              &
+                                   + surf_usm_h(l)%gamma_w_green(nzt_wall-1,m)                        &
+                                   - ( root_extr_green(nzt_wall)                                      &
+                                   * surf_usm_h(l)%qsws_veg(m)                                        &
+                                   * drho_l_lv  )                                                     &
+                                 ) * surf_usm_h(l)%ddz_green_stag(nzt_wall,m)
+
+                swc_h_p(l)%val(nzb_wall:nzt_wall,m) = swc_h(l)%val(nzb_wall:nzt_wall,m) + dt_3d       &
+                                               * ( tsc(2) * tend(:) + tsc(3)                          &
+                                                   * surf_usm_h(l)%tswc_h_m(:,m)                      &
+                                                  )
+
+!
+!--             Account for dry soils (find a better solution here!)
+                DO  kw = nzb_wall, nzt_wall
+                   IF ( swc_h_p(l)%val(kw,m) < 0.0_wp )  swc_h_p(l)%val(kw,m) = 0.0_wp
+                ENDDO
+
+!
+!--             Calculate m_soil tendencies for the next Runge-Kutta step
+                IF ( timestep_scheme(1:5) == 'runge' )  THEN
+                   IF ( intermediate_timestep_count == 1 )  THEN
+                      DO  kw = nzb_wall, nzt_wall
+                         surf_usm_h(l)%tswc_h_m(kw,m) = tend(kw)
+                      ENDDO
+                   ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
+                      DO  kw = nzb_wall, nzt_wall
+                         surf_usm_h(l)%tswc_h_m(kw,m) = -9.5625_wp * tend(kw) + 5.3125_wp             &
+                                                     * surf_usm_h(l)%tswc_h_m(kw,m)
+                      ENDDO
+                   ENDIF
+                ENDIF
              ENDIF
-          ENDIF
-
+
+          ENDIF
+       ENDDO
+       !$OMP END PARALLEL
+    ELSE
+       IF ( horizontal) THEN
+!--       For horizontal downward surfaces
+          surf         => surf_usm_h(l)
+          t_wall       => t_wall_h(l)
+          t_green      => t_green_h(l)
+       ELSE
+!--       For vertical surfaces
+          surf         => surf_usm_v(l)
+          t_wall       => t_wall_v(l)
+          t_green      => t_green_v(l)
        ENDIF
-
-    ENDDO
-    !$OMP END PARALLEL
-
-!
-!-- For vertical surfaces
-    DO  l = 0, 3
-       DO  m = 1, surf_usm_v(l)%ns
-
-          IF (surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp)  THEN
+       !$OMP DO SCHEDULE (STATIC)
+       DO  m = 1, surf%ns
+          IF (surf%frac(m,ind_pav_green) > 0.0_wp)  THEN
 !
 !-- No substrate layer for green walls / only groundbase green walls (ivy i.e.) -> Green layers get
@@ -5896,36 +5669,36 @@
 ! !
 ! !--          Obtain indices
-!              i = surf_usm_v(l)%i(m)
-!              j = surf_usm_v(l)%j(m)
-!              k = surf_usm_v(l)%k(m)
-!
-!              t_green_v(l)%t(nzt_wall+1,m) = t_wall_v(l)%t(nzb_wall,m)
+!              i = surf%i(m)
+!              j = surf%j(m)
+!              k = surf%k(m)
+!
+!              t_green%val(nzt_wall+1,m) = t_wall%val(nzb_wall,m)
 ! !
 ! !--          Prognostic equation for green temperature t_green_v
 !              gtend(:) = 0.0_wp
-!              gtend(nzb_wall) = (1.0_wp / surf_usm_v(l)%rho_c_green(nzb_wall,m)) * &
-!                                      ( surf_usm_v(l)%lambda_h_green(nzb_wall,m) * &
-!                                        ( t_green_v(l)%t(nzb_wall+1,m)             &
-!                                        - t_green_v(l)%t(nzb_wall,m) ) *           &
-!                                        surf_usm_v(l)%ddz_green(nzb_wall+1,m)      &
-!                                      + surf_usm_v(l)%wghf_eb(m) ) *               &
-!                                        surf_usm_v(l)%ddz_green_stag(nzb_wall,m)
+!              gtend(nzb_wall) = (1.0_wp / surf%rho_c_green(nzb_wall,m)) * &
+!                                      ( surf%lambda_h_green(nzb_wall,m) * &
+!                                        ( t_green%val(nzb_wall+1,m)             &
+!                                        - t_green%val(nzb_wall,m) ) *           &
+!                                        surf%ddz_green(nzb_wall+1,m)      &
+!                                      + surf%wghf_eb(m) ) *               &
+!                                        surf%ddz_green_stag(nzb_wall,m)
 !
 !              DO  kw = nzb_wall+1, nzt_wall
-!                 gtend(kw) = (1.0_wp / surf_usm_v(l)%rho_c_green(kw,m))          &
-!                           * (   surf_usm_v(l)%lambda_h_green(kw,m)              &
-!                             * ( t_green_v(l)%t(kw+1,m) - t_green_v(l)%t(kw,m) ) &
-!                             * surf_usm_v(l)%ddz_green(kw+1,m)                   &
-!                           - surf_usm_v(l)%lambda_h(kw-1,m)                      &
-!                             * ( t_green_v(l)%t(kw,m) - t_green_v(l)%t(kw-1,m) ) &
-!                             * surf_usm_v(l)%ddz_green(kw,m) )                   &
-!                           * surf_usm_v(l)%ddz_green_stag(kw,m)
+!                 gtend(kw) = (1.0_wp / surf%rho_c_green(kw,m))          &
+!                           * (   surf%lambda_h_green(kw,m)              &
+!                             * ( t_green%val(kw+1,m) - t_green%val(kw,m) ) &
+!                             * surf%ddz_green(kw+1,m)                   &
+!                           - surf%lambda_h(kw-1,m)                      &
+!                             * ( t_green%val(kw,m) - t_green%val(kw-1,m) ) &
+!                             * surf%ddz_green(kw,m) )                   &
+!                           * surf%ddz_green_stag(kw,m)
 !              ENDDO
 !
-!              t_green_v_p(l)%t(nzb_wall:nzt_wall,m) =                              &
-!                                   t_green_v(l)%t(nzb_wall:nzt_wall,m)             &
+!              t_green_v_p(l)%val(nzb_wall:nzt_wall,m) =                              &
+!                                   t_green%val(nzb_wall:nzt_wall,m)             &
 !                                 + dt_3d * ( tsc(2)                                &
 !                                 * gtend(nzb_wall:nzt_wall) + tsc(3)               &
-!                                 * surf_usm_v(l)%tt_green_m(nzb_wall:nzt_wall,m) )
+!                                 * surf%tt_green_m(nzb_wall:nzt_wall,m) )
 !
 ! !
@@ -5934,26 +5707,26 @@
 !                  IF ( intermediate_timestep_count == 1 )  THEN
 !                     DO  kw = nzb_wall, nzt_wall
-!                        surf_usm_v(l)%tt_green_m(kw,m) = gtend(kw)
+!                        surf%tt_green_m(kw,m) = gtend(kw)
 !                     ENDDO
 !                  ELSEIF ( intermediate_timestep_count <                           &
 !                           intermediate_timestep_count_max )  THEN
 !                      DO  kw = nzb_wall, nzt_wall
-!                         surf_usm_v(l)%tt_green_m(kw,m) =                          &
+!                         surf%tt_green_m(kw,m) =                          &
 !                                     - 9.5625_wp * gtend(kw) +                     &
-!                                       5.3125_wp * surf_usm_v(l)%tt_green_m(kw,m)
+!                                       5.3125_wp * surf%tt_green_m(kw,m)
 !                      ENDDO
 !                  ENDIF
 !              ENDIF
-
              DO  kw = nzb_wall, nzt_wall+1
-                 t_green_v(l)%t(kw,m) = t_wall_v(l)%t(nzb_wall,m)
+                 t_green%val(kw,m) = t_wall%val(nzb_wall,m)
              ENDDO
-
-          ENDIF
-
+          ENDIF
        ENDDO
-    ENDDO
-
-    IF ( debug_output_timestep )  CALL debug_message( 'usm_green_heat_model', 'end' )
+    ENDIF
+
+    IF ( debug_output_timestep )  THEN
+       WRITE( debug_string, * ) 'usm_green_heat_model: ', horizontal, l
+       CALL debug_message( debug_string, 'end' )
+    ENDIF
 
  END SUBROUTINE usm_green_heat_model
@@ -5972,8 +5745,4 @@
     NAMELIST /urban_surface_par/                                                                   &
                         building_type,                                                             &
-                        land_category,                                                             &
-                        naheatlayers,                                                              &
-                        pedestrian_category,                                                       &
-                        read_wall_temp_3d,                                                         &
                         roof_category,                                                             &
                         roof_inner_temperature,                                                    &
@@ -5981,6 +5750,4 @@
                         soil_inner_temperature,                                                    &
                         urban_surface,                                                             &
-                        usm_anthropogenic_heat,                                                    &
-                        usm_material_model,                                                        &
                         usm_wall_mod,                                                              &
                         wall_category,                                                             &
@@ -5991,8 +5758,4 @@
     NAMELIST /urban_surface_parameters/                                                            &
                         building_type,                                                             &
-                        land_category,                                                             &
-                        naheatlayers,                                                              &
-                        pedestrian_category,                                                       &
-                        read_wall_temp_3d,                                                         &
                         roof_category,                                                             &
                         roof_inner_temperature,                                                    &
@@ -6000,6 +5763,4 @@
                         soil_inner_temperature,                                                    &
                         urban_surface,                                                             &
-                        usm_anthropogenic_heat,                                                    &
-                        usm_material_model,                                                        &
                         usm_wall_mod,                                                              &
                         wall_category,                                                             &
@@ -6063,94 +5824,4 @@
 
  END SUBROUTINE usm_parin
-
-
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!
-!> This subroutine is part of the urban surface model.
-!> It reads daily heat produced by anthropogenic source and the diurnal cycle of the heat.
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_read_anthropogenic_heat
-
-    INTEGER(iwp)  ::  i, ii, j, k  !< running indices
-
-    REAL(wp)      ::  heat      !< anthropogenic heat
-
-!
-!-- Allocation of array of sources of anthropogenic heat and their diural profile
-    ALLOCATE( aheat(naheatlayers,nys:nyn,nxl:nxr) )
-    ALLOCATE( aheatprof(naheatlayers,0:24) )
-
-!
-!-- Read daily amount of heat and its daily cycle
-    aheat = 0.0_wp
-    DO  ii = 0, io_blocks-1
-        IF ( ii == io_group )  THEN
-
-!--         Open anthropogenic heat file
-            OPEN( 151, file = 'ANTHROPOGENIC_HEAT' // TRIM( coupling_char ), action = 'read',      &
-                  status = 'old', form = 'formatted', err = 11 )
-            i = 0
-            j = 0
-            DO
-                READ( 151, *, ERR=12, END=13 )  i, j, k, heat
-                IF ( i >= nxl  .AND.  i <= nxr  .AND.  j >= nys  .AND.  j <= nyn )  THEN
-                    IF ( k <= naheatlayers  .AND.  k > topo_top_ind(j,i,0) )  THEN
-!--                     Write heat into the array
-                        aheat(k,j,i) = heat
-                    ENDIF
-                ENDIF
-                CYCLE
- 12             WRITE( message_string, '(a,2i4)' ) 'error in file ANTHROPOGENIC_HEAT'              &
-                                                   // TRIM( coupling_char ) // ' after line ', i, j
-                CALL message( 'usm_read_anthropogenic_heat', 'PA0515', 0, 1, 0, 6, 0 )
-            ENDDO
- 13         CLOSE( 151 )
-            CYCLE
- 11         message_string = 'file ANTHROPOGENIC_HEAT' // TRIM( coupling_char ) // ' does not exist'
-            CALL message( 'usm_read_anthropogenic_heat', 'PA0516', 1, 2, 0, 6, 0 )
-        ENDIF
-
-#if defined( __parallel )
-        CALL MPI_BARRIER( comm2d, ierr )
-#endif
-    ENDDO
-
-!
-!-- Read diurnal profiles of heat sources
-    aheatprof = 0.0_wp
-    DO  ii = 0, io_blocks-1
-       IF ( ii == io_group )  THEN
-!
-!--         Open anthropogenic heat profile file
-            OPEN( 151, file = 'ANTHROPOGENIC_HEAT_PROFILE' // TRIM( coupling_char ),               &
-                  action = 'read', status = 'old', form = 'formatted', err = 21 )
-            i = 0
-            DO
-               READ( 151, *, err = 22, end = 23 )  i, k, heat
-!
-!--            Write heat into the array
-               IF ( i >= 0  .AND.  i <= 24  .AND.  k <= naheatlayers )  THEN
-                   aheatprof(k,i) = heat
-               ENDIF
-               CYCLE
- 22            WRITE( message_string, '(a,i4)' ) 'error in file ANTHROPOGENIC_HEAT_PROFILE' //     &
-                                                  TRIM( coupling_char ) // ' after line ', i
-               CALL message( 'usm_read_anthropogenic_heat', 'PA0517', 0, 1, 0, 6, 0 )
-            ENDDO
-            aheatprof(:,24) = aheatprof(:,0)
- 23         CLOSE( 151 )
-            CYCLE
- 21         message_string = 'file ANTHROPOGENIC_HEAT_PROFILE'//TRIM(coupling_char)//' does not exist'
-            CALL message( 'usm_read_anthropogenic_heat', 'PA0518', 1, 2, 0, 6, 0 )
-        ENDIF
-
-#if defined( __parallel )
-        CALL MPI_BARRIER( comm2d, ierr )
-#endif
-    ENDDO
-
- END SUBROUTINE usm_read_anthropogenic_heat
 
 
@@ -6173,5 +5844,4 @@
     INTEGER(iwp)  ::  k                 !< running index over previous input files covering current local domain
     INTEGER(iwp)  ::  l                 !< index variable for surface type
-    INTEGER(iwp)  ::  ns_h_on_file_usm  !< number of horizontal surface elements (urban type) on file
     INTEGER(iwp)  ::  nxlc              !< index of left boundary on current subdomain
     INTEGER(iwp)  ::  nxlf              !< index of left boundary on former subdomain
@@ -6184,4 +5854,5 @@
     INTEGER(iwp)  ::  nysf              !< index of south boundary on former subdomain
     INTEGER(iwp)  ::  nys_on_file       !< index of south boundary on former local domain
+    INTEGER(iwp)  ::  ns_h_on_file_usm(0:1)  !< number of horizontal surface elements (urban type) on file
     INTEGER(iwp)  ::  ns_v_on_file_usm(0:3)  !< number of vertical surface elements (urban type) on file
 !
@@ -6194,22 +5865,22 @@
 
 ! MS: Why are there individual temporary arrays that all have the same size?
-    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  tmp_surf_green_h   !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  tmp_surf_mliq_h    !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  tmp_surf_wall_h    !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  tmp_surf_waste_h   !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  tmp_surf_window_h  !<
-
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  tmp_green_h   !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  tmp_wall_h    !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  tmp_window_h  !<
-
-    TYPE( t_surf_vertical ), DIMENSION(0:3), SAVE ::  tmp_surf_green_v   !<
-    TYPE( t_surf_vertical ), DIMENSION(0:3), SAVE ::  tmp_surf_wall_v    !<
-    TYPE( t_surf_vertical ), DIMENSION(0:3), SAVE ::  tmp_surf_waste_v   !<
-    TYPE( t_surf_vertical ), DIMENSION(0:3), SAVE ::  tmp_surf_window_v  !<
-
-    TYPE( t_wall_vertical ), DIMENSION(0:3), SAVE ::  tmp_green_v   !<
-    TYPE( t_wall_vertical ), DIMENSION(0:3), SAVE ::  tmp_wall_v    !<
-    TYPE( t_wall_vertical ), DIMENSION(0:3), SAVE ::  tmp_window_v  !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:1), SAVE ::  tmp_surf_green_h   !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:1), SAVE ::  tmp_surf_mliq_h    !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:1), SAVE ::  tmp_surf_wall_h    !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:1), SAVE ::  tmp_surf_waste_h   !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:1), SAVE ::  tmp_surf_window_h  !<
+
+    TYPE( surf_type_2d_usm ), DIMENSION(0:1), SAVE ::  tmp_green_h   !<
+    TYPE( surf_type_2d_usm ), DIMENSION(0:1), SAVE ::  tmp_wall_h    !<
+    TYPE( surf_type_2d_usm ), DIMENSION(0:1), SAVE ::  tmp_window_h  !<
+
+    TYPE( surf_type_1d_usm ), DIMENSION(0:3), SAVE ::  tmp_surf_green_v   !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:3), SAVE ::  tmp_surf_wall_v    !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:3), SAVE ::  tmp_surf_waste_v   !<
+    TYPE( surf_type_1d_usm ), DIMENSION(0:3), SAVE ::  tmp_surf_window_v  !<
+
+    TYPE( surf_type_2d_usm ), DIMENSION(0:3), SAVE ::  tmp_green_v   !<
+    TYPE( surf_type_2d_usm ), DIMENSION(0:3), SAVE ::  tmp_wall_v    !<
+    TYPE( surf_type_2d_usm ), DIMENSION(0:3), SAVE ::  tmp_window_v  !<
 
 
@@ -6223,12 +5894,14 @@
              READ ( 13 ) ns_h_on_file_usm
 
-             IF ( ALLOCATED( tmp_surf_wall_h ) )    DEALLOCATE( tmp_surf_wall_h )
-             IF ( ALLOCATED( tmp_wall_h ) )         DEALLOCATE( tmp_wall_h )
-             IF ( ALLOCATED( tmp_surf_window_h ) )  DEALLOCATE( tmp_surf_window_h )
-             IF ( ALLOCATED( tmp_window_h) )        DEALLOCATE( tmp_window_h )
-             IF ( ALLOCATED( tmp_surf_green_h) )    DEALLOCATE( tmp_surf_green_h )
-             IF ( ALLOCATED( tmp_green_h) )         DEALLOCATE( tmp_green_h )
-             IF ( ALLOCATED( tmp_surf_mliq_h) )     DEALLOCATE( tmp_surf_mliq_h )
-             IF ( ALLOCATED( tmp_surf_waste_h) )    DEALLOCATE( tmp_surf_waste_h )
+             DO  l = 0, 1
+                IF ( ALLOCATED( tmp_surf_wall_h(l)%val ) )    DEALLOCATE( tmp_surf_wall_h(l)%val )
+                IF ( ALLOCATED( tmp_wall_h(l)%val ) )         DEALLOCATE( tmp_wall_h(l)%val )
+                IF ( ALLOCATED( tmp_surf_window_h(l)%val ) )  DEALLOCATE( tmp_surf_window_h(l)%val )
+                IF ( ALLOCATED( tmp_window_h(l)%val) )        DEALLOCATE( tmp_window_h(l)%val )
+                IF ( ALLOCATED( tmp_surf_green_h(l)%val) )    DEALLOCATE( tmp_surf_green_h(l)%val )
+                IF ( ALLOCATED( tmp_green_h(l)%val) )         DEALLOCATE( tmp_green_h(l)%val )
+                IF ( ALLOCATED( tmp_surf_mliq_h(l)%val) )     DEALLOCATE( tmp_surf_mliq_h(l)%val )
+                IF ( ALLOCATED( tmp_surf_waste_h(l)%val) )    DEALLOCATE( tmp_surf_waste_h(l)%val )
+             ENDDO
 
 !
@@ -6236,12 +5909,14 @@
 !--          elements do not necessarily need  to match the size of present surface elements on
 !--          current processor, as the number of processors between restarts can change.
-             ALLOCATE( tmp_surf_wall_h(1:ns_h_on_file_usm) )
-             ALLOCATE( tmp_wall_h(nzb_wall:nzt_wall+1, 1:ns_h_on_file_usm) )
-             ALLOCATE( tmp_surf_window_h(1:ns_h_on_file_usm) )
-             ALLOCATE( tmp_window_h(nzb_wall:nzt_wall+1, 1:ns_h_on_file_usm) )
-             ALLOCATE( tmp_surf_green_h(1:ns_h_on_file_usm) )
-             ALLOCATE( tmp_green_h(nzb_wall:nzt_wall+1, 1:ns_h_on_file_usm) )
-             ALLOCATE( tmp_surf_mliq_h(1:ns_h_on_file_usm) )
-             ALLOCATE( tmp_surf_waste_h(1:ns_h_on_file_usm) )
+             DO  l = 0, 1
+                ALLOCATE( tmp_surf_wall_h(l)%val(1:ns_h_on_file_usm(l)) )
+                ALLOCATE( tmp_wall_h(l)%val(nzb_wall:nzt_wall+1, 1:ns_h_on_file_usm(l) ) )
+                ALLOCATE( tmp_surf_window_h(l)%val(1:ns_h_on_file_usm(l)) )
+                ALLOCATE( tmp_window_h(l)%val(nzb_wall:nzt_wall+1, 1:ns_h_on_file_usm(l) ) )
+                ALLOCATE( tmp_surf_green_h(l)%val(1:ns_h_on_file_usm(l)) )
+                ALLOCATE( tmp_green_h(l)%val(nzb_wall:nzt_wall+1, 1:ns_h_on_file_usm(l) ) )
+                ALLOCATE( tmp_surf_mliq_h(l)%val(1:ns_h_on_file_usm(l)) )
+                ALLOCATE( tmp_surf_waste_h(l)%val(1:ns_h_on_file_usm(l)) )
+             ENDDO
 
           ENDIF
@@ -6252,11 +5927,11 @@
 
              DO  l = 0, 3
-                IF ( ALLOCATED( tmp_surf_wall_v(l)%t ) )    DEALLOCATE( tmp_surf_wall_v(l)%t )
-                IF ( ALLOCATED( tmp_wall_v(l)%t ) )         DEALLOCATE( tmp_wall_v(l)%t )
-                IF ( ALLOCATED( tmp_surf_window_v(l)%t ) )  DEALLOCATE( tmp_surf_window_v(l)%t )
-                IF ( ALLOCATED( tmp_window_v(l)%t ) )       DEALLOCATE( tmp_window_v(l)%t )
-                IF ( ALLOCATED( tmp_surf_green_v(l)%t ) )   DEALLOCATE( tmp_surf_green_v(l)%t )
-                IF ( ALLOCATED( tmp_green_v(l)%t ) )        DEALLOCATE( tmp_green_v(l)%t )
-                IF ( ALLOCATED( tmp_surf_waste_v(l)%t ) )   DEALLOCATE( tmp_surf_waste_v(l)%t )
+                IF ( ALLOCATED( tmp_surf_wall_v(l)%val ) )    DEALLOCATE( tmp_surf_wall_v(l)%val )
+                IF ( ALLOCATED( tmp_wall_v(l)%val ) )         DEALLOCATE( tmp_wall_v(l)%val )
+                IF ( ALLOCATED( tmp_surf_window_v(l)%val ) )  DEALLOCATE( tmp_surf_window_v(l)%val )
+                IF ( ALLOCATED( tmp_window_v(l)%val ) )       DEALLOCATE( tmp_window_v(l)%val )
+                IF ( ALLOCATED( tmp_surf_green_v(l)%val ) )   DEALLOCATE( tmp_surf_green_v(l)%val )
+                IF ( ALLOCATED( tmp_green_v(l)%val ) )        DEALLOCATE( tmp_green_v(l)%val )
+                IF ( ALLOCATED( tmp_surf_waste_v(l)%val ) )   DEALLOCATE( tmp_surf_waste_v(l)%val )
              ENDDO
 
@@ -6266,11 +5941,11 @@
 !--          current processor, as the number of processors between restarts can change.
              DO  l = 0, 3
-                ALLOCATE( tmp_surf_wall_v(l)%t(1:ns_v_on_file_usm(l)) )
-                ALLOCATE( tmp_wall_v(l)%t(nzb_wall:nzt_wall+1, 1:ns_v_on_file_usm(l) ) )
-                ALLOCATE( tmp_surf_window_v(l)%t(1:ns_v_on_file_usm(l)) )
-                ALLOCATE( tmp_window_v(l)%t(nzb_wall:nzt_wall+1, 1:ns_v_on_file_usm(l) ) )
-                ALLOCATE( tmp_surf_green_v(l)%t(1:ns_v_on_file_usm(l)) )
-                ALLOCATE( tmp_green_v(l)%t(nzb_wall:nzt_wall+1, 1:ns_v_on_file_usm(l) ) )
-                ALLOCATE( tmp_surf_waste_v(l)%t(1:ns_v_on_file_usm(l)) )
+                ALLOCATE( tmp_surf_wall_v(l)%val(1:ns_v_on_file_usm(l)) )
+                ALLOCATE( tmp_wall_v(l)%val(nzb_wall:nzt_wall+1, 1:ns_v_on_file_usm(l) ) )
+                ALLOCATE( tmp_surf_window_v(l)%val(1:ns_v_on_file_usm(l)) )
+                ALLOCATE( tmp_window_v(l)%val(nzb_wall:nzt_wall+1, 1:ns_v_on_file_usm(l) ) )
+                ALLOCATE( tmp_surf_green_v(l)%val(1:ns_v_on_file_usm(l)) )
+                ALLOCATE( tmp_green_v(l)%val(nzb_wall:nzt_wall+1, 1:ns_v_on_file_usm(l) ) )
+                ALLOCATE( tmp_surf_waste_v(l)%val(1:ns_v_on_file_usm(l)) )
              ENDDO
 
@@ -6299,87 +5974,176 @@
           ENDIF
 
-       CASE ( 't_surf_wall_h' )
+       CASE ( 't_surf_wall_h(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_wall_h_1 ) )   ALLOCATE( t_surf_wall_h_1(1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_surf_wall_h
-          ENDIF
-          CALL surface_restore_elements( t_surf_wall_h_1, tmp_surf_wall_h, surf_usm_h%start_index, &
-                                         start_index_on_file, end_index_on_file, nxlc, nysc,       &
-                                         nxlf, nxrf, nysf, nynf, nys_on_file, nyn_on_file,         &
-                                         nxl_on_file, nxr_on_file )
+             IF ( .NOT.  ALLOCATED( t_surf_wall_h_1(0)%val ) )                                       &
+                ALLOCATE( t_surf_wall_h_1(0)%val(1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_surf_wall_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_wall_h_1(0)%val, tmp_surf_wall_h(0)%val,               &
+                                         surf_usm_h(0)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_surf_wall_h(1)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_wall_h_1(1)%val ) )                                       &
+                ALLOCATE( t_surf_wall_h_1(1)%val(1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_surf_wall_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_wall_h_1(1)%val, tmp_surf_wall_h(1)%val,               &
+                                         surf_usm_h(1)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
 
        CASE ( 't_surf_wall_v(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(0)%t ) )                                       &
-                ALLOCATE( t_surf_wall_v_1(0)%t(1:surf_usm_v(0)%ns) )
-             READ ( 13 )  tmp_surf_wall_v(0)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_wall_v_1(0)%t, tmp_surf_wall_v(0)%t,               &
+             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(0)%val ) )                                       &
+                ALLOCATE( t_surf_wall_v_1(0)%val(1:surf_usm_v(0)%ns) )
+             READ ( 13 )  tmp_surf_wall_v(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_wall_v_1(0)%val, tmp_surf_wall_v(0)%val,               &
+                                         surf_usm_v(0)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_surf_wall_v(1)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(1)%val ) )                                       &
+                ALLOCATE( t_surf_wall_v_1(1)%val(1:surf_usm_v(1)%ns) )
+             READ ( 13 )  tmp_surf_wall_v(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_wall_v_1(1)%val, tmp_surf_wall_v(1)%val,               &
+                                         surf_usm_v(1)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_surf_wall_v(2)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(2)%val ) )                                       &
+                ALLOCATE( t_surf_wall_v_1(2)%val(1:surf_usm_v(2)%ns) )
+             READ ( 13 )  tmp_surf_wall_v(2)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_wall_v_1(2)%val, tmp_surf_wall_v(2)%val,               &
+                                         surf_usm_v(2)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_surf_wall_v(3)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(3)%val ) )                                       &
+                ALLOCATE( t_surf_wall_v_1(3)%val(1:surf_usm_v(3)%ns) )
+             READ ( 13 )  tmp_surf_wall_v(3)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_wall_v_1(3)%val, tmp_surf_wall_v(3)%val,               &
+                                         surf_usm_v(3)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_surf_window_h(0)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_window_h_1(0)%val ) )                                     &
+                ALLOCATE( t_surf_window_h_1(0)%val(1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_surf_window_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_window_h_1(0)%val, tmp_surf_window_h(0)%val,           &
+                                         surf_usm_h(0)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
+
+       CASE ( 't_surf_window_h(1)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_window_h_1(1)%val ) )                                     &
+                ALLOCATE( t_surf_window_h_1(1)%val(1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_surf_window_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_window_h_1(1)%val, tmp_surf_window_h(1)%val,           &
+                                         surf_usm_h(1)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
+
+       CASE ( 't_surf_window_v(0)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(0)%val ) )                                     &
+                ALLOCATE( t_surf_window_v_1(0)%val(1:surf_usm_v(0)%ns) )
+             READ ( 13 )  tmp_surf_window_v(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_window_v_1(0)%val, tmp_surf_window_v(0)%val,           &
                                          surf_usm_v(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_wall_v(1)' )
+       CASE ( 't_surf_window_v(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(1)%t ) )                                       &
-                ALLOCATE( t_surf_wall_v_1(1)%t(1:surf_usm_v(1)%ns) )
-             READ ( 13 )  tmp_surf_wall_v(1)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_wall_v_1(1)%t, tmp_surf_wall_v(1)%t,               &
+             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(1)%val ) )                                   &
+                ALLOCATE( t_surf_window_v_1(1)%val(1:surf_usm_v(1)%ns) )
+             READ ( 13 )  tmp_surf_window_v(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_window_v_1(1)%val, tmp_surf_window_v(1)%val,       &
                                          surf_usm_v(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_wall_v(2)' )
+       CASE ( 't_surf_window_v(2)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(2)%t ) )                                       &
-                ALLOCATE( t_surf_wall_v_1(2)%t(1:surf_usm_v(2)%ns) )
-             READ ( 13 )  tmp_surf_wall_v(2)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_wall_v_1(2)%t, tmp_surf_wall_v(2)%t,               &
+             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(2)%val ) )                                   &
+                ALLOCATE( t_surf_window_v_1(2)%val(1:surf_usm_v(2)%ns) )
+             READ ( 13 )  tmp_surf_window_v(2)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_window_v_1(2)%val, tmp_surf_window_v(2)%val,       &
                                          surf_usm_v(2)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_wall_v(3)' )
+       CASE ( 't_surf_window_v(3)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(3)%t ) )                                       &
-                ALLOCATE( t_surf_wall_v_1(3)%t(1:surf_usm_v(3)%ns) )
-             READ ( 13 )  tmp_surf_wall_v(3)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_wall_v_1(3)%t, tmp_surf_wall_v(3)%t,               &
+             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(3)%val ) )                                   &
+                ALLOCATE( t_surf_window_v_1(3)%val(1:surf_usm_v(3)%ns) )
+             READ ( 13 )  tmp_surf_window_v(3)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_window_v_1(3)%val, tmp_surf_window_v(3)%val,       &
                                          surf_usm_v(3)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_green_h' )
+       CASE ( 't_surf_green_h(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_green_h_1 ) )                                           &
-                ALLOCATE( t_surf_green_h_1(1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_surf_green_h
-          ENDIF
-          CALL surface_restore_elements( t_surf_green_h_1, tmp_surf_green_h,                       &
-                                         surf_usm_h%start_index, start_index_on_file,              &
+             IF ( .NOT.  ALLOCATED( t_surf_green_h_1(0)%val ) )                                      &
+                ALLOCATE( t_surf_green_h_1(0)%val(1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_surf_green_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_green_h_1(0)%val, tmp_surf_green_h(0)%val,             &
+                                         surf_usm_h(0)%start_index, start_index_on_file,         &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
-                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_surf_green_h(1)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_surf_green_h_1(1)%val ) )                                      &
+                ALLOCATE( t_surf_green_h_1(1)%val(1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_surf_green_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_green_h_1(1)%val, tmp_surf_green_h(1)%val,             &
+                                         surf_usm_h(1)%start_index, start_index_on_file,         &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
 
        CASE ( 't_surf_green_v(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(0)%t ) )                                      &
-                ALLOCATE( t_surf_green_v_1(0)%t(1:surf_usm_v(0)%ns) )
-             READ ( 13 )  tmp_surf_green_v(0)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_green_v_1(0)%t, tmp_surf_green_v(0)%t,             &
+             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(0)%val ) )                                      &
+                ALLOCATE( t_surf_green_v_1(0)%val(1:surf_usm_v(0)%ns) )
+             READ ( 13 )  tmp_surf_green_v(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_green_v_1(0)%val, tmp_surf_green_v(0)%val,             &
                                          surf_usm_v(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
-                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
 
        CASE ( 't_surf_green_v(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(1)%t ) )                                      &
-                ALLOCATE( t_surf_green_v_1(1)%t(1:surf_usm_v(1)%ns) )
-             READ ( 13 )  tmp_surf_green_v(1)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_green_v_1(1)%t, tmp_surf_green_v(1)%t,             &
+             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(1)%val ) )                                      &
+                ALLOCATE( t_surf_green_v_1(1)%val(1:surf_usm_v(1)%ns) )
+             READ ( 13 )  tmp_surf_green_v(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_green_v_1(1)%val, tmp_surf_green_v(1)%val,             &
                                          surf_usm_v(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6388,9 +6152,9 @@
        CASE ( 't_surf_green_v(2)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(2)%t ) )                                      &
-                ALLOCATE( t_surf_green_v_1(2)%t(1:surf_usm_v(2)%ns) )
-             READ ( 13 )  tmp_surf_green_v(2)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_green_v_1(2)%t, tmp_surf_green_v(2)%t,             &
+             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(2)%val ) )                                      &
+                ALLOCATE( t_surf_green_v_1(2)%val(1:surf_usm_v(2)%ns) )
+             READ ( 13 )  tmp_surf_green_v(2)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_green_v_1(2)%val, tmp_surf_green_v(2)%val,             &
                                          surf_usm_v(2)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6399,89 +6163,57 @@
        CASE ( 't_surf_green_v(3)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(3)%t ) )                                      &
-                ALLOCATE( t_surf_green_v_1(3)%t(1:surf_usm_v(3)%ns) )
-             READ ( 13 )  tmp_surf_green_v(3)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_green_v_1(3)%t, tmp_surf_green_v(3)%t,             &
+             IF ( .NOT.  ALLOCATED( t_surf_green_v_1(3)%val ) )                                      &
+                ALLOCATE( t_surf_green_v_1(3)%val(1:surf_usm_v(3)%ns) )
+             READ ( 13 )  tmp_surf_green_v(3)%val
+          ENDIF
+          CALL surface_restore_elements( t_surf_green_v_1(3)%val, tmp_surf_green_v(3)%val,             &
                                          surf_usm_v(3)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_window_h' )
+       CASE ( 'm_liq_usm_h(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_window_h_1 ) )                                          &
-                ALLOCATE( t_surf_window_h_1(1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_surf_window_h
-          ENDIF
-          CALL surface_restore_elements( t_surf_window_h_1, tmp_surf_window_h,                     &
-                                         surf_usm_h%start_index, start_index_on_file,              &
+             IF ( .NOT.  ALLOCATED( m_liq_usm_h(0)%val ) )                                         &
+                ALLOCATE( m_liq_usm_h(0)%val(1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_surf_mliq_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( m_liq_usm_h(0)%val, tmp_surf_mliq_h(0)%val,               &
+                                         surf_usm_h(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_window_v(0)' )
+       CASE ( 'm_liq_usm_h(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(0)%t ) )                                     &
-                ALLOCATE( t_surf_window_v_1(0)%t(1:surf_usm_v(0)%ns) )
-             READ ( 13 )  tmp_surf_window_v(0)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_window_v_1(0)%t, tmp_surf_window_v(0)%t,           &
-                                         surf_usm_v(0)%start_index, start_index_on_file,           &
+             IF ( .NOT.  ALLOCATED( m_liq_usm_h(1)%val ) )                                         &
+                ALLOCATE( m_liq_usm_h(1)%val(1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_surf_mliq_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( m_liq_usm_h(1)%val, tmp_surf_mliq_h(1)%val,               &
+                                         surf_usm_h(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_window_v(1)' )
+       CASE ( 'waste_heat_h(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(1)%t ) )                                     &
-                ALLOCATE( t_surf_window_v_1(1)%t(1:surf_usm_v(1)%ns) )
-             READ ( 13 )  tmp_surf_window_v(1)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_window_v_1(1)%t, tmp_surf_window_v(1)%t,           &
-                                         surf_usm_v(1)%start_index, start_index_on_file,           &
+             IF ( .NOT.  ALLOCATED( surf_usm_h(0)%waste_heat ) )                                   &
+                ALLOCATE( surf_usm_h(0)%waste_heat(1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_surf_waste_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( surf_usm_h(0)%waste_heat, tmp_surf_waste_h(0)%val,          &
+                                         surf_usm_h(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_window_v(2)' )
+       CASE ( 'waste_heat_h(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(2)%t ) )                                     &
-                ALLOCATE( t_surf_window_v_1(2)%t(1:surf_usm_v(2)%ns) )
-             READ ( 13 )  tmp_surf_window_v(2)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_window_v_1(2)%t, tmp_surf_window_v(2)%t,           &
-                                         surf_usm_v(2)%start_index, start_index_on_file,           &
+             IF ( .NOT.  ALLOCATED( surf_usm_h(1)%waste_heat ) )                                   &
+                ALLOCATE( surf_usm_h(1)%waste_heat(1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_surf_waste_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( surf_usm_h(1)%waste_heat, tmp_surf_waste_h(1)%val,          &
+                                         surf_usm_h(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_surf_window_v(3)' )
-          IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_surf_window_v_1(3)%t ) )                                     &
-                ALLOCATE( t_surf_window_v_1(3)%t(1:surf_usm_v(3)%ns) )
-             READ ( 13 )  tmp_surf_window_v(3)%t
-          ENDIF
-          CALL surface_restore_elements( t_surf_window_v_1(3)%t, tmp_surf_window_v(3)%t,           &
-                                         surf_usm_v(3)%start_index, start_index_on_file,           &
-                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
-                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
-
-       CASE ( 'm_liq_usm_h' )
-          IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( m_liq_usm_h%var_usm_1d ) )                                     &
-                ALLOCATE( m_liq_usm_h%var_usm_1d(1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_surf_mliq_h
-          ENDIF
-          CALL surface_restore_elements( m_liq_usm_h%var_usm_1d, tmp_surf_mliq_h,                  &
-                                         surf_usm_h%start_index, start_index_on_file,              &
-                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
-                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
-
-       CASE ( 'waste_heat_h' )
-          IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( surf_usm_h%waste_heat ) )                                      &
-                ALLOCATE( surf_usm_h%waste_heat(1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_surf_waste_h
-          ENDIF
-          CALL surface_restore_elements( surf_usm_h%waste_heat, tmp_surf_waste_h,                  &
-                                         surf_usm_h%start_index, start_index_on_file,              &
-                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
-                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
        CASE ( 'waste_heat_v(0)' )
@@ -6489,7 +6221,7 @@
              IF ( .NOT.  ALLOCATED( surf_usm_v(0)%waste_heat ) )                                   &
                 ALLOCATE( surf_usm_v(0)%waste_heat(1:surf_usm_v(0)%ns) )
-             READ ( 13 )  tmp_surf_waste_v(0)%t
-          ENDIF
-          CALL surface_restore_elements( surf_usm_v(0)%waste_heat, tmp_surf_waste_v(0)%t,          &
+             READ ( 13 )  tmp_surf_waste_v(0)%val
+          ENDIF
+          CALL surface_restore_elements( surf_usm_v(0)%waste_heat, tmp_surf_waste_v(0)%val,          &
                                          surf_usm_v(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6500,7 +6232,7 @@
              IF ( .NOT.  ALLOCATED( surf_usm_v(1)%waste_heat ) )                                   &
                 ALLOCATE( surf_usm_v(1)%waste_heat(1:surf_usm_v(1)%ns) )
-             READ ( 13 )  tmp_surf_waste_v(1)%t
-          ENDIF
-          CALL surface_restore_elements( surf_usm_v(1)%waste_heat, tmp_surf_waste_v(1)%t,          &
+             READ ( 13 )  tmp_surf_waste_v(1)%val
+          ENDIF
+          CALL surface_restore_elements( surf_usm_v(1)%waste_heat, tmp_surf_waste_v(1)%val,          &
                                          surf_usm_v(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6511,7 +6243,7 @@
              IF ( .NOT.  ALLOCATED( surf_usm_v(2)%waste_heat ) )                                   &
                 ALLOCATE( surf_usm_v(2)%waste_heat(1:surf_usm_v(2)%ns) )
-             READ ( 13 )  tmp_surf_waste_v(2)%t
-          ENDIF
-          CALL surface_restore_elements( surf_usm_v(2)%waste_heat, tmp_surf_waste_v(2)%t,          &
+             READ ( 13 )  tmp_surf_waste_v(2)%val
+          ENDIF
+          CALL surface_restore_elements( surf_usm_v(2)%waste_heat, tmp_surf_waste_v(2)%val,          &
                                          surf_usm_v(2)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6522,32 +6254,40 @@
              IF ( .NOT.  ALLOCATED( surf_usm_v(3)%waste_heat ) )                                   &
                 ALLOCATE( surf_usm_v(3)%waste_heat(1:surf_usm_v(3)%ns) )
-             READ ( 13 )  tmp_surf_waste_v(3)%t
-          ENDIF
-          CALL surface_restore_elements( surf_usm_v(3)%waste_heat, tmp_surf_waste_v(3)%t,          &
+             READ ( 13 )  tmp_surf_waste_v(3)%val
+          ENDIF
+          CALL surface_restore_elements( surf_usm_v(3)%waste_heat, tmp_surf_waste_v(3)%val,          &
                                          surf_usm_v(3)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_wall_h' )
+       CASE ( 't_wall_h(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_wall_h_1 ) )                                                 &
-                ALLOCATE( t_wall_h_1(nzb_wall:nzt_wall+1, 1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_wall_h
-          ENDIF
-          CALL surface_restore_elements( t_wall_h_1, tmp_wall_h, surf_usm_h%start_index,           &
-                                         start_index_on_file, end_index_on_file,                   &
-                                         nxlc, nysc, nxlf, nxrf, nysf, nynf,                       &
+             IF ( .NOT.  ALLOCATED( t_wall_h_1(0)%val ) )                                            &
+                ALLOCATE( t_wall_h_1(0)%val(nzb_wall:nzt_wall+1, 1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_wall_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_wall_h_1(0)%val, tmp_wall_h(0)%val,                         &
+                                         surf_usm_h(0)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-
-
+       CASE ( 't_wall_h(1)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_wall_h_1(1)%val ) )                                            &
+                ALLOCATE( t_wall_h_1(1)%val(nzb_wall:nzt_wall+1, 1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_wall_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_wall_h_1(1)%val, tmp_wall_h(1)%val,                         &
+                                         surf_usm_h(1)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
        CASE ( 't_wall_v(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_wall_v_1(0)%t ) )                                            &
-                ALLOCATE( t_wall_v_1(0)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(0)%ns) )
-             READ ( 13 )  tmp_wall_v(0)%t
-          ENDIF
-          CALL surface_restore_elements( t_wall_v_1(0)%t, tmp_wall_v(0)%t,                         &
+             IF ( .NOT.  ALLOCATED( t_wall_v_1(0)%val ) )                                            &
+                ALLOCATE( t_wall_v_1(0)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(0)%ns) )
+             READ ( 13 )  tmp_wall_v(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_wall_v_1(0)%val, tmp_wall_v(0)%val,                         &
                                          surf_usm_v(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6556,9 +6296,9 @@
        CASE ( 't_wall_v(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_wall_v_1(1)%t ) )                                            &
-                ALLOCATE( t_wall_v_1(1)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(1)%ns) )
-             READ ( 13 )  tmp_wall_v(1)%t
-          ENDIF
-          CALL surface_restore_elements( t_wall_v_1(1)%t, tmp_wall_v(1)%t,                         &
+             IF ( .NOT.  ALLOCATED( t_wall_v_1(1)%val ) )                                            &
+                ALLOCATE( t_wall_v_1(1)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(1)%ns) )
+             READ ( 13 )  tmp_wall_v(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_wall_v_1(1)%val, tmp_wall_v(1)%val,                         &
                                          surf_usm_v(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6567,9 +6307,9 @@
        CASE ( 't_wall_v(2)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_wall_v_1(2)%t ) )                                            &
-                ALLOCATE( t_wall_v_1(2)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(2)%ns) )
-             READ ( 13 )  tmp_wall_v(2)%t
-          ENDIF
-          CALL surface_restore_elements( t_wall_v_1(2)%t, tmp_wall_v(2)%t,                         &
+             IF ( .NOT.  ALLOCATED( t_wall_v_1(2)%val ) )                                            &
+                ALLOCATE( t_wall_v_1(2)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(2)%ns) )
+             READ ( 13 )  tmp_wall_v(2)%val
+          ENDIF
+          CALL surface_restore_elements( t_wall_v_1(2)%val, tmp_wall_v(2)%val,                         &
                                          surf_usm_v(2)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6578,119 +6318,141 @@
        CASE ( 't_wall_v(3)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_wall_v_1(3)%t ) )                                            &
-                ALLOCATE( t_wall_v_1(3)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(3)%ns) )
-             READ ( 13 )  tmp_wall_v(3)%t
-          ENDIF
-          CALL surface_restore_elements( t_wall_v_1(3)%t, tmp_wall_v(3)%t,                         &
+             IF ( .NOT.  ALLOCATED( t_wall_v_1(3)%val ) )                                            &
+                ALLOCATE( t_wall_v_1(3)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(3)%ns) )
+             READ ( 13 )  tmp_wall_v(3)%val
+          ENDIF
+          CALL surface_restore_elements( t_wall_v_1(3)%val, tmp_wall_v(3)%val,                         &
                                          surf_usm_v(3)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_green_h' )
+       CASE ( 't_window_h(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_green_h_1 ) )                                                &
-                ALLOCATE( t_green_h_1(nzb_wall:nzt_wall+1, 1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_green_h
-          ENDIF
-          CALL surface_restore_elements( t_green_h_1, tmp_green_h, surf_usm_h%start_index,         &
-                                         start_index_on_file, end_index_on_file, nxlc, nysc,       &
-                                         nxlf, nxrf, nysf, nynf, nys_on_file, nyn_on_file,         &
-                                         nxl_on_file,nxr_on_file )
-
-       CASE ( 't_green_v(0)' )
+             IF ( .NOT.  ALLOCATED( t_window_h_1(0)%val ) )                                               &
+                ALLOCATE( t_window_h_1(0)%val(nzb_wall:nzt_wall+1, 1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_window_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_window_h_1(0)%val, tmp_window_h(0)%val,                     &
+                                         surf_usm_h(0)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_window_h(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_green_v_1(0)%t ) )                                           &
-                ALLOCATE( t_green_v_1(0)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(0)%ns) )
-             READ ( 13 )  tmp_green_v(0)%t
-          ENDIF
-          CALL surface_restore_elements( t_green_v_1(0)%t, tmp_green_v(0)%t,                       &
+             IF ( .NOT.  ALLOCATED( t_window_h_1(1)%val ) )                                               &
+                ALLOCATE( t_window_h_1(1)%val(nzb_wall:nzt_wall+1, 1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_window_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_window_h_1(1)%val, tmp_window_h(1)%val,                     &
+                                         surf_usm_h(1)%start_index, start_index_on_file,           &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file, nxr_on_file )
+
+       CASE ( 't_window_v(0)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_window_v_1(0)%val ) )                                          &
+                ALLOCATE( t_window_v_1(0)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(0)%ns) )
+             READ ( 13 )  tmp_window_v(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_window_v_1(0)%val, tmp_window_v(0)%val,                     &
                                          surf_usm_v(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_green_v(1)' )
+       CASE ( 't_window_v(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_green_v_1(1)%t ) )                                           &
-                ALLOCATE( t_green_v_1(1)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(1)%ns) )
-             READ ( 13 )  tmp_green_v(1)%t
-          ENDIF
-          CALL surface_restore_elements( t_green_v_1(1)%t, tmp_green_v(1)%t,                       &
+             IF ( .NOT.  ALLOCATED( t_window_v_1(1)%val ) )                                          &
+                ALLOCATE( t_window_v_1(1)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(1)%ns) )
+             READ ( 13 )  tmp_window_v(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_window_v_1(1)%val, tmp_window_v(1)%val,                     &
                                          surf_usm_v(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_green_v(2)' )
+       CASE ( 't_window_v(2)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_green_v_1(2)%t ) )                                           &
-                ALLOCATE( t_green_v_1(2)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(2)%ns) )
-             READ ( 13 )  tmp_green_v(2)%t
-          ENDIF
-          CALL surface_restore_elements( t_green_v_1(2)%t, tmp_green_v(2)%t,                       &
+             IF ( .NOT.  ALLOCATED( t_window_v_1(2)%val ) )                                          &
+                ALLOCATE( t_window_v_1(2)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(2)%ns) )
+             READ ( 13 )  tmp_window_v(2)%val
+          ENDIF
+          CALL surface_restore_elements( t_window_v_1(2)%val, tmp_window_v(2)%val,                     &
                                          surf_usm_v(2)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_green_v(3)' )
+       CASE ( 't_window_v(3)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_green_v_1(3)%t ) )                                           &
-                ALLOCATE( t_green_v_1(3)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(3)%ns) )
-             READ ( 13 )  tmp_green_v(3)%t
-          ENDIF
-          CALL surface_restore_elements( t_green_v_1(3)%t, tmp_green_v(3)%t,                       &
+             IF ( .NOT.  ALLOCATED( t_window_v_1(3)%val ) )                                          &
+                ALLOCATE( t_window_v_1(3)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(3)%ns) )
+             READ ( 13 )  tmp_window_v(3)%val
+          ENDIF
+          CALL surface_restore_elements( t_window_v_1(3)%val, tmp_window_v(3)%val,                     &
                                          surf_usm_v(3)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_window_h' )
+       CASE ( 't_green_h(0)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_window_h_1 ) )                                               &
-                ALLOCATE( t_window_h_1(nzb_wall:nzt_wall+1, 1:surf_usm_h%ns) )
-             READ ( 13 )  tmp_window_h
-          ENDIF
-          CALL surface_restore_elements( t_window_h_1, tmp_window_h, surf_usm_h%start_index,       &
-                                         start_index_on_file, end_index_on_file, nxlc, nysc,       &
-                                         nxlf, nxrf, nysf, nynf, nys_on_file, nyn_on_file,         &
-                                         nxl_on_file, nxr_on_file )
-
-       CASE ( 't_window_v(0)' )
+             IF ( .NOT.  ALLOCATED( t_green_h_1(0)%val ) )                                           &
+                ALLOCATE( t_green_h_1(0)%val(nzb_wall:nzt_wall+1, 1:surf_usm_h(0)%ns) )
+             READ ( 13 )  tmp_green_h(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_green_h_1(0)%val, tmp_green_h(0)%val,                       &
+                                         surf_usm_h(0)%start_index, start_index_on_file,              &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
+
+       CASE ( 't_green_h(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_window_v_1(0)%t ) )                                          &
-                ALLOCATE( t_window_v_1(0)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(0)%ns) )
-             READ ( 13 )  tmp_window_v(0)%t
-          ENDIF
-          CALL surface_restore_elements( t_window_v_1(0)%t, tmp_window_v(0)%t,                     &
+             IF ( .NOT.  ALLOCATED( t_green_h_1(1)%val ) )                                           &
+                ALLOCATE( t_green_h_1(1)%val(nzb_wall:nzt_wall+1, 1:surf_usm_h(1)%ns) )
+             READ ( 13 )  tmp_green_h(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_green_h_1(1)%val, tmp_green_h(1)%val,                       &
+                                         surf_usm_h(1)%start_index, start_index_on_file,              &
+                                         end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
+                                         nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
+
+       CASE ( 't_green_v(0)' )
+          IF ( k == 1 )  THEN
+             IF ( .NOT.  ALLOCATED( t_green_v_1(0)%val ) )                                           &
+                ALLOCATE( t_green_v_1(0)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(0)%ns) )
+             READ ( 13 )  tmp_green_v(0)%val
+          ENDIF
+          CALL surface_restore_elements( t_green_v_1(0)%val, tmp_green_v(0)%val,                       &
                                          surf_usm_v(0)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_window_v(1)' )
+       CASE ( 't_green_v(1)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_window_v_1(1)%t ) )                                          &
-                ALLOCATE( t_window_v_1(1)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(1)%ns) )
-             READ ( 13 )  tmp_window_v(1)%t
-          ENDIF
-          CALL surface_restore_elements( t_window_v_1(1)%t, tmp_window_v(1)%t,                     &
+             IF ( .NOT.  ALLOCATED( t_green_v_1(1)%val ) )                                           &
+                ALLOCATE( t_green_v_1(1)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(1)%ns) )
+             READ ( 13 )  tmp_green_v(1)%val
+          ENDIF
+          CALL surface_restore_elements( t_green_v_1(1)%val, tmp_green_v(1)%val,                       &
                                          surf_usm_v(1)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_window_v(2)' )
+       CASE ( 't_green_v(2)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_window_v_1(2)%t ) )                                          &
-                ALLOCATE( t_window_v_1(2)%t(nzb_wall:nzt_wall+1, 1:surf_usm_v(2)%ns) )
-             READ ( 13 )  tmp_window_v(2)%t
-          ENDIF
-          CALL surface_restore_elements( t_window_v_1(2)%t, tmp_window_v(2)%t,                     &
+             IF ( .NOT.  ALLOCATED( t_green_v_1(2)%val ) )                                           &
+                ALLOCATE( t_green_v_1(2)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(2)%ns) )
+             READ ( 13 )  tmp_green_v(2)%val
+          ENDIF
+          CALL surface_restore_elements( t_green_v_1(2)%val, tmp_green_v(2)%val,                       &
                                          surf_usm_v(2)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
                                          nys_on_file, nyn_on_file, nxl_on_file,nxr_on_file )
 
-       CASE ( 't_window_v(3)' )
+       CASE ( 't_green_v(3)' )
           IF ( k == 1 )  THEN
-             IF ( .NOT.  ALLOCATED( t_window_v_1(3)%t ) )                                          &
-                ALLOCATE( t_window_v_1(3)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(3)%ns) )
-             READ ( 13 )  tmp_window_v(3)%t
-          ENDIF
-          CALL surface_restore_elements( t_window_v_1(3)%t, tmp_window_v(3)%t,                     &
+             IF ( .NOT.  ALLOCATED( t_green_v_1(3)%val ) )                                           &
+                ALLOCATE( t_green_v_1(3)%val(nzb_wall:nzt_wall+1, 1:surf_usm_v(3)%ns) )
+             READ ( 13 )  tmp_green_v(3)%val
+          ENDIF
+          CALL surface_restore_elements( t_green_v_1(3)%val, tmp_green_v(3)%val,                       &
                                          surf_usm_v(3)%start_index, start_index_on_file,           &
                                          end_index_on_file, nxlc, nysc, nxlf, nxrf, nysf, nynf,    &
@@ -6731,21 +6493,28 @@
     LOGICAL ::  ldum  !< dummy variable
 
-
-    CALL rrd_mpi_io( 'usm_start_index_h',  surf_usm_h%start_index )
-    CALL rrd_mpi_io( 'usm_end_index_h', surf_usm_h%end_index )
-    CALL rrd_mpi_io( 'usm_global_start_h', global_start )
-
-    CALL rd_mpi_io_surface_filetypes( surf_usm_h%start_index, surf_usm_h%end_index, ldum,          &
-                                      global_start )
-
-    IF ( .NOT.  ALLOCATED( t_surf_wall_h_1 ) )  ALLOCATE( t_surf_wall_h_1(1:surf_usm_h%ns) )
-    CALL rrd_mpi_io_surface( 't_surf_wall_h', t_surf_wall_h_1 )
-
-    IF ( .NOT.  ALLOCATED( t_surf_window_h_1 ) )  ALLOCATE( t_surf_window_h_1(1:surf_usm_h%ns) )
-    CALL rrd_mpi_io_surface( 't_surf_window_h', t_surf_window_h_1 )
-
-    IF ( .NOT.  ALLOCATED( t_surf_green_h_1 ) )  ALLOCATE( t_surf_green_h_1(1:surf_usm_h%ns) )
-    CALL rrd_mpi_io_surface( 't_surf_green_h', t_surf_green_h_1 )
-
+    DO  l = 0, 1
+
+       WRITE( dum, '(I1)' )  l
+
+       CALL rrd_mpi_io( 'usm_start_index_h_' //dum,  surf_usm_h(l)%start_index )
+       CALL rrd_mpi_io( 'usm_end_index_h_' //dum, surf_usm_h(l)%end_index )
+       CALL rrd_mpi_io( 'usm_global_start_h_' //dum, global_start )
+
+       CALL rd_mpi_io_surface_filetypes( surf_usm_h(l)%start_index, surf_usm_h(l)%end_index, ldum, &
+                                         global_start )
+
+       IF ( .NOT.  ALLOCATED( t_surf_wall_h_1(l)%val ) )                                             &
+          ALLOCATE( t_surf_wall_h_1(l)%val(1:surf_usm_h(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_wall_h(' // dum // ')', t_surf_wall_h_1(l)%val )
+
+       IF ( .NOT.  ALLOCATED( t_surf_window_h_1(l)%val ) )                                           &
+          ALLOCATE( t_surf_window_h_1(l)%val(1:surf_usm_h(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_window_h(' // dum // ')', t_surf_window_h_1(l)%val )
+
+       IF ( .NOT.  ALLOCATED( t_surf_green_h_1(l)%val ) )                                            &
+          ALLOCATE( t_surf_green_h_1(l)%val(1:surf_usm_h(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_green_h(' // dum // ')', t_surf_green_h_1(l)%val )
+
+    ENDDO
     DO  l = 0, 3
 
@@ -6759,36 +6528,41 @@
                                          global_start )
 
-       IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(l)%t ) )                                             &
-          ALLOCATE( t_surf_wall_v_1(l)%t(1:surf_usm_v(l)%ns) )
-       CALL rrd_mpi_io_surface( 't_surf_wall_v(' // dum // ')', t_surf_wall_v_1(l)%t )
-
-       IF ( .NOT.  ALLOCATED( t_surf_window_v_1(l)%t ) )                                           &
-          ALLOCATE( t_surf_window_v_1(l)%t(1:surf_usm_v(l)%ns) )
-       CALL rrd_mpi_io_surface( 't_surf_window_v(' // dum // ')', t_surf_window_v_1(l)%t )
-
-       IF ( .NOT.  ALLOCATED( t_surf_green_v_1(l)%t ) )                                            &
-          ALLOCATE( t_surf_green_v_1(l)%t(1:surf_usm_v(l)%ns) )
-       CALL rrd_mpi_io_surface( 't_surf_green_v(' // dum // ')', t_surf_green_v_1(l)%t)
+       IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(l)%val ) )                                             &
+          ALLOCATE( t_surf_wall_v_1(l)%val(1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_wall_v(' // dum // ')', t_surf_wall_v_1(l)%val )
+
+       IF ( .NOT.  ALLOCATED( t_surf_window_v_1(l)%val ) )                                           &
+          ALLOCATE( t_surf_window_v_1(l)%val(1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_window_v(' // dum // ')', t_surf_window_v_1(l)%val )
+
+       IF ( .NOT.  ALLOCATED( t_surf_green_v_1(l)%val ) )                                            &
+          ALLOCATE( t_surf_green_v_1(l)%val(1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_green_v(' // dum // ')', t_surf_green_v_1(l)%val)
 
     ENDDO
 
-    CALL rrd_mpi_io( 'usm_start_index_h_2',  surf_usm_h%start_index )
-    CALL rrd_mpi_io( 'usm_end_index_h_2', surf_usm_h%end_index )
-    CALL rrd_mpi_io( 'usm_global_start_h_2', global_start )
-
-    CALL rd_mpi_io_surface_filetypes( surf_usm_h%start_index, surf_usm_h%end_index, ldum,          &
-                                      global_start )
-
-    IF ( .NOT.  ALLOCATED( t_wall_h_1 ) )                                                          &
-       ALLOCATE( t_wall_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    CALL rrd_mpi_io_surface( 't_wall_h', t_wall_h_1 )
-
-    IF ( .NOT.  ALLOCATED( t_window_h_1 ) )                                                        &
-       ALLOCATE( t_window_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    CALL rrd_mpi_io_surface( 't_window_h', t_window_h_1 )
-
-    IF ( .NOT.  ALLOCATED( t_green_h_1 ) )                                                         &
-       ALLOCATE( t_green_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
-    CALL rrd_mpi_io_surface( 't_green_h', t_green_h_1 )
+    DO  l = 0, 1
+
+       WRITE( dum, '(I1)' )  l
+
+       CALL rrd_mpi_io( 'usm_start_index_h_2_' //dum,  surf_usm_h(l)%start_index )
+       CALL rrd_mpi_io( 'usm_end_index_h_2_' //dum, surf_usm_h(l)%end_index )
+       CALL rrd_mpi_io( 'usm_global_start_h_2_' //dum, global_start )
+
+       CALL rd_mpi_io_surface_filetypes( surf_usm_h(l)%start_index, surf_usm_h(l)%end_index, ldum,          &
+                                         global_start )
+
+       IF ( .NOT.  ALLOCATED( t_wall_h_1(l)%val ) )                                                          &
+          ALLOCATE( t_wall_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_wall_h(' // dum // ')', t_wall_h_1(l)%val )
+
+       IF ( .NOT.  ALLOCATED( t_window_h_1(l)%val ) )                                                        &
+          ALLOCATE( t_window_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_window_h(' // dum // ')', t_window_h_1(l)%val )
+
+       IF ( .NOT.  ALLOCATED( t_green_h_1(l)%val ) )                                                         &
+          ALLOCATE( t_green_h_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_h(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_green_h(' // dum // ')', t_green_h_1(l)%val )
+    ENDDO
 
     DO  l = 0, 3
@@ -6803,688 +6577,19 @@
                                          global_start )
 
-       IF ( .NOT. ALLOCATED( t_wall_v_1(l)%t ) )                                                   &
-          ALLOCATE ( t_wall_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       CALL rrd_mpi_io_surface( 't_wall_v(' // dum // ')', t_wall_v_1(l)%t )
-
-       IF ( .NOT. ALLOCATED( t_window_v_1(l)%t ) )                                                 &
-          ALLOCATE ( t_window_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       CALL rrd_mpi_io_surface( 't_window_v(' // dum // ')', t_window_v_1(l)%t )
-
-       IF ( .NOT. ALLOCATED( t_green_v_1(l)%t ) )                                                  &
-          ALLOCATE ( t_green_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
-       CALL rrd_mpi_io_surface( 't_green_v(' // dum // ')', t_green_v_1(l)%t )
+       IF ( .NOT. ALLOCATED( t_wall_v_1(l)%val ) )                                                   &
+          ALLOCATE ( t_wall_v_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_wall_v(' // dum // ')', t_wall_v_1(l)%val )
+
+       IF ( .NOT. ALLOCATED( t_window_v_1(l)%val ) )                                                 &
+          ALLOCATE ( t_window_v_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_window_v(' // dum // ')', t_window_v_1(l)%val )
+
+       IF ( .NOT. ALLOCATED( t_green_v_1(l)%val ) )                                                  &
+          ALLOCATE ( t_green_v_1(l)%val(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_green_v(' // dum // ')', t_green_v_1(l)%val )
 
     ENDDO
 
  END SUBROUTINE usm_rrd_local_mpi
-
-
-
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!
-!> This subroutine reads walls, roofs and land categories and its parameters from input files.
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_read_urban_surface_types
-
-    USE netcdf_data_input_mod,                                                                     &
-        ONLY:  building_pars_f,                                                                    &
-               building_type_f
-
-    IMPLICIT NONE
-
-    CHARACTER(12)                                        ::  wtn  !<
-
-    INTEGER(iwp)                                         ::  i, j                                  !<
-    INTEGER(iwp)                                         ::  ii, ij, ip, it, iw, jw, k, kw, l, m   !<
-    INTEGER(iwp)                                         ::  category                              !<
-    INTEGER(iwp)                                         ::  dirsn, dirwe, nz, roof                !<
-    INTEGER(iwp)                                         ::  weheight1, wecat1, snheight1, sncat1  !<
-    INTEGER(iwp)                                         ::  weheight2, wecat2, snheight2, sncat2  !<
-    INTEGER(iwp)                                         ::  weheight3, wecat3, snheight3, sncat3  !<
-    INTEGER(iwp)                                         ::  wtc                                   !<
-
-    INTEGER(iwp), DIMENSION(0:17, nysg:nyng, nxlg:nxrg)  ::  usm_par  !<
-
-    LOGICAL                                              ::  ascii_file = .FALSE.  !<
-
-    REAL(wp)                                             ::  albedo, height, thick                     !<
-    REAL(wp)                                             ::  wealbedo1, wethick1, snalbedo1, snthick1  !<
-    REAL(wp)                                             ::  wealbedo2, wethick2, snalbedo2, snthick2  !<
-    REAL(wp)                                             ::  wealbedo3, wethick3, snalbedo3, snthick3  !<
-
-    REAL(wp), DIMENSION(n_surface_params)                ::  wtp      !<
-
-    REAL(wp), DIMENSION(1:14, nysg:nyng, nxlg:nxrg)      ::  usm_val  !<
-
-
-    IF ( debug_output )  CALL debug_message( 'usm_read_urban_surface_types', 'start' )
-!
-!-- If building_pars or building_type are already read from static input file, skip reading ASCII
-!-- file.
-    IF ( building_type_f%from_file  .OR.  building_pars_f%from_file )  RETURN
-!
-!-- Check if ASCII input file exists. If not, return and initialize USM with default settings.
-    INQUIRE( FILE = 'SURFACE_PARAMETERS' // coupling_char, EXIST = ascii_file )
-
-    IF ( .NOT. ascii_file )  RETURN
-
-!
-!-- Read categories of walls and their parameters
-    DO  ii = 0, io_blocks-1
-        IF ( ii == io_group )  THEN
-!
-!--         Open urban surface file
-            OPEN( 151, file = 'SURFACE_PARAMETERS' // coupling_char,  action = 'read', &
-                       status = 'old', form = 'formatted', err = 15 )
-!
-!--         First test and get n_surface_types
-            k = 0
-            l = 0
-            DO
-               l = l+1
-               READ( 151, *, err = 11, end = 12 )  wtc, wtp, wtn
-               k = k+1
-               CYCLE
- 11            CONTINUE
-            ENDDO
- 12         n_surface_types = k
-            ALLOCATE( surface_type_names(n_surface_types) )
-            ALLOCATE( surface_type_codes(n_surface_types) )
-            ALLOCATE( surface_params(n_surface_params, n_surface_types) )
-!
-!--         Real reading
-            rewind( 151 )
-            k = 0
-            DO
-               READ( 151, *, err = 13, end = 14 )  wtc, wtp, wtn
-               k = k+1
-               surface_type_codes(k) = wtc
-               surface_params(:,k) = wtp
-               surface_type_names(k) = wtn
-               CYCLE
-13             WRITE( 6,'(i3,a,2i5)') myid, 'readparams2 error k = ', k
-               FLUSH( 6 )
-               CONTINUE
-            ENDDO
- 14         CLOSE(151)
-            CYCLE
- 15         message_string = 'file SURFACE_PARAMETERS' // TRIM( coupling_char ) // ' does not exist'
-            CALL message( 'usm_read_urban_surface_types', 'PA0513', 1, 2, 0, 6, 0 )
-        ENDIF
-    ENDDO
-
-!
-!-- Read types of surfaces
-    usm_par = 0
-    DO  ii = 0, io_blocks-1
-       IF ( ii == io_group )  THEN
-
-!
-!--         Open csv urban surface file
-            OPEN( 151, file = 'URBAN_SURFACE' // TRIM( coupling_char ), action = 'read',           &
-                  status = 'old', form = 'formatted', err = 23 )
-
-            l = 0
-            DO
-
-               l = l+1
-!
-!--            i, j, height, nz, roof, dirwe, dirsn, category, soilcat,
-!--            weheight1, wecat1, snheight1, sncat1, weheight2, wecat2, snheight2, sncat2,
-!--            weheight3, wecat3, snheight3, sncat3
-               READ( 151, *, err = 21, end = 25 )  i, j, height, nz, roof, dirwe, dirsn,           &
-                                       category, albedo, thick,                                    &
-                                       weheight1, wecat1, wealbedo1, wethick1,                     &
-                                       weheight2, wecat2, wealbedo2, wethick2,                     &
-                                       weheight3, wecat3, wealbedo3, wethick3,                     &
-                                       snheight1, sncat1, snalbedo1, snthick1,                     &
-                                       snheight2, sncat2, snalbedo2, snthick2,                     &
-                                       snheight3, sncat3, snalbedo3, snthick3
-
-               IF ( i >= nxlg  .AND.  i <= nxrg  .AND.  j >= nysg  .AND.  j <= nyng )  THEN
-!
-!--                Write integer variables into array
-                   usm_par(:,j,i) = (/1, nz, roof, dirwe, dirsn, category,                         &
-                                     weheight1, wecat1, weheight2, wecat2, weheight3, wecat3,      &
-                                     snheight1, sncat1, snheight2, sncat2, snheight3, sncat3 /)
-!
-!--                Write real values into array
-                   usm_val(:,j,i) = (/ albedo, thick,                                              &
-                                      wealbedo1, wethick1, wealbedo2, wethick2,                    &
-                                      wealbedo3, wethick3, snalbedo1, snthick1,                    &
-                                      snalbedo2, snthick2, snalbedo3, snthick3 /)
-               ENDIF
-               CYCLE
- 21            WRITE( message_string, '(A,I5)') 'errors in file URBAN_SURFACE ' //                 &
-                                                TRIM( coupling_char ) // ' on line ', l
-               CALL message( 'usm_read_urban_surface_types', 'PA0512', 0, 1, 0, 6, 0 )
-            ENDDO
-
- 23         message_string = 'file URBAN_SURFACE ' // TRIM( coupling_char ) // ' does not exist'
-            CALL message( 'usm_read_urban_surface_types', 'PA0514', 1, 2, 0, 6, 0 )
-
- 25         CLOSE( 151 )
-
-        ENDIF
-#if defined( __parallel )
-        CALL MPI_BARRIER( comm2d, ierr )
-#endif
-    ENDDO
-
-!
-!-- Check completeness and formal correctness of the data
-    DO  i = nxlg, nxrg
-        DO  j = nysg, nyng
-            IF ( usm_par(0,j,i) /= 0  .AND.  (        &  !< incomplete data,supply default values later
-                 usm_par(1,j,i) < nzb  .OR.           &
-                 usm_par(1,j,i) > nzt  .OR.           &  !< incorrect height (nz < nzb  .OR.  nz > nzt)
-                 usm_par(2,j,i) < 0  .OR.             &
-                 usm_par(2,j,i) > 1  .OR.             &  !< incorrect roof sign
-                 usm_par(3,j,i) < nzb-nzt  .OR.       &
-                 usm_par(3,j,i) > nzt-nzb  .OR.       &  !< incorrect west-east wall direction sign
-                 usm_par(4,j,i) < nzb-nzt  .OR.       &
-                 usm_par(4,j,i) > nzt-nzb  .OR.       &  !< incorrect south-north wall direction sign
-                 usm_par(6,j,i) < nzb  .OR.           &
-                 usm_par(6,j,i) > nzt  .OR.           &  !< incorrect pedestrian level height for west-east wall
-                 usm_par(8,j,i) > nzt  .OR.           &
-                 usm_par(10,j,i) > nzt  .OR.          &  !< incorrect wall or roof level height for west-east wall
-                 usm_par(12,j,i) < nzb  .OR.          &
-                 usm_par(12,j,i) > nzt  .OR.          &  !< incorrect pedestrian level height for south-north wall
-                 usm_par(14,j,i) > nzt  .OR.          &
-                 usm_par(16,j,i) > nzt                &  !< incorrect wall or roof level height for south-north wall
-                ) )  THEN
-!
-!--             Incorrect input data
-                WRITE( message_string, '(A,2I5)' )                                                 &
-                'missing or incorrect data in file URBAN_SURFACE' //  TRIM( coupling_char ) //     &
-                ' for i,j=', i, j
-                CALL message( 'usm_read_urban_surface', 'PA0504', 1, 2, 0, 6, 0 )
-            ENDIF
-
-        ENDDO
-    ENDDO
-!
-!-- Assign the surface types to the respective data type. First, for horizontal upward-facing
-!-- surfaces. Further, set flag indicating that albedo is initialized via ASCI format, else it would
-!-- be overwritten in the radiation model.
-    surf_usm_h%albedo_from_ascii = .TRUE.
-    DO  m = 1, surf_usm_h%ns
-       iw = surf_usm_h%i(m)
-       jw = surf_usm_h%j(m)
-       kw = surf_usm_h%k(m)
-
-       IF ( usm_par(5,jw,iw) == 0 )  THEN
-
-          IF ( zu(kw) >= roof_height_limit )  THEN
-             surf_usm_h%isroof_surf(m)   = .TRUE.
-             surf_usm_h%surface_types(m) = roof_category !< Default category for root surface
-          ELSE
-             surf_usm_h%isroof_surf(m)   = .FALSE.
-             surf_usm_h%surface_types(m) = land_category !< Default category for land surface
-          ENDIF
-
-          surf_usm_h%albedo(m,:)         = -1.0_wp
-          surf_usm_h%thickness_wall(m)   = -1.0_wp
-          surf_usm_h%thickness_green(m)  = -1.0_wp
-          surf_usm_h%thickness_window(m) = -1.0_wp
-       ELSE
-          IF ( usm_par(2,jw,iw)==0 )  THEN
-             surf_usm_h%isroof_surf(m)      = .FALSE.
-             surf_usm_h%thickness_wall(m)   = -1.0_wp
-             surf_usm_h%thickness_window(m) = -1.0_wp
-             surf_usm_h%thickness_green(m)  = -1.0_wp
-          ELSE
-             surf_usm_h%isroof_surf(m)      = .TRUE.
-             surf_usm_h%thickness_wall(m)   = usm_val(2,jw,iw)
-             surf_usm_h%thickness_window(m) = usm_val(2,jw,iw)
-             surf_usm_h%thickness_green(m)  = usm_val(2,jw,iw)
-          ENDIF
-          surf_usm_h%surface_types(m)     = usm_par(5,jw,iw)
-          surf_usm_h%albedo(m,:)          = usm_val(1,jw,iw)
-          surf_usm_h%transmissivity(m)    = 0.0_wp
-       ENDIF
-!
-!--    Find the type position
-       it = surf_usm_h%surface_types(m)
-       ip = -99999
-       DO  k = 1, n_surface_types
-          IF ( surface_type_codes(k) == it )  THEN
-             ip = k
-             EXIT
-          ENDIF
-       ENDDO
-       IF ( ip == -99999 )  THEN
-!
-!--       Land/roof category not found
-          WRITE(9, '(A, I5, A, 3I5)' ) 'land/roof category ', it, ' not found  for i, j, k = ',    &
-                                       iw, jw, kw
-          FLUSH( 9 )
-          IF ( surf_usm_h%isroof_surf(m) )  THEN
-             category = roof_category
-          ELSE
-             category = land_category
-          ENDIF
-          DO  k = 1, n_surface_types
-             IF ( surface_type_codes(k) == roof_category )  THEN
-                ip = k
-                EXIT
-             ENDIF
-          ENDDO
-          IF ( ip == -99999 )  THEN
-!
-!--          Default land/roof category not found
-             WRITE( 9, '(A, I5, A, 3I5)' ) 'Default land/roof category ', category, ' not found!'
-             FLUSH( 9 )
-             ip = 1
-          ENDIF
-       ENDIF
-!
-!--    Albedo
-       IF ( surf_usm_h%albedo(m,ind_veg_wall) < 0.0_wp )  THEN
-          surf_usm_h%albedo(m,:) = surface_params(ialbedo, ip)
-       ENDIF
-!
-!--    Albedo type is 0 (custom), others are replaced later
-       surf_usm_h%albedo_type(m,:) = 0
-!
-!--    Transmissivity
-       IF ( surf_usm_h%transmissivity(m) < 0.0_wp )  THEN
-          surf_usm_h%transmissivity(m) = 0.0_wp
-       ENDIF
-!
-!--    Emissivity of the wall
-       surf_usm_h%emissivity(m,:) = surface_params(iemiss, ip)
-!
-!--    Heat conductivity Î»S between air and wall ( W mâ2 Kâ1 )
-       surf_usm_h%lambda_surf(m)        = surface_params(ilambdas,ip)
-       surf_usm_h%lambda_surf_window(m) = surface_params(ilambdas,ip)
-       surf_usm_h%lambda_surf_green(m)  = surface_params(ilambdas,ip)
-!
-!--    Roughness length for momentum, heat and humidity
-       surf_usm_h%z0(m)  = surface_params(irough,ip)
-       surf_usm_h%z0h(m) = surface_params(iroughh,ip)
-       surf_usm_h%z0q(m) = surface_params(iroughh,ip)
-!
-!--    Surface skin layer heat capacity (J mâ2 Kâ1 )
-       surf_usm_h%c_surface(m)        = surface_params(icsurf,ip)
-       surf_usm_h%c_surface_window(m) = surface_params(icsurf,ip)
-       surf_usm_h%c_surface_green(m)  = surface_params(icsurf,ip)
-!
-!--    Wall material parameters:
-!--    Thickness of the wall (m) missing values are replaced by default value for category
-       IF ( surf_usm_h%thickness_wall(m) <= 0.001_wp )  THEN
-            surf_usm_h%thickness_wall(m) = surface_params(ithick,ip)
-       ENDIF
-       IF ( surf_usm_h%thickness_window(m) <= 0.001_wp )  THEN
-            surf_usm_h%thickness_window(m) = surface_params(ithick,ip)
-       ENDIF
-       IF ( surf_usm_h%thickness_green(m) <= 0.001_wp )  THEN
-            surf_usm_h%thickness_green(m) = surface_params(ithick,ip)
-       ENDIF
-!
-!--    Volumetric heat capacity rho*C of the wall ( J mâ3 Kâ1 )
-       surf_usm_h%rho_c_wall(:,m)   = surface_params(irhoC,ip)
-       surf_usm_h%rho_c_window(:,m) = surface_params(irhoC,ip)
-       surf_usm_h%rho_c_green(:,m)  = surface_params(irhoC,ip)
-!
-!--    Thermal conductivity Î»H of the wall (W mâ1 Kâ1 )
-       surf_usm_h%lambda_h(:,m)        = surface_params(ilambdah,ip)
-       surf_usm_h%lambda_h_window(:,m) = surface_params(ilambdah,ip)
-       surf_usm_h%lambda_h_green(:,m)  = surface_params(ilambdah,ip)
-
-    ENDDO
-!
-!-- For vertical surface elements ( 0 -- northward-facing, 1 -- southward-facing,
-!--  2 -- eastward-facing, 3 -- westward-facing )
-    DO  l = 0, 3
-!
-!--    Set flag indicating that albedo is initialized via ASCII format.
-!--    Else it would be overwritten in the radiation model.
-       surf_usm_v(l)%albedo_from_ascii = .TRUE.
-       DO  m = 1, surf_usm_v(l)%ns
-          i  = surf_usm_v(l)%i(m)
-          j  = surf_usm_v(l)%j(m)
-          kw = surf_usm_v(l)%k(m)
-
-          IF ( l == 3 )  THEN ! Westward facing
-             iw = i
-             jw = j
-             ii = 6
-             ij = 3
-          ELSEIF ( l == 2 )  THEN
-             iw = i-1
-             jw = j
-             ii = 6
-             ij = 3
-          ELSEIF ( l == 1 )  THEN
-             iw = i
-             jw = j
-             ii = 12
-             ij = 9
-          ELSEIF ( l == 0 )  THEN
-             iw = i
-             jw = j-1
-             ii = 12
-             ij = 9
-          ENDIF
-
-          IF ( iw < 0 .OR. jw < 0 ) THEN
-!
-!--          Wall on west or south border of the domain - assign default category
-             IF ( kw <= roof_height_limit ) THEN
-                 surf_usm_v(l)%surface_types(m) = wall_category   !< Default category for wall surface in wall zone
-             ELSE
-                 surf_usm_v(l)%surface_types(m) = roof_category   !< Default category for wall surface in roof zone
-             ENDIF
-             surf_usm_v(l)%albedo(m,:)         = -1.0_wp
-             surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
-             surf_usm_v(l)%thickness_window(m) = -1.0_wp
-             surf_usm_v(l)%thickness_green(m)  = -1.0_wp
-             surf_usm_v(l)%transmissivity(m)   = -1.0_wp
-          ELSE IF ( kw <= usm_par(ii,jw,iw) )  THEN
-!
-!--             Pedestrian zone
-             IF ( usm_par(ii+1,jw,iw) == 0 )  THEN
-                 surf_usm_v(l)%surface_types(m)  = pedestrian_category   !< Default category for wall surface in
-                                                                         !< Pedestrian zone
-                 surf_usm_v(l)%albedo(m,:)         = -1.0_wp
-                 surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
-                 surf_usm_v(l)%thickness_window(m) = -1.0_wp
-                 surf_usm_v(l)%thickness_green(m)  = -1.0_wp
-                 surf_usm_v(l)%transmissivity(m)   = -1.0_wp
-             ELSE
-                 surf_usm_v(l)%surface_types(m)    = usm_par(ii+1,jw,iw)
-                 surf_usm_v(l)%albedo(m,:)         = usm_val(ij,jw,iw)
-                 surf_usm_v(l)%thickness_wall(m)   = usm_val(ij+1,jw,iw)
-                 surf_usm_v(l)%thickness_window(m) = usm_val(ij+1,jw,iw)
-                 surf_usm_v(l)%thickness_green(m)  = usm_val(ij+1,jw,iw)
-                 surf_usm_v(l)%transmissivity(m)   = 0.0_wp
-             ENDIF
-          ELSE IF ( kw <= usm_par(ii+2,jw,iw) )  THEN
-!
-!--          Wall zone
-             IF ( usm_par(ii+3,jw,iw) == 0 )  THEN
-                 surf_usm_v(l)%surface_types(m)    = wall_category  !< default category for wall surface
-                 surf_usm_v(l)%albedo(m,:)         = -1.0_wp
-                 surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
-                 surf_usm_v(l)%thickness_window(m) = -1.0_wp
-                 surf_usm_v(l)%thickness_green(m)  = -1.0_wp
-                 surf_usm_v(l)%transmissivity(m)   = -1.0_wp
-             ELSE
-                 surf_usm_v(l)%surface_types(m)    = usm_par(ii+3,jw,iw)
-                 surf_usm_v(l)%albedo(m,:)         = usm_val(ij+2,jw,iw)
-                 surf_usm_v(l)%thickness_wall(m)   = usm_val(ij+3,jw,iw)
-                 surf_usm_v(l)%thickness_window(m) = usm_val(ij+3,jw,iw)
-                 surf_usm_v(l)%thickness_green(m)  = usm_val(ij+3,jw,iw)
-                 surf_usm_v(l)%transmissivity(m)   = 0.0_wp
-             ENDIF
-          ELSE IF ( kw <= usm_par(ii+4,jw,iw) )  THEN
-!
-!--          Roof zone
-             IF ( usm_par(ii+5,jw,iw) == 0 )  THEN
-                 surf_usm_v(l)%surface_types(m)    = roof_category  !< Default category for roof surface
-                 surf_usm_v(l)%albedo(m,:)         = -1.0_wp
-                 surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
-                 surf_usm_v(l)%thickness_window(m) = -1.0_wp
-                 surf_usm_v(l)%thickness_green(m)  = -1.0_wp
-                 surf_usm_v(l)%transmissivity(m)   = -1.0_wp
-             ELSE
-                 surf_usm_v(l)%surface_types(m)    = usm_par(ii+5,jw,iw)
-                 surf_usm_v(l)%albedo(m,:)         = usm_val(ij+4,jw,iw)
-                 surf_usm_v(l)%thickness_wall(m)   = usm_val(ij+5,jw,iw)
-                 surf_usm_v(l)%thickness_window(m) = usm_val(ij+5,jw,iw)
-                 surf_usm_v(l)%thickness_green(m)  = usm_val(ij+5,jw,iw)
-                 surf_usm_v(l)%transmissivity(m)   = 0.0_wp
-             ENDIF
-          ELSE
-             WRITE( 9, *) 'Problem reading USM data:'
-             WRITE( 9, *) l,i,j,kw,topo_top_ind(j,i,0)
-             WRITE( 9, *) ii,iw,jw,kw,topo_top_ind(jw,iw,0)
-             WRITE( 9, *) usm_par(ii,jw,iw),usm_par(ii+1,jw,iw)
-             WRITE( 9, *) usm_par(ii+2,jw,iw),usm_par(ii+3,jw,iw)
-             WRITE( 9, *) usm_par(ii+4,jw,iw),usm_par(ii+5,jw,iw)
-             WRITE( 9, *) kw,roof_height_limit,wall_category,roof_category
-             FLUSH( 9 )
-!
-!--          Supply the default category
-             IF ( kw <= roof_height_limit )  THEN
-                 surf_usm_v(l)%surface_types(m) = wall_category  !< Default category for wall surface in wall zone
-             ELSE
-                 surf_usm_v(l)%surface_types(m) = roof_category  !< Default category for wall surface in roof zone
-             ENDIF
-             surf_usm_v(l)%albedo(m,:)         = -1.0_wp
-             surf_usm_v(l)%thickness_wall(m)   = -1.0_wp
-             surf_usm_v(l)%thickness_window(m) = -1.0_wp
-             surf_usm_v(l)%thickness_green(m)  = -1.0_wp
-             surf_usm_v(l)%transmissivity(m)   = -1.0_wp
-          ENDIF
-!
-!--       Find the type position
-          it = surf_usm_v(l)%surface_types(m)
-          ip = -99999
-          DO  k = 1, n_surface_types
-             IF ( surface_type_codes(k) == it )  THEN
-                ip = k
-                EXIT
-             ENDIF
-          ENDDO
-          IF ( ip == -99999 )  THEN
-!
-!--          Wall category not found
-             WRITE( 9, '(A,I7,A,3I5)' ) 'wall category ', it, ' not found  for i,j,k = ', iw, jw, kw
-             FLUSH(9)
-             category = wall_category
-             DO  k = 1, n_surface_types
-                IF ( surface_type_codes(k) == category )  THEN
-                   ip = k
-                   EXIT
-                ENDIF
-             ENDDO
-             IF ( ip == -99999 )  THEN
-!
-!--             Default wall category not found
-                WRITE ( 9, '(A,I5,A,3I5)' ) 'Default wall category', category, ' not found!'
-                FLUSH( 9 )
-                ip = 1
-             ENDIF
-          ENDIF
-
-!
-!--       Albedo
-          IF ( surf_usm_v(l)%albedo(m,ind_veg_wall) < 0.0_wp )  THEN
-             surf_usm_v(l)%albedo(m,:) = surface_params(ialbedo,ip)
-          ENDIF
-!--       Albedo type is 0 (custom), others are replaced later
-          surf_usm_v(l)%albedo_type(m,:) = 0
-!--       Transmissivity of the windows
-          IF ( surf_usm_v(l)%transmissivity(m) < 0.0_wp )  THEN
-             surf_usm_v(l)%transmissivity(m) = 0.0_wp
-          ENDIF
-!
-!--       Emissivity of the wall
-          surf_usm_v(l)%emissivity(:,m) = surface_params(iemiss,ip)
-!
-!--       Heat conductivity lambda S between air and wall ( W m-2 K-1 )
-          surf_usm_v(l)%lambda_surf(m)        = surface_params(ilambdas,ip)
-          surf_usm_v(l)%lambda_surf_window(m) = surface_params(ilambdas,ip)
-          surf_usm_v(l)%lambda_surf_green(m)  = surface_params(ilambdas,ip)
-!
-!--       Roughness length
-          surf_usm_v(l)%z0(m)  = surface_params(irough,ip)
-          surf_usm_v(l)%z0h(m) = surface_params(iroughh,ip)
-          surf_usm_v(l)%z0q(m) = surface_params(iroughh,ip)
-!
-!--       Surface skin layer heat capacity (J m-2 K-1 )
-          surf_usm_v(l)%c_surface(m)        = surface_params(icsurf,ip)
-          surf_usm_v(l)%c_surface_window(m) = surface_params(icsurf,ip)
-          surf_usm_v(l)%c_surface_green(m)  = surface_params(icsurf,ip)
-!
-!--       Wall material parameters:
-!--       Thickness of the wall (m)
-!--       Missing values are replaced by default value for category
-          IF ( surf_usm_v(l)%thickness_wall(m) <= 0.001_wp )  THEN
-               surf_usm_v(l)%thickness_wall(m) = surface_params(ithick,ip)
-          ENDIF
-          IF ( surf_usm_v(l)%thickness_window(m) <= 0.001_wp )  THEN
-               surf_usm_v(l)%thickness_window(m) = surface_params(ithick,ip)
-          ENDIF
-          IF ( surf_usm_v(l)%thickness_green(m) <= 0.001_wp )  THEN
-               surf_usm_v(l)%thickness_green(m) = surface_params(ithick,ip)
-          ENDIF
-!
-!--       Volumetric heat capacity rho*C of the wall ( J m-3 K-1 )
-          surf_usm_v(l)%rho_c_wall(:,m)   = surface_params(irhoC,ip)
-          surf_usm_v(l)%rho_c_window(:,m) = surface_params(irhoC,ip)
-          surf_usm_v(l)%rho_c_green(:,m)  = surface_params(irhoC,ip)
-!
-!--       Thermal conductivity lambda H of the wall (W m-1 K-1 )
-          surf_usm_v(l)%lambda_h(:,m)        = surface_params(ilambdah,ip)
-          surf_usm_v(l)%lambda_h_window(:,m) = surface_params(ilambdah,ip)
-          surf_usm_v(l)%lambda_h_green(:,m)  = surface_params(ilambdah,ip)
-
-       ENDDO
-    ENDDO
-
-!
-!-- Initialize wall layer thicknesses. Please note, this will be removed after migration to Palm
-!-- input data standard.
-    DO  k = nzb_wall, nzt_wall
-       zwn(k)        = zwn_default(k)
-       zwn_green(k)  = zwn_default_green(k)
-       zwn_window(k) = zwn_default_window(k)
-    ENDDO
-!
-!-- Apply for all particular surface grids. First for horizontal surfaces
-    DO  m = 1, surf_usm_h%ns
-       surf_usm_h%zw(:,m)        = zwn(:) * surf_usm_h%thickness_wall(m)
-       surf_usm_h%zw_green(:,m)  = zwn_green(:) * surf_usm_h%thickness_green(m)
-       surf_usm_h%zw_window(:,m) = zwn_window(:) * surf_usm_h%thickness_window(m)
-    ENDDO
-    DO  l = 0, 3
-       DO  m = 1, surf_usm_v(l)%ns
-          surf_usm_v(l)%zw(:,m)        = zwn(:) * surf_usm_v(l)%thickness_wall(m)
-          surf_usm_v(l)%zw_green(:,m)  = zwn_green(:) * surf_usm_v(l)%thickness_green(m)
-          surf_usm_v(l)%zw_window(:,m) = zwn_window(:) * surf_usm_v(l)%thickness_window(m)
-       ENDDO
-    ENDDO
-
-    IF ( debug_output )  CALL debug_message( 'usm_read_urban_surface_types', 'end' )
-
- END SUBROUTINE usm_read_urban_surface_types
-
-
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!
-!> This function advances through the list of local surfaces to find given x, y, d, z coordinates
-!--------------------------------------------------------------------------------------------------!
-    PURE FUNCTION find_surface( x, y, z, d ) result(isurfl)
-
-        INTEGER(iwp)              ::  isurfl         !<
-        INTEGER(iwp)              ::  isx, isy, isz  !<
-        INTEGER(iwp), INTENT(in)  ::  d, x, y, z     !<
-
-        IF ( d == 0 )  THEN
-           DO  isurfl = 1, surf_usm_h%ns
-              isx = surf_usm_h%i(isurfl)
-              isy = surf_usm_h%j(isurfl)
-              isz = surf_usm_h%k(isurfl)
-              IF ( isx==x .AND. isy==y .AND. isz==z )  RETURN
-           ENDDO
-        ELSE
-           DO  isurfl = 1, surf_usm_v(d-1)%ns
-              isx = surf_usm_v(d-1)%i(isurfl)
-              isy = surf_usm_v(d-1)%j(isurfl)
-              isz = surf_usm_v(d-1)%k(isurfl)
-              IF ( isx==x .AND. isy==y .AND. isz==z )  RETURN
-           ENDDO
-        ENDIF
-!
-!--     coordinate not found
-        isurfl = -1
-
-    END FUNCTION
-
-
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!
-!> This subroutine reads temperatures of respective material layers in walls, roofs and ground from
-!> input files. Data in the input file must be in standard order, i.e. horizontal surfaces first
-!> ordered by x, y and then vertical surfaces ordered by x, y, direction, z
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_read_wall_temperature
-
-    INTEGER(iwp)                              ::  d, i, ii, iline, j, k  !< running indices
-    INTEGER(iwp)                              ::  isurfl                 !<
-
-    REAL(wp)                                  ::  rtsurf  !<
-    REAL(wp), DIMENSION(nzb_wall:nzt_wall+1)  ::  rtwall  !<
-
-
-    IF ( debug_output )  CALL debug_message( 'usm_read_wall_temperature', 'start' )
-
-    DO  ii = 0, io_blocks-1
-        IF ( ii == io_group )  THEN
-!
-!--         Open wall temperature file
-            OPEN( 152, file = 'WALL_TEMPERATURE' // coupling_char, action = 'read', &
-                       status = 'old', form = 'formatted', err = 15 )
-
-            isurfl = 0
-            iline = 1
-            DO
-                rtwall = -9999.0_wp  !< For incomplete lines
-                READ( 152, *, err = 13, end = 14 )  i, j, k, d, rtsurf, rtwall
-
-                IF ( nxl <= i .AND. i <= nxr .AND. nys <= j .AND. j <= nyn)  THEN  !< Local processor
-!--                 identify surface id
-                    isurfl = find_surface( i, j, k, d )
-                    IF ( isurfl == -1 )  THEN
-                        WRITE( message_string, '(a,4i5,a,i5,a)' ) 'Coordinates (xyzd) ', i, j, k,  &
-                        d, ' on line ', iline, ' in file WALL_TEMPERATURE are either not ' //      &
-                        'present or out of standard order of surfaces.'
-                        CALL message( 'usm_read_wall_temperature', 'PA0521', 1, 2, 0, 6, 0 )
-                    ENDIF
-!
-!--                 Assign temperatures
-                    IF ( d == 0 )  THEN
-                       t_surf_wall_h(isurfl) = rtsurf
-                       t_wall_h(:,isurfl)    = rtwall(:)
-                       t_window_h(:,isurfl)  = rtwall(:)
-                       t_green_h(:,isurfl)   = rtwall(:)
-                    ELSE
-                       t_surf_wall_v(d-1)%t(isurfl) = rtsurf
-                       t_wall_v(d-1)%t(:,isurfl)    = rtwall(:)
-                       t_window_v(d-1)%t(:,isurfl)  = rtwall(:)
-                       t_green_v(d-1)%t(:,isurfl)   = rtwall(:)
-                    ENDIF
-                ENDIF
-
-                iline = iline + 1
-                CYCLE
- 13             WRITE( message_string, '(a,i5,a)' ) 'Error reading line ', iline,                  &
-                                                    ' in file WALL_TEMPERATURE.'
-                CALL message( 'usm_read_wall_temperature', 'PA0522', 1, 2, 0, 6, 0 )
-            ENDDO
- 14         CLOSE( 152 )
-            CYCLE
- 15         message_string = 'file WALL_TEMPERATURE' // TRIM( coupling_char ) // ' does not exist'
-            CALL message( 'usm_read_wall_temperature', 'PA0523', 1, 2, 0, 6, 0 )
-        ENDIF
-#if defined( __parallel )
-        CALL MPI_BARRIER( comm2d, ierr )
-#endif
-    ENDDO
-
-    IF ( debug_output )  CALL debug_message( 'usm_read_wall_temperature', 'end' )
-
- END SUBROUTINE usm_read_wall_temperature
-
-
 
 !--------------------------------------------------------------------------------------------------!
@@ -7496,5 +6601,34 @@
 !> No calculation of window surface temperatures during spinup to increase maximum possible timstep
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_surface_energy_balance( during_spinup )
+ SUBROUTINE usm_energy_balance( during_spinup )
+
+    LOGICAL       ::  during_spinup  !< flag indicating soil/wall spinup phase
+    INTEGER(iwp)  ::  l              !< loop index for surface types
+!
+!-- Call for horizontal surfaces
+    DO l = 0, 1
+       CALL usm_surface_energy_balance( .TRUE., l, during_spinup )
+       CALL usm_green_heat_model( .TRUE., l )
+       CALL usm_wall_heat_model( .TRUE., l, during_spinup )
+    ENDDO
+!
+!--   Call for vertical surfaces
+    DO l = 0, 3
+       CALL usm_surface_energy_balance( .FALSE., l, during_spinup )
+       CALL usm_green_heat_model( .FALSE., l )
+       CALL usm_wall_heat_model( .FALSE., l, during_spinup )
+    ENDDO
+
+ END SUBROUTINE usm_energy_balance
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Solver for the energy balance at the ground/roof/wall surface. It follows the basic ideas and
+!> structure of lsm_energy_balance with many simplifications and adjustments.
+!> TODO better description
+!> No calculation of window surface temperatures during spinup to increase maximum possible timstep
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE usm_surface_energy_balance( horizontal, l, during_spinup )
 
     USE exchange_horiz_mod,                                                                        &
@@ -7504,13 +6638,14 @@
     IMPLICIT NONE
 
-    INTEGER(iwp)  ::  dhour          !< simulated hour of day (in UTC)
-    INTEGER(iwp)  ::  i, j, k, l, m  !< running indices
-    INTEGER(iwp)  ::  i_off  !< offset to determine index of surface element, seen from atmospheric grid point, for x
-    INTEGER(iwp)  ::  j_off  !< offset to determine index of surface element, seen from atmospheric grid point, for y
-    INTEGER(iwp)  ::  k_off  !< offset to determine index of surface element, seen from atmospheric grid point, for z
-
-    LOGICAL  ::  during_spinup      !< flag indicating soil/wall spinup phase
-
-    REAL(wp)  ::  acoef              !< actual coefficient of diurnal profile of anthropogenic heat
+    LOGICAL       ::  horizontal     !< Flag indicating horizontal or vertical surfaces
+    INTEGER(iwp)  ::  l              !< direction index
+    LOGICAL       ::  during_spinup  !< flag indicating soil/wall spinup phase
+
+    INTEGER(iwp)  ::  i, j, k, m     !< running indices
+    INTEGER(iwp)  ::  i_off          !< offset to determine index of surface element, seen from atmospheric grid point, for x
+    INTEGER(iwp)  ::  j_off          !< offset to determine index of surface element, seen from atmospheric grid point, for y
+    INTEGER(iwp)  ::  k_off          !< offset to determine index of surface element, seen from atmospheric grid point, for z
+
+
     REAL(wp)  ::  coef_1             !< first coeficient for prognostic equation
     REAL(wp)  ::  coef_window_1      !< first coeficient for prognostic window equation
@@ -7519,5 +6654,4 @@
     REAL(wp)  ::  coef_window_2      !< second  coeficient for prognostic window equation
     REAL(wp)  ::  coef_green_2       !< second  coeficient for prognostic green wall equation
-    REAL(wp)  ::  dtime              !< simulated time of day (in UTC)
     REAL(wp)  ::  frac_win           !< window fraction, used to restore original values during spinup
     REAL(wp)  ::  frac_green         !< green fraction, used to restore original values during spinup
@@ -7557,14 +6691,52 @@
                   ueff                        !< limited near-surface wind speed - used for calculation of resistance
 
+    TYPE(surf_type),        POINTER ::  surf              !< surface-date type variable
+    TYPE(surf_type_1d_usm), POINTER ::  t_surf_green      !<
+    TYPE(surf_type_1d_usm), POINTER ::  t_surf_green_p    !<
+    TYPE(surf_type_1d_usm), POINTER ::  t_surf_wall       !<
+    TYPE(surf_type_1d_usm), POINTER ::  t_surf_wall_p     !<
+    TYPE(surf_type_1d_usm), POINTER ::  t_surf_window     !<
+    TYPE(surf_type_1d_usm), POINTER ::  t_surf_window_p   !<
+    TYPE(surf_type_2d_usm), POINTER ::  t_green           !<
+    TYPE(surf_type_2d_usm), POINTER ::  t_wall            !<
+    TYPE(surf_type_2d_usm), POINTER ::  t_window          !<
+
+    LOGICAL   ::  upward                      !< Flag indicating upward horizontal surfaces
 
     IF ( debug_output_timestep )  THEN
-       WRITE( debug_string, * ) 'usm_surface_energy_balance | during_spinup: ', during_spinup
+       WRITE( debug_string, * ) 'usm_surface_energy_balance:', horizontal, l, during_spinup
        CALL debug_message( debug_string, 'start' )
     ENDIF
+
+    upward = .FALSE.
+    IF ( horizontal )  THEN
+       surf              => surf_usm_h(l)
+       t_surf_wall       => t_surf_wall_h(l)
+       t_surf_wall_p     => t_surf_wall_h_p(l)
+       t_surf_window     => t_surf_window_h(l)
+       t_surf_window_p   => t_surf_window_h_p(l)
+       t_surf_green      => t_surf_green_h(l)
+       t_surf_green_p    => t_surf_green_h_p(l)
+       t_wall            => t_wall_h(l)
+       t_window          => t_window_h(l)
+       t_green           => t_green_h(l)
+       IF ( l == 0 ) upward = .TRUE.
+    ELSE
+       surf              => surf_usm_v(l)
+       t_surf_wall       => t_surf_wall_v(l)
+       t_surf_wall_p     => t_surf_wall_v_p(l)
+       t_surf_window     => t_surf_window_v(l)
+       t_surf_window_p   => t_surf_window_v_p(l)
+       t_surf_green      => t_surf_green_v(l)
+       t_surf_green_p    => t_surf_green_v_p(l)
+       t_wall            => t_wall_v(l)
+       t_window          => t_window_v(l)
+       t_green           => t_green_v(l)
+    ENDIF
 !
 !-- Index offset of surface element point with respect to adjoining atmospheric grid point
-    k_off = surf_usm_h%koff
-    j_off = surf_usm_h%joff
-    i_off = surf_usm_h%ioff
+    k_off = surf%koff
+    j_off = surf%joff
+    i_off = surf%ioff
 
 !
@@ -7577,36 +6749,28 @@
     !$OMP&                  stend_window, stend_green, tend, m_liq_max)
     !$OMP DO SCHEDULE (STATIC)
-    DO  m = 1, surf_usm_h%ns
+    DO  m = 1, surf%ns
 !
 !--    During spinup set green and window fraction to zero and restore at the end of the loop.
 !--    Note, this is a temporary fix and needs to be removed later.
        IF ( during_spinup )  THEN
-          frac_win                         = surf_usm_h%frac(m,ind_wat_win)
-          frac_wall                        = surf_usm_h%frac(m,ind_veg_wall)
-          frac_green                       = surf_usm_h%frac(m,ind_pav_green)
-          surf_usm_h%frac(m,ind_wat_win)   = 0.0_wp
-          surf_usm_h%frac(m,ind_veg_wall)  = 1.0_wp
-          surf_usm_h%frac(m,ind_pav_green) = 0.0_wp
+          frac_win                         = surf%frac(m,ind_wat_win)
+          frac_wall                        = surf%frac(m,ind_veg_wall)
+          frac_green                       = surf%frac(m,ind_pav_green)
+          surf%frac(m,ind_wat_win)   = 0.0_wp
+          surf%frac(m,ind_veg_wall)  = 1.0_wp
+          surf%frac(m,ind_pav_green) = 0.0_wp
        ENDIF
 !
 !--    Get indices of respective grid point
-       i = surf_usm_h%i(m)
-       j = surf_usm_h%j(m)
-       k = surf_usm_h%k(m)
+       i = surf%i(m)
+       j = surf%j(m)
+       k = surf%k(m)
 !
 !--    TODO - how to calculate lambda_surface for horizontal surfaces
-!--    (lambda_surface is set according to stratification in land surface model)
-!--    MS: ???
-       IF ( surf_usm_h%ol(m) >= 0.0_wp )  THEN
-          lambda_surface        = surf_usm_h%lambda_surf(m)
-          lambda_surface_window = surf_usm_h%lambda_surf_window(m)
-          lambda_surface_green  = surf_usm_h%lambda_surf_green(m)
-       ELSE
-          lambda_surface        = surf_usm_h%lambda_surf(m)
-          lambda_surface_window = surf_usm_h%lambda_surf_window(m)
-          lambda_surface_green  = surf_usm_h%lambda_surf_green(m)
-       ENDIF
-
-!        pt1  = pt(k,j,i)
+!--    (lambda_surface shoud be set according to stratification in land surface model)
+       lambda_surface        = surf%lambda_surf(m)
+       lambda_surface_window = surf%lambda_surf_window(m)
+       lambda_surface_green  = surf%lambda_surf_green(m)
+
        IF ( humidity )  THEN
           qv1 = q(k,j,i)
@@ -7616,7 +6780,7 @@
 !
 !--    Calculate rho * c_p coefficient at surface layer
-       rho_cp  = c_p * hyp(k) / ( r_d * surf_usm_h%pt1(m) * exner(k) )
-
-       IF ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp )  THEN
+       rho_cp  = c_p * hyp(k) / ( r_d * surf%pt1(m) * exner(k) )
+
+       IF ( surf%frac(m,ind_pav_green) > 0.0_wp )  THEN
 !
 !--       Calculate frequently used parameters
@@ -7627,93 +6791,108 @@
 !
 !--    Calculate aerodyamic resistance.
-!--    Calculation for horizontal surfaces follows LSM formulation pt, us, ts are not available for
-!--    the prognostic time step, data from the last time step is used here.
-!
-!--    Workaround: use single r_a as stability is only treated for the average temperature
-       surf_usm_h%r_a(m)        = ( surf_usm_h%pt1(m) - surf_usm_h%pt_surface(m) ) /               &
-                                  ( surf_usm_h%ts(m) * surf_usm_h%us(m) + 1.0E-20_wp )
-       surf_usm_h%r_a_window(m) = surf_usm_h%r_a(m)
-       surf_usm_h%r_a_green(m)  = surf_usm_h%r_a(m)
-
-!        r_a        = ( surf_usm_h%pt1(m) - t_surf_h(m) / exner(k) ) /                              &
-!                     ( surf_usm_h%ts(m) * surf_usm_h%us(m) + 1.0E-20_wp )
-!        r_a_window = ( surf_usm_h%pt1(m) - t_surf_window_h(m) / exner(k) ) /                       &
-!                     ( surf_usm_h%ts(m) * surf_usm_h%us(m) + 1.0E-20_wp )
-!        r_a_green  = ( surf_usm_h%pt1(m) - t_surf_green_h(m) / exner(k) ) /                        &
-!                     ( surf_usm_h%ts(m) * surf_usm_h%us(m) + 1.0E-20_wp )
+       IF ( upward ) THEN
+!--       Calculation for horizontal upward facing surfaces follows LSM formulation
+!--       pt, us, ts are not available for the prognostic time step, data from the
+!--       last time step is used here.
+!--       Workaround: use single r_a as stability is only treated for the average temperature
+          surf%r_a(m)        = ( surf%pt1(m) - surf%pt_surface(m) ) /               &
+                                     ( surf%ts(m) * surf%us(m) + 1.0E-20_wp )
+       ELSE
+!--           Calculation of r_a for vertical and downward facing horizontal surfaces
+!--
+!--           Heat transfer coefficient for forced convection along vertical walls follows formulation
+!--           in TUF3d model (Krayenhoff & Voogt, 2006)
+!--
+!--           H = httc (Tsfc - Tair)
+!--           httc = rw * (11.8 + 4.2 * Ueff) - 4.0
+!--
+!--                rw: Wall patch roughness relative to 1.0 for concrete
+!--                Ueff: Effective wind speed
+!--                - 4.0 is a reduction of Rowley et al (1930) formulation based on
+!--                Cole and Sturrock (1977)
+!--
+!--                Ucan: Canyon wind speed
+!--                wstar: Convective velocity
+!--                Qs: Surface heat flux
+!--                zH: Height of the convective layer
+!--                wstar = (g/Tcan*Qs*zH)**(1./3.)
+!--           Effective velocity components must always be defined at scalar grid point. The wall
+!--           normal component is obtained by simple linear interpolation. (An alternative would be an
+!--           logarithmic interpolation.) Parameter roughness_concrete (default value = 0.001) is used
+!--           to calculation of roughness relative to concrete. Note, wind velocity is limited
+!--           to avoid division by zero. The nominator can become <= 0.0 for values z0 < 3*10E-4.
+              ueff        = MAX ( SQRT( ( ( u(k,j,i) + u(k,j,i+1) ) * 0.5_wp )**2 +                  &
+                                        ( ( v(k,j,i) + v(k,j+1,i) ) * 0.5_wp )**2 +                  &
+                                        ( ( w(k,j,i) + w(k-1,j,i) ) * 0.5_wp )**2 ),                 &
+                                  ( ( 4.0_wp + 0.1_wp )                                              &
+                                    / ( surf%z0(m) * d_roughness_concrete )                 &
+                                   - 11.8_wp ) / 4.2_wp                                              &
+                                 )
+
+              surf%r_a(m) = rho_cp / ( surf%z0(m) * d_roughness_concrete            &
+                                     * ( 11.8_wp + 4.2_wp * ueff )  - 4.0_wp  )
+       ENDIF
 
 !--    Make sure that the resistance does not drop to zero
-       IF ( surf_usm_h%r_a(m)        < 1.0_wp )  surf_usm_h%r_a(m)        = 1.0_wp
-       IF ( surf_usm_h%r_a_green(m)  < 1.0_wp )  surf_usm_h%r_a_green(m)  = 1.0_wp
-       IF ( surf_usm_h%r_a_window(m) < 1.0_wp )  surf_usm_h%r_a_window(m) = 1.0_wp
-
-!
-!--    Make sure that the resistacne does not exceed a maxmium value in case of zero velocities
-       IF ( surf_usm_h%r_a(m)        > 300.0_wp )  surf_usm_h%r_a(m)        = 300.0_wp
-       IF ( surf_usm_h%r_a_green(m)  > 300.0_wp )  surf_usm_h%r_a_green(m)  = 300.0_wp
-       IF ( surf_usm_h%r_a_window(m) > 300.0_wp )  surf_usm_h%r_a_window(m) = 300.0_wp
-
+!--    end does not exceed a maxmium value in case of zero velocities
+       IF ( surf%r_a(m)        < 1.0_wp )  surf%r_a(m)        = 1.0_wp
+       IF ( surf%r_a(m)        > 300.0_wp )  surf%r_a(m)        = 300.0_wp
+!
+!--    Aeorodynamical resistance for the window and green fractions are set to the same value
+       surf%r_a_window(m) = surf%r_a(m)
+       surf%r_a_green(m)  = surf%r_a(m)
 !
 !--    Factor for shf_eb
-       f_shf         = rho_cp / surf_usm_h%r_a(m)
-       f_shf_window  = rho_cp / surf_usm_h%r_a_window(m)
-       f_shf_green   = rho_cp / surf_usm_h%r_a_green(m)
-
-
-       IF ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp )  THEN
+       f_shf         = rho_cp / surf%r_a(m)
+       f_shf_window  = rho_cp / surf%r_a_window(m)
+       f_shf_green   = rho_cp / surf%r_a_green(m)
+
+       IF ( surf%frac(m,ind_pav_green) > 0.0_wp )  THEN
+!
 !--       Adapted from LSM:
-!--       Second step: calculate canopy resistance r_canopy f1-f3 here are defined as 1/f1-f3 as in
-!--       ECMWF documentation
+!--       Second step: calculate canopy resistance r_canopy. f1-f3 here are defined as 1/f1-f3
+!--       as in ECMWF documentation
 
 !--       f1: Correction for incoming shortwave radiation (stomata close at night)
-          f1 = MIN( 1.0_wp, ( 0.004_wp * surf_usm_h%rad_sw_in(m) + 0.05_wp ) /                     &
-                    (0.81_wp * ( 0.004_wp * surf_usm_h%rad_sw_in(m) + 1.0_wp ) ) )
+          f1 = MIN( 1.0_wp, ( 0.004_wp * surf%rad_sw_in(m) + 0.05_wp ) /                     &
+                    (0.81_wp * ( 0.004_wp * surf%rad_sw_in(m) + 1.0_wp ) ) )
 !
 !--       f2: Correction for soil moisture availability to plants (the integrated soil moisture must
 !--       thus be considered here) f2 = 0 for very dry soils
-          m_total = 0.0_wp
-          DO  k = nzb_wall, nzt_wall+1
-              m_total = m_total + rootfr_h(nzb_wall,m) * MAX( swc_h(nzb_wall,m),wilt_h(nzb_wall,m) )
-          ENDDO
-
-          IF ( m_total > wilt_h(nzb_wall,m)  .AND.  m_total < fc_h(nzb_wall,m) )  THEN
-             f2 = ( m_total - wilt_h(nzb_wall,m) ) / (fc_h(nzb_wall,m) - wilt_h(nzb_wall,m) )
-          ELSEIF ( m_total >= fc_h(nzb_wall,m) )  THEN
-             f2 = 1.0_wp
+          IF ( upward ) THEN
+             m_total = 0.0_wp
+             DO  k = nzb_wall, nzt_wall+1
+                 m_total = m_total + rootfr_h(l)%val(nzb_wall,m) &
+                                     * MAX( swc_h(l)%val(nzb_wall,m),wilt_h(l)%val(nzb_wall,m) )
+             ENDDO
+
+             IF ( m_total > wilt_h(l)%val(nzb_wall,m)  .AND.  m_total < fc_h(l)%val(nzb_wall,m) )  THEN
+                f2 = ( m_total - wilt_h(l)%val(nzb_wall,m) ) / (fc_h(l)%val(nzb_wall,m) - wilt_h(l)%val(nzb_wall,m) )
+             ELSEIF ( m_total >= fc_h(l)%val(nzb_wall,m) )  THEN
+                f2 = 1.0_wp
+             ELSE
+                f2 = 1.0E-20_wp
+             ENDIF
           ELSE
-             f2 = 1.0E-20_wp
-          ENDIF
-
+             f2=1.0_wp
+          ENDIF
 !
 !--       Calculate water vapour pressure at saturation
-          e_s = 0.01_wp * 610.78_wp * EXP( 17.269_wp * ( t_surf_green_h(m) - 273.16_wp )           &
-                                           / ( t_surf_green_h(m) - 35.86_wp ) )
+          e_s = 0.01_wp * magnus_tl( t_surf_green%val(m) )
 !
 !--       f3: Correction for vapour pressure deficit
-          IF ( surf_usm_h%g_d(m) /= 0.0_wp )  THEN
-!
-!--       Calculate vapour pressure
+          IF ( surf%g_d(m) /= 0.0_wp )  THEN
+!--          Calculate vapour pressure
              e  = qv1 * surface_pressure / ( qv1 + 0.622_wp )
-             f3 = EXP ( - surf_usm_h%g_d(m) * (e_s - e) )
+             f3 = EXP ( - surf%g_d(m) * (e_s - e) )
           ELSE
              f3 = 1.0_wp
           ENDIF
-
 !
 !--       Calculate canopy resistance. In case that c_veg is 0 (bare soils), this calculation is
 !--       obsolete, as r_canopy is not used below.
 !--       To do: check for very dry soil -> r_canopy goes to infinity
-          surf_usm_h%r_canopy(m) = surf_usm_h%r_canopy_min(m) /                                    &
-                                  ( surf_usm_h%lai(m) * f1 * f2 * f3 + 1.0E-20_wp )
-
-!
-!--       Calculate the maximum possible liquid water amount on plants and bare surface. For
-!--       vegetated surfaces, a maximum depth of 0.2 mm is assumed, while paved surfaces might hold
-!--       up 1 mm of water. The liquid water fraction for paved surfaces is calculated after
-!--       Noilhan & Planton (1989), while the ECMWF formulation is used for vegetated surfaces and
-!--       bare soils.
-          m_liq_max = m_max_depth * ( surf_usm_h%lai(m) )
-
-          surf_usm_h%c_liq(m) = MIN( 1.0_wp, ( m_liq_usm_h%var_usm_1d(m) / m_liq_max )**0.67 )
+          surf%r_canopy(m) = surf%r_canopy_min(m) /                                    &
+                                  ( surf%lai(m) * f1 * f2 * f3 + 1.0E-20_wp )
 !
 !--       Calculate saturation specific humidity
@@ -7723,121 +6902,136 @@
 !--       All super-saturated water is then removed from the air
           IF ( humidity  .AND.  q_s <= qv1 )  THEN
-             surf_usm_h%r_canopy(m) = 0.0_wp
-          ENDIF
-
-!
-!--       Calculate coefficients for the total evapotranspiration
-!--       In case of water surface, set vegetation and soil fluxes to zero.
-!--       For pavements, only evaporation of liquid water is possible.
-          f_qsws_veg  = rho_lv * ( 1.0_wp - surf_usm_h%c_liq(m) ) /                                &
-                        ( surf_usm_h%r_a_green(m) + surf_usm_h%r_canopy(m) )
-          f_qsws_liq  = rho_lv * surf_usm_h%c_liq(m) / surf_usm_h%r_a_green(m)
-
-          f_qsws = f_qsws_veg + f_qsws_liq
+             surf%r_canopy(m) = 0.0_wp
+          ENDIF
+
+          IF ( upward ) THEN
+!--          Calculate the maximum possible liquid water amount on plants and bare surface. For
+!--          vegetated surfaces, a maximum depth of 0.2 mm is assumed, while paved surfaces might hold
+!--          up 1 mm of water. The liquid water fraction for paved surfaces is calculated after
+!--          Noilhan & Planton (1989), while the ECMWF formulation is used for vegetated surfaces and
+!--          bare soils.
+             m_liq_max = m_max_depth * ( surf%lai(m) )
+             surf%c_liq(m) = MIN( 1.0_wp, ( m_liq_usm_h(l)%val(m) / m_liq_max )**0.67 )
+
+!
+!--          Calculate coefficients for the total evapotranspiration
+!--          In case of water surface, set vegetation and soil fluxes to zero.
+!--          For pavements, only evaporation of liquid water is possible.
+             f_qsws_veg  = rho_lv * ( 1.0_wp - surf%c_liq(m) ) /                                  &
+                           ( surf%r_a_green(m) + surf%r_canopy(m) )
+             f_qsws_liq  = rho_lv * surf%c_liq(m) / surf%r_a_green(m)
+             f_qsws = f_qsws_veg + f_qsws_liq
+          ELSE
+             f_qsws_veg  = rho_lv * ( 1.0_wp - 0.0_wp ) / & !surf%c_liq(m) ) /                    &
+                                ( surf%r_a_green(m) + surf%r_canopy(m) )
+             f_qsws_liq  = 0._wp ! rho_lv * surf%c_liq(m) / surf%r_a_green(m)
+             f_qsws = f_qsws_veg + f_qsws_liq
+          ENDIF
 !
 !--       Calculate derivative of q_s for Taylor series expansion
-          e_s_dt = e_s * ( 17.269_wp / ( t_surf_green_h(m) - 35.86_wp ) - 17.269_wp                &
-                   * ( t_surf_green_h(m) - 273.16_wp ) / ( t_surf_green_h(m) - 35.86_wp )**2 )
-
+          e_s_dt = e_s * ( 17.269_wp / ( t_surf_green%val(m) - 35.86_wp ) - 17.269_wp             &
+                   * ( t_surf_green%val(m) - degc_to_k )                                          &
+                   / ( t_surf_green%val(m) - 35.86_wp )**2 )
           dq_s_dt = 0.622_wp * e_s_dt / ( surface_pressure - e_s_dt )
        ENDIF
 !
 !--    Add LW up so that it can be removed in prognostic equation
-       surf_usm_h%rad_net_l(m) = surf_usm_h%rad_sw_in(m)  - surf_usm_h%rad_sw_out(m) +             &
-                                 surf_usm_h%rad_lw_in(m)  - surf_usm_h%rad_lw_out(m)
+       surf%rad_net_l(m) = surf%rad_sw_in(m)  - surf%rad_sw_out(m) +                              &
+                           surf%rad_lw_in(m)  - surf%rad_lw_out(m)
 !
 !--    Numerator of the prognostic equation
 !--    Todo: Adjust to tile approach. So far, emissivity for wall (element 0) is used
-       coef_1 = surf_usm_h%rad_net_l(m) + ( 3.0_wp + 1.0_wp )                                      &
-               * surf_usm_h%emissivity(m,ind_veg_wall) * sigma_sb * t_surf_wall_h(m)**4            &
-               + f_shf * surf_usm_h%pt1(m) + lambda_surface * t_wall_h(nzb_wall,m)
-
-       IF ( ( .NOT. during_spinup ) .AND. (surf_usm_h%frac(m,ind_wat_win) > 0.0_wp ) )  THEN
-          coef_window_1 = surf_usm_h%rad_net_l(m) +  ( 3.0_wp + 1.0_wp )                           &
-                          * surf_usm_h%emissivity(m,ind_wat_win) * sigma_sb                        &
-                          * t_surf_window_h(m)**4 + f_shf_window * surf_usm_h%pt1(m)               &
-                          + lambda_surface_window * t_window_h(nzb_wall,m)
+!--    Rem: Coef +1 corresponds to -lwout included in calculation of radnet_l
+       coef_1 = surf%rad_net_l(m) + ( 3.0_wp + 1.0_wp )                                           &
+               * surf%emissivity(m,ind_veg_wall) * sigma_sb * t_surf_wall%val(m)**4               &
+               + f_shf * surf%pt1(m) + lambda_surface * t_wall%val(nzb_wall,m)
+
+       IF ( ( .NOT. during_spinup ) .AND. (surf%frac(m,ind_wat_win) > 0.0_wp ) )  THEN
+          coef_window_1 = surf%rad_net_l(m) +  ( 3.0_wp + 1.0_wp )                                &
+                          * surf%emissivity(m,ind_wat_win) * sigma_sb                             &
+                          * t_surf_window%val(m)**4 + f_shf_window * surf%pt1(m)                  &
+                          + lambda_surface_window * t_window%val(nzb_wall,m)
        ENDIF
-       IF ( ( humidity ) .AND. ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
-                coef_green_1 = surf_usm_h%rad_net_l(m) + ( 3.0_wp + 1.0_wp )                       &
-                               * surf_usm_h%emissivity(m,ind_pav_green) * sigma_sb                 &
-                               * t_surf_green_h(m)**4 + f_shf_green * surf_usm_h%pt1(m)            &
-                               + f_qsws * ( qv1 - q_s + dq_s_dt * t_surf_green_h(m) )              &
-                               + lambda_surface_green * t_green_h(nzb_wall,m)
+       IF ( ( humidity ) .AND. ( surf%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
+          coef_green_1 = surf%rad_net_l(m) + ( 3.0_wp + 1.0_wp )                                  &
+                         * surf%emissivity(m,ind_pav_green) * sigma_sb                            &
+                         * t_surf_green%val(m)**4 + f_shf_green * surf%pt1(m)                     &
+                         + f_qsws * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m) )                 &
+                         + lambda_surface_green * t_green%val(nzb_wall,m)
        ELSE
-       coef_green_1 = surf_usm_h%rad_net_l(m) + ( 3.0_wp + 1.0_wp )                                &
-                      * surf_usm_h%emissivity(m,ind_pav_green) * sigma_sb * t_surf_green_h(m)**4   &
-                      + f_shf_green * surf_usm_h%pt1(m) + lambda_surface_green                     &
-                      * t_green_h(nzb_wall,m)
+          coef_green_1 = surf%rad_net_l(m) + ( 3.0_wp + 1.0_wp )                                  &
+                         * surf%emissivity(m,ind_pav_green) * sigma_sb * t_surf_green%val(m)**4   &
+                         + f_shf_green * surf%pt1(m) + lambda_surface_green                       &
+                         * t_green%val(nzb_wall,m)
        ENDIF
 !
 !--    Denominator of the prognostic equation
-       coef_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_veg_wall) * sigma_sb * t_surf_wall_h(m)**3    &
+       coef_2 = 4.0_wp * surf%emissivity(m,ind_veg_wall) * sigma_sb * t_surf_wall%val(m)**3       &
                 + lambda_surface + f_shf / exner(k)
-       IF ( ( .NOT. during_spinup ) .AND. ( surf_usm_h%frac(m,ind_wat_win) > 0.0_wp ) )  THEN
-          coef_window_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_wat_win) * sigma_sb *               &
-                          t_surf_window_h(m)**3 + lambda_surface_window + f_shf_window / exner(k)
+       IF ( ( .NOT. during_spinup ) .AND. ( surf%frac(m,ind_wat_win) > 0.0_wp ) )  THEN
+          coef_window_2 = 4.0_wp * surf%emissivity(m,ind_wat_win) * sigma_sb *                    &
+                          t_surf_window%val(m)**3 + lambda_surface_window + f_shf_window / exner(k)
        ENDIF
-       IF ( ( humidity ) .AND. ( surf_usm_h%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
-          coef_green_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_pav_green) * sigma_sb *              &
-                         t_surf_green_h(m)**3 + f_qsws * dq_s_dt + lambda_surface_green            &
+       IF ( ( humidity ) .AND. ( surf%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
+          coef_green_2 = 4.0_wp * surf%emissivity(m,ind_pav_green) * sigma_sb *                   &
+                         t_surf_green%val(m)**3 + f_qsws * dq_s_dt + lambda_surface_green         &
                          + f_shf_green / exner(k)
        ELSE
-       coef_green_2 = 4.0_wp * surf_usm_h%emissivity(m,ind_pav_green) * sigma_sb                   &
-                      * t_surf_green_h(m)**3 + lambda_surface_green + f_shf_green / exner(k)
+          coef_green_2 = 4.0_wp * surf%emissivity(m,ind_pav_green) * sigma_sb                     &
+                         * t_surf_green%val(m)**3 + lambda_surface_green + f_shf_green / exner(k)
        ENDIF
 !
 !--    Implicit solution when the surface layer has no heat capacity, otherwise use RK3 scheme.
-       t_surf_wall_h_p(m) = ( coef_1 * dt_3d * tsc(2) + surf_usm_h%c_surface(m)                    &
-                              * t_surf_wall_h(m) )                                                 &
-                            / ( surf_usm_h%c_surface(m) + coef_2 * dt_3d * tsc(2) )
-       IF ( ( .NOT. during_spinup ) .AND. (surf_usm_h%frac(m,ind_wat_win) > 0.0_wp) )  THEN
-          t_surf_window_h_p(m) = ( coef_window_1 * dt_3d * tsc(2) + surf_usm_h%c_surface_window(m) &
-                                   * t_surf_window_h(m) ) /                                        &
-                                 ( surf_usm_h%c_surface_window(m) + coef_window_2 * dt_3d * tsc(2) )
+       t_surf_wall_p%val(m) = ( coef_1 * dt_3d * tsc(2) + surf%c_surface(m)                       &
+                            * t_surf_wall%val(m) )                                                &
+                            / ( surf%c_surface(m) + coef_2 * dt_3d * tsc(2) )
+       IF ( ( .NOT. during_spinup ) .AND. (surf%frac(m,ind_wat_win) > 0.0_wp) )  THEN
+          t_surf_window_p%val(m) = ( coef_window_1 * dt_3d * tsc(2) +                             &
+                                   surf%c_surface_window(m) * t_surf_window%val(m) ) /            &
+                                ( surf%c_surface_window(m) + coef_window_2 * dt_3d * tsc(2) )
        ENDIF
-       t_surf_green_h_p(m) = ( coef_green_1 * dt_3d * tsc(2) + surf_usm_h%c_surface_green(m)       &
-                               * t_surf_green_h(m) )                                               &
-                             /  ( surf_usm_h%c_surface_green(m) + coef_green_2 * dt_3d * tsc(2) )
+       t_surf_green_p%val(m) = ( coef_green_1 * dt_3d * tsc(2) +                                  &
+                               surf%c_surface_green(m) * t_surf_green%val(m) )                    &
+                             / ( surf%c_surface_green(m) + coef_green_2 * dt_3d * tsc(2) )
 !
 !--    Add RK3 term
-       t_surf_wall_h_p(m) = t_surf_wall_h_p(m) + dt_3d * tsc(3) *  surf_usm_h%tt_surface_wall_m(m)
-
-       t_surf_window_h_p(m) = t_surf_window_h_p(m) + dt_3d * tsc(3) *                              &
-                              surf_usm_h%tt_surface_window_m(m)
-
-       t_surf_green_h_p(m) = t_surf_green_h_p(m) + dt_3d * tsc(3) * surf_usm_h%tt_surface_green_m(m)
+       t_surf_wall_p%val(m) = t_surf_wall_p%val(m) + dt_3d * tsc(3) *                             &
+                            surf%tt_surface_wall_m(m)
+       t_surf_window_p%val(m) = t_surf_window_p%val(m) + dt_3d * tsc(3) *                         &
+                              surf%tt_surface_window_m(m)
+       t_surf_green_p%val(m) = t_surf_green_p%val(m) + dt_3d * tsc(3) *                           &
+                             surf%tt_surface_green_m(m)
 !
 !--    Store surface temperature on pt_surface. Further, in case humidity is used, store also
 !--    vpt_surface, which is, due to the lack of moisture on roofs, simply assumed to be the surface
 !--    temperature.
-       surf_usm_h%pt_surface(m) = ( surf_usm_h%frac(m,ind_veg_wall) * t_surf_wall_h_p(m)           &
-                                    + surf_usm_h%frac(m,ind_wat_win) * t_surf_window_h_p(m)        &
-                                    + surf_usm_h%frac(m,ind_pav_green) * t_surf_green_h_p(m)       &
-                                  ) / exner(k)
-
-       IF ( humidity )  surf_usm_h%vpt_surface(m) = surf_usm_h%pt_surface(m)
+       surf%pt_surface(m) = ( surf%frac(m,ind_veg_wall) * t_surf_wall_p%val(m)                    &
+                                 + surf%frac(m,ind_wat_win) * t_surf_window_p%val(m)              &
+                                 + surf%frac(m,ind_pav_green) * t_surf_green_p%val(m)             &
+                             ) / exner(k)
+
+       IF ( humidity )  surf%vpt_surface(m) = surf%pt_surface(m)
 !
 !--    Calculate true tendency
-       stend_wall = ( t_surf_wall_h_p(m) - t_surf_wall_h(m) - dt_3d * tsc(3) *                     &
-                      surf_usm_h%tt_surface_wall_m(m) ) / ( dt_3d  * tsc(2) )
-       stend_window = ( t_surf_window_h_p(m) - t_surf_window_h(m) - dt_3d * tsc(3) *               &
-                        surf_usm_h%tt_surface_window_m(m) ) / ( dt_3d  * tsc(2) )
-       stend_green = ( t_surf_green_h_p(m) - t_surf_green_h(m) - dt_3d * tsc(3) *                  &
-                       surf_usm_h%tt_surface_green_m(m) ) / ( dt_3d  * tsc(2) )
+       stend_wall = ( t_surf_wall_p%val(m) - t_surf_wall%val(m) - dt_3d * tsc(3) *                &
+                      surf%tt_surface_wall_m(m) ) / ( dt_3d  * tsc(2) )
+       stend_window = ( t_surf_window_p%val(m) - t_surf_window%val(m) - dt_3d * tsc(3) *          &
+                        surf%tt_surface_window_m(m) ) / ( dt_3d  * tsc(2) )
+       stend_green = ( t_surf_green_p%val(m) - t_surf_green%val(m) - dt_3d * tsc(3) *             &
+                       surf%tt_surface_green_m(m) ) / ( dt_3d  * tsc(2) )
 !
 !--    Calculate t_surf tendencies for the next Runge-Kutta step
        IF ( timestep_scheme(1:5) == 'runge' )  THEN
           IF ( intermediate_timestep_count == 1 )  THEN
-             surf_usm_h%tt_surface_wall_m(m)   = stend_wall
-             surf_usm_h%tt_surface_window_m(m) = stend_window
-             surf_usm_h%tt_surface_green_m(m)  = stend_green
+             surf%tt_surface_wall_m(m)   = stend_wall
+             surf%tt_surface_window_m(m) = stend_window
+             surf%tt_surface_green_m(m)  = stend_green
           ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
-             surf_usm_h%tt_surface_wall_m(m) = -9.5625_wp * stend_wall +                           &
-                                               5.3125_wp * surf_usm_h%tt_surface_wall_m(m)
-             surf_usm_h%tt_surface_window_m(m) = -9.5625_wp * stend_window +                       &
-                                                 5.3125_wp * surf_usm_h%tt_surface_window_m(m)
-             surf_usm_h%tt_surface_green_m(m) = -9.5625_wp * stend_green +                         &
-                                                5.3125_wp * surf_usm_h%tt_surface_green_m(m)
+             surf%tt_surface_wall_m(m) = -9.5625_wp * stend_wall +                                &
+                                               5.3125_wp * surf%tt_surface_wall_m(m)
+             surf%tt_surface_window_m(m) = -9.5625_wp * stend_window +                            &
+                                                 5.3125_wp * surf%tt_surface_window_m(m)
+             surf%tt_surface_green_m(m) = -9.5625_wp * stend_green +                              &
+                                                5.3125_wp * surf%tt_surface_green_m(m)
           ENDIF
        ENDIF
@@ -7845,143 +7039,135 @@
 !--    In case of fast changes in the skin temperature, it is required to update the radiative
 !--    fluxes in order to keep the solution stable
-       IF ( ( ( ABS( t_surf_wall_h_p(m)   - t_surf_wall_h(m) )   > 1.0_wp )   .OR.                 &
-            (   ABS( t_surf_green_h_p(m)  - t_surf_green_h(m) )  > 1.0_wp )   .OR.                 &
-            (   ABS( t_surf_window_h_p(m) - t_surf_window_h(m) ) > 1.0_wp ) )                      &
+       IF ( ( ( ABS( t_surf_wall_p%val(m)   - t_surf_wall%val(m) )   > 1.0_wp )   .OR.            &
+            (   ABS( t_surf_green_p%val(m)  - t_surf_green%val(m) )  > 1.0_wp )   .OR.            &
+            (   ABS( t_surf_window_p%val(m) - t_surf_window%val(m) ) > 1.0_wp ) )                 &
                .AND.  unscheduled_radiation_calls  )  THEN
           force_radiation_call_l = .TRUE.
        ENDIF
 !
-!--    Calculate fluxes
+!--    Calculate new fluxes
 !--    Rad_net_l is never used!
-       surf_usm_h%rad_net_l(m) = surf_usm_h%rad_net_l(m) + surf_usm_h%frac(m,ind_veg_wall)         &
-                                 * sigma_sb * surf_usm_h%emissivity(m,ind_veg_wall)                &
-                                 * ( t_surf_wall_h_p(m)**4 - t_surf_wall_h(m)**4 )                 &
-                                 + surf_usm_h%frac(m,ind_wat_win) * sigma_sb                       &
-                                 * surf_usm_h%emissivity(m,ind_wat_win)                            &
-                                 * ( t_surf_window_h_p(m)**4 - t_surf_window_h(m)**4 )             &
-                                 + surf_usm_h%frac(m,ind_pav_green) * sigma_sb                     &
-                                 * surf_usm_h%emissivity(m,ind_pav_green)                          &
-                                 * ( t_surf_green_h_p(m)**4 - t_surf_green_h(m)**4 )
-
-       surf_usm_h%wghf_eb(m)   = lambda_surface * ( t_surf_wall_h_p(m) - t_wall_h(nzb_wall,m) )
-       surf_usm_h%wghf_eb_green(m)  = lambda_surface_green                                         &
-                                      * ( t_surf_green_h_p(m) - t_green_h(nzb_wall,m) )
-       surf_usm_h%wghf_eb_window(m) = lambda_surface_window                                        &
-                                      * ( t_surf_window_h_p(m) - t_window_h(nzb_wall,m) )
+       surf%rad_net_l(m) = surf%rad_net_l(m) + surf%frac(m,ind_veg_wall)                          &
+                                 * sigma_sb * surf%emissivity(m,ind_veg_wall)                     &
+                                 * ( t_surf_wall_p%val(m)**4 - t_surf_wall%val(m)**4 )            &
+                                 + surf%frac(m,ind_wat_win) * sigma_sb                            &
+                                 * surf%emissivity(m,ind_wat_win)                                 &
+                                 * ( t_surf_window_p%val(m)**4 - t_surf_window%val(m)**4 )        &
+                                 + surf%frac(m,ind_pav_green) * sigma_sb                          &
+                                 * surf%emissivity(m,ind_pav_green)                               &
+                                 * ( t_surf_green_p%val(m)**4 - t_surf_green%val(m)**4 )
+
+       surf%wghf_eb(m)   = lambda_surface * ( t_surf_wall_p%val(m) - t_wall%val(nzb_wall,m) )
+       surf%wghf_eb_green(m)  = lambda_surface_green                                              &
+                                      * ( t_surf_green_p%val(m) - t_green%val(nzb_wall,m) )
+       surf%wghf_eb_window(m) = lambda_surface_window                                             &
+                                      * ( t_surf_window_p%val(m) - t_window%val(nzb_wall,m) )
 
 !
 !--    Ground/wall/roof surface heat flux
-       surf_usm_h%wshf_eb(m)   = - f_shf  * ( surf_usm_h%pt1(m) - t_surf_wall_h_p(m) / exner(k) )  &
-                                 * surf_usm_h%frac(m,ind_veg_wall) - f_shf_window                  &
-                                 * ( surf_usm_h%pt1(m) - t_surf_window_h_p(m) / exner(k) )         &
-                                 * surf_usm_h%frac(m,ind_wat_win) - f_shf_green                    &
-                                 * ( surf_usm_h%pt1(m) - t_surf_green_h_p(m) / exner(k) )          &
-                                 * surf_usm_h%frac(m,ind_pav_green)
+       surf%wshf_eb(m)   = - f_shf  * ( surf%pt1(m) - t_surf_wall_p%val(m) / exner(k) )           &
+                                 * surf%frac(m,ind_veg_wall) - f_shf_window                       &
+                                 * ( surf%pt1(m) - t_surf_window_p%val(m) / exner(k) )            &
+                                 * surf%frac(m,ind_wat_win) - f_shf_green                         &
+                                 * ( surf%pt1(m) - t_surf_green_p%val(m) / exner(k) )             &
+                                 * surf%frac(m,ind_pav_green)
 !
 !--    Store kinematic surface heat fluxes for utilization in other processes diffusion_s,
 !--    surface_layer_fluxes,...
-       surf_usm_h%shf(m) = surf_usm_h%wshf_eb(m) / c_p
+       surf%shf(m) = surf%wshf_eb(m) / c_p
 !
 !--    If the indoor model is applied, further add waste heat from buildings to the kinematic flux.
        IF ( indoor_model )  THEN
-          surf_usm_h%shf(m) = surf_usm_h%shf(m) + surf_usm_h%waste_heat(m) / c_p
+          surf%shf(m) = surf%shf(m) + surf%waste_heat(m) / c_p
        ENDIF
 
-
-       IF (surf_usm_h%frac(m,ind_pav_green) > 0.0_wp)  THEN
-
-
-          IF ( humidity )  THEN
-             surf_usm_h%qsws(m)  = - f_qsws * ( qv1 - q_s + dq_s_dt * t_surf_green_h(m) - dq_s_dt  &
-                                                * t_surf_green_h_p(m) )
-
-             surf_usm_h%qsws_veg(m)  = - f_qsws_veg  * ( qv1 - q_s + dq_s_dt * t_surf_green_h(m)   &
-                                                         - dq_s_dt * t_surf_green_h_p(m) )
-
-             surf_usm_h%qsws_liq(m)  = - f_qsws_liq  * ( qv1 - q_s + dq_s_dt * t_surf_green_h(m)   &
-                                                         - dq_s_dt * t_surf_green_h_p(m) )
-
-          ENDIF
-
-!
-!--       Calculate the true surface resistance
-          IF ( .NOT.  humidity )  THEN
-             surf_usm_h%r_s(m) = 1.0E10_wp
-          ELSE
-             surf_usm_h%r_s(m) = - rho_lv * ( qv1 - q_s + dq_s_dt * t_surf_green_h(m) - dq_s_dt    &
-                                 * t_surf_green_h_p(m) ) / (surf_usm_h%qsws(m) + 1.0E-20)          &
-                                 - surf_usm_h%r_a_green(m)
-          ENDIF
-
-!
-!--       Calculate change in liquid water reservoir due to dew fall or evaporation of liquid water
-          IF ( humidity )  THEN
-!
-!--          If precipitation is activated, add rain water to qsws_liq and qsws_soil according the
-!--          the vegetation coverage.
-!--          precipitation_rate is given in mm.
+       IF ( humidity .AND.  surf%frac(m,ind_pav_green) > 0.0_wp )  THEN!
+!--       Calculate true surface resistance
+          IF ( upward ) THEN
+             surf%qsws(m)  = - f_qsws * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m)               &
+                                                - dq_s_dt * t_surf_green_p%val(m) )
+             surf%qsws(m) = surf%qsws(m) / l_v
+             surf%qsws_veg(m)  = - f_qsws_veg  * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m)      &
+                                                         - dq_s_dt * t_surf_green_p%val(m) )
+             surf%qsws_liq(m)  = - f_qsws_liq  * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m)      &
+                                                         - dq_s_dt * t_surf_green_p%val(m) )
+             surf%r_s(m) = - rho_lv * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m)                 &
+                                 - dq_s_dt * t_surf_green_p%val(m) ) /                            &
+                                 (surf%qsws(m) + 1.0E-20) - surf%r_a_green(m)
              IF ( precipitation )  THEN
-
-!
+!--             Calculate change in liquid water reservoir due to dew fall or evaporation of liquid water
+!--             If precipitation is activated, add rain water to qsws_liq and qsws_soil according the
+!--             the vegetation coverage. Precipitation_rate is given in mm.
 !--             Add precipitation to liquid water reservoir, if possible. Otherwise, add the water
 !--             to soil. In case of pavements, the exceeding water amount is implicitely removed as
 !--             runoff as qsws_soil is then not used in the soil model
-                IF ( m_liq_usm_h%var_usm_1d(m) /= m_liq_max )  THEN
-                   surf_usm_h%qsws_liq(m) = surf_usm_h%qsws_liq(m)                                 &
-                                            + surf_usm_h%frac(m,ind_pav_green)                     &
-                                            * prr(k+k_off,j+j_off,i+i_off) * hyrho(k+k_off)        &
+                IF ( m_liq_usm_h(l)%val(m) /= m_liq_max )  THEN
+                   surf%qsws_liq(m) = surf%qsws_liq(m)                                            &
+                                            + surf%frac(m,ind_pav_green)                          &
+                                            * prr(k+k_off,j+j_off,i+i_off) * hyrho(k+k_off)       &
                                             * 0.001_wp * rho_l * l_v
-               ENDIF
-
+                ENDIF
              ENDIF
-
 !
 !--          If the air is saturated, check the reservoir water level
-             IF ( surf_usm_h%qsws(m) < 0.0_wp )  THEN
-!
-!--             Check if reservoir is full (avoid values > m_liq_max) In that case, qsws_liq goes to
-!--             qsws_soil. In this case qsws_veg is zero anyway (because c_liq = 1), so that tend is
-!--             zero and no further check is needed
-                IF ( m_liq_usm_h%var_usm_1d(m) == m_liq_max )  THEN
-!                  surf_usm_h%qsws_soil(m) = surf_usm_h%qsws_soil(m) + surf_usm_h%qsws_liq(m)
-                   surf_usm_h%qsws_liq(m)  = 0.0_wp
+             IF ( surf%qsws(m) < 0.0_wp )  THEN
+!
+!--                Check if reservoir is full (avoid values > m_liq_max) In that case, qsws_liq goes to
+!--                qsws_soil. In this case qsws_veg is zero anyway (because c_liq = 1), so that tend is
+!--                zero and no further check is needed
+                IF ( m_liq_usm_h(l)%val(m) == m_liq_max )  THEN
+                   surf%qsws_liq(m)  = 0.0_wp
                 ENDIF
-
-!
+!--                In case qsws_veg becomes negative (unphysical behavior), let the water enter the
+!--                liquid water reservoir as dew on the plant
+                IF ( surf%qsws_veg(m) < 0.0_wp )  THEN
+                   surf%qsws_liq(m) = surf%qsws_liq(m) + surf%qsws_veg(m)
+                   surf%qsws_veg(m) = 0.0_wp
+                ENDIF
+             ENDIF
+
+             tend = - surf%qsws_liq(m) * drho_l_lv
+             m_liq_usm_h_p(l)%val(m) = m_liq_usm_h(l)%val(m) + dt_3d *                            &
+                                       ( tsc(2) * tend + tsc(3) * tm_liq_usm_h_m(l)%val(m) )
+!
+!--             Check if reservoir is overfull -> reduce to maximum
+!--             (conservation of water is violated here)
+             m_liq_usm_h_p(l)%val(m) = MIN( m_liq_usm_h_p(l)%val(m), m_liq_max )
+!
+!--             Check if reservoir is empty (avoid values < 0.0) (conservation of water is violated here)
+             m_liq_usm_h_p(l)%val(m) = MAX( m_liq_usm_h_p(l)%val(m), 0.0_wp )
+!
+!--             Calculate m_liq tendencies for the next Runge-Kutta step
+             IF ( timestep_scheme(1:5) == 'runge' )  THEN
+                IF ( intermediate_timestep_count == 1 )  THEN
+                   tm_liq_usm_h_m(l)%val(m) = tend
+                ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
+                   tm_liq_usm_h_m(l)%val(m) = -9.5625_wp * tend +                                 &
+                                                  5.3125_wp * tm_liq_usm_h_m(l)%val(m)
+                ENDIF
+             ENDIF
+          ELSE
+!--          Downward and vertical surfaces
+             surf%qsws(m)  = - f_qsws * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m)               &
+                                                   - dq_s_dt * t_surf_green_p%val(m) )
+             surf%qsws(m) = surf%qsws(m) / l_v
+             surf%qsws_veg(m)  = - f_qsws_veg  * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m)      &
+                                                   - dq_s_dt * t_surf_green_p%val(m) )
+             surf%r_s(m) = - rho_lv * ( qv1 - q_s + dq_s_dt * t_surf_green%val(m)                 &
+                                                  - dq_s_dt * t_surf_green_p%val(m) ) /           &
+                                                   (surf%qsws(m) + 1.0E-20)  - surf%r_a_green(m)
+             surf%qsws_liq(m) = 0._wp  ! - f_qsws_liq  * ( qv1 - q_s + dq_s_dt * t_surf_green_h(m)&
+!                                                  - dq_s_dt * t_surf_green_h_p(m) )
+!--          If the air is saturated, check the reservoir water level
+             IF ( surf%qsws(m) < 0.0_wp )  THEN
 !--             In case qsws_veg becomes negative (unphysical behavior), let the water enter the
 !--             liquid water reservoir as dew on the plant
-                IF ( surf_usm_h%qsws_veg(m) < 0.0_wp )  THEN
-                   surf_usm_h%qsws_liq(m) = surf_usm_h%qsws_liq(m) + surf_usm_h%qsws_veg(m)
-                   surf_usm_h%qsws_veg(m) = 0.0_wp
+                IF ( surf%qsws_veg(m) < 0.0_wp )  THEN
+                   surf%qsws_veg(m) = 0.0_wp
                 ENDIF
              ENDIF
-
-             surf_usm_h%qsws(m) = surf_usm_h%qsws(m) / l_v
-
-             tend = - surf_usm_h%qsws_liq(m) * drho_l_lv
-             m_liq_usm_h_p%var_usm_1d(m) = m_liq_usm_h%var_usm_1d(m) + dt_3d *                     &
-                                           ( tsc(2) * tend + tsc(3) * tm_liq_usm_h_m%var_usm_1d(m) )
-!
-!--         Check if reservoir is overfull -> reduce to maximum (conservation of water is violated
-!--         here)
-             m_liq_usm_h_p%var_usm_1d(m) = MIN( m_liq_usm_h_p%var_usm_1d(m), m_liq_max )
-
-!
-!--         Check if reservoir is empty (avoid values < 0.0) (conservation of water is violated here)
-             m_liq_usm_h_p%var_usm_1d(m) = MAX( m_liq_usm_h_p%var_usm_1d(m), 0.0_wp )
-!
-!--         Calculate m_liq tendencies for the next Runge-Kutta step
-             IF ( timestep_scheme(1:5) == 'runge' )  THEN
-                IF ( intermediate_timestep_count == 1 )  THEN
-                   tm_liq_usm_h_m%var_usm_1d(m) = tend
-                ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
-                   tm_liq_usm_h_m%var_usm_1d(m) = -9.5625_wp * tend +                              &
-                                                  5.3125_wp * tm_liq_usm_h_m%var_usm_1d(m)
-                ENDIF
-             ENDIF
-
           ENDIF
        ELSE
-          surf_usm_h%r_s(m) = 1.0E10_wp
+          surf%r_s(m) = 1.0E10_wp
        ENDIF
 !
@@ -7989,393 +7175,8 @@
 !--    restored.
        IF ( during_spinup )  THEN
-          surf_usm_h%frac(m,ind_wat_win)   = frac_win
-          surf_usm_h%frac(m,ind_veg_wall)  = frac_wall
-          surf_usm_h%frac(m,ind_pav_green) = frac_green
+          surf%frac(m,ind_wat_win)   = frac_win
+          surf%frac(m,ind_veg_wall)  = frac_wall
+          surf%frac(m,ind_pav_green) = frac_green
        ENDIF
-
-    ENDDO
-!
-!-- Now, treat vertical surface elements
-    !$OMP DO SCHEDULE (STATIC)
-    DO  l = 0, 3
-        DO  m = 1, surf_usm_v(l)%ns
-!
-!--        During spinup set green and window fraction to zero and restore at the end of the loop.
-!--        Note, this is a temporary fix and needs to be removed later.
-           IF ( during_spinup )  THEN
-              frac_win   = surf_usm_v(l)%frac(m,ind_wat_win)
-              frac_wall  = surf_usm_v(l)%frac(m,ind_veg_wall)
-              frac_green = surf_usm_v(l)%frac(m,ind_pav_green)
-              surf_usm_v(l)%frac(m,ind_wat_win)   = 0.0_wp
-              surf_usm_v(l)%frac(m,ind_veg_wall)  = 1.0_wp
-              surf_usm_v(l)%frac(m,ind_pav_green) = 0.0_wp
-           ENDIF
-!
-!--        Get indices of respective grid point
-           i = surf_usm_v(l)%i(m)
-           j = surf_usm_v(l)%j(m)
-           k = surf_usm_v(l)%k(m)
-
-!
-!--        Please note, for vertical surfaces no Obukhov length is defined, since stratification
-!--        is not considered in this case.
-           lambda_surface        = surf_usm_v(l)%lambda_surf(m)
-           lambda_surface_window = surf_usm_v(l)%lambda_surf_window(m)
-           lambda_surface_green  = surf_usm_v(l)%lambda_surf_green(m)
-
-!          pt1  = pt(k,j,i)
-           IF ( humidity )  THEN
-              qv1 = q(k,j,i)
-           ELSE
-              qv1 = 0.0_wp
-           ENDIF
-!
-!--        Calculate rho * c_p coefficient at wall layer
-           rho_cp  = c_p * hyp(k) / ( r_d * surf_usm_v(l)%pt1(m) * exner(k) )
-
-           IF (surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp )  THEN
-!
-!--           Calculate frequently used parameters
-              rho_lv    = rho_cp / c_p * l_v
-              drho_l_lv = 1.0_wp / (rho_l * l_v)
-           ENDIF
-
-!--        Calculation of r_a for vertical surfaces
-!--
-!--        Heat transfer coefficient for forced convection along vertical walls follows formulation
-!--        in TUF3d model (Krayenhoff & Voogt, 2006)
-!--
-!--        H = httc (Tsfc - Tair)
-!--        httc = rw * (11.8 + 4.2 * Ueff) - 4.0
-!--
-!--             rw: Wall patch roughness relative to 1.0 for concrete
-!--             Ueff: Effective wind speed
-!--             - 4.0 is a reduction of Rowley et al (1930) formulation based on
-!--             Cole and Sturrock (1977)
-!--
-!--             Ucan: Canyon wind speed
-!--             wstar: Convective velocity
-!--             Qs: Surface heat flux
-!--             zH: Height of the convective layer
-!--             wstar = (g/Tcan*Qs*zH)**(1./3.)
-!--        Effective velocity components must always be defined at scalar grid point. The wall
-!--        normal component is obtained by simple linear interpolation. (An alternative would be an
-!--        logarithmic interpolation.) Parameter roughness_concrete (default value = 0.001) is used
-!--        to calculation of roughness relative to concrete. Note, wind velocity is limited
-!--        to avoid division by zero. The nominator can become <= 0.0 for values z0 < 3*10E-4.
-           ueff        = MAX ( SQRT( ( ( u(k,j,i) + u(k,j,i+1) ) * 0.5_wp )**2 +                  &
-                                     ( ( v(k,j,i) + v(k,j+1,i) ) * 0.5_wp )**2 +                  &
-                                     ( ( w(k,j,i) + w(k-1,j,i) ) * 0.5_wp )**2 ),                 &
-                               ( ( 4.0_wp + 0.1_wp )                                              &
-                                 / ( surf_usm_v(l)%z0(m) * d_roughness_concrete )                 &
-                                - 11.8_wp ) / 4.2_wp                                              &
-                              )
-           surf_usm_v(l)%r_a(m) = rho_cp / ( surf_usm_v(l)%z0(m) * d_roughness_concrete           &
-                                  * ( 11.8_wp + 4.2_wp * ueff )  - 4.0_wp  )
-!
-!--        Limit aerodynamic resistance
-           IF ( surf_usm_v(l)%r_a(m) < 1.0_wp )  surf_usm_v(l)%r_a(m) = 1.0_wp
-           IF ( surf_usm_v(l)%r_a(m) > 300.0_wp )  surf_usm_v(l)%r_a(m) = 300.0_wp
-
-           f_shf         = rho_cp / surf_usm_v(l)%r_a(m)
-           f_shf_window  = rho_cp / surf_usm_v(l)%r_a(m)
-           f_shf_green   = rho_cp / surf_usm_v(l)%r_a(m)
-
-           IF ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp ) THEN
-!
-!--           Adapted from LSM:
-!--           Second step: calculate canopy resistance r_canopy. f1-f3 here are defined as 1/f1-f3
-!--           as in ECMWF documentation f1: correction for incoming shortwave radiation (stomata
-!--           close at night)
-              f1 = MIN( 1.0_wp, ( 0.004_wp * surf_usm_v(l)%rad_sw_in(m) + 0.05_wp )                &
-                                / (0.81_wp * (0.004_wp * surf_usm_v(l)%rad_sw_in(m) + 1.0_wp) ) )
-!
-!--           f2: Correction for soil moisture availability to plants (the integrated soil moisture
-!--           must thus be considered here) f2 = 0 for very dry soils
-              f2=1.0_wp
-
-!
-!--           Calculate water vapour pressure at saturation
-              e_s = 0.01_wp * 610.78_wp * EXP( 17.269_wp * ( t_surf_green_v_p(l)%t(m) - 273.16_wp ) &
-                                               / (  t_surf_green_v_p(l)%t(m) - 35.86_wp ) )
-!
-!--           f3: Correction for vapour pressure deficit
-              IF ( surf_usm_v(l)%g_d(m) /= 0.0_wp )  THEN
-!
-!--              Calculate vapour pressure
-                 e  = qv1 * surface_pressure / ( qv1 + 0.622_wp )
-                 f3 = EXP ( - surf_usm_v(l)%g_d(m) * (e_s - e) )
-              ELSE
-                 f3 = 1.0_wp
-              ENDIF
-!
-!--           Calculate canopy resistance. In case that c_veg is 0 (bare soils), this calculation is
-!--           obsolete, as r_canopy is not used below.
-!--           To do: check for very dry soil -> r_canopy goes to infinity
-              surf_usm_v(l)%r_canopy(m) = surf_usm_v(l)%r_canopy_min(m) /                          &
-                                          ( surf_usm_v(l)%lai(m) * f1 * f2 * f3 + 1.0E-20_wp )
-
-!
-!--           Calculate saturation specific humidity
-              q_s = 0.622_wp * e_s / ( surface_pressure - e_s )
-!
-!--           In case of dewfall, set evapotranspiration to zero. All super-saturated water is then
-!--           removed from the air
-              IF ( humidity  .AND.  q_s <= qv1 )  THEN
-                 surf_usm_v(l)%r_canopy(m) = 0.0_wp
-              ENDIF
-
-!
-!--           Calculate coefficients for the total evapotranspiration
-!--           In case of water surface, set vegetation and soil fluxes to zero.
-!--           For pavements, only evaporation of liquid water is possible.
-              f_qsws_veg  = rho_lv *                                                               &
-                                ( 1.0_wp        - 0.0_wp ) / & !surf_usm_h%c_liq(m) ) /              &
-                                ( surf_usm_v(l)%r_a(m) + surf_usm_v(l)%r_canopy(m) )
-!             f_qsws_liq  = rho_lv * surf_usm_h%c_liq(m) / surf_usm_h%r_a_green(m)
-
-              f_qsws = f_qsws_veg! + f_qsws_liq
-!
-!--           Calculate derivative of q_s for Taylor series expansion
-              e_s_dt = e_s * ( 17.269_wp / ( t_surf_green_v_p(l)%t(m) - 35.86_wp) - 17.269_wp      &
-                               * ( t_surf_green_v_p(l)%t(m) - 273.16_wp)                           &
-                               / ( t_surf_green_v_p(l)%t(m) - 35.86_wp)**2 )
-
-              dq_s_dt = 0.622_wp * e_s_dt / ( surface_pressure - e_s_dt )
-           ENDIF
-
-!
-!--        Add LW up so that it can be removed in prognostic equation
-           surf_usm_v(l)%rad_net_l(m) = surf_usm_v(l)%rad_sw_in(m) - surf_usm_v(l)%rad_sw_out(m)   &
-                                        + surf_usm_v(l)%rad_lw_in(m)  - surf_usm_v(l)%rad_lw_out(m)
-!
-!--        Numerator of the prognostic equation
-           coef_1 = surf_usm_v(l)%rad_net_l(m) +                             & ! Coef +1 corresponds to -lwout
-                                                                               ! included in calculation of radnet_l
-           ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_veg_wall) *                        &
-                                   sigma_sb *  t_surf_wall_v(l)%t(m) ** 4 +                        &
-                                   f_shf * surf_usm_v(l)%pt1(m) +                                  &
-                                   lambda_surface * t_wall_v(l)%t(nzb_wall,m)
-           IF ( ( .NOT. during_spinup )  .AND.  ( surf_usm_v(l)%frac(m,ind_wat_win) > 0.0_wp ) ) THEN
-              coef_window_1 = surf_usm_v(l)%rad_net_l(m) +                   & ! Coef +1 corresponds to -lwout
-                                                                               ! included in calculation of radnet_l
-             ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_wat_win) *                       &
-                                   sigma_sb * t_surf_window_v(l)%t(m) ** 4 +                       &
-                                   f_shf * surf_usm_v(l)%pt1(m) +                                  &
-                                   lambda_surface_window * t_window_v(l)%t(nzb_wall,m)
-           ENDIF
-           IF ( ( humidity )  .AND.  ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
-              coef_green_1 = surf_usm_v(l)%rad_net_l(m) +                      & ! Coef +1 corresponds to -lwout
-                                                                                 ! included in calculation of radnet_l
-              ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb *         &
-                                   t_surf_green_v(l)%t(m) ** 4 +                                   &
-                                   f_shf * surf_usm_v(l)%pt1(m) + f_qsws * ( qv1 - q_s             &
-                                   + dq_s_dt * t_surf_green_v(l)%t(m) ) +                          &
-                                   lambda_surface_green * t_wall_v(l)%t(nzb_wall,m)
-           ELSE
-             coef_green_1 = surf_usm_v(l)%rad_net_l(m) +                       & ! Coef +1 corresponds to -lwout included
-                                                                                 ! in calculation of radnet_l
-             ( 3.0_wp + 1.0_wp ) * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb *          &
-                                   t_surf_green_v(l)%t(m) ** 4 +                                   &
-                                   f_shf * surf_usm_v(l)%pt1(m) +                                  &
-                                   lambda_surface_green * t_wall_v(l)%t(nzb_wall,m)
-           ENDIF
-
-!
-!--        Denominator of the prognostic equation
-           coef_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_veg_wall) * sigma_sb                   &
-                    * t_surf_wall_v(l)%t(m)**3 + lambda_surface + f_shf / exner(k)
-           IF ( ( .NOT. during_spinup )  .AND.  ( surf_usm_v(l)%frac(m,ind_wat_win) > 0.0_wp ) ) THEN
-              coef_window_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_wat_win) * sigma_sb          &
-                              * t_surf_window_v(l)%t(m)**3 + lambda_surface_window + f_shf / exner(k)
-           ENDIF
-           IF ( ( humidity )  .AND.  ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp ) )  THEN
-               coef_green_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb        &
-                              * t_surf_green_v(l)%t(m)**3  + f_qsws * dq_s_dt                      &
-                              + lambda_surface_green + f_shf / exner(k)
-           ELSE
-              coef_green_2 = 4.0_wp * surf_usm_v(l)%emissivity(m,ind_pav_green) * sigma_sb         &
-                             * t_surf_green_v(l)%t(m)**3 + lambda_surface_green + f_shf / exner(k)
-           ENDIF
-!
-!--        Implicit solution when the surface layer has no heat capacity, otherwise use RK3 scheme.
-           t_surf_wall_v_p(l)%t(m) = ( coef_1 * dt_3d * tsc(2) + surf_usm_v(l)%c_surface(m)        &
-                                       * t_surf_wall_v(l)%t(m) ) / ( surf_usm_v(l)%c_surface(m)    &
-                                       + coef_2 * dt_3d * tsc(2) )
-           IF ( ( .NOT. during_spinup )  .AND.  ( surf_usm_v(l)%frac(m,ind_wat_win) > 0.0_wp ) ) THEN
-              t_surf_window_v_p(l)%t(m) = ( coef_window_1 * dt_3d * tsc(2) +                       &
-                                            surf_usm_v(l)%c_surface_window(m)                      &
-                                            * t_surf_window_v(l)%t(m) ) /                          &
-                                          ( surf_usm_v(l)%c_surface_window(m)                      &
-                                            + coef_window_2 * dt_3d * tsc(2) )
-           ENDIF
-           t_surf_green_v_p(l)%t(m) = ( coef_green_1 * dt_3d * tsc(2) +                            &
-                                        surf_usm_v(l)%c_surface_green(m)                           &
-                                        * t_surf_green_v(l)%t(m) ) /                               &
-                                      ( surf_usm_v(l)%c_surface_green(m)                           &
-                                        + coef_green_2 * dt_3d * tsc(2) )
-!
-!--        Add RK3 term
-           t_surf_wall_v_p(l)%t(m)   = t_surf_wall_v_p(l)%t(m) + dt_3d * tsc(3) *                  &
-                                       surf_usm_v(l)%tt_surface_wall_m(m)
-           t_surf_window_v_p(l)%t(m) = t_surf_window_v_p(l)%t(m) + dt_3d * tsc(3) *                &
-                                       surf_usm_v(l)%tt_surface_window_m(m)
-           t_surf_green_v_p(l)%t(m)  = t_surf_green_v_p(l)%t(m) + dt_3d * tsc(3) *                 &
-                                       surf_usm_v(l)%tt_surface_green_m(m)
-
-!
-!--        Store surface temperature. Further, in case humidity is used, store also vpt_surface,
-!--        which is, due to the lack of moisture on roofs, simply assumed to be the surface temperature.
-           surf_usm_v(l)%pt_surface(m) = ( surf_usm_v(l)%frac(m,ind_veg_wall)                      &
-                                         * t_surf_wall_v_p(l)%t(m)                                 &
-                                         + surf_usm_v(l)%frac(m,ind_wat_win)                       &
-                                         * t_surf_window_v_p(l)%t(m)                               &
-                                         + surf_usm_v(l)%frac(m,ind_pav_green)                     &
-                                         * t_surf_green_v_p(l)%t(m) ) / exner(k)
-
-           IF ( humidity )  surf_usm_v(l)%vpt_surface(m) = surf_usm_v(l)%pt_surface(m)
-!
-!--        Calculate true tendency
-           stend_wall = ( t_surf_wall_v_p(l)%t(m) - t_surf_wall_v(l)%t(m) - dt_3d * tsc(3) *       &
-                          surf_usm_v(l)%tt_surface_wall_m(m) ) / ( dt_3d  * tsc(2) )
-           stend_window = ( t_surf_window_v_p(l)%t(m) - t_surf_window_v(l)%t(m) - dt_3d * tsc(3) * &
-                            surf_usm_v(l)%tt_surface_window_m(m) ) / ( dt_3d  * tsc(2) )
-           stend_green = ( t_surf_green_v_p(l)%t(m) - t_surf_green_v(l)%t(m) - dt_3d * tsc(3) *    &
-                           surf_usm_v(l)%tt_surface_green_m(m) ) / ( dt_3d  * tsc(2) )
-
-!
-!--        Calculate t_surf_* tendencies for the next Runge-Kutta step
-           IF ( timestep_scheme(1:5) == 'runge' )  THEN
-              IF ( intermediate_timestep_count == 1 )  THEN
-                 surf_usm_v(l)%tt_surface_wall_m(m)   = stend_wall
-                 surf_usm_v(l)%tt_surface_window_m(m) = stend_window
-                 surf_usm_v(l)%tt_surface_green_m(m)  = stend_green
-              ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )  THEN
-                 surf_usm_v(l)%tt_surface_wall_m(m)   = -9.5625_wp * stend_wall + 5.3125_wp        &
-                                                         * surf_usm_v(l)%tt_surface_wall_m(m)
-                 surf_usm_v(l)%tt_surface_green_m(m)  = -9.5625_wp * stend_green + 5.3125_wp       &
-                                                        * surf_usm_v(l)%tt_surface_green_m(m)
-                 surf_usm_v(l)%tt_surface_window_m(m) = -9.5625_wp * stend_window + 5.3125_wp      &
-                                                        * surf_usm_v(l)%tt_surface_window_m(m)
-              ENDIF
-           ENDIF
-
-!
-!--        In case of fast changes in the skin temperature, it is required to update the radiative
-!--        fluxes in order to keep the solution stable
-
-           IF ( ( ( ABS( t_surf_wall_v_p(l)%t(m)   - t_surf_wall_v(l)%t(m) )   > 1.0_wp ) .OR.     &
-                (   ABS( t_surf_green_v_p(l)%t(m)  - t_surf_green_v(l)%t(m) )  > 1.0_wp ) .OR.     &
-                (   ABS( t_surf_window_v_p(l)%t(m) - t_surf_window_v(l)%t(m) ) > 1.0_wp ) )        &
-                   .AND.  unscheduled_radiation_calls )  THEN
-              force_radiation_call_l = .TRUE.
-           ENDIF
-
-!
-!--        Calculate fluxes
-!--        Prognostic rad_net_l is used just for output!
-           surf_usm_v(l)%rad_net_l(m) = surf_usm_v(l)%frac(m,ind_veg_wall) *                       &
-                                        ( surf_usm_v(l)%rad_net_l(m) + 3.0_wp * sigma_sb *         &
-                                        t_surf_wall_v(l)%t(m)**4 - 4.0_wp * sigma_sb *             &
-                                        t_surf_wall_v(l)%t(m)**3 * t_surf_wall_v_p(l)%t(m) )       &
-                                      + surf_usm_v(l)%frac(m,ind_wat_win) *                        &
-                                        ( surf_usm_v(l)%rad_net_l(m) + 3.0_wp * sigma_sb *         &
-                                        t_surf_window_v(l)%t(m)**4 - 4.0_wp * sigma_sb *           &
-                                        t_surf_window_v(l)%t(m)**3 * t_surf_window_v_p(l)%t(m) )   &
-                                      + surf_usm_v(l)%frac(m,ind_pav_green) *                      &
-                                        ( surf_usm_v(l)%rad_net_l(m) + 3.0_wp * sigma_sb *         &
-                                        t_surf_green_v(l)%t(m)**4 - 4.0_wp * sigma_sb *            &
-                                        t_surf_green_v(l)%t(m)**3 * t_surf_green_v_p(l)%t(m) )
-
-           surf_usm_v(l)%wghf_eb_window(m) = lambda_surface_window *                               &
-                                             ( t_surf_window_v_p(l)%t(m)                           &
-                                               - t_window_v(l)%t(nzb_wall,m) )
-           surf_usm_v(l)%wghf_eb(m) = lambda_surface * ( t_surf_wall_v_p(l)%t(m)                   &
-                                                         - t_wall_v(l)%t(nzb_wall,m) )
-           surf_usm_v(l)%wghf_eb_green(m) = lambda_surface_green *                                 &
-                                            ( t_surf_green_v_p(l)%t(m)                             &
-                                              - t_green_v(l)%t(nzb_wall,m) )
-
-!
-!--        Ground/wall/roof surface heat flux
-           surf_usm_v(l)%wshf_eb(m) = - f_shf  * ( surf_usm_v(l)%pt1(m) - t_surf_wall_v_p(l)%t(m)  &
-                                      / exner(k) ) * surf_usm_v(l)%frac(m,ind_veg_wall)            &
-                                     - f_shf_window  * ( surf_usm_v(l)%pt1(m)                      &
-                                     - t_surf_window_v_p(l)%t(m) / exner(k) )                      &
-                                     * surf_usm_v(l)%frac(m,ind_wat_win) - f_shf_green             &
-                                     * ( surf_usm_v(l)%pt1(m) - t_surf_green_v_p(l)%t(m)           &
-                                     / exner(k) ) * surf_usm_v(l)%frac(m,ind_pav_green)
-
-!
-!--        Store kinematic surface heat fluxes for utilization in other processes diffusion_s,
-!--        surface_layer_fluxes,...
-           surf_usm_v(l)%shf(m) = surf_usm_v(l)%wshf_eb(m) / c_p
-!
-!--        If the indoor model is applied, further add waste heat from buildings to the kinematic
-!--        flux.
-           IF ( indoor_model )  THEN
-              surf_usm_v(l)%shf(m) = surf_usm_v(l)%shf(m) + surf_usm_v(l)%waste_heat(m) / c_p
-           ENDIF
-
-           IF ( surf_usm_v(l)%frac(m,ind_pav_green) > 0.0_wp )  THEN
-
-
-              IF ( humidity )  THEN
-                 surf_usm_v(l)%qsws(m)  = - f_qsws * ( qv1 - q_s + dq_s_dt                         &
-                                          * t_surf_green_v(l)%t(m) - dq_s_dt                       &
-                                          * t_surf_green_v_p(l)%t(m) )
-
-                 surf_usm_v(l)%qsws(m) = surf_usm_v(l)%qsws(m) / l_v
-
-                 surf_usm_v(l)%qsws_veg(m)  = - f_qsws_veg  * ( qv1 - q_s + dq_s_dt                &
-                                              * t_surf_green_v(l)%t(m) - dq_s_dt                   &
-                                              * t_surf_green_v_p(l)%t(m) )
-
-!                 surf_usm_h%qsws_liq(m)  = - f_qsws_liq  * ( qv1 - q_s + dq_s_dt                   &
-!                                           * t_surf_green_h(m) - dq_s_dt                           &
-!                                           * t_surf_green_h_p(m) )
-              ENDIF
-
-!
-!--           Calculate the true surface resistance
-              IF ( .NOT.  humidity )  THEN
-                 surf_usm_v(l)%r_s(m) = 1.0E10_wp
-              ELSE
-                 surf_usm_v(l)%r_s(m) = - rho_lv * ( qv1 - q_s + dq_s_dt * t_surf_green_v(l)%t(m)  &
-                                        - dq_s_dt * t_surf_green_v_p(l)%t(m) ) /                   &
-                                        (surf_usm_v(l)%qsws(m) + 1.0E-20)  - surf_usm_v(l)%r_a(m)
-              ENDIF
-
-!
-!--           Calculate change in liquid water reservoir due to dew fall or evaporation of liquid
-!--           water
-              IF ( humidity )  THEN
-!
-!--              If the air is saturated, check the reservoir water level
-                 IF ( surf_usm_v(l)%qsws(m) < 0.0_wp )  THEN
-
-!
-!--                 In case qsws_veg becomes negative (unphysical behavior), let the water enter the
-!--                 liquid water reservoir as dew on the plant
-                    IF ( surf_usm_v(l)%qsws_veg(m) < 0.0_wp )  THEN
-       !                 surf_usm_h%qsws_liq(m) = surf_usm_h%qsws_liq(m) + surf_usm_h%qsws_veg(m)
-                       surf_usm_v(l)%qsws_veg(m) = 0.0_wp
-                    ENDIF
-                 ENDIF
-
-              ENDIF
-           ELSE
-              surf_usm_v(l)%r_s(m) = 1.0E10_wp
-           ENDIF
-!
-!--        During spinup green and window fraction are set to zero. Here, the original values are
-!--        restored.
-           IF ( during_spinup )  THEN
-              surf_usm_v(l)%frac(m,ind_wat_win)   = frac_win
-              surf_usm_v(l)%frac(m,ind_veg_wall)  = frac_wall
-              surf_usm_v(l)%frac(m,ind_pav_green) = frac_green
-           ENDIF
-
-        ENDDO
 
     ENDDO
@@ -8383,163 +7184,29 @@
 
 !
-!--  Add-up anthropogenic heat, for now only at upward-facing surfaces
-      IF ( usm_anthropogenic_heat  .AND.    .NOT.  during_spinup   .AND.                           &
-           intermediate_timestep_count == intermediate_timestep_count_max )  THEN
-!
-!--     Application of the additional anthropogenic heat sources. We considere the traffic for now,
-!--     so all heat is absorbed to the first layer, generalization would be worth.
-!--     Calculation of actual profile coefficient
-!--     ??? check time_since_reference_point ???
-         CALL get_date_time( time_since_reference_point, hour = dhour, second_of_day = dtime )
-
-!--      TO_DO: activate, if testcase is available
-!--      !$OMP PARALLEL DO PRIVATE (i, j, k, acoef, rho_cp)
-!--      It may also improve performance to move topo_top_ind before the k-loop
-         DO i = nxl, nxr
-            DO j = nys, nyn
-               DO k = nz_urban_b, min(nz_urban_t,naheatlayers)
-                  IF ( k > topo_top_ind(j,i,0) )  THEN
-!
-!--                 Increase of pt in box i,j,k in time dt_3d given to anthropogenic heat
-!--                 aheat*acoef (W*m-2)
-!--                 linear interpolation of coeficient
-                     acoef = ( REAL( dhour+1,wp ) - dtime / seconds_per_hour )                     &
-                             * aheatprof(k, dhour) +                                               &
-                             ( dtime / seconds_per_hour - REAL( dhour, wp ) )                      &
-                             * aheatprof(k,dhour+1)
-                     IF ( aheat(k,j,i) > 0.0_wp )  THEN
-!
-!--                    Calculate rho * c_p coefficient at layer k
-                        rho_cp  = c_p * hyp(k) / ( r_d * pt(k+1,j,i) * exner(k) )
-                        pt(k,j,i) = pt(k,j,i) + aheat(k,j,i) * acoef * dt_3d / (exner(k) * rho_cp  &
-                        * dz(1) )
-                     ENDIF
-                  ENDIF
-               ENDDO
-            ENDDO
-         ENDDO
-
-      ENDIF
-!
-!--  pt and shf are defined on nxlg:nxrg,nysg:nyng .Get the borders from neighbours.
-      CALL exchange_horiz( pt, nbgp )
-!
-!--  Calculation of force_radiation_call:
-!--  Make logical OR for all processes.
-!--  Force radiation call if at least one processor forces it.
-      IF ( intermediate_timestep_count == intermediate_timestep_count_max-1 )  THEN
+!-- pt and shf are defined on nxlg:nxrg,nysg:nyng .Get the borders from neighbours.
+    CALL exchange_horiz( pt, nbgp )
+!
+!-- Calculation of force_radiation_call:
+!-- Make logical OR for all processes.
+!-- Force radiation call if at least one processor forces it.
+    IF ( intermediate_timestep_count == intermediate_timestep_count_max-1 )  THEN
 #if defined( __parallel )
-        IF ( .NOT. force_radiation_call ) THEN
-           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-           CALL MPI_ALLREDUCE( force_radiation_call_l, force_radiation_call,                      &
-                               1, MPI_LOGICAL, MPI_LOR, comm2d, ierr )
-        ENDIF
+       IF ( .NOT. force_radiation_call ) THEN
+          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
+          CALL MPI_ALLREDUCE( force_radiation_call_l, force_radiation_call,                       &
+                              1, MPI_LOGICAL, MPI_LOR, comm2d, ierr )
+       ENDIF
 #else
-        force_radiation_call = force_radiation_call .OR. force_radiation_call_l
+       force_radiation_call = force_radiation_call .OR. force_radiation_call_l
 #endif
-        force_radiation_call_l = .FALSE.
-      ENDIF
-
-! !
-! !-- Calculate surface specific humidity
-!  IF ( humidity )  THEN
-!     CALL calc_q_surface_usm
-!  ENDIF
-
-
-! CONTAINS
-! !------------------------------------------------------------------------------------------------!
-! ! Description:
-! ! ------------
-! !> Calculation of specific humidity of the skin layer (surface). It is assumend that the skin is
-! !> always saturated.
-! !------------------------------------------------------------------------------------------------!
-! SUBROUTINE calc_q_surface_usm
-!
-!    IMPLICIT NONE
-!
-!    REAL(wp)  ::  resistance  !< aerodynamic and soil resistance term
-!
-!    DO  m = 1, surf_usm_h%ns
-!
-!       i   = surf_usm_h%i(m)
-!       j   = surf_usm_h%j(m)
-!       k   = surf_usm_h%k(m)
-!
-!!
-!!--   Calculate water vapour pressure at saturation
-!       e_s = 0.01_wp * 610.78_wp * EXP( 17.269_wp * ( t_surf_green_h_p(m) - 273.16_wp ) /          &
-!             ( t_surf_green_h_p(m) - 35.86_wp  ) )
-!
-!!
-!!--   Calculate specific humidity at saturation
-!       q_s = 0.622_wp * e_s / ( surface_pressure - e_s )
-!
-!!       surf_usm_h%r_a_green(m) = ( surf_usm_h%pt1(m) - t_surf_green_h(m) / exner(k) ) /           &
-!!                                 ( surf_usm_h%ts(m) * surf_usm_h%us(m) + 1.0E-10_wp )
-!!
-!! !-    Make sure that the resistance does not drop to zero
-!!       IF ( ABS(surf_usm_h%r_a_green(m)) < 1.0E-10_wp )  surf_usm_h%r_a_green(m) = 1.0E-10_wp
-!
-!       resistance = surf_usm_h%r_a_green(m) / ( surf_usm_h%r_a_green(m) + surf_usm_h%r_s(m)        &
-!                    + 1E-5_wp )
-!
-!!
-!!--   Calculate specific humidity at surface
-!       IF ( bulk_cloud_model )  THEN
-!          q(k,j,i) = resistance * q_s + ( 1.0_wp - resistance ) * ( q(k,j,i) - ql(k,j,i) )
-!       ELSE
-!          q(k,j,i) = resistance * q_s + ( 1.0_wp - resistance ) * q(k,j,i)
-!       ENDIF
-!
-!!
-!!--   Update virtual potential temperature
-!       vpt(k,j,i) = pt(k,j,i) * ( 1.0_wp + 0.61_wp * q(k,j,i) )
-!
-!   ENDDO
-!
-!!
-!!--Now, treat vertical surface elements
-!    DO  l = 0, 3
-!       DO  m = 1, surf_usm_v(l)%ns
-!!
-!!--      Get indices of respective grid point
-!          i = surf_usm_v(l)%i(m)
-!          j = surf_usm_v(l)%j(m)
-!          k = surf_usm_v(l)%k(m)
-!
-!!
-!!--      Calculate water vapour pressure at saturation
-!          e_s = 0.01_wp * 610.78_wp * EXP( 17.269_wp * ( t_surf_green_v_p(l)%t(m) - 273.16_wp ) /  &
-!                ( t_surf_green_v_p(l)%t(m) - 35.86_wp ) )
-!
-!!
-!!--      Calculate specific humidity at saturation
-!          q_s = 0.622_wp * e_s / ( surface_pressure -e_s )
-!
-!!
-!!--      Calculate specific humidity at surface
-!          IF ( bulk_cloud_model )  THEN
-!             q(k,j,i) = ( q(k,j,i) - ql(k,j,i) )
-!          ELSE
-!             q(k,j,i) = q(k,j,i)
-!          ENDIF
-!!
-!!--      Update virtual potential temperature
-!          vpt(k,j,i) = pt(k,j,i) * ( 1.0_wp + 0.61_wp * q(k,j,i) )
-!
-!       ENDDO
-!
-!    ENDDO
-!
-! END SUBROUTINE calc_q_surface_usm
+       force_radiation_call_l = .FALSE.
+    ENDIF
 
     IF ( debug_output_timestep )  THEN
-       WRITE( debug_string, * ) 'usm_surface_energy_balance | during_spinup: ', during_spinup
+       WRITE( debug_string, * ) 'usm_surface_energy_balance: ', horizontal, l, during_spinup
        CALL debug_message( debug_string, 'end' )
     ENDIF
 
  END SUBROUTINE usm_surface_energy_balance
-
 
 !--------------------------------------------------------------------------------------------------!
@@ -8617,36 +7284,41 @@
 
        CALL wrd_write_string( 'ns_h_on_file_usm' )
-       WRITE ( 14 )  surf_usm_h%ns
+       WRITE ( 14 )  surf_usm_h(0:1)%ns
 
        CALL wrd_write_string( 'ns_v_on_file_usm' )
        WRITE ( 14 )  surf_usm_v(0:3)%ns
 
-       CALL wrd_write_string( 'usm_start_index_h' )
-       WRITE ( 14 )  surf_usm_h%start_index
-
-       CALL wrd_write_string( 'usm_end_index_h' )
-       WRITE ( 14 )  surf_usm_h%end_index
-
-       CALL wrd_write_string( 't_surf_wall_h' )
-       WRITE ( 14 )  t_surf_wall_h
-
-       CALL wrd_write_string( 't_surf_window_h' )
-       WRITE ( 14 )  t_surf_window_h
-
-       CALL wrd_write_string( 't_surf_green_h' )
-       WRITE ( 14 )  t_surf_green_h
-
-       CALL wrd_write_string( 'm_liq_usm_h' )
-       WRITE ( 14 )  m_liq_usm_h%var_usm_1d
-!
-!--    Write restart data which is especially needed for the urban-surface model. In order to do not
-!--    fill up the restart routines in surface_mod. Output of waste heat from indoor model. Restart
-!--    data is required in this special case, because the indoor model, where waste heat is
-!--    computed, is called each hour (current default), so that waste heat would have zero value
-!--    until next call of indoor model.
-       IF ( indoor_model )  THEN
-          CALL wrd_write_string( 'waste_heat_h' )
-          WRITE ( 14 )  surf_usm_h%waste_heat
-       ENDIF
+       DO  l = 0, 1
+
+          CALL wrd_write_string( 'usm_start_index_h' )
+          WRITE ( 14 )  surf_usm_h(l)%start_index
+
+          CALL wrd_write_string( 'usm_end_index_h' )
+          WRITE ( 14 )  surf_usm_h(l)%end_index
+
+          WRITE( dum, '(I1)')  l
+
+          CALL wrd_write_string( 't_surf_wall_h(' // dum // ')' )
+          WRITE ( 14 )  t_surf_wall_h(l)%val
+
+          CALL wrd_write_string( 't_surf_window_h(' // dum // ')' )
+          WRITE ( 14 )  t_surf_window_h(l)%val
+
+          CALL wrd_write_string( 't_surf_green_h(' // dum // ')' )
+          WRITE ( 14 )  t_surf_green_h(l)%val
+
+          CALL wrd_write_string( 'm_liq_usm_h(' // dum // ')' )
+          WRITE ( 14 )  m_liq_usm_h(l)%val
+!
+!--       Write restart data which is especially needed for the urban-surface model. In order to do not
+!--       fill up the restart routines in surface_mod. Output of waste heat from indoor model. Restart
+!--       data is required in this special case, because the indoor model, where waste heat is
+!--       computed, is called each hour (current default), so that waste heat would have zero value
+!--       until next call of indoor model.
+          IF ( indoor_model )  THEN
+             CALL wrd_write_string( 'waste_heat_h(' // dum // ')' )
+             WRITE ( 14 )  surf_usm_h(l)%waste_heat
+          ENDIF
+       ENDDO
 
        DO  l = 0, 3
@@ -8661,11 +7333,11 @@
 
           CALL wrd_write_string( 't_surf_wall_v(' // dum // ')' )
-          WRITE ( 14 )  t_surf_wall_v(l)%t
+          WRITE ( 14 )  t_surf_wall_v(l)%val
 
           CALL wrd_write_string( 't_surf_window_v(' // dum // ')' )
-          WRITE ( 14 ) t_surf_window_v(l)%t
+          WRITE ( 14 ) t_surf_window_v(l)%val
 
           CALL wrd_write_string( 't_surf_green_v(' // dum // ')' )
-          WRITE ( 14 ) t_surf_green_v(l)%t
+          WRITE ( 14 ) t_surf_green_v(l)%val
 
           IF ( indoor_model )  THEN
@@ -8676,18 +7348,24 @@
        ENDDO
 
-       CALL wrd_write_string( 'usm_start_index_h' )
-       WRITE ( 14 )  surf_usm_h%start_index
-
-       CALL wrd_write_string( 'usm_end_index_h' )
-       WRITE ( 14 )  surf_usm_h%end_index
-
-       CALL wrd_write_string( 't_wall_h' )
-       WRITE ( 14 )  t_wall_h
-
-       CALL wrd_write_string( 't_window_h' )
-       WRITE ( 14 )  t_window_h
-
-       CALL wrd_write_string( 't_green_h' )
-       WRITE ( 14 )  t_green_h
+       DO  l = 0, 1
+
+          CALL wrd_write_string( 'usm_start_index_h' )
+          WRITE ( 14 )  surf_usm_h(l)%start_index
+
+          CALL wrd_write_string( 'usm_end_index_h' )
+          WRITE ( 14 )  surf_usm_h(l)%end_index
+
+          WRITE( dum, '(I1)')  l
+
+          CALL wrd_write_string( 't_wall_h(' // dum // ')' )
+          WRITE ( 14 )  t_wall_h(l)%val
+
+          CALL wrd_write_string( 't_window_h(' // dum // ')' )
+          WRITE ( 14 )  t_window_h(l)%val
+
+          CALL wrd_write_string( 't_green_h(' // dum // ')' )
+          WRITE ( 14 )  t_green_h(l)%val
+
+       ENDDO
 
        DO  l = 0, 3
@@ -8702,11 +7380,11 @@
 
           CALL wrd_write_string( 't_wall_v(' // dum // ')' )
-          WRITE ( 14 )  t_wall_v(l)%t
+          WRITE ( 14 )  t_wall_v(l)%val
 
           CALL wrd_write_string( 't_window_v(' // dum // ')' )
-          WRITE ( 14 )  t_window_v(l)%t
+          WRITE ( 14 )  t_window_v(l)%val
 
           CALL wrd_write_string( 't_green_v(' // dum // ')' )
-          WRITE ( 14 )  t_green_v(l)%t
+          WRITE ( 14 )  t_green_v(l)%val
 
        ENDDO
@@ -8716,19 +7394,24 @@
 !--    There is no information about the PE-grid necessary because the restart files consists of the
 !--    whole domain. Therefore, ns_h_on_file_usm and ns_v_on_file_usm are not used with MPI-IO.
-       CALL rd_mpi_io_surface_filetypes( surf_usm_h%start_index, surf_usm_h%end_index,             &
-                                         surface_data_to_write, global_start_index )
-
-       CALL wrd_mpi_io( 'usm_start_index_h',  surf_usm_h%start_index )
-       CALL wrd_mpi_io( 'usm_end_index_h', surf_usm_h%end_index )
-       CALL wrd_mpi_io( 'usm_global_start_h', global_start_index )
-
-       CALL wrd_mpi_io_surface( 't_surf_wall_h',  t_surf_wall_h )
-       CALL wrd_mpi_io_surface( 't_surf_window_h', t_surf_window_h )
-       CALL wrd_mpi_io_surface( 't_surf_green_h', t_surf_green_h )
-
-       CALL wrd_mpi_io_surface( 'm_liq_usm_h', m_liq_usm_h%var_usm_1d )
-       IF ( indoor_model )  THEN
-          CALL wrd_mpi_io_surface( 'waste_heat_h', surf_usm_h%waste_heat ) ! NEED TO BE CHECKED!!!!!
-       ENDIF
+       DO  l = 0, 1
+
+          WRITE( dum, '(I1)')  l
+
+          END DO
+          CALL rd_mpi_io_surface_filetypes( surf_usm_h(l)%start_index, surf_usm_h(l)%end_index,             &
+                                            surface_data_to_write, global_start_index )
+
+          CALL wrd_mpi_io( 'usm_start_index_h_' // dum,  surf_usm_h(l)%start_index )
+          CALL wrd_mpi_io( 'usm_end_index_h_' // dum, surf_usm_h(l)%end_index )
+          CALL wrd_mpi_io( 'usm_global_start_h_' // dum, global_start_index )
+
+          CALL wrd_mpi_io_surface( 't_surf_wall_h_' // dum,  t_surf_wall_h(l)%val )
+          CALL wrd_mpi_io_surface( 't_surf_window_h_' // dum, t_surf_window_h(l)%val )
+          CALL wrd_mpi_io_surface( 't_surf_green_h_' // dum, t_surf_green_h(l)%val )
+
+          CALL wrd_mpi_io_surface( 'm_liq_usm_h_' // dum, m_liq_usm_h(l)%val )
+          IF ( indoor_model )  THEN
+             CALL wrd_mpi_io_surface( 'waste_heat_h_' // dum, surf_usm_h(l)%waste_heat ) ! NEED TO BE CHECKED!!!!!
+          ENDIF
 
        DO  l = 0, 3
@@ -8745,20 +7428,26 @@
           IF ( .NOT. surface_data_to_write )  CYCLE
 
-          CALL wrd_mpi_io_surface( 't_surf_wall_v(' // dum // ')', t_surf_wall_v(l)%t )
-          CALL wrd_mpi_io_surface( 't_surf_window_v(' // dum // ')', t_surf_window_v(l)%t )
-          CALL wrd_mpi_io_surface( 't_surf_green_v(' // dum // ')', t_surf_green_v(l)%t )
+          CALL wrd_mpi_io_surface( 't_surf_wall_v(' // dum // ')', t_surf_wall_v(l)%val )
+          CALL wrd_mpi_io_surface( 't_surf_window_v(' // dum // ')', t_surf_window_v(l)%val )
+          CALL wrd_mpi_io_surface( 't_surf_green_v(' // dum // ')', t_surf_green_v(l)%val )
 
        ENDDO
 
-       CALL rd_mpi_io_surface_filetypes( surf_usm_h%start_index, surf_usm_h%end_index,             &
-                                         surface_data_to_write, global_start_index )
-
-       CALL wrd_mpi_io( 'usm_start_index_h_2',  surf_usm_h%start_index )
-       CALL wrd_mpi_io( 'usm_end_index_h_2', surf_usm_h%end_index )
-       CALL wrd_mpi_io( 'usm_global_start_h_2', global_start_index )
-
-       CALL wrd_mpi_io_surface( 't_wall_h', t_wall_h )
-       CALL wrd_mpi_io_surface( 't_window_h', t_window_h )
-       CALL wrd_mpi_io_surface( 't_green_h', t_green_h )
+       DO  l = 0, 1
+
+          WRITE( dum, '(I1)')  l
+
+          CALL rd_mpi_io_surface_filetypes( surf_usm_h(l)%start_index, surf_usm_h(l)%end_index,             &
+                                            surface_data_to_write, global_start_index )
+
+          CALL wrd_mpi_io( 'usm_start_index_h_2_' // dum,  surf_usm_h(l)%start_index )
+          CALL wrd_mpi_io( 'usm_end_index_h_2_' // dum, surf_usm_h(l)%end_index )
+          CALL wrd_mpi_io( 'usm_global_start_h_2_' // dum, global_start_index )
+
+          CALL wrd_mpi_io_surface( 't_wall_h_' // dum, t_wall_h(l)%val )
+          CALL wrd_mpi_io_surface( 't_window_h_' // dum, t_window_h(l)%val )
+          CALL wrd_mpi_io_surface( 't_green_h_' // dum, t_green_h(l)%val )
+
+       ENDDO
 
        DO  l = 0, 3
@@ -8775,7 +7464,7 @@
           IF ( .NOT. surface_data_to_write )  CYCLE
 
-          CALL wrd_mpi_io_surface( 't_wall_v(' // dum // ')', t_wall_v(l)%t )
-          CALL wrd_mpi_io_surface( 't_window_v(' // dum // ')', t_window_v(l)%t )
-          CALL wrd_mpi_io_surface( 't_green_v(' // dum // ')', t_green_v(l)%t )
+          CALL wrd_mpi_io_surface( 't_wall_v(' // dum // ')', t_wall_v(l)%val )
+          CALL wrd_mpi_io_surface( 't_window_v(' // dum // ')', t_window_v(l)%val )
+          CALL wrd_mpi_io_surface( 't_green_v(' // dum // ')', t_green_v(l)%val )
 
        ENDDO
Index: palm/trunk/SOURCE/virtual_measurement_mod.f90
===================================================================
--- palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4671)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+!
+! 4645 2020-08-24 13:55:58Z suehring
 ! Bugfix in output of E_UTM_soil coordinate
 !
@@ -1201,8 +1204,8 @@
                 DO  j = nys, nyn
                    IF ( ANY( BTEST( meas_flag(:,j,i), 0 ) ) )  THEN
-                      IF ( surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i) )  THEN
+                      IF ( surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) )  THEN
                          vmea(l)%ns_soil = vmea(l)%ns_soil + nzt_soil - nzb_soil + 1
                       ENDIF
-                      IF ( surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i) )  THEN
+                      IF ( surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) )  THEN
                          vmea(l)%ns_soil = vmea(l)%ns_soil + nzt_wall - nzb_wall + 1
                       ENDIF
@@ -1226,6 +1229,6 @@
                 DO  j = nys, nyn
                    IF ( ANY( BTEST( meas_flag(:,j,i), 0 ) ) )  THEN
-                      IF ( surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i) )  THEN
-                         m = surf_lsm_h%start_index(j,i)
+                      IF ( surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i) )  THEN
+                         m = surf_lsm_h(0)%start_index(j,i)
                          DO  k = nzb_soil, nzt_soil
                             ns = ns + 1
@@ -1237,6 +1240,6 @@
                       ENDIF
 
-                      IF ( surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i) )  THEN
-                         m = surf_usm_h%start_index(j,i)
+                      IF ( surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i) )  THEN
+                         m = surf_usm_h(0)%start_index(j,i)
                          DO  k = nzb_wall, nzt_wall
                             ns = ns + 1
@@ -1244,5 +1247,5 @@
                             vmea(l)%j_soil(ns) = j
                             vmea(l)%k_soil(ns) = k
-                            vmea(l)%depth(ns)  = - surf_usm_h%zw(k,m)
+                            vmea(l)%depth(ns)  = - surf_usm_h(0)%zw(k,m)
                          ENDDO
                       ENDIF
@@ -2552,9 +2555,9 @@
                        vmea(l)%measured_vars(m,n) = surf_def_h(0)%us(mm)
                     ENDDO
-                    DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_lsm_h%us(mm)
-                    ENDDO
-                    DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_usm_h%us(mm)
+                    DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%us(mm)
+                    ENDDO
+                    DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_usm_h(0)%us(mm)
                     ENDDO
                  ENDDO
@@ -2573,9 +2576,9 @@
                        vmea(l)%measured_vars(m,n) = surf_def_h(0)%ts(mm)
                     ENDDO
-                    DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_lsm_h%ts(mm)
-                    ENDDO
-                    DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_usm_h%ts(mm)
+                    DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%ts(mm)
+                    ENDDO
+                    DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_usm_h(0)%ts(mm)
                     ENDDO
                  ENDDO
@@ -2594,9 +2597,9 @@
                        vmea(l)%measured_vars(m,n) = surf_def_h(0)%qsws(mm)
                     ENDDO
-                    DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_lsm_h%qsws(mm)
-                    ENDDO
-                    DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_usm_h%qsws(mm)
+                    DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%qsws(mm)
+                    ENDDO
+                    DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_usm_h(0)%qsws(mm)
                     ENDDO
                  ENDDO
@@ -2615,9 +2618,9 @@
                        vmea(l)%measured_vars(m,n) = surf_def_h(0)%shf(mm)
                     ENDDO
-                    DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_lsm_h%shf(mm)
-                    ENDDO
-                    DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_usm_h%shf(mm)
+                    DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%shf(mm)
+                    ENDDO
+                    DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_usm_h(0)%shf(mm)
                     ENDDO
                  ENDDO
@@ -2633,6 +2636,6 @@
                     i = MERGE( i           , nxr, i            < nxr )
 
-                    DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_lsm_h%ghf(mm)
+                    DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%ghf(mm)
                     ENDDO
                  ENDDO
@@ -2648,5 +2651,5 @@
 !                     i = MERGE( i           , nxr, i            < nxr )
 !
-!                     DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
+!                     DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
 !                        vmea(l)%measured_vars(m,n) = ?
 !                     ENDDO
@@ -2664,9 +2667,9 @@
                        i = MERGE( i           , nxr, i            < nxr )
 
-                       DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_lsm_h%rad_net(mm)
+                       DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%rad_net(mm)
                        ENDDO
-                       DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_usm_h%rad_net(mm)
+                       DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_usm_h(0)%rad_net(mm)
                        ENDDO
                     ENDDO
@@ -2684,9 +2687,9 @@
                        i = MERGE( i           , nxr, i            < nxr )
 
-                       DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_lsm_h%rad_sw_out(mm)
+                       DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%rad_sw_out(mm)
                        ENDDO
-                       DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_usm_h%rad_sw_out(mm)
+                       DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_usm_h(0)%rad_sw_out(mm)
                        ENDDO
                     ENDDO
@@ -2704,9 +2707,9 @@
                        i = MERGE( i           , nxr, i            < nxr )
 
-                       DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_lsm_h%rad_sw_in(mm)
+                       DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%rad_sw_in(mm)
                        ENDDO
-                       DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_usm_h%rad_sw_in(mm)
+                       DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_usm_h(0)%rad_sw_in(mm)
                        ENDDO
                     ENDDO
@@ -2724,9 +2727,9 @@
                        i = MERGE( i           , nxr, i            < nxr )
 
-                       DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_lsm_h%rad_lw_out(mm)
+                       DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%rad_lw_out(mm)
                        ENDDO
-                       DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_usm_h%rad_lw_out(mm)
+                       DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_usm_h(0)%rad_lw_out(mm)
                        ENDDO
                     ENDDO
@@ -2744,9 +2747,9 @@
                        i = MERGE( i           , nxr, i            < nxr )
 
-                       DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_lsm_h%rad_lw_in(mm)
+                       DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%rad_lw_in(mm)
                        ENDDO
-                       DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                          vmea(l)%measured_vars(m,n) = surf_usm_h%rad_lw_in(mm)
+                       DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                          vmea(l)%measured_vars(m,n) = surf_usm_h(0)%rad_lw_in(mm)
                        ENDDO
                     ENDDO
@@ -2853,15 +2856,15 @@
                     k = vmea(l)%k_soil(m)
 
-                    match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
-                    match_usm = surf_usm_h%start_index(j,i) <= surf_usm_h%end_index(j,i)
+                    match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
+                    match_usm = surf_usm_h(0)%start_index(j,i) <= surf_usm_h(0)%end_index(j,i)
 
                     IF ( match_lsm )  THEN
-                       mm = surf_lsm_h%start_index(j,i)
-                       vmea(l)%measured_vars_soil(m,n) = t_soil_h%var_2d(k,mm)
+                       mm = surf_lsm_h(0)%start_index(j,i)
+                       vmea(l)%measured_vars_soil(m,n) = t_soil_h(0)%var_2d(k,mm)
                     ENDIF
 
                     IF ( match_usm )  THEN
-                       mm = surf_usm_h%start_index(j,i)
-                       vmea(l)%measured_vars_soil(m,n) = t_wall_h(k,mm)
+                       mm = surf_usm_h(0)%start_index(j,i)
+                       vmea(l)%measured_vars_soil(m,n) = t_wall_h(0)%val(k,mm)
                     ENDIF
                  ENDDO
@@ -2875,9 +2878,9 @@
                     k = vmea(l)%k_soil(m)
 
-                    match_lsm = surf_lsm_h%start_index(j,i) <= surf_lsm_h%end_index(j,i)
+                    match_lsm = surf_lsm_h(0)%start_index(j,i) <= surf_lsm_h(0)%end_index(j,i)
 
                     IF ( match_lsm )  THEN
-                       mm = surf_lsm_h%start_index(j,i)
-                       vmea(l)%measured_vars_soil(m,n) = m_soil_h%var_2d(k,mm)
+                       mm = surf_lsm_h(0)%start_index(j,i)
+                       vmea(l)%measured_vars_soil(m,n) = m_soil_h(0)%var_2d(k,mm)
                     ENDIF
 
@@ -2897,9 +2900,9 @@
                        vmea(l)%measured_vars(m,n) = surf_def_h(0)%pt_surface(mm)
                     ENDDO
-                    DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_lsm_h%pt_surface(mm)
-                    ENDDO
-                    DO  mm = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                       vmea(l)%measured_vars(m,n) = surf_usm_h%pt_surface(mm)
+                    DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_lsm_h(0)%pt_surface(mm)
+                    ENDDO
+                    DO  mm = surf_usm_h(0)%start_index(j,i), surf_usm_h(0)%end_index(j,i)
+                       vmea(l)%measured_vars(m,n) = surf_usm_h(0)%pt_surface(mm)
                     ENDDO
                  ENDDO
@@ -2935,7 +2938,7 @@
                     i = MERGE( i           , nxr, i            < nxr )
 
-                    DO  mm = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                       IF ( surf_lsm_h%water_surface(m) )                                          &
-                            vmea(l)%measured_vars(m,n) = t_soil_h%var_2d(nzt,m)
+                    DO  mm = surf_lsm_h(0)%start_index(j,i), surf_lsm_h(0)%end_index(j,i)
+                       IF ( surf_lsm_h(0)%water_surface(m) )                                          &
+                            vmea(l)%measured_vars(m,n) = t_soil_h(0)%var_2d(nzt,m)
                     ENDDO
 
Index: palm/trunk/SOURCE/write_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/write_restart_data_mod.f90	(revision 4670)
+++ palm/trunk/SOURCE/write_restart_data_mod.f90	(revision 4671)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Implementation of downward facing USM and LSM surfaces
+! 
+! 4564 2020-06-12 14:03:36Z raasch
 ! Vertical nesting method of Huq et al. (2019) removed
 ! 
@@ -184,5 +187,5 @@
     INTEGER ::  i                                !< loop index
 
-    binary_version_global = '5.0'
+    binary_version_global = '5.1'
 
     IF ( restart_data_format_output == 'fortran_binary' )  THEN
@@ -1161,5 +1164,5 @@
 !
 !-- Write arrays.
-    binary_version_local = '5.0'
+    binary_version_local = '5.1'
 
     IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
Index: palm/trunk/TESTS/cases/urban_environment/INPUT/urban_environment_p3d
===================================================================
--- palm/trunk/TESTS/cases/urban_environment/INPUT/urban_environment_p3d	(revision 4670)
+++ palm/trunk/TESTS/cases/urban_environment/INPUT/urban_environment_p3d	(revision 4671)
@@ -182,5 +182,4 @@
  &urban_surface_parameters
 
-    usm_material_model     = .T.,
     usm_wall_mod = .T.,
 
Index: palm/trunk/TESTS/cases/urban_environment_restart/INPUT/urban_environment_restart_p3dr
===================================================================
--- palm/trunk/TESTS/cases/urban_environment_restart/INPUT/urban_environment_restart_p3dr	(revision 4670)
+++ palm/trunk/TESTS/cases/urban_environment_restart/INPUT/urban_environment_restart_p3dr	(revision 4671)
@@ -181,5 +181,4 @@
  &urban_surface_parameters
 
-    usm_material_model     = .T.,
     usm_wall_mod = .T.,
 
Index: palm/trunk/TESTS/cases/urban_environment_salsa/INPUT/urban_environment_salsa_p3d
===================================================================
--- palm/trunk/TESTS/cases/urban_environment_salsa/INPUT/urban_environment_salsa_p3d	(revision 4670)
+++ palm/trunk/TESTS/cases/urban_environment_salsa/INPUT/urban_environment_salsa_p3d	(revision 4671)
@@ -167,5 +167,4 @@
  &urban_surface_parameters
 
-    usm_material_model     = .T.,
     usm_wall_mod = .T.,
 
