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

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

last commit documented

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