Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 3090)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 3091)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Add check for local roughness length not exceeding surface-layer height and
+! limit roughness length where necessary.
+! 
+! 3051 2018-05-30 17:43:55Z suehring
 ! Bugfix in surface-element loops for pavement surfaces 
 ! 
@@ -4499,5 +4503,5 @@
 !
 !--    Finally, make some consistency checks. 
-!--    Ceck for eck for illegal combination of LAI and vegetation coverage.
+!--    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 ) &
@@ -4517,4 +4521,37 @@
           ENDIF
        ENDDO
+!
+!--    Check if roughness length exceed surface-layer height and decrease 
+!--    local roughness length where necessary. 
+       DO  m = 1, surf_lsm_h%ns
+          IF ( surf_lsm_h%z0(m) >= surf_lsm_h%z_mo(m) )  THEN
+          
+             surf_lsm_h%z0(m) = 0.9_wp * surf_lsm_h%z_mo(m)
+             
+             WRITE( message_string, * ) 'z0 exceeds surface-layer height ' //  &
+                            'at horizontal natural surface and is ' //         &
+                            'decreased appropriately at grid point (i,j) = ',  &
+                            surf_lsm_h%i(m), surf_lsm_h%j(m)
+             CALL message( 'land_surface_model_mod', 'PA0503',                 &
+                            0, 0, 0, 6, 0 )
+          ENDIF
+       ENDDO
+       
+       DO  l = 0, 3
+          DO  m = 1, surf_lsm_v(l)%ns
+             IF ( surf_lsm_v(l)%z0(m) >= surf_lsm_v(l)%z_mo(m) )  THEN
+          
+                surf_lsm_v(l)%z0(m) = 0.9_wp * surf_lsm_v(l)%z_mo(m)
+             
+                WRITE( message_string, * ) 'z0 exceeds surface-layer height '//&
+                            'at vertical natural surface and is ' //           &
+                            'decreased appropriately at grid point (i,j) = ',  &
+                            surf_lsm_v(l)%i(m)+surf_lsm_v(l)%ioff,             &
+                            surf_lsm_v(l)%j(m)+surf_lsm_v(l)%joff
+                CALL message( 'land_surface_model_mod', 'PA0503',              &
+                            0, 0, 0, 6, 0 )
+             ENDIF
+          ENDDO
+       ENDDO      
 
 
Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3090)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3091)
@@ -28,4 +28,9 @@
 ! -----------------
 ! $Id$
+! - Limit aerodynamic resistance at vertical walls.
+! - Add check for local roughness length not exceeding surface-layer height and
+!   limit roughness length where necessary.
+! 
+! 3065 2018-06-12 07:03:02Z Giersch
 ! Unused array dxdir was removed, dz was replaced by dzu to consider vertical
 ! grid stretching
@@ -4577,4 +4582,38 @@
             ENDIF
         ENDIF
+!
+!--    Check for consistent initialization.
+!--    Check if roughness length 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, 0, 6, 0 )
+          ENDIF
+       ENDDO
+       
+       DO  l = 0, 3
+          DO  m = 1, surf_usm_v(l)%ns
+             IF ( surf_usm_v(l)%z0(m) >= surf_usm_v(l)%z_mo(m) )  THEN
+          
+                surf_usm_v(l)%z0(m) = 0.9_wp * surf_usm_v(l)%z_mo(m)
+             
+                WRITE( message_string, * ) 'z0 exceeds surface-layer height '//&
+                            'at vertical urban surface and is ' //             &
+                            'decreased appropriately at grid point (i,j) = ',  &
+                            surf_usm_v(l)%i(m)+surf_usm_v(l)%ioff,             &
+                            surf_usm_v(l)%j(m)+surf_usm_v(l)%joff
+                CALL message( 'urban_surface_model_mod', 'PA0503',             &
+                            0, 0, 0, 6, 0 )
+             ENDIF
+          ENDDO
+       ENDDO    
 
 !--     Intitialization of the surface and wall/ground/roof temperature
@@ -7464,5 +7503,9 @@
                               0.01_wp ) )                                      &
                            )  - 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          
+                           
              f_shf         = rho_cp / surf_usm_v(l)%r_a(m)
              f_shf_window  = rho_cp / surf_usm_v(l)%r_a(m)
@@ -7489,5 +7532,5 @@
                                      lambda_surface_window * t_window_v(l)%t(nzb_wall,m)
 
-              coef_green_1 = surf_usm_v(l)%rad_net_l(m) +                            & ! coef +1 corresponds to -lwout included in calculation of radnet_l
+              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(ind_pav_green,m) *&
                                      sigma_sb * t_surf_green_v(l)%t(m) ** 4 +  &  
