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

Last change on this file since 213 was 213, checked in by raasch, 15 years ago

Output message can be handled with new subroutine handle_palm_message. All output messages will be replaced by this routine step by step within the next revisions

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