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

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

optimization of two-moments cloud physics

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