Index: palm/trunk/DOC/tec/message_identifiers
===================================================================
--- palm/trunk/DOC/tec/message_identifiers	(revision 246)
+++ palm/trunk/DOC/tec/message_identifiers	(revision 247)
@@ -245,4 +245,26 @@
     PA0157           nonzero bulk velocity requires conserve_volume_flow = .T. and 
                       conserve_volume_flow_mode = ''bulk_velocity''
+    PA0158           no vertical boundary condition for variable "..." 
+    PA0159           no term for component "..."
+    PA0160           non-cyclic lateral boundaries along x do not allow 
+                      calculation of spectra along x
+    PA0161           sorry, calculation of spectra in non parallel mode is 
+                      still not realized
+    PA0162           non-cyclic lateral boundaries along y do not allow 
+                      calculation of spectra along y
+    PA0163           run will be terminated because it is running out of 
+                      job cpu limit remaining time: ... s 
+                      termination time needed: ... s
+    PA0164           run will be terminated due to user settings of 
+                      restart_time / dt_restart new restart time is: ... s 
+    PA0165           re-open of unit 14 is not verified. Please check results!
+    PA0166           re-opening of file-id ... is not allowed
+    PA0167           opening file-id ... not allowed for PE ...
+    PA0168           opening file-id ... is not allowed since it is used otherwise
+    PA0169           no filename for AVS-data-file found in MRUN-config-file 
+                      filename in FLD-file set to "unknown"
+    PA0170           no path for batch_scp on host "..."  
+    PA0171           NetCDF: no 64-bit offset allowed on this machine
+    PA0172           no OPEN-statement for file-id ...
 
     UI0001           The value for "topography_grid_convention" is not set. 
Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 246)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 247)
@@ -26,5 +26,5 @@
 First constant in array den also defined as type double. (eqn_state_seawater)
 
-advec_particles, eqn_state_seawater, sort_particles
+advec_particles, advec_s_bc, buoyancy, calc_spectra, check_for_restart, check_open, eqn_state_seawater, sort_particles
 
 
Index: palm/trunk/SOURCE/advec_s_bc.f90
===================================================================
--- palm/trunk/SOURCE/advec_s_bc.f90	(revision 246)
+++ palm/trunk/SOURCE/advec_s_bc.f90	(revision 247)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine
+!
 !
 ! Former revisions:
@@ -840,8 +841,8 @@
     ELSE
 
-       IF ( myid == 0 )  PRINT*,'+++ advec_s_bc:  no vertical boundary condi', &
+       WRITE( message_string, * ) 'no vertical boundary condi', &
                                 'tion for variable "', sk_char, '"'
-       CALL local_stop
-
+       CALL message( 'advec_s_bc', 'PA0158', 1, 2, 0, 6, 0 )
+      
     ENDIF
 
Index: palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- palm/trunk/SOURCE/buoyancy.f90	(revision 246)
+++ palm/trunk/SOURCE/buoyancy.f90	(revision 247)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Currrent revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine
+!
 !
 ! Former revisions:
@@ -137,8 +138,8 @@
 
           ELSE
-
-             IF ( myid == 0 )  PRINT*, '+++ buoyancy: no term for component "',&
+             
+             WRITE( message_string, * ) 'no term for component "',&
                                        wind_component,'"'
-             CALL local_stop
+             CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
 
           ENDIF
@@ -213,7 +214,7 @@
           ELSE
 
-             IF ( myid == 0 )  PRINT*, '+++ buoyancy: no term for component "',&
+             WRITE( message_string, * ) 'no term for component "',&
                                        wind_component,'"'
-             CALL local_stop
+             CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
 
           ENDIF
Index: palm/trunk/SOURCE/calc_spectra.f90
===================================================================
--- palm/trunk/SOURCE/calc_spectra.f90	(revision 246)
+++ palm/trunk/SOURCE/calc_spectra.f90	(revision 247)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine
+!
 !
 ! Former revisions:
@@ -83,10 +84,8 @@
 !--       Calculation of spectra works for cyclic boundary conditions only
           IF ( bc_lr /= 'cyclic' )  THEN
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ calc_spectra:'
-                PRINT*, '    non-cyclic lateral boundaries along x do not ', &
-                             'allow calculation of spectra along x' 
-             ENDIF
-             CALL local_stop
+
+             message_string = 'non-cyclic lateral boundaries along x do not ' // &
+                              '& allow calculation of spectra along x'
+             CALL message( 'calc_spectra', 'PA0160', 1, 2, 0, 6, 0 )
           ENDIF
 
@@ -101,8 +100,7 @@
           CALL calc_spectra_x( d, pr, m )
 #else
