Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 257)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 258)
@@ -29,5 +29,7 @@
 init_1d_model, init_3d_model, init_dvrp, init_grid, init_particles, init_pegrid, 
 netcdf, parin, plant_canopy_model, poisfft_hybrid, poismg, read_3d_binary, 
-read_var_list)
+read_var_list, surface_coupler, temperton_fft, timestep, user_actions, 
+user_data_output_dvrp, user_dvrp_coltab, user_init_grid, user_init_plant_canopy, 
+user_parin, user_read_restart_data, user_spectra )
 
 First constant in array den also defined as type double. (eqn_state_seawater)
@@ -37,5 +39,5 @@
 user_init_grid, user_parin, write_var_list)
 
-advec_particles, advec_s_bc, buoyancy, calc_spectra, check_for_restart, check_open, check_parameters, 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, netcdf, parin, plant_canopy_model, poisfft_hybrid, poismg, read_3d_binary, read_var_list, sort_particles, user_check_parameters, user_header, user_init_grid, user_parin, write_var_list
+advec_particles, advec_s_bc, buoyancy, calc_spectra, check_for_restart, check_open, check_parameters, 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, netcdf, parin, plant_canopy_model, poisfft_hybrid, poismg, read_3d_binary, read_var_list, sort_particles, user_check_parameters, user_header, user_init_grid, user_parin, surface_coupler, temperton_fft, timestep, user_actions, user_data_output_dvrp, user_dvrp_coltab, user_init_grid, user_init_plant_canopy, user_parin, user_read_restart_data, user_spectra, write_var_list
 
 
Index: palm/trunk/SOURCE/surface_coupler.f90
===================================================================
--- palm/trunk/SOURCE/surface_coupler.f90	(revision 257)
+++ palm/trunk/SOURCE/surface_coupler.f90	(revision 258)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -52,16 +53,13 @@
                        0, comm_inter, status, ierr )
     IF ( terminate_coupled_remote > 0 )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ surface_coupler:'
-          PRINT*, '    remote model "', TRIM( coupling_mode_remote ), &
-               '" terminated'
-          PRINT*, '    with terminate_coupled_remote = ', &
-               terminate_coupled_remote
-          PRINT*, '    local model  "', TRIM( coupling_mode ), &
-               '" has'
-          PRINT*, '    terminate_coupled = ', &
-               terminate_coupled
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'remote model "', TRIM( coupling_mode_remote ), &
+                                  '" terminated',                                 &
+                                  '&with terminate_coupled_remote = ',            &
+                                  terminate_coupled_remote,                       &
+                                  '&local model  "', TRIM( coupling_mode ),       &
+                                  '" has',                                        &
+                                  '&terminate_coupled = ',                        &
+                                  terminate_coupled
+       CALL message( 'surface_coupler', 'PA0310', 1, 2, 0, 6, 0 )
        RETURN
     ENDIF
Index: palm/trunk/SOURCE/temperton_fft.f90
===================================================================
--- palm/trunk/SOURCE/temperton_fft.f90	(revision 257)
+++ palm/trunk/SOURCE/temperton_fft.f90	(revision 258)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -1884,4 +1885,5 @@
 
 
+    USE control_parameters
     USE pegrid
 
@@ -1945,12 +1947,8 @@
 
 !    WRITE (nout,'(A,I4,A)') ' n =',n,' - Contains illegal factors'
-    IF ( myid == 0 )  THEN
-       PRINT*, '+++ temperton_fft:'
-       PRINT*, '    number of gridpoints along x or/and y contain illegal ', &
-                    'factors'
-       PRINT*, '    only factors 8,6,5,4,3,2 are allowed'
-    ENDIF
-    CALL local_stop
-
+    message_string = 'number of gridpoints along x or/and y ' // &
+                     'contain illegal  factors' //               &
+                     '&only factors 8,6,5,4,3,2 are allowed' 
+    CALL message( 'temperton_fft', 'PA0311', 1, 2, 0, 6, 0 )
 
     RETURN
