Index: /palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 2332)
+++ /palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 2333)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! minor bugfixes
+! 
+! 2332 2017-08-03 21:15:22Z maronga
 ! bugfix in pavement_pars
 ! 
@@ -1267,4 +1270,41 @@
     ENDDO
  
+!
+!-- Calculate grid spacings. Temperature and moisture are defined at
+!-- the center of the soil layers, whereas gradients/fluxes are 
+!-- defined at the edges (_layer)
+!
+!-- Allocate global 1D arrays
+    ALLOCATE ( ddz_soil_center(nzb_soil:nzt_soil) )
+    ALLOCATE ( ddz_soil(nzb_soil:nzt_soil+1) )
+    ALLOCATE ( dz_soil_center(nzb_soil:nzt_soil) )
+    ALLOCATE ( zs(nzb_soil:nzt_soil+1) )
+
+    zs(nzb_soil) = 0.5_wp * dz_soil(nzb_soil)
+    zs_layer(nzb_soil) = dz_soil(nzb_soil)
+
+    DO  k = nzb_soil+1, nzt_soil
+       zs_layer(k) = zs_layer(k-1) + dz_soil(k)
+       zs(k) = (zs_layer(k) +  zs_layer(k-1)) * 0.5_wp
+    ENDDO
+
+    dz_soil(nzt_soil+1) = zs_layer(nzt_soil) + dz_soil(nzt_soil)
+    zs(nzt_soil+1) = zs_layer(nzt_soil) + 0.5_wp * dz_soil(nzt_soil)
+ 
+    DO  k = nzb_soil, nzt_soil-1
+       dz_soil_center(k) = zs(k+1) - zs(k)
+       IF ( dz_soil_center(k) == 0.0_wp )  THEN
+          message_string = 'invalid soil layer configuration found ' //     &
+                           '(dz_soil_center(k) = 0.0)'
+          CALL message( 'lsm_read_restart_data', 'PA0140', 1, 2, 0, 6, 0 )
+       ENDIF  
+    ENDDO
+  
+    dz_soil_center(nzt_soil) = zs_layer(k-1) + dz_soil(k) - zs(nzt_soil)
+       
+    ddz_soil_center = 1.0_wp / dz_soil_center
+    ddz_soil = 1.0_wp / dz_soil
+
+
  END SUBROUTINE lsm_check_parameters
  
@@ -2106,78 +2146,4 @@
           ENDIF      
        ENDDO
-
-
-
-!
-!--    Calculate grid spacings. Temperature and moisture are defined at
-!--    the center of the soil layers, whereas gradients/fluxes are 
-!--    defined at the edges (_layer)
-       zs(nzb_soil) = 0.5_wp * dz_soil(nzb_soil)
-       zs_layer(nzb_soil) = dz_soil(nzb_soil)
-
-       DO  k = nzb_soil+1, nzt_soil
-          zs_layer(k) = zs_layer(k-1) + dz_soil(k)
-          zs(k) = (zs_layer(k) +  zs_layer(k-1)) * 0.5_wp
-
-       ENDDO
-
-       dz_soil(nzt_soil+1) = zs_layer(nzt_soil) + dz_soil(nzt_soil)
-       zs(nzt_soil+1) = zs_layer(nzt_soil) + 0.5_wp * dz_soil(nzt_soil)
- 
-       DO  k = nzb_soil, nzt_soil-1
-          dz_soil_center(k) = zs(k+1) - zs(k)
-          
-          IF ( dz_soil_center(k) == 0.0_wp )  THEN
-             message_string = 'invalid soil layer configuration found ' //     &
-                              '(dz_soil_center(k) = 0.0)'
-             CALL message( 'lsm_read_restart_data', 'PA0140', 1, 2, 0, 6, 0 )
-          ENDIF  
-       ENDDO
-  
-       dz_soil_center(nzt_soil) = zs_layer(k-1) + dz_soil(k) - zs(nzt_soil)
-
-       IF ( myid == 0 )  THEN
-          PRINT*, "zs:", zs
-          PRINT*, "zs_layer:", zs_layer
-          PRINT*, "dz_soil:", dz_soil
-          PRINT*, "dz_soil_center:", dz_soil_center
-       ENDIF
-
-       
-       ddz_soil_center       = 1.0_wp / dz_soil_center
-       ddz_soil = 1.0_wp / dz_soil
-
-
-
-
-
-
-!        DO  k = nzb_soil, nzt_soil-1
-!           dz_soil_center(k) = zs(k+1) - zs(k)
-!           
-!           IF ( dz_soil_center(k) == 0.0_wp )  THEN
-!              message_string = 'invalid soil layer configuration found ' //     &
-!                               '(dz_soil_center(k) = 0.0)'
-!              CALL message( 'lsm_read_restart_data', 'PA0140', 1, 2, 0, 6, 0 )
-!           ENDIF
-!           
-!        ENDDO
-! 
-!        dz_soil(nzb_soil) = 2.0_wp * zs(nzb_soil)
-!        zs_layer(nzb_soil)      = 2.0_wp * zs(nzb_soil)
-!   
-!        DO  k = nzb_soil+1, nzt_soil
-!           dz_soil(k) = ( zs(k) - zs_layer(k-1) ) * 2.0_wp
-!           zs_layer(k) = zs_layer(k-1) + dz_soil(k)
-!        ENDDO
-!        dz_soil(nzt_soil+1) = 0.5_wp * dz_soil(nzt_soil)
-!        dz_soil_center(nzt_soil) = zs_layer(k-1) + dz_soil(k) - zs(nzt_soil)
-! 
-!        
-!        ddz_soil_center       = 1.0_wp / dz_soil_center
-!        ddz_soil = 1.0_wp / dz_soil
-
-
-
 
 !
@@ -2737,12 +2703,5 @@
        INTEGER(iwp) ::  l !< index indicating facing of surface array 
    
-!
-!--    Allocate global 1D arrays
-       ALLOCATE ( ddz_soil_center(nzb_soil:nzt_soil) )
-       ALLOCATE ( ddz_soil(nzb_soil:nzt_soil+1) )
-       ALLOCATE ( dz_soil_center(nzb_soil:nzt_soil) )
        ALLOCATE ( root_extr(nzb_soil:nzt_soil) )
-       ALLOCATE ( zs(nzb_soil:nzt_soil+1) )
-
        root_extr = 0.0_wp 
        
