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

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

last commit documented

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