Index: /palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 212)
+++ /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 213)
@@ -11,5 +11,4 @@
 User can add additional routines in files user_additional_routines.f90
 
-
 check_for_restart, check_parameters, data_output_dvrp, init_dvrp, init_pegrid, local_stop, modules, package_parin, palm, surface_coupler, timestep, user_additional_routines
 Makefile, mrun, mbuild, subjob
@@ -22,7 +21,11 @@
 User interface has been split into single files.
 
-Makefile
+Output messages (including required stop of execution) can now be handled with
+the new subroutine handle_palm_message. All output messages will be replaced
+by this routine step by step within the next revisions.
 
-New: user_3d_data_averaging user_actions user_advec_particles user_check_data_output user_check_data_output_pr user_data_output_2d user_data_output_3d user_data_output_dvrp user_define_netcdf_grid user_dvrp_coltab user_header user_init user_init_3d_model user_init_grid user_init_particles user_init_plant_canopy user_last_actions user_module user_parin user_particle_attributes user_read_restart_data user_spectra user_statistics
+Makefile, check_parameters, local_stop, modules
+
+New: handle_palm_message, user_3d_data_averaging user_actions user_advec_particles user_check_data_output user_check_data_output_pr user_data_output_2d user_data_output_3d user_data_output_dvrp user_define_netcdf_grid user_dvrp_coltab user_header user_init user_init_3d_model user_init_grid user_init_particles user_init_plant_canopy user_last_actions user_module user_parin user_particle_attributes user_read_restart_data user_spectra user_statistics
 
 Removed: user_interface
Index: /palm/trunk/SOURCE/Makefile
===================================================================
--- /palm/trunk/SOURCE/Makefile	(revision 212)
+++ /palm/trunk/SOURCE/Makefile	(revision 213)
@@ -5,5 +5,5 @@
 # -----------------
 # former file user_interface split into one file per subroutine
-# +init_coupling
+# +init_coupling, handle_palm_message
 #
 # Former revisions:
@@ -57,5 +57,6 @@
 	diffusion_v.f90 diffusion_w.f90 diffusivities.f90 disturb_field.f90 \
 	disturb_heatflux.f90 eqn_state_seawater.f90 exchange_horiz.f90 exchange_horiz_2d.f90 \
-	fft_xy.f90 flow_statistics.f90 global_min_max.f90 header.f90 \
+	fft_xy.f90 flow_statistics.f90 global_min_max.f90 \
+	handle_palm_message.f90 header.f90 \
 	impact_of_latent_heat.f90 inflow_turbulence.f90 init_1d_model.f90 \
 	init_3d_model.f90 init_advec.f90 init_cloud_physics.f90 init_coupling.f90 \
@@ -99,5 +100,6 @@
 	diffusion_v.o diffusion_w.o diffusivities.o disturb_field.o \
 	disturb_heatflux.o eqn_state_seawater.o exchange_horiz.o exchange_horiz_2d.o fft_xy.o \
-	flow_statistics.o global_min_max.o header.o impact_of_latent_heat.o \
+	flow_statistics.o global_min_max.o handle_palm_message.o header.o \
+	impact_of_latent_heat.o \
 	inflow_turbulence.o init_1d_model.o init_3d_model.o init_advec.o init_cloud_physics.o \
 	init_coupling.o init_dvrp.o init_grid.o init_ocean.o init_particles.o init_pegrid.o \
@@ -202,4 +204,5 @@
 flow_statistics.o: modules.o
 global_min_max.o: modules.o
+handle_palm_message.o: modules.o
 header.o: modules.o
 impact_of_latent_heat.o: modules.o
Index: /palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/check_parameters.f90	(revision 212)
+++ /palm/trunk/SOURCE/check_parameters.f90	(revision 213)
@@ -4,4 +4,5 @@
 ! Actual revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! Implementation of an MPI-1 coupling: replaced myid with target_id, 
 ! deleted __mpi2 directives
