Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 253)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 254)
@@ -26,5 +26,5 @@
 First constant in array den also defined as type double. (eqn_state_seawater)
 
-advec_particles, advec_s_bc, buoyancy, calc_spectra, check_for_restart, check_open, eqn_state_seawater, sort_particles
+advec_particles, advec_s_bc, buoyancy, calc_spectra, check_for_restart, check_open, coriolis, cpu_log, data_output_2d, data_output_3d, data_output_dvrp, data_output_profiles, data_output_spectra,  eqn_state_seawater, fft_xy, flow_statistics, header, init_1d_model, init_3d_model, init_dvrp, init_grid, init_particles, init_pegrid, sort_particles
 
 
Index: palm/trunk/SOURCE/coriolis.f90
===================================================================
--- palm/trunk/SOURCE/coriolis.f90	(revision 253)
+++ palm/trunk/SOURCE/coriolis.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -106,7 +107,6 @@
           CASE DEFAULT
 
-             IF ( myid == 0 )  PRINT*,'+++ coriolis:  wrong component: ', &
-                                      component
-             CALL local_stop
+             WRITE( message_string, * ) ' wrong component: ', component
+             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
 
        END SELECT
@@ -166,7 +166,6 @@
           CASE DEFAULT
 
-             IF ( myid == 0 )  PRINT*,'+++ coriolis:  wrong component: ', &
-                                      component
-             CALL local_stop
+             WRITE( message_string, * ) ' wrong component: ', component
+             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
 
        END SELECT
Index: palm/trunk/SOURCE/cpu_log.f90
===================================================================
--- palm/trunk/SOURCE/cpu_log.f90	(revision 253)
+++ palm/trunk/SOURCE/cpu_log.f90	(revision 254)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! Type of count and count_rate changed to default INTEGER on NEC machines
 !
@@ -31,4 +32,5 @@
 !------------------------------------------------------------------------------!
 
+    USE control_parameters
     USE cpulog
     USE pegrid
@@ -56,9 +58,7 @@
        log_event%place = place
     ELSEIF ( log_event%place /= place )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*,'+++ cpu_log: wrong argument'
