Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 4516)
+++ palm/trunk/SOURCE/Makefile	(revision 4517)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# dependencies for MPI-IO added
+# 
+# 4513 2020-04-30 13:45:47Z raasch
 # dependencies from chemistry modules updated
 # 
@@ -460,4 +463,5 @@
 	palm_date_time_mod.o \
 	radiation_model_mod.o \
+	restart_data_mpi_io_mod.o \
 	surface_mod.o
 chem_gasphase_mod.o: \
Index: palm/trunk/SOURCE/biometeorology_mod.f90
===================================================================
--- palm/trunk/SOURCE/biometeorology_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/biometeorology_mod.f90	(revision 4517)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
 ! 
@@ -365,5 +368,6 @@
 !-- Read local restart parameters
     INTERFACE bio_rrd_local
-       MODULE PROCEDURE bio_rrd_local
+       MODULE PROCEDURE bio_rrd_local_ftn
+       MODULE PROCEDURE bio_rrd_local_mpi
     END INTERFACE bio_rrd_local
 !
@@ -1429,7 +1433,7 @@
 ! Description:
 ! ------------
-!> Soubroutine reads local biometeorology configuration from restart file(s)
-!------------------------------------------------------------------------------!
- SUBROUTINE bio_rrd_local( found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE bio_rrd_local_ftn( found )
 
 
@@ -1465,5 +1469,18 @@
 
 
- END SUBROUTINE bio_rrd_local
+ END SUBROUTINE bio_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE bio_rrd_local_mpi
+
+    STOP '+++ reading restart data with MPI-IO not implemented for bio_rrd_local_mpi'
+
+ END SUBROUTINE bio_rrd_local_mpi
+
 
 !------------------------------------------------------------------------------!
Index: palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4517)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4506 2020-04-21 10:57:45Z schwenkel
 ! Use correct magnus formula for liquid water temperature
 ! 
@@ -183,5 +186,5 @@
 
     USE restart_data_mpi_io_mod,                                               &
-        ONLY:  rrd_mpi_io, wrd_mpi_io
+        ONLY:  rd_mpi_io_check_array, rrd_mpi_io, wrd_mpi_io
 
     USE statistics,                                                            &
@@ -404,5 +407,6 @@
 
     INTERFACE bcm_rrd_local
-       MODULE PROCEDURE bcm_rrd_local
+       MODULE PROCEDURE bcm_rrd_local_ftn
+       MODULE PROCEDURE bcm_rrd_local_mpi
     END INTERFACE bcm_rrd_local
 
@@ -3397,9 +3401,9 @@
 ! Description:
 ! ------------
-!> This routine reads the respective restart data for the bulk cloud module.
-!------------------------------------------------------------------------------!
-    SUBROUTINE bcm_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, tmp_3d, found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+    SUBROUTINE bcm_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,          &
+                                  nxr_on_file, nynf, nync, nyn_on_file, nysf,      &
+                                  nysc, nys_on_file, tmp_2d, tmp_3d, found )
 
 
@@ -3432,8 +3436,4 @@
        REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
 
-!
-!-- Here the reading of user-defined restart data follows:
-!-- Sample for user-defined output
-
 
        found = .TRUE.
@@ -3561,5 +3561,107 @@
 
 
-    END SUBROUTINE bcm_rrd_local
+    END SUBROUTINE bcm_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+    SUBROUTINE bcm_rrd_local_mpi
+
+       LOGICAL ::  array_found  !<
+
+
+       CALL rd_mpi_io_check_array( 'prr' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( prr ) )  ALLOCATE( prr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'prr', prr )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'prr_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( prr_av ) )  ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'prr_av', prr_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'precipitation_amount' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( precipitation_amount ) )  THEN
+             ALLOCATE( precipitation_amount(nysg:nyng,nxlg:nxrg) )
+          ENDIF
+          CALL rrd_mpi_io( 'precipitation_amount', precipitation_amount )
+       ENDIF
+
+       CALL rrd_mpi_io( 'ql', ql )
+
+       CALL rd_mpi_io_check_array( 'ql_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( ql_av ) )  ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'ql_av', ql_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'qc', qc )
+
+       CALL rd_mpi_io_check_array( 'qc_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( qc_av ) )  ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'qc_av', qc_av )
+       ENDIF
+
+       IF ( microphysics_morrison )  THEN
+
+          CALL rrd_mpi_io( 'nc', nc )
+
+          CALL rd_mpi_io_check_array( 'nc_av' , found = array_found )
+          IF ( array_found )  THEN
+             IF ( .NOT. ALLOCATED( nc_av ) )  ALLOCATE( nc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             CALL rrd_mpi_io( 'nc_av', nc_av )
+          ENDIF
+
+       ENDIF
+
+       IF ( microphysics_seifert )  THEN
+
+          CALL rrd_mpi_io( 'nr', nr )
+
+          CALL rd_mpi_io_check_array( 'nr_av' , found = array_found )
+          IF ( array_found )  THEN
+             IF ( .NOT. ALLOCATED( nr_av ) )  ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             CALL rrd_mpi_io( 'nr_av', nr_av )
+          ENDIF
+
+          CALL rrd_mpi_io( 'qr', qr )
+
+          CALL rd_mpi_io_check_array( 'qr_av' , found = array_found )
+          IF ( array_found )  THEN
+             IF ( .NOT. ALLOCATED( qr_av ) )  ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             CALL rrd_mpi_io( 'qr_av', qr_av )
+          ENDIF
+
+       ENDIF
+
+       IF ( microphysics_ice_extension )  THEN
+
+          CALL rrd_mpi_io( 'ni', ni )
+
+          CALL rd_mpi_io_check_array( 'ni_av' , found = array_found )
+          IF ( array_found )  THEN
+             IF ( .NOT. ALLOCATED( ni_av ) )  ALLOCATE( ni_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             CALL rrd_mpi_io( 'ni_av', ni_av )
+          ENDIF
+
+          CALL rrd_mpi_io( 'qi', qi )
+
+          CALL rd_mpi_io_check_array( 'qi_av' , found = array_found )
+          IF ( array_found )  THEN
+             IF ( .NOT. ALLOCATED( qi_av ) )  ALLOCATE( qi_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+             CALL rrd_mpi_io( 'qi_av', qi_av )
+          ENDIF
+
+       ENDIF
+
+
+    END SUBROUTINE bcm_rrd_local_mpi
 
 
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4517)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO
+! 
+! 4511 2020-04-30 12:20:40Z raasch
 ! decycling replaced by explicit setting of lateral boundary conditions
 !
@@ -312,4 +315,5 @@
                 max_pr_user,                                                                       &
                 monotonic_limiter_z,                                                               &
+                restart_data_format_output,                                                        &
                 scalar_advec,                                                                      &
                 timestep_scheme, use_prescribed_profile_data, ws_scheme_sca, air_chemistry
@@ -329,4 +333,7 @@
     USE cpulog,                                                                                    &
         ONLY:  cpu_log, log_point_s
+
+    USE restart_data_mpi_io_mod,                                                                   &
+        ONLY:  rrd_mpi_io, wrd_mpi_io
 
     USE statistics
@@ -501,5 +508,6 @@
 
     INTERFACE chem_rrd_local
-       MODULE PROCEDURE chem_rrd_local
+       MODULE PROCEDURE chem_rrd_local_ftn
+       MODULE PROCEDURE chem_rrd_local_mpi
     END INTERFACE chem_rrd_local
 
@@ -3042,9 +3050,9 @@
 ! Description:
 ! ------------
-!> Subroutine to read restart data of chemical species
-!------------------------------------------------------------------------------!
- SUBROUTINE chem_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,             &
-                            nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,   &
-                            nys_on_file, tmp_3d, found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE chem_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,             &
+                                nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,   &
+                                nys_on_file, tmp_3d, found )
 
     USE control_parameters
@@ -3076,5 +3084,5 @@
 
 
-    IF ( ALLOCATED(chem_species) )  THEN
+    IF ( ALLOCATED( chem_species ) )  THEN
 
        DO  lsp = 1, nspec
@@ -3105,5 +3113,30 @@
 
 
- END SUBROUTINE chem_rrd_local
+ END SUBROUTINE chem_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE chem_rrd_local_mpi
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  lsp !<
+
+    IF ( ALLOCATED( chem_species ) )  THEN
+
+       DO  lsp = 1, nspec
+
+          CALL rrd_mpi_io( TRIM( chem_species(lsp)%name ), chem_species(lsp)%conc )
+          CALL rrd_mpi_io( TRIM( chem_species(lsp)%name )//'_av', chem_species(lsp)%conc_av )
+
+       ENDDO
+
+    ENDIF
+
+ END SUBROUTINE chem_rrd_local_mpi
 
 
@@ -3208,10 +3241,21 @@
     INTEGER(iwp) ::  lsp  !< running index for chem spcs. 
 
-    DO  lsp = 1, nspec
-       CALL wrd_write_string( TRIM( chem_species(lsp)%name ) )
-       WRITE ( 14 )  chem_species(lsp)%conc
-       CALL wrd_write_string( TRIM( chem_species(lsp)%name )//'_av' )
-       WRITE ( 14 )  chem_species(lsp)%conc_av
-    ENDDO
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+       DO  lsp = 1, nspec
+          CALL wrd_write_string( TRIM( chem_species(lsp)%name ) )
+          WRITE ( 14 )  chem_species(lsp)%conc
+          CALL wrd_write_string( TRIM( chem_species(lsp)%name )//'_av' )
+          WRITE ( 14 )  chem_species(lsp)%conc_av
+       ENDDO
+
+    ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' )  THEN
+
+       DO  lsp = 1, nspec
+          CALL wrd_mpi_io( TRIM( chem_species(lsp)%name ), chem_species(lsp)%conc )
+          CALL wrd_mpi_io( TRIM( chem_species(lsp)%name ) // '_av', chem_species(lsp)%conc_av )
+       ENDDO
+
+    ENDIF
 
  END SUBROUTINE chem_wrd_local
Index: palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90
===================================================================
--- palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4517)
@@ -110,4 +110,5 @@
                data_output,                                                    &
                message_string,                                                 &
+               restart_data_format_output,                                     &
                varnamelength
 !
@@ -1942,4 +1943,5 @@
 !> Note: With the current structure reading of non-standard array is not
 !> possible
+!> COMMENT:  these arrays should be given standard index bounds! (Siggi)
 !------------------------------------------------------------------------------!
 !  SUBROUTINE doq_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,             &
@@ -2048,69 +2050,77 @@
     IMPLICIT NONE
 
-    IF ( ALLOCATED( pt_2m_av ) )  THEN
-       CALL wrd_write_string( 'pt_2m_av' )
-       WRITE ( 14 )  pt_2m_av
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+       IF ( ALLOCATED( pt_2m_av ) )  THEN
+          CALL wrd_write_string( 'pt_2m_av' )
+          WRITE ( 14 )  pt_2m_av
+       ENDIF
+
+       IF ( ALLOCATED( ti_av ) )  THEN
+          CALL wrd_write_string( 'ti_av' )
+          WRITE ( 14 )  ti_av
+       ENDIF
+
+       IF ( ALLOCATED( uu_av ) )  THEN
+          CALL wrd_write_string( 'uu_av' )
+          WRITE ( 14 )  uu_av
+       ENDIF
+
+       IF ( ALLOCATED( uv_10m_av ) )  THEN
+          CALL wrd_write_string( 'uv_10m_av' )
+          WRITE ( 14 )  uv_10m_av
+       ENDIF
+
+       IF ( ALLOCATED( vv_av ) )  THEN
+          CALL wrd_write_string( 'vv_av' )
+          WRITE ( 14 )  vv_av
+       ENDIF
+
+       IF ( ALLOCATED( ww_av ) )  THEN
+          CALL wrd_write_string( 'ww_av' )
+          WRITE ( 14 )  ww_av
+       ENDIF
+
+       IF ( ALLOCATED( wu_av ) )  THEN
+          CALL wrd_write_string( 'wu_av' )
+          WRITE ( 14 )  wu_av
+       ENDIF
+
+       IF ( ALLOCATED( wv_av ) )  THEN
+          CALL wrd_write_string( 'wv_av' )
+          WRITE ( 14 )  wv_av
+       ENDIF
+
+       IF ( ALLOCATED( wtheta_av ) )  THEN
+          CALL wrd_write_string( 'wtheta_av' )
+          WRITE ( 14 )  wtheta_av
+       ENDIF
+
+       IF ( ALLOCATED( wq_av ) )  THEN
+          CALL wrd_write_string( 'wq_av' )
+          WRITE ( 14 )  wq_av
+       ENDIF
+
+       IF ( ALLOCATED( wspeed_av ) )  THEN
+          CALL wrd_write_string( 'wspeed_av' )
+          WRITE ( 14 )  wspeed_av
+       ENDIF
+
+       IF ( ALLOCATED( u_center_av ) )  THEN
+          CALL wrd_write_string( 'u_center_av' )
+          WRITE ( 14 )  u_center_av
+       ENDIF
+
+       IF ( ALLOCATED( v_center_av ) )  THEN
+          CALL wrd_write_string( 'v_center_av' )
+          WRITE ( 14 )  v_center_av
+       ENDIF
+
+    ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' )  THEN
+
+       STOP 'mpi-io for doq_wrd_local not realized'
+
     ENDIF
 
-    IF ( ALLOCATED( ti_av ) )  THEN
-       CALL wrd_write_string( 'ti_av' )
-       WRITE ( 14 )  ti_av
-    ENDIF
-
-    IF ( ALLOCATED( uu_av ) )  THEN
-       CALL wrd_write_string( 'uu_av' )
-       WRITE ( 14 )  uu_av
-    ENDIF
-
-    IF ( ALLOCATED( uv_10m_av ) )  THEN
-       CALL wrd_write_string( 'uv_10m_av' )
-       WRITE ( 14 )  uv_10m_av
-    ENDIF
-
-    IF ( ALLOCATED( vv_av ) )  THEN
-       CALL wrd_write_string( 'vv_av' )
-       WRITE ( 14 )  vv_av
-    ENDIF
-
-    IF ( ALLOCATED( ww_av ) )  THEN
-       CALL wrd_write_string( 'ww_av' )
-       WRITE ( 14 )  ww_av
-    ENDIF
-
-    IF ( ALLOCATED( wu_av ) )  THEN
-       CALL wrd_write_string( 'wu_av' )
-       WRITE ( 14 )  wu_av
-    ENDIF
-
-    IF ( ALLOCATED( wv_av ) )  THEN
-       CALL wrd_write_string( 'wv_av' )
-       WRITE ( 14 )  wv_av
-    ENDIF
-
-    IF ( ALLOCATED( wtheta_av ) )  THEN
-       CALL wrd_write_string( 'wtheta_av' )
-       WRITE ( 14 )  wtheta_av
-    ENDIF
-
-    IF ( ALLOCATED( wq_av ) )  THEN
-       CALL wrd_write_string( 'wq_av' )
-       WRITE ( 14 )  wq_av
-    ENDIF
-
-    IF ( ALLOCATED( wspeed_av ) )  THEN
-       CALL wrd_write_string( 'wspeed_av' )
-       WRITE ( 14 )  wspeed_av
-    ENDIF
-
-    IF ( ALLOCATED( u_center_av ) )  THEN
-       CALL wrd_write_string( 'u_center_av' )
-       WRITE ( 14 )  u_center_av
-    ENDIF
-
-    IF ( ALLOCATED( v_center_av ) )  THEN
-       CALL wrd_write_string( 'v_center_av' )
-       WRITE ( 14 )  v_center_av
-    ENDIF
-
  END SUBROUTINE doq_wrd_local
 
Index: palm/trunk/SOURCE/dynamics_mod.f90
===================================================================
--- palm/trunk/SOURCE/dynamics_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/dynamics_mod.f90	(revision 4517)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4505 2020-04-20 15:37:15Z schwenkel
 ! Add flag for saturation check
 ! 
@@ -279,5 +282,6 @@
 
     INTERFACE dynamics_rrd_local
-       MODULE PROCEDURE dynamics_rrd_local
+       MODULE PROCEDURE dynamics_rrd_local_ftn
+       MODULE PROCEDURE dynamics_rrd_local_mpi
     END INTERFACE dynamics_rrd_local
 
@@ -1871,11 +1875,11 @@
 ! Description:
 ! ------------
-!> Read module-specific processor specific restart data from file(s).
+!> Read module-specific local restart data arrays (Fortran binary format).
 !> Subdomain index limits on file are given by nxl_on_file, etc.
 !> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the subdomain on file (f)
 !> to the subdomain of the current PE (c). They have been calculated in routine rrd_local.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE dynamics_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, tmp_3d, found )
+ SUBROUTINE dynamics_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync,   &
+                                    nyn_on_file, nysf, nysc, nys_on_file, tmp_2d, tmp_3d, found )
 
 
@@ -1920,5 +1924,29 @@
     END SELECT
 
- END SUBROUTINE dynamics_rrd_local
+ END SUBROUTINE dynamics_rrd_local_ftn
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE dynamics_rrd_local_mpi
+
+    IMPLICIT NONE
+
+!    LOGICAL ::  array_found  !<
+
+
+!    CALL rd_mpi_io_check_array( 'u2_av' , found = array_found )
+!    IF ( array_found )  THEN
+!       IF ( .NOT. ALLOCATED( u2_av ) )  ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+!       CALL rrd_mpi_io( 'u2_av', u2_av )
+!    ENDIF
+
+    CONTINUE
+
+ END SUBROUTINE dynamics_rrd_local_mpi
+
 
 
Index: palm/trunk/SOURCE/gust_mod.f90
===================================================================
--- palm/trunk/SOURCE/gust_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/gust_mod.f90	(revision 4517)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
 ! 
@@ -186,5 +189,6 @@
 
     INTERFACE gust_rrd_local
-       MODULE PROCEDURE gust_rrd_local
+       MODULE PROCEDURE gust_rrd_local_ftn
+       MODULE PROCEDURE gust_rrd_local_mpi
     END INTERFACE gust_rrd_local
 
@@ -618,9 +622,9 @@
 ! Description:
 ! ------------
-!> This routine reads the respective restart data for the gust module.
-!------------------------------------------------------------------------------!
-    SUBROUTINE gust_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, tmp_3d, found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+    SUBROUTINE gust_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,         &
+                                   nxr_on_file, nynf, nync, nyn_on_file, nysf,     &
+                                   nysc, nys_on_file, tmp_2d, tmp_3d, found )
 
 
@@ -686,5 +690,18 @@
 
 
-    END SUBROUTINE gust_rrd_local
+    END SUBROUTINE gust_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+    SUBROUTINE gust_rrd_local_mpi
+
+
+!       CALL rrd_mpi_io( 'local_array', local_array )
+
+    END SUBROUTINE gust_rrd_local_mpi
 
 
Index: palm/trunk/SOURCE/lagrangian_particle_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4517)
@@ -210,5 +210,5 @@
 
     USE restart_data_mpi_io_mod,                                                                   &
-        ONLY:  rrd_mpi_io, wrd_mpi_io
+        ONLY:  rd_mpi_io_check_array, rrd_mpi_io, wrd_mpi_io
 
     USE statistics,                                                            &
@@ -413,5 +413,6 @@
 
     INTERFACE lpm_rrd_local
-       MODULE PROCEDURE lpm_rrd_local
+       MODULE PROCEDURE lpm_rrd_local_ftn
+       MODULE PROCEDURE lpm_rrd_local_mpi
     END INTERFACE lpm_rrd_local
 
@@ -3021,7 +3022,12 @@
  
  
- SUBROUTINE lpm_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,          &
-                              nxr_on_file, nynf, nync, nyn_on_file, nysf,  &
-                              nysc, nys_on_file, tmp_3d, found )
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE lpm_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,          &
+                               nxr_on_file, nynf, nync, nyn_on_file, nysf,  &
+                               nysc, nys_on_file, tmp_3d, found )
 
 
@@ -3101,7 +3107,54 @@
        END SELECT
 