-          PRINT*, '+++ calc_spectra: sorry, calculation of spectra ', &
-                                    'in non parallel mode'
-          PRINT*, '                  is still not realized'
-          CALL local_stop
+          message_string = 'sorry, calculation of spectra in non parallel mode' // &
+                           '& is still not realized'
+          CALL message( 'calc_spectra', 'PA0161', 1, 2, 0, 6, 0 )      
 #endif
 
@@ -118,7 +116,7 @@
           IF ( bc_ns /= 'cyclic' )  THEN
              IF ( myid == 0 )  THEN
-                PRINT*, '+++ calc_spectra:'
-                PRINT*, '    non-cyclic lateral boundaries along y do not ', &
-                             'allow calculation of spectra along y' 
+                message_string = 'non-cyclic lateral boundaries along y do not ' // &
+                                 '& allow calculation of spectra along y' 
+                CALL message( 'calc_spectra', 'PA0162', 1, 2, 0, 6, 0 )
              ENDIF
              CALL local_stop
@@ -131,8 +129,7 @@
           CALL calc_spectra_y( d, pr, m )
 #else
-          PRINT*, '+++ calc_spectra: sorry, calculation of spectra', &
-                                    'in non parallel mode'
-          PRINT*, '                  still not realized'
-          CALL local_stop
+          message_string = 'sorry, calculation of spectra in non parallel mode' // &
+                           '& is still not realized'
+          CALL message( 'calc_spectra', 'PA0161', 1, 2, 0, 6, 0 )
 #endif
 
Index: palm/trunk/SOURCE/check_for_restart.f90
===================================================================
--- palm/trunk/SOURCE/check_for_restart.f90	(revision 246)
+++ palm/trunk/SOURCE/check_for_restart.f90	(revision 247)
@@ -2,7 +2,8 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine
+!
 !
 ! Former revisions:
@@ -68,9 +69,9 @@
 !-- Output that job will be terminated
     IF ( terminate_run  .AND.  myid == 0 )  THEN
-       PRINT*, '*** WARNING: run will be terminated because it is running', &
-                    ' out of job cpu limit'
-       PRINT*, '             remaining time:         ', remaining_time, ' s'
-       PRINT*, '             termination time needed:', &
-                             termination_time_needed, ' s'
+       WRITE( message_string, * ) 'run will be terminated because it is running', &
+                                  ' out of job cpu limit & '&
+                                  'remaining time:         ', remaining_time, ' s', &
+                                  'termination time needed:', termination_time_needed, ' s'
+       CALL message( 'check_for_restart', 'PA0163', 0, 1, 0, 6, 0 )
     ENDIF
 
@@ -111,11 +112,10 @@
           ENDIF
 
-          IF ( myid == 0 )  THEN
-             PRINT*, '*** INFORMATIVE: run will be terminated due to user ', &
-                                       'settings of'
-             PRINT*, '                 restart_time / dt_restart'
-             PRINT*, '                 new restart time is: ', time_restart, &
-                                       ' s'
-          ENDIF
+          WRITE( message_string, * ) 'run will be terminated due to user ', &
+                                     'settings of', &
+                                     '&restart_time / dt_restart',&
+                                     '&new restart time is: ', time_restart, ' s' 
+          CALL message( 'check_for_restart', 'PA0164', 0, 0, 0, 6, 0 )                      
+ 
 !
 !--       In case of coupled runs inform the remote model of the termination 
Index: palm/trunk/SOURCE/check_open.f90
===================================================================
--- palm/trunk/SOURCE/check_open.f90	(revision 246)
+++ palm/trunk/SOURCE/check_open.f90	(revision 247)
@@ -1,8 +1,9 @@
- SUBROUTINE check_open( file_id )
+SUBROUTINE check_open( file_id )
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
-! 
+! Output of messages replaced by message handling routine
+!
 !
 ! Former revisions:
@@ -99,13 +100,14 @@
           CASE ( 13, 14, 21, 22, 23, 80:85 )
              IF ( file_id == 14 .AND. openfile(file_id)%opened_before )  THEN
-                IF ( myid == 0 )  PRINT*, '+++ check_open: re-open of unit ', &
-                                   ' 14 is not verified. Please check results!'
+                message_string = 're-open of unit ' // &
+                                 ' 14 is not verified. Please check results!'
+                CALL message( 'check_open', 'PA0165', 0, 1, 0, 6, 0 )       
              ENDIF
 
           CASE DEFAULT
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ check_open: re-opening of file-id ', file_id, &
-                        ' is not allowed'
-             ENDIF
+             WRITE( message_string, * ) 're-opening of file-id ', file_id, &
+                                           ' is not allowed'
+             CALL message( 'check_open', 'PA0166', 0, 1, 0, 6, 0 )    
+               
              RETURN
 
@@ -119,13 +121,9 @@
        CASE ( 15, 16, 17, 18, 19, 40:49, 50:59, 81:84, 101:107, 109, 111:113, &
               116 )
