Index: palm/trunk/SCRIPTS/palmrun
===================================================================
--- palm/trunk/SCRIPTS/palmrun	(revision 4535)
+++ palm/trunk/SCRIPTS/palmrun	(revision 4536)
@@ -27,4 +27,7 @@
 # -----------------
 # $Id$
+# handling of single restart files (created with MPI-I/O) added
+# 
+# 4481 2020-03-31 18:55:54Z maronga
 # add cycle number to initial files too (000),
 # remove compatibility for cycle numbers which are less than three digits wide
@@ -2045,4 +2048,9 @@
           files_for_cores=true; filetype=files
           actionin[$i]="ln"
+             # FILE HAS BEEN FOUND INSTEAD OF DIRECTORY
+          if [[ -f "${absnamein[$i]}" ]]
+          then
+             files_for_cores=false; filetype=file
+          fi
        elif [[ "${actionin[$i]}" = lnpe  &&  ! -n $cores ]]
        then
@@ -2572,7 +2580,12 @@
           link_local_output=true
           actionout[$i]=""
+             # FILE HAS BEEN FOUND INSTEAD OF DIRECTORY
+          if [[ -f ${localout[$i]} ]]
+          then
+             files_for_cores=false; filetype=file
+          fi
        elif [[ "${actionout[$i]}" = lnpe  &&  ! -n $cores ]]
        then
-          link_local_output
+          link_local_output=true
           actionout[$i]=""
        elif [[ "${actionout[$i]}" = trpe  &&  -n $cores ]]
@@ -2697,38 +2710,34 @@
                 printf "\n  >>> OUTPUT: ${localout[$i]}  to"
                 printf "\n              ${pathout[$i]}.${extout[$i]}\n"
-		              if [[ $link_local_output = true ]]
-		              then
-		                 printf "      file will be linked\n"
-		                 ln -f  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
-		              fi
-		                 # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
-		              if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]]
+                if [[ $link_local_output = true ]]
                 then
-		                 if [[ $link_local_output = true ]]
-	                  then
+                   printf "      file will be linked\n"
+                   ln -f  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
+                fi
+                   # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
+                if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]]
+                then
+                   if [[ $link_local_output = true ]]
+                   then
                       printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
-		                 fi
-		                 cp  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
-		              else
-                   printf "+++ no copy because file ${pathout[$i]}.${extout[$i]} exists\n"
+                   fi
+                   cp  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
                 fi
              else
                 printf "\n  >>> OUTPUT: ${localout[$i]}  to"
                 printf "\n              ${pathout[$i]}\n"
-		              if [[ $link_local_output = true ]]
-		              then
-		                 printf "      file will be linked\n"
-		                 ln -f  ${localout[$i]}  ${pathout[$i]}
-		              fi
-		                 # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
-	              	if [[ ! -f "${pathout[$i]}" ]]
+                if [[ $link_local_output = true ]]
                 then
-		                 if [[ $link_local_output = true ]]
-	                  then
+                   printf "      file will be linked\n"
+                   ln -f  ${localout[$i]}  ${pathout[$i]}
+                fi
+                   # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
+             	if [[ ! -f "${pathout[$i]}" ]]
+                then
+                   if [[ $link_local_output = true ]]
+                   then
                       printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
-		                 fi
-		                 cp  ${localout[$i]}  ${pathout[$i]}
-		              else
-		                 printf "+++ no copy because file ${pathout[$i]} exists\n"
+                   fi
+                   cp  ${localout[$i]}  ${pathout[$i]}
                 fi
              fi
@@ -2741,25 +2750,25 @@
              printf "\n  >>> OUTPUT: ${localout[$i]}/_....  to"
              printf "\n              ${pathout[$i]}\n"
-	            if [[ $link_local_output = true ]]
-	            then
-		              printf "      files will be linked\n"
-		              mkdir -p ${pathout[$i]}
-		              cd ${localout[$i]}
-		              for file in $(ls *)
-		              do
-		                 ln -f $file  ${pathout[$i]}
-		              done >|/dev/null 2>&1
-		              cd $tempdir
-	            fi
+             if [[ $link_local_output = true ]]
+             then
+                printf "      files will be linked\n"
+                mkdir -p ${pathout[$i]}
+                cd ${localout[$i]}
+                for file in $(ls *)
+                do
+                   ln -f $file  ${pathout[$i]}
+                done >|/dev/null 2>&1
+                cd $tempdir
+             fi
 
                 # IF "ln -f" HAS FAILED OR IF "$link_local_output = false" DO A NORMAL COPY "cp -r"
-	            if [[ ! -f "${pathout[$i]}/_000000" ]]
+             if [[ ! -f "${pathout[$i]}/_000000" ]]
              then
-		              if [[ $link_local_output = true ]]
-		              then
+                if [[ $link_local_output = true ]]
+                then
                    printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
