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

Last change on this file since 1216 was 1216, checked in by raasch, 11 years ago

overlapping execution of fft and transpositions (MPI_ALLTOALL), but real overlapping is not activated so far,
fftw implemented for 1D-decomposition
resorting of arrays moved to separate routines resort_for_...
bugfix in mbuild concerning Makefile_check

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