-
- END SUBROUTINE lpm_rrd_local
+ END SUBROUTINE lpm_rrd_local_ftn
+
  
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+ SUBROUTINE lpm_rrd_local_mpi
+
+    IMPLICIT NONE
+
+    LOGICAL ::  array_found  !<
+
+    CALL rrd_mpi_io( 'iran', iran ) ! matching random numbers is still unresolved issue
+    CALL rrd_mpi_io( 'iran_part', iran_part )
+
+    CALL rd_mpi_io_check_array( 'pc_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( pc_av ) )  ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'pc_av', pc_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'pr_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( pr_av ) )  ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'pr_av', pr_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'ql_c_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( ql_c_av ) )  ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'ql_c_av', ql_c_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'ql_v_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( ql_v_av ) )  ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'ql_v_av', ql_v_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'ql_vp_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( ql_vp_av ) )  ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'ql_vp_av', ql_vp_av )
+    ENDIF
+
+ END SUBROUTINE lpm_rrd_local_mpi
+
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -3168,7 +3221,15 @@
 #endif
 
-    CALL wrd_write_string( 'iran' ) 
-    WRITE ( 14 )  iran, iran_part 
-
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+       CALL wrd_write_string( 'iran' )  ! matching random numbers is still unresolved issue
+       WRITE ( 14 )  iran, iran_part
+
+    ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' )  THEN
+
+       CALL wrd_mpi_io( 'iran', iran )  ! matching random numbers is still unresolved issue
+       CALL wrd_mpi_io( 'iran_part', iran_part )
+
+    ENDIF
 
  END SUBROUTINE lpm_wrd_local
Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4517)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
 ! 
@@ -291,5 +294,6 @@
 
     USE restart_data_mpi_io_mod,                                                                   &
-        ONLY:  rd_mpi_io_surface_filetypes, wrd_mpi_io, wrd_mpi_io_surface
+        ONLY:  rd_mpi_io_check_array, rd_mpi_io_surface_filetypes, rrd_mpi_io, rrd_mpi_io_surface, &
+               wrd_mpi_io, wrd_mpi_io_surface
 
     USE statistics,                                                            &
@@ -808,5 +812,6 @@
 
     INTERFACE lsm_rrd_local
-       MODULE PROCEDURE lsm_rrd_local
+       MODULE PROCEDURE lsm_rrd_local_ftn
+       MODULE PROCEDURE lsm_rrd_local_mpi
     END INTERFACE lsm_rrd_local
 
@@ -6674,5 +6679,5 @@
        CALL wrd_mpi_io( 'lsm_end_index_h',  surf_lsm_h%end_index )
        CALL wrd_mpi_io( 'lsm_global_start_index_h', global_start_index )
-       CALL wrd_mpi_io_surface ( 't_soil_h', t_soil_h%var_2d )
+       CALL wrd_mpi_io_surface( 't_soil_h', t_soil_h%var_2d )
        CALL wrd_mpi_io_surface( 'm_soil_h',  m_soil_h%var_2d )
        CALL wrd_mpi_io_surface( 'm_liq_h', m_liq_h%var_1d )
@@ -6686,7 +6691,7 @@
                                              surface_data_to_write, global_start_index )
 
