Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4356)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4360)
@@ -15,5 +15,5 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2019 Leibniz Universitaet Hannover
+! Copyright 1997-2020 Leibniz Universitaet Hannover
 !------------------------------------------------------------------------------!
 !
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Fix wrong location string in message call
+! 
+! 4356 2019-12-20 17:09:33Z suehring
 ! Correct single message calls, local checks must be given by the respective
 ! mpi rank.
@@ -1525,5 +1528,5 @@
           message_string = 'invalid soil layer configuration found ' //        &
                            '(dz_soil_center(k) <= 0.0)'
-          CALL message( 'lsm_rrd_local', 'PA0140', 1, 2, 0, 6, 0 )
+          CALL message( 'lsm_check_parameters', 'PA0140', 1, 2, 0, 6, 0 )
        ENDIF  
     ENDDO
@@ -4860,5 +4863,5 @@
           message_string = 'For non-pavement surfaces the combination ' //     &
                            ' lai = 0.0 and c_veg = 1.0 is not allowed.'
-          CALL message( 'lsm_rrd_local', 'PA0671', 2, 2, myid, 6, 0 )
+          CALL message( 'lsm_init', 'PA0671', 2, 2, myid, 6, 0 )
        ENDIF
 
@@ -4869,5 +4872,5 @@
              message_string = 'For non-pavement surfaces the combination ' //  &
                               ' lai = 0.0 and c_veg = 1.0 is not allowed.'
-             CALL message( 'lsm_rrd_local', 'PA0671', 2, 2, myid, 6, 0 )
+             CALL message( 'lsm_init', 'PA0671', 2, 2, myid, 6, 0 )
           ENDIF
        ENDDO
@@ -6590,5 +6593,5 @@
 !> Soubroutine reads lsm data from restart file(s)
 !------------------------------------------------------------------------------!
-SUBROUTINE lsm_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,              &
+ SUBROUTINE lsm_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,              &
                           nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,    &
                           nys_on_file, tmp_2d, found )
