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

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

bugfix concerning output of averaged 2d/3d quantities

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