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

Last change on this file since 1128 was 1116, checked in by hoffmann, 11 years ago

last commit documented

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