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

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

bugfix: number of selected spectra levels is checked for 0

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