@@ -6643,288 +6646,174 @@
 
 
-       SELECT CASE ( restart_string(1:length) )
-
-           CASE ( 'ns_h_on_file_lsm' )
-              IF ( k == 1 )  THEN  
-                 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 ) 
-
-!
-!--              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)  )
-
-              ENDIF
-
-           CASE ( 'ns_v_on_file_lsm' )
-              IF ( k == 1 )  THEN
-                 READ ( 13 ) ns_v_on_file_lsm
-
-                 DO  l = 0, 3
-                    IF ( ALLOCATED( tmp_walltype_v_1d(l)%var_1d ) )            &
-                       DEALLOCATE( tmp_walltype_v_1d(l)%var_1d )
-                    IF ( ALLOCATED( tmp_walltype_v_2d(l)%var_2d ) )            &
-                       DEALLOCATE( tmp_walltype_v_2d(l)%var_2d )
-                    IF ( ALLOCATED( tmp_walltype_v_2d2(l)%var_2d ) )           &
-                       DEALLOCATE( tmp_walltype_v_2d2(l)%var_2d )
-                 ENDDO
-
-!
-!--              Allocate temporary arrays to store surface data
-                 DO  l = 0, 3
-                    ALLOCATE( tmp_walltype_v_1d(l)                             &
-                                 %var_1d(1:ns_v_on_file_lsm(l)) )
-                    ALLOCATE( tmp_walltype_v_2d(l)                             &
-                                 %var_2d(nzb_soil:nzt_soil+1,                  &
-                                         1:ns_v_on_file_lsm(l)) )
-                    ALLOCATE( tmp_walltype_v_2d2(l)                            &
-                                 %var_2d(nzb_soil:nzt_soil,                    &
-                                         1:ns_v_on_file_lsm(l))  )
-                 ENDDO
-
-              ENDIF
-
-
-           CASE ( 'c_liq_av' )
-              IF ( .NOT. ALLOCATED( c_liq_av ) )  THEN
-                 ALLOCATE( c_liq_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              c_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 'c_soil_av' )
-              IF ( .NOT. ALLOCATED( c_soil_av ) )  THEN
-                 ALLOCATE( c_soil_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              c_soil_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 'c_veg_av' )
-              IF ( .NOT. ALLOCATED( c_veg_av ) )  THEN
-                 ALLOCATE( c_veg_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              c_veg_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 'lai_av' )
-              IF ( .NOT. ALLOCATED( lai_av ) )  THEN
-                 ALLOCATE( lai_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              lai_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 'm_liq_av' )
-              IF ( .NOT. ALLOCATED( m_liq_av ) )  THEN
-                 ALLOCATE( m_liq_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              m_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 'm_soil_av' )
-              IF ( .NOT. ALLOCATED( m_soil_av ) )  THEN
-                 ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
-              ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)
-              m_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
-                 tmp_3d(nzb_soil:nzt_soil,nysf                                 &
-                        -nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 'qsws_liq_av' )
-              IF ( .NOT. ALLOCATED( qsws_liq_av ) )  THEN
-                 ALLOCATE( qsws_liq_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF  
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              qsws_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =          &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-           CASE ( 'qsws_soil_av' )
-              IF ( .NOT. ALLOCATED( qsws_soil_av ) )  THEN
-                 ALLOCATE( qsws_soil_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF  
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              qsws_soil_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =         &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 'qsws_veg_av' )
-              IF ( .NOT. ALLOCATED( qsws_veg_av ) )  THEN
-                 ALLOCATE( qsws_veg_av(nysg:nyng,nxlg:nxrg) )
-              ENDIF  
-              IF ( k == 1 )  READ ( 13 )  tmp_2d
-              qsws_veg_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =          &
-                 tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-           CASE ( 't_soil_av' )
-              IF ( .NOT. ALLOCATED( t_soil_av ) )  THEN
-                 ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
-              ENDIF
-              IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)
-              t_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
-                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-                 
-           CASE ( 'lsm_start_index_h', 'lsm_start_index_v'  )   
-                IF ( k == 1 )  THEN
-
-                   IF ( ALLOCATED( start_index_on_file ) )                     &
-                      DEALLOCATE( start_index_on_file )
-
-                   ALLOCATE ( start_index_on_file(nys_on_file:nyn_on_file,     &
-                   nxl_on_file:nxr_on_file) )
-
-                   READ ( 13 )  start_index_on_file
-
-                ENDIF
-                 
-           CASE ( 'lsm_end_index_h', 'lsm_end_index_v' )   
-                IF ( k == 1 )  THEN
-
-                   IF ( ALLOCATED( end_index_on_file ) )                       &
-                      DEALLOCATE( end_index_on_file )
-
-                   ALLOCATE ( end_index_on_file(nys_on_file:nyn_on_file,       &
-                      nxl_on_file:nxr_on_file) )
-
-                   READ ( 13 )  end_index_on_file
-
-                ENDIF
-           
-           CASE ( 't_soil_h' )
-            
-              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
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                         t_soil_h%var_2d,                      &
-                                         tmp_walltype_h_2d%var_2d,             &
-                                         surf_lsm_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_soil_v(0)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_soil_v(0)%var_2d ) )                 &
-                    ALLOCATE( t_soil_v(0)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(0)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d(0)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_soil_v(0)%var_2d,                      &
-                                      tmp_walltype_v_2d(0)%var_2d,             &
-                                      surf_lsm_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_soil_v(1)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_soil_v(1)%var_2d ) )                 &
-                    ALLOCATE( t_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(1)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d(1)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_soil_v(1)%var_2d,                      &
-                                      tmp_walltype_v_2d(1)%var_2d,             &
-                                      surf_lsm_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_soil_v(2)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_soil_v(2)%var_2d ) )                 &
-                    ALLOCATE( t_soil_v(2)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(2)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d(2)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_soil_v(2)%var_2d,                      &
-                                      tmp_walltype_v_2d(2)%var_2d,             &
-                                      surf_lsm_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_soil_v(3)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_soil_v(3)%var_2d ) )                 &
-                    ALLOCATE( t_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(3)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d(3)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_soil_v(3)%var_2d,                      &
-                                      tmp_walltype_v_2d(3)%var_2d,             &
-                                      surf_lsm_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_soil_h' )
-            
-              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
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                        m_soil_h%var_2d,                       &
-                                        tmp_walltype_h_2d2%var_2d,             &
-                                        surf_lsm_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 ( 'm_soil_v(0)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_soil_v(0)%var_2d ) )                 &
-                    ALLOCATE( m_soil_v(0)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(0)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d2(0)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                     m_soil_v(0)%var_2d,                       & 
-                                     tmp_walltype_v_2d2(0)%var_2d,             &
-                                     surf_lsm_v(0)%start_index,                & 
+    SELECT CASE ( restart_string(1:length) )
+
+       CASE ( 'ns_h_on_file_lsm' )
+          IF ( k == 1 )  THEN  
+             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 )                        
+                                                                               
+!                                                                              
+!--          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)  )                                  
+                                                                               
+          ENDIF                                                                
+                                                                               
+       CASE ( 'ns_v_on_file_lsm' )                                             
+          IF ( k == 1 )  THEN                                                  
+             READ ( 13 ) ns_v_on_file_lsm                                      
+                                                                               
+             DO  l = 0, 3                                                      
+                IF ( ALLOCATED( tmp_walltype_v_1d(l)%var_1d ) )                &
+                   DEALLOCATE( tmp_walltype_v_1d(l)%var_1d )                   
+                IF ( ALLOCATED( tmp_walltype_v_2d(l)%var_2d ) )                &
+                   DEALLOCATE( tmp_walltype_v_2d(l)%var_2d )                   
+                IF ( ALLOCATED( tmp_walltype_v_2d2(l)%var_2d ) )               &
+                   DEALLOCATE( tmp_walltype_v_2d2(l)%var_2d )                  
+             ENDDO                                                             
+                                                                               
+!                                                                              
+!--          Allocate temporary arrays to store surface data                   
+             DO  l = 0, 3                                                      
+                ALLOCATE( tmp_walltype_v_1d(l)                                 &
+                             %var_1d(1:ns_v_on_file_lsm(l)) )                  
+                ALLOCATE( tmp_walltype_v_2d(l)                                 &
+                             %var_2d(nzb_soil:nzt_soil+1,                      &
+                                     1:ns_v_on_file_lsm(l)) )                  
+                ALLOCATE( tmp_walltype_v_2d2(l)                                &
+                             %var_2d(nzb_soil:nzt_soil,                        &
+                                     1:ns_v_on_file_lsm(l))  )                 
+             ENDDO                                                             
+                                                                               
+          ENDIF                                                                
+                                                                               
+                                                                               
+       CASE ( 'c_liq_av' )                                                     
+          IF ( .NOT. ALLOCATED( c_liq_av ) )  THEN                             
+             ALLOCATE( c_liq_av(nysg:nyng,nxlg:nxrg) )                         
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          c_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                  &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+                                                                               
+       CASE ( 'c_soil_av' )                                                    
+          IF ( .NOT. ALLOCATED( c_soil_av ) )  THEN                            
+             ALLOCATE( c_soil_av(nysg:nyng,nxlg:nxrg) )                        
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          c_soil_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                 &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+                                                                               
+       CASE ( 'c_veg_av' )                                                     
+          IF ( .NOT. ALLOCATED( c_veg_av ) )  THEN                             
+             ALLOCATE( c_veg_av(nysg:nyng,nxlg:nxrg) )                         
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          c_veg_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                  &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+                                                                               
+       CASE ( 'lai_av' )                                                       
+          IF ( .NOT. ALLOCATED( lai_av ) )  THEN                               
+             ALLOCATE( lai_av(nysg:nyng,nxlg:nxrg) )                           
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          lai_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                    &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+                                                                               
+       CASE ( 'm_liq_av' )                                                     
+          IF ( .NOT. ALLOCATED( m_liq_av ) )  THEN                             
+             ALLOCATE( m_liq_av(nysg:nyng,nxlg:nxrg) )                         
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          m_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                  &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+                                                                               
+       CASE ( 'm_soil_av' )                                                    
+          IF ( .NOT. ALLOCATED( m_soil_av ) )  THEN                            
+             ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )      
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)                            
+          m_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =               &
+             tmp_3d(nzb_soil:nzt_soil,nysf                                     &
+                    -nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                       
+                                                                               
+       CASE ( 'qsws_liq_av' )                                                  
+          IF ( .NOT. ALLOCATED( qsws_liq_av ) )  THEN                          
+             ALLOCATE( qsws_liq_av(nysg:nyng,nxlg:nxrg) )                      
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          qsws_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =              &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+       CASE ( 'qsws_soil_av' )                                                 
+          IF ( .NOT. ALLOCATED( qsws_soil_av ) )  THEN                         
+             ALLOCATE( qsws_soil_av(nysg:nyng,nxlg:nxrg) )                     
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          qsws_soil_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =             &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+                                                                               
+       CASE ( 'qsws_veg_av' )                                                  
+          IF ( .NOT. ALLOCATED( qsws_veg_av ) )  THEN                          
+             ALLOCATE( qsws_veg_av(nysg:nyng,nxlg:nxrg) )                      
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
+          qsws_veg_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =              &
+             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
+                                                                               
+       CASE ( 't_soil_av' )                                                    
+          IF ( .NOT. ALLOCATED( t_soil_av ) )  THEN                            
+             ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )      
+          ENDIF                                                                
+          IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)                            
+          t_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =               &
+             tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                 
+                                                                               
+       CASE ( 'lsm_start_index_h', 'lsm_start_index_v'  )                      
+            IF ( k == 1 )  THEN                                                
+                                                                               
+               IF ( ALLOCATED( start_index_on_file ) )                         &
+                  DEALLOCATE( start_index_on_file )                            
+                                                                               
+               ALLOCATE ( start_index_on_file(nys_on_file:nyn_on_file,         &
+               nxl_on_file:nxr_on_file) )                                      
+                                                                               
+               READ ( 13 )  start_index_on_file                                
+                                                                               
+            ENDIF                                                              
+                                                                               
+       CASE ( 'lsm_end_index_h', 'lsm_end_index_v' )                           
+            IF ( k == 1 )  THEN                                                
+                                                                               
+               IF ( ALLOCATED( end_index_on_file ) )                           &
+                  DEALLOCATE( end_index_on_file )                              
+                                                                               
+               ALLOCATE ( end_index_on_file(nys_on_file:nyn_on_file,           &
+                  nxl_on_file:nxr_on_file) )                                   
+                                                                               
+               READ ( 13 )  end_index_on_file                                  
+                                                                               
+            ENDIF                                                              
+                                                                               
+       CASE ( 't_soil_h' )                                                     
+                                                                               
+          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                             
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                     t_soil_h%var_2d,                          &
+                                     tmp_walltype_h_2d%var_2d,                 &
+                                     surf_lsm_h%start_index,                   & 
                                      start_index_on_file,                      &
                                      end_index_on_file,                        &
