Index: /palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 215)
+++ /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 216)
@@ -21,4 +21,8 @@
 User interface has been split into single files.
 
+Reading mechanism from restart files completely revised. The subdomain/total
+domain size can vary arbitrarily between current and previous run.
+(read_var_list, read_3d_binary, user_read_restart_data)
+
 Precompilation mechanism (mbuild) completely revised: the source tarfile remains in
 the source directory. One depository per block (given in the config-file) is
@@ -32,9 +36,16 @@
 by this routine step by step within the next revisions.
 
-Makefile, mbuild, mrun, check_parameters, local_stop, modules
+Neumann boundary condition at k=nzb is explicitly set for better reading,
+although this has been already done in boundary_conds. (advec_s_bc)
+
+Origin of the xy-coordinate system shifted from the center of the first
+grid cell (indices i=0, j=0) to the south-left corner of this cell. (netcdf)
+
+Makefile, mbuild, mrun, advec_s_bc, check_parameters, local_stop, modules, netcdf, read_var_list, read_3d_binary, user_read_restart_data
 
 New: handle_palm_message, user_3d_data_averaging user_actions user_advec_particles user_check_data_output user_check_data_output_pr user_data_output_2d user_data_output_3d user_data_output_dvrp user_define_netcdf_grid user_dvrp_coltab user_header user_init user_init_3d_model user_init_grid user_init_particles user_init_plant_canopy user_last_actions user_module user_parin user_particle_attributes user_read_restart_data user_spectra user_statistics
 
 Removed: user_interface
+
 
 Errors:
@@ -57,4 +68,6 @@
 have been started (data_output_2d)
 
+Bugfix: reading of spectrum_x|y from restart files ignored if total numbers
+of grid points do not match (read_3d_binary)
 
-advec_particles, combine_plot_fields, data_output_2d, header, production_e
+advec_particles, combine_plot_fields, data_output_2d, header, production_e, read_3d_binary
Index: /palm/trunk/SOURCE/advec_s_bc.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_bc.f90	(revision 215)
+++ /palm/trunk/SOURCE/advec_s_bc.f90	(revision 216)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Neumann boundary condition at k=nzb is explicitly set for better reading,
+! although this has been already done in boundary_conds
 !
 ! Former revisions:
@@ -728,4 +729,5 @@
           DO  i = nxl, nxr
              DO  j = nys, nyn
+                sk_p(nzb,j,i)   = sk_p(nzb+1,j,i)
                 sk_p(nzb-1,j,i) = sk_p(nzb,j,i)
                 sk_p(nzb-2,j,i) = sk_p(nzb,j,i)
@@ -766,4 +768,5 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             sk_p(nzb,j,i)   = sk_p(nzb+1,j,i)
              sk_p(nzb-1,j,i) = sk_p(nzb,j,i)
              sk_p(nzb-2,j,i) = sk_p(nzb,j,i)
@@ -788,4 +791,5 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             sk_p(nzb,j,i)   = sk_p(nzb+1,j,i)
              sk_p(nzb-1,j,i) = sk_p(nzb,j,i)
              sk_p(nzb-2,j,i) = sk_p(nzb,j,i)
@@ -823,4 +827,5 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             sk_p(nzb,j,i)   = sk_p(nzb+1,j,i)
              sk_p(nzb-1,j,i) = sk_p(nzb,j,i)
              sk_p(nzb-2,j,i) = sk_p(nzb,j,i)
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 215)
+++ /palm/trunk/SOURCE/modules.f90	(revision 216)
@@ -301,5 +301,5 @@
     CHARACTER (LEN=10), DIMENSION(0:1,100) ::  do2d = ' ', do3d = ' '
 
-    INTEGER ::  abort_mode = 0, average_count_pr = 0, average_count_sp = 0, &
+    INTEGER ::  abort_mode = 1, average_count_pr = 0, average_count_sp = 0, &
                 average_count_3d = 0, current_timestep_number = 0, &
                 dist_range = 0, disturbance_level_ind_b, &
Index: /palm/trunk/SOURCE/netcdf.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf.f90	(revision 215)
+++ /palm/trunk/SOURCE/netcdf.f90	(revision 216)
@@ -7,5 +7,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! Origin of the xy-coordinate system shifted from the center of the first
+! grid cell (indices i=0, j=0) to the south-left corner of this cell.
 !
 ! Former revisions:
@@ -457,9 +458,9 @@
 
 !
-!--       Write data for x and xu axis (shifted by -dx/2)
+!--       Write data for x (shifted by +dx/2) and xu axis
           ALLOCATE( netcdf_data(0:nx+1) )
 
           DO  i = 0, nx+1
-             netcdf_data(i) = i * dx
+             netcdf_data(i) = ( i + 0.5 ) * dx
           ENDDO
 
@@ -469,5 +470,5 @@
 
           DO  i = 0, nx+1
-             netcdf_data(i) = ( i - 0.5 ) * dx
+             netcdf_data(i) = i * dx
           ENDDO
 
@@ -480,9 +481,9 @@
 
 !
-!--       Write data for y and yv axis (shifted by -dy/2)
+!--       Write data for y (shifted by +dy/2) and yv axis
           ALLOCATE( netcdf_data(0:ny+1) )
 
           DO  i = 0, ny+1
-             netcdf_data(i) = i * dy
+             netcdf_data(i) = ( i + 0.5 ) * dy
           ENDDO
 
@@ -492,5 +493,5 @@
 
           DO  i = 0, ny+1
-             netcdf_data(i) = ( i - 0.5 ) * dy
+             netcdf_data(i) = i * dy
           ENDDO
 
@@ -1034,9 +1035,9 @@
 
 !
-!--       Write data for x and xu axis (shifted by -dx/2)
+!--       Write data for x (shifted by +dx/2) and xu axis
           ALLOCATE( netcdf_data(0:nx+1) )
 
           DO  i = 0, nx+1
-             netcdf_data(i) = i * dx
+             netcdf_data(i) = ( i + 0.5 ) * dx
           ENDDO
 
@@ -1046,5 +1047,5 @@
 
           DO  i = 0, nx+1
-             netcdf_data(i) = ( i - 0.5 ) * dx
+             netcdf_data(i) = i * dx
           ENDDO
 
@@ -1057,9 +1058,9 @@
 
 !
-!--       Write data for y and yv axis (shifted by -dy/2)
+!--       Write data for y (shifted by +dy/2) and yv axis
           ALLOCATE( netcdf_data(0:ny+1) )
 
           DO  i = 0, ny+1
-             netcdf_data(i) = i * dy
+             netcdf_data(i) = ( i + 0.5 ) * dy
           ENDDO
 
@@ -1069,5 +1070,5 @@
 
           DO  i = 0, ny+1
-             netcdf_data(i) = ( i - 0.5 ) * dy
+             netcdf_data(i) = i * dy
           ENDDO
 
@@ -1531,5 +1532,18 @@
 
 !
