Index: palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- palm/trunk/SOURCE/salsa_mod.f90	(revision 4512)
+++ palm/trunk/SOURCE/salsa_mod.f90	(revision 4525)
@@ -26,4 +26,9 @@
 ! -----------------
 ! $Id$
+! added reading/writing of global restart data,
+! added reading/writing restart data with MPI-IO,
+! variable write_binary_salsa removed
+! 
+! 4512 2020-04-30 12:55:34Z monakurppa
 ! Fixed a bug in component_index_constructor: index out of bounds if all chemical
 ! components are used
@@ -306,7 +311,7 @@
                bc_radiation_s, coupling_char, debug_output, dt_3d, intermediate_timestep_count,    &
                intermediate_timestep_count_max, land_surface, max_pr_salsa, message_string,        &
-               monotonic_limiter_z, plant_canopy, pt_surface, salsa, scalar_advec,                 &
-               surface_pressure, time_since_reference_point, timestep_scheme, tsc, urban_surface,  &
-               ws_scheme_sca
+               monotonic_limiter_z, plant_canopy, pt_surface, restart_data_format_output, salsa,   &
+               scalar_advec, surface_pressure, time_since_reference_point, timestep_scheme, tsc,   &
+               urban_surface, ws_scheme_sca
 
     USE indices,                                                                                   &
@@ -320,4 +325,8 @@
 
     USE pegrid
+
+    USE restart_data_mpi_io_mod,                                                                   &
+        ONLY:  rd_mpi_io_check_array, rrd_mpi_io, rrd_mpi_io_global_array, wrd_mpi_io,             &
+               wrd_mpi_io_global_array
 
     USE statistics,                                                                                &
@@ -551,5 +560,4 @@
     LOGICAL ::  salsa_gases_from_chem   = .FALSE.  !< Transfer the gaseous components to SALSA
     LOGICAL ::  van_der_waals_coagc     = .FALSE.  !< Include van der Waals and viscous forces in coagulation
-    LOGICAL ::  write_binary_salsa      = .TRUE.   !< read binary for salsa
 
 !
@@ -986,6 +994,12 @@
     END INTERFACE salsa_prognostic_equations
 
+    INTERFACE salsa_rrd_global
+       MODULE PROCEDURE salsa_rrd_global_ftn
+       MODULE PROCEDURE salsa_rrd_global_mpi
+    END INTERFACE salsa_rrd_global
+
     INTERFACE salsa_rrd_local
-       MODULE PROCEDURE salsa_rrd_local
+       MODULE PROCEDURE salsa_rrd_local_ftn
+       MODULE PROCEDURE salsa_rrd_local_mpi
     END INTERFACE salsa_rrd_local
 
@@ -1002,4 +1016,8 @@
        MODULE PROCEDURE salsa_tendency_ij
     END INTERFACE salsa_tendency
+
+    INTERFACE salsa_wrd_global
+       MODULE PROCEDURE salsa_wrd_global
+    END INTERFACE salsa_wrd_global
 
     INTERFACE salsa_wrd_local
@@ -1035,7 +1053,9 @@
            salsa_parin,                   &
            salsa_prognostic_equations,    &
+           salsa_rrd_global,              &
            salsa_rrd_local,               &
            salsa_statistics,              &
            salsa_swap_timelevel,          &
+           salsa_wrd_global,              &
            salsa_wrd_local
 
@@ -1130,5 +1150,4 @@
                                      ocnv_init,                                &
                                      ocsv_init,                                &
-                                     read_restart_data_salsa,                  &
                                      reglim,                                   &
                                      salsa,                                    &
@@ -1139,6 +1158,5 @@
                                      skip_time_do_salsa,                       &
                                      surface_aerosol_flux,                     &
-                                     van_der_waals_coagc,                      &
-                                     write_binary_salsa
+                                     van_der_waals_coagc
 
     line = ' '