@@ -6932,18 +6821,191 @@
                                      nxlf, nxrf, nysf, nynf,                   &
                                      nys_on_file, nyn_on_file,                 &
-                                     nxl_on_file,nxr_on_file )
-
-           CASE ( 'm_soil_v(1)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_soil_v(1)%var_2d ) )                 &
-                    ALLOCATE( m_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(1)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d2(1)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                     m_soil_v(1)%var_2d,                       &    
-                                     tmp_walltype_v_2d2(1)%var_2d,             &
-                                     surf_lsm_v(1)%start_index,                &  
+                                     nxl_on_file,nxr_on_file )                 
+                                                                               
+       CASE ( 't_soil_v(0)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_soil_v(0)%var_2d ) )                     &
+                ALLOCATE( t_soil_v(0)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(0)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d(0)%var_2d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_soil_v(0)%var_2d,                          &
+                                  tmp_walltype_v_2d(0)%var_2d,                 &
+                                  surf_lsm_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_soil_v(1)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_soil_v(1)%var_2d ) )                     &
+                ALLOCATE( t_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(1)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d(1)%var_2d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_soil_v(1)%var_2d,                          &
+                                  tmp_walltype_v_2d(1)%var_2d,                 &
+                                  surf_lsm_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_soil_v(2)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_soil_v(2)%var_2d ) )                     &
+                ALLOCATE( t_soil_v(2)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(2)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d(2)%var_2d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_soil_v(2)%var_2d,                          &
+                                  tmp_walltype_v_2d(2)%var_2d,                 &
+                                  surf_lsm_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_soil_v(3)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_soil_v(3)%var_2d ) )                     &
+                ALLOCATE( t_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(3)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d(3)%var_2d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_soil_v(3)%var_2d,                          &
+                                  tmp_walltype_v_2d(3)%var_2d,                 &
+                                  surf_lsm_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_soil_h' )                                                     
+                                                                               
+          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                            
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                    m_soil_h%var_2d,                           &
+                                    tmp_walltype_h_2d2%var_2d,                 &
+                                    surf_lsm_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 ( 'm_soil_v(0)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_soil_v(0)%var_2d ) )                     &
+                ALLOCATE( m_soil_v(0)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(0)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d2(0)%var_2d                         
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                 m_soil_v(0)%var_2d,                           & 
+                                 tmp_walltype_v_2d2(0)%var_2d,                 &
+                                 surf_lsm_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 ( 'm_soil_v(1)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_soil_v(1)%var_2d ) )                     &
+                ALLOCATE( m_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(1)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d2(1)%var_2d                         
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                 m_soil_v(1)%var_2d,                           &    
+                                 tmp_walltype_v_2d2(1)%var_2d,                 &
+                                 surf_lsm_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 ( 'm_soil_v(2)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_soil_v(2)%var_2d ) )                     &
+                ALLOCATE( m_soil_v(2)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(2)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d2(2)%var_2d                         
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                 m_soil_v(2)%var_2d,                           & 
+                                 tmp_walltype_v_2d2(2)%var_2d,                 &
+                                 surf_lsm_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 ( 'm_soil_v(3)' )                                                  
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_soil_v(3)%var_2d ) )                     &
+                ALLOCATE( m_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
+                                             1:surf_lsm_v(3)%ns) )             
+             READ ( 13 )  tmp_walltype_v_2d2(3)%var_2d                         
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                 m_soil_v(3)%var_2d,                           & 
+                                 tmp_walltype_v_2d2(3)%var_2d,                 &
+                                 surf_lsm_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_h' )                                                      
+                                                                               
+          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                             
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                     m_liq_h%var_1d,                           &
+                                     tmp_walltype_h_1d%var_1d,                 &
+                                     surf_lsm_h%start_index,                   &  
                                      start_index_on_file,                      &
                                      end_index_on_file,                        &
@@ -6951,19 +7013,93 @@
                                      nxlf, nxrf, nysf, nynf,                   &
                                      nys_on_file, nyn_on_file,                 &
-                                     nxl_on_file,nxr_on_file )
-
-
-           CASE ( 'm_soil_v(2)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_soil_v(2)%var_2d ) )                 &
-                    ALLOCATE( m_soil_v(2)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(2)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d2(2)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                     m_soil_v(2)%var_2d,                       & 
-                                     tmp_walltype_v_2d2(2)%var_2d,             &
-                                     surf_lsm_v(2)%start_index,                &   
+                                     nxl_on_file,nxr_on_file )                 
+                                                                               
+                                                                               
+       CASE ( 'm_liq_v(0)' )                                                   
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_liq_v(0)%var_1d ) )                      &
+                ALLOCATE( m_liq_v(0)%var_1d(1:surf_lsm_v(0)%ns) )              
+             READ ( 13 )  tmp_walltype_v_1d(0)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  m_liq_v(0)%var_1d,                           &
+                                  tmp_walltype_v_1d(0)%var_1d,                 &
+                                  surf_lsm_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 ( 'm_liq_v(1)' )                                                   
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_liq_v(1)%var_1d ) )                      &
+                ALLOCATE( m_liq_v(1)%var_1d(1:surf_lsm_v(1)%ns) )              
+             READ ( 13 )  tmp_walltype_v_1d(1)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  m_liq_v(1)%var_1d,                           &
+                                  tmp_walltype_v_1d(1)%var_1d,                 &
+                                  surf_lsm_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 ( 'm_liq_v(2)' )                                                   
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_liq_v(2)%var_1d ) )                      &
+                ALLOCATE( m_liq_v(2)%var_1d(1:surf_lsm_v(2)%ns) )              
+             READ ( 13 )  tmp_walltype_v_1d(2)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  m_liq_v(2)%var_1d,                           &
+                                  tmp_walltype_v_1d(2)%var_1d,                 &
+                                  surf_lsm_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 ( 'm_liq_v(3)' )                                                   
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( m_liq_v(3)%var_1d ) )                      &
+                ALLOCATE( m_liq_v(3)%var_1d(1:surf_lsm_v(3)%ns) )              
+             READ ( 13 )  tmp_walltype_v_1d(3)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  m_liq_v(3)%var_1d,                           &
+                                  tmp_walltype_v_1d(3)%var_1d,                 &
+                                  surf_lsm_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_surface_h' )                                                  
+                                                                               
+          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                             
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                     t_surface_h%var_1d,                       &
+                                     tmp_walltype_h_1d%var_1d,                 &
+                                     surf_lsm_h%start_index,                   & 
                                      start_index_on_file,                      &
                                      end_index_on_file,                        &