-		              fi
-		              [[ ! -d "${pathout[$i]}" ]]  &&  mkdir  ${pathout[$i]}
-		              cp -r  ${localout[$i]}/*  ${pathout[$i]}
+                fi
+                [[ ! -d "${pathout[$i]}" ]]  &&  mkdir  ${pathout[$i]}
+                cp -r  ${localout[$i]}/*  ${pathout[$i]}
        	     fi
 
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 4535)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 4536)
@@ -265,5 +265,5 @@
          TRIM( restart_data_format ) /= 'mpi_shared_memory' )  THEN
        message_string = 'illegal restart data format "' // TRIM( restart_data_format ) // '"'
-       CALL message( 'check_parameters', 'PA....', 1, 2, 0, 6, 0 )
+       CALL message( 'check_parameters', 'PA0724', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -278,14 +278,14 @@
          TRIM( restart_data_format_input ) /= 'mpi'             .AND.                              &
          TRIM( restart_data_format_input ) /= 'mpi_shared_memory' )  THEN
-       message_string = 'illegal restart data input format "' //                                   &
+       message_string = 'illegal restart input data format "' //                                   &
                         TRIM( restart_data_format_input ) // '"'
-       CALL message( 'check_parameters', 'PA....', 1, 2, 0, 6, 0 )
+       CALL message( 'check_parameters', 'PA0725', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( TRIM( restart_data_format_output ) /= 'fortran_binary'  .AND.                             &
          TRIM( restart_data_format_output ) /= 'mpi'             .AND.                             &
          TRIM( restart_data_format_output ) /= 'mpi_shared_memory' )  THEN
-       message_string = 'illegal restart data output format "' //                                  &
+       message_string = 'illegal restart output data format "' //                                  &
                         TRIM( restart_data_format_output ) // '"'
-       CALL message( 'check_parameters', 'PA....', 1, 2, 0, 6, 0 )
+       CALL message( 'check_parameters', 'PA0726', 1, 2, 0, 6, 0 )
     ENDIF
 
Index: palm/trunk/SOURCE/cpulog_mod.f90
===================================================================
--- palm/trunk/SOURCE/cpulog_mod.f90	(revision 4535)
+++ palm/trunk/SOURCE/cpulog_mod.f90	(revision 4536)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! restart I/O transfer speed added
+! 
+! 4429 2020-02-27 15:24:30Z raasch
 ! bugfix: cpp-directives added for serial mode
 ! 
@@ -94,5 +97,6 @@
 
     USE control_parameters,                                                                        &
-        ONLY: message_string, nr_timesteps_this_run, run_description_header, synchronous_exchange
+        ONLY: message_string, nr_timesteps_this_run, restart_data_format_output,                   &
+              restart_file_size, run_description_header, synchronous_exchange, write_binary
                
     USE indices,                                                                                   &
@@ -499,9 +503,12 @@
              WRITE ( 18, 106 )
           ENDIF
-
-!
-!--       Empty lines in order to create a gap to the results of the model
-!--       continuation runs
-          WRITE ( 18, 107 )
+!
+!--       Output of restart data transfer speed
+          IF ( write_binary  .AND.  restart_data_format_output(1:3) == 'mpi' )  THEN
+             WRITE ( 18, 107 )  restart_file_size, restart_file_size / log_point(22)%sum
+          ENDIF
+!
+!--       Empty lines in order to create a gap to the results from the next restart run
+          WRITE ( 18, 108 )
 
 !
@@ -529,5 +536,7 @@
    105 FORMAT (/'Exchange of ghostpoints via MPI_SENDRCV')
    106 FORMAT (/'Exchange of ghostpoints via MPI_ISEND/MPI_IRECV')
-   107 FORMAT (//)
+   107 FORMAT (/'Restart file size:   ',F12.1,' MByte'/                                            &
+               &'I/O transfer speed:  ',F12.1,' MByte / sec')
+   108 FORMAT (//)
    110 FORMAT ('------------------------------------------------------------',                     &
                &'----------'//                                                                     &
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 4535)
+++ palm/trunk/SOURCE/header.f90	(revision 4536)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! output of restart data format added
+! 
+! 4473 2020-03-25 21:04:07Z gronemeier
 ! revised message if wall_adjustment is used
 ! 
@@ -1492,4 +1495,16 @@
        ENDIF
        WRITE ( io, 341 )  dt_dots
+    ENDIF
+
+!
+!-- Restart data formats
+    IF ( TRIM( initializing_actions ) == 'read_restart_data'  .OR.  write_binary )  THEN
+       WRITE ( io, 355 )
+       IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
+          WRITE ( io, 356 )  TRIM( restart_data_format_input )
+       ENDIF
+       IF ( write_binary )  THEN
+          WRITE ( io, 357 )  TRIM( restart_data_format_output )
+       ENDIF
     ENDIF
 
@@ -1829,4 +1844,7 @@
 353 FORMAT  (/'       Number of output time levels allowed: unlimited' /)
 354 FORMAT ('       Output format: ',A, '   compressed with level: ',I1/)
+355 FORMAT (/'    Restart data format(s):')
+356 FORMAT ('    Input format:  ',A)
+357 FORMAT ('    Output format: ',A)
 400 FORMAT (//' Physical quantities:'/ &
               ' -------------------'/)
Index: palm/trunk/SOURCE/message.f90
===================================================================
--- palm/trunk/SOURCE/message.f90	(revision 4535)
+++ palm/trunk/SOURCE/message.f90	(revision 4536)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! location message format changed
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
 ! 
@@ -264,9 +267,10 @@
 !
 !--    Write and flush debug location or info message to file
-       WRITE( OUTPUT_UNIT, 200 )  TRIM( message_type_string ), location_string, TRIM( system_time )
+       WRITE( OUTPUT_UNIT, 200 )  TRIM( system_time ), TRIM( message_type_string ),                &
+                                  TRIM( location_string )
        FLUSH( OUTPUT_UNIT )
 !
 !--    Message formats
-200    FORMAT ( 3X, A, ' ', A60, ' | System time: ', A )
+200    FORMAT ( 3X, A, 3x, A, 2X, A )
 
     ENDIF
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 4535)
+++ palm/trunk/SOURCE/modules.f90	(revision 4536)
@@ -949,4 +949,5 @@
     REAL(wp) ::  recycling_width = 9999999.9_wp                !< namelist parameter
     REAL(wp) ::  residual_limit = 1.0E-4_wp                    !< namelist parameter
+    REAL(wp) ::  restart_file_size                             !< size of restart file in mbyte
     REAL(wp) ::  restart_time = 9999999.9_wp                   !< namelist parameter
     REAL(wp) ::  rho_reference                                 !< reference state of density
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 4535)
+++ palm/trunk/SOURCE/parin.f90	(revision 4536)
@@ -517,5 +517,5 @@
                   TRIM( restart_data_format ) /= 'mpi_shared_memory' )  THEN
                 message_string = 'illegal restart data format "' // TRIM( restart_data_format ) // '"'
-                CALL message( 'parin', 'PA....', 1, 2, 0, 6, 0 )
+                CALL message( 'parin', 'PA0724', 1, 2, 0, 6, 0 )
              ENDIF
              IF ( TRIM( restart_data_format_input ) == 'undefined' )  THEN
Index: palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4535)
+++ palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4536)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! binary version incremented
+! 
+! 4534 2020-05-14 18:35:22Z raasch
 ! adjustments for I/O on reduced number of cores using shared memory MPI
 ! 
@@ -253,5 +256,5 @@
        READ ( 13 )  version_on_file
 
-       binary_version_global = '4.9'
+       binary_version_global = '5.0'
        IF ( TRIM( version_on_file ) /= TRIM( binary_version_global ) )  THEN
           WRITE( message_string, * ) 'version mismatch concerning ',           &
@@ -999,5 +1002,5 @@
        CALL rrd_mpi_io( 'omega', omega )
        CALL rrd_mpi_io( 'omega_sor', omega_sor )
-       CALL rrd_mpi_io( 'origin_data_time', origin_date_time )
+       CALL rrd_mpi_io( 'origin_date_time', origin_date_time )
        CALL rrd_mpi_io( 'output_for_t0', output_for_t0 )
        CALL rrd_mpi_io( 'particle_advection', particle_advection )
@@ -1569,5 +1572,5 @@
           READ ( 13 )  version_on_file
 
-          binary_version_local = '4.7'
+          binary_version_local = '5.0'
           IF ( TRIM( version_on_file ) /= TRIM( binary_version_local ) )  THEN
              WRITE( message_string, * ) 'version mismatch concerning ',                               &
Index: palm/trunk/SOURCE/restart_data_mpi_io_mod.f90
===================================================================
--- palm/trunk/SOURCE/restart_data_mpi_io_mod.f90	(revision 4535)
+++ palm/trunk/SOURCE/restart_data_mpi_io_mod.f90	(revision 4536)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! messages and debug output converted to PALM routines
+! 
+! 4534 2020-05-14 18:35:22Z raasch
 ! I/O on reduced number of cores added (using shared memory MPI)
 ! 
@@ -63,5 +66,6 @@
 
     USE control_parameters,                                                                        &
-        ONLY:  include_total_domain_boundaries, restart_data_format_input
+        ONLY:  debug_output, debug_string, include_total_domain_boundaries, message_string,        &
+               restart_data_format_input, restart_data_format_output, restart_file_size
 
     USE exchange_horiz_mod,                                                                        &
@@ -135,9 +139,6 @@
     LOGICAL ::  filetypes_created                 !<
     LOGICAL ::  io_on_limited_cores_per_node      !< switch to shared memory MPI-IO
-    LOGICAL ::  print_header_now = .TRUE.         !<
     LOGICAL ::  rd_flag                           !< file is opened for read
     LOGICAL ::  wr_flag                           !< file is opened for write
-
-    REAL(KIND=wp) ::  mb_processed  !<
 
 #if defined( __parallel )
@@ -194,5 +195,5 @@
     PRIVATE
 
-    PUBLIC  mb_processed, total_number_of_surface_values
+    PUBLIC  restart_file_size, total_number_of_surface_values
 
 !
@@ -300,8 +301,13 @@
 
     offset = 0
+    io_on_limited_cores_per_node = .FALSE.
 
     rd_flag = ( TRIM( action ) == 'READ'  .OR. TRIM( action ) == 'read'  )
     wr_flag = ( TRIM( action ) == 'WRITE' .OR. TRIM( action ) == 'write' )
 
+    IF ( .NOT. ( rd_flag .OR. wr_flag ) )  THEN
+       message_string = 'illegal action "' // TRIM( action ) // '" for opening restart files'
+       CALL message( 'restart_data_mpi_io_mod', 'PA0720', 1, 2, 0, 6, 0 )
+    ENDIF
 !
 !-- Store name of I/O file to communicate it internally within this module.
@@ -309,7 +315,13 @@
 !
 !-- Setup for IO on a limited number of threads per node (using shared memory MPI)
-    IF ( TRIM( restart_data_format_input ) == 'mpi_shared_memory' )  THEN
+    IF ( rd_flag )  THEN
+       set_filetype = .TRUE.
+       IF ( TRIM( restart_data_format_input ) == 'mpi_shared_memory' )  THEN
+          io_on_limited_cores_per_node = .TRUE.
+       ENDIF
+    ENDIF
+
+    IF ( TRIM( restart_data_format_output ) == 'mpi_shared_memory' .AND.  wr_flag )  THEN
        io_on_limited_cores_per_node = .TRUE.
-       set_filetype                 = .TRUE.
     ENDIF
 !
@@ -339,5 +351,5 @@
 !-- In case of read it is not known yet if data include total domain. Filetypes will be created
 !-- further below.
-    IF ( wr_flag)  THEN
+    IF ( wr_flag )  THEN
        CALL rd_mpi_io_create_filetypes
        filetypes_created = .TRUE.
@@ -348,28 +360,93 @@
 #if defined( __parallel )
     IF ( sm_io%iam_io_pe )  THEN
+
        IF ( rd_flag )  THEN
+
+          IF ( debug_output )  THEN
+             WRITE( debug_string, * )  'open joint restart file "' // TRIM( io_file_name ) //      &
+                                       '" for read with MPI-IO'
+             CALL debug_message( debug_string, 'start' )
+          ENDIF
+
           CALL MPI_FILE_OPEN( comm_io, TRIM( io_file_name ), MPI_MODE_RDONLY, MPI_INFO_NULL, fh,   &
                               ierr )
-          WRITE (9,*) 'Open MPI-IO restart file for read  ==> ', TRIM( io_file_name )
+
+          IF ( ierr /= 0 )  THEN
+             message_string = 'error opening restart file "' // TRIM( io_file_name ) //      &
+                              '" for reading with MPI-IO'
+             CALL message( 'rrd_mpi_io_open', 'PA0727', 3, 2, 0, 6, 0 )
+          ENDIF
+
+          IF ( debug_output )  THEN
+             WRITE( debug_string, * )  'open joint restart file "' // TRIM( io_file_name ) //      &
+                                       '" for read with MPI-IO'
+             CALL debug_message( debug_string, 'end' )
+          ENDIF
+
        ELSEIF ( wr_flag )  THEN
+
+          IF ( debug_output )  THEN
+             WRITE( debug_string, * )  'open joint restart file "' // TRIM( io_file_name ) //      &
+                                       '" for write with MPI-IO'
+             CALL debug_message( debug_string, 'start' )
+          ENDIF
+
           CALL MPI_FILE_OPEN( comm_io, TRIM( io_file_name ), MPI_MODE_CREATE+MPI_MODE_WRONLY,      &
                               MPI_INFO_NULL, fh, ierr )
-          WRITE (9,*) 'Open MPI-IO restart file for write ==> ', TRIM( io_file_name )
-       ELSE
-          CALL rd_mpi_io_error( 1 )
-       ENDIF
+
+          IF ( ierr /= 0 )  THEN
+             message_string = 'error opening restart file "' // TRIM( io_file_name ) //      &
+                              '" for writing with MPI-IO'
+             CALL message( 'rrd_mpi_io_open', 'PA0728', 3, 2, 0, 6, 0 )
+          ENDIF
+
+          IF ( debug_output )  THEN
+             WRITE( debug_string, * )  'open joint restart file "' // TRIM( io_file_name ) //      &
+                                       '" for write with MPI-IO'
+             CALL debug_message( debug_string, 'end' )
+          ENDIF
+
+       ENDIF
+
     ENDIF
 #else
     IF ( rd_flag )  THEN
+
+       IF ( debug_output )  THEN
+          WRITE( debug_string, * )  'open restart file "' // TRIM( io_file_name ) //            &
+                                    '" for read in serial mode (posix)'
+          CALL debug_message( debug_string, 'start' )
+       ENDIF
+
        fh = posix_open( TRIM( io_file_name ), .TRUE. )
-       WRITE (9,*) 'Open sequential restart file for read  ==> ', TRIM( io_file_name ), ' ', fh
+
+       IF ( debug_output )  THEN
+          WRITE( debug_string, * )  'open restart file "' // TRIM( io_file_name ) //            &
+                                    '" for read in serial mode (posix)'
+          CALL debug_message( debug_string, 'end' )
+       ENDIF
+
     ELSEIF ( wr_flag )  THEN
+
+       IF ( debug_output )  THEN
+          WRITE( debug_string, * )  'open restart file "' // TRIM( io_file_name ) //            &
+                                    '" for write in serial mode (posix)'
+          CALL debug_message( debug_string, 'start' )
+       ENDIF
+
        fh = posix_open( TRIM( io_file_name ), .FALSE. )
-       WRITE (9,*) 'Open sequential restart file for write ==> ', TRIM( io_file_name ), ' ', fh
-    ELSE
-       CALL rd_mpi_io_error( 1 )
-    ENDIF
-
-    IF ( fh < 0 )  CALL rd_mpi_io_error( 6 )
+
+       IF ( debug_output )  THEN
+          WRITE( debug_string, * )  'open restart file "' // TRIM( io_file_name ) //            &
+                                    '" for write in serial mode (posix)'
+          CALL debug_message( debug_string, 'end' )
+       ENDIF
+
+    ENDIF
+
+    IF ( fh < 0 )  THEN
+       message_string = 'error opening restart file for posix I/O'
+       CALL message( 'restart_data_mpi_io_mod', 'PA0721', 1, 2, 0, 6, 0 )
+    ENDIF
 #endif
 
@@ -506,9 +583,5 @@
           header_position = header_position + SIZE( array_offset ) * rd_offset_kind
 #endif
-          IF ( debug_level >= 2 )  THEN
-             WRITE (9,*) 'header positio after array metadata  ', header_position
-          ENDIF
-
-          IF ( print_header_now )  CALL rd_mpi_io_print_header
+          IF ( debug_output )  CALL rd_mpi_io_print_header
 
        ENDIF
@@ -585,5 +658,5 @@
 !> Read INTEGER with MPI-IO
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE rrd_mpi_io_int( name, value, found )
+ SUBROUTINE rrd_mpi_io_int( name, value )
 
     IMPLICIT NONE
@@ -594,28 +667,21 @@
     INTEGER(KIND=iwp), INTENT(OUT) ::  value
 
-    LOGICAL                        ::  lo_found
-    LOGICAL, INTENT(OUT), OPTIONAL ::  found
-
-
-    lo_found = .FALSE.
+    LOGICAL                        ::  found
+
+
+    found = .FALSE.
     value = 0
 
     DO  i = 1, tgh%nr_int
        IF ( TRIM(int_names(i)) == TRIM( name ) )  THEN
-          IF ( debug_level >= 2 )  WRITE(9,*) 'INTEGER variable found ', name
           value = int_values(i)
-          lo_found = .TRUE.
+          found = .TRUE.
           EXIT
        ENDIF
     ENDDO
 
-    IF ( PRESENT( found ) )  THEN
-       found = lo_found
-       RETURN
-    ENDIF
-
-    IF ( .NOT. lo_found )  THEN
-       WRITE(9,*)  'INTEGER not found ', name
-       CALL rd_mpi_io_error( 3 )
+    IF ( .NOT. found )  THEN
+       message_string = 'INTEGER variable "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_int', 'PA0722', 3, 2, 0, 6, 0 )
     ENDIF
 
@@ -629,5 +695,5 @@
 !> Read REAL with MPI-IO
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE rrd_mpi_io_real( name, value, found )
+ SUBROUTINE rrd_mpi_io_real( name, value )
 
     IMPLICIT NONE
@@ -637,30 +703,23 @@
     INTEGER(iwp)                   ::  i
 
-    LOGICAL                        ::  lo_found
-    LOGICAL, INTENT(OUT), OPTIONAL ::  found
+    LOGICAL                        ::  found
 
     REAL(KIND=wp), INTENT(OUT)     ::  value
 
 
-    lo_found = .FALSE.
+    found = .FALSE.
     value = 0.0
 
     DO  i = 1, tgh%nr_real
        IF ( TRIM(real_names(i)) == TRIM( name ) )  THEN
-          IF ( debug_level >= 2 )  WRITE(9,*) 'REAL variable found ', name
           value = real_values(i)
-          lo_found = .TRUE.
+          found = .TRUE.
           EXIT
        ENDIF
     ENDDO
 
-    IF ( PRESENT( found ) )  THEN
-       found = lo_found
-       RETURN
-    ENDIF
-
-    IF ( .NOT. lo_found )  THEN
-       WRITE(9,*) 'REAL value not found ', name
-       CALL rd_mpi_io_error(3)
+    IF ( .NOT. found )  THEN
+       message_string = 'REAL variable "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_int', 'PA0722', 3, 2, 0, 6, 0 )
     ENDIF
 
@@ -729,6 +788,6 @@
 
     ELSE
-       WRITE(9,*) 'array_2D not found ', name
-       CALL rd_mpi_io_error( 2 )
+       message_string = '2d-REAL array "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_int', 'PA0722', 3, 2, 0, 6, 0 )
     ENDIF
 
@@ -778,5 +837,7 @@
 !--                  would be dimensioned in the caller subroutine like this:
 !--                  INTEGER, DIMENSION(nysg:nyng,nxlg:nxrg)::  data
-          CALL rd_mpi_io_error( 2 )
+          message_string = '2d-INTEGER array "' // TRIM( name ) // '" to be read from restart ' // &
+                           'file is defined with illegal dimensions in the PALM code'
+          CALL message( 'rrd_mpi_io_int_2d', 'PA0723', 3, 2, 0, 6, 0 )
 
        ELSEIF ( (nxr-nxl+1) == SIZE( data, 2 ) )  THEN
@@ -805,15 +866,16 @@
           ENDDO
 
-          IF ( debug_level >= 2 )  WRITE(9,*) 'r2i ', TRIM( name ),' ', SUM( array_2di )
-
        ELSE
-          WRITE (9,*) '### rrd_mpi_io_int_2d  array: ', TRIM( name )
-          CALL rd_mpi_io_error( 4 )
+
+          message_string = '2d-INTEGER array "' // TRIM( name ) // '" to be read from restart ' // &
+                           'file is defined with illegal dimensions in the PALM code'
+          CALL message( 'rrd_mpi_io_int_2d', 'PA0723', 3, 2, 0, 6, 0 )
+
        ENDIF
 
     ELSE
 
-       WRITE(9,*) 'array_2D not found ', name
-       CALL rd_mpi_io_error( 2 )
+       message_string = '2d-INTEGER array "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_int_2d', 'PA0722', 3, 2, 0, 6, 0 )
 
     ENDIF
@@ -872,10 +934,8 @@
              data(:,lb%nys-nbgp:lb%nyn-nbgp,i-nbgp) = array_3d(:,i,lb%nys:lb%nyn)
           ENDDO
-          IF ( debug_level >= 2 )  WRITE(9,*) 'r3f_ob ', TRIM( name ),' ', SUM( data(:,nys:nyn,nxl:nxr) )
        ELSE
           DO  i = nxl, nxr
              data(:,nys:nyn,i) = array_3d(:,i,nys:nyn)
           ENDDO
-          IF ( debug_level >= 2 )  WRITE(9,*) 'r3f ', TRIM( name ),' ', SUM( data(:,nys:nyn,nxl:nxr) )
        ENDIF
 
@@ -883,6 +943,8 @@
 
     ELSE
-       WRITE(9,*)  'array_3D not found ', name
-       CALL rd_mpi_io_error(2)
+
+       message_string = '3d-REAL array "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_real_3d', 'PA0722', 3, 2, 0, 6, 0 )
+
     ENDIF
 
@@ -946,15 +1008,15 @@
              data(:,lb%nys-nbgp:lb%nyn-nbgp,i-nbgp) = array_3d(:,i,lb%nys:lb%nyn)
           ENDDO
-          IF ( debug_level >= 2 )  WRITE(9,*) 'r3f_ob_soil ', TRIM( name ),' ', SUM( data(:,nys:nyn,nxl:nxr) )
        ELSE
           DO  i = nxl, nxr
              data(:,nys:nyn,i) = array_3d(:,i,nys:nyn)
           ENDDO
-          IF ( debug_level >= 2 )  WRITE(9,*) 'r3f_soil ', TRIM( name ),' ', SUM( array_3d )
        ENDIF
 
     ELSE
-       WRITE(9,*)  'array_3D not found ', name
-       CALL rd_mpi_io_error( 2 )
+
+       message_string = '3d-REAL soil array "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_real_3d_soil', 'PA0722', 3, 2, 0, 6, 0 )
+
     ENDIF
 
@@ -968,5 +1030,5 @@
 !> Read CHARACTER with MPI-IO
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE rrd_mpi_io_char( name, text, found )
+ SUBROUTINE rrd_mpi_io_char( name, text )
 
     IMPLICIT NONE
@@ -974,33 +1036,26 @@
     CHARACTER(LEN=*), INTENT(IN)   ::  name
     CHARACTER(LEN=*), INTENT(OUT)  ::  text
-    CHARACTER(LEN=128)             ::  lo_line
+    CHARACTER(LEN=128)             ::  line
 
     INTEGER(iwp)                   ::  i
 
-    LOGICAL, INTENT(OUT), OPTIONAL ::  found
-    LOGICAL                        ::  lo_found
-
-
-    lo_found = .FALSE.
+    LOGICAL                        ::  found
+
+
+    found = .FALSE.
     text = ' '
 
     DO  i = 1, tgh%nr_char
-       lo_line = text_lines(i)
-       IF ( lo_line(1:32) == name )  THEN
-          IF ( debug_level >= 2 )  WRITE(9,*)  'Character variable found ==> ', lo_line(1:32)
-          text = lo_line(33:)
-          lo_found = .TRUE.
+       line = text_lines(i)
+       IF ( TRIM( line(1:32) ) == TRIM( name ) )  THEN
+          text = line(33:)
+          found = .TRUE.
           EXIT
        ENDIF
     ENDDO
 
-    IF ( PRESENT( found ) )  THEN
-       found = lo_found
-       RETURN
-    ENDIF
-
-    IF ( .NOT. lo_found )  THEN
-       WRITE(9,*)  'Character variable not found ', name
-       CALL rd_mpi_io_error( 3 )
+    IF ( .NOT. found )  THEN
+       message_string = 'CHARACTER variable "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_char', 'PA0722', 3, 2, 0, 6, 0 )
     ENDIF
 
@@ -1101,5 +1156,5 @@
           array_2d(i,lb%nys:lb%nyn) = data(lb%nys-nbgp:lb%nyn-nbgp,i-nbgp)
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*)  'w2f_ob ', TRIM( name ), ' ',  SUM( data(nys:nyn,nxl:nxr) )
+
     ELSE
 !
@@ -1108,6 +1163,5 @@
           array_2d(i,lb%nys:lb%nyn) = data(nys:nyn,i)
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*)  'w2f ', TRIM( name ),' ',                              &
-                                            SUM( array_2d(nxl:nxr, lb%nys:lb%nyn) )
+
     ENDIF
 
@@ -1138,5 +1192,5 @@
 !> Write 2d-INTEGER array with MPI-IO
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE wrd_mpi_io_int_2d( name, data, ar_found )
+ SUBROUTINE wrd_mpi_io_int_2d( name, data )
 
     IMPLICIT NONE
@@ -1151,6 +1205,4 @@
 #endif
     INTEGER(KIND=iwp), INTENT(IN), DIMENSION(:,:) ::  data
-
-    LOGICAl, OPTIONAL                             ::  ar_found
 
 
@@ -1164,6 +1216,7 @@
 !--    dimensioned in the caller subroutine as
 !--    INTEGER, DIMENSION(nysg:nyng,nxlg:nxrg) ::  data
-       WRITE (9,*) '### wrd_mpi_io_int_2d  IF  array: ', TRIM( name )
-       CALL rd_mpi_io_error( 4 )
+       message_string = '2d-INTEGER array "' // TRIM( name ) // '" to be written to restart ' //   &
+                        'file is defined with illegal dimensions in the PALM code'
+       CALL message( 'wrd_mpi_io_int_2d', 'PA0723', 3, 2, 0, 6, 0 )
 
     ELSEIF ( ( nxr-nxl+1 ) == SIZE( data, 2 ) )  THEN
@@ -1177,5 +1230,4 @@
           ENDDO
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*) 'w2i ', TRIM( name ), ' ', SUM( array_2di(nxl:nxr,nys:nyn) ), SUM( data )
 #if defined( __parallel )
        CALL sm_io%sm_node_barrier()  ! has no effect if I/O on limited number of cores is inactive
@@ -1197,9 +1249,10 @@
 
     ELSE
-       WRITE (9,*) '### wrd_mpi_io_int_2d  array: ', TRIM( name )
-       CALL rd_mpi_io_error( 4 )
-    ENDIF
-
-    IF ( PRESENT( ar_found ) )  ar_found = .TRUE.
+
+       message_string = '2d-INTEGER array "' // TRIM( name ) // '" to be written to restart ' //   &
+                        'file is defined with illegal dimensions in the PALM code'
+       CALL message( 'wrd_mpi_io_int_2d', 'PA0723', 3, 2, 0, 6, 0 )
+
+    ENDIF
 
  END SUBROUTINE wrd_mpi_io_int_2d
@@ -1239,5 +1292,5 @@
           array_3d(:,i,lb%nys:lb%nyn) = data(:,lb%nys-nbgp:lb%nyn-nbgp,i-nbgp)
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*) 'w3f_ob ', TRIM( name ),' ', SUM( data(:,nys:nyn,nxl:nxr) )
+
     ELSE
 !
@@ -1246,5 +1299,5 @@
            array_3d(:,i,lb%nys:lb%nyn) = data(:,nys:nyn,i)
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*)  'w3f ', TRIM( name ),' ', SUM( data(:,nys:nyn,nxl:nxr) )
+
     ENDIF
 #if defined( __parallel )
@@ -1312,5 +1365,5 @@
           array_3d_soil(:,i,lb%nys:lb%nyn) = data(:,lb%nys-nbgp:lb%nyn-nbgp,i-nbgp)
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*) 'w3f_ob_soil ', TRIM( name ), ' ', SUM( data(:,nys:nyn,nxl:nxr) )
+
     ELSE
 !
@@ -1319,5 +1372,5 @@
           array_3d_soil(:,i,lb%nys:lb%nyn) = data(:,nys:nyn,i)
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*) 'w3f_soil ', TRIM( name ), ' ', SUM( array_3d )
+
     ENDIF
 #if defined( __parallel )
@@ -1446,8 +1499,11 @@
        CALL posix_read( fh, data, SIZE( data ) )
 #endif
-       IF ( debug_level >= 2) WRITE(9,*) 'rr1f ',name,' ', SUM( data)
+
     ELSE
-       WRITE(9,*)  'replicated array_1D not found ', name
-       CALL rd_mpi_io_error( 2 )
+
+       message_string = '1d/2d/3d/4d-REAL global array "' // TRIM( name ) // '" not found in ' //  &
+                        'restart file'
+       CALL message( 'rrd_mpi_io_global_array_real_1d', 'PA0722', 3, 2, 0, 6, 0 )
+
     ENDIF
 
@@ -1481,5 +1537,4 @@
 
     CALL rrd_mpi_io_global_array_real_1d( name, buf )
-    IF ( debug_level >= 2 )  WRITE(9,*) 'rr2f ', TRIM( name ), ' ', bufshape(1), SUM( data )
 
  END SUBROUTINE rrd_mpi_io_global_array_real_2d
@@ -1513,6 +1568,4 @@
     CALL rrd_mpi_io_global_array_real_1d( name, buf )
 
-    IF ( debug_level >= 2 )  WRITE(9,*) 'rr3f ', TRIM( name ), ' ', bufshape(1), SUM( data )
-
  END SUBROUTINE rrd_mpi_io_global_array_real_3d
 
@@ -1544,5 +1597,4 @@
 
     CALL rrd_mpi_io_global_array_real_1d( name, buf )
-    IF ( debug_level >= 2 )  WRITE(9,*) 'rr4f ', TRIM( name ), ' ', bufshape(1), SUM( data )
 
  END SUBROUTINE rrd_mpi_io_global_array_real_4d
@@ -1556,5 +1608,5 @@
 !> Array contains identical data on all PEs.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE rrd_mpi_io_global_array_int_1d( name, data, ar_found )
+ SUBROUTINE rrd_mpi_io_global_array_int_1d( name, data )
 
     IMPLICIT NONE
@@ -1570,5 +1622,4 @@
     INTEGER(KIND=iwp), INTENT(INOUT), DIMENSION(:) ::  data
 
-    LOGICAl, OPTIONAL                              ::  ar_found
     LOGICAL                                        ::  found
 
@@ -1602,16 +1653,10 @@
 #endif
     ELSE
-       IF ( PRESENT( ar_found ) )  THEN
-          ar_found =.FALSE.
-          RETURN
-       ELSE
-          WRITE (9,*) '### rrd_mpi_io_global_array_int_1d ', TRIM( name )
-          CALL rd_mpi_io_error( 4 )
-          WRITE(9,*)  'replicated array_1D not found ', name
-          CALL rd_mpi_io_error( 2 )
-       ENDIF
-    ENDIF
-
-    IF ( PRESENT( ar_found ) )  ar_found =.TRUE.
+
+       message_string = '1d-INTEGER global array "' // TRIM( name ) // '" not found in ' //        &
+                        'restart file'
+       CALL message( 'rrd_mpi_io_global_array_int_1d', 'PA0722', 3, 2, 0, 6, 0 )
+
+    ENDIF
 
  END SUBROUTINE rrd_mpi_io_global_array_int_1d
@@ -1646,22 +1691,21 @@
     header_arr_index = header_arr_index + 1
 
-    IF ( debug_level >= 2 )  WRITE(9,*)  'wr1f ', TRIM( name ), ' ', SUM( data )
-!
-!--    Set default view
-#if defined( __parallel )
-       IF ( sm_io%iam_io_pe )  THEN
-          CALL MPI_FILE_SET_VIEW( fh, offset, MPI_BYTE, MPI_BYTE, 'native', MPI_INFO_NULL, ierr )
-       ENDIF
-!
-!--    Only PE 0 writes replicated data
-       IF ( myid == 0 )  THEN
-          CALL MPI_FILE_SEEK( fh, array_position, MPI_SEEK_SET, ierr )
-          CALL MPI_FILE_WRITE( fh, data, SIZE( data), MPI_REAL, status, ierr )
-       ENDIF
+!
+!-- Set default view
+#if defined( __parallel )
+    IF ( sm_io%iam_io_pe )  THEN
+       CALL MPI_FILE_SET_VIEW( fh, offset, MPI_BYTE, MPI_BYTE, 'native', MPI_INFO_NULL, ierr )
+    ENDIF
+!
+!-- Only PE 0 writes replicated data
+    IF ( myid == 0 )  THEN
+       CALL MPI_FILE_SEEK( fh, array_position, MPI_SEEK_SET, ierr )
+       CALL MPI_FILE_WRITE( fh, data, SIZE( data), MPI_REAL, status, ierr )
+    ENDIF
 #else
-       CALL posix_lseek( fh, array_position )
-       CALL posix_write( fh, data, SIZE( data ) )
-#endif
-       array_position = array_position + SIZE( data ) * wp
+    CALL posix_lseek( fh, array_position )
+    CALL posix_write( fh, data, SIZE( data ) )
+#endif
+    array_position = array_position + SIZE( data ) * wp
 
  END SUBROUTINE wrd_mpi_io_global_array_real_1d
@@ -1693,6 +1737,4 @@
     CALL C_F_POINTER( c_data, buf, bufshape )
 
-    IF ( debug_level >= 2 )  WRITE(9,*)  'wr2f ', TRIM( name ), ' ', bufshape(1), SUM( data )
-
     CALL wrd_mpi_io_global_array_real_1d( name, buf )
 
@@ -1725,6 +1767,4 @@
     CALL C_F_POINTER( c_data, buf, bufshape )
 
-    IF ( debug_level >= 2 )  WRITE(9,*)  'wr3f ', TRIM( name ), ' ', bufshape(1), SUM( data )
-
     CALL wrd_mpi_io_global_array_real_1d( name, buf )
 
@@ -1756,6 +1796,4 @@
     bufshape(1) = SIZE( data)
     CALL C_F_POINTER( c_data, buf, bufshape )
-
-    IF ( debug_level >= 2 )  WRITE(9,*) 'wr4f ', TRIM( name ), ' ', bufshape(1), SUM( data )
 
     CALL wrd_mpi_io_global_array_real_1d( name, buf )
@@ -1789,5 +1827,4 @@
     header_arr_index = header_arr_index + 1
 
-    IF ( debug_level >= 2 )  WRITE(9,*)  'wr1i ', TRIM( name ), ' ', SUM( data )
 !
 !-- Set default view
@@ -1906,6 +1943,4 @@
              ELSE                                          ! read
 #if defined( __parallel )
-                IF ( debug_level >= 2 )  WRITE(9,'(a,4i4,4i10)') 'read block ', j, i, j_f, i_f,    &
-                                                         m_start_index(j_f,i_f), nr_bytes_f, disp_f
                 CALL MPI_FILE_SEEK( fhs, disp_f, MPI_SEEK_SET, ierr )
                 nr_words = nr_bytes_f / wp
@@ -1925,14 +1960,16 @@
 
     ELSE
-       WRITE(9,*) 'surface array not found ', name
-       CALL rd_mpi_io_error( 2 )
-    ENDIF
-
-      IF ( lo_first_index == 1 )  THEN
-         IF ( debug_level >= 2 .AND. nr_val > 0 )  WRITE(9,*)  'r_surf_1 ', TRIM( name ), ' ', nr_val, SUM( data(1:nr_val) )
-      ELSE
-         IF ( debug_level >= 2 .AND. nr_val > 0 )  WRITE(9,*)  'r_surf_next ', TRIM( name ), ' ', &
-                                                               lo_first_index,nr_val, SUM( data(1:nr_val) )
-      ENDIF
+
+       message_string = 'surface array "' // TRIM( name ) // '" not found in restart file'
+       CALL message( 'rrd_mpi_io_global_array_int_1d', 'PA0722', 3, 2, 0, 6, 0 )
+
+    ENDIF
+
+!    IF ( lo_first_index == 1 )  THEN
+!       IF ( debug_level >= 2 .AND. nr_val > 0 )  WRITE(9,*)  'r_surf_1 ', TRIM( name ), ' ', nr_val, SUM( data(1:nr_val) )
+!    ELSE
+!       IF ( debug_level >= 2 .AND. nr_val > 0 )  WRITE(9,*)  'r_surf_next ', TRIM( name ), ' ', &
+!                                                             lo_first_index,nr_val, SUM( data(1:nr_val) )
+!    ENDIF
 
  END SUBROUTINE rrd_mpi_io_surface
@@ -2026,5 +2063,4 @@
           array_1d(i+local_start) = data(i)
        ENDDO
-       IF ( debug_level >= 2 )  WRITE(9,*) 'w_surf ', TRIM( name ), ' ', SUM( array_1d(local_start+1:local_start+nr_val)),sum(data)
     ELSE
 !       array_1d => data                           !kk Did not work in all cases    why???
@@ -2056,10 +2092,10 @@
     array_position = array_position + total_number_of_surface_values * wp
 
-    IF ( lo_first_index == 1 )  THEN
-       IF ( debug_level >= 2 .AND. nr_val  > 0 )  WRITE(9,*) 'w_surf_1 ', TRIM( name ), ' ', nr_val, SUM( data(1:nr_val) )
-    ELSE
-       IF ( debug_level >= 2 .AND. nr_val  > 0 ) WRITE(9,*) 'w_surf_n ', TRIM( name ), ' ', &
-                                                            lo_first_index, nr_val, SUM( data(1:nr_val) )
-    ENDIF
+!    IF ( lo_first_index == 1 )  THEN
+!       IF ( debug_level >= 2 .AND. nr_val  > 0 )  WRITE(9,*) 'w_surf_1 ', TRIM( name ), ' ', nr_val, SUM( data(1:nr_val) )
+!    ELSE
+!       IF ( debug_level >= 2 .AND. nr_val  > 0 ) WRITE(9,*) 'w_surf_n ', TRIM( name ), ' ', &
+!                                                            lo_first_index, nr_val, SUM( data(1:nr_val) )
+!    ENDIF
 
  END SUBROUTINE wrd_mpi_io_surface
@@ -2122,5 +2158,5 @@
        tgh%total_nx  = lb%nx + 1
        tgh%total_ny  = lb%ny + 1
-       IF ( include_total_domain_boundaries )  THEN   ! not sure, if LOGICAL interpretation is the same on all compilers,
+       IF ( include_total_domain_boundaries )  THEN   ! not sure, if LOGICAL interpretation is the same for all compilers,
           tgh%i_outer_bound = 1        ! therefore store as INTEGER in general header
        ELSE
@@ -2175,5 +2211,6 @@
 
           CALL MPI_FILE_SEEK( fh, header_position, MPI_SEEK_SET, ierr )
-          CALL MPI_FILE_WRITE( fh, array_offset, SIZE( array_offset )*MPI_OFFSET_KIND, MPI_BYTE, status, ierr )   !There is no I*8 datatype in FORTRAN
+          CALL MPI_FILE_WRITE( fh, array_offset, SIZE( array_offset )*MPI_OFFSET_KIND, MPI_BYTE,   &
+                               status, ierr )  ! There is no I*8 datatype in Fortran
           header_position = header_position + SIZE( array_offset ) * rd_offset_kind
 #else
@@ -2215,9 +2252,5 @@
           header_position = header_position + SIZE( array_offset ) * rd_offset_kind
 #endif
-          IF ( debug_level >= 2 )  THEN
-             WRITE(9,*)  'header position after arrays  ', header_position, gh_size
-          ENDIF
-
-          IF ( print_header_now )  CALL rd_mpi_io_print_header
+          IF ( debug_output )  CALL rd_mpi_io_print_header
        ENDIF
 
@@ -2248,5 +2281,5 @@
     ENDIF
 
-    mb_processed = array_position / ( 1024.0_dp * 1024.0_dp )
+    restart_file_size = array_position / ( 1024.0_dp * 1024.0_dp )
 
  END SUBROUTINE rd_mpi_io_close
@@ -2687,85 +2720,39 @@
 
 
-    IF ( debug_level >= 1 )  THEN
- 
-       WRITE (9,*)  ' '
-       WRITE (9,*)  ' CHARACTER header values ', tgh%nr_char
-       WRITE (9,*)  ' '
-       DO  i = 1, tgh%nr_char
-          WRITE(9,*)  text_lines(i)(1:80)
-       ENDDO
-
-       WRITE (9,*)  ' '
-       WRITE (9,*) ' INTEGER header values ', tgh%nr_int
-       WRITE (9,*)  ' '
-       DO  i = 1, tgh%nr_int
-          WRITE(9,*)  'INTERGER value:   ', int_names(i), ' ', int_values(i)
-       ENDDO
-
-       WRITE (9,*)  ' '
-       WRITE (9,*)  ' REAL header values ', tgh%nr_real
-       WRITE (9,*)  ' '
-       DO  i = 1, tgh%nr_real
-          WRITE(9,*) 'REAL     value:   ', real_names(i), ' ', real_values(i)
-       ENDDO
-
-       WRITE (9,*)  ' '
-       WRITE (9,*)  ' Header entries with Offset ',tgh%nr_arrays
-       WRITE (9,*)  '                Name                                  Offset '
-       DO  i = 1, tgh%nr_arrays
-          WRITE(9,'(a,1x,a30,1x,i16)') 'Header entiy:   ', array_names(i), array_offset(i)
-       ENDDO
-       WRITE (9,*)  ' '
-    ENDIF
-
-    print_header_now = .FALSE.
+    WRITE (9,*)  'header position after reading the restart file header: ', header_position
+    WRITE (9,*)  ' '
+    WRITE (9,*)  'restart file header content:'
+    WRITE (9,*)  '----------------------------'
+    WRITE (9,*)  ' '
+
+    WRITE (9,*)  ' CHARACTER header values   Total number: ', tgh%nr_char
+    WRITE (9,*)  ' '
+    DO  i = 1, tgh%nr_char
+       WRITE( 9, '(I3,A,1X,A)' )  i, ': ', text_lines(i)(1:80)
+    ENDDO
+    WRITE (9,*)  ' '
+
+    WRITE (9,*) ' INTEGER header variables and values   Total number: ', tgh%nr_int
+    WRITE (9,*)  ' '
+    DO  i = 1, tgh%nr_int
+       WRITE(9,*)  ' variable: ', int_names(i), '  value: ', int_values(i)
+    ENDDO
+    WRITE (9,*)  ' '
+
+    WRITE (9,*)  ' REAL header variables and values   Total number: ', tgh%nr_real
+    WRITE (9,*)  ' '
+    DO  i = 1, tgh%nr_real
+       WRITE(9,*)  ' variable: ', real_names(i), '  value: ', real_values(i)
+    ENDDO
+    WRITE (9,*)  ' '
+
+    WRITE (9,*)  ' Header entries with offset (2d/3d arrays)   Total number: ', tgh%nr_arrays
+    WRITE (9,*)  ' '
+    DO  i = 1, tgh%nr_arrays
+       WRITE(9,*)  ' variable: ', array_names(i), '  offset: ', array_offset(i)
+    ENDDO
+    WRITE (9,*)  ' '
 
  END SUBROUTINE rd_mpi_io_print_header
-
-
-
-!--------------------------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Print error messages for reading/writing restart data with MPI-IO
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE rd_mpi_io_error( error_number )
-
-    IMPLICIT NONE
-
-    INTEGER, INTENT(IN) ::  error_number
-
-    IF ( myid == 0)  THEN
-
-       SELECT CASE (error_number)
- 
-          CASE ( 1 )
-             WRITE(6,*)  'illegal action while opening restart File'
-          CASE ( 2 )
-             WRITE(6,*)  'data array not found in restart File'
-          CASE ( 3 )
-             WRITE(6,*)  'INTEGER or REAL value not found in restart File'
-          CASE ( 4 )
-             WRITE(6,*)  'Arrays only array with nbgp Halos or without halos legal'
-          CASE ( 5 )
-             WRITE(6,*)  'outer boundary in model and outer boundary in restart file do not match'
-          CASE ( 6 )
-             WRITE(6,*)  'posix IO: ERROR Opening Restart File'
-          CASE DEFAULT
-             WRITE(6,*)  'rd_mpi_io_error: illegal error number: ',error_number
-
-       END SELECT
-
-    ENDIF
-#if defined( __parallel )
-    IF ( .NOT. sm_io%iam_io_pe )  RETURN
-
-    CALL MPI_BARRIER( comm_io, ierr )
-    CALL MPI_ABORT( comm_io, 1, ierr )
-#else
-    CALL ABORT
-#endif
-
- END SUBROUTINE rd_mpi_io_error
 
 
Index: palm/trunk/SOURCE/shared_memory_io_mod.f90
===================================================================
--- palm/trunk/SOURCE/shared_memory_io_mod.f90	(revision 4535)
+++ palm/trunk/SOURCE/shared_memory_io_mod.f90	(revision 4536)
@@ -257,10 +257,10 @@
     TYPE(local_boundaries), DIMENSION(32) ::  node_grid
 
-#if defined( __intel_compiler )
-    IF ( numprocs < this%n_npes )  THEN  !  NO shared memory IO on one node jobs
-       this%no_shared_Memory_in_this_run = .TRUE.
+!
+!-- Nn shared memory I/O on one node jobs
+    IF ( numprocs < this%n_npes )  THEN
+       this%no_shared_memory_in_this_run = .TRUE.
        RETURN
     ENDIF
-#endif
 
     local_dim_s = 0
@@ -320,4 +320,8 @@
        color = 1
     ENDIF
+
+    this%io_grid = node_grid(color)
+    this%io_grid%nnx = this%io_grid%nxr - this%io_grid%nxl + 1
+    this%io_grid%nny = this%io_grid%nyn - this%io_grid%nys + 1
 
  END SUBROUTINE compute_color
Index: palm/trunk/SOURCE/virtual_measurement_mod.f90
===================================================================
--- palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4535)
+++ palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4536)
@@ -21,8 +21,11 @@
 ! -----------------
 ! 
-!
+! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! bugfix: preprocessor directive adjusted
+!
+! 4504 2020-04-20 12:11:24Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -859,5 +862,5 @@
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE     ::  ns_all  !< dummy array used to sum-up the number of observation coordinates
 
-#if defined( __parallel )
+#if defined( __netcdf4_parallel )
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  ns_atmos  !< number of observation points for each station on each mpi rank
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  ns_soil   !< number of observation points for each station on each mpi rank
Index: palm/trunk/SOURCE/write_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/write_restart_data_mod.f90	(revision 4535)
+++ palm/trunk/SOURCE/write_restart_data_mod.f90	(revision 4536)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! binary version incremented
+! 
+! 4535 2020-05-15 12:07:23Z raasch
 ! bugfix for restart data format query
 ! 
@@ -181,5 +184,5 @@
     INTEGER ::  i                                !< loop index
 
-    binary_version_global = '4.9'
+    binary_version_global = '5.0'
 
     IF ( restart_data_format_output == 'fortran_binary' )  THEN
@@ -1162,5 +1165,5 @@
 !
 !-- Write arrays.
-    binary_version_local = '4.7'
+    binary_version_local = '5.0'
 
     IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
