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

Last change on this file since 407 was 407, checked in by maronga, 14 years ago

humidity for non-flat topography implemented, re-adjustments for lcxt4

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