-
+          
           IF ( myid /= 0 )  THEN
-             PRINT*,'+++ check_open: opening file-id ',file_id, &
-                    ' not allowed for PE ',myid
-#if defined( __parallel )
-             CALL MPI_ABORT( comm2d, 9999, ierr )
-#else
-             CALL local_stop
-#endif
+             WRITE( message_string, * ) 'opening file-id ',file_id, &
+                                        ' not allowed for PE ',myid
+             CALL message( 'check_open', 'PA0167', 2, 2, 0, 6, 0 )
           ENDIF
 
@@ -134,12 +132,8 @@
           IF ( .NOT.  data_output_2d_on_each_pe )  THEN
              IF ( myid /= 0 )  THEN
-                PRINT*,'+++ check_open: opening file-id ',file_id, &
-                       ' not allowed for PE ',myid
-#if defined( __parallel )
-                CALL MPI_ABORT( comm2d, 9999, ierr )
-#else
-                CALL local_stop
-#endif
-             ENDIF
+                WRITE( message_string, * ) 'opening file-id ',file_id, &
+                                           ' not allowed for PE ',myid
+                CALL message( 'check_open', 'PA0167', 2, 2, 0, 6, 0 )
+             END IF
           ENDIF
 
@@ -148,7 +142,8 @@
 !
 !--       File-ids that are used temporarily in other routines
-          PRINT*,'+++ check_open: opening file-id ',file_id, &
-                 ' is not allowed since it is used otherwise'
-
+          WRITE( message_string, * ) 'opening file-id ',file_id, &
+                                     ' is not allowed since it is used otherwise'
+          CALL message( 'check_open', 'PA0168', 0, 1, 0, 6, 0 ) 
+          
     END SELECT
 
@@ -409,8 +404,8 @@
                 IF ( .NOT. avs_coor_file_found  .OR. &
                      .NOT. avs_data_file_found )  THEN
-                   PRINT*, '+++ check_open: no filename for AVS-data-file ', &
-                             'found in MRUN-config-file'
-                   PRINT*, '                filename in FLD-file set to ', &
-                             '"unknown"'
+                   message_string= 'no filename for AVS-data-file ' // &
+                                   'found in MRUN-config-file' // &
+                                   ' &filename in FLD-file set to "unknown"'
+                   CALL message( 'check_open', 'PA0169', 0, 1, 0, 6, 0 )
 
                    avs_coor_file = 'unknown'
@@ -429,6 +424,7 @@
                       batch_scp = '/home/nhbksira/pub/batch_scp'
                    ELSE
-                      PRINT*,'+++ check_open: no path for batch_scp on host "',&
-                             TRIM( host ), '"'
+                      message_string= 'no path for batch_scp on host "' // &
+                                       TRIM( host ) // '"'
+                      CALL message( 'check_open', 'PA0170', 0, 1, 0, 6, 0 )
                       get_filenames = .FALSE.
                    ENDIF
@@ -727,6 +723,7 @@
                                        id_set_xy(av) )
 #else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xy(av) )
 #endif
@@ -787,6 +784,7 @@
                                        id_set_xz(av) )
 #else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+         
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xz(av) )
 #endif
@@ -847,6 +845,7 @@
                                        id_set_yz(av) )
 #else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+                
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_yz(av) )
 #endif
@@ -900,7 +899,8 @@
                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
                                        id_set_pr )
-#else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+#else 
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+                
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pr )
 #endif
@@ -954,7 +954,8 @@
                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
                                        id_set_ts )
-#else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+#else 
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+                
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_ts )
 #endif
@@ -1015,7 +1016,8 @@
                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
                                        id_set_3d(av) )
-#else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+#else 
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+                
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_3d(av) )
 #endif
@@ -1070,7 +1072,8 @@
                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
                                        id_set_sp )
-#else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+#else 
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+               
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_sp )
 #endif
@@ -1146,6 +1149,7 @@
                                        id_set_prt )
 #else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+                
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_prt )
 #endif
@@ -1201,6 +1205,7 @@
                                        id_set_pts )
 #else
-                IF ( myid == 0 )  PRINT*, '+++ WARNING: NetCDF: no 64-bit ', &
-                                               'offset allowed on this machine'
+                message_string = 'NetCDF: no 64-bit offset allowed on this machine'
+                CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )
+                
                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pts )
 #endif
@@ -1226,10 +1231,6 @@
        CASE DEFAULT
 
-          PRINT*,'+++ check_open: no OPEN-statement for file-id ',file_id
-#if defined( __parallel )
-          CALL MPI_ABORT( comm2d, 9999, ierr )
-#else
-          CALL local_stop
-#endif
+          WRITE( message_string, * ) 'no OPEN-statement for file-id ',file_id
+          CALL message( 'check_open', 'PA0172', 2, 2, 0, 6, 0 )
 
     END SELECT