-!--       Write y_xz data
+!--       Write y_xz data (shifted by +dy/2)
+          DO  i = 1, ns
+             IF( section(i,2) == -1 )  THEN
+                netcdf_data(i) = -1.0  ! section averaged along y
+             ELSE
+                netcdf_data(i) = ( section(i,2) + 0.5 ) * dy
+             ENDIF
+          ENDDO
+          nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_y_xz(av), netcdf_data, &
+                                  start = (/ 1 /), count = (/ ns /) )
+          IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 163 )
+
+!
+!--       Write yv_xz data 
           DO  i = 1, ns
              IF( section(i,2) == -1 )  THEN
@@ -1539,17 +1553,4 @@
              ENDIF
           ENDDO
-          nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_y_xz(av), netcdf_data, &
-                                  start = (/ 1 /), count = (/ ns /) )
-          IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 163 )
-
-!
-!--       Write yv_xz data 
-          DO  i = 1, ns
-             IF( section(i,2) == -1 )  THEN
-                netcdf_data(i) = -1.0  ! section averaged along y
-             ELSE
-                netcdf_data(i) = ( section(i,2) - 0.5 ) * dy
-             ENDIF
-          ENDDO
           nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_yv_xz(av), &
                                   netcdf_data, start = (/ 1 /),    &
@@ -1568,9 +1569,9 @@
 
 !
-!--       Write data for x and xu axis (shifted by -dx/2)
+!--       Write data for x (shifted by +dx/2) and xu axis
           ALLOCATE( netcdf_data(0:nx+1) )
 
           DO  i = 0, nx+1
-             netcdf_data(i) = i * dx
+             netcdf_data(i) = ( i + 0.5 ) * dx
           ENDDO
 
@@ -1580,5 +1581,5 @@
 
           DO  i = 0, nx+1
-             netcdf_data(i) = ( i - 0.5 ) * dx
+             netcdf_data(i) = i * dx
           ENDDO
 
@@ -2042,5 +2043,18 @@
 
 !
-!--       Write x_yz data
+!--       Write x_yz data (shifted by +dx/2)
+          DO  i = 1, ns
+             IF( section(i,3) == -1 )  THEN
+                netcdf_data(i) = -1.0  ! section averaged along x
+             ELSE
+                netcdf_data(i) = ( section(i,3) + 0.5 ) * dx
+             ENDIF
+          ENDDO
+          nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_x_yz(av), netcdf_data, &
+                                  start = (/ 1 /), count = (/ ns /) )
+          IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 202 )
+
+!
+!--       Write x_yz data (xu grid)
           DO  i = 1, ns
              IF( section(i,3) == -1 )  THEN
@@ -2050,17 +2064,4 @@
              ENDIF
           ENDDO
-          nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_x_yz(av), netcdf_data, &
-                                  start = (/ 1 /), count = (/ ns /) )
-          IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 202 )
-
-!
-!--       Write x_yz data (xu grid)
-          DO  i = 1, ns
-             IF( section(i,3) == -1 )  THEN
-                netcdf_data(i) = -1.0  ! section averaged along x
-             ELSE
-                netcdf_data(i) = (section(i,3)-0.5) * dx
-             ENDIF
-          ENDDO
           nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_xu_yz(av), netcdf_data, &
                                   start = (/ 1 /), count = (/ ns /) )
@@ -2078,9 +2079,9 @@
 
 !
-!--       Write data for y and yv axis (shifted by -dy/2)
+!--       Write data for y (shifted by +dy/2) and yv axis
           ALLOCATE( netcdf_data(0:ny+1) )
 
           DO  j = 0, ny+1
-             netcdf_data(j) = j * dy
+             netcdf_data(j) = ( j + 0.5 ) * dy
           ENDDO
 
@@ -2090,5 +2091,5 @@
 
           DO  j = 0, ny+1
-             netcdf_data(j) = ( j - 0.5 ) * dy
+             netcdf_data(j) = j * dy
           ENDDO
 
Index: /palm/trunk/SOURCE/read_3d_binary.f90
===================================================================
--- /palm/trunk/SOURCE/read_3d_binary.f90	(revision 215)
+++ /palm/trunk/SOURCE/read_3d_binary.f90	(revision 216)
@@ -4,5 +4,8 @@
 ! Actual revisions:
 ! -----------------
-! 
+! reading mechanism completely revised (subdomain/total domain size can vary
+! arbitrarily between current and previous run)
+! Bugfix: reading of spectrum_x|y from restart files ignored if total numbers
+! of grid points do not match
 !
 ! Former revisions:
@@ -66,15 +69,23 @@
     CHARACTER (LEN=20) ::  field_chr
 
-    INTEGER ::  files_to_be_opened, i, j, myid_on_file,                       &
+    INTEGER ::  files_to_be_opened, i, j, k, myid_on_file,                    &
                 numprocs_on_file, nxlc, nxlf, nxlpr, nxl_on_file, nxrc, nxrf, &
                 nxrpr, nxr_on_file, nync, nynf, nynpr, nyn_on_file, nysc,     &
                 nysf, nyspr, nys_on_file, nzb_on_file, nzt_on_file, offset_x, &
-                offset_y
-
-    INTEGER, DIMENSION(numprocs_previous_run*4) ::  file_list, nxlfa, nxrfa, &
-                nynfa, nysfa, offset_xa, offset_ya
+                offset_y, shift_x, shift_y
+
+    INTEGER, DIMENSION(numprocs_previous_run) ::  file_list, overlap_count
+
+    INTEGER, DIMENSION(numprocs_previous_run,1000) ::  nxlfa, nxrfa, nynfa, &
+                                                       nysfa, offset_xa, &
+                                                       offset_ya
+    REAL ::  rdummy
 
     REAL, DIMENSION(:,:), ALLOCATABLE     ::  tmp_2d
-    REAL, DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d, tmp_3dw
+    REAL, DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d, tmp_3dwul, tmp_3dwun,    &
+                                              tmp_3dwur, tmp_3dwus, tmp_3dwvl, &
+                                              tmp_3dwvn, tmp_3dwvr, tmp_3dwvs, &
+                                              tmp_3dwwl, tmp_3dwwn, tmp_3dwwr, &
+                                              tmp_3dwws
     REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  tmp_4d
 
@@ -90,5 +101,6 @@
 
     DO  i = 1, numprocs_previous_run
-
+!
+!--    Store array bounds of the previous run ("pr") in temporary scalars
        nxlpr = hor_index_bounds_previous_run(1,i-1)
        nxrpr = hor_index_bounds_previous_run(2,i-1)
@@ -103,161 +115,74 @@
 
 !