Index: palm/trunk/SOURCE/timestep.f90
===================================================================
--- palm/trunk/SOURCE/timestep.f90	(revision 257)
+++ palm/trunk/SOURCE/timestep.f90	(revision 258)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -201,19 +202,18 @@
           stop_dt = .TRUE.
 
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ time_step: Time step has reached minimum limit.'
-             PRINT*,'    dt      = ', dt_3d, ' s   Simulation is terminated.'
-             PRINT*,'    old_dt  = ', old_dt, ' s'
-             PRINT*,'    dt_u    = ', dt_u, ' s'
-             PRINT*,'    dt_v    = ', dt_v, ' s'
-             PRINT*,'    dt_w    = ', dt_w, ' s'
-             PRINT*,'    dt_diff = ', dt_diff, ' s'
-             PRINT*,'    u_max   = ', u_max, ' m/s   k=', u_max_ijk(1), &
-                    '  j=', u_max_ijk(2), '  i=', u_max_ijk(3)
-             PRINT*,'    v_max   = ', v_max, ' m/s   k=', v_max_ijk(1), &
-                    '  j=', v_max_ijk(2), '  i=', v_max_ijk(3)
-             PRINT*,'    w_max   = ', w_max, ' m/s   k=', w_max_ijk(1), &
-                    '  j=', w_max_ijk(2), '  i=', w_max_ijk(3)
-          ENDIF
+          WRITE( message_string, * ) 'Time step has reached minimum limit.',        &
+                             '&dt      = ', dt_3d, ' s  Simulation is terminated.', &
+                             '&old_dt  = ', old_dt, ' s',                           &
+                             '&dt_u    = ', dt_u, ' s',                             &
+                             '&dt_v    = ', dt_v, ' s',                             &
+                             '&dt_w    = ', dt_w, ' s',                             &
+                             '&dt_diff = ', dt_diff, ' s',                          &
+                             '&u_max   = ', u_max, ' m/s   k=', u_max_ijk(1),       &
+                             '  j=', u_max_ijk(2), '  i=', u_max_ijk(3),            &
+                             '&v_max   = ', v_max, ' m/s   k=', v_max_ijk(1),       &
+                             '  j=', v_max_ijk(2), '  i=', v_max_ijk(3),            &
+                             '&w_max   = ', w_max, ' m/s   k=', w_max_ijk(1),       &
+                             '  j=', w_max_ijk(2), '  i=', w_max_ijk(3)
+          CALL message( 'timestep', 'PA0312', 0, 1, 0, 6, 0 )
 !
 !--       In case of coupled runs inform the remote model of the termination 
Index: palm/trunk/SOURCE/user_actions.f90
===================================================================
--- palm/trunk/SOURCE/user_actions.f90	(revision 257)
+++ palm/trunk/SOURCE/user_actions.f90	(revision 258)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -113,7 +114,6 @@
 
           CASE DEFAULT
-             IF ( myid == 0 )  PRINT*, '+++ user_actions: unknown location "', &
-                                       location, '"'
-             CALL local_stop
+             message_string = 'unknown location "' // location // '"'
+             CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 )
 
        END SELECT
@@ -168,16 +168,13 @@
 
           CASE ( 'before_timestep', 'after_integration', 'after_timestep' )
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ user_actions: location "', location, '" is not ', &
+             message_string = 'location "' // location // '" is not ' // &
                              'allowed to be called with parameters "i" and "j"'
-             ENDIF
-             CALL local_stop
+             CALL message( 'user_actions', 'UI0002', 1, 2, 0, 6, 0 )
 
 
           CASE DEFAULT
-             IF ( myid == 0 )  PRINT*, '+++ user_actions: unknown location "', &
-                                       location, '"'
-             CALL local_stop
-
+             message_string = 'unknown location "' // location // '"'
+             CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 )
+             
 
        END SELECT
