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

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

last commit documented, rc-file for example run updated

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