-!--    Only data which overlap with the current subdomain have to be read
-       IF ( nxlpr <= nxr-offset_x  .AND.  nxrpr >= nxl-offset_x  .AND.  &
-            nyspr <= nyn-offset_y  .AND.  nynpr >= nys-offset_y )  THEN
-
-          files_to_be_opened = files_to_be_opened + 1
-          file_list(files_to_be_opened) = i-1
-!
-!--       Index bounds of overlapping data
-          nxlfa(files_to_be_opened) = MAX( nxl-offset_x, nxlpr )
-          nxrfa(files_to_be_opened) = MIN( nxr-offset_x, nxrpr )
-          nysfa(files_to_be_opened) = MAX( nys-offset_y, nyspr )
-          nynfa(files_to_be_opened) = MIN( nyn-offset_y, nynpr )
-
-          WRITE (9,*) '*** reading from file: ', i
-          WRITE (9,*) '    index bounds on file:'
-          WRITE (9,*) '       nxlpr=', nxlpr, ' nxrpr=', nxrpr
-          WRITE (9,*) '       nyspr=', nyspr, ' nynpr=', nynpr
-          WRITE (9,*) '    index bounds of current subdmain:'
-          WRITE (9,*) '       nxl  =', nxl, ' nxr  =', nxr
-          WRITE (9,*) '       nys  =', nys, ' nyn  =', nyn
-          WRITE (9,*) '    offset used:'
-          WRITE (9,*) '       offset_x=', offset_x, ' offset_y=', offset_y
-          WRITE (9,*) '    bounds of overlapping data:'
-          WRITE (9,*) '       nxlfa=', nxlfa(files_to_be_opened), ' nxrfa=', nxrfa(files_to_be_opened)
-          WRITE (9,*) '       nysfa=', nysfa(files_to_be_opened), ' nynfa=', nynfa(files_to_be_opened)
+!--    Start with this offset and then check, if the subdomain on file
+!--    matches another time(s) in the current subdomain by shifting it
+!--    for nx_on_file+1, ny_on_file+1 respectively
+
+       shift_y = 0
+       j       = 0  ! counter for the number of files to be opened
+
+       DO WHILE ( nyspr+shift_y <= nyn-offset_y  .AND.  &
+                  nynpr+shift_y >= nys-offset_y )
+
+          shift_x = 0
+
+          DO WHILE ( nxlpr+shift_x <= nxr-offset_x  .AND. &
+                     nxrpr+shift_x >= nxl-offset_x )
+
+             j = j +1
+
+             IF ( j > 1000 )  THEN
+!
+!--             Array bound exceeded
+                PRINT*, '+++ read_3d_binary: data from subdomain of previous', &
+                             ' run mapped more than 1000 times'
+#if defined( __parallel )
+                CALL MPI_ABORT( comm2d, 9999, ierr )
+#else
+                STOP
+#endif
+             ENDIF
+
+             IF ( j == 1 )  THEN
+                files_to_be_opened = files_to_be_opened + 1
+                file_list(files_to_be_opened) = i-1
+             ENDIF
+
+             offset_xa(files_to_be_opened,j) = offset_x + shift_x
+             offset_ya(files_to_be_opened,j) = offset_y + shift_y
+
+!
+!--          Index bounds of overlapping data
+             nxlfa(files_to_be_opened,j) = MAX( nxl-offset_x-shift_x, nxlpr )
+             nxrfa(files_to_be_opened,j) = MIN( nxr-offset_x-shift_x, nxrpr )
+             nysfa(files_to_be_opened,j) = MAX( nys-offset_y, nyspr )
+             nynfa(files_to_be_opened,j) = MIN( nyn-offset_y, nynpr )
+
+             shift_x = shift_x + ( nx_on_file + 1 )
+
+          ENDDO
+
+          shift_y = shift_y + ( ny_on_file + 1 )
+
+       ENDDO
+
+       IF ( j > 0 )  overlap_count(files_to_be_opened) = j
+
+!
+!--    Test output, to be removed later
+       IF ( j > 0 )  THEN
+          WRITE (9,*) '*** reading from file: ', i, j, ' times'
+          WRITE (9,*) '    nxl = ', nxl, ' nxr = ', nxr, ' nys = ', nys, ' nyn = ', nyn
+          WRITE (9,*) ' '
+          DO  k = 1, j
+             WRITE (9,*) 'k = ', k
+             WRITE (9,'(6(A,I2))')  'nxlfa = ', nxlfa(files_to_be_opened,k), &
+                         ' nxrfa = ', nxrfa(files_to_be_opened,k), &
+                         ' offset_xa = ', offset_xa(files_to_be_opened,k), &
+                         ' nysfa = ', nysfa(files_to_be_opened,k), &
+                         ' nynfa = ', nynfa(files_to_be_opened,k), &
+                         ' offset_ya = ', offset_ya(files_to_be_opened,k)
+          ENDDO
           CALL local_flush( 9 )