@@ -109,10 +110,7 @@
 !-- Warning, if host is not set
     IF ( host(1:1) == ' ' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ WARNING: check_parameters:'
-          PRINT*, '    "host" is not set. Please check that environment', &
-                       ' variable "localhost"'
-          PRINT*, '    is set before running PALM'
-       ENDIF
+       message_string = '"host" is not set. Please check that environment ' // &
+                        'variable "localhost" & is set before running PALM'
+       CALL handle_palm_message( 'check_parameters', 'PA0001', 0, 0, 0, 6, 0 )
     ENDIF
 
@@ -122,9 +120,6 @@
          coupling_mode /= 'atmosphere_to_ocean'  .AND.  &
          coupling_mode /= 'ocean_to_atmosphere' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:'
-          PRINT*, '    illegal coupling mode: ', TRIM( coupling_mode )
-       ENDIF
-       CALL local_stop
+       message_string = 'illegal coupling mode: ' // TRIM( coupling_mode )
+       CALL handle_palm_message( 'check_parameters', 'PA0002', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -132,12 +127,12 @@
 !-- Check dt_coupling, restart_time, dt_restart, end_time, dx, dy, nx and ny
     IF ( coupling_mode /= 'uncoupled' )  THEN
+
        IF ( dt_coupling == 9999999.9 )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    dt_coupling is not set but required for coupling ', &
-                  'mode: ', TRIM( coupling_mode )
-          ENDIF
-          CALL local_stop
-       ENDIF
+          message_string = 'dt_coupling is not set but required for coup' // &
+                           'ling mode "' //  TRIM( coupling_mode ) // '"'
+          CALL handle_palm_message( 'check_parameters', 'PA0003', 1, 2, 0, 6, &
+                                    0 )
+       ENDIF
+
 #if defined( __parallel )
        CALL MPI_SEND( dt_coupling, 1, MPI_REAL, target_id, 11, comm_inter, &
@@ -146,10 +141,9 @@
                       status, ierr )
        IF ( dt_coupling /= remote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): dt_coupling = ', dt_coupling
-             PRINT*, '    is not equal to dt_coupling_remote = ', remote
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '": dt_coupling = ', dt_coupling, '& is not equal to ',       &
+                 'dt_coupling_remote = ', remote
+          CALL handle_palm_message( 'check_parameters', 'PA0004', 1, 2, 0, 6, &
+                                    0 )
        ENDIF
        IF ( dt_coupling <= 0.0 )  THEN
@@ -158,11 +152,11 @@
                          status, ierr )
           dt_coupling = MAX( dt_max, remote )
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): dt_coupling <= 0.0'
-             PRINT*, '    is not allowed and is reset to MAX(dt_max(A,O)) = ', &
-                  dt_coupling
-          ENDIF
-       ENDIF
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '": dt_coupling <= 0.0 & is not allowed and is reset to ',    &
+                 'MAX(dt_max(A,O)) = ', dt_coupling
+          CALL handle_palm_message( 'check_parameters', 'PA0005', 0, 1, 0, 6, &
+                                    0 )
+       ENDIF
+
        CALL MPI_SEND( restart_time, 1, MPI_REAL, target_id, 12, comm_inter, &
                       ierr )
@@ -170,11 +164,11 @@
                       status, ierr )
        IF ( restart_time /= remote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): restart_time = ', restart_time
-             PRINT*, '    is not equal to restart_time_remote = ', remote
-          ENDIF
-          CALL local_stop
-       ENDIF
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '": restart_time = ', restart_time, '& is not equal to ',     &
+                 'restart_time_remote = ', remote
+          CALL handle_palm_message( 'check_parameters', 'PA0006', 1, 2, 0, 6, &
+                                    0 )
+       ENDIF
+
        CALL MPI_SEND( dt_restart, 1, MPI_REAL, target_id, 13, comm_inter, &
                       ierr )
@@ -182,65 +176,60 @@
                       status, ierr )
        IF ( dt_restart /= remote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): dt_restart = ', dt_restart
