source: palm/trunk/SOURCE/check_parameters.f90 @ 388

Last change on this file since 388 was 388, checked in by raasch, 15 years ago

in-situ AND potential density are calculated and used in the ocean version

  • Property svn:keywords set to Id
File size: 119.8 KB
Line 
1 SUBROUTINE check_parameters
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
6! Check profiles fpr prho and hyp.
7! Bugfix: output of averaged 2d/3d quantities requires that an avaraging
8! interval has been set, respective error message is included
9! bc_lr_cyc and bc_ns_cyc are set,
10! initializing_actions='read_data_for_recycling' renamed to 'cyclic_fill'
11! Check for illegal entries in section_xy|xz|yz that exceed nz+1|ny+1|nx+1
12! Coupling with independent precursor runs.
13! Check particle_color, particle_dvrpsize, color_interval, dvrpsize_interval
14! Bugfix: pressure included for profile output
15! Check pressure gradient conditions
16! topography_grid_convention moved from user_check_parameters
17! 'single_street_canyon'
18! Added shf* and qsws* to the list of available output data
19!
20! Former revisions:
21! -----------------
22! $Id: check_parameters.f90 388 2009-09-23 09:40:33Z raasch $
23!
24! 222 2009-01-12 16:04:16Z letzel
25! +user_check_parameters
26! Output of messages replaced by message handling routine.
27! Implementation of an MPI-1 coupling: replaced myid with target_id,
28! deleted __mpi2 directives
29! Check that PALM is called with mrun -K parallel for coupling
30!
31! 197 2008-09-16 15:29:03Z raasch
32! Bug fix: Construction of vertical profiles when 10 gradients have been
33! specified in the parameter list (ug, vg, pt, q, sa, lad)
34!   
35! Strict grid matching along z is not needed for mg-solver.
36! Leaf area density (LAD) explicitly set to its surface value at k=0
37! Case of reading data for recycling included in initializing_actions,
38! check of turbulent_inflow and calculation of recycling_plane.
39! q*2 profile added
40!
41! 138 2007-11-28 10:03:58Z letzel
42! Plant canopy added
43! Allow new case bc_uv_t = 'dirichlet_0' for channel flow.
44! Multigrid solver allows topography, checking of dt_sort_particles
45! Bugfix: initializing u_init and v_init in case of ocean runs
46!
47! 109 2007-08-28 15:26:47Z letzel
48! Check coupling_mode and set default (obligatory) values (like boundary
49! conditions for temperature and fluxes) in case of coupled runs.
50! +profiles for w*p* and w"e
51! Bugfix: Error message concerning output of particle concentration (pc)
52! modified
53! More checks and more default values for coupled runs
54! allow data_output_pr= q, wq, w"q", w*q* for humidity = .T. (instead of
55! cloud_physics = .T.)
56! Rayleigh damping for ocean fixed.
57! Check and, if necessary, set default value for dt_coupling
58!
59! 97 2007-06-21 08:23:15Z raasch
60! Initial salinity profile is calculated, salinity boundary conditions are
61! checked,
62! z_max_do1d is checked only in case of ocean = .f.,
63! +initial temperature and geostrophic velocity profiles for the ocean version,
64! use_pt_reference renamed use_reference
65!
66! 89 2007-05-25 12:08:31Z raasch
67! Check for user-defined profiles
68!
69! 75 2007-03-22 09:54:05Z raasch
70! "by_user" allowed as initializing action, -data_output_ts,
71! leapfrog with non-flat topography not allowed any more, loop_optimization
72! and pt_reference are checked, moisture renamed humidity,
73! output of precipitation amount/rate and roughnes length + check
74! possible negative humidities are avoided in initial profile,
75! dirichlet/neumann changed to dirichlet/radiation, etc.,
76! revision added to run_description_header
77!
78! 20 2007-02-26 00:12:32Z raasch
79! Temperature and humidity gradients at top are now calculated for nzt+1,
80! top_heatflux and respective boundary condition bc_pt_t is checked
81!
82! RCS Log replace by Id keyword, revision history cleaned up
83!
84! Revision 1.61  2006/08/04 14:20:25  raasch
85! do2d_unit and do3d_unit now defined as 2d-arrays, check of
86! use_upstream_for_tke, default value for dt_dopts,
87! generation of file header moved from routines palm and header to here
88!
89! Revision 1.1  1997/08/26 06:29:23  raasch
90! Initial revision
91!
92!
93! Description:
94! ------------
95! Check control parameters and deduce further quantities.
96!------------------------------------------------------------------------------!
97
98    USE arrays_3d
99    USE constants
100    USE control_parameters
101    USE dvrp_variables
102    USE grid_variables
103    USE indices
104    USE model_1d
105    USE netcdf_control
106    USE particle_attributes
107    USE pegrid
108    USE profil_parameter
109    USE statistics
110    USE transpose_indices
111
112    IMPLICIT NONE
113
114    CHARACTER (LEN=1)   ::  sq
115    CHARACTER (LEN=6)   ::  var
116    CHARACTER (LEN=7)   ::  unit
117    CHARACTER (LEN=8)   ::  date
118    CHARACTER (LEN=10)  ::  time
119    CHARACTER (LEN=40)  ::  coupling_string
120    CHARACTER (LEN=100) ::  action
121
122    INTEGER ::  i, ilen, intervals, iremote = 0, iter, j, k, nnxh, nnyh, &
123         position, prec
124    LOGICAL ::  found, ldum
125    REAL    ::  gradient, maxn, maxp, remote = 0.0, &
126                simulation_time_since_reference
127
128!
129!-- Warning, if host is not set
130    IF ( host(1:1) == ' ' )  THEN
131       message_string = '"host" is not set. Please check that environment ' // &
132                        'variable "localhost" & is set before running PALM'
133       CALL message( 'check_parameters', 'PA0001', 0, 0, 0, 6, 0 )
134    ENDIF
135
136!
137!-- Check the coupling mode
138    IF ( coupling_mode /= 'uncoupled'            .AND.  &
139         coupling_mode /= 'atmosphere_to_ocean'  .AND.  &
140         coupling_mode /= 'ocean_to_atmosphere' )  THEN
141       message_string = 'illegal coupling mode: ' // TRIM( coupling_mode )
142       CALL message( 'check_parameters', 'PA0002', 1, 2, 0, 6, 0 )
143    ENDIF
144
145!
146!-- Check dt_coupling, restart_time, dt_restart, end_time, dx, dy, nx and ny
147    IF ( coupling_mode /= 'uncoupled' )  THEN
148
149       IF ( dt_coupling == 9999999.9 )  THEN
150          message_string = 'dt_coupling is not set but required for coup' // &
151                           'ling mode "' //  TRIM( coupling_mode ) // '"'
152          CALL message( 'check_parameters', 'PA0003', 1, 2, 0, 6, 0 )
153       ENDIF
154
155#if defined( __parallel )
156       CALL MPI_SEND( dt_coupling, 1, MPI_REAL, target_id, 11, comm_inter, &
157                      ierr )
158       CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 11, comm_inter, &
159                      status, ierr )
160       IF ( dt_coupling /= remote )  THEN
161          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
162                 '": dt_coupling = ', dt_coupling, '& is not equal to ',       &
163                 'dt_coupling_remote = ', remote
164          CALL message( 'check_parameters', 'PA0004', 1, 2, 0, 6, 0 )
165       ENDIF
166       IF ( dt_coupling <= 0.0 )  THEN
167          CALL MPI_SEND( dt_max, 1, MPI_REAL, target_id, 19, comm_inter, ierr )
168          CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 19, comm_inter, &
169                         status, ierr )
170          dt_coupling = MAX( dt_max, remote )
171          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
172                 '": dt_coupling <= 0.0 & is not allowed and is reset to ',    &
173                 'MAX(dt_max(A,O)) = ', dt_coupling
174          CALL message( 'check_parameters', 'PA0005', 0, 1, 0, 6, 0 )
175       ENDIF
176
177       CALL MPI_SEND( restart_time, 1, MPI_REAL, target_id, 12, comm_inter, &
178                      ierr )
179       CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 12, comm_inter, &
180                      status, ierr )
181       IF ( restart_time /= remote )  THEN
182          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
183                 '": restart_time = ', restart_time, '& is not equal to ',     &
184                 'restart_time_remote = ', remote
185          CALL message( 'check_parameters', 'PA0006', 1, 2, 0, 6, 0 )
186       ENDIF
187
188       CALL MPI_SEND( dt_restart, 1, MPI_REAL, target_id, 13, comm_inter, &
189                      ierr )
190       CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 13, comm_inter, &
191                      status, ierr )
192       IF ( dt_restart /= remote )  THEN
193          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
194                 '": dt_restart = ', dt_restart, '& is not equal to ',         &
195                 'dt_restart_remote = ', remote
196          CALL message( 'check_parameters', 'PA0007', 1, 2, 0, 6, 0 )
197       ENDIF
198
199       simulation_time_since_reference = end_time - coupling_start_time
200       CALL MPI_SEND( simulation_time_since_reference, 1, MPI_REAL, target_id, &
201                      14, comm_inter, ierr )
202       CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter, &
203                      status, ierr )
204       IF ( simulation_time_since_reference /= remote )  THEN
205          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
206                 '": simulation_time_since_reference = ',                      &
207                 simulation_time_since_reference, '& is not equal to ',        &
208                 'simulation_time_since_reference_remote = ', remote
209          CALL message( 'check_parameters', 'PA0008', 1, 2, 0, 6, 0 )
210       ENDIF
211
212       CALL MPI_SEND( dx, 1, MPI_REAL, target_id, 15, comm_inter, ierr )
213       CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 15, comm_inter, &
214                      status, ierr )
215       IF ( dx /= remote )  THEN
216          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
217                 '":  dx = ', dx, '& is not equal to dx_remote = ', remote
218          CALL message( 'check_parameters', 'PA0009', 1, 2, 0, 6, 0 )
219       ENDIF
220
221       CALL MPI_SEND( dy, 1, MPI_REAL, target_id, 16, comm_inter, ierr )
222       CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 16, comm_inter, &
223                      status, ierr )
224       IF ( dy /= remote )  THEN
225          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
226                 '":  dy = ', dy, '& is not equal to dy_remote = ', remote
227          CALL message( 'check_parameters', 'PA0010', 1, 2, 0, 6, 0 )
228       ENDIF
229
230       CALL MPI_SEND( nx, 1, MPI_INTEGER, target_id, 17, comm_inter, ierr )
231       CALL MPI_RECV( iremote, 1, MPI_INTEGER, target_id, 17, comm_inter, &
232                      status, ierr )
233       IF ( nx /= iremote )  THEN
234          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
235                 '": nx = ', nx, '& is not equal to nx_remote = ', iremote
236          CALL message( 'check_parameters', 'PA0011', 1, 2, 0, 6, 0 )
237       ENDIF
238
239       CALL MPI_SEND( ny, 1, MPI_INTEGER, target_id, 18, comm_inter, ierr )
240       CALL MPI_RECV( iremote, 1, MPI_INTEGER, target_id, 18, comm_inter, &
241                      status, ierr )
242       IF ( ny /= iremote )  THEN
243          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
244                 '": ny = ', ny, '& is not equal to ny_remote = ', iremote
245          CALL message( 'check_parameters', 'PA0012', 1, 2, 0, 6, 0 )
246       ENDIF
247#else
248       WRITE( message_string, * ) 'coupling requires PALM to be called with', &
249            ' ''mrun -K parallel'''
250       CALL message( 'check_parameters', 'PA0141', 1, 2, 0, 6, 0 )
251#endif
252    ENDIF
253
254#if defined( __parallel )
255!
256!-- Exchange via intercommunicator
257    IF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
258       CALL MPI_SEND( humidity, 1, MPI_LOGICAL, target_id, 19, comm_inter, &
259                      ierr )
260    ELSEIF ( coupling_mode == 'ocean_to_atmosphere' )  THEN
261       CALL MPI_RECV( humidity_remote, 1, MPI_LOGICAL, target_id, 19, &
262                      comm_inter, status, ierr )
263    ENDIF
264#endif
265
266
267!
268!-- Generate the file header which is used as a header for most of PALM's
269!-- output files
270    CALL DATE_AND_TIME( date, time )
271    run_date = date(7:8)//'-'//date(5:6)//'-'//date(3:4)
272    run_time = time(1:2)//':'//time(3:4)//':'//time(5:6)
273    IF ( coupling_mode == 'uncoupled' )  THEN
274       coupling_string = ''
275    ELSEIF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
276       coupling_string = ' coupled (atmosphere)'
277    ELSEIF ( coupling_mode == 'ocean_to_atmosphere' )  THEN
278       coupling_string = ' coupled (ocean)'
279    ENDIF       
280
281    WRITE ( run_description_header,                                        &
282                             '(A,2X,A,2X,A,A,A,I2.2,A,2X,A,A,2X,A,1X,A)' ) &
283              TRIM( version ), TRIM( revision ), 'run: ',                  &
284              TRIM( run_identifier ), '.', runnr, TRIM( coupling_string ), &
285              'host: ', TRIM( host ), run_date, run_time
286
287!
288!-- Check the general loop optimization method
289    IF ( loop_optimization == 'default' )  THEN
290       IF ( host(1:3) == 'nec' )  THEN
291          loop_optimization = 'vector'
292       ELSE
293          loop_optimization = 'cache'
294       ENDIF
295    ENDIF
296    IF ( loop_optimization /= 'noopt'  .AND.  loop_optimization /= 'cache' &
297         .AND.  loop_optimization /= 'vector' )  THEN
298       message_string = 'illegal value given for loop_optimization: "' // &
299                        TRIM( loop_optimization ) // '"'
300       CALL message( 'check_parameters', 'PA0013', 1, 2, 0, 6, 0 )
301    ENDIF
302
303!
304!-- Check topography setting (check for illegal parameter combinations)
305    IF ( topography /= 'flat' )  THEN
306       action = ' '
307       IF ( scalar_advec /= 'pw-scheme' )  THEN
308          WRITE( action, '(A,A)' )  'scalar_advec = ', scalar_advec
309       ENDIF
310       IF ( momentum_advec /= 'pw-scheme' )  THEN
311          WRITE( action, '(A,A)' )  'momentum_advec = ', momentum_advec
312       ENDIF
313       IF ( timestep_scheme(1:8) == 'leapfrog' )  THEN
314          WRITE( action, '(A,A)' )  'timestep_scheme = ', timestep_scheme
315       ENDIF
316       IF ( psolver == 'sor' )  THEN
317          WRITE( action, '(A,A)' )  'psolver = ', psolver
318       ENDIF
319       IF ( sloping_surface )  THEN
320          WRITE( action, '(A)' )  'sloping surface = .TRUE.'
321       ENDIF
322       IF ( galilei_transformation )  THEN
323          WRITE( action, '(A)' )  'galilei_transformation = .TRUE.'
324       ENDIF
325       IF ( cloud_physics )  THEN
326          WRITE( action, '(A)' )  'cloud_physics = .TRUE.'
327       ENDIF
328       IF ( cloud_droplets )  THEN
329          WRITE( action, '(A)' )  'cloud_droplets = .TRUE.'
330       ENDIF
331       IF ( humidity )  THEN
332          WRITE( action, '(A)' )  'humidity = .TRUE.'
333       ENDIF
334       IF ( .NOT. prandtl_layer )  THEN
335          WRITE( action, '(A)' )  'prandtl_layer = .FALSE.'
336       ENDIF
337       IF ( action /= ' ' )  THEN
338          message_string = 'a non-flat topography does not allow ' // &
339                           TRIM( action )
340          CALL message( 'check_parameters', 'PA0014', 1, 2, 0, 6, 0 )
341       ENDIF
342!
343!--    In case of non-flat topography, check whether the convention how to
344!--    define the topography grid has been set correctly, or whether the default
345!--    is applicable. If this is not possible, abort.
346       IF ( TRIM( topography_grid_convention ) == ' ' )  THEN
347          IF ( TRIM( topography ) /= 'single_building' .AND.  &
348               TRIM( topography ) /= 'single_street_canyon' .AND.  &
349               TRIM( topography ) /= 'read_from_file' )  THEN
350!--          The default value is not applicable here, because it is only valid
351!--          for the two standard cases 'single_building' and 'read_from_file'
352!--          defined in init_grid.
353             WRITE( message_string, * )  &
354                  'The value for "topography_grid_convention" ',  &
355                  'is not set. Its default value is & only valid for ',  &
356                  '"topography" = ''single_building'', ',  &
357                  '''single_street_canyon'' & or ''read_from_file''.',  &
358                  ' & Choose ''cell_edge'' or ''cell_center''.'
359             CALL message( 'user_check_parameters', 'PA0239', 1, 2, 0, 6, 0 )
360          ELSE
361!--          The default value is applicable here.
362!--          Set convention according to topography.
363             IF ( TRIM( topography ) == 'single_building' .OR.  &
364                  TRIM( topography ) == 'single_street_canyon' )  THEN
365                topography_grid_convention = 'cell_edge'
366             ELSEIF ( TRIM( topography ) == 'read_from_file' )  THEN
367                topography_grid_convention = 'cell_center'
368             ENDIF
369          ENDIF
370       ELSEIF ( TRIM( topography_grid_convention ) /= 'cell_edge' .AND.  &
371                TRIM( topography_grid_convention ) /= 'cell_center' )  THEN
372          WRITE( message_string, * )  &
373               'The value for "topography_grid_convention" is ', &
374               'not recognized. & Choose ''cell_edge'' or ''cell_center''.'
375          CALL message( 'user_check_parameters', 'PA0240', 1, 2, 0, 6, 0 )
376       ENDIF
377
378    ENDIF
379
380!
381!-- Check ocean setting
382    IF ( ocean )  THEN
383
384       action = ' '
385       IF ( timestep_scheme(1:8) == 'leapfrog' )  THEN
386          WRITE( action, '(A,A)' )  'timestep_scheme = ', timestep_scheme
387       ENDIF
388       IF ( momentum_advec == 'ups-scheme' )  THEN
389          WRITE( action, '(A,A)' )  'momentum_advec = ', momentum_advec
390       ENDIF
391       IF ( action /= ' ' )  THEN
392          message_string = 'ocean = .T. does not allow ' // TRIM( action )
393          CALL message( 'check_parameters', 'PA0015', 1, 2, 0, 6, 0 )
394       ENDIF
395
396    ELSEIF ( TRIM( coupling_mode ) == 'uncoupled'  .AND.  &
397             TRIM( coupling_char ) == '_O' )  THEN
398
399!
400!--    Check whether an (uncoupled) atmospheric run has been declared as an
401!--    ocean run (this setting is done via mrun-option -y)
402
403       message_string = 'ocean = .F. does not allow coupling_char = "' // &
404                        TRIM( coupling_char ) // '" set by mrun-option "-y"'
405       CALL message( 'check_parameters', 'PA0317', 1, 2, 0, 6, 0 )
406
407    ENDIF
408
409!
410!-- Check whether there are any illegal values
411!-- Pressure solver:
412    IF ( psolver /= 'poisfft'  .AND.  psolver /= 'poisfft_hybrid'  .AND. &
413         psolver /= 'sor'  .AND.  psolver /= 'multigrid' )  THEN
414       message_string = 'unknown solver for perturbation pressure: psolver' // &
415                        ' = "' // TRIM( psolver ) // '"'
416       CALL message( 'check_parameters', 'PA0016', 1, 2, 0, 6, 0 )
417    ENDIF
418
419#if defined( __parallel )
420    IF ( psolver == 'poisfft_hybrid'  .AND.  pdims(2) /= 1 )  THEN
421       message_string = 'psolver = "' // TRIM( psolver ) // '" only works ' // &
422                        'for a 1d domain-decomposition along x & please do' // &
423                        ' not set npey/=1 in the parameter file'
424       CALL message( 'check_parameters', 'PA0017', 1, 2, 0, 6, 0 )
425    ENDIF
426    IF ( psolver == 'poisfft_hybrid'  .AND.                     &
427         ( nxra > nxr  .OR.  nyna > nyn  .OR.  nza > nz )  .OR. &
428          psolver == 'multigrid'      .AND.                     &
429         ( nxra > nxr  .OR.  nyna > nyn ) )  THEN
430       message_string = 'psolver = "' // TRIM( psolver ) // '" does not ' // &
431                        'work for subdomains with unequal size & please ' // &
432                        'set grid_matching = ''strict'' in the parameter file'
433       CALL message( 'check_parameters', 'PA0018', 1, 2, 0, 6, 0 )
434    ENDIF
435#else
436    IF ( psolver == 'poisfft_hybrid' )  THEN
437       message_string = 'psolver = "' // TRIM( psolver ) // '" only works' // &
438                        ' for a parallel environment'
439       CALL message( 'check_parameters', 'PA0019', 1, 2, 0, 6, 0 )
440    ENDIF
441#endif
442
443    IF ( psolver == 'multigrid' )  THEN
444       IF ( cycle_mg == 'w' )  THEN
445          gamma_mg = 2
446       ELSEIF ( cycle_mg == 'v' )  THEN
447          gamma_mg = 1
448       ELSE
449          message_string = 'unknown multigrid cycle: cycle_mg = "' // &
450                           TRIM( cycle_mg ) // '"'
451          CALL message( 'check_parameters', 'PA0020', 1, 2, 0, 6, 0 )
452       ENDIF
453    ENDIF
454
455    IF ( fft_method /= 'singleton-algorithm'  .AND.  &
456         fft_method /= 'temperton-algorithm'  .AND.  &
457         fft_method /= 'system-specific' )  THEN
458       message_string = 'unknown fft-algorithm: fft_method = "' // &
459                        TRIM( fft_method ) // '"'
460       CALL message( 'check_parameters', 'PA0021', 1, 2, 0, 6, 0 )
461    ENDIF
462
463!
464!-- Advection schemes:
465    IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ups-scheme' ) &
466    THEN
467       message_string = 'unknown advection scheme: momentum_advec = "' // &
468                        TRIM( momentum_advec ) // '"'
469       CALL message( 'check_parameters', 'PA0022', 1, 2, 0, 6, 0 )
470    ENDIF
471    IF ( ( momentum_advec == 'ups-scheme'  .OR.  scalar_advec == 'ups-scheme' )&
472                                      .AND.  timestep_scheme /= 'euler' )  THEN
473       message_string = 'momentum_advec = "' // TRIM( momentum_advec ) // &
474                        '" is not allowed with timestep_scheme = "' //    &
475                        TRIM( timestep_scheme ) // '"'
476       CALL message( 'check_parameters', 'PA0023', 1, 2, 0, 6, 0 )
477    ENDIF
478
479    IF ( scalar_advec /= 'pw-scheme'  .AND.  scalar_advec /= 'bc-scheme'  .AND.&
480         scalar_advec /= 'ups-scheme' )  THEN
481       message_string = 'unknown advection scheme: scalar_advec = "' // &
482                        TRIM( scalar_advec ) // '"'
483       CALL message( 'check_parameters', 'PA0024', 1, 2, 0, 6, 0 )
484    ENDIF
485
486    IF ( use_sgs_for_particles  .AND.  .NOT. use_upstream_for_tke )  THEN
487       use_upstream_for_tke = .TRUE.
488       message_string = 'use_upstream_for_tke set .TRUE. because ' // &
489                        'use_sgs_for_particles = .TRUE.'
490       CALL message( 'check_parameters', 'PA0025', 0, 1, 0, 6, 0 )
491    ENDIF
492
493    IF ( use_upstream_for_tke  .AND.  timestep_scheme(1:8) == 'leapfrog' )  THEN
494       message_string = 'use_upstream_for_tke = .TRUE. not allowed with ' // &
495                        'timestep_scheme = "' // TRIM( timestep_scheme ) // '"'
496       CALL message( 'check_parameters', 'PA0026', 1, 2, 0, 6, 0 )
497    ENDIF
498
499!
500!-- Timestep schemes:
501    SELECT CASE ( TRIM( timestep_scheme ) )
502
503       CASE ( 'euler' )
504          intermediate_timestep_count_max = 1
505          asselin_filter_factor           = 0.0
506
507       CASE ( 'leapfrog', 'leapfrog+euler' )
508          intermediate_timestep_count_max = 1
509
510       CASE ( 'runge-kutta-2' )
511          intermediate_timestep_count_max = 2
512          asselin_filter_factor           = 0.0
513
514       CASE ( 'runge-kutta-3' )
515          intermediate_timestep_count_max = 3
516          asselin_filter_factor           = 0.0
517
518       CASE DEFAULT
519          message_string = 'unknown timestep scheme: timestep_scheme = "' // &
520                           TRIM( timestep_scheme ) // '"'
521          CALL message( 'check_parameters', 'PA0027', 1, 2, 0, 6, 0 )
522
523    END SELECT
524
525    IF ( scalar_advec == 'ups-scheme'  .AND.  timestep_scheme(1:5) == 'runge' )&
526    THEN
527       message_string = 'scalar advection scheme "' // TRIM( scalar_advec ) // &
528                        '" & does not work with timestep_scheme "' // &
529                        TRIM( timestep_scheme ) // '"'
530       CALL message( 'check_parameters', 'PA0028', 1, 2, 0, 6, 0 )
531    ENDIF
532
533    IF ( momentum_advec /= 'pw-scheme' .AND. timestep_scheme(1:5) == 'runge' ) &
534    THEN
535       message_string = 'momentum advection scheme "' // &
536                        TRIM( momentum_advec ) // '" & does not work with ' // &
537                        'timestep_scheme "' // TRIM( timestep_scheme ) // '"'
538       CALL message( 'check_parameters', 'PA0029', 1, 2, 0, 6, 0 )
539    ENDIF
540
541    IF ( TRIM( initializing_actions ) /= 'read_restart_data'  .AND.  &
542         TRIM( initializing_actions ) /= 'cyclic_fill' )  THEN
543!
544!--    No restart run: several initialising actions are possible
545       action = initializing_actions
546       DO WHILE ( TRIM( action ) /= '' )
547          position = INDEX( action, ' ' )
548          SELECT CASE ( action(1:position-1) )
549
550             CASE ( 'set_constant_profiles', 'set_1d-model_profiles', &
551                    'by_user', 'initialize_vortex',     'initialize_ptanom' )
552                action = action(position+1:)
553
554             CASE DEFAULT
555                message_string = 'initializing_action = "' // &
556                                 TRIM( action ) // '" unkown or not allowed'
557                CALL message( 'check_parameters', 'PA0030', 1, 2, 0, 6, 0 )
558
559          END SELECT
560       ENDDO
561    ENDIF
562
563    IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0  .AND. &
564         INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
565       message_string = 'initializing_actions = "set_constant_profiles"' // &
566                        ' and "set_1d-model_profiles" are not allowed ' //  &
567                        'simultaneously'
568       CALL message( 'check_parameters', 'PA0031', 1, 2, 0, 6, 0 )
569    ENDIF
570
571    IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0  .AND. &
572         INDEX( initializing_actions, 'by_user' ) /= 0 )  THEN
573       message_string = 'initializing_actions = "set_constant_profiles"' // &
574                        ' and "by_user" are not allowed simultaneously'
575       CALL message( 'check_parameters', 'PA0032', 1, 2, 0, 6, 0 )
576    ENDIF
577
578    IF ( INDEX( initializing_actions, 'by_user' ) /= 0  .AND. &
579         INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
580       message_string = 'initializing_actions = "by_user" and ' // &
581                        '"set_1d-model_profiles" are not allowed simultaneously'
582       CALL message( 'check_parameters', 'PA0033', 1, 2, 0, 6, 0 )
583    ENDIF
584
585    IF ( cloud_physics  .AND.  .NOT. humidity )  THEN
586       WRITE( message_string, * ) 'cloud_physics = ', cloud_physics, ' is ', &
587              'not allowed with humidity = ', humidity
588       CALL message( 'check_parameters', 'PA0034', 1, 2, 0, 6, 0 )
589    ENDIF
590
591    IF ( precipitation  .AND.  .NOT.  cloud_physics )  THEN
592       WRITE( message_string, * ) 'precipitation = ', precipitation, ' is ', &
593              'not allowed with cloud_physics = ', cloud_physics
594       CALL message( 'check_parameters', 'PA0035', 1, 2, 0, 6, 0 )
595    ENDIF
596
597    IF ( humidity  .AND.  sloping_surface )  THEN
598       message_string = 'humidity = .TRUE. and sloping_surface = .TRUE. ' // &
599                        'are not allowed simultaneously'
600       CALL message( 'check_parameters', 'PA0036', 1, 2, 0, 6, 0 )
601    ENDIF
602
603    IF ( humidity  .AND.  scalar_advec == 'ups-scheme' )  THEN
604       message_string = 'UPS-scheme is not implemented for humidity = .TRUE.'
605       CALL message( 'check_parameters', 'PA0037', 1, 2, 0, 6, 0 )
606    ENDIF
607
608    IF ( passive_scalar  .AND.  humidity )  THEN
609       message_string = 'humidity = .TRUE. and passive_scalar = .TRUE. ' // &
610                        'is not allowed simultaneously'
611       CALL message( 'check_parameters', 'PA0038', 1, 2, 0, 6, 0 )
612    ENDIF
613
614    IF ( passive_scalar  .AND.  scalar_advec == 'ups-scheme' )  THEN
615       message_string = 'UPS-scheme is not implemented for passive_scalar' // &
616                        ' = .TRUE.'
617       CALL message( 'check_parameters', 'PA0039', 1, 2, 0, 6, 0 )
618    ENDIF
619
620    IF ( grid_matching /= 'strict'  .AND.  grid_matching /= 'match' )  THEN
621       message_string = 'illegal value "' // TRIM( grid_matching ) // &
622                        '" found for parameter grid_matching'
623       CALL message( 'check_parameters', 'PA0040', 1, 2, 0, 6, 0 )
624    ENDIF
625
626    IF ( plant_canopy .AND. ( drag_coefficient == 0.0 ) ) THEN
627       message_string = 'plant_canopy = .TRUE. requires a non-zero drag ' // &
628                        'coefficient & given value is drag_coefficient = 0.0'
629       CALL message( 'check_parameters', 'PA0041', 1, 2, 0, 6, 0 )
630    ENDIF 
631
632!
633!-- In case of no model continuation run, check initialising parameters and
634!-- deduce further quantities
635    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
636
637!
638!--    Initial profiles for 1D and 3D model, respectively
639       u_init  = ug_surface
640       v_init  = vg_surface
641       pt_init = pt_surface
642       IF ( humidity )        q_init  = q_surface
643       IF ( ocean )           sa_init = sa_surface
644       IF ( passive_scalar )  q_init  = s_surface
645       IF ( plant_canopy )    lad = 0.0
646
647!
648!--
649!--    If required, compute initial profile of the geostrophic wind
650!--    (component ug)
651       i = 1
652       gradient = 0.0
653
654       IF ( .NOT. ocean )  THEN
655
656          ug_vertical_gradient_level_ind(1) = 0
657          ug(0) = ug_surface
658          DO  k = 1, nzt+1
659             IF ( i < 11 ) THEN
660                IF ( ug_vertical_gradient_level(i) < zu(k)  .AND. &
661                     ug_vertical_gradient_level(i) >= 0.0 )  THEN
662                   gradient = ug_vertical_gradient(i) / 100.0
663                   ug_vertical_gradient_level_ind(i) = k - 1
664                   i = i + 1
665                ENDIF
666             ENDIF       
667             IF ( gradient /= 0.0 )  THEN
668                IF ( k /= 1 )  THEN
669                   ug(k) = ug(k-1) + dzu(k) * gradient
670                ELSE
671                   ug(k) = ug_surface + 0.5 * dzu(k) * gradient
672                ENDIF
673             ELSE
674                ug(k) = ug(k-1)
675             ENDIF
676          ENDDO
677
678       ELSE
679
680          ug_vertical_gradient_level_ind(1) = nzt+1
681          ug(nzt+1) = ug_surface
682          DO  k = nzt, 0, -1
683             IF ( i < 11 ) THEN
684                IF ( ug_vertical_gradient_level(i) > zu(k)  .AND. &
685                     ug_vertical_gradient_level(i) <= 0.0 )  THEN
686                   gradient = ug_vertical_gradient(i) / 100.0
687                   ug_vertical_gradient_level_ind(i) = k + 1
688                   i = i + 1
689                ENDIF
690             ENDIF
691             IF ( gradient /= 0.0 )  THEN
692                IF ( k /= nzt )  THEN
693                   ug(k) = ug(k+1) - dzu(k+1) * gradient
694                ELSE
695                   ug(k)   = ug_surface - 0.5 * dzu(k+1) * gradient
696                   ug(k+1) = ug_surface + 0.5 * dzu(k+1) * gradient
697                ENDIF
698             ELSE
699                ug(k) = ug(k+1)
700             ENDIF
701          ENDDO
702
703       ENDIF
704
705       u_init = ug
706
707!
708!--    In case of no given gradients for ug, choose a vanishing gradient
709       IF ( ug_vertical_gradient_level(1) == -9999999.9 )  THEN
710          ug_vertical_gradient_level(1) = 0.0
711       ENDIF 
712
713!
714!--
715!--    If required, compute initial profile of the geostrophic wind
716!--    (component vg)
717       i = 1
718       gradient = 0.0
719
720       IF ( .NOT. ocean )  THEN
721
722          vg_vertical_gradient_level_ind(1) = 0
723          vg(0) = vg_surface
724          DO  k = 1, nzt+1
725             IF ( i < 11 ) THEN
726                IF ( vg_vertical_gradient_level(i) < zu(k)  .AND. &
727                     vg_vertical_gradient_level(i) >= 0.0 )  THEN
728                   gradient = vg_vertical_gradient(i) / 100.0
729                   vg_vertical_gradient_level_ind(i) = k - 1
730                   i = i + 1
731                ENDIF
732             ENDIF
733             IF ( gradient /= 0.0 )  THEN
734                IF ( k /= 1 )  THEN
735                   vg(k) = vg(k-1) + dzu(k) * gradient
736                ELSE
737                   vg(k) = vg_surface + 0.5 * dzu(k) * gradient
738                ENDIF
739             ELSE
740                vg(k) = vg(k-1)
741             ENDIF
742          ENDDO
743
744       ELSE
745
746          vg_vertical_gradient_level_ind(1) = nzt+1
747          vg(nzt+1) = vg_surface
748          DO  k = nzt, 0, -1
749             IF ( i < 11 ) THEN
750                IF ( vg_vertical_gradient_level(i) > zu(k)  .AND. &
751                     vg_vertical_gradient_level(i) <= 0.0 )  THEN
752                   gradient = vg_vertical_gradient(i) / 100.0
753                   vg_vertical_gradient_level_ind(i) = k + 1
754                   i = i + 1
755                ENDIF
756             ENDIF
757             IF ( gradient /= 0.0 )  THEN
758                IF ( k /= nzt )  THEN
759                   vg(k) = vg(k+1) - dzu(k+1) * gradient
760                ELSE
761                   vg(k)   = vg_surface - 0.5 * dzu(k+1) * gradient
762                   vg(k+1) = vg_surface + 0.5 * dzu(k+1) * gradient
763                ENDIF
764             ELSE
765                vg(k) = vg(k+1)
766             ENDIF
767          ENDDO
768
769       ENDIF
770
771       v_init = vg
772 
773!
774!--    In case of no given gradients for vg, choose a vanishing gradient
775       IF ( vg_vertical_gradient_level(1) == -9999999.9 )  THEN
776          vg_vertical_gradient_level(1) = 0.0
777       ENDIF
778
779!
780!--    Compute initial temperature profile using the given temperature gradients
781       i = 1
782       gradient = 0.0
783
784       IF ( .NOT. ocean )  THEN
785
786          pt_vertical_gradient_level_ind(1) = 0
787          DO  k = 1, nzt+1
788             IF ( i < 11 ) THEN
789                IF ( pt_vertical_gradient_level(i) < zu(k)  .AND. &
790                     pt_vertical_gradient_level(i) >= 0.0 )  THEN
791                   gradient = pt_vertical_gradient(i) / 100.0
792                   pt_vertical_gradient_level_ind(i) = k - 1
793                   i = i + 1
794                ENDIF
795             ENDIF
796             IF ( gradient /= 0.0 )  THEN
797                IF ( k /= 1 )  THEN
798                   pt_init(k) = pt_init(k-1) + dzu(k) * gradient
799                ELSE
800                   pt_init(k) = pt_surface   + 0.5 * dzu(k) * gradient
801                ENDIF
802             ELSE
803                pt_init(k) = pt_init(k-1)
804             ENDIF
805          ENDDO
806
807       ELSE
808
809          pt_vertical_gradient_level_ind(1) = nzt+1
810          DO  k = nzt, 0, -1
811             IF ( i < 11 ) THEN
812                IF ( pt_vertical_gradient_level(i) > zu(k)  .AND. &
813                     pt_vertical_gradient_level(i) <= 0.0 )  THEN
814                   gradient = pt_vertical_gradient(i) / 100.0
815                   pt_vertical_gradient_level_ind(i) = k + 1
816                   i = i + 1
817                ENDIF
818             ENDIF
819             IF ( gradient /= 0.0 )  THEN
820                IF ( k /= nzt )  THEN
821                   pt_init(k) = pt_init(k+1) - dzu(k+1) * gradient
822                ELSE
823                   pt_init(k)   = pt_surface - 0.5 * dzu(k+1) * gradient
824                   pt_init(k+1) = pt_surface + 0.5 * dzu(k+1) * gradient
825                ENDIF
826             ELSE
827                pt_init(k) = pt_init(k+1)
828             ENDIF
829          ENDDO
830
831       ENDIF
832
833!
834!--    In case of no given temperature gradients, choose gradient of neutral
835!--    stratification
836       IF ( pt_vertical_gradient_level(1) == -9999999.9 )  THEN
837          pt_vertical_gradient_level(1) = 0.0
838       ENDIF
839
840!
841!--    Store temperature gradient at the top boundary for possible Neumann
842!--    boundary condition
843       bc_pt_t_val = ( pt_init(nzt+1) - pt_init(nzt) ) / dzu(nzt+1)
844
845!
846!--    If required, compute initial humidity or scalar profile using the given
847!--    humidity/scalar gradient. In case of scalar transport, initially store
848!--    values of the scalar parameters on humidity parameters
849       IF ( passive_scalar )  THEN
850          bc_q_b                    = bc_s_b
851          bc_q_t                    = bc_s_t
852          q_surface                 = s_surface
853          q_surface_initial_change  = s_surface_initial_change
854          q_vertical_gradient       = s_vertical_gradient
855          q_vertical_gradient_level = s_vertical_gradient_level
856          surface_waterflux         = surface_scalarflux
857       ENDIF
858
859       IF ( humidity  .OR.  passive_scalar )  THEN
860
861          i = 1
862          gradient = 0.0
863          q_vertical_gradient_level_ind(1) = 0
864          DO  k = 1, nzt+1
865             IF ( i < 11 ) THEN
866                IF ( q_vertical_gradient_level(i) < zu(k)  .AND. &
867                     q_vertical_gradient_level(i) >= 0.0 )  THEN
868                   gradient = q_vertical_gradient(i) / 100.0
869                   q_vertical_gradient_level_ind(i) = k - 1
870                   i = i + 1
871                ENDIF
872             ENDIF
873             IF ( gradient /= 0.0 )  THEN
874                IF ( k /= 1 )  THEN
875                   q_init(k) = q_init(k-1) + dzu(k) * gradient
876                ELSE
877                   q_init(k) = q_init(k-1) + 0.5 * dzu(k) * gradient
878                ENDIF
879             ELSE
880                q_init(k) = q_init(k-1)
881             ENDIF
882!
883!--          Avoid negative humidities
884             IF ( q_init(k) < 0.0 )  THEN
885                q_init(k) = 0.0
886             ENDIF
887          ENDDO
888
889!
890!--       In case of no given humidity gradients, choose zero gradient
891!--       conditions
892          IF ( q_vertical_gradient_level(1) == -1.0 )  THEN
893             q_vertical_gradient_level(1) = 0.0
894          ENDIF
895
896!
897!--       Store humidity gradient at the top boundary for possile Neumann
898!--       boundary condition
899          bc_q_t_val = ( q_init(nzt+1) - q_init(nzt) ) / dzu(nzt+1)
900
901       ENDIF
902
903!
904!--    If required, compute initial salinity profile using the given salinity
905!--    gradients
906       IF ( ocean )  THEN
907
908          i = 1
909          gradient = 0.0
910
911          sa_vertical_gradient_level_ind(1) = nzt+1
912          DO  k = nzt, 0, -1
913             IF ( i < 11 ) THEN
914                IF ( sa_vertical_gradient_level(i) > zu(k)  .AND. &
915                     sa_vertical_gradient_level(i) <= 0.0 )  THEN
916                   gradient = sa_vertical_gradient(i) / 100.0
917                   sa_vertical_gradient_level_ind(i) = k + 1
918                   i = i + 1
919                ENDIF
920             ENDIF
921             IF ( gradient /= 0.0 )  THEN
922                IF ( k /= nzt )  THEN
923                   sa_init(k) = sa_init(k+1) - dzu(k+1) * gradient
924                ELSE
925                   sa_init(k)   = sa_surface - 0.5 * dzu(k+1) * gradient
926                   sa_init(k+1) = sa_surface + 0.5 * dzu(k+1) * gradient
927                ENDIF
928             ELSE
929                sa_init(k) = sa_init(k+1)
930             ENDIF
931          ENDDO
932
933       ENDIF
934
935!
936!--    If required compute the profile of leaf area density used in the plant
937!--    canopy model
938       IF ( plant_canopy ) THEN
939       
940          i = 1
941          gradient = 0.0
942
943          IF ( .NOT. ocean ) THEN
944
945             lad(0) = lad_surface
946 
947             lad_vertical_gradient_level_ind(1) = 0
948             DO k = 1, pch_index
949                IF ( i < 11 ) THEN
950                   IF ( lad_vertical_gradient_level(i) < zu(k) .AND.  &
951                        lad_vertical_gradient_level(i) >= 0.0 ) THEN
952                      gradient = lad_vertical_gradient(i)
953                      lad_vertical_gradient_level_ind(i) = k - 1
954                      i = i + 1
955                   ENDIF
956                ENDIF
957                IF ( gradient /= 0.0 ) THEN
958                   IF ( k /= 1 ) THEN
959                      lad(k) = lad(k-1) + dzu(k) * gradient
960                   ELSE
961                      lad(k) = lad_surface + 0.5 * dzu(k) *gradient
962                   ENDIF
963                ELSE
964                   lad(k) = lad(k-1)
965                ENDIF
966             ENDDO
967
968          ENDIF
969
970!
971!--       In case of no given leaf area density gradients, choose a vanishing
972!--       gradient
973          IF ( lad_vertical_gradient_level(1) == -9999999.9 ) THEN
974             lad_vertical_gradient_level(1) = 0.0
975          ENDIF
976
977       ENDIF
978         
979    ENDIF
980             
981!
982!-- Compute Coriolis parameter
983    f  = 2.0 * omega * SIN( phi / 180.0 * pi )
984    fs = 2.0 * omega * COS( phi / 180.0 * pi )
985
986!
987!-- Ocean runs always use reference values in the buoyancy term. Therefore
988!-- set the reference temperature equal to the surface temperature.
989    IF ( ocean  .AND.  pt_reference == 9999999.9 )  pt_reference = pt_surface
990
991!
992!-- Reference value has to be used in buoyancy terms
993    IF ( pt_reference /= 9999999.9 )  use_reference = .TRUE.
994
995!
996!-- Sign of buoyancy/stability terms
997    IF ( ocean )  atmos_ocean_sign = -1.0
998
999!
1000!-- Ocean version must use flux boundary conditions at the top
1001    IF ( ocean .AND. .NOT. use_top_fluxes )  THEN
1002       message_string = 'use_top_fluxes must be .TRUE. in ocean version'
1003       CALL message( 'check_parameters', 'PA0042', 1, 2, 0, 6, 0 )
1004    ENDIF
1005
1006!
1007!-- In case of a given slope, compute the relevant quantities
1008    IF ( alpha_surface /= 0.0 )  THEN
1009       IF ( ABS( alpha_surface ) > 90.0 )  THEN
1010          WRITE( message_string, * ) 'ABS( alpha_surface = ', alpha_surface, &
1011                                     ' ) must be < 90.0'
1012          CALL message( 'check_parameters', 'PA0043', 1, 2, 0, 6, 0 )
1013       ENDIF
1014       sloping_surface = .TRUE.
1015       cos_alpha_surface = COS( alpha_surface / 180.0 * pi )
1016       sin_alpha_surface = SIN( alpha_surface / 180.0 * pi )
1017    ENDIF
1018
1019!
1020!-- Check time step and cfl_factor
1021    IF ( dt /= -1.0 )  THEN
1022       IF ( dt <= 0.0  .AND.  dt /= -1.0 )  THEN
1023          WRITE( message_string, * ) 'dt = ', dt , ' <= 0.0'
1024          CALL message( 'check_parameters', 'PA0044', 1, 2, 0, 6, 0 )
1025       ENDIF
1026       dt_3d = dt
1027       dt_fixed = .TRUE.
1028    ENDIF
1029
1030    IF ( cfl_factor <= 0.0  .OR.  cfl_factor > 1.0 )  THEN
1031       IF ( cfl_factor == -1.0 )  THEN
1032          IF ( momentum_advec == 'ups-scheme'  .OR.  &
1033               scalar_advec == 'ups-scheme' )  THEN
1034             cfl_factor = 0.8
1035          ELSE
1036             IF ( timestep_scheme == 'runge-kutta-2' )  THEN
1037                cfl_factor = 0.8
1038             ELSEIF ( timestep_scheme == 'runge-kutta-3' )  THEN
1039                cfl_factor = 0.9
1040             ELSE
1041                cfl_factor = 0.1
1042             ENDIF
1043          ENDIF
1044       ELSE
1045          WRITE( message_string, * ) 'cfl_factor = ', cfl_factor, &
1046                 ' out of range & 0.0 < cfl_factor <= 1.0 is required'
1047          CALL message( 'check_parameters', 'PA0045', 1, 2, 0, 6, 0 )
1048       ENDIF
1049    ENDIF
1050
1051!
1052!-- Store simulated time at begin
1053    simulated_time_at_begin = simulated_time
1054
1055!
1056!-- Store reference time for coupled runs and change the coupling flag,
1057!-- if ...
1058    IF ( simulated_time == 0.0 )  THEN
1059       IF ( coupling_start_time == 0.0 )  THEN
1060          time_since_reference_point = 0.0
1061       ELSEIF ( time_since_reference_point < 0.0 )  THEN
1062          run_coupled = .FALSE.
1063       ENDIF
1064    ENDIF
1065
1066!
1067!-- Set wind speed in the Galilei-transformed system
1068    IF ( galilei_transformation )  THEN
1069       IF ( use_ug_for_galilei_tr .AND.                &
1070            ug_vertical_gradient_level(1) == 0.0 .AND. & 
1071            vg_vertical_gradient_level(1) == 0.0 )  THEN
1072          u_gtrans = ug_surface
1073          v_gtrans = vg_surface
1074       ELSEIF ( use_ug_for_galilei_tr .AND.                &
1075                ug_vertical_gradient_level(1) /= 0.0 )  THEN
1076          message_string = 'baroclinicity (ug) not allowed simultaneously' // &
1077                           ' with galilei transformation'
1078          CALL message( 'check_parameters', 'PA0046', 1, 2, 0, 6, 0 )
1079       ELSEIF ( use_ug_for_galilei_tr .AND.                &
1080                vg_vertical_gradient_level(1) /= 0.0 )  THEN
1081          message_string = 'baroclinicity (vg) not allowed simultaneously' // &
1082                           ' with galilei transformation'
1083          CALL message( 'check_parameters', 'PA0047', 1, 2, 0, 6, 0 )
1084       ELSE
1085          message_string = 'variable translation speed used for galilei-' // &
1086             'transformation, which may cause & instabilities in stably ' // &
1087             'stratified regions'
1088          CALL message( 'check_parameters', 'PA0048', 0, 1, 0, 6, 0 )
1089       ENDIF
1090    ENDIF
1091
1092!
1093!-- In case of using a prandtl-layer, calculated (or prescribed) surface
1094!-- fluxes have to be used in the diffusion-terms
1095    IF ( prandtl_layer )  use_surface_fluxes = .TRUE.
1096
1097!
1098!-- Check boundary conditions and set internal variables:
1099!-- Lateral boundary conditions
1100    IF ( bc_lr /= 'cyclic'  .AND.  bc_lr /= 'dirichlet/radiation'  .AND. &
1101         bc_lr /= 'radiation/dirichlet' )  THEN
1102       message_string = 'unknown boundary condition: bc_lr = "' // &
1103                        TRIM( bc_lr ) // '"'
1104       CALL message( 'check_parameters', 'PA0049', 1, 2, 0, 6, 0 )
1105    ENDIF
1106    IF ( bc_ns /= 'cyclic'  .AND.  bc_ns /= 'dirichlet/radiation'  .AND. &
1107         bc_ns /= 'radiation/dirichlet' )  THEN
1108       message_string = 'unknown boundary condition: bc_ns = "' // &
1109                        TRIM( bc_ns ) // '"'
1110       CALL message( 'check_parameters', 'PA0050', 1, 2, 0, 6, 0 )
1111    ENDIF
1112
1113!
1114!-- Internal variables used for speed optimization in if clauses
1115    IF ( bc_lr /= 'cyclic' )  bc_lr_cyc = .FALSE.
1116    IF ( bc_ns /= 'cyclic' )  bc_ns_cyc = .FALSE.
1117
1118!
1119!-- Non-cyclic lateral boundaries require the multigrid method and Piascek-
1120!-- Willimas advection scheme. Several schemes and tools do not work with
1121!-- non-cyclic boundary conditions.
1122    IF ( bc_lr /= 'cyclic'  .OR.  bc_ns /= 'cyclic' )  THEN
1123       IF ( psolver /= 'multigrid' )  THEN
1124          message_string = 'non-cyclic lateral boundaries do not allow ' // &
1125                           'psolver = "' // TRIM( psolver ) // '"'
1126          CALL message( 'check_parameters', 'PA0051', 1, 2, 0, 6, 0 )
1127       ENDIF
1128       IF ( momentum_advec /= 'pw-scheme' )  THEN
1129          message_string = 'non-cyclic lateral boundaries do not allow ' // &
1130                           'momentum_advec = "' // TRIM( momentum_advec ) // '"'
1131          CALL message( 'check_parameters', 'PA0052', 1, 2, 0, 6, 0 )
1132       ENDIF
1133       IF ( scalar_advec /= 'pw-scheme' )  THEN
1134          message_string = 'non-cyclic lateral boundaries do not allow ' // &
1135                           'scalar_advec = "' // TRIM( scalar_advec ) // '"'
1136          CALL message( 'check_parameters', 'PA0053', 1, 2, 0, 6, 0 )
1137       ENDIF
1138       IF ( galilei_transformation )  THEN
1139          message_string = 'non-cyclic lateral boundaries do not allow ' // &
1140                           'galilei_transformation = .T.'
1141          CALL message( 'check_parameters', 'PA0054', 1, 2, 0, 6, 0 )
1142       ENDIF
1143    ENDIF
1144
1145!
1146!-- Bottom boundary condition for the turbulent Kinetic energy
1147    IF ( bc_e_b == 'neumann' )  THEN
1148       ibc_e_b = 1
1149       IF ( adjust_mixing_length  .AND.  prandtl_layer )  THEN
1150          message_string = 'adjust_mixing_length = TRUE and bc_e_b = "neumann"'
1151          CALL message( 'check_parameters', 'PA0055', 0, 1, 0, 6, 0 )
1152       ENDIF
1153    ELSEIF ( bc_e_b == '(u*)**2+neumann' )  THEN
1154       ibc_e_b = 2
1155       IF ( .NOT. adjust_mixing_length  .AND.  prandtl_layer )  THEN
1156          message_string = 'adjust_mixing_length = FALSE and bc_e_b = "' // &
1157                           TRIM( bc_e_b ) // '"'
1158          CALL message( 'check_parameters', 'PA0056', 0, 1, 0, 6, 0 )
1159       ENDIF
1160       IF ( .NOT. prandtl_layer )  THEN
1161          bc_e_b = 'neumann'
1162          ibc_e_b = 1
1163          message_string = 'boundary condition bc_e_b changed to "' // &
1164                           TRIM( bc_e_b ) // '"'
1165          CALL message( 'check_parameters', 'PA0057', 0, 1, 0, 6, 0 )
1166       ENDIF
1167    ELSE
1168       message_string = 'unknown boundary condition: bc_e_b = "' // &
1169                        TRIM( bc_e_b ) // '"'
1170       CALL message( 'check_parameters', 'PA0058', 1, 2, 0, 6, 0 )
1171    ENDIF
1172
1173!
1174!-- Boundary conditions for perturbation pressure
1175    IF ( bc_p_b == 'dirichlet' )  THEN
1176       ibc_p_b = 0
1177    ELSEIF ( bc_p_b == 'neumann' )  THEN
1178       ibc_p_b = 1
1179    ELSEIF ( bc_p_b == 'neumann+inhomo' )  THEN
1180       ibc_p_b = 2
1181    ELSE
1182       message_string = 'unknown boundary condition: bc_p_b = "' // &
1183                        TRIM( bc_p_b ) // '"'
1184       CALL message( 'check_parameters', 'PA0059', 1, 2, 0, 6, 0 )
1185    ENDIF
1186    IF ( ibc_p_b == 2  .AND.  .NOT. prandtl_layer )  THEN
1187       message_string = 'boundary condition: bc_p_b = "' // TRIM( bc_p_b ) // &
1188                        '" not allowed with prandtl_layer = .FALSE.'
1189       CALL message( 'check_parameters', 'PA0060', 1, 2, 0, 6, 0 )
1190    ENDIF
1191    IF ( bc_p_t == 'dirichlet' )  THEN
1192       ibc_p_t = 0
1193    ELSEIF ( bc_p_t == 'neumann' )  THEN
1194       ibc_p_t = 1
1195    ELSE
1196       message_string = 'unknown boundary condition: bc_p_t = "' // &
1197                        TRIM( bc_p_t ) // '"'
1198       CALL message( 'check_parameters', 'PA0061', 1, 2, 0, 6, 0 )
1199    ENDIF
1200
1201!
1202!-- Boundary conditions for potential temperature
1203    IF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
1204       ibc_pt_b = 2
1205    ELSE
1206       IF ( bc_pt_b == 'dirichlet' )  THEN
1207          ibc_pt_b = 0
1208       ELSEIF ( bc_pt_b == 'neumann' )  THEN
1209          ibc_pt_b = 1
1210       ELSE
1211          message_string = 'unknown boundary condition: bc_pt_b = "' // &
1212                           TRIM( bc_pt_b ) // '"'
1213          CALL message( 'check_parameters', 'PA0062', 1, 2, 0, 6, 0 )
1214       ENDIF
1215    ENDIF
1216
1217    IF ( bc_pt_t == 'dirichlet' )  THEN
1218       ibc_pt_t = 0
1219    ELSEIF ( bc_pt_t == 'neumann' )  THEN
1220       ibc_pt_t = 1
1221    ELSEIF ( bc_pt_t == 'initial_gradient' )  THEN
1222       ibc_pt_t = 2
1223    ELSE
1224       message_string = 'unknown boundary condition: bc_pt_t = "' // &
1225                        TRIM( bc_pt_t ) // '"'
1226       CALL message( 'check_parameters', 'PA0063', 1, 2, 0, 6, 0 )
1227    ENDIF
1228
1229    IF ( surface_heatflux == 9999999.9 )  constant_heatflux     = .FALSE.
1230    IF ( top_heatflux     == 9999999.9 )  constant_top_heatflux = .FALSE.
1231    IF ( top_momentumflux_u /= 9999999.9  .AND.  &
1232         top_momentumflux_v /= 9999999.9 )  THEN
1233       constant_top_momentumflux = .TRUE.
1234    ELSEIF (  .NOT. ( top_momentumflux_u == 9999999.9  .AND.  &
1235           top_momentumflux_v == 9999999.9 ) )  THEN
1236       message_string = 'both, top_momentumflux_u AND top_momentumflux_v ' // &
1237                        'must be set'
1238       CALL message( 'check_parameters', 'PA0064', 1, 2, 0, 6, 0 )
1239    ENDIF
1240
1241!
1242!-- A given surface temperature implies Dirichlet boundary condition for
1243!-- temperature. In this case specification of a constant heat flux is
1244!-- forbidden.
1245    IF ( ibc_pt_b == 0  .AND.   constant_heatflux  .AND. &
1246         surface_heatflux /= 0.0 )  THEN
1247       message_string = 'boundary_condition: bc_pt_b = "' // TRIM( bc_pt_b ) //&
1248                        '& is not allowed with constant_heatflux = .TRUE.'
1249       CALL message( 'check_parameters', 'PA0065', 1, 2, 0, 6, 0 )
1250    ENDIF
1251    IF ( constant_heatflux  .AND.  pt_surface_initial_change /= 0.0 )  THEN
1252       WRITE ( message_string, * )  'constant_heatflux = .TRUE. is not allo', &
1253               'wed with pt_surface_initial_change (/=0) = ', &
1254               pt_surface_initial_change
1255       CALL message( 'check_parameters', 'PA0066', 1, 2, 0, 6, 0 )
1256    ENDIF
1257
1258!
1259!-- A given temperature at the top implies Dirichlet boundary condition for
1260!-- temperature. In this case specification of a constant heat flux is
1261!-- forbidden.
1262    IF ( ibc_pt_t == 0  .AND.   constant_top_heatflux  .AND. &
1263         top_heatflux /= 0.0 )  THEN
1264       message_string = 'boundary_condition: bc_pt_t = "' // TRIM( bc_pt_t ) //&
1265                        '" is not allowed with constant_top_heatflux = .TRUE.'
1266       CALL message( 'check_parameters', 'PA0067', 1, 2, 0, 6, 0 )
1267    ENDIF
1268
1269!
1270!-- Boundary conditions for salinity
1271    IF ( ocean )  THEN
1272       IF ( bc_sa_t == 'dirichlet' )  THEN
1273          ibc_sa_t = 0
1274       ELSEIF ( bc_sa_t == 'neumann' )  THEN
1275          ibc_sa_t = 1
1276       ELSE
1277          message_string = 'unknown boundary condition: bc_sa_t = "' // &
1278                           TRIM( bc_sa_t ) // '"'
1279          CALL message( 'check_parameters', 'PA0068', 1, 2, 0, 6, 0 )
1280       ENDIF
1281
1282       IF ( top_salinityflux == 9999999.9 )  constant_top_salinityflux = .FALSE.
1283       IF ( ibc_sa_t == 1  .AND.   top_salinityflux == 9999999.9 )  THEN
1284          message_string = 'boundary condition: bc_sa_t = "' // &
1285                           TRIM( bc_sa_t ) // '" requires to set ' // &
1286                           'top_salinityflux'
1287          CALL message( 'check_parameters', 'PA0069', 1, 2, 0, 6, 0 )
1288       ENDIF
1289
1290!
1291!--    A fixed salinity at the top implies Dirichlet boundary condition for
1292!--    salinity. In this case specification of a constant salinity flux is
1293!--    forbidden.
1294       IF ( ibc_sa_t == 0  .AND.   constant_top_salinityflux  .AND. &
1295            top_salinityflux /= 0.0 )  THEN
1296          message_string = 'boundary condition: bc_sa_t = "' // &
1297                           TRIM( bc_sa_t ) // '" is not allowed with ' // &
1298                           'constant_top_salinityflux = .TRUE.'
1299          CALL message( 'check_parameters', 'PA0070', 1, 2, 0, 6, 0 )
1300       ENDIF
1301
1302    ENDIF
1303
1304!
1305!-- In case of humidity or passive scalar, set boundary conditions for total
1306!-- water content / scalar
1307    IF ( humidity  .OR.  passive_scalar ) THEN
1308       IF ( humidity )  THEN
1309          sq = 'q'
1310       ELSE
1311          sq = 's'
1312       ENDIF
1313       IF ( bc_q_b == 'dirichlet' )  THEN
1314          ibc_q_b = 0
1315       ELSEIF ( bc_q_b == 'neumann' )  THEN
1316          ibc_q_b = 1
1317       ELSE
1318          message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // &
1319                           '_b ="' // TRIM( bc_q_b ) // '"'
1320          CALL message( 'check_parameters', 'PA0071', 1, 2, 0, 6, 0 )
1321       ENDIF
1322       IF ( bc_q_t == 'dirichlet' )  THEN
1323          ibc_q_t = 0
1324       ELSEIF ( bc_q_t == 'neumann' )  THEN
1325          ibc_q_t = 1
1326       ELSE
1327          message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // &
1328                           '_t ="' // TRIM( bc_q_t ) // '"'
1329          CALL message( 'check_parameters', 'PA0072', 1, 2, 0, 6, 0 )
1330       ENDIF
1331
1332       IF ( surface_waterflux == 0.0 )  constant_waterflux = .FALSE.
1333
1334!
1335!--    A given surface humidity implies Dirichlet boundary condition for
1336!--    humidity. In this case specification of a constant water flux is
1337!--    forbidden.
1338       IF ( ibc_q_b == 0  .AND.  constant_waterflux )  THEN
1339          message_string = 'boundary condition: bc_' // TRIM( sq ) // '_b ' // &
1340                           '= "' // TRIM( bc_q_b ) // '" is not allowed wi' // &
1341                           'th prescribed surface flux'
1342          CALL message( 'check_parameters', 'PA0073', 1, 2, 0, 6, 0 )
1343       ENDIF
1344       IF ( constant_waterflux  .AND.  q_surface_initial_change /= 0.0 )  THEN
1345          WRITE( message_string, * )  'a prescribed surface flux is not allo', &
1346                 'wed with ', sq, '_surface_initial_change (/=0) = ', &
1347                 q_surface_initial_change
1348          CALL message( 'check_parameters', 'PA0074', 1, 2, 0, 6, 0 )
1349       ENDIF
1350       
1351    ENDIF
1352
1353!
1354!-- Boundary conditions for horizontal components of wind speed
1355    IF ( bc_uv_b == 'dirichlet' )  THEN
1356       ibc_uv_b = 0
1357    ELSEIF ( bc_uv_b == 'neumann' )  THEN
1358       ibc_uv_b = 1
1359       IF ( prandtl_layer )  THEN
1360          message_string = 'boundary condition: bc_uv_b = "' // &
1361               TRIM( bc_uv_b ) // '" is not allowed with prandtl_layer = .TRUE.'
1362          CALL message( 'check_parameters', 'PA0075', 1, 2, 0, 6, 0 )
1363       ENDIF
1364    ELSE
1365       message_string = 'unknown boundary condition: bc_uv_b = "' // &
1366                        TRIM( bc_uv_b ) // '"'
1367       CALL message( 'check_parameters', 'PA0076', 1, 2, 0, 6, 0 )
1368    ENDIF
1369
1370    IF ( coupling_mode == 'ocean_to_atmosphere' )  THEN
1371       bc_uv_t = 'neumann'
1372       ibc_uv_t = 1
1373    ELSE
1374       IF ( bc_uv_t == 'dirichlet' .OR. bc_uv_t == 'dirichlet_0' )  THEN
1375          ibc_uv_t = 0
1376       ELSEIF ( bc_uv_t == 'neumann' )  THEN
1377          ibc_uv_t = 1
1378       ELSE
1379          message_string = 'unknown boundary condition: bc_uv_t = "' // &
1380                           TRIM( bc_uv_t ) // '"'
1381          CALL message( 'check_parameters', 'PA0077', 1, 2, 0, 6, 0 )
1382       ENDIF
1383    ENDIF
1384
1385!
1386!-- Compute and check, respectively, the Rayleigh Damping parameter
1387    IF ( rayleigh_damping_factor == -1.0 )  THEN
1388       IF ( momentum_advec == 'ups-scheme' )  THEN
1389          rayleigh_damping_factor = 0.01
1390       ELSE
1391          rayleigh_damping_factor = 0.0
1392       ENDIF
1393    ELSE
1394       IF ( rayleigh_damping_factor < 0.0 .OR. rayleigh_damping_factor > 1.0 ) &
1395       THEN
1396          WRITE( message_string, * )  'rayleigh_damping_factor = ', &
1397                              rayleigh_damping_factor, ' out of range [0.0,1.0]'
1398          CALL message( 'check_parameters', 'PA0078', 1, 2, 0, 6, 0 )
1399       ENDIF
1400    ENDIF
1401
1402    IF ( rayleigh_damping_height == -1.0 )  THEN
1403       IF ( .NOT. ocean )  THEN
1404          rayleigh_damping_height = 0.66666666666 * zu(nzt)
1405       ELSE
1406          rayleigh_damping_height = 0.66666666666 * zu(nzb)
1407       ENDIF
1408    ELSE
1409       IF ( .NOT. ocean )  THEN
1410          IF ( rayleigh_damping_height < 0.0  .OR. &
1411               rayleigh_damping_height > zu(nzt) )  THEN
1412             WRITE( message_string, * )  'rayleigh_damping_height = ', &
1413                   rayleigh_damping_height, ' out of range [0.0,', zu(nzt), ']'
1414             CALL message( 'check_parameters', 'PA0079', 1, 2, 0, 6, 0 )
1415          ENDIF
1416       ELSE
1417          IF ( rayleigh_damping_height > 0.0  .OR. &
1418               rayleigh_damping_height < zu(nzb) )  THEN
1419             WRITE( message_string, * )  'rayleigh_damping_height = ', &
1420                   rayleigh_damping_height, ' out of range [0.0,', zu(nzb), ']'
1421             CALL message( 'check_parameters', 'PA0079', 1, 2, 0, 6, 0 )
1422          ENDIF
1423       ENDIF
1424    ENDIF
1425
1426!
1427!-- Check limiters for Upstream-Spline scheme
1428    IF ( overshoot_limit_u < 0.0  .OR.  overshoot_limit_v < 0.0  .OR.  &
1429         overshoot_limit_w < 0.0  .OR.  overshoot_limit_pt < 0.0  .OR. &
1430         overshoot_limit_e < 0.0 )  THEN
1431       message_string = 'overshoot_limit_... < 0.0 is not allowed'
1432       CALL message( 'check_parameters', 'PA0080', 1, 2, 0, 6, 0 )
1433    ENDIF
1434    IF ( ups_limit_u < 0.0 .OR. ups_limit_v < 0.0 .OR. ups_limit_w < 0.0 .OR. &
1435         ups_limit_pt < 0.0 .OR. ups_limit_e < 0.0 )  THEN
1436       message_string = 'ups_limit_... < 0.0 is not allowed'
1437       CALL message( 'check_parameters', 'PA0081', 1, 2, 0, 6, 0 )
1438    ENDIF
1439
1440!
1441!-- Check number of chosen statistic regions. More than 10 regions are not
1442!-- allowed, because so far no more than 10 corresponding output files can
1443!-- be opened (cf. check_open)
1444    IF ( statistic_regions > 9  .OR.  statistic_regions < 0 )  THEN
1445       WRITE ( message_string, * ) 'number of statistic_regions = ', &
1446                   statistic_regions+1, ' but only 10 regions are allowed'
1447       CALL message( 'check_parameters', 'PA0082', 1, 2, 0, 6, 0 )
1448    ENDIF
1449    IF ( normalizing_region > statistic_regions  .OR. &
1450         normalizing_region < 0)  THEN
1451       WRITE ( message_string, * ) 'normalizing_region = ', &
1452                normalizing_region, ' must be >= 0 and <= ',statistic_regions, &
1453                ' (value of statistic_regions)'
1454       CALL message( 'check_parameters', 'PA0083', 1, 2, 0, 6, 0 )
1455    ENDIF
1456
1457!
1458!-- Check the interval for sorting particles.
1459!-- Using particles as cloud droplets requires sorting after each timestep.
1460    IF ( dt_sort_particles /= 0.0  .AND.  cloud_droplets )  THEN
1461       dt_sort_particles = 0.0
1462       message_string = 'dt_sort_particles is reset to 0.0 because of cloud' //&
1463                        '_droplets = .TRUE.'
1464       CALL message( 'check_parameters', 'PA0084', 0, 1, 0, 6, 0 )
1465    ENDIF
1466
1467!
1468!-- Set the default intervals for data output, if necessary
1469!-- NOTE: dt_dosp has already been set in package_parin
1470    IF ( dt_data_output /= 9999999.9 )  THEN
1471       IF ( dt_dopr           == 9999999.9 )  dt_dopr           = dt_data_output
1472       IF ( dt_dopts          == 9999999.9 )  dt_dopts          = dt_data_output
1473       IF ( dt_do2d_xy        == 9999999.9 )  dt_do2d_xy        = dt_data_output
1474       IF ( dt_do2d_xz        == 9999999.9 )  dt_do2d_xz        = dt_data_output
1475       IF ( dt_do2d_yz        == 9999999.9 )  dt_do2d_yz        = dt_data_output
1476       IF ( dt_do3d           == 9999999.9 )  dt_do3d           = dt_data_output
1477       IF ( dt_data_output_av == 9999999.9 )  dt_data_output_av = dt_data_output
1478    ENDIF
1479
1480!
1481!-- Set the default skip time intervals for data output, if necessary
1482    IF ( skip_time_dopr    == 9999999.9 ) &
1483                                       skip_time_dopr    = skip_time_data_output
1484    IF ( skip_time_dosp    == 9999999.9 ) &
1485                                       skip_time_dosp    = skip_time_data_output
1486    IF ( skip_time_do2d_xy == 9999999.9 ) &
1487                                       skip_time_do2d_xy = skip_time_data_output
1488    IF ( skip_time_do2d_xz == 9999999.9 ) &
1489                                       skip_time_do2d_xz = skip_time_data_output
1490    IF ( skip_time_do2d_yz == 9999999.9 ) &
1491                                       skip_time_do2d_yz = skip_time_data_output
1492    IF ( skip_time_do3d    == 9999999.9 ) &
1493                                       skip_time_do3d    = skip_time_data_output
1494    IF ( skip_time_data_output_av == 9999999.9 ) &
1495                                skip_time_data_output_av = skip_time_data_output
1496
1497!
1498!-- Check the average intervals (first for 3d-data, then for profiles and
1499!-- spectra)
1500    IF ( averaging_interval > dt_data_output_av )  THEN
1501       WRITE( message_string, * )  'averaging_interval = ', &
1502             averaging_interval, ' must be <= dt_data_output = ', dt_data_output
1503       CALL message( 'check_parameters', 'PA0085', 1, 2, 0, 6, 0 )
1504    ENDIF
1505
1506    IF ( averaging_interval_pr == 9999999.9 )  THEN
1507       averaging_interval_pr = averaging_interval
1508    ENDIF
1509
1510    IF ( averaging_interval_pr > dt_dopr )  THEN
1511       WRITE( message_string, * )  'averaging_interval_pr = ', &
1512             averaging_interval_pr, ' must be <= dt_dopr = ', dt_dopr
1513       CALL message( 'check_parameters', 'PA0086', 1, 2, 0, 6, 0 )
1514    ENDIF
1515
1516    IF ( averaging_interval_sp == 9999999.9 )  THEN
1517       averaging_interval_sp = averaging_interval
1518    ENDIF
1519
1520    IF ( averaging_interval_sp > dt_dosp )  THEN
1521       WRITE( message_string, * )  'averaging_interval_sp = ', &
1522             averaging_interval_sp, ' must be <= dt_dosp = ', dt_dosp
1523       CALL message( 'check_parameters', 'PA0087', 1, 2, 0, 6, 0 )
1524    ENDIF
1525
1526!
1527!-- Set the default interval for profiles entering the temporal average
1528    IF ( dt_averaging_input_pr == 9999999.9 )  THEN
1529       dt_averaging_input_pr = dt_averaging_input
1530    ENDIF
1531
1532!
1533!-- Set the default interval for the output of timeseries to a reasonable
1534!-- value (tries to minimize the number of calls of flow_statistics)
1535    IF ( dt_dots == 9999999.9 )  THEN
1536       IF ( averaging_interval_pr == 0.0 )  THEN
1537          dt_dots = MIN( dt_run_control, dt_dopr )
1538       ELSE
1539          dt_dots = MIN( dt_run_control, dt_averaging_input_pr )
1540       ENDIF
1541    ENDIF
1542
1543!
1544!-- Check the sample rate for averaging (first for 3d-data, then for profiles)
1545    IF ( dt_averaging_input > averaging_interval )  THEN
1546       WRITE( message_string, * )  'dt_averaging_input = ', &
1547                dt_averaging_input, ' must be <= averaging_interval = ', &
1548                averaging_interval
1549       CALL message( 'check_parameters', 'PA0088', 1, 2, 0, 6, 0 )
1550    ENDIF
1551
1552    IF ( dt_averaging_input_pr > averaging_interval_pr )  THEN
1553       WRITE( message_string, * )  'dt_averaging_input_pr = ', &
1554                dt_averaging_input_pr, ' must be <= averaging_interval_pr = ', &
1555                averaging_interval_pr
1556       CALL message( 'check_parameters', 'PA0089', 1, 2, 0, 6, 0 )
1557    ENDIF
1558
1559!
1560!-- Set the default value for the integration interval of precipitation amount
1561    IF ( precipitation )  THEN
1562       IF ( precipitation_amount_interval == 9999999.9 )  THEN
1563          precipitation_amount_interval = dt_do2d_xy
1564       ELSE
1565          IF ( precipitation_amount_interval > dt_do2d_xy )  THEN
1566             WRITE( message_string, * )  'precipitation_amount_interval = ', &
1567                 precipitation_amount_interval, ' must not be larger than ', &
1568                 'dt_do2d_xy = ', dt_do2d_xy
1569             CALL message( 'check_parameters', 'PA0090', 1, 2, 0, 6, 0 )
1570          ENDIF
1571       ENDIF
1572    ENDIF
1573
1574!
1575!-- Determine the number of output profiles and check whether they are
1576!-- permissible
1577    DO  WHILE ( data_output_pr(dopr_n+1) /= '          ' )
1578
1579       dopr_n = dopr_n + 1
1580       i = dopr_n
1581
1582!
1583!--    Determine internal profile number (for hom, homs)
1584!--    and store height levels
1585       SELECT CASE ( TRIM( data_output_pr(i) ) )
1586
1587          CASE ( 'u', '#u' )
1588             dopr_index(i) = 1
1589             dopr_unit(i)  = 'm/s'
1590             hom(:,2,1,:)  = SPREAD( zu, 2, statistic_regions+1 )
1591             IF ( data_output_pr(i)(1:1) == '#' )  THEN
1592                dopr_initial_index(i) = 5
1593                hom(:,2,5,:)          = SPREAD( zu, 2, statistic_regions+1 )
1594                data_output_pr(i)     = data_output_pr(i)(2:)
1595             ENDIF
1596
1597          CASE ( 'v', '#v' )
1598             dopr_index(i) = 2
1599             dopr_unit(i)  = 'm/s'
1600             hom(:,2,2,:)  = SPREAD( zu, 2, statistic_regions+1 )
1601             IF ( data_output_pr(i)(1:1) == '#' )  THEN
1602                dopr_initial_index(i) = 6
1603                hom(:,2,6,:)          = SPREAD( zu, 2, statistic_regions+1 )
1604                data_output_pr(i)     = data_output_pr(i)(2:)
1605             ENDIF
1606
1607          CASE ( 'w' )
1608             dopr_index(i) = 3
1609             dopr_unit(i)  = 'm/s'
1610             hom(:,2,3,:)  = SPREAD( zw, 2, statistic_regions+1 )
1611
1612          CASE ( 'pt', '#pt' )
1613             IF ( .NOT. cloud_physics ) THEN
1614                dopr_index(i) = 4
1615                dopr_unit(i)  = 'K'
1616                hom(:,2,4,:)  = SPREAD( zu, 2, statistic_regions+1 )
1617                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1618                   dopr_initial_index(i) = 7
1619                   hom(:,2,7,:)          = SPREAD( zu, 2, statistic_regions+1 )
1620                   hom(nzb,2,7,:)        = 0.0    ! because zu(nzb) is negative
1621                   data_output_pr(i)     = data_output_pr(i)(2:)
1622                ENDIF
1623             ELSE
1624                dopr_index(i) = 43
1625                dopr_unit(i)  = 'K'
1626                hom(:,2,43,:)  = SPREAD( zu, 2, statistic_regions+1 )
1627                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1628                   dopr_initial_index(i) = 28
1629                   hom(:,2,28,:)         = SPREAD( zu, 2, statistic_regions+1 )
1630                   hom(nzb,2,28,:)       = 0.0    ! because zu(nzb) is negative
1631                   data_output_pr(i)     = data_output_pr(i)(2:)
1632                ENDIF
1633             ENDIF
1634
1635          CASE ( 'e' )
1636             dopr_index(i)  = 8
1637             dopr_unit(i)   = 'm2/s2'
1638             hom(:,2,8,:)   = SPREAD( zu, 2, statistic_regions+1 )
1639             hom(nzb,2,8,:) = 0.0
1640
1641          CASE ( 'km', '#km' )
1642             dopr_index(i)  = 9
1643             dopr_unit(i)   = 'm2/s'
1644             hom(:,2,9,:)   = SPREAD( zu, 2, statistic_regions+1 )
1645             hom(nzb,2,9,:) = 0.0
1646             IF ( data_output_pr(i)(1:1) == '#' )  THEN
1647                dopr_initial_index(i) = 23
1648                hom(:,2,23,:)         = hom(:,2,9,:)
1649                data_output_pr(i)     = data_output_pr(i)(2:)
1650             ENDIF
1651
1652          CASE ( 'kh', '#kh' )
1653             dopr_index(i)   = 10
1654             dopr_unit(i)    = 'm2/s'
1655             hom(:,2,10,:)   = SPREAD( zu, 2, statistic_regions+1 )
1656             hom(nzb,2,10,:) = 0.0
1657             IF ( data_output_pr(i)(1:1) == '#' )  THEN
1658                dopr_initial_index(i) = 24
1659                hom(:,2,24,:)         = hom(:,2,10,:)
1660                data_output_pr(i)     = data_output_pr(i)(2:)
1661             ENDIF
1662
1663          CASE ( 'l', '#l' )
1664             dopr_index(i)   = 11
1665             dopr_unit(i)    = 'm'
1666             hom(:,2,11,:)   = SPREAD( zu, 2, statistic_regions+1 )
1667             hom(nzb,2,11,:) = 0.0
1668             IF ( data_output_pr(i)(1:1) == '#' )  THEN
1669                dopr_initial_index(i) = 25
1670                hom(:,2,25,:)         = hom(:,2,11,:)
1671                data_output_pr(i)     = data_output_pr(i)(2:)
1672             ENDIF
1673
1674          CASE ( 'w"u"' )
1675             dopr_index(i) = 12
1676             dopr_unit(i)  = 'm2/s2'
1677             hom(:,2,12,:) = SPREAD( zw, 2, statistic_regions+1 )
1678             IF ( prandtl_layer )  hom(nzb,2,12,:) = zu(1)
1679
1680          CASE ( 'w*u*' )
1681             dopr_index(i) = 13
1682             dopr_unit(i)  = 'm2/s2'
1683             hom(:,2,13,:) = SPREAD( zw, 2, statistic_regions+1 )
1684
1685          CASE ( 'w"v"' )
1686             dopr_index(i) = 14
1687             dopr_unit(i)  = 'm2/s2'
1688             hom(:,2,14,:) = SPREAD( zw, 2, statistic_regions+1 )
1689             IF ( prandtl_layer )  hom(nzb,2,14,:) = zu(1)
1690
1691          CASE ( 'w*v*' )
1692             dopr_index(i) = 15
1693             dopr_unit(i)  = 'm2/s2'
1694             hom(:,2,15,:) = SPREAD( zw, 2, statistic_regions+1 )
1695
1696          CASE ( 'w"pt"' )
1697             dopr_index(i) = 16
1698             dopr_unit(i)  = 'K m/s'
1699             hom(:,2,16,:) = SPREAD( zw, 2, statistic_regions+1 )
1700
1701          CASE ( 'w*pt*' )
1702             dopr_index(i) = 17
1703             dopr_unit(i)  = 'K m/s'
1704             hom(:,2,17,:) = SPREAD( zw, 2, statistic_regions+1 )
1705
1706          CASE ( 'wpt' )
1707             dopr_index(i) = 18
1708             dopr_unit(i)  = 'K m/s'
1709             hom(:,2,18,:) = SPREAD( zw, 2, statistic_regions+1 )
1710
1711          CASE ( 'wu' )
1712             dopr_index(i) = 19
1713             dopr_unit(i)  = 'm2/s2'
1714             hom(:,2,19,:) = SPREAD( zw, 2, statistic_regions+1 )
1715             IF ( prandtl_layer )  hom(nzb,2,19,:) = zu(1)
1716
1717          CASE ( 'wv' )
1718             dopr_index(i) = 20
1719             dopr_unit(i)  = 'm2/s2'
1720             hom(:,2,20,:) = SPREAD( zw, 2, statistic_regions+1 )
1721             IF ( prandtl_layer )  hom(nzb,2,20,:) = zu(1)
1722
1723          CASE ( 'w*pt*BC' )
1724             dopr_index(i) = 21
1725             dopr_unit(i)  = 'K m/s'
1726             hom(:,2,21,:) = SPREAD( zw, 2, statistic_regions+1 )
1727
1728          CASE ( 'wptBC' )
1729             dopr_index(i) = 22
1730             dopr_unit(i)  = 'K m/s'
1731             hom(:,2,22,:) = SPREAD( zw, 2, statistic_regions+1 )
1732
1733          CASE ( 'sa', '#sa' )
1734             IF ( .NOT. ocean )  THEN
1735                message_string = 'data_output_pr = ' // &
1736                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1737                                 'lemented for ocean = .FALSE.'
1738                CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
1739             ELSE
1740                dopr_index(i) = 23
1741                dopr_unit(i)  = 'psu'
1742                hom(:,2,23,:) = SPREAD( zu, 2, statistic_regions+1 )
1743                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1744                   dopr_initial_index(i) = 26
1745                   hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
1746                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
1747                   data_output_pr(i)     = data_output_pr(i)(2:)
1748                ENDIF
1749             ENDIF
1750
1751          CASE ( 'u*2' )
1752             dopr_index(i) = 30
1753             dopr_unit(i)  = 'm2/s2'
1754             hom(:,2,30,:) = SPREAD( zu, 2, statistic_regions+1 )
1755
1756          CASE ( 'v*2' )
1757             dopr_index(i) = 31
1758             dopr_unit(i)  = 'm2/s2'
1759             hom(:,2,31,:) = SPREAD( zu, 2, statistic_regions+1 )
1760
1761          CASE ( 'w*2' )
1762             dopr_index(i) = 32
1763             dopr_unit(i)  = 'm2/s2'
1764             hom(:,2,32,:) = SPREAD( zw, 2, statistic_regions+1 )
1765
1766          CASE ( 'pt*2' )
1767             dopr_index(i) = 33
1768             dopr_unit(i)  = 'K2'
1769             hom(:,2,33,:) = SPREAD( zu, 2, statistic_regions+1 )
1770
1771          CASE ( 'e*' )
1772             dopr_index(i) = 34
1773             dopr_unit(i)  = 'm2/s2'
1774             hom(:,2,34,:) = SPREAD( zu, 2, statistic_regions+1 )
1775
1776          CASE ( 'w*2pt*' )
1777             dopr_index(i) = 35
1778             dopr_unit(i)  = 'K m2/s2'
1779             hom(:,2,35,:) = SPREAD( zw, 2, statistic_regions+1 )
1780
1781          CASE ( 'w*pt*2' )
1782             dopr_index(i) = 36
1783             dopr_unit(i)  = 'K2 m/s'
1784             hom(:,2,36,:) = SPREAD( zw, 2, statistic_regions+1 )
1785
1786          CASE ( 'w*e*' )
1787             dopr_index(i) = 37
1788             dopr_unit(i)  = 'm3/s3'
1789             hom(:,2,37,:) = SPREAD( zw, 2, statistic_regions+1 )
1790
1791          CASE ( 'w*3' )
1792             dopr_index(i) = 38
1793             dopr_unit(i)  = 'm3/s3'
1794             hom(:,2,38,:) = SPREAD( zw, 2, statistic_regions+1 )
1795
1796          CASE ( 'Sw' )
1797             dopr_index(i) = 39
1798             dopr_unit(i)  = 'none'
1799             hom(:,2,39,:) = SPREAD( zw, 2, statistic_regions+1 )
1800
1801          CASE ( 'p' )
1802             dopr_index(i) = 40
1803             dopr_unit(i)  = 'Pa'
1804             hom(:,2,40,:) = SPREAD( zu, 2, statistic_regions+1 )
1805
1806          CASE ( 'q', '#q' )
1807             IF ( .NOT. humidity )  THEN
1808                message_string = 'data_output_pr = ' // &
1809                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1810                                 'lemented for humidity = .FALSE.'
1811                CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 )
1812             ELSE
1813                dopr_index(i) = 41
1814                dopr_unit(i)  = 'kg/kg'
1815                hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 )
1816                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1817                   dopr_initial_index(i) = 26
1818                   hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
1819                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
1820                   data_output_pr(i)     = data_output_pr(i)(2:)
1821                ENDIF
1822             ENDIF
1823
1824          CASE ( 's', '#s' )
1825             IF ( .NOT. passive_scalar )  THEN
1826                message_string = 'data_output_pr = ' // &
1827                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1828                                 'lemented for passive_scalar = .FALSE.'
1829                CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 )
1830             ELSE
1831                dopr_index(i) = 41
1832                dopr_unit(i)  = 'kg/m3'
1833                hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 )
1834                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1835                   dopr_initial_index(i) = 26
1836                   hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
1837                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
1838                   data_output_pr(i)     = data_output_pr(i)(2:)
1839                ENDIF
1840             ENDIF
1841
1842          CASE ( 'qv', '#qv' )
1843             IF ( .NOT. cloud_physics ) THEN
1844                dopr_index(i) = 41
1845                dopr_unit(i)  = 'kg/kg'
1846                hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 )
1847                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1848                   dopr_initial_index(i) = 26
1849                   hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
1850                   hom(nzb,2,26,:)       = 0.0    ! weil zu(nzb) negativ ist
1851                   data_output_pr(i)     = data_output_pr(i)(2:)
1852                ENDIF
1853             ELSE
1854                dopr_index(i) = 42
1855                dopr_unit(i)  = 'kg/kg'
1856                hom(:,2,42,:) = SPREAD( zu, 2, statistic_regions+1 )
1857                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1858                   dopr_initial_index(i) = 27
1859                   hom(:,2,27,:)         = SPREAD( zu, 2, statistic_regions+1 )
1860                   hom(nzb,2,27,:)       = 0.0    ! weil zu(nzb) negativ ist
1861                   data_output_pr(i)     = data_output_pr(i)(2:)
1862                ENDIF
1863             ENDIF
1864
1865          CASE ( 'lpt', '#lpt' )
1866             IF ( .NOT. cloud_physics ) THEN
1867                message_string = 'data_output_pr = ' // &
1868                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1869                                 'lemented for cloud_physics = .FALSE.'
1870                CALL message( 'check_parameters', 'PA0094', 1, 2, 0, 6, 0 )
1871             ELSE
1872                dopr_index(i) = 4
1873                dopr_unit(i)  = 'K'
1874                hom(:,2,4,:)  = SPREAD( zu, 2, statistic_regions+1 )
1875                IF ( data_output_pr(i)(1:1) == '#' )  THEN
1876                   dopr_initial_index(i) = 7
1877                   hom(:,2,7,:)          = SPREAD( zu, 2, statistic_regions+1 )
1878                   hom(nzb,2,7,:)        = 0.0    ! weil zu(nzb) negativ ist
1879                   data_output_pr(i)     = data_output_pr(i)(2:)
1880                ENDIF
1881             ENDIF
1882
1883          CASE ( 'vpt', '#vpt' )
1884             dopr_index(i) = 44
1885             dopr_unit(i)  = 'K'
1886             hom(:,2,44,:) = SPREAD( zu, 2, statistic_regions+1 )
1887             IF ( data_output_pr(i)(1:1) == '#' )  THEN
1888                dopr_initial_index(i) = 29
1889                hom(:,2,29,:)         = SPREAD( zu, 2, statistic_regions+1 )
1890                hom(nzb,2,29,:)       = 0.0    ! weil zu(nzb) negativ ist
1891                data_output_pr(i)     = data_output_pr(i)(2:)
1892             ENDIF
1893
1894          CASE ( 'w"vpt"' )
1895             dopr_index(i) = 45
1896             dopr_unit(i)  = 'K m/s'
1897             hom(:,2,45,:) = SPREAD( zw, 2, statistic_regions+1 )
1898
1899          CASE ( 'w*vpt*' )
1900             dopr_index(i) = 46
1901             dopr_unit(i)  = 'K m/s'
1902             hom(:,2,46,:) = SPREAD( zw, 2, statistic_regions+1 )
1903
1904          CASE ( 'wvpt' )
1905             dopr_index(i) = 47
1906             dopr_unit(i)  = 'K m/s'
1907             hom(:,2,47,:) = SPREAD( zw, 2, statistic_regions+1 )
1908
1909          CASE ( 'w"q"' )
1910             IF ( .NOT. humidity )  THEN
1911                message_string = 'data_output_pr = ' // &
1912                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1913                                 'lemented for humidity = .FALSE.'
1914                CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 )
1915             ELSE
1916                dopr_index(i) = 48
1917                dopr_unit(i)  = 'kg/kg m/s'
1918                hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 )
1919             ENDIF
1920
1921          CASE ( 'w*q*' )
1922             IF ( .NOT. humidity )  THEN
1923                message_string = 'data_output_pr = ' // &
1924                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1925                                 'lemented for humidity = .FALSE.'
1926                CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 )
1927             ELSE
1928                dopr_index(i) = 49
1929                dopr_unit(i)  = 'kg/kg m/s'
1930                hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 )
1931             ENDIF
1932
1933          CASE ( 'wq' )
1934             IF ( .NOT. humidity )  THEN
1935                message_string = 'data_output_pr = ' // &
1936                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1937                                 'lemented for humidity = .FALSE.'
1938                CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 )
1939             ELSE
1940                dopr_index(i) = 50
1941                dopr_unit(i)  = 'kg/kg m/s'
1942                hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 )
1943             ENDIF
1944
1945          CASE ( 'w"s"' )
1946             IF ( .NOT. passive_scalar ) THEN
1947                message_string = 'data_output_pr = ' // &
1948                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1949                                 'lemented for passive_scalar = .FALSE.'
1950                CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 )
1951             ELSE
1952                dopr_index(i) = 48
1953                dopr_unit(i)  = 'kg/m3 m/s'
1954                hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 )
1955             ENDIF
1956
1957          CASE ( 'w*s*' )
1958             IF ( .NOT. passive_scalar ) THEN
1959                message_string = 'data_output_pr = ' // &
1960                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1961                                 'lemented for passive_scalar = .FALSE.'
1962                CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 )
1963             ELSE
1964                dopr_index(i) = 49
1965                dopr_unit(i)  = 'kg/m3 m/s'
1966                hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 )
1967             ENDIF
1968
1969          CASE ( 'ws' )
1970             IF ( .NOT. passive_scalar ) THEN
1971                message_string = 'data_output_pr = ' // &
1972                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1973                                 'lemented for passive_scalar = .FALSE.'
1974                CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 )
1975             ELSE
1976                dopr_index(i) = 50
1977                dopr_unit(i)  = 'kg/m3 m/s'
1978                hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 )
1979             ENDIF
1980
1981          CASE ( 'w"qv"' )
1982             IF ( humidity  .AND.  .NOT. cloud_physics ) &
1983             THEN
1984                dopr_index(i) = 48
1985                dopr_unit(i)  = 'kg/kg m/s'
1986                hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 )
1987             ELSEIF( humidity .AND. cloud_physics ) THEN
1988                dopr_index(i) = 51
1989                dopr_unit(i)  = 'kg/kg m/s'
1990                hom(:,2,51,:) = SPREAD( zw, 2, statistic_regions+1 )
1991             ELSE
1992                message_string = 'data_output_pr = ' // &
1993                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
1994                                 'lemented for cloud_physics = .FALSE. an&' // &
1995                                 'd humidity = .FALSE.'
1996                CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 )
1997             ENDIF
1998
1999          CASE ( 'w*qv*' )
2000             IF ( humidity  .AND.  .NOT. cloud_physics ) &
2001             THEN
2002                dopr_index(i) = 49
2003                dopr_unit(i)  = 'kg/kg m/s'
2004                hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 )
2005             ELSEIF( humidity .AND. cloud_physics ) THEN
2006                dopr_index(i) = 52
2007                dopr_unit(i)  = 'kg/kg m/s'
2008                hom(:,2,52,:) = SPREAD( zw, 2, statistic_regions+1 )
2009             ELSE
2010                message_string = 'data_output_pr = ' // &
2011                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2012                                 'lemented for cloud_physics = .FALSE. an&' // &
2013                                 'd humidity = .FALSE.'
2014                CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 )
2015             ENDIF
2016
2017          CASE ( 'wqv' )
2018             IF ( humidity  .AND.  .NOT. cloud_physics ) &
2019             THEN
2020                dopr_index(i) = 50
2021                dopr_unit(i)  = 'kg/kg m/s'
2022                hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 )
2023             ELSEIF( humidity .AND. cloud_physics ) THEN
2024                dopr_index(i) = 53
2025                dopr_unit(i)  = 'kg/kg m/s'
2026                hom(:,2,53,:) = SPREAD( zw, 2, statistic_regions+1 )
2027             ELSE
2028                message_string = 'data_output_pr = ' // &
2029                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2030                                 'lemented for cloud_physics = .FALSE. an&' // &
2031                                 'd humidity = .FALSE.'
2032                CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 )
2033             ENDIF
2034
2035          CASE ( 'ql' )
2036             IF ( .NOT. cloud_physics  .AND.  .NOT. cloud_droplets )  THEN
2037                message_string = 'data_output_pr = ' // &
2038                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2039                                 'lemented for cloud_physics = .FALSE. or'  // &
2040                                 '&cloud_droplets = .FALSE.'
2041                CALL message( 'check_parameters', 'PA0096', 1, 2, 0, 6, 0 )
2042             ELSE
2043                dopr_index(i) = 54
2044                dopr_unit(i)  = 'kg/kg'
2045                hom(:,2,54,:)  = SPREAD( zu, 2, statistic_regions+1 )
2046             ENDIF
2047
2048          CASE ( 'w*u*u*/dz' )
2049             dopr_index(i) = 55
2050             dopr_unit(i)  = 'm2/s3'
2051             hom(:,2,55,:) = SPREAD( zu, 2, statistic_regions+1 )
2052
2053          CASE ( 'w*p*/dz' )
2054             dopr_index(i) = 56
2055             dopr_unit(i)  = 'm2/s3'
2056             hom(:,2,56,:) = SPREAD( zw, 2, statistic_regions+1 )
2057
2058          CASE ( 'w"e/dz' )
2059             dopr_index(i) = 57
2060             dopr_unit(i)  = 'm2/s3'
2061             hom(:,2,57,:) = SPREAD( zu, 2, statistic_regions+1 )
2062
2063          CASE ( 'u"pt"' )
2064             dopr_index(i) = 58
2065             dopr_unit(i)  = 'K m/s'
2066             hom(:,2,58,:) = SPREAD( zu, 2, statistic_regions+1 )
2067
2068          CASE ( 'u*pt*' )
2069             dopr_index(i) = 59
2070             dopr_unit(i)  = 'K m/s'
2071             hom(:,2,59,:) = SPREAD( zu, 2, statistic_regions+1 )
2072
2073          CASE ( 'upt_t' )
2074             dopr_index(i) = 60
2075             dopr_unit(i)  = 'K m/s'
2076             hom(:,2,60,:) = SPREAD( zu, 2, statistic_regions+1 )
2077
2078          CASE ( 'v"pt"' )
2079             dopr_index(i) = 61
2080             dopr_unit(i)  = 'K m/s'
2081             hom(:,2,61,:) = SPREAD( zu, 2, statistic_regions+1 )
2082             
2083          CASE ( 'v*pt*' )
2084             dopr_index(i) = 62
2085             dopr_unit(i)  = 'K m/s'
2086             hom(:,2,62,:) = SPREAD( zu, 2, statistic_regions+1 )
2087
2088          CASE ( 'vpt_t' )
2089             dopr_index(i) = 63
2090             dopr_unit(i)  = 'K m/s'
2091             hom(:,2,63,:) = SPREAD( zu, 2, statistic_regions+1 )
2092
2093          CASE ( 'rho' )
2094             IF ( .NOT. ocean ) THEN
2095                message_string = 'data_output_pr = ' // &
2096                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2097                                 'lemented for ocean = .FALSE.'
2098                CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
2099             ELSE
2100                dopr_index(i) = 64
2101                dopr_unit(i)  = 'kg/m3'
2102                hom(:,2,64,:) = SPREAD( zu, 2, statistic_regions+1 )
2103             ENDIF
2104
2105          CASE ( 'w"sa"' )
2106             IF ( .NOT. ocean ) THEN
2107                message_string = 'data_output_pr = ' // &
2108                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2109                                 'lemented for ocean = .FALSE.'
2110                CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
2111             ELSE
2112                dopr_index(i) = 65
2113                dopr_unit(i)  = 'psu m/s'
2114                hom(:,2,65,:) = SPREAD( zw, 2, statistic_regions+1 )
2115             ENDIF
2116
2117          CASE ( 'w*sa*' )
2118             IF ( .NOT. ocean ) THEN
2119                message_string = 'data_output_pr = ' // &
2120                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2121                                 'lemented for ocean = .FALSE.'
2122                CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
2123             ELSE
2124                dopr_index(i) = 66
2125                dopr_unit(i)  = 'psu m/s'
2126                hom(:,2,66,:) = SPREAD( zw, 2, statistic_regions+1 )
2127             ENDIF
2128
2129          CASE ( 'wsa' )
2130             IF ( .NOT. ocean ) THEN
2131                message_string = 'data_output_pr = ' // &
2132                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2133                                 'lemented for ocean = .FALSE.'
2134                CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
2135             ELSE
2136                dopr_index(i) = 67
2137                dopr_unit(i)  = 'psu m/s'
2138                hom(:,2,67,:) = SPREAD( zw, 2, statistic_regions+1 )
2139             ENDIF
2140
2141          CASE ( 'w*p*' )
2142             dopr_index(i) = 68
2143             dopr_unit(i)  = 'm3/s3'
2144             hom(:,2,68,:) = SPREAD( zu, 2, statistic_regions+1 )
2145
2146          CASE ( 'w"e' )
2147             dopr_index(i) = 69
2148             dopr_unit(i)  = 'm3/s3'
2149             hom(:,2,69,:) = SPREAD( zu, 2, statistic_regions+1 )
2150
2151          CASE ( 'q*2' )
2152             IF ( .NOT. humidity )  THEN
2153                message_string = 'data_output_pr = ' // &
2154                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2155                                 'lemented for humidity = .FALSE.'
2156                CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 )
2157             ELSE
2158                dopr_index(i) = 70
2159                dopr_unit(i)  = 'kg2/kg2'
2160                hom(:,2,70,:) = SPREAD( zu, 2, statistic_regions+1 )
2161             ENDIF
2162
2163          CASE ( 'prho' )
2164             IF ( .NOT. ocean ) THEN
2165                message_string = 'data_output_pr = ' // &
2166                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
2167                                 'lemented for ocean = .FALSE.'
2168                CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
2169             ELSE
2170                dopr_index(i) = 71
2171                dopr_unit(i)  = 'kg/m3'
2172                hom(:,2,71,:) = SPREAD( zu, 2, statistic_regions+1 )
2173             ENDIF
2174
2175          CASE ( 'hyp' )
2176             dopr_index(i) = 72
2177             dopr_unit(i)  = 'kPa'
2178             hom(:,2,72,:) = SPREAD( zu, 2, statistic_regions+1 )
2179
2180          CASE DEFAULT
2181
2182             CALL user_check_data_output_pr( data_output_pr(i), i, unit )
2183
2184             IF ( unit == 'illegal' )  THEN
2185                IF ( data_output_pr_user(1) /= ' ' )  THEN
2186                   message_string = 'illegal value for data_output_pr or ' // &
2187                                    'data_output_pr_user = "' // &
2188                                    TRIM( data_output_pr(i) ) // '"'
2189                   CALL message( 'check_parameters', 'PA0097', 1, 2, 0, 6, 0 )
2190                ELSE
2191                   message_string = 'illegal value for data_output_pr = "' // &
2192                                    TRIM( data_output_pr(i) ) // '"'
2193                   CALL message( 'check_parameters', 'PA0098', 1, 2, 0, 6, 0 )
2194                ENDIF
2195             ENDIF
2196
2197       END SELECT
2198!
2199!--    Check to which of the predefined coordinate systems the profile belongs
2200       DO  k = 1, crmax
2201          IF ( INDEX( cross_profiles(k), ' '//TRIM( data_output_pr(i) )//' ' ) &
2202               /=0 ) &
2203          THEN
2204             dopr_crossindex(i) = k
2205             EXIT
2206          ENDIF
2207       ENDDO
2208!
2209!--    Generate the text for the labels of the PROFIL output file. "-characters
2210!--    must be substituted, otherwise PROFIL would interpret them as TeX
2211!--    control characters
2212       dopr_label(i) = data_output_pr(i)
2213       position = INDEX( dopr_label(i) , '"' )
2214       DO WHILE ( position /= 0 )
2215          dopr_label(i)(position:position) = ''''
2216          position = INDEX( dopr_label(i) , '"' )
2217       ENDDO
2218
2219    ENDDO
2220
2221!
2222!-- y-value range of the coordinate system (PROFIL).
2223!-- x-value range determined in plot_1d.
2224    IF ( .NOT. ocean )  THEN
2225       cross_uymin = 0.0
2226       IF ( z_max_do1d == -1.0 )  THEN
2227          cross_uymax = zu(nzt+1)
2228       ELSEIF ( z_max_do1d < zu(nzb+1)  .OR.  z_max_do1d > zu(nzt+1) )  THEN
2229          WRITE( message_string, * )  'z_max_do1d = ', z_max_do1d, ' must ', &
2230                 'be >= ', zu(nzb+1), ' or <= ', zu(nzt+1)
2231          CALL message( 'check_parameters', 'PA0099', 1, 2, 0, 6, 0 )
2232       ELSE
2233          cross_uymax = z_max_do1d
2234       ENDIF
2235    ENDIF
2236
2237!
2238!-- Check whether the chosen normalizing factor for the coordinate systems is
2239!-- permissible
2240    DO  i = 1, crmax
2241       SELECT CASE ( TRIM( cross_normalized_x(i) ) )  ! TRIM required on IBM
2242
2243          CASE ( '', 'wpt0', 'ws2', 'tsw2', 'ws3', 'ws2tsw', 'wstsw2' )
2244             j = 0
2245
2246          CASE DEFAULT
2247             message_string = 'unknown normalization method cross_normali' // &
2248                              'zed_x = "' // TRIM( cross_normalized_x(i) ) // &
2249                              '"'
2250             CALL message( 'check_parameters', 'PA0100', 1, 2, 0, 6, 0 )
2251
2252       END SELECT
2253       SELECT CASE ( TRIM( cross_normalized_y(i) ) )  ! TRIM required on IBM
2254
2255          CASE ( '', 'z_i' )
2256             j = 0
2257
2258          CASE DEFAULT
2259             message_string = 'unknown normalization method cross_normali' // &
2260                              'zed_y = "' // TRIM( cross_normalized_y(i) ) // &
2261                              '"'
2262             CALL message( 'check_parameters', 'PA0101', 1, 2, 0, 6, 0 )
2263
2264       END SELECT
2265    ENDDO
2266!
2267!-- Check normalized y-value range of the coordinate system (PROFIL)
2268    IF ( z_max_do1d_normalized /= -1.0  .AND.  z_max_do1d_normalized <= 0.0 ) &
2269    THEN
2270       WRITE( message_string, * )  'z_max_do1d_normalized = ', &
2271                                   z_max_do1d_normalized, ' must be >= 0.0'
2272       CALL message( 'check_parameters', 'PA0101', 1, 2, 0, 6, 0 )
2273    ENDIF
2274
2275
2276!
2277!-- Append user-defined data output variables to the standard data output
2278    IF ( data_output_user(1) /= ' ' )  THEN
2279       i = 1
2280       DO  WHILE ( data_output(i) /= ' '  .AND.  i <= 100 )
2281          i = i + 1
2282       ENDDO
2283       j = 1
2284       DO  WHILE ( data_output_user(j) /= ' '  .AND.  j <= 100 )
2285          IF ( i > 100 )  THEN
2286             message_string = 'number of output quantitities given by data' // &
2287                '_output and data_output_user exceeds the limit of 100'
2288             CALL message( 'check_parameters', 'PA0102', 1, 2, 0, 6, 0 )
2289          ENDIF
2290          data_output(i) = data_output_user(j)
2291          i = i + 1
2292          j = j + 1
2293       ENDDO
2294    ENDIF
2295
2296!
2297!-- Check and set steering parameters for 2d/3d data output and averaging
2298    i   = 1
2299    DO  WHILE ( data_output(i) /= ' '  .AND.  i <= 100 )
2300!
2301!--    Check for data averaging
2302       ilen = LEN_TRIM( data_output(i) )
2303       j = 0                                                 ! no data averaging
2304       IF ( ilen > 3 )  THEN
2305          IF ( data_output(i)(ilen-2:ilen) == '_av' )  THEN
2306             j = 1                                           ! data averaging
2307             data_output(i) = data_output(i)(1:ilen-3)
2308          ENDIF
2309       ENDIF
2310!
2311!--    Check for cross section or volume data
2312       ilen = LEN_TRIM( data_output(i) )
2313       k = 0                                                   ! 3d data
2314       var = data_output(i)(1:ilen)
2315       IF ( ilen > 3 )  THEN
2316          IF ( data_output(i)(ilen-2:ilen) == '_xy'  .OR. &
2317               data_output(i)(ilen-2:ilen) == '_xz'  .OR. &
2318               data_output(i)(ilen-2:ilen) == '_yz' )  THEN
2319             k = 1                                             ! 2d data
2320             var = data_output(i)(1:ilen-3)
2321          ENDIF
2322       ENDIF
2323!
2324!--    Check for allowed value and set units
2325       SELECT CASE ( TRIM( var ) )
2326
2327          CASE ( 'e' )
2328             IF ( constant_diffusion )  THEN
2329                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2330                                 'res constant_diffusion = .FALSE.'
2331                CALL message( 'check_parameters', 'PA0103', 1, 2, 0, 6, 0 )
2332             ENDIF
2333             unit = 'm2/s2'
2334
2335          CASE ( 'pc', 'pr' )
2336             IF ( .NOT. particle_advection )  THEN
2337                message_string = 'output of "' // TRIM( var ) // '" requir' // &
2338                   'es a "particles_par"-NAMELIST in the parameter file (PARIN)'
2339                CALL message( 'check_parameters', 'PA0104', 1, 2, 0, 6, 0 )
2340             ENDIF
2341             IF ( TRIM( var ) == 'pc' )  unit = 'number'
2342             IF ( TRIM( var ) == 'pr' )  unit = 'm'
2343
2344          CASE ( 'q', 'vpt' )
2345             IF ( .NOT. humidity )  THEN
2346                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2347                                 'res humidity = .TRUE.'
2348                CALL message( 'check_parameters', 'PA0105', 1, 2, 0, 6, 0 )
2349             ENDIF
2350             IF ( TRIM( var ) == 'q'   )  unit = 'kg/kg'
2351             IF ( TRIM( var ) == 'vpt' )  unit = 'K'
2352
2353          CASE ( 'ql' )
2354             IF ( .NOT. ( cloud_physics  .OR.  cloud_droplets ) )  THEN
2355                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2356                         'res cloud_physics = .TRUE. or cloud_droplets = .TRUE.'
2357                CALL message( 'check_parameters', 'PA0106', 1, 2, 0, 6, 0 )
2358             ENDIF
2359             unit = 'kg/kg'
2360
2361          CASE ( 'ql_c', 'ql_v', 'ql_vp' )
2362             IF ( .NOT. cloud_droplets )  THEN
2363                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2364                                 'res cloud_droplets = .TRUE.'
2365                CALL message( 'check_parameters', 'PA0107', 1, 2, 0, 6, 0 )
2366             ENDIF
2367             IF ( TRIM( var ) == 'ql_c'  )  unit = 'kg/kg'
2368             IF ( TRIM( var ) == 'ql_v'  )  unit = 'm3'
2369             IF ( TRIM( var ) == 'ql_vp' )  unit = 'none'
2370
2371          CASE ( 'qv' )
2372             IF ( .NOT. cloud_physics )  THEN
2373                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2374                                 'res cloud_physics = .TRUE.'
2375                CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 )
2376             ENDIF
2377             unit = 'kg/kg'
2378
2379          CASE ( 'rho' )
2380             IF ( .NOT. ocean )  THEN
2381                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2382                                 'res ocean = .TRUE.'
2383                CALL message( 'check_parameters', 'PA0109', 1, 2, 0, 6, 0 )
2384             ENDIF
2385             unit = 'kg/m3'
2386
2387          CASE ( 's' )
2388             IF ( .NOT. passive_scalar )  THEN
2389                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2390                                 'res passive_scalar = .TRUE.'
2391                CALL message( 'check_parameters', 'PA0110', 1, 2, 0, 6, 0 )
2392             ENDIF
2393             unit = 'conc'
2394
2395          CASE ( 'sa' )
2396             IF ( .NOT. ocean )  THEN
2397                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2398                                 'res ocean = .TRUE.'
2399                CALL message( 'check_parameters', 'PA0109', 1, 2, 0, 6, 0 )
2400             ENDIF
2401             unit = 'psu'
2402
2403          CASE ( 'u*', 't*', 'lwp*', 'pra*', 'prr*', 'qsws*', 'shf*', 'z0*' )
2404             IF ( k == 0  .OR.  data_output(i)(ilen-2:ilen) /= '_xy' )  THEN
2405                message_string = 'illegal value for data_output: "' // &
2406                                 TRIM( var ) // '" & only 2d-horizontal ' // &
2407                                 'cross sections are allowed for this value'
2408                CALL message( 'check_parameters', 'PA0111', 1, 2, 0, 6, 0 )
2409             ENDIF
2410             IF ( TRIM( var ) == 'lwp*'  .AND.  .NOT. cloud_physics )  THEN
2411                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2412                                 'res cloud_physics = .TRUE.'
2413                CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 )
2414             ENDIF
2415             IF ( TRIM( var ) == 'pra*'  .AND.  .NOT. precipitation )  THEN
2416                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2417                                 'res precipitation = .TRUE.'
2418                CALL message( 'check_parameters', 'PA0112', 1, 2, 0, 6, 0 )
2419             ENDIF
2420             IF ( TRIM( var ) == 'pra*'  .AND.  j == 1 )  THEN
2421                message_string = 'temporal averaging of precipitation ' // &
2422                          'amount "' // TRIM( var ) // '" is not possible'
2423                CALL message( 'check_parameters', 'PA0113', 1, 2, 0, 6, 0 )
2424             ENDIF
2425             IF ( TRIM( var ) == 'prr*'  .AND.  .NOT. precipitation )  THEN
2426                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2427                                 'res precipitation = .TRUE.'
2428                CALL message( 'check_parameters', 'PA0112', 1, 2, 0, 6, 0 )
2429             ENDIF
2430             IF ( TRIM( var ) == 'qsws*'  .AND.  .NOT. humidity )  THEN
2431                message_string = 'output of "' // TRIM( var ) // '" requi' // &
2432                                 'res humidity = .TRUE.'
2433                CALL message( 'check_parameters', 'PA0322', 1, 2, 0, 6, 0 )
2434             ENDIF
2435
2436             IF ( TRIM( var ) == 'lwp*'   )  unit = 'kg/kg*m'
2437             IF ( TRIM( var ) == 'pra*'   )  unit = 'mm'
2438             IF ( TRIM( var ) == 'prr*'   )  unit = 'mm/s'
2439             IF ( TRIM( var ) == 'qsws*'  )  unit = 'kgm/kgs'
2440             IF ( TRIM( var ) == 'shf*'   )  unit = 'K*m/s'
2441             IF ( TRIM( var ) == 't*'     )  unit = 'K'
2442             IF ( TRIM( var ) == 'u*'     )  unit = 'm/s'
2443             IF ( TRIM( var ) == 'z0*'    )  unit = 'm'
2444
2445
2446          CASE ( 'p', 'pt', 'u', 'v', 'w' )
2447             IF ( TRIM( var ) == 'p'  )  unit = 'Pa'
2448             IF ( TRIM( var ) == 'pt' )  unit = 'K'
2449             IF ( TRIM( var ) == 'u'  )  unit = 'm/s'
2450             IF ( TRIM( var ) == 'v'  )  unit = 'm/s'
2451             IF ( TRIM( var ) == 'w'  )  unit = 'm/s'
2452             CONTINUE
2453
2454          CASE DEFAULT
2455             CALL user_check_data_output( var, unit )
2456
2457             IF ( unit == 'illegal' )  THEN
2458                IF ( data_output_user(1) /= ' ' )  THEN
2459                   message_string = 'illegal value for data_output or ' // &
2460                         'data_output_user = "' // TRIM( data_output(i) ) // '"'
2461                   CALL message( 'check_parameters', 'PA0114', 1, 2, 0, 6, 0 )
2462                ELSE
2463                   message_string = 'illegal value for data_output =' // &
2464                                    TRIM( data_output(i) ) // '"'
2465                   CALL message( 'check_parameters', 'PA0115', 1, 2, 0, 6, 0 )
2466                ENDIF
2467             ENDIF
2468
2469       END SELECT
2470!
2471!--    Set the internal steering parameters appropriately
2472       IF ( k == 0 )  THEN
2473          do3d_no(j)              = do3d_no(j) + 1
2474          do3d(j,do3d_no(j))      = data_output(i)
2475          do3d_unit(j,do3d_no(j)) = unit
2476       ELSE
2477          do2d_no(j)              = do2d_no(j) + 1
2478          do2d(j,do2d_no(j))      = data_output(i)
2479          do2d_unit(j,do2d_no(j)) = unit
2480          IF ( data_output(i)(ilen-2:ilen) == '_xy' )  THEN
2481             data_output_xy(j) = .TRUE.
2482          ENDIF
2483          IF ( data_output(i)(ilen-2:ilen) == '_xz' )  THEN
2484             data_output_xz(j) = .TRUE.
2485          ENDIF
2486          IF ( data_output(i)(ilen-2:ilen) == '_yz' )  THEN
2487             data_output_yz(j) = .TRUE.
2488          ENDIF
2489       ENDIF
2490
2491       IF ( j == 1 )  THEN
2492!
2493!--       Check, if variable is already subject to averaging
2494          found = .FALSE.
2495          DO  k = 1, doav_n
2496             IF ( TRIM( doav(k) ) == TRIM( var ) )  found = .TRUE.
2497          ENDDO
2498
2499          IF ( .NOT. found )  THEN
2500             doav_n = doav_n + 1
2501             doav(doav_n) = var
2502          ENDIF
2503       ENDIF
2504
2505       i = i + 1
2506    ENDDO
2507
2508!
2509!-- Averaged 2d or 3d output requires that an averaging interval has been set
2510    IF ( doav_n > 0  .AND.  averaging_interval == 0.0 )  THEN
2511       WRITE( message_string, * )  'output of averaged quantity "',            &
2512                                   TRIM( doav(1) ), '_av" requires to set a ', &
2513                                   'non-zero & averaging interval'
2514       CALL message( 'check_parameters', 'PA0323', 1, 2, 0, 6, 0 )
2515    ENDIF
2516
2517!
2518!-- Check sectional planes and store them in one shared array
2519    IF ( ANY( section_xy > nz + 1 ) )  THEN
2520       WRITE( message_string, * )  'section_xy must be <= nz + 1 = ', nz + 1
2521       CALL message( 'check_parameters', 'PA0319', 1, 2, 0, 6, 0 )
2522    ENDIF
2523    IF ( ANY( section_xz > ny + 1 ) )  THEN
2524       WRITE( message_string, * )  'section_xz must be <= ny + 1 = ', ny + 1
2525       CALL message( 'check_parameters', 'PA0320', 1, 2, 0, 6, 0 )
2526    ENDIF
2527    IF ( ANY( section_yz > nx + 1 ) )  THEN
2528       WRITE( message_string, * )  'section_yz must be <= nx + 1 = ', nx + 1
2529       CALL message( 'check_parameters', 'PA0321', 1, 2, 0, 6, 0 )
2530    ENDIF
2531    section(:,1) = section_xy
2532    section(:,2) = section_xz
2533    section(:,3) = section_yz
2534
2535!
2536!-- Upper plot limit (grid point value) for 1D profiles
2537    IF ( z_max_do1d == -1.0 )  THEN
2538       nz_do1d = nzt+1
2539    ELSE
2540       DO  k = nzb+1, nzt+1
2541          nz_do1d = k
2542          IF ( zw(k) > z_max_do1d )  EXIT
2543       ENDDO
2544    ENDIF
2545
2546!
2547!-- Upper plot limit for 2D vertical sections
2548    IF ( z_max_do2d == -1.0 )  z_max_do2d = zu(nzt)
2549    IF ( z_max_do2d < zu(nzb+1)  .OR.  z_max_do2d > zu(nzt) )  THEN
2550       WRITE( message_string, * )  'z_max_do2d = ', z_max_do2d, &
2551                    ' must be >= ', zu(nzb+1), '(zu(nzb+1)) and <= ', zu(nzt), &
2552                    ' (zu(nzt))'
2553       CALL message( 'check_parameters', 'PA0116', 1, 2, 0, 6, 0 )
2554    ENDIF
2555
2556!
2557!-- Upper plot limit for 3D arrays
2558    IF ( nz_do3d == -9999 )  nz_do3d = nzt + 1
2559
2560!
2561!-- Determine and check accuracy for compressed 3D plot output
2562    IF ( do3d_compress )  THEN
2563!
2564!--    Compression only permissible on T3E machines
2565       IF ( host(1:3) /= 't3e' )  THEN
2566          message_string = 'do3d_compress = .TRUE. not allowed on host "' // &
2567                           TRIM( host ) // '"'
2568          CALL message( 'check_parameters', 'PA0117', 1, 2, 0, 6, 0 )
2569       ENDIF
2570
2571       i = 1
2572       DO  WHILE ( do3d_comp_prec(i) /= ' ' )
2573
2574          ilen = LEN_TRIM( do3d_comp_prec(i) )
2575          IF ( LLT( do3d_comp_prec(i)(ilen:ilen), '0' ) .OR. &
2576               LGT( do3d_comp_prec(i)(ilen:ilen), '9' ) )  THEN
2577             WRITE( message_string, * )  'illegal precision: do3d_comp_prec', &
2578                                   '(', i, ') = "', TRIM(do3d_comp_prec(i)),'"'
2579             CALL message( 'check_parameters', 'PA0118', 1, 2, 0, 6, 0 )
2580          ENDIF
2581
2582          prec = IACHAR( do3d_comp_prec(i)(ilen:ilen) ) - IACHAR( '0' )
2583          var = do3d_comp_prec(i)(1:ilen-1)
2584
2585          SELECT CASE ( var )
2586
2587             CASE ( 'u' )
2588                j = 1
2589             CASE ( 'v' )
2590                j = 2
2591             CASE ( 'w' )
2592                j = 3
2593             CASE ( 'p' )
2594                j = 4
2595             CASE ( 'pt' )
2596                j = 5
2597
2598             CASE DEFAULT
2599                WRITE( message_string, * )  'unknown variable "', &
2600                     TRIM( do3d_comp_prec(i) ), '" given for do3d_comp_prec(', &
2601                     i, ')'
2602                CALL message( 'check_parameters', 'PA0119', 1, 2, 0, 6, 0 )
2603
2604          END SELECT
2605
2606          plot_3d_precision(j)%precision = prec
2607          i = i + 1
2608
2609       ENDDO
2610    ENDIF
2611
2612!
2613!-- Check the data output format(s)
2614    IF ( data_output_format(1) == ' ' )  THEN
2615!
2616!--    Default value
2617       netcdf_output = .TRUE.
2618    ELSE
2619       i = 1
2620       DO  WHILE ( data_output_format(i) /= ' ' )
2621
2622          SELECT CASE ( data_output_format(i) )
2623
2624             CASE ( 'netcdf' )
2625                netcdf_output = .TRUE.
2626             CASE ( 'iso2d' )
2627                iso2d_output  = .TRUE.
2628             CASE ( 'profil' )
2629                profil_output = .TRUE.
2630             CASE ( 'avs' )
2631                avs_output    = .TRUE.
2632
2633             CASE DEFAULT
2634                message_string = 'unknown value for data_output_format "' // &
2635                                 TRIM( data_output_format(i) ) // '"'
2636                CALL message( 'check_parameters', 'PA0120', 1, 2, 0, 6, 0 )
2637
2638          END SELECT
2639
2640          i = i + 1
2641          IF ( i > 10 )  EXIT
2642
2643       ENDDO
2644
2645    ENDIF
2646
2647!
2648!-- Check netcdf precison
2649    ldum = .FALSE.
2650    CALL define_netcdf_header( 'ch', ldum, 0 )
2651
2652!
2653!-- Check, whether a constant diffusion coefficient shall be used
2654    IF ( km_constant /= -1.0 )  THEN
2655       IF ( km_constant < 0.0 )  THEN
2656          WRITE( message_string, * )  'km_constant = ', km_constant, ' < 0.0'
2657          CALL message( 'check_parameters', 'PA0121', 1, 2, 0, 6, 0 )
2658       ELSE
2659          IF ( prandtl_number < 0.0 )  THEN
2660             WRITE( message_string, * )  'prandtl_number = ', prandtl_number, &
2661                                         ' < 0.0'
2662             CALL message( 'check_parameters', 'PA0122', 1, 2, 0, 6, 0 )
2663          ENDIF
2664          constant_diffusion = .TRUE.
2665
2666          IF ( prandtl_layer )  THEN
2667             message_string = 'prandtl_layer is not allowed with fixed ' // &
2668                              'value of km'
2669             CALL message( 'check_parameters', 'PA0123', 1, 2, 0, 6, 0 )
2670          ENDIF
2671       ENDIF
2672    ENDIF
2673
2674!
2675!-- In case of non-cyclic lateral boundaries, set the default maximum value
2676!-- for the horizontal diffusivity used within the outflow damping layer,
2677!-- and check/set the width of the damping layer
2678    IF ( bc_lr /= 'cyclic' ) THEN
2679       IF ( km_damp_max == -1.0 )  THEN
2680          km_damp_max = 0.5 * dx
2681       ENDIF
2682       IF ( outflow_damping_width == -1.0 )  THEN
2683          outflow_damping_width = MIN( 20, nx/2 )
2684       ENDIF
2685       IF ( outflow_damping_width <= 0  .OR.  outflow_damping_width > nx )  THEN
2686          message_string = 'outflow_damping width out of range'
2687          CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 )
2688       ENDIF
2689    ENDIF
2690
2691    IF ( bc_ns /= 'cyclic' )  THEN
2692       IF ( km_damp_max == -1.0 )  THEN
2693          km_damp_max = 0.5 * dy
2694       ENDIF
2695       IF ( outflow_damping_width == -1.0 )  THEN
2696          outflow_damping_width = MIN( 20, ny/2 )
2697       ENDIF
2698       IF ( outflow_damping_width <= 0  .OR.  outflow_damping_width > ny )  THEN
2699          message_string = 'outflow_damping width out of range'
2700          CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 )
2701       ENDIF
2702    ENDIF
2703
2704!
2705!-- Check value range for rif
2706    IF ( rif_min >= rif_max )  THEN
2707       WRITE( message_string, * )  'rif_min = ', rif_min, ' must be less ', &
2708                                   'than rif_max = ', rif_max
2709       CALL message( 'check_parameters', 'PA0125', 1, 2, 0, 6, 0 )
2710    ENDIF
2711
2712!
2713!-- Determine upper and lower hight level indices for random perturbations
2714    IF ( disturbance_level_b == -9999999.9 )  THEN
2715       IF ( ocean ) THEN
2716          disturbance_level_b     = zu((nzt*2)/3)
2717          disturbance_level_ind_b = ( nzt * 2 ) / 3
2718       ELSE
2719          disturbance_level_b     = zu(nzb+3)
2720          disturbance_level_ind_b = nzb + 3
2721       ENDIF
2722    ELSEIF ( disturbance_level_b < zu(3) )  THEN
2723       WRITE( message_string, * )  'disturbance_level_b = ', &
2724                           disturbance_level_b, ' must be >= ', zu(3), '(zu(3))'
2725       CALL message( 'check_parameters', 'PA0126', 1, 2, 0, 6, 0 )
2726    ELSEIF ( disturbance_level_b > zu(nzt-2) )  THEN
2727       WRITE( message_string, * )  'disturbance_level_b = ', &
2728                   disturbance_level_b, ' must be <= ', zu(nzt-2), '(zu(nzt-2))'
2729       CALL message( 'check_parameters', 'PA0127', 1, 2, 0, 6, 0 )
2730    ELSE
2731       DO  k = 3, nzt-2
2732          IF ( disturbance_level_b <= zu(k) )  THEN
2733             disturbance_level_ind_b = k
2734             EXIT
2735          ENDIF
2736       ENDDO
2737    ENDIF
2738
2739    IF ( disturbance_level_t == -9999999.9 )  THEN
2740       IF ( ocean )  THEN
2741          disturbance_level_t     = zu(nzt-3)
2742          disturbance_level_ind_t = nzt - 3
2743       ELSE
2744          disturbance_level_t     = zu(nzt/3)
2745          disturbance_level_ind_t = nzt / 3
2746       ENDIF
2747    ELSEIF ( disturbance_level_t > zu(nzt-2) )  THEN
2748       WRITE( message_string, * )  'disturbance_level_t = ', &
2749                   disturbance_level_t, ' must be <= ', zu(nzt-2), '(zu(nzt-2))'
2750       CALL message( 'check_parameters', 'PA0128', 1, 2, 0, 6, 0 )
2751    ELSEIF ( disturbance_level_t < disturbance_level_b )  THEN
2752       WRITE( message_string, * )  'disturbance_level_t = ', &
2753                   disturbance_level_t, ' must be >= disturbance_level_b = ', &
2754                   disturbance_level_b
2755       CALL message( 'check_parameters', 'PA0129', 1, 2, 0, 6, 0 )
2756    ELSE
2757       DO  k = 3, nzt-2
2758          IF ( disturbance_level_t <= zu(k) )  THEN
2759             disturbance_level_ind_t = k
2760             EXIT
2761          ENDIF
2762       ENDDO
2763    ENDIF
2764
2765!
2766!-- Check again whether the levels determined this way are ok.
2767!-- Error may occur at automatic determination and too few grid points in
2768!-- z-direction.
2769    IF ( disturbance_level_ind_t < disturbance_level_ind_b )  THEN
2770       WRITE( message_string, * )  'disturbance_level_ind_t = ', &
2771                disturbance_level_ind_t, ' must be >= disturbance_level_b = ', &
2772                disturbance_level_b
2773       CALL message( 'check_parameters', 'PA0130', 1, 2, 0, 6, 0 )
2774    ENDIF
2775
2776!
2777!-- Determine the horizontal index range for random perturbations.
2778!-- In case of non-cyclic horizontal boundaries, no perturbations are imposed
2779!-- near the inflow and the perturbation area is further limited to ...(1)
2780!-- after the initial phase of the flow.
2781    dist_nxl = 0;  dist_nxr = nx
2782    dist_nys = 0;  dist_nyn = ny
2783    IF ( bc_lr /= 'cyclic' )  THEN
2784       IF ( inflow_disturbance_begin == -1 )  THEN
2785          inflow_disturbance_begin = MIN( 10, nx/2 )
2786       ENDIF
2787       IF ( inflow_disturbance_begin < 0  .OR.  inflow_disturbance_begin > nx )&
2788       THEN
2789          message_string = 'inflow_disturbance_begin out of range'
2790          CALL message( 'check_parameters', 'PA0131', 1, 2, 0, 6, 0 )
2791       ENDIF
2792       IF ( inflow_disturbance_end == -1 )  THEN
2793          inflow_disturbance_end = MIN( 100, 3*nx/4 )
2794       ENDIF
2795       IF ( inflow_disturbance_end < 0  .OR.  inflow_disturbance_end > nx )    &
2796       THEN
2797          message_string = 'inflow_disturbance_end out of range'
2798          CALL message( 'check_parameters', 'PA0132', 1, 2, 0, 6, 0 )
2799       ENDIF
2800    ELSEIF ( bc_ns /= 'cyclic' )  THEN
2801       IF ( inflow_disturbance_begin == -1 )  THEN
2802          inflow_disturbance_begin = MIN( 10, ny/2 )
2803       ENDIF
2804       IF ( inflow_disturbance_begin < 0  .OR.  inflow_disturbance_begin > ny )&
2805       THEN
2806          message_string = 'inflow_disturbance_begin out of range'
2807          CALL message( 'check_parameters', 'PA0131', 1, 2, 0, 6, 0 )
2808       ENDIF
2809       IF ( inflow_disturbance_end == -1 )  THEN
2810          inflow_disturbance_end = MIN( 100, 3*ny/4 )
2811       ENDIF
2812       IF ( inflow_disturbance_end < 0  .OR.  inflow_disturbance_end > ny )    &
2813       THEN
2814          message_string = 'inflow_disturbance_end out of range'
2815          CALL message( 'check_parameters', 'PA0132', 1, 2, 0, 6, 0 )
2816       ENDIF
2817    ENDIF
2818
2819    IF ( bc_lr == 'radiation/dirichlet' )  THEN
2820       dist_nxr    = nx - inflow_disturbance_begin
2821       dist_nxl(1) = nx - inflow_disturbance_end
2822    ELSEIF ( bc_lr == 'dirichlet/radiation' )  THEN
2823       dist_nxl    = inflow_disturbance_begin
2824       dist_nxr(1) = inflow_disturbance_end
2825    ENDIF
2826    IF ( bc_ns == 'dirichlet/radiation' )  THEN
2827       dist_nyn    = ny - inflow_disturbance_begin
2828       dist_nys(1) = ny - inflow_disturbance_end
2829    ELSEIF ( bc_ns == 'radiation/dirichlet' )  THEN
2830       dist_nys    = inflow_disturbance_begin
2831       dist_nyn(1) = inflow_disturbance_end
2832    ENDIF
2833
2834!
2835!-- A turbulent inflow requires Dirichlet conditions at the respective inflow
2836!-- boundary (so far, a turbulent inflow is realized from the left side only)
2837    IF ( turbulent_inflow  .AND.  bc_lr /= 'dirichlet/radiation' )  THEN
2838       message_string = 'turbulent_inflow = .T. requires a Dirichlet ' // &
2839                        'condition at the inflow boundary'
2840       CALL message( 'check_parameters', 'PA0133', 1, 2, 0, 6, 0 )
2841    ENDIF
2842
2843!
2844!-- In case of turbulent inflow calculate the index of the recycling plane
2845    IF ( turbulent_inflow )  THEN
2846       IF ( recycling_width == 9999999.9 )  THEN
2847!
2848!--       Set the default value for the width of the recycling domain
2849          recycling_width = 0.1 * nx * dx
2850       ELSE
2851          IF ( recycling_width < dx  .OR.  recycling_width > nx * dx )  THEN
2852             WRITE( message_string, * )  'illegal value for recycling_width:', &
2853                                         ' ', recycling_width
2854             CALL message( 'check_parameters', 'PA0134', 1, 2, 0, 6, 0 )
2855          ENDIF
2856       ENDIF
2857!
2858!--    Calculate the index
2859       recycling_plane = recycling_width / dx
2860    ENDIF
2861
2862!
2863!-- Check random generator
2864    IF ( random_generator /= 'system-specific'  .AND. &
2865         random_generator /= 'numerical-recipes' )  THEN
2866       message_string = 'unknown random generator: random_generator = "' // &
2867                        TRIM( random_generator ) // '"'
2868       CALL message( 'check_parameters', 'PA0135', 1, 2, 0, 6, 0 )
2869    ENDIF
2870
2871!
2872!-- Determine damping level index for 1D model
2873    IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
2874       IF ( damp_level_1d == -1.0 )  THEN
2875          damp_level_1d     = zu(nzt+1)
2876          damp_level_ind_1d = nzt + 1
2877       ELSEIF ( damp_level_1d < 0.0  .OR.  damp_level_1d > zu(nzt+1) )  THEN
2878          WRITE( message_string, * )  'damp_level_1d = ', damp_level_1d, &
2879                 ' must be > 0.0 and < ', zu(nzt+1), '(zu(nzt+1))'
2880          CALL message( 'check_parameters', 'PA0136', 1, 2, 0, 6, 0 )
2881       ELSE
2882          DO  k = 1, nzt+1
2883             IF ( damp_level_1d <= zu(k) )  THEN
2884                damp_level_ind_1d = k
2885                EXIT
2886             ENDIF
2887          ENDDO
2888       ENDIF
2889    ENDIF
2890
2891!
2892!-- Check some other 1d-model parameters
2893    IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model'  .AND. &
2894         TRIM( mixing_length_1d ) /= 'blackadar' )  THEN
2895       message_string = 'mixing_length_1d = "' // TRIM( mixing_length_1d ) // &
2896                        '" is unknown'
2897       CALL message( 'check_parameters', 'PA0137', 1, 2, 0, 6, 0 )
2898    ENDIF
2899    IF ( TRIM( dissipation_1d ) /= 'as_in_3d_model'  .AND. &
2900         TRIM( dissipation_1d ) /= 'detering' )  THEN
2901       message_string = 'dissipation_1d = "' // TRIM( dissipation_1d ) // &
2902                        '" is unknown'
2903       CALL message( 'check_parameters', 'PA0138', 1, 2, 0, 6, 0 )
2904    ENDIF
2905
2906!
2907!-- Set time for the next user defined restart (time_restart is the
2908!-- internal parameter for steering restart events)
2909    IF ( restart_time /= 9999999.9 )  THEN
2910       IF ( restart_time > time_since_reference_point )  THEN
2911          time_restart = restart_time
2912       ENDIF
2913    ELSE
2914!
2915!--    In case of a restart run, set internal parameter to default (no restart)
2916!--    if the NAMELIST-parameter restart_time is omitted
2917       time_restart = 9999999.9
2918    ENDIF
2919
2920!
2921!-- Set default value of the time needed to terminate a model run
2922    IF ( termination_time_needed == -1.0 )  THEN
2923       IF ( host(1:3) == 'ibm' )  THEN
2924          termination_time_needed = 300.0
2925       ELSE
2926          termination_time_needed = 35.0
2927       ENDIF
2928    ENDIF
2929
2930!
2931!-- Check the time needed to terminate a model run
2932    IF ( host(1:3) == 't3e' )  THEN
2933!
2934!--    Time needed must be at least 30 seconds on all CRAY machines, because
2935!--    MPP_TREMAIN gives the remaining CPU time only in steps of 30 seconds
2936       IF ( termination_time_needed <= 30.0 )  THEN
2937          WRITE( message_string, * )  'termination_time_needed = ', &
2938                 termination_time_needed, ' must be > 30.0 on host "', &
2939                 TRIM( host ), '"'
2940          CALL message( 'check_parameters', 'PA0139', 1, 2, 0, 6, 0 )
2941       ENDIF
2942    ELSEIF ( host(1:3) == 'ibm' )  THEN
2943!
2944!--    On IBM-regatta machines the time should be at least 300 seconds,
2945!--    because the job time consumed before executing palm (for compiling,
2946!--    copying of files, etc.) has to be regarded
2947       IF ( termination_time_needed < 300.0 )  THEN
2948          WRITE( message_string, * )  'termination_time_needed = ', &
2949                 termination_time_needed, ' should be >= 300.0 on host "', &
2950                 TRIM( host ), '"'
2951          CALL message( 'check_parameters', 'PA0140', 1, 2, 0, 6, 0 )
2952       ENDIF
2953    ENDIF
2954
2955!
2956!-- Check pressure gradient conditions
2957    IF ( dp_external .AND. conserve_volume_flow )  THEN
2958       WRITE( message_string, * )  'Both dp_external and conserve_volume_flo', &
2959            'w are .TRUE. but one of them must be .FALSE.'
2960       CALL message( 'check_parameters', 'PA0150', 1, 2, 0, 6, 0 )
2961    ENDIF
2962    IF ( dp_external )  THEN
2963       IF ( dp_level_b < zu(nzb) .OR. dp_level_b > zu(nzt) )  THEN
2964          WRITE( message_string, * )  'dp_level_b = ', dp_level_b, ' is out ', &
2965               ' of range'
2966          CALL message( 'check_parameters', 'PA0151', 1, 2, 0, 6, 0 )
2967       ENDIF
2968       IF ( .NOT. ANY( dpdxy /= 0.0 ) )  THEN
2969          WRITE( message_string, * )  'dp_external is .TRUE. but dpdxy is ze', &
2970               'ro, i.e. the external pressure gradient & will not be applied'
2971          CALL message( 'check_parameters', 'PA0152', 0, 1, 0, 6, 0 )
2972       ENDIF
2973    ENDIF
2974    IF ( ANY( dpdxy /= 0.0 ) .AND. .NOT. dp_external )  THEN
2975       WRITE( message_string, * )  'dpdxy is nonzero but dp_external is ', &
2976            '.FALSE., i.e. the external pressure gradient & will not be applied'
2977       CALL message( 'check_parameters', 'PA0153', 0, 1, 0, 6, 0 )
2978    ENDIF
2979    IF ( conserve_volume_flow )  THEN
2980       IF ( TRIM( conserve_volume_flow_mode ) == 'default' )  THEN
2981          IF ( bc_lr /= 'cyclic'  .OR.  bc_ns /= 'cyclic' )  THEN
2982             conserve_volume_flow_mode = 'inflow_profile'
2983          ELSE
2984             conserve_volume_flow_mode = 'initial_profiles'
2985          ENDIF
2986       ELSEIF ( TRIM( conserve_volume_flow_mode ) /= 'initial_profiles' .AND.  &
2987            TRIM( conserve_volume_flow_mode ) /= 'inflow_profile' .AND.  &
2988            TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' )  THEN
2989          WRITE( message_string, * )  'unknown conserve_volume_flow_mode: ', &
2990               conserve_volume_flow_mode
2991          CALL message( 'check_parameters', 'PA0154', 1, 2, 0, 6, 0 )
2992       ENDIF
2993       IF ( ( bc_lr /= 'cyclic'  .OR.  bc_ns /= 'cyclic' ) .AND. &
2994            TRIM( conserve_volume_flow_mode ) /= 'inflow_profile' )  THEN
2995          WRITE( message_string, * )  'noncyclic boundary conditions ', &
2996               'require & conserve_volume_flow_mode = ''inflow_profile'''
2997          CALL message( 'check_parameters', 'PA0155', 1, 2, 0, 6, 0 )
2998       ENDIF
2999       IF ( bc_lr == 'cyclic'  .AND.  bc_ns == 'cyclic'  .AND.  &
3000            TRIM( conserve_volume_flow_mode ) == 'inflow_profile' )  THEN
3001          WRITE( message_string, * )  'cyclic boundary conditions ', &
3002               'require & conserve_volume_flow_mode = ''initial_profiles''', &
3003               ' or ''bulk_velocity'''
3004          CALL message( 'check_parameters', 'PA0156', 1, 2, 0, 6, 0 )
3005       ENDIF
3006    ENDIF
3007    IF ( ( u_bulk /= 0.0 .OR. v_bulk /= 0.0 ) .AND.  &
3008         ( .NOT. conserve_volume_flow .OR.  &
3009         TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) )  THEN
3010       WRITE( message_string, * )  'nonzero bulk velocity requires ', &
3011            'conserve_volume_flow = .T. and & ', &
3012            'conserve_volume_flow_mode = ''bulk_velocity'''
3013       CALL message( 'check_parameters', 'PA0157', 1, 2, 0, 6, 0 )
3014    ENDIF
3015
3016!
3017!-- Check particle attributes
3018    IF ( particle_color /= 'none' )  THEN
3019       IF ( particle_color /= 'absuv'  .AND.  particle_color /= 'pt*'  .AND.  &
3020            particle_color /= 'z' )  THEN
3021          message_string = 'illegal value for parameter particle_color: ' // &
3022                           TRIM( particle_color)
3023          CALL message( 'check_parameters', 'PA0313', 1, 2, 0, 6, 0 )
3024       ELSE
3025          IF ( color_interval(2) <= color_interval(1) )  THEN
3026             message_string = 'color_interval(2) <= color_interval(1)'
3027             CALL message( 'check_parameters', 'PA0315', 1, 2, 0, 6, 0 )
3028          ENDIF
3029       ENDIF
3030    ENDIF
3031
3032    IF ( particle_dvrpsize /= 'none' )  THEN
3033       IF ( particle_dvrpsize /= 'absw' )  THEN
3034          message_string = 'illegal value for parameter particle_dvrpsize:' // &
3035                           ' ' // TRIM( particle_color)
3036          CALL message( 'check_parameters', 'PA0314', 1, 2, 0, 6, 0 )
3037       ELSE
3038          IF ( dvrpsize_interval(2) <= dvrpsize_interval(1) )  THEN
3039             message_string = 'dvrpsize_interval(2) <= dvrpsize_interval(1)'
3040             CALL message( 'check_parameters', 'PA0316', 1, 2, 0, 6, 0 )
3041          ENDIF
3042       ENDIF
3043    ENDIF
3044
3045!
3046!-- Check &userpar parameters
3047    CALL user_check_parameters
3048
3049
3050 END SUBROUTINE check_parameters
Note: See TracBrowser for help on using the repository browser.