Index: /palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/check_parameters.f90	(revision 213)
+++ /palm/trunk/SOURCE/check_parameters.f90	(revision 214)
@@ -403,37 +403,34 @@
     IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ups-scheme' ) &
     THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters:  unknown advection ', &
-                                 'scheme: momentum_advec=', momentum_advec
-       CALL local_stop
+       message_string = 'unknown advection scheme: momentum_advec = "' // &
+                        TRIM( momentum_advec ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0022', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( ( momentum_advec == 'ups-scheme'  .OR.  scalar_advec == 'ups-scheme' )&
                                       .AND.  timestep_scheme /= 'euler' )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters:  momentum_advec=', &
-                                 momentum_advec, ' is not allowed with ', &
-                                 'timestep_scheme=', timestep_scheme
-       CALL local_stop
+       message_string = 'momentum_advec = "' // TRIM( momentum_advec ) // &
+                        '" is not allowed with timestep_scheme = "' //    &
+                        TRIM( timestep_scheme ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0023', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( scalar_advec /= 'pw-scheme'  .AND.  scalar_advec /= 'bc-scheme'  .AND.&
          scalar_advec /= 'ups-scheme' )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters:  unknown advection ', &
-                                 'scheme: scalar_advec=', scalar_advec
-       CALL local_stop
+       message_string = 'unknown advection scheme: scalar_advec = "' // &
+                        TRIM( scalar_advec ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0024', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( use_sgs_for_particles  .AND.  .NOT. use_upstream_for_tke )  THEN
        use_upstream_for_tke = .TRUE.
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ WARNING: check_parameters:  use_upstream_for_tke set ', &
-                       '.TRUE. because use_sgs_for_particles = .TRUE.'
-       ENDIF
+       message_string = 'use_upstream_for_tke set .TRUE. because ' // &
+                        'use_sgs_for_particles = .TRUE.'
+       CALL handle_palm_message( 'check_parameters', 'PA0025', 0, 1, 0, 6, 0 )
     ENDIF
 
     IF ( use_upstream_for_tke  .AND.  timestep_scheme(1:8) == 'leapfrog' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:  use_upstream_for_tke = .TRUE. ', &
-                       'not allowed with timestep_scheme=', timestep_scheme
-       ENDIF
-       CALL local_stop
+       message_string = 'use_upstream_for_tke = .TRUE. not allowed with ' // &
+                        'timestep_scheme = "' // TRIM( timestep_scheme ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0026', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -458,7 +455,8 @@
 
        CASE DEFAULT
-          IF ( myid == 0 )  PRINT*, '+++ check_parameters:  unknown timestep ',&
-                                    'scheme: timestep_scheme=', timestep_scheme
-          CALL local_stop
+          message_string = 'unknown timestep scheme: timestep_scheme = "' // &
+                           TRIM( timestep_scheme ) // '"'
+          CALL handle_palm_message( 'check_parameters', 'PA0027', 1, 2, 0, 6, &
+                                    0 )
 
     END SELECT
@@ -466,31 +464,16 @@
     IF ( scalar_advec == 'ups-scheme'  .AND.  timestep_scheme(1:5) == 'runge' )&
     THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:  scalar advection scheme "', &
-                                          TRIM( scalar_advec ), '"'
-          PRINT*, '    does not work with timestep_scheme "', &
-                                          TRIM( timestep_scheme ), '"'
-       ENDIF
-       CALL local_stop
+       message_string = 'scalar advection scheme "' // TRIM( scalar_advec ) // &
+                        '" & does not work with timestep_scheme "' // &
+                        TRIM( timestep_scheme ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0028', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( momentum_advec /= 'pw-scheme' .AND. timestep_scheme(1:5) == 'runge' ) &
     THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check_parameters:  momentum advection scheme "', &
-                                          TRIM( momentum_advec ), '"'
-          PRINT*, '    does not work with timestep_scheme "', &
-                                          TRIM( timestep_scheme ), '"'
-       ENDIF
-       CALL local_stop
-    ENDIF
-
-
-    IF ( initializing_actions == ' ' )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ check parameters:'
-          PRINT*, '    no value found for initializing_actions'
-       ENDIF
-       CALL local_stop
+       message_string = 'momentum advection scheme "' // &
+                        TRIM( momentum_advec ) // '" & does not work with ' // &
+                        'timestep_scheme "' // TRIM( timestep_scheme ) // '"'
+       CALL handle_palm_message( 'check_parameters', 'PA0029', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -498,5 +481,5 @@
          TRIM( initializing_actions ) /= 'read_data_for_recycling' )  THEN
 !
-!--    No model continuation run; several initialising actions are possible
+!--    No restart run: several initialising actions are possible
        action = initializing_actions
        DO WHILE ( TRIM( action ) /= '' )
@@ -509,85 +492,80 @@
 
              CASE DEFAULT
-                IF ( myid == 0 )  PRINT*, '+++ check_parameters: initializi', &
-                               'ng_action unkown or not allowed: action = "', &
-                               TRIM(action), '"'
-                CALL local_stop
+                message_string = 'initializing_action = "' // &
+                                 TRIM( action ) // '" unkown or not allowed'
+                CALL handle_palm_message( 'check_parameters', 'PA0030', 1, 2, &
+                                          0, 6, 0 )
 
           END SELECT
        ENDDO
     ENDIF
+
     IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0  .AND. &
          INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: initializing_actions', &
-          '"set_constant_profiles" and "set_1d-model_profiles" are not', &
-          ' allowed simultaneously'
-       CALL local_stop
-    ENDIF
+       message_string = 'initializing_actions = "set_constant_profiles"' // &
+                        ' and "set_1d-model_profiles" are not allowed ' //  &
+                        'simultaneously'
+       CALL handle_palm_message( 'check_parameters', 'PA0031', 1, 2, 0, 6, 0 )
+    ENDIF
+
     IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0  .AND. &
          INDEX( initializing_actions, 'by_user' ) /= 0 )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: initializing_actions', &
-          '"set_constant_profiles" and "by_user" are not', &
-          ' allowed simultaneously'
-       CALL local_stop
-    ENDIF
+       message_string = 'initializing_actions = "set_constant_profiles"' // &
+                        ' and "by_user" are not allowed simultaneously'
+       CALL handle_palm_message( 'check_parameters', 'PA0032', 1, 2, 0, 6, 0 )
+    ENDIF
+
     IF ( INDEX( initializing_actions, 'by_user' ) /= 0  .AND. &
          INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: initializing_actions', &
-          '"by_user" and "set_1d-model_profiles" are not', &
-          ' allowed simultaneously'
-       CALL local_stop
+       message_string = 'initializing_actions = "by_user" and ' // &
+                        '"set_1d-model_profiles" are not allowed simultaneously'
+       CALL handle_palm_message( 'check_parameters', 'PA0033', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( cloud_physics  .AND.  .NOT. humidity )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: cloud_physics =', &
-                                 cloud_physics, ' is not allowed with ',  &
-                                 'humidity =', humidity
-       CALL local_stop
+       WRITE( message_string, * ) 'cloud_physics = ', cloud_physics, ' is ', &
+              'not allowed with humidity = ', humidity
+       CALL handle_palm_message( 'check_parameters', 'PA0034', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( precipitation  .AND.  .NOT.  cloud_physics )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: precipitation =', &
-                                 precipitation, ' is not allowed with ',  &
-                                 'cloud_physics =', cloud_physics
-       CALL local_stop
+       WRITE( message_string, * ) 'precipitation = ', precipitation, ' is ', &
+              'not allowed with cloud_physics = ', cloud_physics
+       CALL handle_palm_message( 'check_parameters', 'PA0035', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( humidity  .AND.  sloping_surface )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: humidity = TRUE', &
-                                 'and hang = TRUE are not',               &
-                                 ' allowed simultaneously' 
-       CALL local_stop       
+       message_string = 'humidity = .TRUE. and sloping_surface = .TRUE. ' // &
+                        'are not allowed simultaneously'
+       CALL handle_palm_message( 'check_parameters', 'PA0036', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( humidity  .AND.  scalar_advec == 'ups-scheme' )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: UPS-scheme', &
-                                 'is not implemented for humidity'
-       CALL local_stop       
+       message_string = 'UPS-scheme is not implemented for humidity = .TRUE.'
+       CALL handle_palm_message( 'check_parameters', 'PA0037', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( passive_scalar  .AND.  humidity )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: humidity = TRUE and', &
-                                 'passive_scalar = TRUE is not allowed ',     &
-                                 'simultaneously'
-       CALL local_stop
+       message_string = 'humidity = .TRUE. and passive_scalar = .TRUE. ' // &
+                        'is not allowed simultaneously'
+       CALL handle_palm_message( 'check_parameters', 'PA0038', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( passive_scalar  .AND.  scalar_advec == 'ups-scheme' )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: UPS-scheme', &
-                                 'is not implemented for passive_scalar'
-       CALL local_stop       
+       message_string = 'UPS-scheme is not implemented for passive_scalar' // &
+                        ' = .TRUE.'
+       CALL handle_palm_message( 'check_parameters', 'PA0039', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( grid_matching /= 'strict'  .AND.  grid_matching /= 'match' )  THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: illegal value "', &
-                                 TRIM( grid_matching ),                   &
-                                 '" found for parameter grid_matching'
-       CALL local_stop       
+       message_string = 'illegal value "' // TRIM( grid_matching ) // &
+                        '" found for parameter grid_matching'
+       CALL handle_palm_message( 'check_parameters', 'PA0040', 1, 2, 0, 6, 0 )
     ENDIF
 
     IF ( plant_canopy .AND. ( drag_coefficient == 0.0 ) ) THEN
-       IF ( myid == 0 )  PRINT*, '+++ check_parameters: plant_canopy = TRUE', &
-                                 'requires a non-zero drag_coefficient'
-       CALL local_stop
+       message_string = 'plant_canopy = .TRUE. requires a non-zero drag ' // &
+                        'coefficient & given value is drag_coefficient = 0.0'
+       CALL handle_palm_message( 'check_parameters', 'PA0041', 1, 2, 0, 6, 0 )
     ENDIF 
 