-          CALL wrd_mpi_io( 'lsm_start_index_v_' //dum,  surf_lsm_v(l)%start_index )
-          CALL wrd_mpi_io( 'lsm_end_index_v_' //dum,  surf_lsm_v(l)%end_index )
-          CALL wrd_mpi_io( 'lsm_global_start_index_v_' //dum , global_start_index )
+          CALL wrd_mpi_io( 'lsm_start_index_v_' // dum,  surf_lsm_v(l)%start_index )
+          CALL wrd_mpi_io( 'lsm_end_index_v_' // dum,  surf_lsm_v(l)%end_index )
+          CALL wrd_mpi_io( 'lsm_global_start_index_v_' // dum , global_start_index )
 
           IF ( .NOT. surface_data_to_write )  CYCLE
@@ -6708,9 +6713,9 @@
 ! Description:
 ! ------------
-!> Soubroutine reads lsm data from restart file(s)
+!> Read module-specific local restart data arrays (Fortran binary format).
 !------------------------------------------------------------------------------!
- 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 )
+ SUBROUTINE lsm_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,              &
+                               nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,    &
+                               nys_on_file, tmp_2d, found )
 
 
@@ -7305,5 +7310,133 @@
 
 
- END SUBROUTINE lsm_rrd_local
+ END SUBROUTINE lsm_rrd_local_ftn
+
+!------------------------------------------------------------------------------!
+!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+ SUBROUTINE lsm_rrd_local_mpi
+
+    USE control_parameters
+
+    USE indices
+
+    USE pegrid
+
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=1) ::  dum  !< dummy to create correct string for creating variable string
+
+    INTEGER(iwp) ::  l   !< running index surface orientation
+
+    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  end_index
+    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  global_start
+    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  start_index
+
+    LOGICAL      :: array_found
+    LOGICAL      :: ldum
+
+
+    CALL rd_mpi_io_check_array( 'c_liq_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( c_liq_av ) )  ALLOCATE( c_liq_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'c_liq_av',  c_liq_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'c_soil_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( c_soil_av ) )  ALLOCATE( c_soil_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'c_soil_av',  c_soil_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'c_veg_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( c_veg_av ) )  ALLOCATE( c_veg_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'c_veg_av',  c_veg_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'lai_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( lai_av ) )  ALLOCATE( lai_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'lai_av',  lai_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'm_liq_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( m_liq_av ) )  ALLOCATE( m_liq_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'm_liq_av',  m_liq_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'm_soil_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( m_soil_av ) )  ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'm_soil_av', m_soil_av, nzb_soil, nzt_soil )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'qsws_liq_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( qsws_liq_av ) )  ALLOCATE( qsws_liq_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'qsws_liq_av',  qsws_liq_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'qsws_soil_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( qsws_soil_av ) )  ALLOCATE( qsws_soil_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'qsws_soil_av',  qsws_soil_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'qsws_veg_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( qsws_veg_av ) )  ALLOCATE( qsws_veg_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'qsws_veg_av',  qsws_veg_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 't_soil_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( t_soil_av ) )  ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 't_soil_av', t_soil_av, nzb_soil, nzt_soil )
+    ENDIF
+
+    CALL rrd_mpi_io( 'lsm_start_index_h',  surf_lsm_h%start_index )
+    CALL rrd_mpi_io( 'lsm_end_index_h',  surf_lsm_h%end_index )
+    CALL rrd_mpi_io( 'lsm_global_start_index_h', global_start )
+
+    CALL rd_mpi_io_surface_filetypes ( surf_lsm_h%start_index, surf_lsm_h%end_index, ldum,         &
+                                       global_start )
+
+    CALL rrd_mpi_io_surface( 't_soil_h', t_soil_h%var_2d )
+    CALL rrd_mpi_io_surface( 'm_soil_h',  m_soil_h%var_2d )
+    CALL rrd_mpi_io_surface( 'm_liq_h', m_liq_h%var_1d )
+    CALL rrd_mpi_io_surface( 't_surface_h', t_surface_h%var_1d )
+
+
+    DO  l = 0, 3
+
+       WRITE( dum, '(I1)')  l
+
+!kk    In case of nothing to do, the settings of start_index and end_index differ
+!kk    between writing and reading restart file
+!kk
+!kk    Has to be discussed with the developpers
+
+       CALL rrd_mpi_io( 'lsm_start_index_v_' // dum,  start_index )
+       CALL rrd_mpi_io( 'lsm_end_index_v_' // dum,  end_index )
+       CALL rrd_mpi_io( 'lsm_global_start_index_v_' // dum , global_start )
+
+       CALL rd_mpi_io_surface_filetypes( start_index, end_index, ldum, global_start )
+
+       IF ( MAXVAL( end_index ) <= 0 )  CYCLE
+
+       CALL rrd_mpi_io_surface( 't_soil_v(' // dum // ')', t_soil_v(l)%var_2d )
+       CALL rrd_mpi_io_surface( 'm_soil_v(' // dum // ')', m_soil_v(l)%var_2d )
+       CALL rrd_mpi_io_surface( 'm_liq_v(' // dum // ')',  m_liq_v(l)%var_1d )
+       CALL rrd_mpi_io_surface( 't_surface_v(' // dum // ')',  t_surface_v(l)%var_1d )
+
+    ENDDO
+
+ END SUBROUTINE lsm_rrd_local_mpi
 
 !------------------------------------------------------------------------------!
Index: palm/trunk/SOURCE/module_interface.f90
===================================================================
--- palm/trunk/SOURCE/module_interface.f90	(revision 4516)
+++ palm/trunk/SOURCE/module_interface.f90	(revision 4517)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4514 2020-04-30 16:29:59Z suehring
 ! Added global restart routines for plant-canopy model
 ! 
@@ -704,5 +707,6 @@
 
     INTERFACE module_interface_rrd_local
-       MODULE PROCEDURE module_interface_rrd_local
+       MODULE PROCEDURE module_interface_rrd_local_ftn
+       MODULE PROCEDURE module_interface_rrd_local_mpi
     END INTERFACE module_interface_rrd_local
 
@@ -1806,12 +1810,12 @@
 ! Description:
 ! ------------
-!> Read module-specific restart data specific to local MPI ranks
-!------------------------------------------------------------------------------!
- SUBROUTINE module_interface_rrd_local( map_index,                             &
-                                        nxlf, nxlc, nxl_on_file,               &
-                                        nxrf, nxrc, nxr_on_file,               &
-                                        nynf, nync, nyn_on_file,               &
-                                        nysf, nysc, nys_on_file,               &
-                                        tmp_2d, tmp_3d, found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE module_interface_rrd_local_ftn( map_index,                             &
+                                           nxlf, nxlc, nxl_on_file,               &
+                                           nxrf, nxrc, nxr_on_file,               &
+                                           nynf, nync, nyn_on_file,               &
+                                           nysf, nysc, nys_on_file,               &
+                                           tmp_2d, tmp_3d, found )
 
 
@@ -1839,5 +1843,7 @@
 
 
-    IF ( debug_output )  CALL debug_message( 'module-specific read local restart data', 'start' )
+    IF ( debug_output )  THEN
+       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'start' )
+    ENDIF
 
     CALL dynamics_rrd_local(                                                   &
@@ -1965,8 +1971,45 @@
                             ) ! ToDo: change interface to pass variable
 
-    IF ( debug_output )  CALL debug_message( 'module-specific read local restart data', 'end' )
-
-
- END SUBROUTINE module_interface_rrd_local
+    IF ( debug_output )  THEN
+       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'end' )
+    ENDIF
+
+ END SUBROUTINE module_interface_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+ SUBROUTINE module_interface_rrd_local_mpi
+
+    IF ( debug_output )  THEN
+       CALL debug_message( 'module-specific read local restart data (MPI-IO)', 'start' )
+    ENDIF
+
+    CALL dynamics_rrd_local
+
+!    IF ( biometeorology )       CALL bio_rrd_local
+    IF ( bulk_cloud_model )     CALL bcm_rrd_local
+    IF ( air_chemistry )        CALL chem_rrd_local
+!    CALL doq_rrd_local
+    IF ( gust_module_enabled )  CALL gust_rrd_local
+    IF ( particle_advection )   CALL lpm_rrd_local
+    IF ( land_surface )         CALL lsm_rrd_local
+    IF ( plant_canopy )         CALL pcm_rrd_local
+    IF ( ocean_mode )           CALL ocean_rrd_local
+    IF ( radiation )            CALL radiation_rrd_local
+!    IF ( salsa )                CALL salsa_rrd_local
+    IF ( urban_surface )        CALL usm_rrd_local
+    IF ( surface_output )       CALL surface_data_output_rrd_local
+
+    IF ( user_module_enabled )  CALL user_rrd_local
+
+    IF ( debug_output )  THEN
+       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'end' )
+    ENDIF
+
+ END SUBROUTINE module_interface_rrd_local_mpi
 
 
Index: palm/trunk/SOURCE/ocean_mod.f90
===================================================================
--- palm/trunk/SOURCE/ocean_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/ocean_mod.f90	(revision 4517)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
 ! 
@@ -102,5 +105,6 @@
 
     USE restart_data_mpi_io_mod,                                                                   &
-        ONLY:  rrd_mpi_io, rrd_mpi_io_global_array, wrd_mpi_io, wrd_mpi_io_global_array
+        ONLY:  rd_mpi_io_check_array, rrd_mpi_io, rrd_mpi_io_global_array, wrd_mpi_io,             &
+               wrd_mpi_io_global_array
 
     USE surface_mod,                                                           &
@@ -232,5 +236,6 @@
 
     INTERFACE ocean_rrd_local
-       MODULE PROCEDURE ocean_rrd_local
+       MODULE PROCEDURE ocean_rrd_local_ftn
+       MODULE PROCEDURE ocean_rrd_local_mpi
     END INTERFACE ocean_rrd_local
 
@@ -2039,9 +2044,9 @@
 ! Description:
 ! ------------
-!> This routine reads the respective restart data for the ocean module.
-!------------------------------------------------------------------------------!
- SUBROUTINE ocean_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,           &
-                             nxr_on_file, nynf, nync, nyn_on_file, nysf,       &
-                             nysc, nys_on_file, tmp_3d, found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE ocean_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,           &
+                                 nxr_on_file, nynf, nync, nyn_on_file, nysf,       &
+                                 nysc, nys_on_file, tmp_3d, found )
 
     USE averaging,                                                             &
@@ -2108,5 +2113,40 @@
     END SELECT
 
- END SUBROUTINE ocean_rrd_local
+ END SUBROUTINE ocean_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+ SUBROUTINE ocean_rrd_local_mpi
+
+    USE averaging,                                                             &
+        ONLY:  rho_ocean_av, sa_av
+
+    USE indices,                                                               &
+        ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
+
+    IMPLICIT NONE
+
+    LOGICAL ::  array_found  !<
+
+
+    CALL rd_mpi_io_check_array( 'rho_ocean_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rho_ocean_av ) )  ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rho_ocean_av', rho_ocean_av )
+    ENDIF
+
+    CALL rrd_mpi_io( 'sa', sa )
+
+    CALL rd_mpi_io_check_array( 'sa_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( sa_av ) )  ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'sa_av', sa_av )
+    ENDIF
+
+ END SUBROUTINE ocean_rrd_local_mpi
 
 
Index: palm/trunk/SOURCE/plant_canopy_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4517)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4515 2020-04-30 16:37:18Z suehring
 ! Rename error number again since this was recently given in -r 4511
 ! 
@@ -237,5 +240,6 @@
 
     USE restart_data_mpi_io_mod,                                                                   &
-        ONLY:  rrd_mpi_io,                                                                         &
+        ONLY:  rd_mpi_io_check_array,                                                              &
+               rrd_mpi_io,                                                                         &
                wrd_mpi_io
 
@@ -361,5 +365,6 @@
 
     INTERFACE pcm_rrd_local
-       MODULE PROCEDURE pcm_rrd_local
+       MODULE PROCEDURE pcm_rrd_local_ftn
+       MODULE PROCEDURE pcm_rrd_local_mpi
     END INTERFACE pcm_rrd_local
 
@@ -1685,12 +1690,13 @@
     END SUBROUTINE pcm_rrd_global_mpi
 
+
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Subroutine reads local (subdomain) restart data
-!------------------------------------------------------------------------------!
-    SUBROUTINE pcm_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,          &
-                              nxr_on_file, nynf, nync, nyn_on_file, nysf,      &
-                              nysc, nys_on_file, found )
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+    SUBROUTINE pcm_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,          &
+                                  nxr_on_file, nynf, nync, nyn_on_file, nysf,      &
+                                  nysc, nys_on_file, found )
 
        INTEGER(iwp) ::  k               !< 
@@ -1751,5 +1757,40 @@
        END SELECT
 
-    END SUBROUTINE pcm_rrd_local
+    END SUBROUTINE pcm_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+    SUBROUTINE pcm_rrd_local_mpi
+
+       IMPLICIT NONE
+
+       LOGICAL ::  array_found  !<
+
+
+!>     TODO: following code does not work because arrays are sized 0:pch_index along k!!!!!
+       CALL rd_mpi_io_check_array( 'pcm_heatrate_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( pcm_heatrate_av ) )  ALLOCATE( pcm_heatrate_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'pcm_heatrate_av', pcm_heatrate_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'pcm_latentrate_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( pcm_latentrate_av ) )  ALLOCATE( pcm_latentrate_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'pcm_latentrate_av', pcm_latentrate_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'pcm_transpirationrate_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( pcm_transpirationrate_av ) )  ALLOCATE( pcm_transpirationrate_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'pcm_transpirationrate_av', pcm_transpirationrate_av )
+       ENDIF
+
+    END SUBROUTINE pcm_rrd_local_mpi
+
 
 !------------------------------------------------------------------------------!
Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4517)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
 ! 
@@ -364,5 +367,5 @@
 #endif
     USE restart_data_mpi_io_mod,                                                                   &
-        ONLY:  wrd_mpi_io
+        ONLY:  rd_mpi_io_check_array, rrd_mpi_io, wrd_mpi_io
 
     USE statistics,                                                            &
@@ -971,5 +974,6 @@
 
     INTERFACE radiation_rrd_local
-       MODULE PROCEDURE radiation_rrd_local
+       MODULE PROCEDURE radiation_rrd_local_ftn
+       MODULE PROCEDURE radiation_rrd_local_mpi
     END INTERFACE radiation_rrd_local
 
@@ -12080,9 +12084,9 @@
 ! Description:
 ! ------------
-!> Subroutine reads local (subdomain) restart data
+!> Read module-specific local restart data arrays (Fortran binary format).
 !------------------------------------------------------------------------------!
- SUBROUTINE radiation_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, tmp_3d, found )
+ SUBROUTINE radiation_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,       &
+                                     nxr_on_file, nynf, nync, nyn_on_file, nysf,    &
+                                     nysc, nys_on_file, tmp_2d, tmp_3d, found )
 
 
@@ -12428,6 +12432,211 @@
     END SELECT
 
- END SUBROUTINE radiation_rrd_local
-
+ END SUBROUTINE radiation_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+ SUBROUTINE radiation_rrd_local_mpi
+
+    USE control_parameters
+
+    USE indices
+
+    USE kinds
+
+
+    IMPLICIT NONE
+
+    LOGICAL      ::  array_found  !<
+
+    REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  tmp  !< temporary array for reading from file
+
+
+    CALL rd_mpi_io_check_array( 'rad_net_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_net_av ) )  ALLOCATE( rad_net_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_net_av', rad_net_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_in_xy_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_lw_in_xy_av ) )  ALLOCATE( rad_lw_in_xy_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_lw_in_xy_av', rad_lw_in_xy_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_out_xy_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_lw_out_xy_av ) )  ALLOCATE( rad_lw_out_xy_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_lw_out_xy_av', rad_lw_out_xy_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_in_xy_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_sw_in_xy_av ) )  ALLOCATE( rad_sw_in_xy_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_sw_in_xy_av', rad_sw_in_xy_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_out_xy_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_sw_out_xy_av ) )  ALLOCATE( rad_sw_out_xy_av(nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_sw_out_xy_av', rad_sw_out_xy_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_in' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_lw_in ) )  ALLOCATE( rad_lw_in(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_in', tmp )
+          rad_lw_in(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_lw_in ) )  ALLOCATE( rad_lw_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_in', rad_lw_in )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_in_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_lw_in_av ) )  ALLOCATE( rad_lw_in_av(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_in_av', tmp )
+          rad_lw_in_av(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_lw_in_av ) )  ALLOCATE( rad_lw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_in_av', rad_lw_in_av )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_out' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_lw_out ) )  ALLOCATE( rad_lw_out(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_out', tmp )
+          rad_lw_out(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_lw_out ) )  ALLOCATE( rad_lw_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_out', rad_lw_out )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_out_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_lw_out_av ) )  ALLOCATE( rad_lw_out_av(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_out_av', tmp )
+          rad_lw_out_av(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_lw_out_av ) )  ALLOCATE( rad_lw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_lw_out_av', rad_lw_out_av )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_cs_hr' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_lw_cs_hr ) )  ALLOCATE( rad_lw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_lw_cs_hr', rad_lw_cs_hr )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_cs_hr_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_lw_cs_hr_av ) )  ALLOCATE( rad_lw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_lw_cs_hr_av', rad_lw_cs_hr_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_hr' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_lw_hr ) )  ALLOCATE( rad_lw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_lw_hr', rad_lw_hr )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_lw_hr_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_lw_hr_av ) )  ALLOCATE( rad_lw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_lw_hr_av', rad_lw_hr_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_in' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_sw_in ) )  ALLOCATE( rad_sw_in(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_in', tmp )
+          rad_sw_in(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_sw_in ) )  ALLOCATE( rad_sw_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_in', rad_sw_in )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_in_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_sw_in_av ) )  ALLOCATE( rad_sw_in_av(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_in_av', tmp )
+          rad_sw_in_av(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_sw_in_av ) )  ALLOCATE( rad_sw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_in_av', rad_sw_in_av )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_out' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_sw_out ) )  ALLOCATE( rad_sw_out(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_out',  tmp)
+          rad_sw_out(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_sw_out ) )  ALLOCATE( rad_sw_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_out',  rad_sw_out )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_out_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( radiation_scheme == 'clear-sky'  .OR.  radiation_scheme == 'constant'  .OR.            &
+            radiation_scheme == 'external' )  THEN
+          IF ( .NOT. ALLOCATED( rad_sw_out_av ) )  ALLOCATE( rad_sw_out_av(0:0,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_out_av', tmp )
+          rad_sw_out_av(0,:,:) = tmp
+       ELSE
+          IF ( .NOT. ALLOCATED( rad_sw_out_av ) )  ALLOCATE( rad_sw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'rad_sw_out_av', rad_sw_out_av )
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_cs_hr' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_sw_cs_hr ) )  ALLOCATE( rad_sw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_sw_cs_hr', rad_sw_cs_hr )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_cs_hr_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_sw_cs_hr_av ) )  ALLOCATE( rad_sw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_sw_cs_hr_av', rad_sw_cs_hr_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_hr' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_sw_hr ) )  ALLOCATE( rad_sw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_sw_hr', rad_sw_hr )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'rad_sw_hr_av' , found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( rad_sw_hr_av ) )  ALLOCATE( rad_sw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'rad_sw_hr_av', rad_sw_hr_av )
+    ENDIF
+
+ END SUBROUTINE radiation_rrd_local_mpi
 
  END MODULE radiation_model_mod
Index: palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4517)
@@ -1147,5 +1147,5 @@
 
 !
-!--    Close restart File
+!--    Close restart file
        CALL rd_mpi_io_close
 
@@ -1376,5 +1376,5 @@
 ! Description:
 ! ------------
-!> Reads processor specific data of variables and arrays from restart file
+!> Reads processor (subdomain) specific data of variables and arrays from restart file
 !> (binary format).
 !------------------------------------------------------------------------------!
@@ -1385,4 +1385,5 @@
     CHARACTER (LEN=10) ::  binary_version_local
     CHARACTER (LEN=10) ::  version_on_file
+    CHARACTER (LEN=20) ::  tmp_name               !< temporary variable
 
     INTEGER(iwp) ::  files_to_be_opened  !<
@@ -1428,5 +1429,6 @@
     INTEGER(isp), DIMENSION(:,:,:), ALLOCATABLE ::  tmp_2d_seq_random  !< temporary array for storing random generator data
 
-    LOGICAL ::  found
+    LOGICAL ::  array_found                      !<
+    LOGICAL ::  found                            !<
 
     REAL(wp), DIMENSION(:,:),   ALLOCATABLE   ::  tmp_2d         !< temporary array for storing 2D data
@@ -1438,816 +1440,1193 @@
 !-- Read data from previous model run.
     CALL cpu_log( log_point_s(14), 'rrd_local', 'start' )
