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

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

fftw support added; object file list in Makefile replaced by a short one line statement

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