@@ -6971,216 +7107,83 @@
                                      nxlf, nxrf, nysf, nynf,                   &
                                      nys_on_file, nyn_on_file,                 &
-                                     nxl_on_file,nxr_on_file )
-
-
-           CASE ( 'm_soil_v(3)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_soil_v(3)%var_2d ) )                 &
-                    ALLOCATE( m_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,          &
-                                                 1:surf_lsm_v(3)%ns) )
-                 READ ( 13 )  tmp_walltype_v_2d2(3)%var_2d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                     m_soil_v(3)%var_2d,                       & 
-                                     tmp_walltype_v_2d2(3)%var_2d,             &
-                                     surf_lsm_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_h' )
-            
-              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
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                         m_liq_h%var_1d,                       &
-                                         tmp_walltype_h_1d%var_1d,             &
-                                         surf_lsm_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 ( 'm_liq_v(0)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_liq_v(0)%var_1d ) )                  &
-                    ALLOCATE( m_liq_v(0)%var_1d(1:surf_lsm_v(0)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(0)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      m_liq_v(0)%var_1d,                       &
-                                      tmp_walltype_v_1d(0)%var_1d,             &
-                                      surf_lsm_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 ( 'm_liq_v(1)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_liq_v(1)%var_1d ) )                  &
-                    ALLOCATE( m_liq_v(1)%var_1d(1:surf_lsm_v(1)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(1)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      m_liq_v(1)%var_1d,                       &
-                                      tmp_walltype_v_1d(1)%var_1d,             &
-                                      surf_lsm_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 ( 'm_liq_v(2)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_liq_v(2)%var_1d ) )                  &
-                    ALLOCATE( m_liq_v(2)%var_1d(1:surf_lsm_v(2)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(2)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      m_liq_v(2)%var_1d,                       &
-                                      tmp_walltype_v_1d(2)%var_1d,             &
-                                      surf_lsm_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 ( 'm_liq_v(3)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( m_liq_v(3)%var_1d ) )                  &
-                    ALLOCATE( m_liq_v(3)%var_1d(1:surf_lsm_v(3)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(3)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      m_liq_v(3)%var_1d,                       &
-                                      tmp_walltype_v_1d(3)%var_1d,             &
-                                      surf_lsm_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_surface_h' )
-            
-              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
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                         t_surface_h%var_1d,                   &
-                                         tmp_walltype_h_1d%var_1d,             &
-                                         surf_lsm_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_surface_v(0)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_surface_v(0)%var_1d ) )              &
-                    ALLOCATE( t_surface_v(0)%var_1d(1:surf_lsm_v(0)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(0)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_surface_v(0)%var_1d,                   &
-                                      tmp_walltype_v_1d(0)%var_1d,             &
-                                      surf_lsm_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_surface_v(1)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_surface_v(1)%var_1d ) )              &
-                    ALLOCATE( t_surface_v(1)%var_1d(1:surf_lsm_v(1)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(1)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_surface_v(1)%var_1d,                   &
-                                      tmp_walltype_v_1d(1)%var_1d,             &
-                                      surf_lsm_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_surface_v(2)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_surface_v(2)%var_1d ) )              &
-                    ALLOCATE( t_surface_v(2)%var_1d(1:surf_lsm_v(2)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(2)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_surface_v(2)%var_1d,                   &
-                                      tmp_walltype_v_1d(2)%var_1d,             &
-                                      surf_lsm_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_surface_v(3)' )
-            
-              IF ( k == 1 )  THEN
-                 IF ( .NOT.  ALLOCATED( t_surface_v(3)%var_1d ) )              &
-                    ALLOCATE( t_surface_v(3)%var_1d(1:surf_lsm_v(3)%ns) )
-                 READ ( 13 )  tmp_walltype_v_1d(3)%var_1d
-              ENDIF
-              CALL surface_restore_elements(                                   &
-                                      t_surface_v(3)%var_1d,                   &
-                                      tmp_walltype_v_1d(3)%var_1d,             &
-                                      surf_lsm_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 DEFAULT
-
-                found = .FALSE.
-
-       END SELECT
+                                     nxl_on_file,nxr_on_file )                 
+                                                                               
+       CASE ( 't_surface_v(0)' )                                               
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_surface_v(0)%var_1d ) )                  &
+                ALLOCATE( t_surface_v(0)%var_1d(1:surf_lsm_v(0)%ns) )          
+             READ ( 13 )  tmp_walltype_v_1d(0)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_surface_v(0)%var_1d,                       &
+                                  tmp_walltype_v_1d(0)%var_1d,                 &
+                                  surf_lsm_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_surface_v(1)' )                                               
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_surface_v(1)%var_1d ) )                  &
+                ALLOCATE( t_surface_v(1)%var_1d(1:surf_lsm_v(1)%ns) )          
+             READ ( 13 )  tmp_walltype_v_1d(1)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_surface_v(1)%var_1d,                       &
+                                  tmp_walltype_v_1d(1)%var_1d,                 &
+                                  surf_lsm_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_surface_v(2)' )                                               
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_surface_v(2)%var_1d ) )                  &
+                ALLOCATE( t_surface_v(2)%var_1d(1:surf_lsm_v(2)%ns) )          
+             READ ( 13 )  tmp_walltype_v_1d(2)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_surface_v(2)%var_1d,                       &
+                                  tmp_walltype_v_1d(2)%var_1d,                 &
+                                  surf_lsm_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_surface_v(3)' )                                               
+                                                                               
+          IF ( k == 1 )  THEN                                                  
+             IF ( .NOT.  ALLOCATED( t_surface_v(3)%var_1d ) )                  &
+                ALLOCATE( t_surface_v(3)%var_1d(1:surf_lsm_v(3)%ns) )          
+             READ ( 13 )  tmp_walltype_v_1d(3)%var_1d                          
+          ENDIF                                                                
+          CALL surface_restore_elements(                                       &
+                                  t_surface_v(3)%var_1d,                       &
+                                  tmp_walltype_v_1d(3)%var_1d,                 &
+                                  surf_lsm_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 DEFAULT
+
+          found = .FALSE.
+
+    END SELECT
 
 
