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

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