Index: palm/trunk/SOURCE/user_data_output_dvrp.f90
===================================================================
--- palm/trunk/SOURCE/user_data_output_dvrp.f90	(revision 257)
+++ palm/trunk/SOURCE/user_data_output_dvrp.f90	(revision 258)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! Clipping implemented
 !
@@ -58,8 +59,8 @@
 !--       wrong character string that is neither recognized in data_output_dvrp
 !--       nor here in user_data_output_dvrp.
-          IF ( myid == 0 )  THEN
-             PRINT*,'+++ (user_)data_output_dvrp: no output possible for: ', &
-                  output_variable
-          ENDIF
+          WRITE( message_string, * ) 'no output possible for: ', &
+                                     output_variable
+          CALL message( 'user_data_output_dvrp', 'UI0003', 0, 0, 0, 6, 0 )
+          
 
     END SELECT
Index: palm/trunk/SOURCE/user_dvrp_coltab.f90
===================================================================
--- palm/trunk/SOURCE/user_dvrp_coltab.f90	(revision 257)
+++ palm/trunk/SOURCE/user_dvrp_coltab.f90	(revision 258)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -17,5 +18,6 @@
 ! Definition of the colour table to be used by the dvrp software.
 !------------------------------------------------------------------------------!
-
+    
+    USE control_parameters
     USE dvrp_variables
     USE pegrid
@@ -37,7 +39,7 @@
 
        CASE DEFAULT
-          IF ( myid == 0 )  PRINT*, '+++ user_dvrp_coltab: unknown mode "', &
-                                    mode, '"'
-          CALL local_stop
+          message_string = 'unknown mode "' // mode // '"'
+          CALL message( 'user_dvrp_coltab', 'UI0004', 1, 2, 0, 6, 0 )
+
 
     END SELECT
Index: palm/trunk/SOURCE/user_init_grid.f90
===================================================================
--- palm/trunk/SOURCE/user_init_grid.f90	(revision 257)
+++ palm/trunk/SOURCE/user_init_grid.f90	(revision 258)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! add 'single_street_canyon' as standard topography case
 ! -topography_grid_convention
@@ -48,7 +49,6 @@
 !--       Here the user can define his own topography.
 !--       After definition, please remove the following three lines!
-          PRINT*, '+++ user_init_grid: topography "', &
-               topography, '" not available yet'
-          CALL local_stop
+          message_string = 'topography "' // topography // '" not available yet'
+          CALL message( 'user_init_grid', 'UI0005', 1, 2, 0, 6, 0 )
 
        CASE DEFAULT
@@ -57,7 +57,6 @@
 !--       wrong character string that is neither recognized in init_grid nor 
 !--       here in user_init_grid.
-          PRINT*, '+++ (user_)init_grid: unknown topography "', &
-               topography, '"'
-          CALL local_stop
+          message_string = 'unknown topography "' // topography // '"'
+          CALL message( 'user_init_grid', 'UI0006', 1, 2, 0, 6, 0 )
 
     END SELECT
Index: palm/trunk/SOURCE/user_init_plant_canopy.f90
===================================================================
--- palm/trunk/SOURCE/user_init_plant_canopy.f90	(revision 257)
+++ palm/trunk/SOURCE/user_init_plant_canopy.f90	(revision 258)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -59,7 +60,7 @@
 !--       After definition, please
 !--       remove the following three lines!
-          PRINT*, '+++ user_init_plant_canopy: canopy_mode "', &
-               canopy_mode, '" not available yet'
-
+          message_string = 'canopy_mode "' // canopy_mode // '" not available yet'
+          CALL message( 'user_init_plant_canopy', 'UI0007', 0, 1, 0, 6, 0 )
+          
        CASE DEFAULT
 !
@@ -67,7 +68,6 @@
 !--       wrong character string that is neither recognized in init_3d_model nor 
 !--       here in user_init_plant_canopy.
