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

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