Index: /palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 3135)
+++ /palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 3136)
@@ -25,7 +25,10 @@
 ! -----------------
 ! $Id$
+! Limit also roughness length for heat and moisture where necessary;
+! Limit surface resistance to positive values
+! 
+! 3133 2018-07-16 11:46:50Z maronga
 ! Bugfix for last commit.
 ! 
-! 3127 2018-07-15 08:01:25Z maronga
 ! Some adjustments for pavement parameters
 ! Limit magnus formula to avoid negative q_s (leads to model crash)
@@ -2150,5 +2153,7 @@
                             (surf%qsws(m) + 1.0E-20)  - surf%r_a(m)
        ENDIF
-
+!
+!--    Limit resistance resistance
+       surf%r_s(m) = MAX( surf%r_s(m), 1.0_wp )
 !
 !--    Calculate change in liquid water reservoir due to dew fall or 
@@ -4531,6 +4536,7 @@
        ENDDO
 !
-!--    Check if roughness length exceed surface-layer height and decrease 
-!--    local roughness length where necessary. 
+!--    Check if roughness length for momentum, heat, or moisture 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
@@ -4543,4 +4549,16 @@
                             surf_lsm_h%i(m), surf_lsm_h%j(m)
              CALL message( 'land_surface_model_mod', 'PA0503',                 &
+                            0, 0, 0, 6, 0 )
+          ENDIF
+          IF ( surf_lsm_h%z0h(m) >= surf_lsm_h%z_mo(m) )  THEN
+          
+             surf_lsm_h%z0h(m) = 0.9_wp * surf_lsm_h%z_mo(m)
+             surf_lsm_h%z0q(m) = 0.9_wp * surf_lsm_h%z_mo(m)
+             
+             WRITE( message_string, * ) 'z0h 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', 'PA0507',                 &
                             0, 0, 0, 6, 0 )
           ENDIF
@@ -4561,8 +4579,19 @@
                             0, 0, 0, 6, 0 )
              ENDIF
+             IF ( surf_lsm_v(l)%z0h(m) >= surf_lsm_v(l)%z_mo(m) )  THEN
+          
+                surf_lsm_v(l)%z0h(m) = 0.9_wp * surf_lsm_v(l)%z_mo(m)
+                surf_lsm_v(l)%z0q(m) = 0.9_wp * surf_lsm_v(l)%z_mo(m)
+             
+                WRITE( message_string, * ) 'z0h 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', 'PA0507',              &
+                            0, 0, 0, 6, 0 )
+             ENDIF
           ENDDO
        ENDDO      
-
-
 
     END SUBROUTINE lsm_init
Index: /palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3135)
+++ /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 3136)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! Limit also roughness length for heat and moisture where necessary
+! 
+! 3123 2018-07-12 16:21:53Z suehring
 ! Correct working precision for INTEGER number
 ! 
@@ -4602,6 +4605,6 @@
 !
 !--    Check for consistent initialization.
-!--    Check if roughness length exceed surface-layer height and decrease 
-!--    local roughness length where necessary. 
+!--    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
@@ -4616,4 +4619,16 @@
                             0, 0, 0, 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, 0, 6, 0 )
+          ENDIF          
        ENDDO
        
@@ -4630,4 +4645,17 @@
                             surf_usm_v(l)%j(m)+surf_usm_v(l)%joff
                 CALL message( 'urban_surface_model_mod', 'PA0503',             &
+                            0, 0, 0, 6, 0 )
+             ENDIF
+             IF ( surf_usm_v(l)%z0h(m) >= surf_usm_v(l)%z_mo(m) )  THEN
+          
+                surf_usm_v(l)%z0h(m) = 0.9_wp * surf_usm_v(l)%z_mo(m)
+                surf_usm_v(l)%z0q(m) = 0.9_wp * surf_usm_v(l)%z_mo(m)
+             
+                WRITE( message_string, * ) 'z0h 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', 'PA0507',             &
                             0, 0, 0, 6, 0 )
              ENDIF
