Index: palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- palm/trunk/SOURCE/read_var_list.f90	(revision 146)
+++ palm/trunk/SOURCE/read_var_list.f90	(revision 147)
@@ -8,5 +8,5 @@
 ! hom_sum, volume_flow_area, volume_flow_initial moved from
 ! read_3d_binary to here,
-! routine skip_var_list added at the end
+! routines read_parts_of_var_list and skip_var_list added at the end
 !
 ! Former revisions:
@@ -148,6 +148,7 @@
     READ ( 13 )  statistic_regions
     IF ( .NOT. ALLOCATED( ug ) )  THEN
-       ALLOCATE( ug(0:nz+1), u_init(0:nz+1), vg(0:nz+1), v_init(0:nz+1), & 
-                 pt_init(0:nz+1), q_init(0:nz+1), sa_init(0:nz+1),       &
+       ALLOCATE( lad(0:nz+1), ug(0:nz+1), u_init(0:nz+1), vg(0:nz+1),    &
+                 v_init(0:nz+1), pt_init(0:nz+1), q_init(0:nz+1),        &
+                 sa_init(0:nz+1),                                        &
                  hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),  &
                  hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
@@ -314,6 +315,8 @@
           CASE ( 'nx' )
              READ ( 13 )  nx
+             nx_on_file = nx
           CASE ( 'ny' )
              READ ( 13 )  ny
+             ny_on_file = ny
           CASE ( 'ocean' )
              READ ( 13 )  ocean
@@ -542,4 +545,174 @@
 
 
+ SUBROUTINE read_parts_of_var_list
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+! Skipping the global control variables from restart-file (binary format)
+! except some informations needed when reading restart data from a previous
+! run which used a smaller total domain.
+!------------------------------------------------------------------------------!
+
+    USE control_parameters
+    USE indices
+    USE pegrid
+    USE statistics
+
+    IMPLICIT NONE
+
+    CHARACTER (LEN=10) ::  version_on_file
+    CHARACTER (LEN=30) ::  variable_chr
+
+    INTEGER ::  idum, max_pr_user_on_file, nz_on_file, &
+                statistic_regions_on_file
+
+    REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  hom_on_file
+
+
+    CALL check_open( 13 )
+
+    WRITE (9,*) 'rpovl: after check open 13'
+    CALL local_flush( 9 )
+    READ ( 13 )  version_on_file
+
+!
+!-- Read number of PEs and horizontal index bounds of all PEs used in previous
+!-- run
+    READ ( 13 )  variable_chr
+    IF ( TRIM( variable_chr ) /= 'numprocs' )  THEN
+       PRINT*, '+++ read_parts_of_var_list: numprocs not found in data from ', &
+                    'prior run on PE ', myid
+       CALL local_stop
+    ENDIF
+    READ ( 13 )  numprocs_previous_run
+
+    IF ( .NOT. ALLOCATED( hor_index_bounds_previous_run ) )  THEN
+       ALLOCATE( hor_index_bounds_previous_run(4,0:numprocs_previous_run-1) )
+    ENDIF
+
+    READ ( 13 )  variable_chr
+    IF ( TRIM( variable_chr ) /= 'hor_index_bounds' )  THEN
+       PRINT*, '+++ read_parts_of_var_list: hor_index_bounds not found in da', &
+                    'ta from prior run on PE ', myid
+       CALL local_stop
+    ENDIF
+    READ ( 13 )  hor_index_bounds_previous_run
+
+!
+!-- Read vertical number of gridpoints and number of different areas used
+!-- for computing statistics. Allocate arrays depending on these values,
+!-- which are needed for the following read instructions.
+    READ ( 13 )  variable_chr
+    IF ( TRIM( variable_chr ) /= 'nz' )  THEN
+       PRINT*, '+++ read_parts_of_var_list: nz not found in restart data file'
+       CALL local_stop
+    ENDIF
+    READ ( 13 )  nz_on_file
+    IF ( nz_on_file /= nz )  THEN
+       IF ( myid == 0 )  THEN
+          PRINT*, '+++ read_parts_of_var_list: mismatch concerning number of', &
+                       ' gridpoints along z'
+          PRINT*, '                   nz on file    = "', nz_on_file, '"'
+          PRINT*, '                   nz from run   = "', nz, '"'
+       ENDIF
+       CALL local_stop
+    ENDIF
+
+    READ ( 13 )  variable_chr
+    IF ( TRIM( variable_chr ) /= 'max_pr_user' )  THEN
+       PRINT*, '+++ read_parts_of_var_list: max_pr_user not found in restart', &
+                    ' data file'
+       CALL local_stop
+    ENDIF
+    READ ( 13 )  max_pr_user_on_file
+    IF ( max_pr_user_on_file > max_pr_user )  THEN
+       IF ( myid == 0 )  THEN
+          PRINT*, '+++ read_parts_of_var_list: too many user profiles on res', &
+                       'tart data file'
+          PRINT*, '                   max_pr_user on file    = "', &
+                  max_pr_user_on_file, '"'
+          PRINT*, '                   max_pr_user from run   = "', &
+                  max_pr_user, '"'
+       ENDIF
+       CALL local_stop
+    ENDIF
+
+    READ ( 13 )  variable_chr
+    IF ( TRIM( variable_chr ) /= 'statistic_regions' )  THEN
+       PRINT*, '+++ read_var_list: statistic_regions not found in restart da', &
+                    'ta file'
+       CALL local_stop
+    ENDIF
+    READ ( 13 )  statistic_regions_on_file
+    IF ( statistic_regions_on_file > statistic_regions )  THEN
+       IF ( myid == 0 )  THEN
+          PRINT*, '+++ read_parts_of_var_list: too many statistic regions on', &
+                       ' restart data file'
+          PRINT*, '                   statistic regions on file    = "', &
+                  max_pr_user_on_file, '"'
+          PRINT*, '                   statistic regions from run   = "', &
+                  max_pr_user, '"'
+       ENDIF
+       CALL local_stop
+    ENDIF
+
+
+!
+!-- Now read and check some control parameters and skip the rest
+!-- The total domain of the pre-run must not be smaller than the subdomain
+!-- of the current run, because the mapping of data from the pre-run does
+!-- not work for this case.
+    WRITE (9,*) 'wpovl: begin reading variables'
+    CALL local_flush( 9 )
+    READ ( 13 )  variable_chr
+
+    DO  WHILE ( TRIM( variable_chr ) /= '*** end ***' )
+
+       SELECT CASE ( TRIM( variable_chr ) )
+
+          CASE ( 'hom' )
+             ALLOCATE( hom_on_file(0:nz+1,2,pr_palm+max_pr_user_on_file, &
+                       0:statistic_regions_on_file) )
+             READ ( 13 )  hom_on_file
+             hom = hom_on_file(:,:,1:pr_palm+max_pr_user,0:statistic_regions)
+             DEALLOCATE( hom_on_file )
+
+          CASE ( 'nx' )
+             READ ( 13 )  nx_on_file
+             IF ( nx_on_file < ( nxr - nxl ) )  THEN
+                PRINT*, '+++ read_parts_of_var_list: total domain along x on', &
+                             ' restart file is smaller than current subdomain'
+                PRINT*, '                            nx on file = ', nx_on_file
+                PRINT*, '                            nxr - nxl  = ', nxr - nxl
+                CALL local_stop
+             ENDIF
+
+          CASE ( 'ny' )
+             READ ( 13 )  ny_on_file
+             IF ( ny_on_file < ( nyn - nys ) )  THEN
+                PRINT*, '+++ read_parts_of_var_list: total domain along y on', &
+                             ' restart file is smaller than current subdomain'
+                PRINT*, '                            ny on file = ', ny_on_file
+                PRINT*, '                            nyn - nys  = ', nyn - nys
+                CALL local_stop
+             ENDIF
+
+
+          CASE DEFAULT
+
+             READ ( 13 )  idum
+
+       END SELECT
+
+       READ ( 13 )  variable_chr
+
+    ENDDO
+
+
+ END SUBROUTINE read_parts_of_var_list
+
+
+
  SUBROUTINE skip_var_list
 
@@ -550,4 +723,6 @@
 !------------------------------------------------------------------------------!
 
+    IMPLICIT NONE
+
     CHARACTER (LEN=10) ::  version_on_file
     CHARACTER (LEN=30) ::  variable_chr
@@ -556,14 +731,24 @@
 
 
+    WRITE (9,*) 'skipvl #1'
+    CALL local_flush( 9 )
     READ ( 13 )  version_on_file
 
-    READ ( 13 )  variable_chr
+    WRITE (9,*) 'skipvl before variable_chr'
+    CALL local_flush( 9 )
+    READ ( 13 )  variable_chr
+    WRITE (9,*) 'skipvl after variable_chr'
+    CALL local_flush( 9 )
 
     DO  WHILE ( TRIM( variable_chr ) /= '*** end ***' )
 
+    WRITE (9,*) 'skipvl chr = ', variable_chr
+    CALL local_flush( 9 )
        READ ( 13 )  idum
        READ ( 13 )  variable_chr
 
     ENDDO
+    WRITE (9,*) 'skipvl last'
+    CALL local_flush( 9 )
 
 