-!
-!-- Allocate temporary buffer arrays. In previous versions, there were
-!-- declared as automated arrays, causing memory problems when these
-!-- were allocate on stack.
-    ALLOCATE( nxlfa(numprocs_previous_run,1000) )
-    ALLOCATE( nxrfa(numprocs_previous_run,1000) )
-    ALLOCATE( nynfa(numprocs_previous_run,1000) )
-    ALLOCATE( nysfa(numprocs_previous_run,1000) )
-    ALLOCATE( offset_xa(numprocs_previous_run,1000) )
-    ALLOCATE( offset_ya(numprocs_previous_run,1000) )
-
-!
-!-- Check which of the restart files contain data needed for the subdomain
-!-- of this PE
-    files_to_be_opened = 0
-
-    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)
-       nyspr = hor_index_bounds_previous_run(3,i-1)
-       nynpr = hor_index_bounds_previous_run(4,i-1)
-
-!
-!--    Determine the offsets. They may be non-zero in case that the total domain
-!--    on file is smaller than the current total domain.
-       offset_x = ( nxl / ( nx_on_file + 1 ) ) * ( nx_on_file + 1 )
-       offset_y = ( nys / ( ny_on_file + 1 ) ) * ( ny_on_file + 1 )
-
-!
-!--    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
-       DO WHILE (  nyspr+shift_y <= nyn-offset_y )
-
-          IF ( nynpr+shift_y >= nys-offset_y ) THEN
-
-             shift_x = 0
-             DO WHILE ( nxlpr+shift_x <= nxr-offset_x )
-
-                IF ( nxrpr+shift_x >= nxl-offset_x ) THEN
-                   j = j +1
-                   IF ( j > 1000 )  THEN
-!
-!--                   Array bound exceeded
-                      message_string = 'data from subdomain of previous' //                        &
-                                       ' run mapped more than 1000 times'
-                      CALL message( 'rrd_local', 'PA0284', 2, 2, -1, 6, 1 )
+
+    IF ( TRIM( restart_data_format_input ) == 'fortran_binary' )  THEN
+!
+!--    Input in Fortran binary format
+
+!
+!--    Allocate temporary buffer arrays. In previous versions, there were
+!--    declared as automated arrays, causing memory problems when these
+!--    were allocate on stack.
+       ALLOCATE( nxlfa(numprocs_previous_run,1000) )
+       ALLOCATE( nxrfa(numprocs_previous_run,1000) )
+       ALLOCATE( nynfa(numprocs_previous_run,1000) )
+       ALLOCATE( nysfa(numprocs_previous_run,1000) )
+       ALLOCATE( offset_xa(numprocs_previous_run,1000) )
+       ALLOCATE( offset_ya(numprocs_previous_run,1000) )
+
+!
+!--    Check which of the restart files contain data needed for the subdomain
+!--    of this PE
+       files_to_be_opened = 0
+
+       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)
+          nyspr = hor_index_bounds_previous_run(3,i-1)
+          nynpr = hor_index_bounds_previous_run(4,i-1)
+
+!
+!--       Determine the offsets. They may be non-zero in case that the total domain
+!--       on file is smaller than the current total domain.
+          offset_x = ( nxl / ( nx_on_file + 1 ) ) * ( nx_on_file + 1 )
+          offset_y = ( nys / ( ny_on_file + 1 ) ) * ( ny_on_file + 1 )
+
+!
+!--       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
+          DO WHILE (  nyspr+shift_y <= nyn-offset_y )
+
+             IF ( nynpr+shift_y >= nys-offset_y ) THEN
+
+                shift_x = 0
+                DO WHILE ( nxlpr+shift_x <= nxr-offset_x )
+
+                   IF ( nxrpr+shift_x >= nxl-offset_x ) THEN
+                      j = j +1
+                      IF ( j > 1000 )  THEN
+!
+!--                      Array bound exceeded
+                         message_string = 'data from subdomain of previous' //                        &
+                                          ' run mapped more than 1000 times'
+                         CALL message( 'rrd_local', 'PA0284', 2, 2, -1, 6, 1 )
+                      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-shift_y, nyspr )
+                      nynfa(files_to_be_opened,j) = MIN( nyn-offset_y-shift_y, nynpr )
+
                    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-shift_y, nyspr )
-                   nynfa(files_to_be_opened,j) = MIN( nyn-offset_y-shift_y, nynpr )
-
-                ENDIF
-
-                shift_x = shift_x + ( nx_on_file + 1 )
-             ENDDO
-
+                   shift_x = shift_x + ( nx_on_file + 1 )
+                ENDDO
+
+             ENDIF
+
+             shift_y = shift_y + ( ny_on_file + 1 )
+          ENDDO
+
+          IF ( j > 0 )  overlap_count(files_to_be_opened) = j
+
+       ENDDO
+
+!
+!--    Save the id-string of the current process, since myid_char may now be used
+!--    to open files created by PEs with other id.
+       myid_char_save = myid_char
+
+       IF ( files_to_be_opened /= 1  .OR.  numprocs /= numprocs_previous_run )  THEN
+          WRITE( message_string, * ) 'number of PEs or virtual PE-grid changed in restart run. & ',   &
+                                     'Set debug_output =.T. to get a list of files from which the & ',&
+                                     'single PEs will read respectively'
+          CALL message( 'rrd_local', 'PA0285', 0, 0, 0, 6, 0 )
+          IF ( debug_output )  THEN
+             IF ( files_to_be_opened <= 120 )  THEN
+                WRITE( debug_string, '(2A,1X,120(I6.6,1X))' )                                         &
+                     'number of PEs or virtual PE-grid changed in restart run.  PE will read from ',  &
+                     'files ', file_list(1:files_to_be_opened)
+             ELSE
+                WRITE( debug_string, '(3A,1X,120(I6.6,1X),A)' )                                      &
+                     'number of PEs or virtual PE-grid changed in restart run.  PE will read from ',  &
+                     'files ', file_list(1:120), '... and more'
+             ENDIF
+             CALL debug_message( 'rrd_local', 'info' )
           ENDIF
-
-          shift_y = shift_y + ( ny_on_file + 1 )
-       ENDDO
-
-       IF ( j > 0 )  overlap_count(files_to_be_opened) = j
-
-    ENDDO
-
-!
-!-- Save the id-string of the current process, since myid_char may now be used
-!-- to open files created by PEs with other id.
-    myid_char_save = myid_char
-
-    IF ( files_to_be_opened /= 1  .OR.  numprocs /= numprocs_previous_run )  THEN
-       WRITE( message_string, * ) 'number of PEs or virtual PE-grid changed in restart run. & ',   &
-                                  'Set debug_output =.T. to get a list of files from which the & ',&
-                                  'single PEs will read respectively'
-       CALL message( 'rrd_local', 'PA0285', 0, 0, 0, 6, 0 )
-       IF ( debug_output )  THEN
-          IF ( files_to_be_opened <= 120 )  THEN
-             WRITE( debug_string, '(2A,1X,120(I6.6,1X))' )                                         &
-                  'number of PEs or virtual PE-grid changed in restart run.  PE will read from ',  &
-                  'files ', file_list(1:files_to_be_opened)
-          ELSE
-             WRITE( debug_string, '(3A,1X,120(I6.6,1X),A)' )                                      &
-                  'number of PEs or virtual PE-grid changed in restart run.  PE will read from ',  &
-                  'files ', file_list(1:120), '... and more'
-          ENDIF
-          CALL debug_message( 'rrd_local', 'info' )
-       ENDIF
-    ENDIF
-
-!
-!-- Read data from all restart files determined above
-    DO  i = 1, files_to_be_opened
-
-       j = file_list(i)
-!
-!--    Set the filename (underscore followed by four digit processor id)
-       WRITE (myid_char,'(''_'',I6.6)')  j
-
-!
-!--    Open the restart file. If this file has been created by PE0 (_000000),
-!--    the global variables at the beginning of the file have to be skipped
-!--    first.
-       CALL check_open( 13 )
-       IF ( j == 0 )  CALL rrd_skip_global
-
-!
-!--    First compare the version numbers
-       READ ( 13 )  length
-       READ ( 13 )  restart_string(1:length)
-       READ ( 13 )  version_on_file
-
-       binary_version_local = '4.7'
-       IF ( TRIM( version_on_file ) /= TRIM( binary_version_local ) )  THEN
-          WRITE( message_string, * ) 'version mismatch concerning ',                               &
-                                     'binary_version_local:',                                      &
-                                     '&version on file    = "', TRIM( version_on_file ), '"',      &
-                                     '&version in program = "', TRIM( binary_version_local ), '"'
-          CALL message( 'rrd_local', 'PA0286', 1, 2, 0, 6, 0 )
-       ENDIF
-
-!
-!--    Read number of processors, processor-id, and array ranges.
-!--    Compare the array ranges with those stored in the index bound array.
-       READ ( 13 )  numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file, nys_on_file,         &
-                    nyn_on_file, nzb_on_file, nzt_on_file
-
-       IF ( nxl_on_file /= hor_index_bounds_previous_run(1,j) )  THEN
-          WRITE( message_string, * ) 'problem with index bound nxl on ',                           &
-                                     'restart file "', myid_char, '"',                             &
-                                     '&nxl = ', nxl_on_file, ' but it should be',                  &
-                                     '&= ', hor_index_bounds_previous_run(1,j),                    &
-                                     '&from the index bound information array'
-          CALL message( 'rrd_local', 'PA0287', 2, 2, -1, 6, 1 )
-       ENDIF
-
-       IF ( nxr_on_file /= hor_index_bounds_previous_run(2,j) )  THEN
-           WRITE( message_string, * ) 'problem with index bound nxr on ',                          &
-                                      'restart file "', myid_char, '"'  ,                          &
-                                      ' nxr = ', nxr_on_file, ' but it should be',                 &
-                                      ' = ', hor_index_bounds_previous_run(2,j),                   &
-                                      ' from the index bound information array'
-          CALL message( 'rrd_local', 'PA0288', 2, 2, -1, 6, 1 )
-
-       ENDIF
-
-       IF ( nys_on_file /= hor_index_bounds_previous_run(3,j) )  THEN
-          WRITE( message_string, * ) 'problem with index bound nys on ',                           &
-                                     'restart file "', myid_char, '"',                             &
-                                     '&nys = ', nys_on_file, ' but it should be',                  &
-                                     '&= ', hor_index_bounds_previous_run(3,j),                    &
-                                     '&from the index bound information array'
-          CALL message( 'rrd_local', 'PA0289', 2, 2, -1, 6, 1 )
-       ENDIF
-
-       IF ( nyn_on_file /= hor_index_bounds_previous_run(4,j) )  THEN
-          WRITE( message_string, * ) 'problem with index bound nyn on ',                           &
-                                     'restart file "', myid_char, '"',                             &
-                                     '&nyn = ', nyn_on_file, ' but it should be',                  &
-                                     '&= ', hor_index_bounds_previous_run(4,j),                    &
-                                     '&from the index bound information array'
-          CALL message( 'rrd_local', 'PA0290', 2, 2, -1, 6, 1 )
-       ENDIF
-
-       IF ( nzb_on_file /= nzb )  THEN
-          WRITE( message_string, * ) 'mismatch between actual data and data ',                     &
-                                     'from prior run on PE ', myid,                                &
-                                     '&nzb on file = ', nzb_on_file,                               &
-                                     '&nzb         = ', nzb
-          CALL message( 'rrd_local', 'PA0291', 1, 2, 0, 6, 0 )
-       ENDIF
-
-       IF ( nzt_on_file /= nzt )  THEN
-          WRITE( message_string, * ) 'mismatch between actual data and data ',                     &
-                                     'from prior run on PE ', myid,                                &
-                                     '&nzt on file = ', nzt_on_file,                               &
-                                     '&nzt         = ', nzt
-          CALL message( 'rrd_local', 'PA0292', 1, 2, 0, 6, 0 )
-       ENDIF
-
-!
-!--    Allocate temporary arrays sized as the arrays on the restart file
-       ALLOCATE( tmp_2d(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp),      &
-                 tmp_3d(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,                               &
-                        nxl_on_file-nbgp:nxr_on_file+nbgp) )
-
-!
-!--    Read arrays
-!--    ATTENTION: If the following read commands have been altered, the
-!--    ---------- version number of the variable binary_version_local must
-!--               be altered, too. Furthermore, the output list of arrays in
-!--               wrd_write_local must also be altered
-!--               accordingly.
-       READ ( 13 )  length
-       READ ( 13 )  restart_string(1:length)
-
-
-!
-!--    Loop over processor specific field data
-       DO  WHILE ( restart_string(1:length) /= '*** end ***' )
-
-!
-!--       Map data on file as often as needed (data are read only for k=1)
-          DO  k = 1, overlap_count(i)
-
-             found = .FALSE.
-
-!
-!--          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)
-
-
-             SELECT CASE ( restart_string(1:length) )
-
-                CASE ( 'ghf_av' )
-                   IF ( .NOT. ALLOCATED( ghf_av ) )  THEN
-                      ALLOCATE( ghf_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   ghf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'e' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   e(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'e_av' )
-                   IF ( .NOT. ALLOCATED( e_av ) )  THEN
-                      ALLOCATE( e_av(nzb:nzt+1,nys-nbgp:nyn+nbgp,                                  &
-                                     nxl-nbgp:nxr+nbgp) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   e_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'kh' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   kh(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'kh_av' )
-                   IF ( .NOT. ALLOCATED( kh_av ) )  THEN
-                      ALLOCATE( kh_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   kh_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'km' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   km(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'km_av' )
-                   IF ( .NOT. ALLOCATED( km_av ) )  THEN
-                      ALLOCATE( km_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   km_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'lpt_av' )
-                   IF ( .NOT. ALLOCATED( lpt_av ) )  THEN
-                      ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   lpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'lwp_av' )
-                   IF ( .NOT. ALLOCATED( lwp_av ) )  THEN
-                      ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   lwp_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'p' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   p(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'p_av' )
-                   IF ( .NOT. ALLOCATED( p_av ) )  THEN
-                      ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   p_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'pt' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   pt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'pt_av' )
-                   IF ( .NOT. ALLOCATED( pt_av ) )  THEN
-                      ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   pt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'pt_2m_av' )
-                   IF ( .NOT. ALLOCATED( pt_2m_av ) )  THEN
-                      ALLOCATE( pt_2m_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   pt_2m_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                            &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'q' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   q(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'q_av' )
-                   IF ( .NOT. ALLOCATED( q_av ) )  THEN
-                      ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   q_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'ql' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   ql(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'ql_av' )
-                   IF ( .NOT. ALLOCATED( ql_av ) )  THEN
-                      ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   ql_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'qsurf_av' )
-                   IF ( .NOT. ALLOCATED( qsurf_av ) )  THEN
-                      ALLOCATE( qsurf_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   qsurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'qsws_av' )
-                   IF ( .NOT. ALLOCATED( qsws_av ) )  THEN
-                      ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   qsws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                             &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'qv_av' )
-                   IF ( .NOT. ALLOCATED( qv_av ) )  THEN
-                      ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   qv_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'r_a_av' )
-                   IF ( .NOT. ALLOCATED( r_a_av ) )  THEN
-                      ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   r_a_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'random_iv' )  ! still unresolved issue
-                   IF ( k == 1 )  READ ( 13 )  random_iv
-                   IF ( k == 1 )  READ ( 13 )  random_iy
-
-                CASE ( 'seq_random_array' )
-                   ALLOCATE( tmp_2d_id_random(nys_on_file:nyn_on_file,nxl_on_file:nxr_on_file) )
-                   ALLOCATE( tmp_2d_seq_random(5,nys_on_file:nyn_on_file,nxl_on_file:nxr_on_file) )
-                   IF ( .NOT. ALLOCATED( id_random_array ) )  THEN
-                      ALLOCATE( id_random_array(nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( .NOT. ALLOCATED( seq_random_array ) )  THEN
-                      ALLOCATE( seq_random_array(5,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d_id_random
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d_seq_random
-                   id_random_array(nysc:nync,nxlc:nxrc) = tmp_2d_id_random(nysf:nynf,nxlf:nxrf)
-                   seq_random_array(:,nysc:nync,nxlc:nxrc) = tmp_2d_seq_random(:,nysf:nynf,nxlf:nxrf)
-                   DEALLOCATE( tmp_2d_id_random, tmp_2d_seq_random )
-
-                CASE ( 's' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   s(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 's_av' )
-                   IF ( .NOT. ALLOCATED( s_av ) )  THEN
-                      ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   s_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'shf_av' )
-                   IF ( .NOT. ALLOCATED( shf_av ) )  THEN
-                      ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   shf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'ssurf_av' )
-                   IF ( .NOT. ALLOCATED( ssurf_av ) )  THEN
-                      ALLOCATE( ssurf_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   ssurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'ssws_av' )
-                   IF ( .NOT. ALLOCATED( ssws_av ) )  THEN
-                      ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   ssws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                             &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'ti_av' )
-                   IF ( .NOT. ALLOCATED( ti_av ) )  THEN
-                      ALLOCATE( ti_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                                                    nxl_on_file:nxr_on_file) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   ti_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
-
-                CASE ( 'ts_av' )
-                   IF ( .NOT. ALLOCATED( ts_av ) )  THEN
-                      ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   ts_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
-                        tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'tsurf_av' )
-                   IF ( .NOT. ALLOCATED( tsurf_av ) )  THEN
-                      ALLOCATE( tsurf_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   tsurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'u' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   u(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'u_av' )
-                   IF ( .NOT. ALLOCATED( u_av ) )  THEN
-                      ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   u_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'u_center_av' )
-                   IF ( .NOT. ALLOCATED( u_center_av ) )  THEN
-                      ALLOCATE( u_center_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                                                    nxl_on_file:nxr_on_file) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   u_center_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
-
-                CASE ( 'uu_av' )
-                   IF ( .NOT. ALLOCATED( uu_av ) )  THEN
-                      ALLOCATE( uu_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                                                    nxl_on_file:nxr_on_file) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   uu_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
-
-                CASE ( 'uv_10m_av' )
-                   IF ( .NOT. ALLOCATED( uv_10m_av ) )  THEN
-                      ALLOCATE( uv_10m_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   uv_10m_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                           &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'u_m_l' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
-                                                    1:2) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_l )  THEN
-                      u_m_l(:,nysc-nbgp:nync+nbgp,:) =  tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
-                   ENDIF
-
-                CASE ( 'u_m_n' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
-                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_n )  THEN
-                      u_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
-                   ENDIF
-
-                CASE ( 'u_m_r' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
-                                                    nx-1:nx) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_r )  THEN
-                      u_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
-                   ENDIF
-
-                CASE ( 'u_m_s' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,0:1,                                 &
-                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_s )  THEN
-                      u_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
-                   ENDIF
-
-                CASE ( 'us_av' )
-                   IF ( .NOT. ALLOCATED( us_av ) )  THEN
-                      ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   us_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'v' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   v(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'v_av' )
-                   IF ( .NOT. ALLOCATED( v_av ) )  THEN
-                      ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'v_center_av' )
-                   IF ( .NOT. ALLOCATED( v_center_av ) )  THEN
-                      ALLOCATE( v_center_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                                                    nxl_on_file:nxr_on_file) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   v_center_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
-
-                CASE ( 'vv_av' )
-                   IF ( .NOT. ALLOCATED( vv_av ) )  THEN
-                      ALLOCATE( vv_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                                                    nxl_on_file:nxr_on_file) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   vv_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
-
-                CASE ( 'v_m_l' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
-                                                    0:1) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_l )  THEN
-                      v_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
-                   ENDIF
-
-                CASE ( 'v_m_n' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
-                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_n )  THEN
-                      v_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
-                   ENDIF
-
-                CASE ( 'v_m_r' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
-                                                    nx-1:nx) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_r )  THEN
-                      v_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
-                   ENDIF
-
-                CASE ( 'v_m_s' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,1:2,                                 &
-                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_s )  THEN
-                      v_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
-                   ENDIF
-
-                CASE ( 'vpt' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   vpt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'vpt_av' )
-                   IF ( .NOT. ALLOCATED( vpt_av ) )  THEN
-                      ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   vpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'w' )
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   w(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'w_av' )
-                   IF ( .NOT. ALLOCATED( w_av ) )  THEN
-                      ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   w_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'ww_av' )
-                   IF ( .NOT. ALLOCATED( ww_av ) )  THEN
-                      ALLOCATE( ww_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                                                    nxl_on_file:nxr_on_file) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   ww_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
-
-                CASE ( 'w_m_l' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
-                                                    0:1) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_l )  THEN
-                      w_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
-                   ENDIF
-
-                CASE ( 'w_m_n' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
-                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_n )  THEN
-                      w_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
-                   ENDIF
-
-                CASE ( 'w_m_r' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
-                                                    nx-1:nx) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_r )  THEN
-                      w_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
-                   ENDIF
-
-                CASE ( 'w_m_s' )
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,0:1,                                 &
-                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   IF ( bc_radiation_s )  THEN
-                      w_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
-                   ENDIF
-
-                CASE ( 'wspeed_av' )
-                   IF ( .NOT. ALLOCATED( wspeed_av ) )  THEN
-                      ALLOCATE( wspeed_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
-                   ENDIF
-                   IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                                                    nxl_on_file:nxr_on_file) )
-                      READ ( 13 )  tmp_3d_non_standard
-                   ENDIF
-                   wspeed_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
-
-                CASE ( 'z0_av' )
-                   IF ( .NOT. ALLOCATED( z0_av ) )  THEN
-                      ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   z0_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
-                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'z0h_av' )
-                   IF ( .NOT. ALLOCATED( z0h_av ) )  THEN
-                      ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   z0h_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
-                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'z0q_av' )
-                   IF ( .NOT. ALLOCATED( z0q_av ) )  THEN
-                      ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) )
-                   ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   z0q_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
-                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE DEFAULT
-
-!
-!--                Read restart data of surfaces
-                   IF ( .NOT. found )  CALL surface_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf,   &
-                                                               nxr_on_file, nynf, nyn_on_file,     &
-                                                               nysf, nysc, nys_on_file, found )
-!
-!--                Read restart data of other modules
-                   IF ( .NOT. found ) CALL module_interface_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, tmp_3d, found )
-
-
-                   IF ( .NOT. found )  THEN
-                      WRITE( message_string, * ) 'unknown variable named "',                       &
-                                                 restart_string(1:length),                         &
-                                                '" found in subdomain data ',                      &
-                                                'from prior run on PE ', myid
-                      CALL message( 'rrd_local', 'PA0302', 1, 2, 0, 6, 0 )
-
-                   ENDIF
-
-             END SELECT
-
-          ENDDO ! overlaploop
-
-!
-!--       Deallocate non standard array needed for specific variables only
-          IF ( ALLOCATED( tmp_3d_non_standard ) )  DEALLOCATE( tmp_3d_non_standard )
-
-!
-!--       Read next character string
+       ENDIF
+
+!
+!--    Read data from all restart files determined above
+       DO  i = 1, files_to_be_opened
+
+          j = file_list(i)
+!
+!--       Set the filename (underscore followed by four digit processor id)
+          WRITE (myid_char,'(''_'',I6.6)')  j
+
+!
+!--       Open the restart file. If this file has been created by PE0 (_000000),
+!--       the global variables at the beginning of the file have to be skipped
+!--       first.
+          CALL check_open( 13 )
+          IF ( j == 0 )  CALL rrd_skip_global
+
+!
+!--       First compare the version numbers
           READ ( 13 )  length
           READ ( 13 )  restart_string(1:length)