-          PRINT*,'    expected: ',log_event%place,'  given: ', place
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'wrong argument & expected: ', &
+                         TRIM(log_event%place), '  given: ',  TRIM( place )
+       CALL message( 'cpu_log', 'PA0174', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -71,8 +71,6 @@
     mtime = IRTC( ) * 1E-9
 #else
-    IF ( myid == 0 )  THEN
-       PRINT*, '+++ cpu_log: no time measurement defined on this host'
-    ENDIF
-    CALL local_stop
+    message_string = 'no time measurement defined on this host'
+    CALL message( 'cpu_log', 'PA0175', 1, 2, 0, 6, 0 )
 #endif
 
@@ -84,7 +82,8 @@
     ELSEIF ( modus == 'pause' )  THEN
        IF ( ( mtime - log_event%mtime ) < 0.0  .AND.  first )  THEN
-          PRINT*,'+++ WARNING: cpu_log: negative time interval occured'
-          PRINT*,'+++ PE',myid,' L=PAUSE "',TRIM(log_event%place),'" new=', &
-                 mtime,' last=',log_event%mtime
+          WRITE( message_string, * ) 'negative time interval occured', &
+                                     ' &PE',myid,' L=PAUSE "',TRIM(log_event%place),'" new=', &
+                                      mtime,' last=',log_event%mtime
+          CALL message( 'cpu_log', 'PA0176', 0, 1, -1, 6, 0 )
           first = .FALSE.
        ENDIF
@@ -94,7 +93,8 @@
        IF ( ( mtime - log_event%mtime + log_event%isum ) < 0.0  .AND. &
             first )  THEN
-          PRINT*,'+++ WARNING: cpu_log: negative time interval occured'
-          PRINT*,'+++ PE',myid,' L=STOP "',TRIM(log_event%place),'" new=', &
-                 mtime,' last=',log_event%mtime,' isum=',log_event%isum
+          WRITE( message_string, * ) 'negative time interval occured', &
+                                     ' &PE',myid,' L=STOP "',TRIM(log_event%place),'" new=', &
+                                      mtime,' last=',log_event%mtime,' isum=',log_event%isum
+          CALL message( 'cpu_log', 'PA0177', 0, 1, -1, 6, 0 )
           first = .FALSE.
        ENDIF
@@ -103,7 +103,8 @@
        log_event%sum      = log_event%sum  + log_event%mtime
        IF ( log_event%sum < 0.0  .AND.  first )  THEN
-          PRINT*,'+++ WARNING: cpu_log: negative time interval occured'
-          PRINT*,'+++ PE',myid,' L=STOP "',TRIM(log_event%place),'" sum=', &
-                 log_event%sum,' mtime=',log_event%mtime
+          WRITE( message_string, * ) 'negative time interval occured',&
+                                     ' &PE',myid,' L=STOP "',TRIM(log_event%place),'" sum=', &
+                                      log_event%sum,' mtime=',log_event%mtime
+          CALL message( 'cpu_log', 'PA0178', 0, 1, -1, 6, 0 )
           first = .FALSE.
        ENDIF
@@ -113,5 +114,6 @@
        log_event%ivect    = 0.0
     ELSE
-       PRINT*, '+++ unknown modus of time measurement: ', modus
+       message_string = 'unknown modus of time measurement: ' // TRIM( modus )
+       CALL message( 'cpu_log', 'PA0179', 0, 1, -1, 6, 0 )
     ENDIF
 
Index: palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_2d.f90	(revision 253)
+++ palm/trunk/SOURCE/data_output_2d.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -158,6 +159,6 @@
        CASE DEFAULT
 
-          PRINT*,'+++ data_output_2d: unknown cross-section: ',mode
-          CALL local_stop
+          message_string = 'unknown cross-section: ' // TRIM( mode )
+          CALL message( 'data_output_2d', 'PA0180', 1, 2, 0, 6, 0 )
 
     END SELECT
@@ -518,6 +519,6 @@
 
                 IF ( .NOT. found )  THEN
-                   PRINT*, '+++ data_output_2d: no output provided for: ', &
-                                do2d(av,if)
+                   message_string =  'no output provided for: ' // TRIM( do2d(av,if) )
+                   CALL message( 'data_output_2d', 'PA0181', 0, 0, 0, 6, 0 )
                 ENDIF
 
Index: palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_3d.f90	(revision 253)
+++ palm/trunk/SOURCE/data_output_3d.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -310,7 +311,7 @@
              resorted = .TRUE.
 
-             IF ( myid == 0  .AND.  .NOT. found )  THEN
-                PRINT*, '+++ data_output_3d: no output available for: ', &
-                             do3d(av,if)
+             IF ( .NOT. found )  THEN
+                message_string =  'no output available for: ' // TRIM( do3d(av,if) )
+                CALL message( 'data_output_3d', 'PA0182', 0, 0, 0, 6, 0 )
              ENDIF
 
Index: palm/trunk/SOURCE/data_output_dvrp.f90
===================================================================
--- palm/trunk/SOURCE/data_output_dvrp.f90	(revision 253)
+++ palm/trunk/SOURCE/data_output_dvrp.f90	(revision 254)
@@ -30,6 +30,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! TEST: different colours for isosurfaces
 !
@@ -398,10 +399,9 @@
                          ENDDO
                       ENDDO            
-                   ELSE
-                      IF ( myid == 0 )  THEN
-                         PRINT*, '+++ data_output_dvrp: if humidity/passive_scalar = ', & 
-                                 'FALSE output of ', output_variable,            &
-                                 'is not provided' 
-                      ENDIF
+                   ELSE                    
+                      message_string = 'if humidity/passive_scalar = ' //  & 
+                                       'FALSE output of ' // TRIM( output_variable ) // &
+                                       'is not provided' 
+                      CALL message( 'data_output_dvrp', 'PA0183', 0, 0, 0, 6, 0 )
                    ENDIF
              
@@ -415,9 +415,9 @@
                          ENDDO
                       ENDDO
-                   ELSE
-                      IF ( myid == 0 ) THEN
-                         PRINT*, '+++ data_output_dvrp: if cloud_physics = FALSE ', & 
-                                 'output of ', output_variable, 'is not provided' 
-                      ENDIF
+                   ELSE                     
+                         message_string = 'if cloud_physics = FALSE ' // & 
+                                          'output of ' // TRIM( output_variable) // &
+                                          'is not provided' 
+                         CALL message( 'data_output_dvrp', 'PA0184', 0, 0, 0, 6, 0 )
                    ENDIF
 
Index: palm/trunk/SOURCE/data_output_profiles.f90
===================================================================
--- palm/trunk/SOURCE/data_output_profiles.f90	(revision 253)
+++ palm/trunk/SOURCE/data_output_profiles.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -290,13 +291,12 @@
                       IF ( cross_normx_factor(k,j) == 0.0  .OR. &
                            cross_normy_factor(k,j) == 0.0 )  THEN
-                         PRINT*,'+++ WARNING data_output_profiles: normalizi', &
-                                'ng cross ',j, ' is not possible since one o', &
-                                'f the'
-                         PRINT*,'                     normalizing factors is ',&
-                                'zero!'
-                         PRINT*,'    cross_normx_factor(',k,',',j,') = ', &
-                                cross_normx_factor(k,j)
-                         PRINT*,'    cross_normy_factor(',k,',',j,') = ', &
-                                cross_normy_factor(k,j)
+                         WRITE( message_string, * ) 'data_output_profiles: normalizi', &
+                                                    'ng cross ',j, ' is not possible since one o', &
+                                                    'f the & normalizing factors is zero! & ', &
+                                                    'cross_normx_factor(',k,',',j,') = ', &
+                                                     cross_normx_factor(k,j), &
+                                                    ' & cross_normy_factor(',k,',',j,') = ', &
+                                                     cross_normy_factor(k,j)
+                         CALL message( 'data_output_profiles', 'PA0185', 0, 1, 0, 6, 0 )
                          cross_normx_factor(k,j) = 1.0
                          cross_normy_factor(k,j) = 1.0
@@ -532,19 +532,20 @@
 
 !
-!--             Check the normalizing factors for zeros and deactivate the 
-!--             normalization, if required.
+!--             Check the normalizing factors for zeros and deactivate
+!--             the normalization, if required.
                 IF ( cross_normx_factor(k,j) == 0.0  .OR. &
                      cross_normy_factor(k,j) == 0.0 )  THEN
-                   PRINT*,'+++ WARNING data_output_profiles: normalizing ',j, &
-                          ' cross is not possible since one of the'
-                   PRINT*,'                     normalizing factors is zero!'
-                   PRINT*,'    cross_normx_factor(',k,',',j,') = ', &
-                           cross_normx_factor(k,j)
-                   PRINT*,'    cross_normy_factor(',k,',',j,') = ', &
-                           cross_normy_factor(k,j)
-                   cross_normx_factor(k,j) = 1.0
-                   cross_normy_factor(k,j) = 1.0
-                   cross_normalized_x(j) = ' '
-                   cross_normalized_y(j) = ' '
+                   WRITE( message_string, * ) 'data_output_profiles: normalizi', &
+                                              'ng cross ',j, ' is not possible since one o', &
+                                              'f the & normalizing factors is zero! & ', &
+                                              'cross_normx_factor(',k,',',j,') = ', &
+                                               cross_normx_factor(k,j), &
+                                              ' & cross_normy_factor(',k,',',j,') = ', &
+                                               cross_normy_factor(k,j)
+                    CALL message( 'data_output_profiles', 'PA0185', 0, 1, 0, 6, 0 )
+                    cross_normx_factor(k,j) = 1.0
+                    cross_normy_factor(k,j) = 1.0
+                    cross_normalized_x(j) = ' '
+                    cross_normalized_y(j) = ' '
                 ENDIF
 
Index: palm/trunk/SOURCE/data_output_spectra.f90
===================================================================
--- palm/trunk/SOURCE/data_output_spectra.f90	(revision 253)
+++ palm/trunk/SOURCE/data_output_spectra.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -92,5 +93,6 @@
 !--    If necessary, calculate time average and reset average counter
        IF ( average_count_sp == 0 )  THEN
-          PRINT*, '+++ data_output_spectra: no spectra data available'
+           message_string = 'no spectra data available'
+           CALL message( 'data_output_spectra', 'PA0186', 0, 0, 0, 6, 0 )
        ENDIF
        IF ( average_count_sp /= 1 )  THEN
Index: palm/trunk/SOURCE/fft_xy.f90
===================================================================
--- palm/trunk/SOURCE/fft_xy.f90	(revision 253)
+++ palm/trunk/SOURCE/fft_xy.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -134,7 +135,7 @@
                       auy4, nau2 )
 #elif defined( __nec )