-             PRINT*, '    is not equal to dt_restart_remote = ', remote
-          ENDIF
-          CALL local_stop
-       ENDIF
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '": dt_restart = ', dt_restart, '& is not equal to ',         &
+                 'dt_restart_remote = ', remote
+          CALL handle_palm_message( 'check_parameters', 'PA0007', 1, 2, 0, 6, &
+                                    0 )
+       ENDIF
+
        CALL MPI_SEND( end_time, 1, MPI_REAL, target_id, 14, comm_inter, ierr )
        CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter, &
                       status, ierr )
        IF ( end_time /= remote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): end_time = ', end_time
-             PRINT*, '    is not equal to end_time_remote = ', remote
-          ENDIF
-          CALL local_stop
-       ENDIF
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '": end_time = ', end_time, '& is not equal to ',             &
+                 'end_time_remote = ', remote
+          CALL handle_palm_message( 'check_parameters', 'PA0008', 1, 2, 0, 6, &
+                                    0 )
+       ENDIF
+
        CALL MPI_SEND( dx, 1, MPI_REAL, target_id, 15, comm_inter, ierr )
        CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 15, comm_inter, &
                       status, ierr )
        IF ( dx /= remote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): dx = ', dx
-             PRINT*, '    is not equal to dx_remote = ', remote
-          ENDIF
-          CALL local_stop
-       ENDIF
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '":  dx = ', dx, '& is not equal to dx_remote = ', remote
+          CALL handle_palm_message( 'check_parameters', 'PA0009', 1, 2, 0, 6, &
+                                    0 )
+       ENDIF
+
        CALL MPI_SEND( dy, 1, MPI_REAL, target_id, 16, comm_inter, ierr )
        CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 16, comm_inter, &
                       status, ierr )
        IF ( dy /= remote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): dy = ', dy
-             PRINT*, '    is not equal to dy_remote = ', remote
-          ENDIF
-          CALL local_stop
-       ENDIF
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '":  dy = ', dy, '& is not equal to dy_remote = ', remote
+          CALL handle_palm_message( 'check_parameters', 'PA0010', 1, 2, 0, 6, &
+                                    0 )
+       ENDIF
+
        CALL MPI_SEND( nx, 1, MPI_INTEGER, target_id, 17, comm_inter, ierr )
        CALL MPI_RECV( iremote, 1, MPI_INTEGER, target_id, 17, comm_inter, &
                       status, ierr )
        IF ( nx /= iremote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): nx = ', nx
-             PRINT*, '    is not equal to nx_remote = ', iremote
-          ENDIF
-          CALL local_stop
-       ENDIF
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '": nx = ', nx, '& is not equal to nx_remote = ', iremote
+          CALL handle_palm_message( 'check_parameters', 'PA0011', 1, 2, 0, 6, &
+                                    0 )
+       ENDIF
+
        CALL MPI_SEND( ny, 1, MPI_INTEGER, target_id, 18, comm_inter, ierr )
        CALL MPI_RECV( iremote, 1, MPI_INTEGER, target_id, 18, comm_inter, &
                       status, ierr )
        IF ( ny /= iremote )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    TRIM( coupling_mode ): ny = ', ny
-             PRINT*, '    is not equal to ny_remote = ', iremote
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
+                 '": ny = ', ny, '& is not equal to ny_remote = ', iremote
+          CALL handle_palm_message( 'check_parameters', 'PA0012', 1, 2, 0, 6, &
+                                    0 )
        ENDIF
 #endif