-
-       ENDDO ! dataloop
-!
-!--    Close the restart file
-       CALL close_file( 13 )
-
-       DEALLOCATE( tmp_2d, tmp_3d )
-
-    ENDDO  ! loop over restart files
-!
-!-- Deallocate temporary buffer arrays
-    DEALLOCATE( nxlfa )
-    DEALLOCATE( nxrfa )
-    DEALLOCATE( nynfa )
-    DEALLOCATE( nysfa )
-    DEALLOCATE( offset_xa )
-    DEALLOCATE( offset_ya )
-!
-!-- Restore the original filename for the restart file to be written
-    myid_char = myid_char_save
+          READ ( 13 )  version_on_file
+
+          binary_version_local = '4.7'
+          IF ( TRIM( version_on_file ) /= TRIM( binary_version_local ) )  THEN
+             WRITE( message_string, * ) 'version mismatch concerning ',                               &
+                                        'binary_version_local:',                                      &
+                                        '&version on file    = "', TRIM( version_on_file ), '"',      &
+                                        '&version in program = "', TRIM( binary_version_local ), '"'
+             CALL message( 'rrd_local', 'PA0286', 1, 2, 0, 6, 0 )
+          ENDIF
+
+!
+!--       Read number of processors, processor-id, and array ranges.
+!--       Compare the array ranges with those stored in the index bound array.
+          READ ( 13 )  numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file, nys_on_file,         &
+                       nyn_on_file, nzb_on_file, nzt_on_file
+
+          IF ( nxl_on_file /= hor_index_bounds_previous_run(1,j) )  THEN
+             WRITE( message_string, * ) 'problem with index bound nxl on ',                           &
+                                        'restart file "', myid_char, '"',                             &
+                                        '&nxl = ', nxl_on_file, ' but it should be',                  &
+                                        '&= ', hor_index_bounds_previous_run(1,j),                    &
+                                        '&from the index bound information array'
+             CALL message( 'rrd_local', 'PA0287', 2, 2, -1, 6, 1 )
+          ENDIF
+
+          IF ( nxr_on_file /= hor_index_bounds_previous_run(2,j) )  THEN
+              WRITE( message_string, * ) 'problem with index bound nxr on ',                          &
+                                         'restart file "', myid_char, '"'  ,                          &
+                                         ' nxr = ', nxr_on_file, ' but it should be',                 &
+                                         ' = ', hor_index_bounds_previous_run(2,j),                   &
+                                         ' from the index bound information array'
+             CALL message( 'rrd_local', 'PA0288', 2, 2, -1, 6, 1 )
+
+          ENDIF
+
+          IF ( nys_on_file /= hor_index_bounds_previous_run(3,j) )  THEN
+             WRITE( message_string, * ) 'problem with index bound nys on ',                           &
+                                        'restart file "', myid_char, '"',                             &
+                                        '&nys = ', nys_on_file, ' but it should be',                  &
+                                        '&= ', hor_index_bounds_previous_run(3,j),                    &
+                                        '&from the index bound information array'
+             CALL message( 'rrd_local', 'PA0289', 2, 2, -1, 6, 1 )
+          ENDIF
+
+          IF ( nyn_on_file /= hor_index_bounds_previous_run(4,j) )  THEN
+             WRITE( message_string, * ) 'problem with index bound nyn on ',                           &
+                                        'restart file "', myid_char, '"',                             &
+                                        '&nyn = ', nyn_on_file, ' but it should be',                  &
+                                        '&= ', hor_index_bounds_previous_run(4,j),                    &
+                                        '&from the index bound information array'
+             CALL message( 'rrd_local', 'PA0290', 2, 2, -1, 6, 1 )
+          ENDIF
+
+          IF ( nzb_on_file /= nzb )  THEN
+             WRITE( message_string, * ) 'mismatch between actual data and data ',                     &
+                                        'from prior run on PE ', myid,                                &
+                                        '&nzb on file = ', nzb_on_file,                               &
+                                        '&nzb         = ', nzb
+             CALL message( 'rrd_local', 'PA0291', 1, 2, 0, 6, 0 )
+          ENDIF
+
+          IF ( nzt_on_file /= nzt )  THEN
+             WRITE( message_string, * ) 'mismatch between actual data and data ',                     &
+                                        'from prior run on PE ', myid,                                &
+                                        '&nzt on file = ', nzt_on_file,                               &
+                                        '&nzt         = ', nzt
+             CALL message( 'rrd_local', 'PA0292', 1, 2, 0, 6, 0 )
+          ENDIF
+
+!
+!--       Allocate temporary arrays sized as the arrays on the restart file
+          ALLOCATE( tmp_2d(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp),      &
+                    tmp_3d(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,                               &
+                           nxl_on_file-nbgp:nxr_on_file+nbgp) )
+
+!
+!--       Read arrays
+!--       ATTENTION: If the following read commands have been altered, the
+!--       ---------- version number of the variable binary_version_local must
+!--                  be altered, too. Furthermore, the output list of arrays in
+!--                  wrd_write_local must also be altered
+!--                  accordingly.
+          READ ( 13 )  length
+          READ ( 13 )  restart_string(1:length)
+
+
+!
+!--       Loop over processor specific field data
+          DO  WHILE ( restart_string(1:length) /= '*** end ***' )
+
+!
+!--          Map data on file as often as needed (data are read only for k=1)
+             DO  k = 1, overlap_count(i)
+
+                found = .FALSE.
+
+!
+!--             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)
+
+
+                SELECT CASE ( restart_string(1:length) )
+
+                   CASE ( 'ghf_av' )
+                      IF ( .NOT. ALLOCATED( ghf_av ) )  THEN
+                         ALLOCATE( ghf_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      ghf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'e' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      e(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'e_av' )
+                      IF ( .NOT. ALLOCATED( e_av ) )  THEN
+                         ALLOCATE( e_av(nzb:nzt+1,nys-nbgp:nyn+nbgp,                                  &
+                                        nxl-nbgp:nxr+nbgp) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      e_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'kh' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      kh(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'kh_av' )
+                      IF ( .NOT. ALLOCATED( kh_av ) )  THEN
+                         ALLOCATE( kh_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      kh_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'km' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      km(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'km_av' )
+                      IF ( .NOT. ALLOCATED( km_av ) )  THEN
+                         ALLOCATE( km_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      km_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'lpt_av' )
+                      IF ( .NOT. ALLOCATED( lpt_av ) )  THEN
+                         ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      lpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'lwp_av' )
+                      IF ( .NOT. ALLOCATED( lwp_av ) )  THEN
+                         ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      lwp_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'p' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      p(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'p_av' )
+                      IF ( .NOT. ALLOCATED( p_av ) )  THEN
+                         ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      p_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'pt' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      pt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'pt_av' )
+                      IF ( .NOT. ALLOCATED( pt_av ) )  THEN
+                         ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      pt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'pt_2m_av' )
+                      IF ( .NOT. ALLOCATED( pt_2m_av ) )  THEN
+                         ALLOCATE( pt_2m_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      pt_2m_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                            &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'q' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      q(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'q_av' )
+                      IF ( .NOT. ALLOCATED( q_av ) )  THEN
+                         ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg ))
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      q_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'ql' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      ql(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'ql_av' )
+                      IF ( .NOT. ALLOCATED( ql_av ) )  THEN
+                         ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      ql_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'qsurf_av' )
+                      IF ( .NOT. ALLOCATED( qsurf_av ) )  THEN
+                         ALLOCATE( qsurf_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      qsurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'qsws_av' )
+                      IF ( .NOT. ALLOCATED( qsws_av ) )  THEN
+                         ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      qsws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                             &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'qv_av' )
+                      IF ( .NOT. ALLOCATED( qv_av ) )  THEN
+                         ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      qv_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'r_a_av' )
+                      IF ( .NOT. ALLOCATED( r_a_av ) )  THEN
+                         ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      r_a_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'random_iv' )  ! still unresolved issue
+                      IF ( k == 1 )  READ ( 13 )  random_iv
+                      IF ( k == 1 )  READ ( 13 )  random_iy
+
+                   CASE ( 'seq_random_array' )
+                      ALLOCATE( tmp_2d_id_random(nys_on_file:nyn_on_file,nxl_on_file:nxr_on_file) )
+                      ALLOCATE( tmp_2d_seq_random(5,nys_on_file:nyn_on_file,nxl_on_file:nxr_on_file) )
+                      IF ( .NOT. ALLOCATED( id_random_array ) )  THEN
+                         ALLOCATE( id_random_array(nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( .NOT. ALLOCATED( seq_random_array ) )  THEN
+                         ALLOCATE( seq_random_array(5,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d_id_random
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d_seq_random
+                      id_random_array(nysc:nync,nxlc:nxrc) = tmp_2d_id_random(nysf:nynf,nxlf:nxrf)
+                      seq_random_array(:,nysc:nync,nxlc:nxrc) = tmp_2d_seq_random(:,nysf:nynf,nxlf:nxrf)
+                      DEALLOCATE( tmp_2d_id_random, tmp_2d_seq_random )
+
+                   CASE ( 's' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      s(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 's_av' )
+                      IF ( .NOT. ALLOCATED( s_av ) )  THEN
+                         ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      s_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'shf_av' )
+                      IF ( .NOT. ALLOCATED( shf_av ) )  THEN
+                         ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      shf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'ssurf_av' )
+                      IF ( .NOT. ALLOCATED( ssurf_av ) )  THEN
+                         ALLOCATE( ssurf_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      ssurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'ssws_av' )
+                      IF ( .NOT. ALLOCATED( ssws_av ) )  THEN
+                         ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      ssws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                             &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'ti_av' )
+                      IF ( .NOT. ALLOCATED( ti_av ) )  THEN
+                         ALLOCATE( ti_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                       nxl_on_file:nxr_on_file) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      ti_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
+
+                   CASE ( 'ts_av' )
+                      IF ( .NOT. ALLOCATED( ts_av ) )  THEN
+                         ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      ts_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
+                           tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'tsurf_av' )
+                      IF ( .NOT. ALLOCATED( tsurf_av ) )  THEN
+                         ALLOCATE( tsurf_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      tsurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'u' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      u(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'u_av' )
+                      IF ( .NOT. ALLOCATED( u_av ) )  THEN
+                         ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      u_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'u_center_av' )
+                      IF ( .NOT. ALLOCATED( u_center_av ) )  THEN
+                         ALLOCATE( u_center_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                       nxl_on_file:nxr_on_file) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      u_center_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
+
+                   CASE ( 'uu_av' )
+                      IF ( .NOT. ALLOCATED( uu_av ) )  THEN
+                         ALLOCATE( uu_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                       nxl_on_file:nxr_on_file) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      uu_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
+
+                   CASE ( 'uv_10m_av' )
+                      IF ( .NOT. ALLOCATED( uv_10m_av ) )  THEN
+                         ALLOCATE( uv_10m_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      uv_10m_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                           &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'u_m_l' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                       1:2) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_l )  THEN
+                         u_m_l(:,nysc-nbgp:nync+nbgp,:) =  tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
+                      ENDIF
+
+                   CASE ( 'u_m_n' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
+                                                       nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_n )  THEN
+                         u_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
+                      ENDIF
+
+                   CASE ( 'u_m_r' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                       nx-1:nx) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_r )  THEN
+                         u_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
+                      ENDIF
+
+                   CASE ( 'u_m_s' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,0:1,                                 &
+                                                       nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_s )  THEN
+                         u_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
+                      ENDIF
+
+                   CASE ( 'us_av' )
+                      IF ( .NOT. ALLOCATED( us_av ) )  THEN
+                         ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      us_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'v' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      v(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'v_av' )
+                      IF ( .NOT. ALLOCATED( v_av ) )  THEN
+                         ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'v_center_av' )
+                      IF ( .NOT. ALLOCATED( v_center_av ) )  THEN
+                         ALLOCATE( v_center_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                       nxl_on_file:nxr_on_file) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      v_center_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
+
+                   CASE ( 'vv_av' )
+                      IF ( .NOT. ALLOCATED( vv_av ) )  THEN
+                      ALLOCATE( vv_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                       nxl_on_file:nxr_on_file) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      vv_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
+
+                   CASE ( 'v_m_l' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                       0:1) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_l )  THEN
+                         v_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
+                      ENDIF
+
+                   CASE ( 'v_m_n' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
+                                                       nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_n )  THEN
+                         v_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
+                      ENDIF
+
+                   CASE ( 'v_m_r' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                       nx-1:nx) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_r )  THEN
+                         v_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
+                      ENDIF
+
+                   CASE ( 'v_m_s' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,1:2,                                 &
+                                                       nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_s )  THEN
+                         v_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
+                      ENDIF
+
+                   CASE ( 'vpt' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      vpt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'vpt_av' )
+                      IF ( .NOT. ALLOCATED( vpt_av ) )  THEN
+                         ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      vpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'w' )
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      w(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'w_av' )
+                      IF ( .NOT. ALLOCATED( w_av ) )  THEN
+                         ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_3d
+                      w_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                         tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'ww_av' )
+                      IF ( .NOT. ALLOCATED( ww_av ) )  THEN
+                         ALLOCATE( ww_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                       nxl_on_file:nxr_on_file) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      ww_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
+
+                   CASE ( 'w_m_l' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                       0:1) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_l )  THEN
+                         w_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
+                      ENDIF
+
+                   CASE ( 'w_m_n' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
+                                                       nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_n )  THEN
+                         w_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
+                      ENDIF
+
+                   CASE ( 'w_m_r' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                       nx-1:nx) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_r )  THEN
+                         w_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
+                      ENDIF
+
+                   CASE ( 'w_m_s' )
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,0:1,                                 &
+                                                       nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      IF ( bc_radiation_s )  THEN
+                         w_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
+                      ENDIF
+
+                   CASE ( 'wspeed_av' )
+                      IF ( .NOT. ALLOCATED( wspeed_av ) )  THEN
+                         ALLOCATE( wspeed_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+                      ENDIF
+                      IF ( k == 1 )  THEN
+                         ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                       nxl_on_file:nxr_on_file) )
+                         READ ( 13 )  tmp_3d_non_standard
+                      ENDIF
+                      wspeed_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
+
+                   CASE ( 'z0_av' )
+                      IF ( .NOT. ALLOCATED( z0_av ) )  THEN
+                         ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      z0_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
+                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'z0h_av' )
+                      IF ( .NOT. ALLOCATED( z0h_av ) )  THEN
+                         ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      z0h_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
+                          tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE ( 'z0q_av' )
+                      IF ( .NOT. ALLOCATED( z0q_av ) )  THEN
+                         ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) )
+                      ENDIF
+                      IF ( k == 1 )  READ ( 13 )  tmp_2d
+                      z0q_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
+                      tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                   CASE DEFAULT
+
+!
+!--                   Read restart data of surfaces
+                      IF ( .NOT. found )  CALL surface_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf,   &
+                                                                  nxr_on_file, nynf, nyn_on_file,     &
+                                                                  nysf, nysc, nys_on_file, found )
+!
+!--                   Read restart data of other modules
+                      IF ( .NOT. found ) CALL module_interface_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, tmp_3d, found )
+
+
+                      IF ( .NOT. found )  THEN
+                         WRITE( message_string, * ) 'unknown variable named "',                       &
+                                                    restart_string(1:length),                         &
+                                                   '" found in subdomain data ',                      &
+                                                   'from prior run on PE ', myid
+                         CALL message( 'rrd_local', 'PA0302', 1, 2, 0, 6, 0 )
+
+                      ENDIF
+
+                END SELECT
+
+             ENDDO ! overlaploop
+
+!
+!--          Deallocate non standard array needed for specific variables only
+             IF ( ALLOCATED( tmp_3d_non_standard ) )  DEALLOCATE( tmp_3d_non_standard )
+
+!
+!--          Read next character string
+             READ ( 13 )  length
+             READ ( 13 )  restart_string(1:length)
+
+          ENDDO ! dataloop
+!
+!--       Close the restart file
+          CALL close_file( 13 )
+
+          DEALLOCATE( tmp_2d, tmp_3d )
+
+       ENDDO  ! loop over restart files
+!
+!--    Deallocate temporary buffer arrays
+       DEALLOCATE( nxlfa )
+       DEALLOCATE( nxrfa )
+       DEALLOCATE( nynfa )
+       DEALLOCATE( nysfa )
+       DEALLOCATE( offset_xa )
+       DEALLOCATE( offset_ya )
+!
+!--    Restore the original filename for the restart file to be written
+       myid_char = myid_char_save
+
+
+    ELSEIF ( TRIM( restart_data_format_input ) == 'mpi' )  THEN
+
+!
+!--    Read global restart data using MPI-IO
+!
+!--    Open the MPI-IO restart file.
+       CALL rd_mpi_io_open( 'read', 'BININ' // TRIM( coupling_char ) )
+
+
+       CALL rd_mpi_io_check_array( 'ghf_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF (.NOT. ALLOCATED( ghf_av ) )  ALLOCATE( ghf_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'ghf_av', ghf_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'e', e )
+
+       CALL rd_mpi_io_check_array( 'e_av' , found = array_found )
+       IF ( array_found  )  THEN
+          IF ( .NOT. ALLOCATED( e_av ) )  ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'e_av', e_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'kh', kh )
+
+       CALL rd_mpi_io_check_array( 'kh_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( kh_av ) )  ALLOCATE( kh_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'kh_av', kh_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'km' , km)
+
+       CALL rd_mpi_io_check_array( 'km_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( km_av ) )  ALLOCATE( km_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'km_av', km_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'lpt_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( lpt_av ) )  ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'lpt_av', lpt_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'lwp_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( lwp_av ) )  ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'lwp_av', lwp_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'p', p)
+
+       CALL rd_mpi_io_check_array( 'p_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( p_av ) )  ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'p_av', p_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'pt', pt)
+
+       CALL rd_mpi_io_check_array( 'pt_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( pt_av ) )  ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'pt_av', pt_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'pt_2m_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( pt_2m_av ) )  ALLOCATE( pt_2m_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'pt_2m_av', pt_2m_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'q' , found = array_found )
+       IF ( array_found )  THEN
+          CALL rrd_mpi_io( 'q', q )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'q_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( q_av ) )  ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'q_av', q_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'ql' , found = array_found )
+       IF ( array_found )  THEN
+          CALL rrd_mpi_io( 'ql', ql )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'ql_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( ql_av ) )  ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'ql_av', ql_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'qsurf_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( qsurf_av ) )  ALLOCATE( qsurf_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'qsurf_av', qsurf_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'qsws_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( qsws_av ) )  ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'qsws_av', qsws_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'qv_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( qv_av ) )  ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'qv_av', qv_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'r_a_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( r_a_av ) )  ALLOCATE( r_a_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'r_a_av', r_a_av )
+       ENDIF
+
+!
+!--    ATTENTION: The random seeds are global data! If independent values for every PE are required,
+!--    the general approach of PE indendent restart will be lost. That means that in general the
+!--    parallel random number generator in random_generator_parallel_mod should be used!
+       CALL rrd_mpi_io_global_array( 'random_iv', random_iv )
+       CALL rrd_mpi_io( 'random_iy', random_iy )
+
+       CALL rd_mpi_io_check_array( 'id_random_array' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( id_random_array ) )  ALLOCATE( id_random_array(nys:nyn,nxl:nxr) )
+          IF ( .NOT. ALLOCATED( seq_random_array ) )  ALLOCATE( seq_random_array(5,nys:nyn,nxl:nxr) )
+          CALL rrd_mpi_io( 'id_random_array', id_random_array)
+          DO  i = 1, SIZE( seq_random_array, 1 )
+             WRITE( tmp_name, '(A,I2.2)' )  'seq_random_array', i
+             CALL rrd_mpi_io( TRIM(tmp_name), seq_random_array(i,:,:) )
+          ENDDO
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 's' , found = array_found )
+       IF ( array_found )  THEN
+          CALL rrd_mpi_io( 's', s )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 's_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( s_av ) )  ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 's_av', s_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'shf_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( shf_av ) )  ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'shf_av', shf_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'ssurf_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( ssurf_av ) )  ALLOCATE( ssurf_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'ssurf_av', ssurf_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'ssws_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( ssws_av ) )  ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'ssws_av', ssws_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'ti_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( ti_av ) )  ALLOCATE( ti_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'ti_av', ti_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'ts_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( ts_av ) )  ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'ts_av', ts_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'tsurf_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( tsurf_av ) )  ALLOCATE( tsurf_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'tsurf_av', tsurf_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'u', u)
+
+       CALL rd_mpi_io_check_array( 'u_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( u_av ) )  ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'u_av', u_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'u_center_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( u_center_av ) )  ALLOCATE( u_center_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+          CALL rrd_mpi_io( 'u_center_av', u_center_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'uu_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( uu_av ) )  ALLOCATE( uu_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+          CALL rrd_mpi_io( 'uu_av', uu_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'uv_10m_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( uv_10m_av ) )  ALLOCATE( uv_10m_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'uv_10m_av', uv_10m_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'u_m_l' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( u_m_l ) )  ALLOCATE( u_m_l(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'u_m_l', u_m_l )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'u_m_n' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( u_m_n ) )  ALLOCATE( u_m_n(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'u_m_n', u_m_n )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'u_m_r' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( u_m_r ) )  ALLOCATE( u_m_r(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'u_m_r', u_m_r )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'u_m_s' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( u_m_s ) )  ALLOCATE( u_m_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'u_m_s', u_m_s )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'us_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( us_av ) )  ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'us_av', us_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'v', v )
+
+       CALL rd_mpi_io_check_array( 'v_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( v_av ) )  ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'v_av', v_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'v_center_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( v_center_av ) )  ALLOCATE( v_center_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+          CALL rrd_mpi_io( 'v_center_av', v_center_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'vv_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( vv_av ) )  ALLOCATE( vv_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+          CALL rrd_mpi_io( 'vv_av', vv_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'v_m_l' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( v_m_l ) )  ALLOCATE( v_m_l(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'v_m_l', v_m_l )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'v_m_n' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( v_m_n ) )  ALLOCATE( v_m_n(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'v_m_n', v_m_n )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'v_m_r' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( v_m_r ) )  ALLOCATE( v_m_r(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'v_m_r', v_m_r )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'v_m_s' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( v_m_s ) )  ALLOCATE( v_m_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'v_m_s', v_m_s )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'vpt' , found = array_found )
+       IF ( array_found )  THEN
+          CALL rrd_mpi_io( 'vpt',  vpt)
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'vpt_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( vpt_av ) )  ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'vpt_av', vpt_av )
+       ENDIF
+
+       CALL rrd_mpi_io( 'w', w)
+
+       CALL rd_mpi_io_check_array( 'w_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( w_av ) )  ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'w_av', w_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'ww_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( ww_av ) )  ALLOCATE( w_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+          CALL rrd_mpi_io( 'ww_av', ww_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'w_m_l' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( w_m_l ) )  ALLOCATE( w_m_l(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'w_m_l', w_m_l )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'w_m_n' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( w_m_n ) )  ALLOCATE( w_m_n(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'w_m_n', w_m_n )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'w_m_r' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( w_m_r ) )  ALLOCATE( w_m_r(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'w_m_r', w_m_r )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'w_m_s' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( w_m_s ) )  ALLOCATE( w_m_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'w_m_s', w_m_s )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'wspeed_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( wspeed_av ) )  ALLOCATE( wspeed_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
+          CALL rrd_mpi_io( 'wspeed_av', wspeed_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'z0_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( z0_av ) )  ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'z0_av', z0_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'z0h_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( z0h_av ) )  ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'z0h_av', z0h_av )
+       ENDIF
+
+       CALL rd_mpi_io_check_array( 'z0q_av' , found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( z0q_av ) )  ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) )
+          CALL rrd_mpi_io( 'z0q_av', z0q_av )
+       ENDIF
+
+!
+!--    Read restart data of surfaces
+       CALL surface_rrd_local
+
+!
+!--    Read restart data of other modules
+       CALL module_interface_rrd_local
+
+!
+!--    Close restart file
+       CALL rd_mpi_io_close
+
+    ENDIF
 
 !
Index: palm/trunk/SOURCE/surface_data_output_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4517)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4502 2020-04-17 16:14:16Z schwenkel
 ! Implementation of ice microphysics
 ! 