-          offset_xa(files_to_be_opened) = offset_x
-          offset_ya(files_to_be_opened) = offset_y
-
-       ENDIF
-
-!
-!--    If the total domain on file is smaller than the current total domain,
-!--    and if the current subdomain extends beyond the limits of the total
-!--    domain of file, the respective file may be opened again (three times
-!--    maximum) to read the still missing parts, which are then added
-!--    "cyclically".
-!--    Overlap along x:
-       IF ( ( nxr - offset_x ) > nx_on_file )  THEN
-
-          offset_x = offset_x + ( nx_on_file + 1 )
-
-          IF ( nxlpr <= nxr-offset_x  .AND.  nxrpr >= nxl-offset_x  .AND.  &
-               nyspr <= nyn-offset_y  .AND.  nynpr >= nys-offset_y )  THEN
-
-             files_to_be_opened = files_to_be_opened + 1
-             file_list(files_to_be_opened) = i-1
-!
-!--          Index bounds of overlapping data
-             nxlfa(files_to_be_opened) = MAX( nxl-offset_x, nxlpr )
-             nxrfa(files_to_be_opened) = MIN( nxr-offset_x, nxrpr )
-             nysfa(files_to_be_opened) = MAX( nys-offset_y, nyspr )
-             nynfa(files_to_be_opened) = MIN( nyn-offset_y, nynpr )
-
-          WRITE (9,*) '*** reading from file: ', i
-          WRITE (9,*) '    index bounds on file:'
-          WRITE (9,*) '       nxlpr=', nxlpr, ' nxrpr=', nxrpr
-          WRITE (9,*) '       nyspr=', nyspr, ' nynpr=', nynpr
-          WRITE (9,*) '    index bounds of current subdmain:'
-          WRITE (9,*) '       nxl  =', nxl, ' nxr  =', nxr
-          WRITE (9,*) '       nys  =', nys, ' nyn  =', nyn
-          WRITE (9,*) '    offset used:'
-          WRITE (9,*) '       offset_x=', offset_x, ' offset_y=', offset_y
-          WRITE (9,*) '    bounds of overlapping data:'
-          WRITE (9,*) '       nxlfa=', nxlfa(files_to_be_opened), ' nxrfa=', nxrfa(files_to_be_opened)
-          WRITE (9,*) '       nysfa=', nysfa(files_to_be_opened), ' nynfa=', nynfa(files_to_be_opened)
-          CALL local_flush( 9 )
-             offset_xa(files_to_be_opened) = offset_x
-             offset_ya(files_to_be_opened) = offset_y
-
-          ENDIF
-
-          offset_x = offset_x - ( nx_on_file + 1 )
-
-       ENDIF
-
-
-!
-!--    Overlap along y:
-       IF ( ( nyn - offset_y ) > ny_on_file )  THEN
-
-          offset_y = offset_y + ( ny_on_file + 1 )
-
-          IF ( nxlpr <= nxr-offset_x  .AND.  nxrpr >= nxl-offset_x  .AND.  &
-               nyspr <= nyn-offset_y  .AND.  nynpr >= nys-offset_y )  THEN
-
-             files_to_be_opened = files_to_be_opened + 1
-             file_list(files_to_be_opened) = i-1
-!
-!--          Index bounds of overlapping data
-             nxlfa(files_to_be_opened) = MAX( nxl-offset_x, nxlpr )
-             nxrfa(files_to_be_opened) = MIN( nxr-offset_x, nxrpr )
-             nysfa(files_to_be_opened) = MAX( nys-offset_y, nyspr )
-             nynfa(files_to_be_opened) = MIN( nyn-offset_y, nynpr )
-
-          WRITE (9,*) '*** reading from file: ', i
-          WRITE (9,*) '    index bounds on file:'
-          WRITE (9,*) '       nxlpr=', nxlpr, ' nxrpr=', nxrpr
-          WRITE (9,*) '       nyspr=', nyspr, ' nynpr=', nynpr
-          WRITE (9,*) '    index bounds of current subdmain:'
-          WRITE (9,*) '       nxl  =', nxl, ' nxr  =', nxr
-          WRITE (9,*) '       nys  =', nys, ' nyn  =', nyn
-          WRITE (9,*) '    offset used:'
-          WRITE (9,*) '       offset_x=', offset_x, ' offset_y=', offset_y
-          WRITE (9,*) '    bounds of overlapping data:'
-          WRITE (9,*) '       nxlfa=', nxlfa(files_to_be_opened), ' nxrfa=', nxrfa(files_to_be_opened)
-          WRITE (9,*) '       nysfa=', nysfa(files_to_be_opened), ' nynfa=', nynfa(files_to_be_opened)
-          CALL local_flush( 9 )
-             offset_xa(files_to_be_opened) = offset_x
-             offset_ya(files_to_be_opened) = offset_y
-
-          ENDIF
-
-          offset_y = offset_y - ( ny_on_file + 1 )
-
-       ENDIF
-
-!--    Overlap along x and y:
-       IF ( ( nxr - offset_x ) > nx_on_file  .AND.  &
-            ( nyn - offset_y ) > ny_on_file )  THEN
-
-          offset_x = offset_x + ( nx_on_file + 1 )
-          offset_y = offset_y + ( ny_on_file + 1 )
-
-          IF ( nxlpr <= nxr-offset_x  .AND.  nxrpr >= nxl-offset_x  .AND.  &
-               nyspr <= nyn-offset_y  .AND.  nynpr >= nys-offset_y )  THEN
-
-             files_to_be_opened = files_to_be_opened + 1
-             file_list(files_to_be_opened) = i-1
-!
-!--          Index bounds of overlapping data
-             nxlfa(files_to_be_opened) = MAX( nxl-offset_x, nxlpr )
-             nxrfa(files_to_be_opened) = MIN( nxr-offset_x, nxrpr )
-             nysfa(files_to_be_opened) = MAX( nys-offset_y, nyspr )
-             nynfa(files_to_be_opened) = MIN( nyn-offset_y, nynpr )
-
-          WRITE (9,*) '*** reading from file: ', i
-          WRITE (9,*) '    index bounds on file:'
-          WRITE (9,*) '       nxlpr=', nxlpr, ' nxrpr=', nxrpr
-          WRITE (9,*) '       nyspr=', nyspr, ' nynpr=', nynpr
-          WRITE (9,*) '    index bounds of current subdmain:'
-          WRITE (9,*) '       nxl  =', nxl, ' nxr  =', nxr
-          WRITE (9,*) '       nys  =', nys, ' nyn  =', nyn
-          WRITE (9,*) '    offset used:'
-          WRITE (9,*) '       offset_x=', offset_x, ' offset_y=', offset_y
-          WRITE (9,*) '    bounds of overlapping data:'
-          WRITE (9,*) '       nxlfa=', nxlfa(files_to_be_opened), ' nxrfa=', nxrfa(files_to_be_opened)
-          WRITE (9,*) '       nysfa=', nysfa(files_to_be_opened), ' nynfa=', nynfa(files_to_be_opened)
-          CALL local_flush( 9 )
-             offset_xa(files_to_be_opened) = offset_x
-             offset_ya(files_to_be_opened) = offset_y
-
-          ENDIF
-
-          offset_x = offset_x - ( nx_on_file + 1 )
-          offset_y = offset_y - ( ny_on_file + 1 )
-
        ENDIF
 
@@ -403,16 +328,4 @@
 
 !
-!--    Get the index range of the subdomain on file which overlap with the
-!--    current subdomain
-       nxlf = nxlfa(i)
-       nxlc = nxlfa(i) + offset_xa(i)
-       nxrf = nxrfa(i)
-       nxrc = nxrfa(i) + offset_xa(i)
-       nysf = nysfa(i)
-       nysc = nysfa(i) + offset_ya(i)
-       nynf = nynfa(i)
-       nync = nynfa(i) + offset_ya(i)
-
-!
 !--    Read arrays
 !--    ATTENTION: If the following read commands have been altered, the 
@@ -423,555 +336,634 @@
        DO  WHILE ( TRIM( field_chr ) /= '*** end ***' )
 
