Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4493)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4495)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! restart data handling with MPI-IO added
+! 
+! 4493 2020-04-10 09:49:43Z pavelkrc
 ! Avoid unstable direct normal radiation near horizon
 ! 
@@ -278,5 +281,5 @@
                message_string, plant_canopy, pt_surface,                       &
                rho_surface, simulated_time, spinup_time, surface_pressure,     &
-               read_svf, write_svf,                                            &
+               read_svf, restart_data_format_output, write_svf,                &
                time_since_reference_point, urban_surface, varnamelength
 
@@ -360,4 +363,7 @@
         ONLY:  rrtmg_sw
 #endif
+    USE restart_data_mpi_io_mod,                                                                   &
+        ONLY:  wrd_mpi_io
+
     USE statistics,                                                            &
         ONLY:  hom
@@ -11934,111 +11940,140 @@
 
 
-    IF ( ALLOCATED( rad_net_av ) )  THEN
-       CALL wrd_write_string( 'rad_net_av' )
-       WRITE ( 14 )  rad_net_av
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+       IF ( ALLOCATED( rad_net_av ) )  THEN
+          CALL wrd_write_string( 'rad_net_av' )
+          WRITE ( 14 )  rad_net_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_in_xy_av ) )  THEN
+          CALL wrd_write_string( 'rad_lw_in_xy_av' )
+          WRITE ( 14 )  rad_lw_in_xy_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_out_xy_av ) )  THEN
+          CALL wrd_write_string( 'rad_lw_out_xy_av' )
+          WRITE ( 14 )  rad_lw_out_xy_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_in_xy_av ) )  THEN
+          CALL wrd_write_string( 'rad_sw_in_xy_av' )
+          WRITE ( 14 )  rad_sw_in_xy_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_out_xy_av ) )  THEN
+          CALL wrd_write_string( 'rad_sw_out_xy_av' )
+          WRITE ( 14 )  rad_sw_out_xy_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_in ) )  THEN
+          CALL wrd_write_string( 'rad_lw_in' )
+          WRITE ( 14 )  rad_lw_in
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_in_av ) )  THEN
+          CALL wrd_write_string( 'rad_lw_in_av' )
+          WRITE ( 14 )  rad_lw_in_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_out ) )  THEN
+          CALL wrd_write_string( 'rad_lw_out' )
+          WRITE ( 14 )  rad_lw_out
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_out_av) )  THEN
+          CALL wrd_write_string( 'rad_lw_out_av' )
+          WRITE ( 14 )  rad_lw_out_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_cs_hr) )  THEN
+          CALL wrd_write_string( 'rad_lw_cs_hr' )
+          WRITE ( 14 )  rad_lw_cs_hr
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_cs_hr_av) )  THEN
+          CALL wrd_write_string( 'rad_lw_cs_hr_av' )
+          WRITE ( 14 )  rad_lw_cs_hr_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_hr) )  THEN
+          CALL wrd_write_string( 'rad_lw_hr' )
+          WRITE ( 14 )  rad_lw_hr
+       ENDIF
+
+       IF ( ALLOCATED( rad_lw_hr_av) )  THEN
+          CALL wrd_write_string( 'rad_lw_hr_av' )
+          WRITE ( 14 )  rad_lw_hr_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_in) )  THEN
+          CALL wrd_write_string( 'rad_sw_in' )
+          WRITE ( 14 )  rad_sw_in
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_in_av) )  THEN
+          CALL wrd_write_string( 'rad_sw_in_av' )
+          WRITE ( 14 )  rad_sw_in_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_out) )  THEN
+          CALL wrd_write_string( 'rad_sw_out' )
+          WRITE ( 14 )  rad_sw_out
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_out_av) )  THEN
+          CALL wrd_write_string( 'rad_sw_out_av' )
+          WRITE ( 14 )  rad_sw_out_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_cs_hr) )  THEN
+          CALL wrd_write_string( 'rad_sw_cs_hr' )
+          WRITE ( 14 )  rad_sw_cs_hr
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_cs_hr_av) )  THEN
+          CALL wrd_write_string( 'rad_sw_cs_hr_av' )
+          WRITE ( 14 )  rad_sw_cs_hr_av
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_hr) )  THEN
+          CALL wrd_write_string( 'rad_sw_hr' )
+          WRITE ( 14 )  rad_sw_hr
+       ENDIF
+
+       IF ( ALLOCATED( rad_sw_hr_av) )  THEN
+          CALL wrd_write_string( 'rad_sw_hr_av' )
+          WRITE ( 14 )  rad_sw_hr_av
+       ENDIF
+
+    ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' )  THEN
+
+       IF ( ALLOCATED( rad_net_av ) )  CALL wrd_mpi_io( 'rad_net_av', rad_net_av )
+       IF ( ALLOCATED( rad_lw_in_xy_av ) )  CALL wrd_mpi_io( 'rad_lw_in_xy_av', rad_lw_in_xy_av )
+       IF ( ALLOCATED( rad_lw_out_xy_av ) )  CALL wrd_mpi_io( 'rad_lw_out_xy_av', rad_lw_out_xy_av )
+       IF ( ALLOCATED( rad_sw_in_xy_av ) )  CALL wrd_mpi_io( 'rad_sw_in_xy_av', rad_sw_in_xy_av )
+       IF ( ALLOCATED( rad_sw_out_xy_av ) )  CALL wrd_mpi_io( 'rad_sw_out_xy_av', rad_sw_out_xy_av )
+       IF ( ALLOCATED( rad_lw_in ) )  CALL wrd_mpi_io( 'rad_lw_in', rad_lw_in )
+       IF ( ALLOCATED( rad_lw_in_av ) )  CALL wrd_mpi_io( 'rad_lw_in_av', rad_lw_in_av )
+       IF ( ALLOCATED( rad_lw_out ) )  CALL wrd_mpi_io( 'rad_lw_out', rad_lw_out )
+       IF ( ALLOCATED( rad_lw_out_av) )  CALL wrd_mpi_io( 'rad_lw_out_av', rad_lw_out_av )
+       IF ( ALLOCATED( rad_lw_cs_hr) )  CALL wrd_mpi_io( 'rad_lw_cs_hr', rad_lw_cs_hr )
+       IF ( ALLOCATED( rad_lw_cs_hr_av) )  CALL wrd_mpi_io( 'rad_lw_cs_hr_av', rad_lw_cs_hr_av )
+       IF ( ALLOCATED( rad_lw_hr) )  CALL wrd_mpi_io( 'rad_lw_hr', rad_lw_hr )
+       IF ( ALLOCATED( rad_lw_hr_av) )  CALL wrd_mpi_io( 'rad_lw_hr_av', rad_lw_hr_av )
+       IF ( ALLOCATED( rad_sw_in) )  CALL wrd_mpi_io( 'rad_sw_in', rad_sw_in )
+       IF ( ALLOCATED( rad_sw_in_av) )  CALL wrd_mpi_io( 'rad_sw_in_av', rad_sw_in_av )
+       IF ( ALLOCATED( rad_sw_out) )  CALL wrd_mpi_io( 'rad_sw_out', rad_sw_out )
+       IF ( ALLOCATED( rad_sw_out_av) )  CALL wrd_mpi_io( 'rad_sw_out_av', rad_sw_out_av )
+       IF ( ALLOCATED( rad_sw_cs_hr) )  CALL wrd_mpi_io( 'rad_sw_cs_hr', rad_sw_cs_hr )
+       IF ( ALLOCATED( rad_sw_cs_hr_av) )  CALL wrd_mpi_io( 'rad_sw_cs_hr_av', rad_sw_cs_hr_av )
+       IF ( ALLOCATED( rad_sw_hr) )  CALL wrd_mpi_io( 'rad_sw_hr', rad_sw_hr )
+       IF ( ALLOCATED( rad_sw_hr_av) )  CALL wrd_mpi_io( 'rad_sw_hr_av', rad_sw_hr_av )
+
     ENDIF
 