@@ -147,5 +150,5 @@
 
    USE restart_data_mpi_io_mod,                                                                    &
-       ONLY:  rrd_mpi_io, wrd_mpi_io
+       ONLY:  rd_mpi_io_check_array, rrd_mpi_io, wrd_mpi_io
 
    USE surface_mod,                                                                                &
@@ -267,5 +270,6 @@
 
    INTERFACE  surface_data_output_rrd_local
-      MODULE PROCEDURE surface_data_output_rrd_local
+      MODULE PROCEDURE surface_data_output_rrd_local_ftn
+      MODULE PROCEDURE surface_data_output_rrd_local_mpi
    END INTERFACE  surface_data_output_rrd_local
 
@@ -4883,7 +4887,7 @@
 ! Description:
 ! ------------
-!> This routine reads the respective restart data.
+!> Read module-specific local restart data arrays (Fortran binary format).
 !------------------------------------------------------------------------------!
-    SUBROUTINE surface_data_output_rrd_local( found )
+    SUBROUTINE surface_data_output_rrd_local_ftn( found )
 
 
@@ -4895,7 +4899,5 @@
        LOGICAL, INTENT(OUT)  ::  found
 
-!
-!--    Here the reading of user-defined restart data follows:
-!--    Sample for user-defined output
+
        found = .TRUE.
 
