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

Last change on this file since 1171 was 1160, checked in by fricke, 11 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 138.5 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! -----------------
[1054]22!
[1160]23!
[1054]24! Former revisions:
25! -----------------
26! $Id: check_parameters.f90 1160 2013-05-21 12:06:24Z raasch $
27!
[1160]28! 1159 2013-05-21 11:58:22Z fricke
29! bc_lr/ns_dirneu/neudir removed
30!
[1116]31! 1115 2013-03-26 18:16:16Z hoffmann
32! unused variables removed
33! drizzle can be used without precipitation
34!
[1112]35! 1111 2013-03-08 23:54:10Z raasch
36! ibc_p_b = 2 removed
37!
[1104]38! 1103 2013-02-20 02:15:53Z raasch
39! Bugfix: turbulent inflow must not require cyclic fill in restart runs
40!
[1093]41! 1092 2013-02-02 11:24:22Z raasch
42! unused variables removed
43!
[1070]44! 1069 2012-11-28 16:18:43Z maronga
45! allow usage of topography in combination with cloud physics
46!
[1066]47! 1065 2012-11-22 17:42:36Z hoffmann
48! Bugfix: It is not allowed to use cloud_scheme = seifert_beheng without
49!         precipitation in order to save computational resources.
50!
[1061]51! 1060 2012-11-21 07:19:51Z raasch
52! additional check for parameter turbulent_inflow
53!
[1054]54! 1053 2012-11-13 17:11:03Z hoffmann
[1053]55! necessary changes for the new two-moment cloud physics scheme added:
56! - check cloud physics scheme (Kessler or Seifert and Beheng)
57! - plant_canopy is not allowed
58! - currently, only cache loop_optimization is allowed
59! - initial profiles of nr, qr
60! - boundary condition of nr, qr
61! - check output quantities (qr, nr, prr)
[979]62!
[1037]63! 1036 2012-10-22 13:43:42Z raasch
64! code put under GPL (PALM 3.9)
65!
[1035]66! 1031/1034 2012-10-22 11:32:49Z raasch
67! check of netcdf4 parallel file support
68!
[1020]69! 1019 2012-09-28 06:46:45Z raasch
70! non-optimized version of prognostic_equations not allowed any more
71!
[1017]72! 1015 2012-09-27 09:23:24Z raasch
73! acc allowed for loop optimization,
74! checks for adjustment of mixing length to the Prandtl mixing length removed
75!
[1004]76! 1003 2012-09-14 14:35:53Z raasch
77! checks for cases with unequal subdomain sizes removed
78!
[1002]79! 1001 2012-09-13 14:08:46Z raasch
80! all actions concerning leapfrog- and upstream-spline-scheme removed
81!
[997]82! 996 2012-09-07 10:41:47Z raasch
83! little reformatting
[1001]84
[979]85! 978 2012-08-09 08:28:32Z fricke
[978]86! setting of bc_lr/ns_dirneu/neudir
87! outflow damping layer removed
88! check for z0h*
89! check for pt_damping_width
[667]90!
[965]91! 964 2012-07-26 09:14:24Z raasch
92! check of old profil-parameters removed
93!
[941]94! 940 2012-07-09 14:31:00Z raasch
95! checks for parameter neutral
96!
[925]97! 924 2012-06-06 07:44:41Z maronga
98! Bugfix: preprocessor directives caused error during compilation
99!
[893]100! 892 2012-05-02 13:51:44Z maronga
101! Bugfix for parameter file check ( excluding __netcdf4 )
102!
[867]103! 866 2012-03-28 06:44:41Z raasch
104! use only 60% of the geostrophic wind as translation speed in case of Galilean
105! transformation and use_ug_for_galilei_tr = .T. in order to mimimize the
106! timestep
107!
[863]108! 861 2012-03-26 14:18:34Z suehring
109! Check for topography and ws-scheme removed.
110! Check for loop_optimization = 'vector' and ws-scheme removed.
111!
[846]112! 845 2012-03-07 10:23:05Z maronga
113! Bugfix: exclude __netcdf4 directive part from namelist file check compilation
114!
[829]115! 828 2012-02-21 12:00:36Z raasch
116! check of collision_kernel extended
117!
[826]118! 825 2012-02-19 03:03:44Z raasch
119! check for collision_kernel and curvature_solution_effects
120!
[810]121! 809 2012-01-30 13:32:58Z maronga
122! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives
123!
[808]124! 807 2012-01-25 11:53:51Z maronga
125! New cpp directive "__check" implemented which is used by check_namelist_files
126!
[775]127! 774 2011-10-27 13:34:16Z letzel
128! bugfix for prescribed u,v-profiles
129!
[768]130! 767 2011-10-14 06:39:12Z raasch
131! Calculating u,v-profiles from given profiles by linear interpolation.
132! bugfix: dirichlet_0 conditions for ug/vg moved from init_3d_model to here
133!
[708]134! 707 2011-03-29 11:39:40Z raasch
135! setting of bc_lr/ns_dirrad/raddir
136!
137! 689 2011-02-20 19:31:12z gryschka
[690]138! Bugfix for some logical expressions
139! (syntax was not compatible with all compilers)
[687]140!
[690]141! 680 2011-02-04 23:16:06Z gryschka
[681]142! init_vortex is not allowed with volume_flow_control
[668]143!
[674]144! 673 2011-01-18 16:19:48Z suehring
145! Declaration of ws_scheme_sca and ws_scheme_mom added (moved from advec_ws).
146!
[668]147! 667 2010-12-23 12:06:00Z suehring/gryschka
[667]148! Exchange of parameters between ocean and atmosphere via PE0
149! Check for illegal combination of ws-scheme and timestep scheme.
150! Check for topography and ws-scheme.
151! Check for not cyclic boundary conditions in combination with ws-scheme and
152! loop_optimization = 'vector'.
153! Check for call_psolver_at_all_substeps and ws-scheme for momentum_advec.
154! Different processor/grid topology in atmosphere and ocean is now allowed!
155! Bugfixes in checking for conserve_volume_flow_mode
[601]156! 600 2010-11-24 16:10:51Z raasch
157! change due to new default value of surface_waterflux
[581]158! 580 2010-10-05 13:59:11Z heinze
[601]159! renaming of ws_vertical_gradient_level to subs_vertical_gradient_level
[581]160!
[568]161! 567 2010-10-01 10:46:30Z helmke
162! calculating masks changed
163!
[565]164! 564 2010-09-30 13:18:59Z helmke
165! palm message identifiers of masked output changed, 20 replaced by max_masks
166!
[554]167! 553 2010-09-01 14:09:06Z weinreis
168! masks is calculated and removed from inipar
[532]169!
170! 531 2010-04-21 06:47:21Z heinze
171! Bugfix: unit of hyp changed to dbar
[392]172!
[525]173! 524 2010-03-30 02:04:51Z raasch
174! Bugfix: "/" in netcdf profile variable names replaced by ":"
175!
[494]176! 493 2010-03-01 08:30:24Z raasch
177! netcdf_data_format is checked
178!
[449]179! 411 2009-12-11 14:15:58Z heinze
180! Enabled passive scalar/humidity wall fluxes for non-flat topography
181! Initialization of large scale vertical motion (subsidence/ascent)
182!
183! 410 2009-12-04 17:05:40Z letzel
184! masked data output
185!
[392]186! 388 2009-09-23 09:40:33Z raasch
[388]187! Check profiles fpr prho and hyp.
[376]188! Bugfix: output of averaged 2d/3d quantities requires that an avaraging
189! interval has been set, respective error message is included
[366]190! bc_lr_cyc and bc_ns_cyc are set,
[328]191! initializing_actions='read_data_for_recycling' renamed to 'cyclic_fill'
[308]192! Check for illegal entries in section_xy|xz|yz that exceed nz+1|ny+1|nx+1
[291]193! Coupling with independent precursor runs.
[264]194! Check particle_color, particle_dvrpsize, color_interval, dvrpsize_interval
[232]195! Bugfix: pressure included for profile output
[240]196! Check pressure gradient conditions
[256]197! topography_grid_convention moved from user_check_parameters
198! 'single_street_canyon'
[367]199! Added shf* and qsws* to the list of available output data
[226]200!
201! 222 2009-01-12 16:04:16Z letzel
[217]202! +user_check_parameters
[213]203! Output of messages replaced by message handling routine.
[206]204! Implementation of an MPI-1 coupling: replaced myid with target_id,
205! deleted __mpi2 directives
[222]206! Check that PALM is called with mrun -K parallel for coupling
[198]207!
208! 197 2008-09-16 15:29:03Z raasch
[177]209! Bug fix: Construction of vertical profiles when 10 gradients have been
[181]210! specified in the parameter list (ug, vg, pt, q, sa, lad)
211!   
212! Strict grid matching along z is not needed for mg-solver.
[153]213! Leaf area density (LAD) explicitly set to its surface value at k=0
[151]214! Case of reading data for recycling included in initializing_actions,
[197]215! check of turbulent_inflow and calculation of recycling_plane.
216! q*2 profile added
[139]217!
218! 138 2007-11-28 10:03:58Z letzel
[138]219! Plant canopy added
[132]220! Allow new case bc_uv_t = 'dirichlet_0' for channel flow.
[116]221! Multigrid solver allows topography, checking of dt_sort_particles
[121]222! Bugfix: initializing u_init and v_init in case of ocean runs
[110]223!
224! 109 2007-08-28 15:26:47Z letzel
[102]225! Check coupling_mode and set default (obligatory) values (like boundary
[106]226! conditions for temperature and fluxes) in case of coupled runs.
227! +profiles for w*p* and w"e
[104]228! Bugfix: Error message concerning output of particle concentration (pc)
229! modified
[108]230! More checks and more default values for coupled runs
231! allow data_output_pr= q, wq, w"q", w*q* for humidity = .T. (instead of
232! cloud_physics = .T.)
233! Rayleigh damping for ocean fixed.
[109]234! Check and, if necessary, set default value for dt_coupling
[98]235!
236! 97 2007-06-21 08:23:15Z raasch
[97]237! Initial salinity profile is calculated, salinity boundary conditions are
238! checked,
[94]239! z_max_do1d is checked only in case of ocean = .f.,
[97]240! +initial temperature and geostrophic velocity profiles for the ocean version,
241! use_pt_reference renamed use_reference
[77]242!
[90]243! 89 2007-05-25 12:08:31Z raasch
244! Check for user-defined profiles
245!
[77]246! 75 2007-03-22 09:54:05Z raasch
[51]247! "by_user" allowed as initializing action, -data_output_ts,
[63]248! leapfrog with non-flat topography not allowed any more, loop_optimization
[75]249! and pt_reference are checked, moisture renamed humidity,
[72]250! output of precipitation amount/rate and roughnes length + check
[73]251! possible negative humidities are avoided in initial profile,
[75]252! dirichlet/neumann changed to dirichlet/radiation, etc.,
253! revision added to run_description_header
[1]254!
[39]255! 20 2007-02-26 00:12:32Z raasch
256! Temperature and humidity gradients at top are now calculated for nzt+1,
257! top_heatflux and respective boundary condition bc_pt_t is checked
258!
[3]259! RCS Log replace by Id keyword, revision history cleaned up
260!
[1]261! Revision 1.61  2006/08/04 14:20:25  raasch
262! do2d_unit and do3d_unit now defined as 2d-arrays, check of
263! use_upstream_for_tke, default value for dt_dopts,
264! generation of file header moved from routines palm and header to here
265!
266! Revision 1.1  1997/08/26 06:29:23  raasch
267! Initial revision
268!
269!
270! Description:
271! ------------
272! Check control parameters and deduce further quantities.
273!------------------------------------------------------------------------------!
274
275    USE arrays_3d
[824]276    USE cloud_parameters
[1]277    USE constants
278    USE control_parameters
[264]279    USE dvrp_variables
[1]280    USE grid_variables
281    USE indices
282    USE model_1d
283    USE netcdf_control
284    USE particle_attributes
285    USE pegrid
286    USE profil_parameter
[411]287    USE subsidence_mod
[1]288    USE statistics
289    USE transpose_indices
290
291    IMPLICIT NONE
292
293    CHARACTER (LEN=1)   ::  sq
294    CHARACTER (LEN=6)   ::  var
295    CHARACTER (LEN=7)   ::  unit
296    CHARACTER (LEN=8)   ::  date
297    CHARACTER (LEN=10)  ::  time
[102]298    CHARACTER (LEN=40)  ::  coupling_string
[1]299    CHARACTER (LEN=100) ::  action
300
[1092]301    INTEGER ::  i, ilen, iremote = 0, j, k, kk, position, prec
[1]302    LOGICAL ::  found, ldum
[1092]303    REAL    ::  gradient, remote = 0.0, simulation_time_since_reference
[1]304
305!
306!-- Warning, if host is not set
307    IF ( host(1:1) == ' ' )  THEN
[213]308       message_string = '"host" is not set. Please check that environment ' // &
309                        'variable "localhost" & is set before running PALM'
[226]310       CALL message( 'check_parameters', 'PA0001', 0, 0, 0, 6, 0 )
[1]311    ENDIF
312
313!
[102]314!-- Check the coupling mode
315    IF ( coupling_mode /= 'uncoupled'            .AND.  &
316         coupling_mode /= 'atmosphere_to_ocean'  .AND.  &
317         coupling_mode /= 'ocean_to_atmosphere' )  THEN
[213]318       message_string = 'illegal coupling mode: ' // TRIM( coupling_mode )
[226]319       CALL message( 'check_parameters', 'PA0002', 1, 2, 0, 6, 0 )
[102]320    ENDIF
321
322!
[108]323!-- Check dt_coupling, restart_time, dt_restart, end_time, dx, dy, nx and ny
[667]324    IF ( coupling_mode /= 'uncoupled')  THEN
[213]325
[108]326       IF ( dt_coupling == 9999999.9 )  THEN
[213]327          message_string = 'dt_coupling is not set but required for coup' // &
328                           'ling mode "' //  TRIM( coupling_mode ) // '"'
[226]329          CALL message( 'check_parameters', 'PA0003', 1, 2, 0, 6, 0 )
[108]330       ENDIF
[213]331
[206]332#if defined( __parallel )
[807]333
334!
335!--    NOTE: coupled runs have not been implemented in the check_namelist_files
336!--    program.
337!--    check_namelist_files will need the following information of the other
338!--    model (atmosphere/ocean).
[845]339!       dt_coupling = remote
340!       dt_max = remote
341!       restart_time = remote
342!       dt_restart= remote
343!       simulation_time_since_reference = remote
344!       dx = remote
[807]345
346
[809]347#if ! defined( __check )
[667]348       IF ( myid == 0 ) THEN
349          CALL MPI_SEND( dt_coupling, 1, MPI_REAL, target_id, 11, comm_inter, &
350                         ierr )
351          CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 11, comm_inter, &
352                         status, ierr )
353       ENDIF
354       CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
[807]355#endif     
[108]356       IF ( dt_coupling /= remote )  THEN
[213]357          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
358                 '": dt_coupling = ', dt_coupling, '& is not equal to ',       &
359                 'dt_coupling_remote = ', remote
[226]360          CALL message( 'check_parameters', 'PA0004', 1, 2, 0, 6, 0 )
[108]361       ENDIF
[109]362       IF ( dt_coupling <= 0.0 )  THEN
[809]363#if ! defined( __check )
[667]364          IF ( myid == 0  ) THEN
365             CALL MPI_SEND( dt_max, 1, MPI_REAL, target_id, 19, comm_inter, ierr )
366             CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 19, comm_inter, &
367                            status, ierr )
368          ENDIF   
369          CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
[807]370#endif         
[109]371          dt_coupling = MAX( dt_max, remote )
[213]372          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
373                 '": dt_coupling <= 0.0 & is not allowed and is reset to ',    &
374                 'MAX(dt_max(A,O)) = ', dt_coupling
[226]375          CALL message( 'check_parameters', 'PA0005', 0, 1, 0, 6, 0 )
[109]376       ENDIF
[809]377#if ! defined( __check )
[667]378       IF ( myid == 0 ) THEN
379          CALL MPI_SEND( restart_time, 1, MPI_REAL, target_id, 12, comm_inter, &
380                         ierr )
381          CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 12, comm_inter, &
382                         status, ierr )
383       ENDIF
384       CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
[807]385#endif     
[108]386       IF ( restart_time /= remote )  THEN
[213]387          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
388                 '": restart_time = ', restart_time, '& is not equal to ',     &
389                 'restart_time_remote = ', remote
[226]390          CALL message( 'check_parameters', 'PA0006', 1, 2, 0, 6, 0 )
[108]391       ENDIF
[809]392#if ! defined( __check )
[667]393       IF ( myid == 0 ) THEN
394          CALL MPI_SEND( dt_restart, 1, MPI_REAL, target_id, 13, comm_inter, &
395                         ierr )
396          CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 13, comm_inter, &
397                         status, ierr )
398       ENDIF   
399       CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
[807]400#endif     
[108]401       IF ( dt_restart /= remote )  THEN
[213]402          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
403                 '": dt_restart = ', dt_restart, '& is not equal to ',         &
404                 'dt_restart_remote = ', remote
[226]405          CALL message( 'check_parameters', 'PA0007', 1, 2, 0, 6, 0 )
[108]406       ENDIF
[213]407
[291]408       simulation_time_since_reference = end_time - coupling_start_time
[809]409#if ! defined( __check )
[667]410       IF  ( myid == 0 ) THEN
411          CALL MPI_SEND( simulation_time_since_reference, 1, MPI_REAL, target_id, &
412                         14, comm_inter, ierr )
413          CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter, &
414                         status, ierr )   
415       ENDIF
416       CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
[807]417#endif     
[291]418       IF ( simulation_time_since_reference /= remote )  THEN
[213]419          WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
[291]420                 '": simulation_time_since_reference = ',                      &
421                 simulation_time_since_reference, '& is not equal to ',        &
422                 'simulation_time_since_reference_remote = ', remote
[226]423          CALL message( 'check_parameters', 'PA0008', 1, 2, 0, 6, 0 )
[108]424       ENDIF
[213]425
[809]426#if ! defined( __check )
[667]427       IF ( myid == 0 ) THEN
428          CALL MPI_SEND( dx, 1, MPI_REAL, target_id, 15, comm_inter, ierr )
429          CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 15, comm_inter, &
430                                                             status, ierr )
[108]431       ENDIF
[667]432       CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
[213]433
[807]434#endif
[667]435       IF ( coupling_mode == 'atmosphere_to_ocean') THEN
436
437          IF ( dx < remote ) THEN
438             WRITE( message_string, * ) 'coupling mode "', &
439                   TRIM( coupling_mode ),                  &
440           '": dx in Atmosphere is not equal to or not larger then dx in ocean'
441             CALL message( 'check_parameters', 'PA0009', 1, 2, 0, 6, 0 )
442          ENDIF
443
444          IF ( (nx_a+1)*dx /= (nx_o+1)*remote )  THEN
445             WRITE( message_string, * ) 'coupling mode "', &
446                    TRIM( coupling_mode ), &
447             '": Domain size in x-direction is not equal in ocean and atmosphere'
448             CALL message( 'check_parameters', 'PA0010', 1, 2, 0, 6, 0 )
449          ENDIF
450
[108]451       ENDIF
[213]452
[809]453#if ! defined( __check )
[667]454       IF ( myid == 0) THEN
455          CALL MPI_SEND( dy, 1, MPI_REAL, target_id, 16, comm_inter, ierr )
456          CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 16, comm_inter, &
457                         status, ierr )
[108]458       ENDIF
[667]459       CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr)
[807]460#endif
[667]461       IF ( coupling_mode == 'atmosphere_to_ocean') THEN
462
463          IF ( dy < remote )  THEN
464             WRITE( message_string, * ) 'coupling mode "', &
465                    TRIM( coupling_mode ), &
466                 '": dy in Atmosphere is not equal to or not larger then dy in ocean'
467             CALL message( 'check_parameters', 'PA0011', 1, 2, 0, 6, 0 )
468          ENDIF
469
470          IF ( (ny_a+1)*dy /= (ny_o+1)*remote )  THEN
471             WRITE( message_string, * ) 'coupling mode "', &
472                   TRIM( coupling_mode ), &
473             '": Domain size in y-direction is not equal in ocean and atmosphere'
474             CALL message( 'check_parameters', 'PA0012', 1, 2, 0, 6, 0 )
475          ENDIF
476
477          IF ( MOD(nx_o+1,nx_a+1) /= 0 )  THEN
478             WRITE( message_string, * ) 'coupling mode "', &
479                   TRIM( coupling_mode ), &
480             '": nx+1 in ocean is not divisible without remainder with nx+1 in', & 
481             ' atmosphere'
482             CALL message( 'check_parameters', 'PA0339', 1, 2, 0, 6, 0 )
483          ENDIF
484
485          IF ( MOD(ny_o+1,ny_a+1) /= 0 )  THEN
486             WRITE( message_string, * ) 'coupling mode "', &
487                   TRIM( coupling_mode ), &
488             '": ny+1 in ocean is not divisible without remainder with ny+1 in', & 
489             ' atmosphere'
490             CALL message( 'check_parameters', 'PA0340', 1, 2, 0, 6, 0 )
491          ENDIF
492
[108]493       ENDIF
[222]494#else
495       WRITE( message_string, * ) 'coupling requires PALM to be called with', &
496            ' ''mrun -K parallel'''
[226]497       CALL message( 'check_parameters', 'PA0141', 1, 2, 0, 6, 0 )
[108]498#endif
499    ENDIF
500
[809]501#if defined( __parallel ) && ! defined ( __check )
[108]502!
503!-- Exchange via intercommunicator
[667]504    IF ( coupling_mode == 'atmosphere_to_ocean' .AND. myid == 0 )  THEN
[206]505       CALL MPI_SEND( humidity, 1, MPI_LOGICAL, target_id, 19, comm_inter, &
506                      ierr )
[667]507    ELSEIF ( coupling_mode == 'ocean_to_atmosphere' .AND. myid == 0)  THEN
[206]508       CALL MPI_RECV( humidity_remote, 1, MPI_LOGICAL, target_id, 19, &
509                      comm_inter, status, ierr )
[108]510    ENDIF
[667]511    CALL MPI_BCAST( humidity_remote, 1, MPI_LOGICAL, 0, comm2d, ierr)
512   
[108]513#endif
514
515
516!
[1]517!-- Generate the file header which is used as a header for most of PALM's
518!-- output files
519    CALL DATE_AND_TIME( date, time )
520    run_date = date(7:8)//'-'//date(5:6)//'-'//date(3:4)
521    run_time = time(1:2)//':'//time(3:4)//':'//time(5:6)
[102]522    IF ( coupling_mode == 'uncoupled' )  THEN
523       coupling_string = ''
524    ELSEIF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
525       coupling_string = ' coupled (atmosphere)'
526    ELSEIF ( coupling_mode == 'ocean_to_atmosphere' )  THEN
527       coupling_string = ' coupled (ocean)'
528    ENDIF       
[1]529
[102]530    WRITE ( run_description_header,                                        &
531                             '(A,2X,A,2X,A,A,A,I2.2,A,2X,A,A,2X,A,1X,A)' ) &
532              TRIM( version ), TRIM( revision ), 'run: ',                  &
533              TRIM( run_identifier ), '.', runnr, TRIM( coupling_string ), &
534              'host: ', TRIM( host ), run_date, run_time
[1]535
536!
[63]537!-- Check the general loop optimization method
538    IF ( loop_optimization == 'default' )  THEN
539       IF ( host(1:3) == 'nec' )  THEN
540          loop_optimization = 'vector'
541       ELSE
542          loop_optimization = 'cache'
543       ENDIF
544    ENDIF
545
[1015]546    SELECT CASE ( TRIM( loop_optimization ) )
547
[1019]548       CASE ( 'acc', 'cache', 'vector' )
[1015]549          CONTINUE
550
551       CASE DEFAULT
552          message_string = 'illegal value given for loop_optimization: "' // &
553                           TRIM( loop_optimization ) // '"'
554          CALL message( 'check_parameters', 'PA0013', 1, 2, 0, 6, 0 )
555
556    END SELECT
557
[63]558!
[1]559!-- Check topography setting (check for illegal parameter combinations)
560    IF ( topography /= 'flat' )  THEN
561       action = ' '
[861]562       IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme')  THEN
[1]563          WRITE( action, '(A,A)' )  'scalar_advec = ', scalar_advec
564       ENDIF
[861]565       IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' ) &
566       THEN
[1]567          WRITE( action, '(A,A)' )  'momentum_advec = ', momentum_advec
568       ENDIF
[114]569       IF ( psolver == 'sor' )  THEN
[1]570          WRITE( action, '(A,A)' )  'psolver = ', psolver
571       ENDIF
572       IF ( sloping_surface )  THEN
573          WRITE( action, '(A)' )  'sloping surface = .TRUE.'
574       ENDIF
575       IF ( galilei_transformation )  THEN
576          WRITE( action, '(A)' )  'galilei_transformation = .TRUE.'
577       ENDIF
[1115]578       IF ( cloud_physics )  THEN
579          WRITE( action, '(A)' )  'cloud_physics = .TRUE.'
580       ENDIF
[1]581       IF ( cloud_droplets )  THEN
[1115]582          WRITE( action, '(A)' )  'cloud_droplets = .TRUE.'
[1]583       ENDIF
584       IF ( .NOT. prandtl_layer )  THEN
585          WRITE( action, '(A)' )  'prandtl_layer = .FALSE.'
586       ENDIF
587       IF ( action /= ' ' )  THEN
[213]588          message_string = 'a non-flat topography does not allow ' // &
589                           TRIM( action )
[226]590          CALL message( 'check_parameters', 'PA0014', 1, 2, 0, 6, 0 )
[1]591       ENDIF
[256]592!
593!--    In case of non-flat topography, check whether the convention how to
594!--    define the topography grid has been set correctly, or whether the default
595!--    is applicable. If this is not possible, abort.
596       IF ( TRIM( topography_grid_convention ) == ' ' )  THEN
597          IF ( TRIM( topography ) /= 'single_building' .AND.  &
598               TRIM( topography ) /= 'single_street_canyon' .AND.  &
599               TRIM( topography ) /= 'read_from_file' )  THEN
600!--          The default value is not applicable here, because it is only valid
601!--          for the two standard cases 'single_building' and 'read_from_file'
602!--          defined in init_grid.
603             WRITE( message_string, * )  &
604                  'The value for "topography_grid_convention" ',  &
605                  'is not set. Its default value is & only valid for ',  &
606                  '"topography" = ''single_building'', ',  &
607                  '''single_street_canyon'' & or ''read_from_file''.',  &
608                  ' & Choose ''cell_edge'' or ''cell_center''.'
609             CALL message( 'user_check_parameters', 'PA0239', 1, 2, 0, 6, 0 )
610          ELSE
611!--          The default value is applicable here.
612!--          Set convention according to topography.
613             IF ( TRIM( topography ) == 'single_building' .OR.  &
614                  TRIM( topography ) == 'single_street_canyon' )  THEN
615                topography_grid_convention = 'cell_edge'
616             ELSEIF ( TRIM( topography ) == 'read_from_file' )  THEN
617                topography_grid_convention = 'cell_center'
618             ENDIF
619          ENDIF
620       ELSEIF ( TRIM( topography_grid_convention ) /= 'cell_edge' .AND.  &
621                TRIM( topography_grid_convention ) /= 'cell_center' )  THEN
622          WRITE( message_string, * )  &
623               'The value for "topography_grid_convention" is ', &
624               'not recognized. & Choose ''cell_edge'' or ''cell_center''.'
625          CALL message( 'user_check_parameters', 'PA0240', 1, 2, 0, 6, 0 )
626       ENDIF
627
[1]628    ENDIF
[94]629
[1]630!
[94]631!-- Check ocean setting
632    IF ( ocean )  THEN
[332]633
[94]634       action = ' '
635       IF ( action /= ' ' )  THEN
[213]636          message_string = 'ocean = .T. does not allow ' // TRIM( action )
[226]637          CALL message( 'check_parameters', 'PA0015', 1, 2, 0, 6, 0 )
[94]638       ENDIF
639
[332]640    ELSEIF ( TRIM( coupling_mode ) == 'uncoupled'  .AND.  &
641             TRIM( coupling_char ) == '_O' )  THEN
[343]642
[94]643!
[332]644!--    Check whether an (uncoupled) atmospheric run has been declared as an
645!--    ocean run (this setting is done via mrun-option -y)
[343]646
[291]647       message_string = 'ocean = .F. does not allow coupling_char = "' // &
648                        TRIM( coupling_char ) // '" set by mrun-option "-y"'
649       CALL message( 'check_parameters', 'PA0317', 1, 2, 0, 6, 0 )
[332]650
[291]651    ENDIF
652!
[1053]653!-- Check cloud scheme
654    IF ( cloud_scheme == 'seifert_beheng' )  THEN
655       icloud_scheme = 0
656    ELSEIF ( cloud_scheme == 'kessler' )  THEN
657       icloud_scheme = 1
658    ELSE
659       message_string = 'unknown cloud microphysics scheme cloud_scheme ="' // &
660                        TRIM( cloud_scheme ) // '"'
661       CALL message( 'check_parameters', 'PA0357', 1, 2, 0, 6, 0 )
662    ENDIF
663!
[1]664!-- Check whether there are any illegal values
665!-- Pressure solver:
666    IF ( psolver /= 'poisfft'  .AND.  psolver /= 'poisfft_hybrid'  .AND. &
667         psolver /= 'sor'  .AND.  psolver /= 'multigrid' )  THEN
[213]668       message_string = 'unknown solver for perturbation pressure: psolver' // &
669                        ' = "' // TRIM( psolver ) // '"'
[226]670       CALL message( 'check_parameters', 'PA0016', 1, 2, 0, 6, 0 )
[1]671    ENDIF
672
673#if defined( __parallel )
674    IF ( psolver == 'poisfft_hybrid'  .AND.  pdims(2) /= 1 )  THEN
[213]675       message_string = 'psolver = "' // TRIM( psolver ) // '" only works ' // &
676                        'for a 1d domain-decomposition along x & please do' // &
677                        ' not set npey/=1 in the parameter file'
[226]678       CALL message( 'check_parameters', 'PA0017', 1, 2, 0, 6, 0 )
[1]679    ENDIF
680#else
681    IF ( psolver == 'poisfft_hybrid' )  THEN
[213]682       message_string = 'psolver = "' // TRIM( psolver ) // '" only works' // &
683                        ' for a parallel environment'
[226]684       CALL message( 'check_parameters', 'PA0019', 1, 2, 0, 6, 0 )
[1]685    ENDIF
686#endif
687
688    IF ( psolver == 'multigrid' )  THEN
689       IF ( cycle_mg == 'w' )  THEN
690          gamma_mg = 2
691       ELSEIF ( cycle_mg == 'v' )  THEN
692          gamma_mg = 1
693       ELSE
[213]694          message_string = 'unknown multigrid cycle: cycle_mg = "' // &
695                           TRIM( cycle_mg ) // '"'
[226]696          CALL message( 'check_parameters', 'PA0020', 1, 2, 0, 6, 0 )
[1]697       ENDIF
698    ENDIF
699
700    IF ( fft_method /= 'singleton-algorithm'  .AND.  &
701         fft_method /= 'temperton-algorithm'  .AND.  &
702         fft_method /= 'system-specific' )  THEN
[213]703       message_string = 'unknown fft-algorithm: fft_method = "' // &
704                        TRIM( fft_method ) // '"'
[226]705       CALL message( 'check_parameters', 'PA0021', 1, 2, 0, 6, 0 )
[1]706    ENDIF
[667]707   
708    IF( momentum_advec == 'ws-scheme' .AND. & 
[688]709        .NOT. call_psolver_at_all_substeps  ) THEN
[667]710        message_string = 'psolver must be called at each RK3 substep when "'//&
711                      TRIM(momentum_advec) // ' "is used for momentum_advec'
[685]712        CALL message( 'check_parameters', 'PA0344', 1, 2, 0, 6, 0 )
[667]713    END IF
[1]714!
715!-- Advection schemes:
[1001]716    IF ( momentum_advec /= 'pw-scheme'  .AND.  momentum_advec /= 'ws-scheme' ) &
717    THEN
[214]718       message_string = 'unknown advection scheme: momentum_advec = "' // &
719                        TRIM( momentum_advec ) // '"'
[226]720       CALL message( 'check_parameters', 'PA0022', 1, 2, 0, 6, 0 )
[1]721    ENDIF
[1001]722    IF ( ( momentum_advec == 'ws-scheme' .OR.  scalar_advec == 'ws-scheme' )   &
723           .AND. ( timestep_scheme == 'euler' .OR.                             &
724                   timestep_scheme == 'runge-kutta-2' ) )                      &
725    THEN
[667]726       message_string = 'momentum_advec or scalar_advec = "' &
727         // TRIM( momentum_advec ) // '" is not allowed with timestep_scheme = "' // &
728         TRIM( timestep_scheme ) // '"'
[226]729       CALL message( 'check_parameters', 'PA0023', 1, 2, 0, 6, 0 )
[1]730    ENDIF
[667]731    IF ( scalar_advec /= 'pw-scheme'  .AND.  scalar_advec /= 'ws-scheme' .AND. &
[1001]732         scalar_advec /= 'bc-scheme' )                                         &
733    THEN
[214]734       message_string = 'unknown advection scheme: scalar_advec = "' // &
735                        TRIM( scalar_advec ) // '"'
[226]736       CALL message( 'check_parameters', 'PA0024', 1, 2, 0, 6, 0 )
[1]737    ENDIF
[1019]738    IF ( scalar_advec == 'bc-scheme'  .AND.  loop_optimization == 'cache' ) &
739    THEN
740       message_string = 'advection_scheme scalar_advec = "' &
741         // TRIM( scalar_advec ) // '" not implemented for & loop_optimization = "' // &
742         TRIM( loop_optimization ) // '"'
743       CALL message( 'check_parameters', 'PA0026', 1, 2, 0, 6, 0 )
744    ENDIF
[1]745
746    IF ( use_sgs_for_particles  .AND.  .NOT. use_upstream_for_tke )  THEN
747       use_upstream_for_tke = .TRUE.
[214]748       message_string = 'use_upstream_for_tke set .TRUE. because ' // &
749                        'use_sgs_for_particles = .TRUE.'
[226]750       CALL message( 'check_parameters', 'PA0025', 0, 1, 0, 6, 0 )
[1]751    ENDIF
752
[824]753    IF ( use_sgs_for_particles  .AND.  curvature_solution_effects )  THEN
754       message_string = 'use_sgs_for_particles = .TRUE. not allowed with ' // &
755                        'curvature_solution_effects = .TRUE.'
756       CALL message( 'check_parameters', 'PA0349', 1, 2, 0, 6, 0 )
757    ENDIF
758
[1]759!
[1019]760!-- Set LOGICAL switches to enhance performance
761    IF ( momentum_advec == 'ws-scheme' )    ws_scheme_mom = .TRUE.
762    IF ( scalar_advec   == 'ws-scheme'   )  ws_scheme_sca = .TRUE.
763
764!
[1]765!-- Timestep schemes:
766    SELECT CASE ( TRIM( timestep_scheme ) )
767
768       CASE ( 'euler' )
769          intermediate_timestep_count_max = 1
770
771       CASE ( 'runge-kutta-2' )
772          intermediate_timestep_count_max = 2
773
774       CASE ( 'runge-kutta-3' )
775          intermediate_timestep_count_max = 3
776
777       CASE DEFAULT
[214]778          message_string = 'unknown timestep scheme: timestep_scheme = "' // &
779                           TRIM( timestep_scheme ) // '"'
[226]780          CALL message( 'check_parameters', 'PA0027', 1, 2, 0, 6, 0 )
[1]781
782    END SELECT
783
[667]784    IF ( (momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme') &
785         .AND. timestep_scheme(1:5) == 'runge' ) THEN
[214]786       message_string = 'momentum advection scheme "' // &
787                        TRIM( momentum_advec ) // '" & does not work with ' // &
788                        'timestep_scheme "' // TRIM( timestep_scheme ) // '"'
[226]789       CALL message( 'check_parameters', 'PA0029', 1, 2, 0, 6, 0 )
[1]790    ENDIF
791
[825]792!
793!-- Collision kernels:
794    SELECT CASE ( TRIM( collision_kernel ) )
795
[828]796       CASE ( 'hall', 'hall_fast' )
[825]797          hall_kernel = .TRUE.
798
799       CASE ( 'palm' )
800          palm_kernel = .TRUE.
801
[828]802       CASE ( 'wang', 'wang_fast' )
[825]803          wang_kernel = .TRUE.
804
805       CASE ( 'none' )
806
807
808       CASE DEFAULT
809          message_string = 'unknown collision kernel: collision_kernel = "' // &
810                           TRIM( collision_kernel ) // '"'
811          CALL message( 'check_parameters', 'PA0350', 1, 2, 0, 6, 0 )
812
813    END SELECT
[828]814    IF ( collision_kernel(6:9) == 'fast' )  use_kernel_tables = .TRUE.
[825]815
[147]816    IF ( TRIM( initializing_actions ) /= 'read_restart_data'  .AND.  &
[328]817         TRIM( initializing_actions ) /= 'cyclic_fill' )  THEN
[1]818!
[214]819!--    No restart run: several initialising actions are possible
[1]820       action = initializing_actions
821       DO WHILE ( TRIM( action ) /= '' )
822          position = INDEX( action, ' ' )
823          SELECT CASE ( action(1:position-1) )
824
825             CASE ( 'set_constant_profiles', 'set_1d-model_profiles', &
[46]826                    'by_user', 'initialize_vortex',     'initialize_ptanom' )
[1]827                action = action(position+1:)
828
829             CASE DEFAULT
[214]830                message_string = 'initializing_action = "' // &
831                                 TRIM( action ) // '" unkown or not allowed'
[226]832                CALL message( 'check_parameters', 'PA0030', 1, 2, 0, 6, 0 )
[1]833
834          END SELECT
835       ENDDO
836    ENDIF
[214]837
[680]838    IF ( TRIM( initializing_actions ) == 'initialize_vortex' .AND. &
839         conserve_volume_flow ) THEN
840         message_string = 'initializing_actions = "initialize_vortex"' // &
841                        ' ist not allowed with conserve_volume_flow = .T.'
842       CALL message( 'check_parameters', 'PA0343', 1, 2, 0, 6, 0 )
843    ENDIF       
844
845
[1]846    IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0  .AND. &
847         INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
[214]848       message_string = 'initializing_actions = "set_constant_profiles"' // &
849                        ' and "set_1d-model_profiles" are not allowed ' //  &
850                        'simultaneously'
[226]851       CALL message( 'check_parameters', 'PA0031', 1, 2, 0, 6, 0 )
[1]852    ENDIF
[214]853
[46]854    IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0  .AND. &
855         INDEX( initializing_actions, 'by_user' ) /= 0 )  THEN
[214]856       message_string = 'initializing_actions = "set_constant_profiles"' // &
857                        ' and "by_user" are not allowed simultaneously'
[226]858       CALL message( 'check_parameters', 'PA0032', 1, 2, 0, 6, 0 )
[46]859    ENDIF
[214]860
[46]861    IF ( INDEX( initializing_actions, 'by_user' ) /= 0  .AND. &
862         INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
[214]863       message_string = 'initializing_actions = "by_user" and ' // &
864                        '"set_1d-model_profiles" are not allowed simultaneously'
[226]865       CALL message( 'check_parameters', 'PA0033', 1, 2, 0, 6, 0 )
[46]866    ENDIF
[1]867
[75]868    IF ( cloud_physics  .AND.  .NOT. humidity )  THEN
[214]869       WRITE( message_string, * ) 'cloud_physics = ', cloud_physics, ' is ', &
870              'not allowed with humidity = ', humidity
[226]871       CALL message( 'check_parameters', 'PA0034', 1, 2, 0, 6, 0 )
[1]872    ENDIF
873
[72]874    IF ( precipitation  .AND.  .NOT.  cloud_physics )  THEN
[214]875       WRITE( message_string, * ) 'precipitation = ', precipitation, ' is ', &
876              'not allowed with cloud_physics = ', cloud_physics
[226]877       CALL message( 'check_parameters', 'PA0035', 1, 2, 0, 6, 0 )
[72]878    ENDIF
879
[75]880    IF ( humidity  .AND.  sloping_surface )  THEN
[214]881       message_string = 'humidity = .TRUE. and sloping_surface = .TRUE. ' // &
882                        'are not allowed simultaneously'
[226]883       CALL message( 'check_parameters', 'PA0036', 1, 2, 0, 6, 0 )
[1]884    ENDIF
885
[75]886    IF ( passive_scalar  .AND.  humidity )  THEN
[214]887       message_string = 'humidity = .TRUE. and passive_scalar = .TRUE. ' // &
888                        'is not allowed simultaneously'
[226]889       CALL message( 'check_parameters', 'PA0038', 1, 2, 0, 6, 0 )
[1]890    ENDIF
891
[138]892    IF ( plant_canopy .AND. ( drag_coefficient == 0.0 ) ) THEN
[214]893       message_string = 'plant_canopy = .TRUE. requires a non-zero drag ' // &
894                        'coefficient & given value is drag_coefficient = 0.0'
[226]895       CALL message( 'check_parameters', 'PA0041', 1, 2, 0, 6, 0 )
[138]896    ENDIF
897
[1053]898    IF ( plant_canopy  .AND.  cloud_physics  .AND.  icloud_scheme == 0 ) THEN
899       message_string = 'plant_canopy = .TRUE. requires cloud_scheme /=' //  &
900                        ' seifert_beheng'
901       CALL message( 'check_parameters', 'PA0360', 1, 2, 0, 6, 0 )
902    ENDIF
903
904    IF ( loop_optimization /= 'cache' .AND.  cloud_physics  .AND.            &
905         icloud_scheme == 0 ) THEN
906       message_string = 'cloud_scheme = seifert_beheng requires ' // &
907                        'loop_optimization = cache'
908       CALL message( 'check_parameters', 'PA0362', 1, 2, 0, 6, 0 )
909    ENDIF 
910
[1115]911!    IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
912!         .NOT. precipitation  .AND.  .NOT. drizzle ) THEN
913!       message_string = 'cloud_scheme = seifert_beheng requires ' // &
914!                        'precipitation = .TRUE. or drizzle = .TRUE.'
915!       CALL message( 'check_parameters', 'PA0363', 1, 2, 0, 6, 0 )
916!    ENDIF
[1065]917
[1]918!
919!-- In case of no model continuation run, check initialising parameters and
920!-- deduce further quantities
921    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
922
923!
[767]924!--    Initial profiles for 1D and 3D model, respectively (u,v further below)
[1]925       pt_init = pt_surface
[1053]926       IF ( humidity )  THEN
927          q_init  = q_surface
928       ENDIF
[94]929       IF ( ocean )           sa_init = sa_surface
930       IF ( passive_scalar )  q_init  = s_surface
[138]931       IF ( plant_canopy )    lad = 0.0
[1]932
933!
934!--
935!--    If required, compute initial profile of the geostrophic wind
936!--    (component ug)
937       i = 1
938       gradient = 0.0
[97]939
940       IF ( .NOT. ocean )  THEN
941
942          ug_vertical_gradient_level_ind(1) = 0
943          ug(0) = ug_surface
944          DO  k = 1, nzt+1
[177]945             IF ( i < 11 ) THEN
946                IF ( ug_vertical_gradient_level(i) < zu(k)  .AND. &
947                     ug_vertical_gradient_level(i) >= 0.0 )  THEN
948                   gradient = ug_vertical_gradient(i) / 100.0
949                   ug_vertical_gradient_level_ind(i) = k - 1
950                   i = i + 1
[1]951                ENDIF
[177]952             ENDIF       
[97]953             IF ( gradient /= 0.0 )  THEN
954                IF ( k /= 1 )  THEN
955                   ug(k) = ug(k-1) + dzu(k) * gradient
956                ELSE
957                   ug(k) = ug_surface + 0.5 * dzu(k) * gradient
958                ENDIF
[1]959             ELSE
[97]960                ug(k) = ug(k-1)
[1]961             ENDIF
[97]962          ENDDO
[1]963
[97]964       ELSE
965
966          ug_vertical_gradient_level_ind(1) = nzt+1
[121]967          ug(nzt+1) = ug_surface
[667]968          DO  k = nzt, nzb, -1
[177]969             IF ( i < 11 ) THEN
970                IF ( ug_vertical_gradient_level(i) > zu(k)  .AND. &
971                     ug_vertical_gradient_level(i) <= 0.0 )  THEN
972                   gradient = ug_vertical_gradient(i) / 100.0
973                   ug_vertical_gradient_level_ind(i) = k + 1
974                   i = i + 1
[97]975                ENDIF
976             ENDIF
977             IF ( gradient /= 0.0 )  THEN
978                IF ( k /= nzt )  THEN
979                   ug(k) = ug(k+1) - dzu(k+1) * gradient
980                ELSE
981                   ug(k)   = ug_surface - 0.5 * dzu(k+1) * gradient
982                   ug(k+1) = ug_surface + 0.5 * dzu(k+1) * gradient
983                ENDIF
984             ELSE
985                ug(k) = ug(k+1)
986             ENDIF
987          ENDDO
988
989       ENDIF
990
[1]991!
[767]992!--    In case of no given gradients for ug, choose a zero gradient
[97]993       IF ( ug_vertical_gradient_level(1) == -9999999.9 )  THEN
[1]994          ug_vertical_gradient_level(1) = 0.0
995       ENDIF 
996
997!
998!--
999!--    If required, compute initial profile of the geostrophic wind
1000!--    (component vg)
1001       i = 1
1002       gradient = 0.0
[97]1003
1004       IF ( .NOT. ocean )  THEN
1005
1006          vg_vertical_gradient_level_ind(1) = 0
1007          vg(0) = vg_surface
1008          DO  k = 1, nzt+1
[177]1009             IF ( i < 11 ) THEN
1010                IF ( vg_vertical_gradient_level(i) < zu(k)  .AND. &
1011                     vg_vertical_gradient_level(i) >= 0.0 )  THEN
1012                   gradient = vg_vertical_gradient(i) / 100.0
1013                   vg_vertical_gradient_level_ind(i) = k - 1
1014                   i = i + 1
[1]1015                ENDIF
1016             ENDIF
[97]1017             IF ( gradient /= 0.0 )  THEN
1018                IF ( k /= 1 )  THEN
1019                   vg(k) = vg(k-1) + dzu(k) * gradient
1020                ELSE
1021                   vg(k) = vg_surface + 0.5 * dzu(k) * gradient
1022                ENDIF
[1]1023             ELSE
[97]1024                vg(k) = vg(k-1)
[1]1025             ENDIF
[97]1026          ENDDO
[1]1027
[97]1028       ELSE
1029
[121]1030          vg_vertical_gradient_level_ind(1) = nzt+1
1031          vg(nzt+1) = vg_surface
[667]1032          DO  k = nzt, nzb, -1
[177]1033             IF ( i < 11 ) THEN
1034                IF ( vg_vertical_gradient_level(i) > zu(k)  .AND. &
1035                     vg_vertical_gradient_level(i) <= 0.0 )  THEN
1036                   gradient = vg_vertical_gradient(i) / 100.0
1037                   vg_vertical_gradient_level_ind(i) = k + 1
1038                   i = i + 1
[97]1039                ENDIF
1040             ENDIF
1041             IF ( gradient /= 0.0 )  THEN
1042                IF ( k /= nzt )  THEN
1043                   vg(k) = vg(k+1) - dzu(k+1) * gradient
1044                ELSE
1045                   vg(k)   = vg_surface - 0.5 * dzu(k+1) * gradient
1046                   vg(k+1) = vg_surface + 0.5 * dzu(k+1) * gradient
1047                ENDIF
1048             ELSE
1049                vg(k) = vg(k+1)
1050             ENDIF
1051          ENDDO
1052
1053       ENDIF
1054
[1]1055!
[767]1056!--    In case of no given gradients for vg, choose a zero gradient
[97]1057       IF ( vg_vertical_gradient_level(1) == -9999999.9 )  THEN
[1]1058          vg_vertical_gradient_level(1) = 0.0
1059       ENDIF
1060
1061!
[767]1062!--    Let the initial wind profiles be the calculated ug/vg profiles or
1063!--    interpolate them from wind profile data (if given)
1064       IF ( u_profile(1) == 9999999.9  .AND.  v_profile(1) == 9999999.9 )  THEN
1065
1066          u_init = ug
1067          v_init = vg
1068
1069       ELSEIF ( u_profile(1) == 0.0  .AND.  v_profile(1) == 0.0 )  THEN
1070
1071          IF ( uv_heights(1) /= 0.0 )  THEN
1072             message_string = 'uv_heights(1) must be 0.0'
1073             CALL message( 'check_parameters', 'PA0345', 1, 2, 0, 6, 0 )
1074          ENDIF
1075
1076          use_prescribed_profile_data = .TRUE.
1077
1078          kk = 1
1079          u_init(0) = 0.0
1080          v_init(0) = 0.0
1081
1082          DO  k = 1, nz+1
1083
1084             IF ( kk < 100 )  THEN
1085                DO WHILE ( uv_heights(kk+1) <= zu(k) )
1086                   kk = kk + 1
1087                   IF ( kk == 100 )  EXIT
1088                ENDDO
1089             ENDIF
1090
[774]1091             IF ( kk < 100 .AND. uv_heights(kk+1) /= 9999999.9 )  THEN
[767]1092                u_init(k) = u_profile(kk) + ( zu(k) - uv_heights(kk) ) /       &
1093                                       ( uv_heights(kk+1) - uv_heights(kk) ) * &
1094                                       ( u_profile(kk+1) - u_profile(kk) )
1095                v_init(k) = v_profile(kk) + ( zu(k) - uv_heights(kk) ) /       &
1096                                       ( uv_heights(kk+1) - uv_heights(kk) ) * &
1097                                       ( v_profile(kk+1) - v_profile(kk) )
1098             ELSE
1099                u_init(k) = u_profile(kk)
1100                v_init(k) = v_profile(kk)
1101             ENDIF
1102
1103          ENDDO
1104
1105       ELSE
1106
1107          message_string = 'u_profile(1) and v_profile(1) must be 0.0'
1108          CALL message( 'check_parameters', 'PA0346', 1, 2, 0, 6, 0 )
1109
1110       ENDIF
1111
1112!
[94]1113!--    Compute initial temperature profile using the given temperature gradients
[940]1114       IF ( .NOT. neutral )  THEN
[94]1115
[940]1116          i = 1
1117          gradient = 0.0
[94]1118
[940]1119          IF ( .NOT. ocean )  THEN
1120
1121             pt_vertical_gradient_level_ind(1) = 0
1122             DO  k = 1, nzt+1
1123                IF ( i < 11 ) THEN
1124                   IF ( pt_vertical_gradient_level(i) < zu(k)  .AND. &
1125                        pt_vertical_gradient_level(i) >= 0.0 )  THEN
1126                      gradient = pt_vertical_gradient(i) / 100.0
1127                      pt_vertical_gradient_level_ind(i) = k - 1
1128                      i = i + 1
1129                   ENDIF
[1]1130                ENDIF
[940]1131                IF ( gradient /= 0.0 )  THEN
1132                   IF ( k /= 1 )  THEN
1133                      pt_init(k) = pt_init(k-1) + dzu(k) * gradient
1134                   ELSE
1135                      pt_init(k) = pt_surface   + 0.5 * dzu(k) * gradient
1136                   ENDIF
[94]1137                ELSE
[940]1138                   pt_init(k) = pt_init(k-1)
[94]1139                ENDIF
[940]1140             ENDDO
[1]1141
[940]1142          ELSE
[94]1143
[940]1144             pt_vertical_gradient_level_ind(1) = nzt+1
1145             DO  k = nzt, 0, -1
1146                IF ( i < 11 ) THEN
1147                   IF ( pt_vertical_gradient_level(i) > zu(k)  .AND. &
1148                        pt_vertical_gradient_level(i) <= 0.0 )  THEN
1149                      gradient = pt_vertical_gradient(i) / 100.0
1150                      pt_vertical_gradient_level_ind(i) = k + 1
1151                      i = i + 1
1152                   ENDIF
[94]1153                ENDIF
[940]1154                IF ( gradient /= 0.0 )  THEN
1155                   IF ( k /= nzt )  THEN
1156                      pt_init(k) = pt_init(k+1) - dzu(k+1) * gradient
1157                   ELSE
1158                      pt_init(k)   = pt_surface - 0.5 * dzu(k+1) * gradient
1159                      pt_init(k+1) = pt_surface + 0.5 * dzu(k+1) * gradient
1160                   ENDIF
[94]1161                ELSE
[940]1162                   pt_init(k) = pt_init(k+1)
[94]1163                ENDIF
[940]1164             ENDDO
[94]1165
[940]1166          ENDIF
1167
[94]1168       ENDIF
1169
[1]1170!
1171!--    In case of no given temperature gradients, choose gradient of neutral
1172!--    stratification
[94]1173       IF ( pt_vertical_gradient_level(1) == -9999999.9 )  THEN
[1]1174          pt_vertical_gradient_level(1) = 0.0
1175       ENDIF
1176
1177!
[94]1178!--    Store temperature gradient at the top boundary for possible Neumann
[1]1179!--    boundary condition
[19]1180       bc_pt_t_val = ( pt_init(nzt+1) - pt_init(nzt) ) / dzu(nzt+1)
[1]1181
1182!
1183!--    If required, compute initial humidity or scalar profile using the given
1184!--    humidity/scalar gradient. In case of scalar transport, initially store
1185!--    values of the scalar parameters on humidity parameters
1186       IF ( passive_scalar )  THEN
1187          bc_q_b                    = bc_s_b
1188          bc_q_t                    = bc_s_t
1189          q_surface                 = s_surface
1190          q_surface_initial_change  = s_surface_initial_change
1191          q_vertical_gradient       = s_vertical_gradient
1192          q_vertical_gradient_level = s_vertical_gradient_level
1193          surface_waterflux         = surface_scalarflux
[407]1194          wall_humidityflux         = wall_scalarflux
[1]1195       ENDIF
1196
[75]1197       IF ( humidity  .OR.  passive_scalar )  THEN
[1]1198
1199          i = 1
1200          gradient = 0.0
1201          q_vertical_gradient_level_ind(1) = 0
1202          DO  k = 1, nzt+1
[177]1203             IF ( i < 11 ) THEN
1204                IF ( q_vertical_gradient_level(i) < zu(k)  .AND. &
1205                     q_vertical_gradient_level(i) >= 0.0 )  THEN
1206                   gradient = q_vertical_gradient(i) / 100.0
1207                   q_vertical_gradient_level_ind(i) = k - 1
1208                   i = i + 1
[1]1209                ENDIF
1210             ENDIF
1211             IF ( gradient /= 0.0 )  THEN
1212                IF ( k /= 1 )  THEN
1213                   q_init(k) = q_init(k-1) + dzu(k) * gradient
1214                ELSE
1215                   q_init(k) = q_init(k-1) + 0.5 * dzu(k) * gradient
1216                ENDIF
1217             ELSE
1218                q_init(k) = q_init(k-1)
1219             ENDIF
[72]1220!
1221!--          Avoid negative humidities
1222             IF ( q_init(k) < 0.0 )  THEN
1223                q_init(k) = 0.0
1224             ENDIF
[1]1225          ENDDO
1226
1227!
1228!--       In case of no given humidity gradients, choose zero gradient
1229!--       conditions
1230          IF ( q_vertical_gradient_level(1) == -1.0 )  THEN
1231             q_vertical_gradient_level(1) = 0.0
1232          ENDIF
1233!
[1053]1234!--       Store humidity, rain water content and rain drop concentration
1235!--       gradient at the top boundary for possile Neumann boundary condition
1236          bc_q_t_val  = ( q_init(nzt+1) - q_init(nzt) ) / dzu(nzt+1)
[1]1237       ENDIF
1238
[94]1239!
1240!--    If required, compute initial salinity profile using the given salinity
1241!--    gradients
1242       IF ( ocean )  THEN
1243
1244          i = 1
1245          gradient = 0.0
1246
1247          sa_vertical_gradient_level_ind(1) = nzt+1
1248          DO  k = nzt, 0, -1
[177]1249             IF ( i < 11 ) THEN
1250                IF ( sa_vertical_gradient_level(i) > zu(k)  .AND. &
1251                     sa_vertical_gradient_level(i) <= 0.0 )  THEN
1252                   gradient = sa_vertical_gradient(i) / 100.0
1253                   sa_vertical_gradient_level_ind(i) = k + 1
1254                   i = i + 1
[94]1255                ENDIF
1256             ENDIF
1257             IF ( gradient /= 0.0 )  THEN
1258                IF ( k /= nzt )  THEN
1259                   sa_init(k) = sa_init(k+1) - dzu(k+1) * gradient
1260                ELSE
1261                   sa_init(k)   = sa_surface - 0.5 * dzu(k+1) * gradient
1262                   sa_init(k+1) = sa_surface + 0.5 * dzu(k+1) * gradient
1263                ENDIF
1264             ELSE
1265                sa_init(k) = sa_init(k+1)
1266             ENDIF
1267          ENDDO
1268
1269       ENDIF
1270
[138]1271!
[388]1272!--    If required compute the profile of leaf area density used in the plant
1273!--    canopy model
[138]1274       IF ( plant_canopy ) THEN
1275       
1276          i = 1
1277          gradient = 0.0
[1]1278
[138]1279          IF ( .NOT. ocean ) THEN
[153]1280
1281             lad(0) = lad_surface
[138]1282 
1283             lad_vertical_gradient_level_ind(1) = 0
1284             DO k = 1, pch_index
[177]1285                IF ( i < 11 ) THEN
1286                   IF ( lad_vertical_gradient_level(i) < zu(k) .AND.  &
1287                        lad_vertical_gradient_level(i) >= 0.0 ) THEN
1288                      gradient = lad_vertical_gradient(i)
1289                      lad_vertical_gradient_level_ind(i) = k - 1
1290                      i = i + 1
[138]1291                   ENDIF
1292                ENDIF
1293                IF ( gradient /= 0.0 ) THEN
1294                   IF ( k /= 1 ) THEN
1295                      lad(k) = lad(k-1) + dzu(k) * gradient
1296                   ELSE
1297                      lad(k) = lad_surface + 0.5 * dzu(k) *gradient
1298                   ENDIF
1299                ELSE
1300                   lad(k) = lad(k-1)
1301                ENDIF
1302             ENDDO
1303
1304          ENDIF
1305
[1]1306!
[388]1307!--       In case of no given leaf area density gradients, choose a vanishing
1308!--       gradient
[138]1309          IF ( lad_vertical_gradient_level(1) == -9999999.9 ) THEN
1310             lad_vertical_gradient_level(1) = 0.0
1311          ENDIF
1312
1313       ENDIF
1314         
1315    ENDIF
[411]1316
1317!
1318!-- Initialize large scale subsidence if required
[580]1319    IF ( subs_vertical_gradient_level(1) /= -9999999.9 )  THEN
[411]1320       large_scale_subsidence = .TRUE.
1321       CALL init_w_subsidence
1322    END IF
1323 
[138]1324             
[667]1325
[138]1326!
[1]1327!-- Compute Coriolis parameter
1328    f  = 2.0 * omega * SIN( phi / 180.0 * pi )
1329    fs = 2.0 * omega * COS( phi / 180.0 * pi )
1330
1331!
[97]1332!-- Ocean runs always use reference values in the buoyancy term. Therefore
1333!-- set the reference temperature equal to the surface temperature.
1334    IF ( ocean  .AND.  pt_reference == 9999999.9 )  pt_reference = pt_surface
[57]1335
1336!
[97]1337!-- Reference value has to be used in buoyancy terms
1338    IF ( pt_reference /= 9999999.9 )  use_reference = .TRUE.
1339
1340!
1341!-- Sign of buoyancy/stability terms
1342    IF ( ocean )  atmos_ocean_sign = -1.0
1343
1344!
[108]1345!-- Ocean version must use flux boundary conditions at the top
1346    IF ( ocean .AND. .NOT. use_top_fluxes )  THEN
[215]1347       message_string = 'use_top_fluxes must be .TRUE. in ocean version'
[226]1348       CALL message( 'check_parameters', 'PA0042', 1, 2, 0, 6, 0 )
[108]1349    ENDIF
[97]1350
1351!
[1]1352!-- In case of a given slope, compute the relevant quantities
1353    IF ( alpha_surface /= 0.0 )  THEN
1354       IF ( ABS( alpha_surface ) > 90.0 )  THEN
[215]1355          WRITE( message_string, * ) 'ABS( alpha_surface = ', alpha_surface, &
1356                                     ' ) must be < 90.0'
[226]1357          CALL message( 'check_parameters', 'PA0043', 1, 2, 0, 6, 0 )
[1]1358       ENDIF
1359       sloping_surface = .TRUE.
1360       cos_alpha_surface = COS( alpha_surface / 180.0 * pi )
1361       sin_alpha_surface = SIN( alpha_surface / 180.0 * pi )
1362    ENDIF
1363
1364!
1365!-- Check time step and cfl_factor
1366    IF ( dt /= -1.0 )  THEN
1367       IF ( dt <= 0.0  .AND.  dt /= -1.0 )  THEN
[215]1368          WRITE( message_string, * ) 'dt = ', dt , ' <= 0.0'
[226]1369          CALL message( 'check_parameters', 'PA0044', 1, 2, 0, 6, 0 )
[1]1370       ENDIF
1371       dt_3d = dt
1372       dt_fixed = .TRUE.
1373    ENDIF
1374
1375    IF ( cfl_factor <= 0.0  .OR.  cfl_factor > 1.0 )  THEN
1376       IF ( cfl_factor == -1.0 )  THEN
[1001]1377          IF ( timestep_scheme == 'runge-kutta-2' )  THEN
[1]1378             cfl_factor = 0.8
[1001]1379          ELSEIF ( timestep_scheme == 'runge-kutta-3' )  THEN
1380             cfl_factor = 0.9
[1]1381          ELSE
[1001]1382             cfl_factor = 0.9
[1]1383          ENDIF
1384       ELSE
[215]1385          WRITE( message_string, * ) 'cfl_factor = ', cfl_factor, &
1386                 ' out of range & 0.0 < cfl_factor <= 1.0 is required'
[226]1387          CALL message( 'check_parameters', 'PA0045', 1, 2, 0, 6, 0 )
[1]1388       ENDIF
1389    ENDIF
1390
1391!
1392!-- Store simulated time at begin
1393    simulated_time_at_begin = simulated_time
1394
1395!
[291]1396!-- Store reference time for coupled runs and change the coupling flag,
1397!-- if ...
1398    IF ( simulated_time == 0.0 )  THEN
1399       IF ( coupling_start_time == 0.0 )  THEN
1400          time_since_reference_point = 0.0
1401       ELSEIF ( time_since_reference_point < 0.0 )  THEN
1402          run_coupled = .FALSE.
1403       ENDIF
1404    ENDIF
1405
1406!
[1]1407!-- Set wind speed in the Galilei-transformed system
1408    IF ( galilei_transformation )  THEN
[1053]1409       IF ( use_ug_for_galilei_tr .AND.                  &
1410            ug_vertical_gradient_level(1) == 0.0  .AND.  &
1411            ug_vertical_gradient(1) == 0.0  .AND.        & 
1412            vg_vertical_gradient_level(1) == 0.0  .AND.  &
1413            vg_vertical_gradient(1) == 0.0 )  THEN
[866]1414          u_gtrans = ug_surface * 0.6
1415          v_gtrans = vg_surface * 0.6
[1053]1416       ELSEIF ( use_ug_for_galilei_tr  .AND.                  &
1417                ( ug_vertical_gradient_level(1) /= 0.0  .OR.  &
1418                ug_vertical_gradient(1) /= 0.0 ) )  THEN
[215]1419          message_string = 'baroclinicity (ug) not allowed simultaneously' // &
1420                           ' with galilei transformation'
[226]1421          CALL message( 'check_parameters', 'PA0046', 1, 2, 0, 6, 0 )
[1053]1422       ELSEIF ( use_ug_for_galilei_tr  .AND.                  &
1423                ( vg_vertical_gradient_level(1) /= 0.0  .OR.  &
1424                vg_vertical_gradient(1) /= 0.0 ) )  THEN
[215]1425          message_string = 'baroclinicity (vg) not allowed simultaneously' // &
1426                           ' with galilei transformation'
[226]1427          CALL message( 'check_parameters', 'PA0047', 1, 2, 0, 6, 0 )
[1]1428       ELSE
[215]1429          message_string = 'variable translation speed used for galilei-' // &
1430             'transformation, which may cause & instabilities in stably ' // &
1431             'stratified regions'
[226]1432          CALL message( 'check_parameters', 'PA0048', 0, 1, 0, 6, 0 )
[1]1433       ENDIF
1434    ENDIF
1435
1436!
1437!-- In case of using a prandtl-layer, calculated (or prescribed) surface
1438!-- fluxes have to be used in the diffusion-terms
1439    IF ( prandtl_layer )  use_surface_fluxes = .TRUE.
1440
1441!
1442!-- Check boundary conditions and set internal variables:
1443!-- Lateral boundary conditions
[73]1444    IF ( bc_lr /= 'cyclic'  .AND.  bc_lr /= 'dirichlet/radiation'  .AND. &
[1159]1445         bc_lr /= 'radiation/dirichlet' )  THEN
[215]1446       message_string = 'unknown boundary condition: bc_lr = "' // &
1447                        TRIM( bc_lr ) // '"'
[226]1448       CALL message( 'check_parameters', 'PA0049', 1, 2, 0, 6, 0 )
[1]1449    ENDIF
[73]1450    IF ( bc_ns /= 'cyclic'  .AND.  bc_ns /= 'dirichlet/radiation'  .AND. &
[1159]1451         bc_ns /= 'radiation/dirichlet' )  THEN
[215]1452       message_string = 'unknown boundary condition: bc_ns = "' // &
1453                        TRIM( bc_ns ) // '"'
[226]1454       CALL message( 'check_parameters', 'PA0050', 1, 2, 0, 6, 0 )
[1]1455    ENDIF
1456
1457!
[366]1458!-- Internal variables used for speed optimization in if clauses
[707]1459    IF ( bc_lr /= 'cyclic' )               bc_lr_cyc    = .FALSE.
1460    IF ( bc_lr == 'dirichlet/radiation' )  bc_lr_dirrad = .TRUE.
1461    IF ( bc_lr == 'radiation/dirichlet' )  bc_lr_raddir = .TRUE.
1462    IF ( bc_ns /= 'cyclic' )               bc_ns_cyc    = .FALSE.
1463    IF ( bc_ns == 'dirichlet/radiation' )  bc_ns_dirrad = .TRUE.
1464    IF ( bc_ns == 'radiation/dirichlet' )  bc_ns_raddir = .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
[1159]3305    IF ( bc_lr == 'radiation/dirichlet' )  THEN
[1]3306       dist_nxr    = nx - inflow_disturbance_begin
3307       dist_nxl(1) = nx - inflow_disturbance_end
[1159]3308    ELSEIF ( bc_lr == 'dirichlet/radiation' )  THEN
[1]3309       dist_nxl    = inflow_disturbance_begin
3310       dist_nxr(1) = inflow_disturbance_end
[73]3311    ENDIF
[1159]3312    IF ( bc_ns == 'dirichlet/radiation' )  THEN
[1]3313       dist_nyn    = ny - inflow_disturbance_begin
3314       dist_nys(1) = ny - inflow_disturbance_end
[1159]3315    ELSEIF ( bc_ns == 'radiation/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)
[1159]3323    IF ( turbulent_inflow  .AND.  bc_lr /= 'dirichlet/radiation' )  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.