Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4495)
+++ 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