@@ -4912,5 +4914,29 @@
 
 
-    END SUBROUTINE surface_data_output_rrd_local
+    END SUBROUTINE surface_data_output_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+    SUBROUTINE surface_data_output_rrd_local_mpi
+
+       IMPLICIT NONE
+
+       LOGICAL ::  array_found  !<
+
+
+       CALL rd_mpi_io_check_array( 'surfaces%var_av' , found = array_found )
+
+!> does not work this way: surface%var_av has non-standard dimensions
+!       IF ( array_found )  THEN
+!          IF ( .NOT. ALLOCATED( surfaces%var_av ) )  ALLOCATE( ....... )
+!          CALL rrd_mpi_io( 'surfaces%var_av', surfaces%var_av )
+!       ENDIF
+
+    END SUBROUTINE surface_data_output_rrd_local_mpi
+
 
 !------------------------------------------------------------------------------!
@@ -4936,4 +4962,5 @@
     END SUBROUTINE surface_data_output_wrd_global
 
+
 !------------------------------------------------------------------------------!
 ! Description:
Index: palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/surface_mod.f90	(revision 4517)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4502 2020-04-17 16:14:16Z schwenkel
 ! Implementation of ice microphysics
 ! 
@@ -145,5 +148,6 @@
 
     USE restart_data_mpi_io_mod,                                                                   &
-        ONLY:  rd_mpi_io_surface_filetypes, total_number_of_surface_values, wrd_mpi_io,            &
+        ONLY:  rd_mpi_io_surface_filetypes, rrd_mpi_io, rrd_mpi_io_global_array,                   &
+               rrd_mpi_io_surface, total_number_of_surface_values, wrd_mpi_io,                     &
                wrd_mpi_io_global_array, wrd_mpi_io_surface
 
@@ -499,5 +503,6 @@
 
     INTERFACE surface_rrd_local
-       MODULE PROCEDURE surface_rrd_local
+       MODULE PROCEDURE surface_rrd_local_ftn
+       MODULE PROCEDURE surface_rrd_local_mpi
     END INTERFACE surface_rrd_local
 
@@ -4236,5 +4241,5 @@
 ! Description:
 ! ------------
-!> Reads surface-related restart data. Please note, restart data for a certain
+!> Reads surface-related restart data in Fortran binary format. Please note, restart data for a certain
 !> surface orientation (e.g. horizontal upward-facing) is stored in one
 !> array, even if surface elements may belong to different surface types
@@ -4244,7 +4249,7 @@
 !> of cyclic_fill mode.
 !------------------------------------------------------------------------------!
-    SUBROUTINE surface_rrd_local( kk, nxlf, nxlc, nxl_on_file, nxrf,           &
-                                  nxr_on_file, nynf, nyn_on_file, nysf,        &
-                                  nysc, nys_on_file, found )
+    SUBROUTINE surface_rrd_local_ftn( kk, nxlf, nxlc, nxl_on_file, nxrf,           &
+                                      nxr_on_file, nynf, nyn_on_file, nysf,        &
+                                      nysc, nys_on_file, found )
 
 
@@ -5185,6 +5190,5 @@
        ENDIF
 
-
-    CONTAINS
+ CONTAINS
 !------------------------------------------------------------------------------!
 ! Description:
@@ -5403,5 +5407,450 @@
 
 
-    END SUBROUTINE surface_rrd_local
+    END SUBROUTINE surface_rrd_local_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Reads surface-related restart data in MPI-IO format.
+!> TO_DO: this routine needs to be adjusted for cyclic_fill mode
+!------------------------------------------------------------------------------!
+ SUBROUTINE surface_rrd_local_mpi
+
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=1) ::  dum  !< dummy string to create input-variable name
+
+    INTEGER(iwp) ::  l  !< loop index for surface types
+
+    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  global_start_index  !< index for surface data (MPI-IO)
+
+    LOGICAL ::  ldum  !< dummy variable
+
+    TYPE(surf_type), DIMENSION(0:2) ::  surf_h     !< gathered horizontal surfaces, contains all surface types
+    TYPE(surf_type), DIMENSION(0:3) ::  surf_v     !< gathered vertical surfaces, contains all surface types
+
+!
+!-- Get total number of surface points on the file
+    CALL rrd_mpi_io_global_array( 'ns_h_on_file', ns_h_on_file )
+    CALL rrd_mpi_io_global_array( 'ns_v_on_file', ns_v_on_file )
+
+
+    DO  l = 0, 2
+
+       IF ( ns_h_on_file(l) == 0 )  CYCLE  !< no data of this surface type on file
+
+       IF ( ALLOCATED( surf_h(l)%start_index ) )  CALL deallocate_surface_attributes_h( surf_h(l) )
+       surf_h(l)%ns = ns_h_on_file(l)
+       CALL allocate_surface_attributes_h( surf_h(l), nys, nyn, nxl, nxr )
+
+       WRITE( dum, '(I1)')  l
+
+       CALL rrd_mpi_io( 'surf_h(' // dum // ')%start_index',  surf_h(l)%start_index )
+       CALL rrd_mpi_io( 'surf_h(' // dum // ')%end_index',  surf_h(l)%end_index )
+       CALL rrd_mpi_io( 'global_start_index_h_' // dum , global_start_index )
+
+       CALL rd_mpi_io_surface_filetypes( surf_h(l)%start_index, surf_h(l)%end_index, ldum, global_start_index )
+
+       IF ( ALLOCATED ( surf_h(l)%us ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%us', surf_h(l)%us )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%ts ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%ts', surf_h(l)%ts )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qs', surf_h(l)%qs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%ss ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%ss', surf_h(l)%ss )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qcs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qcs', surf_h(l)%qcs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%ncs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%ncs', surf_h(l)%ncs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qis ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qis', surf_h(l)%qis )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%nis ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%nis', surf_h(l)%nis )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qrs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qrs', surf_h(l)%qrs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%nrs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%nrs', surf_h(l)%nrs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%ol ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%ol', surf_h(l)%ol )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%rib ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%rib',  surf_h(l)%rib )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%pt_surface ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%pt_surface', surf_h(l)%pt_surface )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%q_surface ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%q_surface', surf_h(l)%q_surface )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%vpt_surface ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%vpt_surface', surf_h(l)%vpt_surface )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%usws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%usws', surf_h(l)%usws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%vsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%vsws', surf_h(l)%vsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%shf ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%shf', surf_h(l)%shf )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qsws', surf_h(l)%qsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%ssws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%ssws', surf_h(l)%ssws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%css ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%css', surf_h(l)%css )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%cssws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%cssws', surf_h(l)%cssws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qcsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qcsws', surf_h(l)%qcsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%ncsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%ncsws', surf_h(l)%ncsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qisws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qisws', surf_h(l)%qisws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%nisws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%nisws', surf_h(l)%nisws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%qrsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%qrsws', surf_h(l)%qrsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%nrsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%nrsws', surf_h(l)%nrsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_h(l)%sasws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_h(' // dum // ')%sasws', surf_h(l)%sasws )
+       ENDIF
+
+    ENDDO
+
+!
+!-- Read vertical surfaces
+    DO  l = 0, 3
+
+       IF ( ns_v_on_file(l) == 0 )  CYCLE  !< no data of this surface type on file
+
+       IF ( ALLOCATED( surf_v(l)%start_index ) )  CALL deallocate_surface_attributes_v( surf_v(l) )
+       surf_v(l)%ns = ns_v_on_file(l)
+       CALL allocate_surface_attributes_v( surf_v(l), nys, nyn, nxl, nxr )
+
+       WRITE( dum, '(I1)' )  l
+
+       CALL rrd_mpi_io( 'surf_v(' // dum // ')%start_index', surf_v(l)%start_index )
+       CALL rrd_mpi_io( 'surf_v(' // dum // ')%end_index', surf_v(l)%end_index )
+       CALL rrd_mpi_io( 'global_start_index_v_' // dum , global_start_index )
+
+       CALL rd_mpi_io_surface_filetypes( surf_v(l)%start_index, surf_v(l)%end_index, ldum,         &
+                                         global_start_index )
+
+       IF ( ALLOCATED ( surf_v(l)%us ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%us',  surf_v(l)%us )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%ts ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%ts', surf_v(l)%ts )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qs',  surf_v(l)%qs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%ss ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%ss',  surf_v(l)%ss )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qcs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qcs', surf_v(l)%qcs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%ncs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%ncs', surf_v(l)%ncs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qis ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qis', surf_v(l)%qis )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%nis ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%nis', surf_v(l)%nis )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qrs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qrs', surf_v(l)%qrs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%nrs ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%nrs', surf_v(l)%nrs )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%ol ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%ol', surf_v(l)%ol )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%rib ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%rib', surf_v(l)%rib )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%pt_surface ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%pt_surface', surf_v(l)%pt_surface )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%q_surface ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%q_surface', surf_v(l)%q_surface )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%vpt_surface ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%vpt_surface', surf_v(l)%vpt_surface )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%shf ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%shf', surf_v(l)%shf )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qsws', surf_v(l)%qsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%ssws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%ssws', surf_v(l)%ssws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%css ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%css', surf_v(l)%css )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%cssws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%cssws', surf_v(l)%cssws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qcsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qcsws', surf_v(l)%qcsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%ncsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%ncsws', surf_v(l)%ncsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qisws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qisws', surf_v(l)%qisws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%nisws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%nisws', surf_v(l)%nisws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%qrsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%qrsws', surf_v(l)%qrsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%nrsws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%nrsws', surf_v(l)%nrsws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%sasws ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%sasws', surf_v(l)%sasws )
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%mom_flux_uv ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%mom_uv', surf_v(l)%mom_flux_uv)
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%mom_flux_w ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%mom_w',  surf_v(l)%mom_flux_w)
+       ENDIF
+
+       IF ( ALLOCATED ( surf_v(l)%mom_flux_tke ) )  THEN
+          CALL rrd_mpi_io_surface( 'surf_v(' // dum // ')%mom_tke', surf_v(l)%mom_flux_tke)
+       ENDIF
+
+    ENDDO
+
+!
+!-- Redistribute surface elements on its respective type.
+
+    DO  l = 0 , 2
+       CALL restore_surface_elements( surf_def_h(l), surf_h(l) )
+       CALL restore_surface_elements( surf_lsm_h, surf_h(l) )
+       CALL restore_surface_elements( surf_usm_h, surf_h(l) )
+    ENDDO
+
+    DO  l = 0 , 3
+       CALL restore_surface_elements( surf_def_v(l), surf_v(l) )
+       CALL restore_surface_elements( surf_lsm_v(l), surf_v(l) )
+       CALL restore_surface_elements( surf_usm_v(l), surf_v(l) )
+    ENDDO
+
+ CONTAINS
+
+          SUBROUTINE restore_surface_elements( surf_target, surf_file )
+
+             IMPLICIT NONE
+
+             INTEGER(iwp)      ::  lsp         !< running index chemical species
+
+             TYPE( surf_type ) ::  surf_target !< target surface type
+             TYPE( surf_type ) ::  surf_file   !< surface type on file
+
+
+             IF ( ALLOCATED( surf_target%us )  .AND. ALLOCATED( surf_file%us   ) )      THEN
+                surf_target%us = surf_file%us
+             ENDIF
+
+             IF ( ALLOCATED( surf_target%ol )  .AND.                        &
+                ALLOCATED( surf_file%ol   ) )                             &
+                surf_target%ol = surf_file%ol
+
+             IF ( ALLOCATED( surf_target%pt_surface )  .AND.                &
+                ALLOCATED( surf_file%pt_surface   ) )                     &
+                surf_target%pt_surface = surf_file%pt_surface
+
+             IF ( ALLOCATED( surf_target%q_surface )  .AND.                 &
+                ALLOCATED( surf_file%q_surface   ) )                      &
+                surf_target%q_surface = surf_file%q_surface
+
+             IF ( ALLOCATED( surf_target%vpt_surface )  .AND.               &
+                ALLOCATED( surf_file%vpt_surface   ) )                    &
+                surf_target%vpt_surface = surf_file%vpt_surface
+
+             IF ( ALLOCATED( surf_target%usws )  .AND.                      &
+                ALLOCATED( surf_file%usws   ) )                           &
+                surf_target%usws = surf_file%usws
+
+             IF ( ALLOCATED( surf_target%vsws )  .AND.                      &
+                ALLOCATED( surf_file%vsws   ) )                           &
+                surf_target%vsws = surf_file%vsws
+
+             IF ( ALLOCATED( surf_target%ts )  .AND.                        &
+                ALLOCATED( surf_file%ts   ) )                             &
+                surf_target%ts = surf_file%ts
+
+             IF ( ALLOCATED( surf_target%shf )  .AND.                       &
+                ALLOCATED( surf_file%shf   ) )                            &
+                surf_target%shf = surf_file%shf
+
+             IF ( ALLOCATED( surf_target%qs )  .AND.                        &
+                ALLOCATED( surf_file%qs   ) )                             &
+                surf_target%qs = surf_file%qs
+
+             IF ( ALLOCATED( surf_target%qsws )  .AND.                      &
+                ALLOCATED( surf_file%qsws   ) )                           &
+                surf_target%qsws = surf_file%qsws
+
+             IF ( ALLOCATED( surf_target%ss )  .AND.                        &
+                ALLOCATED( surf_file%ss   ) )                             &
+                surf_target%ss = surf_file%ss
+
+             IF ( ALLOCATED( surf_target%ssws )  .AND.                      &
+                ALLOCATED( surf_file%ssws   ) )                           &
+                surf_target%ssws = surf_file%ssws
+
+             IF ( ALLOCATED( surf_target%css )  .AND.                     &
+                ALLOCATED( surf_file%css   ) )  THEN
+                DO  lsp = 1, nvar
+                   surf_target%css(lsp,:) = surf_file%css(lsp,:)
+                ENDDO
+             ENDIF
+
+             IF ( ALLOCATED( surf_target%cssws )  .AND.                     &
+                ALLOCATED( surf_file%cssws   ) )  THEN
+                DO  lsp = 1, nvar
+                   surf_target%cssws(lsp,:) = surf_file%cssws(lsp,:)
+                ENDDO
+             ENDIF
+             IF ( ALLOCATED( surf_target%qcs )  .AND.                       &
+                ALLOCATED( surf_file%qcs   ) )                            &
+                surf_target%qcs = surf_file%qcs
+             IF ( ALLOCATED( surf_target%qcsws )  .AND.                     &
+                ALLOCATED( surf_file%qcsws   ) )                          &
+                surf_target%qcsws = surf_file%qcsws
+             IF ( ALLOCATED( surf_target%ncs )  .AND.                       &
+                ALLOCATED( surf_file%ncs   ) )                            &
+                surf_target%ncs = surf_file%ncs
+             IF ( ALLOCATED( surf_target%ncsws )  .AND.                     &
+                ALLOCATED( surf_file%ncsws   ) )                          &
+                surf_target%ncsws = surf_file%ncsws
+             IF ( ALLOCATED( surf_target%qrs )  .AND.                       &
+                ALLOCATED( surf_file%qrs   ) )                            &
+                surf_target%qrs = surf_file%qrs
+             IF ( ALLOCATED( surf_target%qrsws )  .AND.                     &
+                ALLOCATED( surf_file%qrsws   ) )                          &
+                surf_target%qrsws = surf_file%qrsws
+             IF ( ALLOCATED( surf_target%nrs )  .AND.                       &
+                ALLOCATED( surf_file%nrs   ) )                            &
+                surf_target%nrs = surf_file%nrs
+
+             IF ( ALLOCATED( surf_target%nrsws )  .AND.                     &
+                ALLOCATED( surf_file%nrsws   ) )                          &
+                surf_target%nrsws = surf_file%nrsws
+             IF ( ALLOCATED( surf_target%sasws )  .AND.                     &
+                ALLOCATED( surf_file%sasws   ) )                          &
+                surf_target%sasws = surf_file%sasws
+             IF ( ALLOCATED( surf_target%mom_flux_uv )  .AND.               &
+                ALLOCATED( surf_file%mom_flux_uv   ) )                    &
+                surf_target%mom_flux_uv =                         &
+                surf_file%mom_flux_uv
+             IF ( ALLOCATED( surf_target%mom_flux_w )  .AND.                &
+                ALLOCATED( surf_file%mom_flux_w   ) )                     &
+                surf_target%mom_flux_w =                          &
+                surf_file%mom_flux_w
+             IF ( ALLOCATED( surf_target%mom_flux_tke )  .AND.              &
+                ALLOCATED( surf_file%mom_flux_tke   ) )                   &
+                surf_target%mom_flux_tke(0:1,:) =                    &
+                surf_file%mom_flux_tke(0:1,:)
+
+
+          END SUBROUTINE restore_surface_elements
+
+ END SUBROUTINE surface_rrd_local_mpi
+
+
+
 
 
Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4516)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4517)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+! 
+! 4510 2020-04-29 14:19:18Z raasch
 ! Further re-formatting to follow the PALM coding standard
 !