-          PRINT*, '+++ user_init_plant_canopy: unknown canopy_mode "', &
-               canopy_mode, '"'
-          CALL local_stop
+          message_string = 'unknown canopy_mode "' // canopy_mode // '"'
+          CALL message( 'user_init_plant_canopy', 'UI0008', 1, 2, 0, 6, 0 )
 
     END SELECT
Index: palm/trunk/SOURCE/user_parin.f90
===================================================================
--- palm/trunk/SOURCE/user_parin.f90	(revision 257)
+++ palm/trunk/SOURCE/user_parin.f90	(revision 258)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! topography_grid_convention moved to inipar
 !
@@ -74,10 +75,10 @@
     IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
        IF ( max_pr_user /= max_pr_user_tmp )  THEN
-          PRINT*, '+++ user_parin: the number of user-defined profiles given in'
-          PRINT*, '                data_output_pr (', max_pr_user_tmp, ' doe', &
-                                   's not match the one'
-          PRINT*, '                found in the restart file (', max_pr_user, &
-                                   ')'
-          CALL local_stop
+          WRITE( message_string, * ) 'the number of user-defined profiles given in ', &
+                                     '&data_output_pr (', max_pr_user_tmp, ') doe',    &
+                                     'snot match the one ',                           &
+                                     '&found in the restart file (', max_pr_user,     &
+                                     ')'
+          CALL message( 'user_parin', 'UI0009', 1, 2, 0, 6, 0 )
        ENDIF
     ELSE
Index: palm/trunk/SOURCE/user_read_restart_data.f90
===================================================================
--- palm/trunk/SOURCE/user_read_restart_data.f90	(revision 257)
+++ palm/trunk/SOURCE/user_read_restart_data.f90	(revision 258)
@@ -5,7 +5,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine.
+!
 !
 ! Former revisions:
@@ -81,8 +82,8 @@
 !
 !                CASE DEFAULT
-!                   PRINT*, '+++ user_init: unknown variable named "', &
-!                           TRIM( field_char ), '" found in'
-!                   PRINT*, '               data from prior run on PE ', myid
-!                   CALL local_stop
+!                   WRITE( message_string, * ) 'unknown variable named "',        &
+!                                               TRIM( field_char ), '" found in', &
+!                                              '&data from prior run on PE ', myid
+!                   CALL message( 'user_spectra', 'UI0012', 1, 2, 0, 6, 0 )
 !
 !             END SELECT
Index: palm/trunk/SOURCE/user_spectra.f90
===================================================================
--- palm/trunk/SOURCE/user_spectra.f90	(revision 257)
+++ palm/trunk/SOURCE/user_spectra.f90	(revision 258)
@@ -2,7 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine. 
 !
 ! Former revisions:
@@ -21,4 +21,5 @@
 
     USE arrays_3d
+    USE control_parameters
     USE indices
     USE spectrum
@@ -52,7 +53,8 @@
        
           CASE DEFAULT
-             PRINT*, '+++ user_spectra/preprocess: Spectra of ', &
-                  TRIM( data_output_sp(m) ), ' can not be calculated'
-          
+             message_string = 'Spectra of ' // &
+                              TRIM( data_output_sp(m) ) // ' can not be calculated'
+             CALL message( 'user_spectra', 'UI0010', 0, 0, 0, 6, 0 )
+            
        END SELECT
 
@@ -69,7 +71,8 @@
 
           CASE DEFAULT
-             PRINT*, '+++ user_spectra/data_output: Spectra of ', &
-                          TRIM( data_output_sp(m) ), ' are not defined'
-
+             message_string = 'Spectra of ' //  &
+                              TRIM( data_output_sp(m) ) // ' are not defined'
+             CALL message( 'user_spectra', 'UI0011', 0, 0, 0, 6, 0 )
+             
           END SELECT
 