-          WRITE (9,*) 'var = ', field_chr
-          CALL local_flush( 9 )
-          SELECT CASE ( TRIM( field_chr ) )
-
-             CASE ( 'e' )
-                READ ( 13 )  tmp_3d
-                e(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'e_av' )
-                IF ( .NOT. ALLOCATED( e_av ) )  THEN
-                   ALLOCATE( e_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                e_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'e_m' )
-                READ ( 13 )  tmp_3d
-                e_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'iran' ) ! matching random numbers is still unresolved issue
-                READ ( 13 )  iran, iran_part
-
-             CASE ( 'kh' )
-                READ ( 13 )  tmp_3d
-                kh(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'kh_m' )
-                READ ( 13 )  tmp_3d
-                kh_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'km' )
-                READ ( 13 )  tmp_3d
-                km(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'km_m' )
-                READ ( 13 )  tmp_3d
-                km_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'lwp_av' )
-                IF ( .NOT. ALLOCATED( lwp_av ) )  THEN
-                   ALLOCATE( lwp_av(nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_2d
-                lwp_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'p' )
-                READ ( 13 )  tmp_3d
-                p(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'p_av' )
-                IF ( .NOT. ALLOCATED( p_av ) )  THEN
-                   ALLOCATE( p_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                p_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'pc_av' )
-                IF ( .NOT. ALLOCATED( pc_av ) )  THEN
-                   ALLOCATE( pc_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                pc_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'pr_av' )
-                IF ( .NOT. ALLOCATED( pr_av ) )  THEN
-                   ALLOCATE( pr_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                pr_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'precipitation_amount' )
-                READ ( 13 )  tmp_2d
-                precipitation_amount(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'precipitation_rate_a' )
-                IF ( .NOT. ALLOCATED( precipitation_rate_av ) )  THEN
-                   ALLOCATE( precipitation_rate_av(nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_2d
-                precipitation_rate_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'pt' )
-                READ ( 13 )  tmp_3d
-                pt(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'pt_av' )
-                IF ( .NOT. ALLOCATED( pt_av ) )  THEN
-                   ALLOCATE( pt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                pt_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'pt_m' )
-                READ ( 13 )  tmp_3d
-                pt_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'q' )
-                READ ( 13 )  tmp_3d
-                q(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'q_av' )
-                IF ( .NOT. ALLOCATED( q_av ) )  THEN
-                   ALLOCATE( q_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                q_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'q_m' )
-                READ ( 13 )  tmp_3d
-                q_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'ql' )
-                READ ( 13 )  tmp_3d
-                ql(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'ql_av' )
-                IF ( .NOT. ALLOCATED( ql_av ) )  THEN
-                   ALLOCATE( ql_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                ql_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'ql_c_av' )
-                IF ( .NOT. ALLOCATED( ql_c_av ) )  THEN
-                   ALLOCATE( ql_c_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                ql_c_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'ql_v_av' )
-                IF ( .NOT. ALLOCATED( ql_v_av ) )  THEN
-                   ALLOCATE( ql_v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                ql_v_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'ql_vp_av' )
-                IF ( .NOT. ALLOCATED( ql_vp_av ) )  THEN
-                   ALLOCATE( ql_vp_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                ql_vp_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'qs' )
-                READ ( 13 )  tmp_2d
-                qs(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'qsws' )
-                READ ( 13 )  tmp_2d
-                qsws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'qsws_m' )
-                READ ( 13 )  tmp_2d
-                qsws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'qswst' )
-                READ ( 13 )  tmp_2d
-                qswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'qswst_m' )
-                READ ( 13 )  tmp_2d
-                qswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'qv_av' )
-                IF ( .NOT. ALLOCATED( qv_av ) )  THEN
-                   ALLOCATE( qv_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                qv_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'random_iv' )  ! still unresolved issue
-                READ ( 13 )  random_iv
-                READ ( 13 )  random_iy
-
-             CASE ( 'rho_av' )
-                IF ( .NOT. ALLOCATED( rho_av ) )  THEN
-                   ALLOCATE( rho_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                rho_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'rif' )
-                READ ( 13 )  tmp_2d
-                rif(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'rif_m' )
-                READ ( 13 )  tmp_2d
-                rif_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'rif_wall' )
-                ALLOCATE( tmp_4d(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
-                                 nxl_on_file-1:nxr_on_file+1,1:4) )
-                READ ( 13 )  tmp_4d
-                rif_wall(:,nysc-1:nync+1,nxlc-1:nxrc+1,:) = &
+!
+!--       Map data on file as often as needed (data are read only for k=1)
+          DO  k = 1, overlap_count(i)
+
+!
+!--          Get the index range of the subdomain on file which overlap with the
+!--          current subdomain
+             nxlf = nxlfa(i,k)
+             nxlc = nxlfa(i,k) + offset_xa(i,k)
+             nxrf = nxrfa(i,k)
+             nxrc = nxrfa(i,k) + offset_xa(i,k)
+             nysf = nysfa(i,k)
+             nysc = nysfa(i,k) + offset_ya(i,k)
+             nynf = nynfa(i,k)
+             nync = nynfa(i,k) + offset_ya(i,k)
+
+
+             WRITE (9,*) 'var = ', field_chr
+             CALL local_flush( 9 )
+
+             SELECT CASE ( TRIM( field_chr ) )
+
+                CASE ( 'e' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   e(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'e_av' )
+                   IF ( .NOT. ALLOCATED( e_av ) )  THEN
+                      ALLOCATE( e_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   e_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'e_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   e_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'iran' ) ! matching random numbers is still unresolved
+                                ! issue
+                   IF ( k == 1 )  READ ( 13 )  iran, iran_part
+
+                CASE ( 'kh' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   kh(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'kh_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   kh_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'km' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   km(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'km_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   km_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'lwp_av' )
+                   IF ( .NOT. ALLOCATED( lwp_av ) )  THEN
+                      ALLOCATE( lwp_av(nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   lwp_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'p' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   p(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'p_av' )
+                   IF ( .NOT. ALLOCATED( p_av ) )  THEN
+                      ALLOCATE( p_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   p_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'pc_av' )
+                   IF ( .NOT. ALLOCATED( pc_av ) )  THEN
+                      ALLOCATE( pc_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   pc_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'pr_av' )
+                   IF ( .NOT. ALLOCATED( pr_av ) )  THEN
+                      ALLOCATE( pr_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   pr_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'precipitation_amount' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   precipitation_amount(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'precipitation_rate_a' )
+                   IF ( .NOT. ALLOCATED( precipitation_rate_av ) )  THEN
+                      ALLOCATE( precipitation_rate_av(nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   precipitation_rate_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'pt' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   pt(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'pt_av' )
+                   IF ( .NOT. ALLOCATED( pt_av ) )  THEN
+                      ALLOCATE( pt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   pt_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'pt_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   pt_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'q' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   q(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'q_av' )
+                   IF ( .NOT. ALLOCATED( q_av ) )  THEN
+                      ALLOCATE( q_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   q_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'q_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   q_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'ql' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   ql(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'ql_av' )
+                   IF ( .NOT. ALLOCATED( ql_av ) )  THEN
+                      ALLOCATE( ql_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   ql_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'ql_c_av' )
+                   IF ( .NOT. ALLOCATED( ql_c_av ) )  THEN
+                      ALLOCATE( ql_c_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   ql_c_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'ql_v_av' )
+                   IF ( .NOT. ALLOCATED( ql_v_av ) )  THEN
+                      ALLOCATE( ql_v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   ql_v_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'ql_vp_av' )
+                   IF ( .NOT. ALLOCATED( ql_vp_av ) )  THEN
+                      ALLOCATE( ql_vp_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   ql_vp_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'qs' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   qs(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'qsws' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   qsws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'qsws_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   qsws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'qswst' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   qswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'qswst_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   qswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'qv_av' )
+                   IF ( .NOT. ALLOCATED( qv_av ) )  THEN
+                      ALLOCATE( qv_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   qv_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'random_iv' )  ! still unresolved issue
+                   IF ( k == 1 )  READ ( 13 )  random_iv
+                   IF ( k == 1 )  READ ( 13 )  random_iy
+
+                CASE ( 'rho_av' )
+                   IF ( .NOT. ALLOCATED( rho_av ) )  THEN
+                      ALLOCATE( rho_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   rho_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'rif' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   rif(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'rif_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   rif_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'rif_wall' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_4d(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
+                                       nxl_on_file-1:nxr_on_file+1,1:4) )
+                      READ ( 13 )  tmp_4d
+                   ENDIF
+                   rif_wall(:,nysc-1:nync+1,nxlc-1:nxrc+1,:) = &
                                          tmp_4d(:,nysf-1:nynf+1,nxlf-1:nxrf+1,:)
-                DEALLOCATE( tmp_4d )
-
-             CASE ( 's_av' )
-                IF ( .NOT. ALLOCATED( s_av ) )  THEN
-                   ALLOCATE( s_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                s_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'sa' )
-                READ ( 13 )  tmp_3d
-                sa(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'sa_av' )
-                IF ( .NOT. ALLOCATED( sa_av ) )  THEN
-                   ALLOCATE( sa_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                sa_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'saswsb' )
-                READ ( 13 )  tmp_2d
-                saswsb(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'saswst' )
-                READ ( 13 )  tmp_2d
-                saswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'shf' )
-                READ ( 13 )  tmp_2d
-                shf(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'shf_m' )
-                READ ( 13 )  tmp_2d
-                shf_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'spectrum_x' )
-                READ ( 13 )  spectrum_x
-
-             CASE ( 'spectrum_y' )
-                READ ( 13 )  spectrum_y
-
-             CASE ( 'ts' )
-                READ ( 13 )  tmp_2d
-                ts(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'ts_av' )
-                IF ( .NOT. ALLOCATED( ts_av ) )  THEN
-                   ALLOCATE( ts_av(nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_2d
-                ts_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'tswst' )
-                READ ( 13 )  tmp_2d
-                tswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'tswst_m' )
-                READ ( 13 )  tmp_2d
-                tswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'u' )
-                READ ( 13 )  tmp_3d
-                u(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'u_av' )
-                IF ( .NOT. ALLOCATED( u_av ) )  THEN
-                   ALLOCATE( u_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                u_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'u_m' )
-                READ ( 13 )  tmp_3d
-                u_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'u_m_l' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1,1:2) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_l )  THEN
-                   u_m_l(:,nysc-1:nync+1,:) = tmp_3dw(:,nysf-1:nynf+1,:)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'u_m_n' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,ny-1:ny, &
-                                  nxl_on_file-1:nxr_on_file+1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_n )  THEN
-                   u_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlf-1:nxrf+1)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'u_m_r' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
-                                  nx-1:nx) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_r )  THEN
-                   u_m_r(:,nysc-1:nync+1,:) = tmp_3dw(:,nysf-1:nynf+1,:)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'u_m_s' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,0:1, &
-                                  nxl_on_file-1:nxr_on_file+1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_s )  THEN
-                   u_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlf-1:nxrf+1)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'us' )
-                READ ( 13 )  tmp_2d
-                us(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'usws' )
-                READ ( 13 )  tmp_2d
-                usws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'uswst' )
-                READ ( 13 )  tmp_2d
-                uswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'usws_m' )
-                READ ( 13 )  tmp_2d
-                usws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'uswst_m' )
-                READ ( 13 )  tmp_2d
-                uswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'us_av' )
-                IF ( .NOT. ALLOCATED( us_av ) )  THEN
-                   ALLOCATE( us_av(nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_2d
-                us_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'v' )
-                READ ( 13 )  tmp_3d
-                v(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'v_av' )
-                IF ( .NOT. ALLOCATED( v_av ) )  THEN
-                   ALLOCATE( v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                v_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'v_m' )
-                READ ( 13 )  tmp_3d
-                v_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'v_m_l' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1,0:1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_l )  THEN
-                   v_m_l(:,nysc-1:nync+1,:) = tmp_3dw(:,nysf-1:nynf+1,:)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'v_m_n' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,ny-1:ny, &
-                                  nxl_on_file-1:nxr_on_file+1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_n )  THEN
-                   v_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlf-1:nxrf+1)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'v_m_r' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
-                                  nx-1:nx) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_r )  THEN
-                   v_m_r(:,nysc-1:nync+1,:) = tmp_3dw(:,nysf-1:nynf+1,:)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'v_m_s' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,1:2, &
-                                  nxl_on_file-1:nxr_on_file+1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_s )  THEN
-                   v_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlf-1:nxrf+1)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'vpt' )
-                READ ( 13 )  tmp_3d
-                vpt(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'vpt_av' )
-                IF ( .NOT. ALLOCATED( vpt_av ) )  THEN
-                   ALLOCATE( vpt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                vpt_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'vpt_m' )
-                READ ( 13 )  tmp_3d
-                vpt_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'vsws' )
-                READ ( 13 )  tmp_2d
-                vsws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'vswst' )
-                READ ( 13 )  tmp_2d
-                vswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'vsws_m' )
-                READ ( 13 )  tmp_2d
-                vsws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'vswst_m' )
-                READ ( 13 )  tmp_2d
-                vswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'w' )
-                READ ( 13 )  tmp_3d
-                w(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'w_av' )
-                IF ( .NOT. ALLOCATED( w_av ) )  THEN
-                   ALLOCATE( w_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_3d
-                w_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'w_m' )
-                READ ( 13 )  tmp_3d
-                w_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'w_m_l' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1,0:1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_l )  THEN
-                   w_m_l(:,nysc-1:nync+1,:) = tmp_3dw(:,nysf-1:nynf+1,:)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'w_m_n' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,ny-1:ny, &
-                                  nxl_on_file-1:nxr_on_file+1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_n )  THEN
-                   w_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlf-1:nxrf+1)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'w_m_r' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
-                                  nx-1:nx) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_r )  THEN
-                   w_m_r(:,nysc-1:nync+1,:) = tmp_3dw(:,nysf-1:nynf+1,:)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'w_m_s' )
-                ALLOCATE( tmp_3dw(nzb:nzt+1,0:1, &
-                                  nxl_on_file-1:nxr_on_file+1) )
-                READ ( 13 )  tmp_3dw
-                IF ( outflow_s )  THEN
-                   w_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlf-1:nxrf+1)
-                ENDIF
-                DEALLOCATE( tmp_3dw )
-
-             CASE ( 'z0' )
-                READ ( 13 )  tmp_2d
-                z0(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE ( 'z0_av' )
-                IF ( .NOT. ALLOCATED( z0_av ) )  THEN
-                   ALLOCATE( z0_av(nys-1:nyn+1,nxl-1:nxr+1) )
-                ENDIF
-                READ ( 13 )  tmp_2d
-                z0_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
-                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
-
-             CASE DEFAULT
-                PRINT*, '+++ read_3d_binary: unknown field named "', &
-                        TRIM( field_chr ), '" found in'
-                PRINT*, '                    data from prior run on PE ', myid
-                CALL local_stop
-
-          END SELECT
+
+                CASE ( 's_av' )
+                   IF ( .NOT. ALLOCATED( s_av ) )  THEN
+                      ALLOCATE( s_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   s_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'sa' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   sa(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'sa_av' )
+                   IF ( .NOT. ALLOCATED( sa_av ) )  THEN
+                      ALLOCATE( sa_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   sa_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'saswsb' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   saswsb(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'saswst' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   saswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'shf' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   shf(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'shf_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   shf_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'spectrum_x' )
+                   IF ( k == 1 )  THEN
+                      IF ( nx_on_file /= nx )  THEN
+                         IF ( myid == 0 )  THEN
+                            PRINT*, '+++ WARNING: read_3d_binary: spectrum_x', &
+                                         ' on restart file ignored because'
+                            PRINT*, '    total numbers of grid points (nx) ', &
+                                         'do not match'
+                         ENDIF
+                         READ ( 13 )  rdummy
+                      ELSE
+                         READ ( 13 )  spectrum_x
+                      ENDIF
+                   ENDIF
+
+                CASE ( 'spectrum_y' )
+                   IF ( k == 1 )  THEN
+                      IF ( ny_on_file /= ny )  THEN
+                         IF ( myid == 0 )  THEN
+                            PRINT*, '+++ WARNING: read_3d_binary: spectrum_y', &
+                                         ' on restart file ignored because'
+                            PRINT*, '    total numbers of grid points (ny) ', &
+                                         'do not match'
+                         ENDIF
+                         READ ( 13 )  rdummy
+                      ELSE
+                         READ ( 13 )  spectrum_y
+                      ENDIF
+                   ENDIF
+
+                CASE ( 'ts' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   ts(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'ts_av' )
+                   IF ( .NOT. ALLOCATED( ts_av ) )  THEN
+                      ALLOCATE( ts_av(nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   ts_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'tswst' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   tswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'tswst_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   tswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'u' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   u(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'u_av' )
+                   IF ( .NOT. ALLOCATED( u_av ) )  THEN
+                      ALLOCATE( u_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   u_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'u_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   u_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'u_m_l' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwul(nzb:nzt+1, &
+                                          nys_on_file-1:nyn_on_file+1,1:2) )
+                      READ ( 13 )  tmp_3dwul
+                   ENDIF
+                   IF ( outflow_l )  THEN
+                      u_m_l(:,nysc-1:nync+1,:) = tmp_3dwul(:,nysf-1:nynf+1,:)
+                   ENDIF
+
+                CASE ( 'u_m_n' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwun(nzb:nzt+1,ny-1:ny, &
+                                          nxl_on_file-1:nxr_on_file+1) )
+                      READ ( 13 )  tmp_3dwun
+                   ENDIF
+                   IF ( outflow_n )  THEN
+                      u_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dwun(:,:,nxlf-1:nxrf+1)
+                   ENDIF
+
+                CASE ( 'u_m_r' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwur(nzb:nzt+1,&
+                                          nys_on_file-1:nyn_on_file+1,nx-1:nx) )
+                      READ ( 13 )  tmp_3dwur
+                   ENDIF
+                   IF ( outflow_r )  THEN
+                      u_m_r(:,nysc-1:nync+1,:) = tmp_3dwur(:,nysf-1:nynf+1,:)
+                   ENDIF
+
+                CASE ( 'u_m_s' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwus(nzb:nzt+1,0:1, &
+                                          nxl_on_file-1:nxr_on_file+1) )
+                      READ ( 13 )  tmp_3dwus
+                   ENDIF
+                   IF ( outflow_s )  THEN
+                      u_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dwus(:,:,nxlf-1:nxrf+1)
+                   ENDIF
+
+                CASE ( 'us' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   us(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'usws' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   usws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'uswst' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   uswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'usws_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   usws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'uswst_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   uswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'us_av' )
+                   IF ( .NOT. ALLOCATED( us_av ) )  THEN
+                      ALLOCATE( us_av(nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   us_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'v' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   v(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'v_av' )
+                   IF ( .NOT. ALLOCATED( v_av ) )  THEN
+                      ALLOCATE( v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   v_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'v_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   v_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'v_m_l' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwvl(nzb:nzt+1,&
+                                          nys_on_file-1:nyn_on_file+1,0:1) )
+                      READ ( 13 )  tmp_3dwvl
+                   ENDIF
+                   IF ( outflow_l )  THEN
+                      v_m_l(:,nysc-1:nync+1,:) = tmp_3dwvl(:,nysf-1:nynf+1,:)
+                   ENDIF
+
+                CASE ( 'v_m_n' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwvn(nzb:nzt+1,ny-1:ny, &
+                                          nxl_on_file-1:nxr_on_file+1) )
+                      READ ( 13 )  tmp_3dwvn
+                   ENDIF
+                   IF ( outflow_n )  THEN
+                      v_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dwvn(:,:,nxlf-1:nxrf+1)
+                   ENDIF
+
+                CASE ( 'v_m_r' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwvr(nzb:nzt+1,&
+                                          nys_on_file-1:nyn_on_file+1,nx-1:nx) )
+                      READ ( 13 )  tmp_3dwvr
+                   ENDIF
+                   IF ( outflow_r )  THEN
+                      v_m_r(:,nysc-1:nync+1,:) = tmp_3dwvr(:,nysf-1:nynf+1,:)
+                   ENDIF
+
+                CASE ( 'v_m_s' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwvs(nzb:nzt+1,1:2, &
+                                          nxl_on_file-1:nxr_on_file+1) )
+                      READ ( 13 )  tmp_3dwvs
+                   ENDIF
+                   IF ( outflow_s )  THEN
+                      v_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dwvs(:,:,nxlf-1:nxrf+1)
+                   ENDIF
+
+                CASE ( 'vpt' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   vpt(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'vpt_av' )
+                   IF ( .NOT. ALLOCATED( vpt_av ) )  THEN
+                      ALLOCATE( vpt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   vpt_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'vpt_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   vpt_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'vsws' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   vsws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'vswst' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   vswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'vsws_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   vsws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'vswst_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   vswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'w' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   w(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'w_av' )
+                   IF ( .NOT. ALLOCATED( w_av ) )  THEN
+                      ALLOCATE( w_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   w_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'w_m' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+                   w_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'w_m_l' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwwl(nzb:nzt+1,&
+                                          nys_on_file-1:nyn_on_file+1,0:1) )
+                      READ ( 13 )  tmp_3dwwl
+                   ENDIF
+                   IF ( outflow_l )  THEN
+                      w_m_l(:,nysc-1:nync+1,:) = tmp_3dwwl(:,nysf-1:nynf+1,:)
+                   ENDIF
+
+                CASE ( 'w_m_n' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwwn(nzb:nzt+1,ny-1:ny, &
+                                          nxl_on_file-1:nxr_on_file+1) )
+                      READ ( 13 )  tmp_3dwwn
+                   ENDIF
+                   IF ( outflow_n )  THEN
+                      w_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dwwn(:,:,nxlf-1:nxrf+1)
+                   ENDIF
+
+                CASE ( 'w_m_r' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwwr(nzb:nzt+1,&
+                                          nys_on_file-1:nyn_on_file+1,nx-1:nx) )
+                      READ ( 13 )  tmp_3dwwr
+                   ENDIF
+                   IF ( outflow_r )  THEN
+                      w_m_r(:,nysc-1:nync+1,:) = tmp_3dwwr(:,nysf-1:nynf+1,:)
+                   ENDIF
+
+                CASE ( 'w_m_s' )
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3dwws(nzb:nzt+1,0:1, &
+                                          nxl_on_file-1:nxr_on_file+1) )
+                      READ ( 13 )  tmp_3dwws
+                   ENDIF
+                   IF ( outflow_s )  THEN
+                      w_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dwws(:,:,nxlf-1:nxrf+1)
+                   ENDIF
+                   DEALLOCATE( tmp_3dwws )
+
+                CASE ( 'z0' )
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   z0(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE ( 'z0_av' )
+                   IF ( .NOT. ALLOCATED( z0_av ) )  THEN
+                      ALLOCATE( z0_av(nys-1:nyn+1,nxl-1:nxr+1) )
+                   ENDIF
+                   IF ( k == 1 )  READ ( 13 )  tmp_2d
+                   z0_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
+                                          tmp_2d(nysf-1:nynf+1,nxlf-1:nxrf+1)
+
+                CASE DEFAULT
+                   PRINT*, '+++ read_3d_binary: unknown field named "', &
+                           TRIM( field_chr ), '" found in'
+                   PRINT*, '                    data from prior run on PE ',myid
+                   CALL local_stop
+
+             END SELECT
+
+          ENDDO  ! overlap loop
+
+!
+!--       Deallocate arrays needed for specific variables only
+          IF ( ALLOCATED( tmp_3dwul ) )  DEALLOCATE( tmp_3dwul )
+          IF ( ALLOCATED( tmp_3dwun ) )  DEALLOCATE( tmp_3dwun )
+          IF ( ALLOCATED( tmp_3dwur ) )  DEALLOCATE( tmp_3dwur )
+          IF ( ALLOCATED( tmp_3dwus ) )  DEALLOCATE( tmp_3dwus )
+          IF ( ALLOCATED( tmp_3dwvl ) )  DEALLOCATE( tmp_3dwvl )
+          IF ( ALLOCATED( tmp_3dwvn ) )  DEALLOCATE( tmp_3dwvn )
+          IF ( ALLOCATED( tmp_3dwvr ) )  DEALLOCATE( tmp_3dwvr )
+          IF ( ALLOCATED( tmp_3dwvs ) )  DEALLOCATE( tmp_3dwvs )
+          IF ( ALLOCATED( tmp_3dwwl ) )  DEALLOCATE( tmp_3dwwl )
+          IF ( ALLOCATED( tmp_3dwwn ) )  DEALLOCATE( tmp_3dwwn )
+          IF ( ALLOCATED( tmp_3dwwr ) )  DEALLOCATE( tmp_3dwwr )
+          IF ( ALLOCATED( tmp_3dwws ) )  DEALLOCATE( tmp_3dwws )
+          IF ( ALLOCATED( tmp_4d ) )  DEALLOCATE( tmp_4d )
+
 !
 !--       Read next character string
@@ -982,7 +974,8 @@
 !
 !--    Read user-defined restart data
-       CALL user_read_restart_data( nxlc, nxlf, nxl_on_file, nxrc, nxrf, &
-                                    nxr_on_file, nync, nynf, nyn_on_file, &
-                                    nysc, nysf, nys_on_file, tmp_2d, tmp_3d )
+       CALL user_read_restart_data( nxlfa, nxl_on_file, nxrfa, nxr_on_file, &
+                                    nynfa, nyn_on_file, nysfa, nys_on_file, &
+                                    offset_xa, offset_ya, overlap_count(i), &
+                                    tmp_2d, tmp_3d )
 
 !
Index: /palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/read_var_list.f90	(revision 215)
+++ /palm/trunk/SOURCE/read_var_list.f90	(revision 216)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! limitations for nx_on_file, ny_on_file removed (read_parts_of_var_list)
 !
 ! Former revisions:
@@ -725,21 +725,7 @@
           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
 
 
Index: /palm/trunk/SOURCE/user_read_restart_data.f90
===================================================================
--- /palm/trunk/SOURCE/user_read_restart_data.f90	(revision 215)
+++ /palm/trunk/SOURCE/user_read_restart_data.f90	(revision 216)
@@ -1,10 +1,13 @@
- SUBROUTINE user_read_restart_data( nxlc, nxlf, nxl_on_file, nxrc, nxrf,  &
-                                    nxr_on_file, nync, nynf, nyn_on_file, &
-                                    nysc, nysf, nys_on_file, tmp_2d, tmp_3d )
+ SUBROUTINE user_read_restart_data( nxlfa, nxl_on_file, nxrfa, nxr_on_file, &
+                                    nynfa, nyn_on_file, nysfa, nys_on_file, &
+                                    offset_xa, offset_ya, overlap_count,    &
+                                    tmp_2d, tmp_3d )
 
 !------------------------------------------------------------------------------!
 ! Actual revisions:
 ! -----------------
-! Former file user_interface.f90 split into one file per subroutine
+! reading mechanism revised (subdomain/total domain size can vary arbitrarily
+! between current and previous run),
+! former file user_interface.f90 split into one file per subroutine
 !
 ! Former revisions:
@@ -30,6 +33,10 @@
     CHARACTER (LEN=20) :: field_char
 
-    INTEGER ::  nxlc, nxlf, nxl_on_file, nxrc, nxrf, nxr_on_file, nync, nynf, &
-                nyn_on_file, nysc, nysf, nys_on_file
+    INTEGER ::  k, nxlc, nxlf, nxl_on_file, nxrc, nxrf, nxr_on_file, nync, &
+                nynf, nyn_on_file, nysc, nysf, nys_on_file, overlap_count
+
+    INTEGER, DIMENSION(numprocs_previous_run,1000) ::  nxlfa, nxrfa, nynfa, &
+                                                       nysfa, offset_xa, &
+                                                       offset_ya
 
     REAL, DIMENSION(nys_on_file-1:nyn_on_file+1,nxl_on_file-1:nxr_on_file+1) ::&
@@ -48,21 +55,35 @@
 !       DO  WHILE ( TRIM( field_char ) /= '*** end user ***' )
 !
-!          SELECT CASE ( TRIM( field_char ) )
+!          DO  k = 1, overlap_count
 !
-!             CASE ( 'u2_av' )
-!                IF ( .NOT. ALLOCATED( u2_av ) ) THEN
-!                   ALLOCATE( u2_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
-!                ENDIF
-!                READ ( 13 )  tmp_3d
-!                u2_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
+!             nxlf = nxlfa(i,k)
+!             nxlc = nxlfa(i,k) + offset_xa(i,k)
+!             nxrf = nxrfa(i,k)
+!             nxrc = nxrfa(i,k) + offset_xa(i,k)
+!             nysf = nysfa(i,k)
+!             nysc = nysfa(i,k) + offset_ya(i,k)
+!             nynf = nynfa(i,k)
+!             nync = nynfa(i,k) + offset_ya(i,k)
+!
+!
+!             SELECT CASE ( TRIM( field_char ) )
+!
+!                CASE ( 'u2_av' )
+!                   IF ( .NOT. ALLOCATED( u2_av ) ) THEN
+!                      ALLOCATE( u2_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+!                   ENDIF
+!                   IF ( k == 1 )  READ ( 13 )  tmp_3d
+!                   u2_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
 !                                          tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)
 !
-!             CASE DEFAULT
-!                PRINT*, '+++ user_init: unknown variable named "', &
-!                        TRIM( field_char ), '" found in'
-!                PRINT*, '               data from prior run on PE ', myid
-!                CALL local_stop
+!                CASE DEFAULT
+!                   PRINT*, '+++ user_init: unknown variable named "', &
+!                           TRIM( field_char ), '" found in'
+!                   PRINT*, '               data from prior run on PE ', myid
+!                   CALL local_stop
 !
-!          END SELECT
+!             END SELECT
+!
+!          ENDDO
 !
 !          READ ( 13 )  field_char