@@ -368,4 +371,6 @@
     USE restart_data_mpi_io_mod,                                                                   &
         ONLY:  rd_mpi_io_surface_filetypes,                                                        &
+               rrd_mpi_io,                                                                         &
+               rrd_mpi_io_surface,                                                                 &
                wrd_mpi_io,                                                                         &
                wrd_mpi_io_surface
@@ -617,6 +622,4 @@
 
 
-
-
 !
 !-- Building facade/wall/green/window properties (partly according to PIDS).
@@ -840,5 +843,6 @@
 
     INTERFACE usm_rrd_local
-       MODULE PROCEDURE usm_rrd_local
+       MODULE PROCEDURE usm_rrd_local_ftn
+       MODULE PROCEDURE usm_rrd_local_mpi
     END INTERFACE usm_rrd_local
 
@@ -6110,8 +6114,9 @@
 ! Description:
 ! ------------
-!> Soubroutine reads t_surf and t_wall data from restart files
+!> Read module-specific local restart data arrays (Fortran binary format).
+!> Soubroutine reads t_surf and t_wall.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE usm_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxr_on_file, nynf, nyn_on_file,       &
-                           nysf, nysc, nys_on_file, found )
+ SUBROUTINE usm_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxr_on_file, nynf, nyn_on_file,   &
+                               nysf, nysc, nys_on_file, found )
 
 
@@ -6654,5 +6659,120 @@
     END SELECT
 
- END SUBROUTINE usm_rrd_local
+ END SUBROUTINE usm_rrd_local_ftn
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!> Soubroutine reads t_surf and t_wall.
+!>
+!> This read routine is a counterpart of usm_wrd_local.
+!> In usm_wrd_local, all array are unconditionally written, therefore all arrays are read here.
+!> This is a preliminary version of reading usm data. The final version has to be discussed with
+!> the developers.
+!>
+!> If it is possible to call usm_allocate_surface before reading the restart file, this reading
+!> routine would become much simpler, because no checking for allocation will be necessary any more.
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE usm_rrd_local_mpi
+
+
+    CHARACTER(LEN=1) ::  dum  !< dummy string to create input-variable name
+
+    INTEGER(iwp) ::  l  !< loop index for surface types
+
+    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  global_start
+
+    LOGICAL ::  ldum  !< dummy variable
+
+
+    CALL rrd_mpi_io( 'usm_start_index_h',  surf_usm_h%start_index )
+    CALL rrd_mpi_io( 'usm_end_index_h', surf_usm_h%end_index )
+    CALL rrd_mpi_io( 'usm_global_start_h', global_start )
+
+    CALL rd_mpi_io_surface_filetypes( surf_usm_h%start_index, surf_usm_h%end_index, ldum,          &
+                                      global_start )
+
+    IF ( .NOT.  ALLOCATED( t_surf_wall_h_1 ) )  ALLOCATE( t_surf_wall_h_1(1:surf_usm_h%ns) )
+    CALL rrd_mpi_io_surface( 't_surf_wall_h', t_surf_wall_h_1 )
+
+    IF ( .NOT.  ALLOCATED( t_surf_window_h_1 ) )  ALLOCATE( t_surf_window_h_1(1:surf_usm_h%ns) )
+    CALL rrd_mpi_io_surface( 't_surf_window_h', t_surf_window_h_1 )
+
+    IF ( .NOT.  ALLOCATED( t_surf_green_h_1 ) )  ALLOCATE( t_surf_green_h_1(1:surf_usm_h%ns) )
+    CALL rrd_mpi_io_surface( 't_surf_green_h', t_surf_green_h_1 )
+
+    DO  l = 0, 3
+
+       WRITE( dum, '(I1)' )  l
+
+       CALL rrd_mpi_io( 'usm_start_index_v_' //dum, surf_usm_v(l)%start_index )
+       CALL rrd_mpi_io( 'usm_end_index_v_' // dum, surf_usm_v(l)%end_index )
+       CALL rrd_mpi_io( 'usm_global_start_v_' // dum, global_start )
+
+       CALL rd_mpi_io_surface_filetypes( surf_usm_v(l)%start_index, surf_usm_v(l)%end_index, ldum, &
+                                         global_start )
+
+       IF ( .NOT.  ALLOCATED( t_surf_wall_v_1(l)%t ) )                                             &
+          ALLOCATE( t_surf_wall_v_1(l)%t(1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_wall_v(' // dum // ')', t_surf_wall_v_1(l)%t )
+
+       IF ( .NOT.  ALLOCATED( t_surf_window_v_1(l)%t ) )                                           &
+          ALLOCATE( t_surf_window_v_1(l)%t(1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_window_v(' // dum // ')', t_surf_window_v_1(l)%t )
+
+       IF ( .NOT.  ALLOCATED( t_surf_green_v_1(l)%t ) )                                            &
+          ALLOCATE( t_surf_green_v_1(l)%t(1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_surf_green_v(' // dum // ')', t_surf_green_v_1(l)%t)
+
+    ENDDO
+
+    CALL rrd_mpi_io( 'usm_start_index_h_2',  surf_usm_h%start_index )
+    CALL rrd_mpi_io( 'usm_end_index_h_2', surf_usm_h%end_index )
+    CALL rrd_mpi_io( 'usm_global_start_h_2', global_start )
+
+    CALL rd_mpi_io_surface_filetypes( surf_usm_h%start_index, surf_usm_h%end_index, ldum,          &
+                                      global_start )
+
+    IF ( .NOT.  ALLOCATED( t_wall_h_1 ) )                                                          &
+       ALLOCATE( t_wall_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
+    CALL rrd_mpi_io_surface( 't_wall_h', t_wall_h_1 )
+
+    IF ( .NOT.  ALLOCATED( t_window_h_1 ) )                                                        &
+       ALLOCATE( t_window_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
+    CALL rrd_mpi_io_surface( 't_window_h', t_window_h_1 )
+
+    IF ( .NOT.  ALLOCATED( t_green_h_1 ) )                                                         &
+       ALLOCATE( t_green_h_1(nzb_wall:nzt_wall+1,1:surf_usm_h%ns) )
+    CALL rrd_mpi_io_surface( 't_green_h', t_green_h_1 )
+
+    DO  l = 0, 3
+
+       WRITE( dum, '(I1)' )  l
+
+       CALL rrd_mpi_io( 'usm_start_index_v_2_' //dum, surf_usm_v(l)%start_index )
+       CALL rrd_mpi_io( 'usm_end_index_v_2_' // dum, surf_usm_v(l)%end_index )
+       CALL rrd_mpi_io( 'usm_global_start_v_2_' // dum, global_start )
+
+       CALL rd_mpi_io_surface_filetypes( surf_usm_v(l)%start_index, surf_usm_v(l)%end_index, ldum, &
+                                         global_start )
+
+       IF ( .NOT. ALLOCATED( t_wall_v_1(l)%t ) )                                                   &
+          ALLOCATE ( t_wall_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_wall_v(' // dum // ')', t_wall_v_1(l)%t )
+
+       IF ( .NOT. ALLOCATED( t_window_v_1(l)%t ) )                                                 &
+          ALLOCATE ( t_window_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_window_v(' // dum // ')', t_window_v_1(l)%t )
+
+       IF ( .NOT. ALLOCATED( t_green_v_1(l)%t ) )                                                  &
+          ALLOCATE ( t_green_v_1(l)%t(nzb_wall:nzt_wall+1,1:surf_usm_v(l)%ns) )
+       CALL rrd_mpi_io_surface( 't_green_v(' // dum // ')', t_green_v_1(l)%t )
+
+    ENDDO
+
+ END SUBROUTINE usm_rrd_local_mpi
+
 
 
Index: palm/trunk/SOURCE/user_module.f90
===================================================================
--- palm/trunk/SOURCE/user_module.f90	(revision 4516)
+++ palm/trunk/SOURCE/user_module.f90	(revision 4517)
@@ -21,8 +21,11 @@
 ! -----------------
 ! 
-!
+! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! added restart with MPI-IO for reading local arrays
+!
+! 4504 2020-04-20 12:11:24Z raasch
 ! hint for setting rmask arrays added
 ! 
@@ -207,5 +210,6 @@
 
     INTERFACE user_rrd_local
-       MODULE PROCEDURE user_rrd_local
+       MODULE PROCEDURE user_rrd_local_ftn
+       MODULE PROCEDURE user_rrd_local_mpi
     END INTERFACE user_rrd_local
 
@@ -1130,4 +1134,7 @@
  SUBROUTINE user_rrd_global_mpi
 
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  rrd_mpi_io
+
 !    CALL rrd_mpi_io( 'global_parameter', global_parameter )
     CONTINUE
@@ -1139,11 +1146,12 @@
 ! Description:
 ! ------------
-!> Reading processor specific restart data from file(s) that has been defined by the user. Subdomain
+!> Read module-specific local restart data arrays (Fortran binary format).
+!> Subdomain
 !> index limits on file are given by nxl_on_file, etc. Indices nxlc, etc. indicate the range of
 !> gridpoints to be mapped from the subdomain on file (f) to the subdomain of the current PE (c).
 !> They have been calculated in routine rrd_local.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE user_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync,       &
-                            nyn_on_file, nysf, nysc, nys_on_file, tmp_3d, found )
+ SUBROUTINE user_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync,   &
+                                nyn_on_file, nysf, nysc, nys_on_file, tmp_3d, found )
 
 
@@ -1194,5 +1202,26 @@
     END SELECT
 
- END SUBROUTINE user_rrd_local
+ END SUBROUTINE user_rrd_local_ftn
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE user_rrd_local_mpi
+
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  rd_mpi_io_check_array, rrd_mpi_io
+
+!    CALL rd_mpi_io_check_array( 'u2_av' , found = array_found )
+!    IF ( array_found )  THEN
+!       IF ( .NOT. ALLOCATED( u2_av ) )  ALLOCATE( u2_av(nysg:nyng,nxlg:nxrg) )
+!       CALL rrd_mpi_io( 'rad_u2_av', rad_u2_av )
+!    ENDIF
+
+    CONTINUE
+
+ END SUBROUTINE user_rrd_local_mpi
 
 
@@ -1203,4 +1232,7 @@
 !--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_wrd_global
+
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  wrd_mpi_io
 
     IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
@@ -1224,4 +1256,7 @@
 !--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_wrd_local
+
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  wrd_mpi_io
 
 !