-          PRINT*, '+++ fft_init: fft method "', fft_method, &
-                  '" currently does not work on NEC'
-          CALL local_stop
+          message_string = 'fft method "' // TRIM( fft_method) // &
+                           '" currently does not work on NEC'
+          CALL message( 'fft_init', 'PA0187', 1, 2, 0, 6, 0 )
 
           ALLOCATE( trig_xb(2*(nx+1)), trig_xf(2*(nx+1)), &
@@ -163,6 +164,6 @@
                        trig_yb, worky, 0 )
 #else
-          PRINT*, '+++ fft_init: no system-specific fft-call available'
-          CALL local_stop
+          message_string = 'no system-specific fft-call available'
+          CALL message( 'fft_init', 'PA0188', 1, 2, 0, 6, 0 )
 #endif
        ELSEIF ( fft_method == 'temperton-algorithm' )  THEN
@@ -181,8 +182,7 @@
        ELSE
 
-          PRINT*, '+++ fft_init: fft method "', fft_method, &
-                  '" not available'
-          CALL local_stop
-
+          message_string = 'fft method "' // TRIM( fft_method) // &
+                           '" not available'
+          CALL message( 'fft_init', 'PA0189', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -357,11 +357,10 @@
           ENDIF
 #else
-          PRINT*, '+++ fft_x: no system-specific fft-call available'
-          CALL local_stop
+          message_string = 'no system-specific fft-call available'
+          CALL message( 'fft_x', 'PA0188', 1, 2, 0, 6, 0 )
 #endif
        ELSE
-
-          PRINT*, '+++ fft_x: fft method "', fft_method, '" not available'
-          CALL local_stop
+          message_string = 'fft method "' // TRIM( fft_method) // '" not available'
+          CALL message( 'fft_x', 'PA0189', 1, 2, 0, 6, 0 )
 
        ENDIF
@@ -537,12 +536,13 @@
           ENDIF
 #else
-          PRINT*, '+++ fft_y: no system-specific fft-call available'
-          CALL local_stop
+          message_string = 'no system-specific fft-call available'
+          CALL message( 'fft_y', 'PA0188', 1, 2, 0, 6, 0 ) 
+
 #endif
 
        ELSE
 
-          PRINT*, '+++ fft_y: fft method "', fft_method, '" not available'
-          CALL local_stop
+          message_string = 'fft method "' // TRIM( fft_method) // '" not available'
+          CALL message( 'fft_y', 'PA0189', 1, 2, 0, 6, 0 )
 
        ENDIF
@@ -672,12 +672,12 @@
 
 #else
-          PRINT*, '+++ fft_x_m: no system-specific fft-call available'
-          STOP
+          message_string = 'no system-specific fft-call available'
+          CALL message( 'fft_x_m', 'PA0188', 1, 2, 0, 6, 0 ) 
 #endif
 
        ELSE
 
-          PRINT*, '+++ fft_x_m: fft method "', fft_method, '" not available'
-          CALL local_stop
+          message_string = 'fft method "' // TRIM( fft_method) // '" not available'
+          CALL message( 'fft_x_m', 'PA0189', 1, 2, 0, 6, 0 )
 
        ENDIF
@@ -807,12 +807,12 @@
 
 #else
-          PRINT*, '+++ fft_y_m: no system-specific fft-call available'
-          STOP
+          message_string = 'no system-specific fft-call available'
+          CALL message( 'fft_y_m', 'PA0188', 1, 2, 0, 6, 0 ) 
 #endif
 
        ELSE
-
-          PRINT*, '+++ fft_y_m: fft method "', fft_method, '" not available'
-          CALL local_stop
+         
+          message_string = 'fft method "' // TRIM( fft_method) // '" not available'
+          CALL message( 'fft_x_m', 'PA0189', 1, 2, 0, 6, 0 )
 
        ENDIF
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 253)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -93,7 +94,8 @@
 !-- called once after the current time step
     IF ( flow_statistics_called )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ WARNING: flow_statistics is called two', &
-                                 ' times within one timestep'
-       CALL local_stop
+
+       message_string = 'flow_statistics is called two times within one timestep'
+       CALL message( 'flow_statistics', 'PA0190', 1, 2, 0, 6, 0 )
+      
     ENDIF
 
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 253)
+++ palm/trunk/SOURCE/header.f90	(revision 254)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! Output of cluster_size
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left,
@@ -135,5 +136,6 @@
        run_classification = '3D - run initialized by user'
     ELSE
-       PRINT*,'+++ header:  unknown action(s): ',initializing_actions
+       message_string = ' unknown action(s): ' // TRIM( initializing_actions )
+       CALL message( 'header', 'PA0191', 0, 0, 0, 6, 0 )
     ENDIF
     IF ( ocean )  THEN
@@ -634,5 +636,5 @@
 !
 !-- 1D-profiles
-    dopr_chr = 'Profile:'
+    dopr_chr = 'Pofile:'
     IF ( dopr_n /= 0 )  THEN
        WRITE ( io, 331 )
Index: palm/trunk/SOURCE/init_1d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_1d_model.f90	(revision 253)
+++ palm/trunk/SOURCE/init_1d_model.f90	(revision 254)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -842,9 +843,9 @@
     IF ( dt_1d < ( 0.00001 * dt_max_1d ) )  THEN
        stop_dt_1d = .TRUE.