@@ -291,10 +280,7 @@
     IF ( loop_optimization /= 'noopt'  .AND.  loop_optimization /= 'cache' &
          .AND.  loop_optimization /= 'vector' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:'
-          PRINT*, '    illegal value given for loop_optimization: ', &
-                  TRIM( loop_optimization )
-       ENDIF
-       CALL local_stop
+       message_string = 'illegal value given for loop_optimization: "' // &
+                        TRIM( loop_optimization ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0013', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -334,9 +320,8 @@
        ENDIF
        IF ( action /= ' ' )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    a non-flat topography does not allow ', TRIM( action )
-          ENDIF
-          CALL local_stop
+          message_string = 'a non-flat topography does not allow ' // &
+                           TRIM( action )
+          CALL handle_palm_message( 'check_parameters', 'PA0014', 1, 2, 0, 6, &
+                                    0 )
        ENDIF
     ENDIF
@@ -353,9 +338,7 @@
        ENDIF
        IF ( action /= ' ' )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    ocean = .T. does not allow ', TRIM( action )
-          ENDIF
-          CALL local_stop
+          message_string = 'ocean = .T. does not allow ' // TRIM( action )
+          CALL handle_palm_message( 'check_parameters', 'PA0015', 1, 2, 0, 6, &
+                                    0 )
        ENDIF
     ENDIF
@@ -366,21 +349,15 @@
     IF ( psolver /= 'poisfft'  .AND.  psolver /= 'poisfft_hybrid'  .AND. &
          psolver /= 'sor'  .AND.  psolver /= 'multigrid' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:'
-          PRINT*, '    unknown solver for perturbation pressure: psolver=', &
-                  psolver
-       ENDIF
-       CALL local_stop
+       message_string = 'unknown solver for perturbation pressure: psolver' // &
+                        ' = "' // TRIM( psolver ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0016', 1, 2, 0, 6, 0 )
     ENDIF
 
 #if defined( __parallel )
     IF ( psolver == 'poisfft_hybrid'  .AND.  pdims(2) /= 1 )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:'
-          PRINT*, '    psolver="', TRIM( psolver ), '" only works for a ', &
-                       '1d domain-decomposition along x'
-          PRINT*, '    please do not set npey/=1 in the parameter file'
-       ENDIF
-       CALL local_stop
+       message_string = 'psolver = "' // TRIM( psolver ) // '" only works ' // &
+                        'for a 1d domain-decomposition along x & please do' // &
+                        ' not set npey/=1 in the parameter file'
+       CALL handle_palm_message( 'check_parameters', 'PA0017', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( psolver == 'poisfft_hybrid'  .AND.                     &
@@ -388,21 +365,14 @@
           psolver == 'multigrid'      .AND.                     &
          ( nxra > nxr  .OR.  nyna > nyn ) )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:'
-          PRINT*, '    psolver="', TRIM( psolver ), '" does not work for ', &
-                       'subdomains with unequal size'
-          PRINT*, '    please set grid_matching = ''strict'' in the parameter',&
-                       ' file'
-       ENDIF
-       CALL local_stop
+       message_string = 'psolver = "' // TRIM( psolver ) // '" does not ' // &
+                        'work for subdomains with unequal size & please ' // &
+                        'set grid_matching = ''strict'' in the parameter file'
+       CALL handle_palm_message( 'check_parameters', 'PA0018', 1, 2, 0, 6, 0 )
     ENDIF
 #else
     IF ( psolver == 'poisfft_hybrid' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:'
-          PRINT*, '    psolver="', TRIM( psolver ), '" only works for a ', &
-                       'parallel environment'
-       ENDIF
-       CALL local_stop
+       message_string = 'psolver = "' // TRIM( psolver ) // '" only works' // &
+                        ' for a parallel environment'
+       CALL handle_palm_message( 'check_parameters', 'PA0019', 1, 2, 0, 6, 0 )
     ENDIF
 #endif
@@ -414,9 +384,8 @@
           gamma_mg = 1
        ELSE
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ check_parameters:'
-             PRINT*, '    unknown multigrid cycle: cycle_mg=', cycle_mg
-          ENDIF
-          CALL local_stop
+          message_string = 'unknown multigrid cycle: cycle_mg = "' // &
+                           TRIM( cycle_mg ) // '"'
+          CALL handle_palm_message( 'check_parameters', 'PA0020', 1, 2, 0, 6, &
+                                    0 )
        ENDIF
     ENDIF
@@ -425,9 +394,7 @@
          fft_method /= 'temperton-algorithm'  .AND.  &
          fft_method /= 'system-specific' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:'
-          PRINT*, '    unknown fft-algorithm: fft_method=', fft_method
-       ENDIF
-       CALL local_stop
+       message_string = 'unknown fft-algorithm: fft_method = "' // &
+                        TRIM( fft_method ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0021', 1, 2, 0, 6, 0 )
     ENDIF
 
Index: /palm/trunk/SOURCE/handle_palm_message.f90
===================================================================
--- /palm/trunk/SOURCE/handle_palm_message.f90	(revision 213)
+++ /palm/trunk/SOURCE/handle_palm_message.f90	(revision 213)
@@ -0,0 +1,150 @@
+ SUBROUTINE handle_palm_message( routine_name, message_identifier,             &
+                                 requested_action, message_level, output_on_pe,&
+                                 file_id, flush )
+
+!------------------------------------------------------------------------------!
+! Actual revisions:
+! -----------------
+! Initial revision
+!
+! Former revisions:
+! -----------------
+! $Id$
+!
+! Description:
+! ------------
+! Handling of the different kinds of messages.
+! Meaning of formal parameters:
+! requested_action: 0 - continue, 1 - abort by stop, 2 - abort by mpi_abort
+! message_level: 0 - informative, 1 - warning, 2 - error
+! output_on_pe: -1 - all, else - output on specified PE
+! file_id: 6 - stdout (*)
+! flush: 0 - no action, 1 - flush the respective output buffer
+!------------------------------------------------------------------------------!
+
+    USE pegrid
+    USE control_parameters
+
+    IMPLICIT NONE
+
+    CHARACTER(LEN=6)   ::  message_identifier
+    CHARACTER(LEN=*)   ::  routine_name
+    CHARACTER(LEN=200) ::  header_string
+
+    INTEGER ::  file_id, flush, i, message_level, output_on_pe, requested_action
+
+    LOGICAL ::  do_output, pe_out_of_range
+
+
+    do_output       = .FALSE.
+    pe_out_of_range = .FALSE.
+
+!    print*, '#1'
+!
+!-- Create the complete output string, starting with the message level
+    IF ( message_level == 0 )  THEN
+       header_string = '--- informative message ---  ID:'
+    ELSEIF ( message_level == 1 )  THEN
+       header_string = '+++ warning message ---  ID:'
+    ELSEIF ( message_level == 2 )  THEN
+       header_string = '+++ error message ---  ID:'
+    ELSE
+       WRITE( header_string,'(A,I2)' )  '+++ unknown message level: ', &
+                                        message_level
+    ENDIF
+
+!    print*, '#2'
+!
+!-- Add the message identifier and the generating routine
+    header_string = TRIM( header_string ) // ' ' // message_identifier // &
+                    '   generated by routine: ' // TRIM( routine_name )
+
+!    print*, '#3'
+!
+!-- Output the output string and the corresponding message string which had
+!-- been already assigned in the calling subroutine.
+!
+!-- First find out if output shall be done on this PE.
+    IF ( output_on_pe == -1 )  THEN
+       do_output = .TRUE.
+    ELSEIF ( myid == output_on_pe )  THEN
+       do_output = .TRUE.
+    ENDIF
+!    print*, '#4'
+#if defined( __parallel )
+!
+!-- In case of illegal pe number output on pe0
+    IF ( output_on_pe > numprocs-1 )  THEN
+       pe_out_of_range = .TRUE.
+       IF ( myid == 0 )  do_output = .TRUE.
+    ENDIF
+!    print*, '#5'
+#endif
+
+!
+!-- Now do the output
+    IF ( do_output )  THEN
+!    print*, '#6'
+       IF ( file_id == 6 )  THEN
+!
+!--       Output on stdout
+          WRITE( *, '(A/)' )  TRIM( header_string )
+!    print*, '#7'
+!
+!--       Cut message string into pieces and output one piece per line.
+!--       Remove leading blanks.
+          message_string = ADJUSTL( message_string )
+          i = INDEX( message_string, '&' )
+          DO WHILE ( i /= 0 )
+             WRITE( *, '(4X,A)' )  ADJUSTL( message_string(1:i-1) )
+             message_string = ADJUSTL( message_string(i+1:) )
+             i = INDEX( message_string, '&' )
+          ENDDO
+          WRITE( *, '(4X,A)' )  TRIM( message_string )
+!    print*, '#8'
+
+       ELSE
+!    print*, '#9'
+!
+!--       Output on requested file id (file must have been opened elsewhere!)
+          WRITE( file_id, '(A/)' )  TRIM( header_string )
+!
+!--       Cut message string into pieces and output one piece per line.
+!--       Remove leading blanks.
+          message_string = ADJUSTL( message_string )
+          i = INDEX( message_string, '&' )
+          DO WHILE ( i /= 0 )
+             WRITE( file_id, '(4X,A)' )  ADJUSTL( message_string(1:i-1) )
+             message_string = ADJUSTL( message_string(i+1:) )
+             i = INDEX( message_string, '&' )
+          ENDDO
+          WRITE( file_id, '(4X,A)' )  TRIM( message_string )
+
+!
+!--       Flush buffer, if requested
+          IF ( flush == 1 )  CALL local_flush( file_id )
+       ENDIF
+!    print*, '#10'
+
+       IF ( pe_out_of_range )  THEN
+          WRITE ( *, '(A)' )  '+++ WARNING from handle_palm_message:'
+          WRITE ( *, '(A,I6,A)' )  '    PE ', output_on_pe, &
+                                   ' choosed for output is larger '
+          WRITE ( *, '(A,I6)' )  '    than the maximum number of used PEs', &
+                                 numprocs-1
+          WRITE ( *, '(A)' )  '    Output is done on PE0 instead'
+       ENDIF
+!    print*, '#11'
+
+    ENDIF
+
+!
+!-- Abort execution, if requested
+!    print*, '#12'
+    IF ( requested_action > 0 )  THEN
+       abort_mode = requested_action
+       CALL local_stop
+    ENDIF
+!    print*, '#13'
+
+ END SUBROUTINE handle_palm_message
Index: /palm/trunk/SOURCE/local_stop.f90
===================================================================
--- /palm/trunk/SOURCE/local_stop.f90	(revision 212)
+++ /palm/trunk/SOURCE/local_stop.f90	(revision 213)
@@ -4,5 +4,7 @@
 ! Actual revisions:
 ! -----------------
-! Implementation of a MPI-1 coupling: replaced myid with target_id
+! Implementation of a MPI-1 coupling: replaced myid with target_id.
+! The uncoupled case allows stop or mpi_abort depending on new steering
+! parameter abort_mode, which is set in handle_palm_message.
 !
 ! Former revisions:
@@ -36,6 +38,10 @@
 #if defined( __parallel )
     IF ( coupling_mode == 'uncoupled' )  THEN
-       CALL MPI_FINALIZE( ierr )
-       STOP
+       IF ( abort_mode == 1 )  THEN
+          CALL MPI_FINALIZE( ierr )
+          STOP
+       ELSEIF ( abort_mode == 2 )  THEN
+          CALL MPI_ABORT( comm2d, 9999, ierr )
+       ENDIF
     ELSE
 
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 212)
+++ /palm/trunk/SOURCE/modules.f90	(revision 213)
@@ -6,5 +6,5 @@
 ! -----------------
 ! some dvrp-variables changed to single precision, variables for dvrp-mode
-! pathlines added, +target_id
+! pathlines added, +target_id, abort_mode, message_string
 !
 ! Former revisions:
@@ -257,36 +257,37 @@
 
 
-    CHARACTER (LEN=1)   ::  cycle_mg = 'w', timestep_reason = ' '
-    CHARACTER (LEN=2)   ::  coupling_char = ''
-    CHARACTER (LEN=5)   ::  write_binary = 'false'
-    CHARACTER (LEN=6)   ::  grid_matching = 'match'
-    CHARACTER (LEN=8)   ::  run_date, run_time
-    CHARACTER (LEN=9)   ::  simulated_time_chr
-    CHARACTER (LEN=12)  ::  version = ' ', revision = ' '
-    CHARACTER (LEN=16)  ::  loop_optimization = 'default', &
-                            momentum_advec = 'pw-scheme', &
-                            psolver = 'poisfft', &
-                            scalar_advec = 'pw-scheme'
-    CHARACTER (LEN=20)  ::  bc_e_b = 'neumann', bc_lr = 'cyclic', &
-                            bc_ns = 'cyclic', bc_p_b = 'neumann', &
-                            bc_p_t = 'dirichlet', bc_pt_b = 'dirichlet', &
-                            bc_pt_t = 'initial_gradient', &
-                            bc_q_b = 'dirichlet', bc_q_t = 'neumann', &
-                            bc_s_b = 'dirichlet', bc_s_t = 'neumann', &
-                            bc_sa_t = 'neumann', &
-                            bc_uv_b = 'dirichlet', bc_uv_t = 'dirichlet', &
-                            canopy_mode = 'block', &
-                            coupling_mode = 'uncoupled', &
-                            coupling_mode_remote = 'uncoupled', &
-                            dissipation_1d = 'as_in_3d_model', &
-                            fft_method = 'system-specific', &
-                            mixing_length_1d = 'as_in_3d_model', &
-                            random_generator = 'numerical-recipes', &
-                            return_addres, return_username, &
-                            timestep_scheme = 'runge-kutta-3'
-    CHARACTER (LEN=40)  ::  avs_data_file, topography = 'flat'
-    CHARACTER (LEN=64)  ::  host
-    CHARACTER (LEN=80)  ::  log_message, run_identifier
-    CHARACTER (LEN=100) ::  initializing_actions = ' ', run_description_header
+    CHARACTER (LEN=1)    ::  cycle_mg = 'w', timestep_reason = ' '
+    CHARACTER (LEN=2)    ::  coupling_char = ''
+    CHARACTER (LEN=5)    ::  write_binary = 'false'
+    CHARACTER (LEN=6)    ::  grid_matching = 'match'
+    CHARACTER (LEN=8)    ::  run_date, run_time
+    CHARACTER (LEN=9)    ::  simulated_time_chr
+    CHARACTER (LEN=12)   ::  version = ' ', revision = ' '
+    CHARACTER (LEN=16)   ::  loop_optimization = 'default', &
+                             momentum_advec = 'pw-scheme', &
+                             psolver = 'poisfft', &
+                             scalar_advec = 'pw-scheme'
+    CHARACTER (LEN=20)   ::  bc_e_b = 'neumann', bc_lr = 'cyclic', &
+                             bc_ns = 'cyclic', bc_p_b = 'neumann', &
+                             bc_p_t = 'dirichlet', bc_pt_b = 'dirichlet', &
+                             bc_pt_t = 'initial_gradient', &
+                             bc_q_b = 'dirichlet', bc_q_t = 'neumann', &
+                             bc_s_b = 'dirichlet', bc_s_t = 'neumann', &
+                             bc_sa_t = 'neumann', &
+                             bc_uv_b = 'dirichlet', bc_uv_t = 'dirichlet', &
+                             canopy_mode = 'block', &
+                             coupling_mode = 'uncoupled', &
+                             coupling_mode_remote = 'uncoupled', &
+                             dissipation_1d = 'as_in_3d_model', &
+                             fft_method = 'system-specific', &
+                             mixing_length_1d = 'as_in_3d_model', &
+                             random_generator = 'numerical-recipes', &
+                             return_addres, return_username, &
+                             timestep_scheme = 'runge-kutta-3'
+    CHARACTER (LEN=40)   ::  avs_data_file, topography = 'flat'
+    CHARACTER (LEN=64)   ::  host = ' '
+    CHARACTER (LEN=80)   ::  log_message, run_identifier
+    CHARACTER (LEN=100)  ::  initializing_actions = ' ', run_description_header
+    CHARACTER (LEN=1000) ::  message_string = ' '
 
     CHARACTER (LEN=7),  DIMENSION(100) ::  do3d_comp_prec = ' '
@@ -300,5 +301,5 @@
     CHARACTER (LEN=10), DIMENSION(0:1,100) ::  do2d = ' ', do3d = ' '
 
-    INTEGER ::  average_count_pr = 0, average_count_sp = 0, &
+    INTEGER ::  abort_mode = 0, average_count_pr = 0, average_count_sp = 0, &
                 average_count_3d = 0, current_timestep_number = 0, &
                 dist_range = 0, disturbance_level_ind_b, &