@@ -2972,8 +2990,83 @@
 ! Description:
 ! ------------
-!> This routine reads the respective restart data.
-!------------------------------------------------------------------------------!
- SUBROUTINE salsa_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 global restart data (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_rrd_global_ftn( found )
+
+    USE control_parameters,                                                    &
+        ONLY: length, restart_string
+
+
+    IMPLICIT NONE
+
+    LOGICAL, INTENT(OUT)  ::  found
+
+
+    found = .TRUE.
+
+    SELECT CASE ( restart_string(1:length) )
+
+       CASE ( 'listspec' )
+          READ ( 13 )  listspec
+
+       CASE ( 'nbin' )
+          READ ( 13 )  nbin
+
+       CASE ( 'nf2a' )
+          READ ( 13 )  nf2a
+
+       CASE ( 'ncc' )
+          READ ( 13 )  ncc
+
+       CASE ( 'mass_fracs_a' )
+          READ ( 13 )  mass_fracs_a
+
+       CASE ( 'mass_fracs_b' )
+          READ ( 13 )  mass_fracs_b
+
+       CASE DEFAULT
+
+          found = .FALSE.
+
+    END SELECT
+
+ END SUBROUTINE salsa_rrd_global_ftn
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific global restart data (MPI-IO).
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_rrd_global_mpi
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=1) ::  counter  !< counter used for output-variable names
+
+    INTEGER(iwp) ::  i  !< loop counter
+
+
+    DO  i = 1, 7
+       WRITE( counter, '(I1)' )  i
+       CALL rrd_mpi_io( 'listspec_' // counter, listspec(i) )
+    ENDDO
+
+    CALL rrd_mpi_io_global_array( 'nbin', nbin )
+    CALL rrd_mpi_io( 'nf2a', nf2a )
+    CALL rrd_mpi_io( 'ncc', ncc )
+    CALL rrd_mpi_io_global_array( 'mass_fracs_a', mass_fracs_a )
+    CALL rrd_mpi_io_global_array( 'mass_fracs_b', mass_fracs_b )
+
+ END SUBROUTINE salsa_rrd_global_mpi
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (Fortran binary format).
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_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,                                                                        &
@@ -3004,151 +3097,329 @@
        DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
 
-    found = .FALSE.
-
-    IF ( read_restart_data_salsa )  THEN
+    found = .TRUE.
 
        SELECT CASE ( restart_string(1:length) )
 
-          CASE ( 'aerosol_mass' )
-             DO  ic = 1, ncomponents_mass * nbins_aerosol
+       CASE ( 'aerosol_mass' )
+          DO  ic = 1, ncomponents_mass * nbins_aerosol
+             IF ( k == 1 )  READ ( 13 ) tmp_3d
+             aerosol_mass(ic)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                    &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          ENDDO
+
+       CASE ( 'aerosol_number' )
+          DO  ib = 1, nbins_aerosol
+             IF ( k == 1 )  READ ( 13 ) tmp_3d
+             aerosol_number(ib)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                  &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          ENDDO
+
+       CASE( 'salsa_gases_av' )
+          IF ( .NOT. ALLOCATED( salsa_gases_av ) )  THEN
+             ALLOCATE( salsa_gases_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngases_salsa) )
+          ENDIF
+          DO  ig = 1, ngases_salsa
+             IF ( k == 1 )  READ ( 13 ) tmp_3d
+             salsa_gases_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ig) =                        &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          ENDDO
+
+       CASE ( 'ldsa_av' )
+          IF ( .NOT. ALLOCATED( ldsa_av ) )  ALLOCATE( ldsa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( k == 1 )  READ ( 13 ) tmp_3d
+          ldsa_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                     &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+       CASE ( 'mbins_av' )
+          IF ( .NOT. ALLOCATED( mbins_av ) )  THEN
+             ALLOCATE( mbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
+          ENDIF
+          DO  ib = 1, nbins_aerosol
+             IF ( k == 1 )  READ ( 13 ) tmp_3d
+             mbins_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ib) =                              &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          ENDDO
+
+       CASE ( 'nbins_av' )
+          IF ( .NOT. ALLOCATED( nbins_av ) )  THEN
+             ALLOCATE( nbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
+          ENDIF
+          DO  ib = 1, nbins_aerosol
+             IF ( k == 1 )  READ ( 13 ) tmp_3d
+             nbins_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ib) =                              &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          ENDDO
+
+       CASE ( 'ntot_av' )
+          IF ( .NOT. ALLOCATED( ntot_av ) )  ALLOCATE( ntot_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( k == 1 )  READ ( 13 ) tmp_3d
+          ntot_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                     &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          found = .TRUE.
+
+       CASE ( 'nufp_av' )
+          IF ( .NOT. ALLOCATED( nufp_av ) )  ALLOCATE( nufp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( k == 1 )  READ ( 13 ) tmp_3d
+          nufp_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                     &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+       CASE ( 'pm01_av' )
+          IF ( .NOT. ALLOCATED( pm01_av ) )  ALLOCATE( pm01_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( k == 1 )  READ ( 13 ) tmp_3d
+          pm01_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                     &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+       CASE ( 'pm25_av' )
+          IF ( .NOT. ALLOCATED( pm25_av ) )  ALLOCATE( pm25_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( k == 1 )  READ ( 13 ) tmp_3d
+          pm25_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                     &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+       CASE ( 'pm10_av' )
+          IF ( .NOT. ALLOCATED( pm10_av ) )  ALLOCATE( pm10_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( k == 1 )  READ ( 13 ) tmp_3d
+          pm10_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                     &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+       CASE ( 's_mass_av' )
+          IF ( .NOT. ALLOCATED( s_mass_av ) )  THEN
+             ALLOCATE( s_mass_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncomponents_mass) )
+          ENDIF
+          DO  ic = 1, ncomponents_mass
+             IF ( k == 1 )  READ ( 13 ) tmp_3d
+             s_mass_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ic) =                             &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          ENDDO
+
+       CASE ( 's_h2o_av' )
+          IF ( .NOT. ALLOCATED( s_h2o_av ) )  ALLOCATE( s_h2o_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+          IF ( k == 1 )  READ ( 13 ) tmp_3d
+          s_h2o_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+       CASE ( 'salsa_gas' )
+          IF ( .NOT. salsa_gases_from_chem )  THEN
+             DO  ig = 1, ngases_salsa
                 IF ( k == 1 )  READ ( 13 ) tmp_3d
-                aerosol_mass(ic)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                 &
+                salsa_gas(ig)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                    &
                                                    tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
              ENDDO
-             found = .TRUE.
-
-          CASE ( 'aerosol_number' )
-             DO  ib = 1, nbins_aerosol
-                IF ( k == 1 )  READ ( 13 ) tmp_3d
-                aerosol_number(ib)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =               &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             ENDDO
-             found = .TRUE.
-
-          CASE( 'salsa_gases_av' )
-             IF ( .NOT. ALLOCATED( salsa_gases_av ) )  THEN
-                ALLOCATE( salsa_gases_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ngases_salsa) )
-             ENDIF
-             DO  ig = 1, ngases_salsa
-                IF ( k == 1 )  READ ( 13 ) tmp_3d
-                salsa_gases_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ig) =                     &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             ENDDO
-             found = .TRUE.
-
-          CASE ( 'ldsa_av' )
-             IF ( .NOT. ALLOCATED( ldsa_av ) )  ALLOCATE( ldsa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             IF ( k == 1 )  READ ( 13 ) tmp_3d
-             ldsa_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-
-          CASE ( 'mbins_av' )
-             IF ( .NOT. ALLOCATED( mbins_av ) )  THEN
-                ALLOCATE( mbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
-             ENDIF
-             DO  ib = 1, nbins_aerosol
-                IF ( k == 1 )  READ ( 13 ) tmp_3d
-                mbins_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ib) =                           &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-                found = .TRUE.
-             ENDDO
-
-          CASE ( 'nbins_av' )
-             IF ( .NOT. ALLOCATED( nbins_av ) )  THEN
-                ALLOCATE( nbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,nbins_aerosol) )
-             ENDIF
-             DO  ib = 1, nbins_aerosol
-                IF ( k == 1 )  READ ( 13 ) tmp_3d
-                nbins_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ib) =                           &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-                found = .TRUE.
-             ENDDO
-
-          CASE ( 'ntot_av' )
-             IF ( .NOT. ALLOCATED( ntot_av ) )  ALLOCATE( ntot_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             IF ( k == 1 )  READ ( 13 ) tmp_3d
-             ntot_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-
-          CASE ( 'nufp_av' )
-             IF ( .NOT. ALLOCATED( nufp_av ) )  ALLOCATE( nufp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             IF ( k == 1 )  READ ( 13 ) tmp_3d
-             nufp_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-
-          CASE ( 'pm01_av' )
-             IF ( .NOT. ALLOCATED( pm01_av ) )  ALLOCATE( pm01_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             IF ( k == 1 )  READ ( 13 ) tmp_3d
-             pm01_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-
-          CASE ( 'pm25_av' )
-             IF ( .NOT. ALLOCATED( pm25_av ) )  ALLOCATE( pm25_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             IF ( k == 1 )  READ ( 13 ) tmp_3d
-             pm25_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-
-          CASE ( 'pm10_av' )
-             IF ( .NOT. ALLOCATED( pm10_av ) )  ALLOCATE( pm10_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             IF ( k == 1 )  READ ( 13 ) tmp_3d
-             pm10_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-
-          CASE ( 's_mass_av' )
-             IF ( .NOT. ALLOCATED( s_mass_av ) )  THEN
-                ALLOCATE( s_mass_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,ncomponents_mass) )
-             ENDIF
-             DO  ic = 1, ncomponents_mass
-                IF ( k == 1 )  READ ( 13 ) tmp_3d
-                s_mass_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp,ic) =                          &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             ENDDO
-             found = .TRUE.
-
-          CASE ( 's_h2o_av' )
-             IF ( .NOT. ALLOCATED( s_h2o_av ) )  ALLOCATE( s_h2o_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-             IF ( k == 1 )  READ ( 13 ) tmp_3d
-             s_h2o_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-
-          CASE ( 'salsa_gas' )
-             IF ( .NOT. salsa_gases_from_chem )  THEN
-                DO  ig = 1, ngases_salsa
-                   IF ( k == 1 )  READ ( 13 ) tmp_3d
-                   salsa_gas(ig)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                 &
-                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-                ENDDO
-                found = .TRUE.
-             ENDIF
-
-          CASE DEFAULT
-             found = .FALSE.
-
-       END SELECT
-    ENDIF
-
- END SUBROUTINE salsa_rrd_local
+          ENDIF
+
+       CASE DEFAULT
+          found = .FALSE.
+
+    END SELECT
+
+ END SUBROUTINE salsa_rrd_local_ftn
+
 
 !------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> This routine writes the respective restart data.
+!> Read module-specific local restart data arrays (MPI-IO).
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_rrd_local_mpi
+
+    USE indices,                                                               &
+        ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=3) ::  counter  !< counter used for input-variable names
+
+    INTEGER(iwp) ::  ib  !<
+    INTEGER(iwp) ::  ic  !<
+    INTEGER(iwp) ::  ig  !<
+
+    LOGICAL ::  array_found  !<
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  tmp_3d  !< temporary array to store aerosal data
+                                                        !< as single 3d-standard arrays
+
+
+    ALLOCATE( tmp_3d(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+
+    DO  ic = 1, nbins_aerosol * ncomponents_mass
+       WRITE( counter, '(I3.3)')  ic
+       CALL rrd_mpi_io( 'aerosol_mass_' // counter, tmp_3d )
+       aerosol_mass(ic)%conc = tmp_3d
+    ENDDO
+
+    DO  ib = 1, nbins_aerosol
+       WRITE( counter, '(I3.3)')  ib
+       CALL rrd_mpi_io( 'aerosol_number_' // counter, tmp_3d )
+       aerosol_number(ic)%conc = tmp_3d
+    ENDDO
+
+    IF ( .NOT. salsa_gases_from_chem )  THEN
+       CALL rd_mpi_io_check_array( 'salsa_gases_av_001', found = array_found )
+       IF ( array_found )  THEN
+          IF ( .NOT. ALLOCATED( salsa_gases_av ) )  THEN
+             ALLOCATE( salsa_gases_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,1:ngases_salsa) )
+          ENDIF
+          DO  ig = 1, ngases_salsa
+             WRITE( counter, '(I3.3)')  ig
+             CALL rrd_mpi_io( 'salsa_gases_av_' // counter , tmp_3d )
+             salsa_gases_av(:,:,:,ig) = tmp_3d
+          ENDDO
+       ENDIF
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'ldsa_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( ldsa_av ) )  ALLOCATE( ldsa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'ldsa_av', ldsa_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'mbins_av_001', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( mbins_av ) )  THEN
+          ALLOCATE( mbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,1:nbins_aerosol) )
+       ENDIF
+       DO  ib = 1, nbins_aerosol
+          WRITE( counter, '(I3.3)')  ib
+          CALL rrd_mpi_io( 'mbins_av_' // counter, tmp_3d )
+          mbins_av(:,:,:,ib) = tmp_3d
+       ENDDO
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'nbins_av_001', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( nbins_av ) )  THEN
+          ALLOCATE( nbins_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,1:nbins_aerosol) )
+       ENDIF
+       DO  ib = 1, nbins_aerosol
+          WRITE( counter, '(I3.3)')  ib
+          CALL rrd_mpi_io( 'nbins_av_' // counter, tmp_3d )
+          nbins_av(:,:,:,ib) = tmp_3d
+       ENDDO
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'ntot_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( ntot_av ) )  ALLOCATE( ntot_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'ntot_av', ntot_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'nufp_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( nufp_av ) )  ALLOCATE( nufp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'nufp_av', nufp_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'pm01_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( pm01_av ) )  ALLOCATE( pm01_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'pm01_av', pm01_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'pm25_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( pm25_av ) )  ALLOCATE( pm25_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'pm25_av', pm25_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 'pm10_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( pm10_av ) )  ALLOCATE( pm10_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 'pm10_av', pm10_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 's_h20_av', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( s_h2o_av ) )  ALLOCATE( s_h2o_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+       CALL rrd_mpi_io( 's_h2o_av', s_h2o_av )
+    ENDIF
+
+    CALL rd_mpi_io_check_array( 's_mass_av_001', found = array_found )
+    IF ( array_found )  THEN
+       IF ( .NOT. ALLOCATED( s_mass_av ) )  THEN
+          ALLOCATE( s_mass_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg,1:ncomponents_mass) )
+       ENDIF
+       DO  ic = 1, ncomponents_mass
+          WRITE( counter, '(I3.3)')  ib
+          CALL rrd_mpi_io( 's_mass_av_' // counter, tmp_3d )
+          s_mass_av(:,:,:,ic) = tmp_3d
+       ENDDO
+    ENDIF
+
+    IF ( .NOT. salsa_gases_from_chem )  THEN
+       DO  ig = 1, ngases_salsa
+          WRITE( counter, '(I3.3)')  ig
+          CALL rrd_mpi_io( 'salsa_gas_' // counter, tmp_3d )
+          salsa_gas(ig)%conc = tmp_3d
+       ENDDO
+    ENDIF
+
+    DEALLOCATE( tmp_3d )
+
+ END SUBROUTINE salsa_rrd_local_mpi
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Write module-specific global restart data.
+!------------------------------------------------------------------------------!
+ SUBROUTINE salsa_wrd_global
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=1) ::  counter  !< counter used for output-variable names
+
+    INTEGER(iwp) ::  i  !< loop counter
+
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+       CALL wrd_write_string( 'listpec' )
+       WRITE ( 14 )  listspec
+
+       CALL wrd_write_string( 'nbin' )
+       WRITE ( 14 )  nbin
+
+       CALL wrd_write_string( 'nf2a' )
+       WRITE ( 14 )  nf2a
+
+       CALL wrd_write_string( 'ncc' )
+       WRITE ( 14 )  ncc
+
+       CALL wrd_write_string( 'mass_fracs_a' )
+       WRITE ( 14 )  mass_fracs_a
+
+       CALL wrd_write_string( 'mass_fracs_b' )
+       WRITE ( 14 )  mass_fracs_b
+
+    ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' )  THEN
+
+       DO  i = 1, 7
+          WRITE( counter, '(I1)' )  i
+          CALL wrd_mpi_io( 'listspec_' // counter, listspec(i) )
+       ENDDO
+
+       CALL wrd_mpi_io_global_array( 'nbin', nbin )
+       CALL wrd_mpi_io( 'nf2a', nf2a )
+       CALL wrd_mpi_io( 'ncc', ncc )
+       CALL wrd_mpi_io_global_array( 'mass_fracs_a', mass_fracs_a )
+       CALL wrd_mpi_io_global_array( 'mass_fracs_b', mass_fracs_b )
+
+    ENDIF
+
+ END SUBROUTINE salsa_wrd_global
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> This routine writes the respective local restart data.
 !> Note that the following input variables in PARIN have to be equal between
 !> restart runs:
-!>    listspec, nbin, nbin2, nf2a, ncc, mass_fracs_a, mass_fracs_b
+!>    listspec, nbin, nf2a, ncc, mass_fracs_a, mass_fracs_b
 !------------------------------------------------------------------------------!
  SUBROUTINE salsa_wrd_local
 
-    USE control_parameters,                                                                        &
-        ONLY:  write_binary
-
     IMPLICIT NONE
+
+    CHARACTER(LEN=3) ::  counter  !< counter used for output-variable names
 
     INTEGER(iwp) ::  ib   !<
@@ -3156,5 +3427,8 @@
     INTEGER(iwp) ::  ig  !<
 
-    IF ( write_binary  .AND.  write_binary_salsa )  THEN
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  tmp_3d  !< temporary array to store aerosal data
+                                                        !< as single 3d-standard arrays
+
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
 
        CALL wrd_write_string( 'aerosol_mass' )
@@ -3179,6 +3453,6 @@
 
        IF ( ALLOCATED( ldsa_av ) )  THEN
-       CALL wrd_write_string( 'ldsa_av' )
-       WRITE ( 14 )  ldsa_av
+          CALL wrd_write_string( 'ldsa_av' )
+          WRITE ( 14 )  ldsa_av
        ENDIF
 
@@ -3240,4 +3514,75 @@
           ENDDO
        ENDIF
+
+    ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' )  THEN
+
+       ALLOCATE( tmp_3d(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+
+       DO  ic = 1, nbins_aerosol * ncomponents_mass
+          WRITE( counter, '(I3.3)')  ic
+          tmp_3d = aerosol_mass(ic)%conc
+          CALL wrd_mpi_io( 'aerosol_mass_' // counter, tmp_3d )
+       ENDDO
+
+       DO  ib = 1, nbins_aerosol
+          WRITE( counter, '(I3.3)')  ib
+          tmp_3d = aerosol_number(ib)%conc
+          CALL wrd_mpi_io( 'aerosol_number_' // counter, tmp_3d )
+       ENDDO
+
+       IF (  .NOT. salsa_gases_from_chem )  THEN
+
+          IF ( ALLOCATED( salsa_gases_av ) )  THEN
+             DO  ig = 1, ngases_salsa
+                WRITE( counter, '(I3.3)')  ig
+                tmp_3d = salsa_gases_av(:,:,:,ig)
+                CALL wrd_mpi_io( 'salsa_gases_av_' // counter, tmp_3d )
+             ENDDO
+          ENDIF
+       ENDIF
+
+       IF ( ALLOCATED( ldsa_av ) )  CALL wrd_mpi_io( 'ldsa_av', ldsa_av )
+
+
+       IF ( ALLOCATED( mbins_av ) )  THEN
+          DO  ib = 1, nbins_aerosol
+             WRITE( counter, '(I3.3)')  ib
+             tmp_3d = mbins_av(:,:,:,ib)
+             CALL wrd_mpi_io( 'mbins_av_' // counter, tmp_3d )
+          ENDDO
+       ENDIF
+
+       IF ( ALLOCATED( nbins_av ) )  THEN
+          DO  ib = 1, nbins_aerosol
+             WRITE( counter, '(I3.3)')  ib
+             tmp_3d = nbins_av(:,:,:,ib)
+             CALL wrd_mpi_io( 'nbins_av_' // counter, tmp_3d )
+          ENDDO
+       ENDIF
+
+       IF ( ALLOCATED( ntot_av )  )  CALL wrd_mpi_io( 'ntot_av', ntot_av )
+       IF ( ALLOCATED( nufp_av )  )  CALL wrd_mpi_io( 'nufp_av', nufp_av )
+       IF ( ALLOCATED( pm01_av )  )  CALL wrd_mpi_io( 'pm01_av', pm01_av )
+       IF ( ALLOCATED( pm25_av )  )  CALL wrd_mpi_io( 'pm25_av', pm25_av )
+       IF ( ALLOCATED( pm10_av )  )  CALL wrd_mpi_io( 'pm10_av', pm10_av )
+       IF ( ALLOCATED( s_h2o_av ) )  CALL wrd_mpi_io( 's_h2o_av', s_h2o_av )
+
+       IF ( ALLOCATED( s_mass_av ) )  THEN
+          DO  ic = 1, ncomponents_mass
+             WRITE( counter, '(I3.3)')  ic
+             tmp_3d = s_mass_av(:,:,:,ic)
+             CALL wrd_mpi_io( 's_mass_av_' // counter, tmp_3d )
+          ENDDO
+       ENDIF
+
+       IF ( .NOT. salsa_gases_from_chem )  THEN
+          DO  ig = 1, ngases_salsa
+             WRITE( counter, '(I3.3)')  ig
+             tmp_3d = salsa_gas(ig)%conc
+             CALL wrd_mpi_io( 'salsa_gas_' // counter, tmp_3d )
+          ENDDO
+       ENDIF
+
+       DEALLOCATE( tmp_3d )
 
     ENDIF
@@ -13067,5 +13412,5 @@
 
     USE control_parameters,                                                                        &
-        ONLY:  end_time, initializing_actions, spinup_time
+        ONLY:  end_time, spinup_time
 
     USE palm_date_time_mod,                                                                        &
@@ -13139,6 +13484,5 @@
 !
 !--    Initialize boundary data. Please note, do not initialize boundaries in case of restart runs.
-       IF ( TRIM( initializing_actions ) /= 'read_restart_data'  .AND.  read_restart_data_salsa )  &
-       THEN
+       IF ( .NOT. read_restart_data_salsa )  THEN
           IF ( bc_dirichlet_l )  THEN
              DO  ib = 1, nbins_aerosol