-       IF ( myid == 0 )  THEN
-          PRINT*,'+++ timestep_1d: timestep has exceeded the lower limit'
-          PRINT*,'                 dt_1d = ',dt_1d,' s   simulation stopped!'
-       ENDIF
-       CALL local_stop
+
+       WRITE( message_string, * ) 'timestep has exceeded the lower limit &', &
+                                  'dt_1d = ',dt_1d,' s   simulation stopped!'
+       CALL message( 'timestep_1d', 'PA0192', 1, 2, 0, 6, 0 )
+       
     ENDIF
 
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 253)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 254)
@@ -5,9 +5,10 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! Set the starting level and the vertical smoothing factor used for 
 ! the external pressure gradient
-! +converve_volume_flow_mode: 'default', 'initial_profiles', 'inflow_profile'
+! +conserve_volume_flow_mode: 'default', 'initial_profiles', 'inflow_profile'
 ! and 'bulk_velocity'
 !
@@ -1079,7 +1080,6 @@
 !
 !--    Actually this part of the programm should not be reached
-       IF ( myid == 0 )  PRINT*,'+++ init_3d_model: unknown initializing ', &
-                                                    'problem'
-       CALL local_stop
+       message_string = 'unknown initializing problem'
+       CALL message( 'init_3d_model', 'PA0193', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -1378,10 +1378,8 @@
 
     IF ( dots_num > dots_max )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ user_init: number of time series quantities exceeds', &
-                  ' its maximum of dots_max = ', dots_max
-          PRINT*, '    Please increase dots_max in modules.f90.'
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'number of time series quantities exceeds', &
+                                  ' its maximum of dots_max = ', dots_max, &
+                                  ' &Please increase dots_max in modules.f90.'
+       CALL message( 'init_3d_model', 'PA0194', 1, 2, 0, 6, 0 )    
     ENDIF
 
Index: palm/trunk/SOURCE/init_dvrp.f90
===================================================================
--- palm/trunk/SOURCE/init_dvrp.f90	(revision 253)
+++ palm/trunk/SOURCE/init_dvrp.f90	(revision 254)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! Clipping implemented.
 ! Polygon reduction for building and ground plate isosurface. Reduction level
@@ -131,16 +132,12 @@
 !-- and set default-values, where necessary
     IF ( dvrp_username == ' ' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ init_dvrp: dvrp_username is undefined'
-          CALL local_stop
-       ENDIF
+        message_string = 'dvrp_username is undefined'
+        CALL message( 'init_dvrp', 'PA0195', 1, 2, 0, 6, 0 )         
     ENDIF
 
     IF ( dvrp_output /= 'ftp'  .AND.  dvrp_output /= 'rtsp'  .AND. &
          dvrp_output /= 'local' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ init_dvrp: dvrp_output="', dvrp_output, '" not allowed'
-          CALL local_stop
-       ENDIF
+       message_string = 'dvrp_output="' // TRIM( dvrp_output ) // '" not allowed'
+       CALL message( 'init_dvrp', 'PA0196', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -151,8 +148,6 @@
     IF ( dvrp_output /= 'local' )  THEN
        IF ( dvrp_file /= 'default'  .AND.  dvrp_file /= '/dev/null' )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ init_dvrp: dvrp_file="', dvrp_file, '" not allowed'
-             CALL local_stop
-          ENDIF
+          message_string = 'dvrp_file="' // TRIM( dvrp_file ) // '" not allowed'
+          CALL message( 'init_dvrp', 'PA0197', 1, 2, 0, 6, 0 )
        ENDIF
     ENDIF
@@ -181,7 +176,6 @@
             mode_dvrp(m)(1:9)  /= 'pathlines' )  THEN
 
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ init_dvrp: mode_dvrp="', mode_dvrp, '" not allowed'
-          ENDIF
+          message_string = 'mode_dvrp="' // TRIM( mode_dvrp ) // '" not allowed'
+          CALL message( 'init_dvrp', 'PA0198', 1, 2, 0, 6, 0 )
           CALL local_stop
 
@@ -693,9 +687,8 @@
 #else
        IF ( coupling_mode /= 'uncoupled' ) THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ init_dvrp: split of communicator not realized with', &
+          message_string = 'split of communicator not realized with' // &
                           ' MPI1 coupling atmosphere-ocean'
-          ENDIF
-          CALL local_stop
+          CALL message( 'init_dvrp_logging', 'PA0199', 1, 2, 0, 6, 0 )
+ 
 !          CALL DVRP_SPLIT( comm_inter, comm_palm )
        ELSE
Index: palm/trunk/SOURCE/init_grid.f90
===================================================================
--- palm/trunk/SOURCE/init_grid.f90	(revision 253)
+++ palm/trunk/SOURCE/init_grid.f90	(revision 254)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! new topography case 'single_street_canyon'
 !
@@ -78,9 +79,9 @@
 !-- Compute height of u-levels from constant grid length and dz stretch factors
     IF ( dz == -1.0 )  THEN
-       IF ( myid == 0 )  PRINT*,'+++ init_grid:  missing dz'
-       CALL local_stop
+       message_string = 'missing dz'
+       CALL message( 'init_grid', 'PA0200', 1, 2, 0, 6, 0 ) 
     ELSEIF ( dz <= 0.0 )  THEN
-       IF ( myid == 0 )  PRINT*,'+++ init_grid:  dz=',dz,' <= 0.0'
-       CALL local_stop
+       WRITE( message_string, * ) 'dz=',dz,' <= 0.0'
+       CALL message( 'init_grid', 'PA0201', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -309,11 +310,10 @@
        IF ( l_grid(k) > 1.5 * dx * wall_adjustment_factor .OR.  &
             l_grid(k) > 1.5 * dy * wall_adjustment_factor )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ WARNING: grid anisotropy exceeds '// &
-                           'threshold given by only local'
-             PRINT*, '             horizontal reduction of near_wall '// &
-                           'mixing length l_wall'
-             PRINT*, '             starting from height level k = ', k, '.'
-          ENDIF
+          WRITE( message_string, * ) 'grid anisotropy exceeds ', &
+                                     'threshold given by only local', &
+                                     ' &horizontal reduction of near_wall ', &
+                                     'mixing length l_wall', &
+                                     ' &starting from height level k = ', k, '.'
+          CALL message( 'init_grid', 'PA0202', 0, 1, 0, 6, 0 )
           EXIT
        ENDIF
@@ -367,10 +367,8 @@
           IF ( ( bxl < 1 ) .OR. ( bxr > nx-1 ) .OR. ( bxr < bxl+3 ) .OR.  &
                ( bys < 1 ) .OR. ( byn > ny-1 ) .OR. ( byn < bys+3 ) )  THEN
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ init_grid: inconsistent building parameters:'
-                PRINT*, '               bxl=', bxl, 'bxr=', bxr, 'bys=', bys, &
-                                      'byn=', byn, 'nx=', nx, 'ny=', ny
-             ENDIF
-             CALL local_stop
+             WRITE( message_string, * ) 'inconsistent building parameters:', &
+                                        '& bxl=', bxl, 'bxr=', bxr, 'bys=', bys, &
+                                        'byn=', byn, 'nx=', nx, 'ny=', ny
+             CALL message( 'init_grid', 'PA0203', 1, 2, 0, 6, 0 )
           ENDIF
 
@@ -405,8 +403,8 @@
 
           ELSE
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ user_init_grid: no street canyon width given'
-             ENDIF
-             CALL local_stop
+             
+             message_string = 'no street canyon width given'
+             CALL message( 'init_grid', 'PA0204', 1, 2, 0, 6, 0 )
+  
           ENDIF
 
@@ -418,32 +416,26 @@
              IF ( ( cxl < 1 ) .OR. ( cxr > nx-1 ) .OR. ( cwx < 3 ) .OR.  &
                ( ch < 3 ) )  THEN
-                IF ( myid == 0 )  THEN
-                   PRINT*, '+++ user_init_grid: inconsistent canyon parameters:'
-                   PRINT*, '                    cxl=', cxl, 'cxr=', cxr,  &
-                                              'cwx=', cwx,  &
-                                              'ch=', ch, 'nx=', nx, 'ny=', ny
-                ENDIF
-                CALL local_stop
+                WRITE( message_string, * ) 'inconsistent canyon parameters:', &
+                                           '&cxl=', cxl, 'cxr=', cxr,  &
+                                           'cwx=', cwx,  &
+                                           'ch=', ch, 'nx=', nx, 'ny=', ny
+                CALL message( 'init_grid', 'PA0205', 1, 2, 0, 6, 0 ) 
              ENDIF
           ELSEIF ( canyon_width_y /= 9999999.9 )  THEN
              IF ( ( cys < 1 ) .OR. ( cyn > ny-1 ) .OR. ( cwy < 3 ) .OR.  &
                ( ch < 3 ) )  THEN
-                IF ( myid == 0 )  THEN
-                   PRINT*, '+++ user_init_grid: inconsistent canyon parameters:'
-                   PRINT*, '                    cys=', cys, 'cyn=', cyn,  &
-                                              'cwy=', cwy,  &
-                                              'ch=', ch, 'nx=', nx, 'ny=', ny
-                ENDIF
-                CALL local_stop
+                WRITE( message_string, * ) 'inconsistent canyon parameters:', &
+                                           '&cys=', cys, 'cyn=', cyn,  &
+                                           'cwy=', cwy,  &
+                                           'ch=', ch, 'nx=', nx, 'ny=', ny
+                CALL message( 'init_grid', 'PA0206', 1, 2, 0, 6, 0 ) 
              ENDIF
           ENDIF
           IF ( canyon_width_x /= 9999999.9 .AND. canyon_width_y /= 9999999.9 )  &
                THEN
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ user_init_grid: inconsistent canyon parameters:'
-                PRINT*, '                    street canyon can only be oriented'
-                PRINT*, '                    either in x- or in y-direction'
-             ENDIF
-             CALL local_stop
+             message_string = 'inconsistent canyon parameters:' // &
+                              '&street canyon can only be oriented' // &
+                              '&either in x- or in y-direction'
+             CALL message( 'init_grid', 'PA0207', 1, 2, 0, 6, 0 )
           ENDIF
 
@@ -480,14 +472,10 @@
       
           GOTO 12
-
- 10       IF ( myid == 0 )  THEN
-             PRINT*, '+++ init_grid: file TOPOGRAPHY_DATA does not exist'
-          ENDIF
-          CALL local_stop
-
- 11       IF ( myid == 0 )  THEN
-             PRINT*, '+++ init_grid: errors in file TOPOGRAPHY_DATA'
-          ENDIF
-          CALL local_stop
+          
+ 10       message_string = 'file TOPOGRAPHY_DATA does not exist'
+          CALL message( 'init_grid', 'PA0208', 1, 2, 0, 6, 0 )
+
+ 11       message_string = 'errors in file TOPOGRAPHY_DATA'
+          CALL message( 'init_grid', 'PA0209', 1, 2, 0, 6, 0 )
 
  12       CLOSE( 90 )
@@ -519,11 +507,9 @@
 !--    Consistency checks
        IF ( MINVAL( nzb_local ) < 0  .OR.  MAXVAL( nzb_local ) > nz + 1 )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ init_grid: nzb_local values are outside the', &
-                          'model domain'
-             PRINT*, '               MINVAL( nzb_local ) = ', MINVAL(nzb_local)
-             PRINT*, '               MAXVAL( nzb_local ) = ', MAXVAL(nzb_local)
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'nzb_local values are outside the', &
+                                     'model domain', &
+                                     '&MINVAL( nzb_local ) = ', MINVAL(nzb_local), &
+                                     '&MAXVAL( nzb_local ) = ', MAXVAL(nzb_local)
+          CALL message( 'init_grid', 'PA0210', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -531,9 +517,7 @@
           IF ( ANY( nzb_local(:,-1) /= nzb_local(:,nx)   )  .OR. &
                ANY( nzb_local(:,0)  /= nzb_local(:,nx+1) ) )  THEN
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ init_grid: nzb_local does not fulfill cyclic', &
-                        '               boundary condition in x-direction'
-             ENDIF
-             CALL local_stop
+             message_string = 'nzb_local does not fulfill cyclic' // &
+                              ' boundary condition in x-direction'
+             CALL message( 'init_grid', 'PA0211', 1, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -541,9 +525,7 @@
           IF ( ANY( nzb_local(-1,:) /= nzb_local(ny,:)   )  .OR. &
                ANY( nzb_local(0,:)  /= nzb_local(ny+1,:) ) )  THEN
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ init_grid: nzb_local does not fulfill cyclic', &
-                        '               boundary condition in y-direction'
-             ENDIF
-             CALL local_stop
+             message_string = 'nzb_local does not fulfill cyclic' // &
+                              ' boundary condition in y-direction'
+             CALL message( 'init_grid', 'PA0212', 1, 2, 0, 6, 0 )
           ENDIF
        ENDIF
Index: palm/trunk/SOURCE/init_particles.f90
===================================================================
--- palm/trunk/SOURCE/init_particles.f90	(revision 253)
+++ palm/trunk/SOURCE/init_particles.f90	(revision 254)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine
 ! Bugfix: arrays for tails are allocated with a minimum size of 10 tails if
 ! there is no tail initially
@@ -97,9 +98,9 @@
 !-- Check the number of particle groups.
     IF ( number_of_particle_groups > max_number_of_particle_groups )  THEN
-       PRINT*, '+++ WARNING: init_particles: ', &
-                    'max_number_of_particle_groups =', &
-               max_number_of_particle_groups
-       PRINT*, '+++          number_of_particle_groups reset to ', &
-               max_number_of_particle_groups
+       WRITE( message_string, * ) 'max_number_of_particle_groups =', &
+                                  max_number_of_particle_groups , &
+                                  '&number_of_particle_groups reset to ', &
+                                  max_number_of_particle_groups
+       CALL message( 'init_particles', 'PA0213', 0, 1, 0, 6, 0 )
        number_of_particle_groups = max_number_of_particle_groups
     ENDIF
@@ -152,13 +153,9 @@
        particle_binary_version = '3.0'
        IF ( TRIM( version_on_file ) /= TRIM( particle_binary_version ) )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*, '+++ init_particles: version mismatch concerning data ', &
-                     'from prior run'
-             PRINT*, '        version on file    = "', TRIM( version_on_file ),&
-                     '"'
-             PRINT*, '        version in program = "', &
-                     TRIM( particle_binary_version ), '"'
-          ENDIF
-          CALL local_stop
+          message_string = 'version mismatch concerning data from prior run' // &
+                           '&version on file    = "' // TRIM( version_on_file ) // &
+                           '&version in program = "' // &
+                           TRIM( particle_binary_version ) // '"'
+          CALL message( 'init_particles', 'PA0214', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -234,9 +231,7 @@
        DO  i = 1, number_of_particle_groups
           IF ( density_ratio(i) /= 0.0  .AND.  radius(i) == 0 )  THEN
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ init_particles: particle group #', i, 'has a', &
-                        'density ratio /= 0 but radius = 0'
-             ENDIF
-             CALL local_stop
+             WRITE( message_string, * ) 'particle group #', i, 'has a', &
+                                        'density ratio /= 0 but radius = 0'
+             CALL message( 'init_particles', 'PA0215', 1, 2, 0, 6, 0 )
           ENDIF
           particle_groups(i)%density_ratio = density_ratio(i)
@@ -273,14 +268,10 @@
                             n = n + 1
                             IF ( n > maximum_number_of_particles )  THEN
-                               PRINT*,'+++ init_particles: number of initial', &
-                                      ' particles (', n, ') exceeds'
-                               PRINT*,'    maximum_number_of_particles (',     &
-                                      maximum_number_of_particles, ') on PE ', &
-                                      myid
-#if defined( __parallel )
-                               CALL MPI_ABORT( comm2d, 9999, ierr )
-#else
-                               CALL local_stop
-#endif
+                               WRITE( message_string, * ) 'number of initial', &
+                                             'particles (', n, ') exceeds', &
+                                             '&maximum_number_of_particles (', &
+                                             maximum_number_of_particles, ') on PE ', &
+                                             myid
+                               CALL message( 'init_particles', 'PA0216', 2, 2, 0, 6, 0 )
                             ENDIF
                             particles(n)%x             = pos_x
@@ -519,9 +510,7 @@
           
        CASE DEFAULT
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ init_particles: unknown boundary condition ',   &
-                         'bc_par_b = "', TRIM( bc_par_b ), '"'
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * )  'unknown boundary condition ',   &
+                                       'bc_par_b = "', TRIM( bc_par_b ), '"'
+          CALL message( 'init_particles', 'PA0217', 1, 2, 0, 6, 0 )
           
     END SELECT
@@ -535,9 +524,7 @@
           
        CASE DEFAULT
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ init_particles: unknown boundary condition ',   &
-                         'bc_par_t = "', TRIM( bc_par_t ), '"'
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'unknown boundary condition ',   &
+                                     'bc_par_t = "', TRIM( bc_par_t ), '"'
+          CALL message( 'init_particles', 'PA0218', 1, 2, 0, 6, 0 )
           
     END SELECT
@@ -554,9 +541,7 @@
           
        CASE DEFAULT
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ init_particles: unknown boundary condition ',   &
-                         'bc_par_lr = "', TRIM( bc_par_lr ), '"'
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'unknown boundary condition ',   &
+                                     'bc_par_lr = "', TRIM( bc_par_lr ), '"'
+          CALL message( 'init_particles', 'PA0219', 1, 2, 0, 6, 0 )
           
     END SELECT
@@ -573,9 +558,7 @@
           
        CASE DEFAULT
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ init_particles: unknown boundary condition ',   &
-                         'bc_par_ns = "', TRIM( bc_par_ns ), '"'
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'unknown boundary condition ',   &
+                                     'bc_par_ns = "', TRIM( bc_par_ns ), '"'
+          CALL message( 'init_particles', 'PA0220', 1, 2, 0, 6, 0 )
           
     END SELECT
Index: palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- palm/trunk/SOURCE/init_pegrid.f90	(revision 253)
+++ palm/trunk/SOURCE/init_pegrid.f90	(revision 254)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! ATTENTION: nnz_x undefined problem still has to be solved!!!!!!!!
 ! TEST OUTPUT (TO BE REMOVED) logging mpi2 ierr values
@@ -121,9 +122,8 @@
 !--    must be equal to the number of PEs available to the job
        IF ( ( npex * npey ) /= numprocs )  THEN
-          PRINT*, '+++ init_pegrid:'
-          PRINT*, '    number of PEs of the prescribed topology (', npex*npey, &
-                      ') does not match the number of PEs available to the ',  &
-                      'job (', numprocs, ')'
-          CALL local_stop
+          WRITE( message_string, * ) 'number of PEs of the prescribed topology (', &
+                                     npex*npey,') does not match & the number of ',  & 
+                                     'PEs available to the job (', numprocs, ')'
+          CALL message( 'init_pegrid', 'PA0221', 1, 2, 0, 6, 0 )
        ENDIF
        pdims(1) = npex
@@ -134,9 +134,8 @@
 !--    If the processor topology is prescribed by the user, the number of
 !--    PEs must be given in both directions
-       PRINT*, '+++ init_pegrid:'
-       PRINT*, '    if the processor topology is prescribed by the user, ',   &
-                    'both values of "npex" and "npey" must be given in the ', &
-                    'NAMELIST-parameter file'
-       CALL local_stop
+       message_string = 'if the processor topology is prescribed by the user, ' // &
+                    '& both values of "npex" and "npey" must be given in the ' //    &
+                    '&NAMELIST-parameter file'
+       CALL message( 'init_pegrid', 'PA0222', 1, 2, 0, 6, 0 )
 
     ENDIF
@@ -145,8 +144,7 @@
 !-- The hybrid solver can only be used in case of a 1d-decomposition along x
     IF ( pdims(2) /= 1  .AND.  psolver == 'poisfft_hybrid' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '*** init_pegrid: psolver = "poisfft_hybrid" can only be'
-          PRINT*, '                 used in case of a 1d-decomposition along x'
-       ENDIF
+       message_string = 'psolver = "poisfft_hybrid" can only be' // &
+                        '& used in case of a 1d-decomposition along x'
+       CALL message( 'init_pegrid', 'PA0223', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -224,8 +222,6 @@
 
        IF ( .NOT. found )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ init_pegrid: no matching grid for transpositions found'
-          ENDIF
-          CALL local_stop
+          message_string = 'no matching grid for transpositions found'
+          CALL message( 'init_pegrid', 'PA0224', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -239,21 +235,17 @@
 
     IF ( MOD( nxa+1 , pdims(1) ) /= 0 )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*,'+++ x-direction:  gridpoint number (',nx+1,') is not an'
-          PRINT*,'                  integral divisor of the number of proces', &
-                                   &'sors (', pdims(1),')'
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'x-direction: gridpoint number (',nx+1,') is not an',&
+                                  '& integral divisor of the number of proces', &
+                                  'sors (', pdims(1),')'
+       CALL message( 'init_pegrid', 'PA0225', 1, 2, 0, 6, 0 )
     ELSE
        nnx  = ( nxa + 1 ) / pdims(1)
        IF ( nnx*pdims(1) - ( nx + 1) > nnx )  THEN
-          IF ( myid == 0 )  THEN
-	     PRINT*,'+++ x-direction: nx does not match the requirements ', &
-	                 'given by the number of PEs'
-             PRINT*,'                 used'
-             PRINT*,'    please use nx = ', nx - ( pdims(1) - ( nnx*pdims(1) &
-	                 - ( nx + 1 ) ) ), ' instead of nx =', nx
-          ENDIF
-	  CALL local_stop
+          WRITE( message_string, * ) 'x-direction: nx does not match the', & 
+                                     'requirements given by the number of PEs', &
+                                     '& used',&
+                                     '& please use nx = ', nx - ( pdims(1) - ( nnx*pdims(1) &
+	                               - ( nx + 1 ) ) ), ' instead of nx =', nx
+          CALL message( 'init_pegrid', 'PA0226', 1, 2, 0, 6, 0 )
        ENDIF
     ENDIF    
@@ -270,21 +262,17 @@
 !-- Calculate array bounds in y-direction for every PE.
     IF ( MOD( nya+1 , pdims(2) ) /= 0 )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*,'+++ y-direction:  gridpoint number (',ny+1,') is not an'
-          PRINT*,'                  integral divisor of the number of proces', &
-                                   &'sors (', pdims(2),')'
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'y-direction: gridpoint number (',ny+1,') is not an', &
+                                  '& integral divisor of the number of proces', &
+                                  'sors (', pdims(2),')'
+       CALL message( 'init_pegrid', 'PA0227', 1, 2, 0, 6, 0 )
     ELSE
        nny  = ( nya + 1 ) / pdims(2)
        IF ( nny*pdims(2) - ( ny + 1) > nny )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ x-direction: nx does not match the requirements ', &
-                         'given by the number of PEs'
-             PRINT*,'                 used'
-             PRINT*,'    please use nx = ', nx - ( pdims(1) - ( nnx*pdims(1) &
-                         - ( nx + 1 ) ) ), ' instead of nx =', nx
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'y-direction: ny does not match the',&
+                                     'requirements given by the number of PEs', &
+                                     '& used', &
+                                     '& please use ny = ', ny - ( pdims(2) - ( nnx*pdims(2) &
+                                     - ( ny + 1 ) ) ), ' instead of ny =', ny
+          CALL message( 'init_pegrid', 'PA0228', 1, 2, 0, 6, 0 )
        ENDIF
     ENDIF    
@@ -326,9 +314,8 @@
        IF ( pdims(2) == 1  .AND. ( momentum_advec == 'ups-scheme'  .OR. &
             scalar_advec == 'ups-scheme' ) )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ WARNING: init_pegrid: 1d-decomposition along x ', &
-                                &'chosen but nz restrictions may occur'
-             PRINT*,'             since ups-scheme is activated'
-          ENDIF
+          message_string = '1d-decomposition along x ' // &
+                           'chosen but nz restrictions may occur' // &
+                           '& since ups-scheme is activated'
+          CALL message( 'init_pegrid', 'PA0229', 0, 1, 0, 6, 0 )
        ENDIF
        nys_x  = nys
@@ -337,10 +324,8 @@
        nny_x  = nny
        IF ( MOD( nza , pdims(1) ) /= 0 )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ transposition z --> x:'
-             PRINT*,'    nz=',nz,' is not an integral divisior of pdims(1)=', &
-                    &pdims(1)
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'transposition z --> x:', &
+                                     '&nz=',nz,' is not an integral divisior of pdims(1)=', &
+                                     pdims(1)
+          CALL message( 'init_pegrid', 'PA0230', 1, 2, 0, 6, 0 )
        ENDIF
        nnz_x  = nza / pdims(1)
@@ -371,10 +356,8 @@
     nzt_y  = nzt_x
     IF ( MOD( nxa+1 , pdims(2) ) /= 0 )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*,'+++ transposition x --> y:'
-          PRINT*,'    nx+1=',nx+1,' is not an integral divisor of ',&
-                 &'pdims(2)=',pdims(2)
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'transposition x --> y:', &
+                                  '&nx+1=',nx+1,' is not an integral divisor of ',&
+                                  'pdims(2)=',pdims(2)
+       CALL message( 'init_pegrid', 'PA0231', 1, 2, 0, 6, 0 )
     ENDIF
     nnx_y = (nxa+1) / pdims(2)
@@ -399,10 +382,8 @@
        nxr_z  = nxr_y
        IF ( MOD( nya+1 , pdims(1) ) /= 0 )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ Transposition y --> z:'
-             PRINT*,'    ny+1=',ny+1,' is not an integral divisor of ',&
-                    &'pdims(1)=',pdims(1)
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'transposition y --> z:', &
+                                     '& ny+1=',ny+1,' is not an integral divisor of ',&
+                                     'pdims(1)=',pdims(1)
+          CALL message( 'init_pegrid', 'PA0232', 1, 2, 0, 6, 0 )
        ENDIF
        nny_z  = (nya+1) / pdims(1)
@@ -417,10 +398,8 @@
 !--    x --> y. This condition must be fulfilled for a 1D-decomposition along x
        IF ( MOD( nya+1 , pdims(1) ) /= 0 )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ Transposition x --> y:'
-             PRINT*,'    ny+1=',ny+1,' is not an integral divisor of ',&
-                    &'pdims(1)=',pdims(1)
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'transposition x --> y:', &
+                                     '& ny+1=',ny+1,' is not an integral divisor of ',&
+                                     'pdims(1)=',pdims(1)
+          CALL message( 'init_pegrid', 'PA0233', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -431,10 +410,8 @@
     IF ( dt_dosp /= 9999999.9 )  THEN
        IF ( MOD( nza, pdims(2) ) /= 0 )  THEN
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ Direct transposition z --> y (needed for spectra):'
-             PRINT*,'    nz=',nz,' is not an integral divisor of ',&
-                    &'pdims(2)=',pdims(2)
-          ENDIF
-          CALL local_stop
+          WRITE( message_string, * ) 'direct transposition z --> y (needed for spectra):', &
+                                     '& nz=',nz,' is not an integral divisor of ',&
+                                     'pdims(2)=',pdims(2)
+          CALL message( 'init_pegrid', 'PA0234', 1, 2, 0, 6, 0 )
        ELSE
           nxl_yd  = nxl
@@ -609,9 +586,9 @@
     IF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
 
-       print*, '... before COMM_ACCEPT'
+       PRINT*, '... before COMM_ACCEPT'
        CALL MPI_COMM_ACCEPT( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &
                              comm_inter, ierr )
-       print*, '--- ierr = ', ierr
-       print*, '--- comm_inter atmosphere = ', comm_inter
+       PRINT*, '--- ierr = ', ierr
+       PRINT*, '--- comm_inter atmosphere = ', comm_inter
 
        coupling_mode_remote = 'ocean_to_atmosphere'
@@ -620,9 +597,9 @@
 
        IF ( myid == 0 )  PRINT*, '*** read: ', port_name, '  ierr = ', ierr
-       print*, '... before COMM_CONNECT'
+       PRINT*, '... before COMM_CONNECT'
        CALL MPI_COMM_CONNECT( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &
                               comm_inter, ierr )
-       print*, '--- ierr = ', ierr
-       print*, '--- comm_inter ocean      = ', comm_inter
+       PRINT*, '--- ierr = ', ierr
+       PRINT*, '--- comm_inter ocean      = ', comm_inter
 
        coupling_mode_remote = 'atmosphere_to_ocean'
@@ -776,8 +753,7 @@
              IF ( mg_switch_to_pe0_level < mg_switch_to_pe0_level_l  .OR.  &
                   mg_switch_to_pe0_level >= maximum_grid_level_l )  THEN
-                IF ( myid == 0 )  THEN
-                   PRINT*, '+++ WARNING init_pegrid: mg_switch_to_pe0_level ', &
-                               'out of range and reset to default (=0)'
-                ENDIF
+                message_string = 'mg_switch_to_pe0_level ' // &
+                                 'out of range and reset to default (=0)'
+                CALL message( 'init_pegrid', 'PA0235', 0, 1, 0, 6, 0 )
                 mg_switch_to_pe0_level = 0
              ELSE
@@ -836,14 +812,12 @@
 
              IF ( gathered_size > subdomain_size )  THEN
-                IF ( myid == 0 )  THEN
-                   PRINT*, '+++ init_pegrid: not enough memory for storing ', &
-                               'gathered multigrid data on PE0'
-                ENDIF
-                CALL local_stop
+                message_string = 'not enough memory for storing ' // &
+                                 'gathered multigrid data on PE0'
+                CALL message( 'init_pegrid', 'PA0236', 1, 2, 0, 6, 0 )
              ENDIF
 #else
-             PRINT*, '+++ init_pegrid: multigrid gather/scatter impossible ', &
+             message_string = 'multigrid gather/scatter impossible ' // &
                           'in non parallel mode'
-             CALL local_stop
+             CALL message( 'init_pegrid', 'PA0237', 1, 2, 0, 6, 0 )
 #endif
           ENDIF
@@ -1062,7 +1036,6 @@
 
               CASE DEFAULT
-                 IF ( myid == 0 )  PRINT*, '+++ init_pegrid: more than 10 ', &
-                                           ' multigrid levels'
-                 CALL local_stop
+                 message_string = 'more than 10 multigrid levels'
+                 CALL message( 'init_pegrid', 'PA0238', 1, 2, 0, 6, 0 )
 
           END SELECT