-    IF ( ALLOCATED( rad_lw_in_xy_av ) )  THEN
-       CALL wrd_write_string( 'rad_lw_in_xy_av' )
-       WRITE ( 14 )  rad_lw_in_xy_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_out_xy_av ) )  THEN
-       CALL wrd_write_string( 'rad_lw_out_xy_av' )
-       WRITE ( 14 )  rad_lw_out_xy_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_in_xy_av ) )  THEN
-       CALL wrd_write_string( 'rad_sw_in_xy_av' )
-       WRITE ( 14 )  rad_sw_in_xy_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_out_xy_av ) )  THEN
-       CALL wrd_write_string( 'rad_sw_out_xy_av' )
-       WRITE ( 14 )  rad_sw_out_xy_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_in ) )  THEN
-       CALL wrd_write_string( 'rad_lw_in' )
-       WRITE ( 14 )  rad_lw_in
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_in_av ) )  THEN
-       CALL wrd_write_string( 'rad_lw_in_av' )
-       WRITE ( 14 )  rad_lw_in_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_out ) )  THEN
-       CALL wrd_write_string( 'rad_lw_out' )
-       WRITE ( 14 )  rad_lw_out
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_out_av) )  THEN
-       CALL wrd_write_string( 'rad_lw_out_av' )
-       WRITE ( 14 )  rad_lw_out_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_cs_hr) )  THEN
-       CALL wrd_write_string( 'rad_lw_cs_hr' )
-       WRITE ( 14 )  rad_lw_cs_hr
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_cs_hr_av) )  THEN
-       CALL wrd_write_string( 'rad_lw_cs_hr_av' )
-       WRITE ( 14 )  rad_lw_cs_hr_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_hr) )  THEN
-       CALL wrd_write_string( 'rad_lw_hr' )
-       WRITE ( 14 )  rad_lw_hr
-    ENDIF
-
-    IF ( ALLOCATED( rad_lw_hr_av) )  THEN
-       CALL wrd_write_string( 'rad_lw_hr_av' )
-       WRITE ( 14 )  rad_lw_hr_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_in) )  THEN
-       CALL wrd_write_string( 'rad_sw_in' )
-       WRITE ( 14 )  rad_sw_in
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_in_av) )  THEN
-       CALL wrd_write_string( 'rad_sw_in_av' )
-       WRITE ( 14 )  rad_sw_in_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_out) )  THEN
-       CALL wrd_write_string( 'rad_sw_out' )
-       WRITE ( 14 )  rad_sw_out
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_out_av) )  THEN
-       CALL wrd_write_string( 'rad_sw_out_av' )
-       WRITE ( 14 )  rad_sw_out_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_cs_hr) )  THEN
-       CALL wrd_write_string( 'rad_sw_cs_hr' )
-       WRITE ( 14 )  rad_sw_cs_hr
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_cs_hr_av) )  THEN
-       CALL wrd_write_string( 'rad_sw_cs_hr_av' )
-       WRITE ( 14 )  rad_sw_cs_hr_av
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_hr) )  THEN
-       CALL wrd_write_string( 'rad_sw_hr' )
-       WRITE ( 14 )  rad_sw_hr
-    ENDIF
-
-    IF ( ALLOCATED( rad_sw_hr_av) )  THEN
-       CALL wrd_write_string( 'rad_sw_hr_av' )
-       WRITE ( 14 )  rad_sw_hr_av
-    ENDIF
-
-
  END SUBROUTINE radiation_wrd_local
+
+
 
 !------------------------------------------------------------------------------!
