SUBROUTINE check_parameters !------------------------------------------------------------------------------! ! Actual revisions: ! ----------------- ! Multigrid solver allows topography ! ! Former revisions: ! ----------------- ! $Id: check_parameters.f90 114 2007-10-10 00:03:15Z raasch $ ! ! 109 2007-08-28 15:26:47Z letzel ! Check coupling_mode and set default (obligatory) values (like boundary ! conditions for temperature and fluxes) in case of coupled runs. ! +profiles for w*p* and w"e ! Bugfix: Error message concerning output of particle concentration (pc) ! modified ! More checks and more default values for coupled runs ! allow data_output_pr= q, wq, w"q", w*q* for humidity = .T. (instead of ! cloud_physics = .T.) ! Rayleigh damping for ocean fixed. ! Check and, if necessary, set default value for dt_coupling ! ! 97 2007-06-21 08:23:15Z raasch ! Initial salinity profile is calculated, salinity boundary conditions are ! checked, ! z_max_do1d is checked only in case of ocean = .f., ! +initial temperature and geostrophic velocity profiles for the ocean version, ! use_pt_reference renamed use_reference ! ! 89 2007-05-25 12:08:31Z raasch ! Check for user-defined profiles ! ! 75 2007-03-22 09:54:05Z raasch ! "by_user" allowed as initializing action, -data_output_ts, ! leapfrog with non-flat topography not allowed any more, loop_optimization ! and pt_reference are checked, moisture renamed humidity, ! output of precipitation amount/rate and roughnes length + check ! possible negative humidities are avoided in initial profile, ! dirichlet/neumann changed to dirichlet/radiation, etc., ! revision added to run_description_header ! ! 20 2007-02-26 00:12:32Z raasch ! Temperature and humidity gradients at top are now calculated for nzt+1, ! top_heatflux and respective boundary condition bc_pt_t is checked ! ! RCS Log replace by Id keyword, revision history cleaned up ! ! Revision 1.61 2006/08/04 14:20:25 raasch ! do2d_unit and do3d_unit now defined as 2d-arrays, check of ! use_upstream_for_tke, default value for dt_dopts, ! generation of file header moved from routines palm and header to here ! ! Revision 1.1 1997/08/26 06:29:23 raasch ! Initial revision ! ! ! Description: ! ------------ ! Check control parameters and deduce further quantities. !------------------------------------------------------------------------------! USE arrays_3d USE constants USE control_parameters USE grid_variables USE indices USE model_1d USE netcdf_control USE particle_attributes USE pegrid USE profil_parameter USE statistics USE transpose_indices IMPLICIT NONE CHARACTER (LEN=1) :: sq CHARACTER (LEN=6) :: var CHARACTER (LEN=7) :: unit CHARACTER (LEN=8) :: date CHARACTER (LEN=10) :: time CHARACTER (LEN=40) :: coupling_string CHARACTER (LEN=100) :: action INTEGER :: i, ilen, intervals, iremote = 0, iter, j, k, nnxh, nnyh, & position, prec LOGICAL :: found, ldum REAL :: gradient, maxn, maxp, remote = 0.0 ! !-- Warning, if host is not set IF ( host(1:1) == ' ' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ WARNING: check_parameters:' PRINT*, ' "host" is not set. Please check that environment', & ' variable "localhost"' PRINT*, ' is set before running PALM' ENDIF ENDIF ! !-- Check the coupling mode IF ( coupling_mode /= 'uncoupled' .AND. & coupling_mode /= 'atmosphere_to_ocean' .AND. & coupling_mode /= 'ocean_to_atmosphere' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' illegal coupling mode: ', TRIM( coupling_mode ) ENDIF CALL local_stop ENDIF ! !-- Check dt_coupling, restart_time, dt_restart, end_time, dx, dy, nx and ny IF ( coupling_mode /= 'uncoupled' ) THEN IF ( dt_coupling == 9999999.9 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' dt_coupling is not set but required for coupling ', & 'mode: ', TRIM( coupling_mode ) ENDIF CALL local_stop ENDIF #if defined( __parallel ) && defined( __mpi2 ) CALL MPI_SEND( dt_coupling, 1, MPI_REAL, myid, 11, comm_inter, ierr ) CALL MPI_RECV( remote, 1, MPI_REAL, myid, 11, comm_inter, status, ierr ) IF ( dt_coupling /= remote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): dt_coupling = ', dt_coupling PRINT*, ' is not equal to dt_coupling_remote = ', remote ENDIF CALL local_stop ENDIF IF ( dt_coupling <= 0.0 ) THEN CALL MPI_SEND( dt_max, 1, MPI_REAL, myid, 19, comm_inter, ierr ) CALL MPI_RECV( remote, 1, MPI_REAL, myid, 19, comm_inter, status, & ierr ) dt_coupling = MAX( dt_max, remote ) IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): dt_coupling <= 0.0' PRINT*, ' is not allowed and is reset to MAX(dt_max(A,O)) = ', & dt_coupling ENDIF ENDIF CALL MPI_SEND( restart_time, 1, MPI_REAL, myid, 12, comm_inter, ierr ) CALL MPI_RECV( remote, 1, MPI_REAL, myid, 12, comm_inter, status, ierr ) IF ( restart_time /= remote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): restart_time = ', restart_time PRINT*, ' is not equal to restart_time_remote = ', remote ENDIF CALL local_stop ENDIF CALL MPI_SEND( dt_restart, 1, MPI_REAL, myid, 13, comm_inter, ierr ) CALL MPI_RECV( remote, 1, MPI_REAL, myid, 13, comm_inter, status, ierr ) IF ( dt_restart /= remote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): dt_restart = ', dt_restart PRINT*, ' is not equal to dt_restart_remote = ', remote ENDIF CALL local_stop ENDIF CALL MPI_SEND( end_time, 1, MPI_REAL, myid, 14, comm_inter, ierr ) CALL MPI_RECV( remote, 1, MPI_REAL, myid, 14, comm_inter, status, ierr ) IF ( end_time /= remote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): end_time = ', end_time PRINT*, ' is not equal to end_time_remote = ', remote ENDIF CALL local_stop ENDIF CALL MPI_SEND( dx, 1, MPI_REAL, myid, 15, comm_inter, ierr ) CALL MPI_RECV( remote, 1, MPI_REAL, myid, 15, comm_inter, status, ierr ) IF ( dx /= remote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): dx = ', dx PRINT*, ' is not equal to dx_remote = ', remote ENDIF CALL local_stop ENDIF CALL MPI_SEND( dy, 1, MPI_REAL, myid, 16, comm_inter, ierr ) CALL MPI_RECV( remote, 1, MPI_REAL, myid, 16, comm_inter, status, ierr ) IF ( dy /= remote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): dy = ', dy PRINT*, ' is not equal to dy_remote = ', remote ENDIF CALL local_stop ENDIF CALL MPI_SEND( nx, 1, MPI_INTEGER, myid, 17, comm_inter, ierr ) CALL MPI_RECV( iremote, 1, MPI_INTEGER, myid, 17, comm_inter, status, & ierr ) IF ( nx /= iremote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): nx = ', nx PRINT*, ' is not equal to nx_remote = ', iremote ENDIF CALL local_stop ENDIF CALL MPI_SEND( ny, 1, MPI_INTEGER, myid, 18, comm_inter, ierr ) CALL MPI_RECV( iremote, 1, MPI_INTEGER, myid, 18, comm_inter, status, & ierr ) IF ( ny /= iremote ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' TRIM( coupling_mode ): ny = ', ny PRINT*, ' is not equal to ny_remote = ', iremote ENDIF CALL local_stop ENDIF #endif ENDIF #if defined( __parallel ) && defined( __mpi2 ) ! !-- Exchange via intercommunicator IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN CALL MPI_SEND( humidity, & 1, MPI_LOGICAL, myid, 19, comm_inter, ierr ) ELSEIF ( coupling_mode == 'ocean_to_atmosphere' ) THEN CALL MPI_RECV( humidity_remote, & 1, MPI_LOGICAL, myid, 19, comm_inter, status, ierr ) ENDIF #endif ! !-- Generate the file header which is used as a header for most of PALM's !-- output files CALL DATE_AND_TIME( date, time ) run_date = date(7:8)//'-'//date(5:6)//'-'//date(3:4) run_time = time(1:2)//':'//time(3:4)//':'//time(5:6) IF ( coupling_mode == 'uncoupled' ) THEN coupling_string = '' ELSEIF ( coupling_mode == 'atmosphere_to_ocean' ) THEN coupling_string = ' coupled (atmosphere)' ELSEIF ( coupling_mode == 'ocean_to_atmosphere' ) THEN coupling_string = ' coupled (ocean)' ENDIF WRITE ( run_description_header, & '(A,2X,A,2X,A,A,A,I2.2,A,2X,A,A,2X,A,1X,A)' ) & TRIM( version ), TRIM( revision ), 'run: ', & TRIM( run_identifier ), '.', runnr, TRIM( coupling_string ), & 'host: ', TRIM( host ), run_date, run_time ! !-- Check the general loop optimization method IF ( loop_optimization == 'default' ) THEN IF ( host(1:3) == 'nec' ) THEN loop_optimization = 'vector' ELSE loop_optimization = 'cache' ENDIF ENDIF IF ( loop_optimization /= 'noopt' .AND. loop_optimization /= 'cache' & .AND. loop_optimization /= 'vector' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' illegal value given for loop_optimization: ', & TRIM( loop_optimization ) ENDIF CALL local_stop ENDIF ! !-- Check topography setting (check for illegal parameter combinations) IF ( topography /= 'flat' ) THEN action = ' ' IF ( scalar_advec /= 'pw-scheme' ) THEN WRITE( action, '(A,A)' ) 'scalar_advec = ', scalar_advec ENDIF IF ( momentum_advec /= 'pw-scheme' ) THEN WRITE( action, '(A,A)' ) 'momentum_advec = ', momentum_advec ENDIF IF ( timestep_scheme(1:8) == 'leapfrog' ) THEN WRITE( action, '(A,A)' ) 'timestep_scheme = ', timestep_scheme ENDIF IF ( psolver == 'sor' ) THEN WRITE( action, '(A,A)' ) 'psolver = ', psolver ENDIF IF ( sloping_surface ) THEN WRITE( action, '(A)' ) 'sloping surface = .TRUE.' ENDIF IF ( galilei_transformation ) THEN WRITE( action, '(A)' ) 'galilei_transformation = .TRUE.' ENDIF IF ( cloud_physics ) THEN WRITE( action, '(A)' ) 'cloud_physics = .TRUE.' ENDIF IF ( cloud_droplets ) THEN WRITE( action, '(A)' ) 'cloud_droplets = .TRUE.' ENDIF IF ( humidity ) THEN WRITE( action, '(A)' ) 'humidity = .TRUE.' ENDIF IF ( .NOT. prandtl_layer ) THEN WRITE( action, '(A)' ) 'prandtl_layer = .FALSE.' ENDIF IF ( action /= ' ' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' a non-flat topography does not allow ', TRIM( action ) ENDIF CALL local_stop ENDIF ENDIF ! !-- Check ocean setting IF ( ocean ) THEN action = ' ' IF ( timestep_scheme(1:8) == 'leapfrog' ) THEN WRITE( action, '(A,A)' ) 'timestep_scheme = ', timestep_scheme ENDIF IF ( momentum_advec == 'ups-scheme' ) THEN WRITE( action, '(A,A)' ) 'momentum_advec = ', momentum_advec ENDIF IF ( action /= ' ' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' ocean = .T. does not allow ', TRIM( action ) ENDIF CALL local_stop ENDIF ENDIF ! !-- Check whether there are any illegal values !-- Pressure solver: IF ( psolver /= 'poisfft' .AND. psolver /= 'poisfft_hybrid' .AND. & psolver /= 'sor' .AND. psolver /= 'multigrid' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown solver for perturbation pressure: psolver=', & psolver ENDIF CALL local_stop ENDIF #if defined( __parallel ) IF ( psolver == 'poisfft_hybrid' .AND. pdims(2) /= 1 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' psolver="', TRIM( psolver ), '" only works for a ', & '1d domain-decomposition along x' PRINT*, ' please do not set npey/=1 in the parameter file' ENDIF CALL local_stop ENDIF IF ( ( psolver == 'poisfft_hybrid' .OR. psolver == 'multigrid' ) .AND. & ( nxra > nxr .OR. nyna > nyn .OR. nza > nz ) ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' psolver="', TRIM( psolver ), '" does not work for ', & 'subdomains with unequal size' PRINT*, ' please set grid_matching = ''strict'' in the parameter',& ' file' ENDIF CALL local_stop ENDIF #else IF ( psolver == 'poisfft_hybrid' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' psolver="', TRIM( psolver ), '" only works for a ', & 'parallel environment' ENDIF CALL local_stop ENDIF #endif IF ( psolver == 'multigrid' ) THEN IF ( cycle_mg == 'w' ) THEN gamma_mg = 2 ELSEIF ( cycle_mg == 'v' ) THEN gamma_mg = 1 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown multigrid cycle: cycle_mg=', cycle_mg ENDIF CALL local_stop ENDIF ENDIF IF ( fft_method /= 'singleton-algorithm' .AND. & fft_method /= 'temperton-algorithm' .AND. & fft_method /= 'system-specific' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown fft-algorithm: fft_method=', fft_method ENDIF CALL local_stop ENDIF ! !-- Advection schemes: IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ups-scheme' ) & THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: unknown advection ', & 'scheme: momentum_advec=', momentum_advec CALL local_stop ENDIF IF ( ( momentum_advec == 'ups-scheme' .OR. scalar_advec == 'ups-scheme' )& .AND. timestep_scheme /= 'euler' ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: momentum_advec=', & momentum_advec, ' is not allowed with ', & 'timestep_scheme=', timestep_scheme CALL local_stop ENDIF IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'bc-scheme' .AND.& scalar_advec /= 'ups-scheme' ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: unknown advection ', & 'scheme: scalar_advec=', scalar_advec CALL local_stop ENDIF IF ( use_sgs_for_particles .AND. .NOT. use_upstream_for_tke ) THEN use_upstream_for_tke = .TRUE. IF ( myid == 0 ) THEN PRINT*, '+++ WARNING: check_parameters: use_upstream_for_tke set ', & '.TRUE. because use_sgs_for_particles = .TRUE.' ENDIF ENDIF IF ( use_upstream_for_tke .AND. timestep_scheme(1:8) == 'leapfrog' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: use_upstream_for_tke = .TRUE. ', & 'not allowed with timestep_scheme=', timestep_scheme ENDIF CALL local_stop ENDIF ! !-- Timestep schemes: SELECT CASE ( TRIM( timestep_scheme ) ) CASE ( 'euler' ) intermediate_timestep_count_max = 1 asselin_filter_factor = 0.0 CASE ( 'leapfrog', 'leapfrog+euler' ) intermediate_timestep_count_max = 1 CASE ( 'runge-kutta-2' ) intermediate_timestep_count_max = 2 asselin_filter_factor = 0.0 CASE ( 'runge-kutta-3' ) intermediate_timestep_count_max = 3 asselin_filter_factor = 0.0 CASE DEFAULT IF ( myid == 0 ) PRINT*, '+++ check_parameters: unknown timestep ',& 'scheme: timestep_scheme=', timestep_scheme CALL local_stop END SELECT IF ( scalar_advec == 'ups-scheme' .AND. timestep_scheme(1:5) == 'runge' )& THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: scalar advection scheme "', & TRIM( scalar_advec ), '"' PRINT*, ' does not work with timestep_scheme "', & TRIM( timestep_scheme ), '"' ENDIF CALL local_stop ENDIF IF ( momentum_advec /= 'pw-scheme' .AND. timestep_scheme(1:5) == 'runge' ) & THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: momentum advection scheme "', & TRIM( momentum_advec ), '"' PRINT*, ' does not work with timestep_scheme "', & TRIM( timestep_scheme ), '"' ENDIF CALL local_stop ENDIF IF ( initializing_actions == ' ' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check parameters:' PRINT*, ' no value found for initializing_actions' ENDIF CALL local_stop ENDIF IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN ! !-- No model continuation run; several initialising actions are possible action = initializing_actions DO WHILE ( TRIM( action ) /= '' ) position = INDEX( action, ' ' ) SELECT CASE ( action(1:position-1) ) CASE ( 'set_constant_profiles', 'set_1d-model_profiles', & 'by_user', 'initialize_vortex', 'initialize_ptanom' ) action = action(position+1:) CASE DEFAULT IF ( myid == 0 ) PRINT*, '+++ check_parameters: initializi', & 'ng_action unkown or not allowed: action = "', & TRIM(action), '"' CALL local_stop END SELECT ENDDO ENDIF IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. & INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: initializing_actions', & '"set_constant_profiles" and "set_1d-model_profiles" are not', & ' allowed simultaneously' CALL local_stop ENDIF IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. & INDEX( initializing_actions, 'by_user' ) /= 0 ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: initializing_actions', & '"set_constant_profiles" and "by_user" are not', & ' allowed simultaneously' CALL local_stop ENDIF IF ( INDEX( initializing_actions, 'by_user' ) /= 0 .AND. & INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: initializing_actions', & '"by_user" and "set_1d-model_profiles" are not', & ' allowed simultaneously' CALL local_stop ENDIF IF ( cloud_physics .AND. .NOT. humidity ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: cloud_physics =', & cloud_physics, ' is not allowed with ', & 'humidity =', humidity CALL local_stop ENDIF IF ( precipitation .AND. .NOT. cloud_physics ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: precipitation =', & precipitation, ' is not allowed with ', & 'cloud_physics =', cloud_physics CALL local_stop ENDIF IF ( humidity .AND. sloping_surface ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: humidity = TRUE', & 'and hang = TRUE are not', & ' allowed simultaneously' CALL local_stop ENDIF IF ( humidity .AND. scalar_advec == 'ups-scheme' ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: UPS-scheme', & 'is not implemented for humidity' CALL local_stop ENDIF IF ( passive_scalar .AND. humidity ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: humidity = TRUE and', & 'passive_scalar = TRUE is not allowed ', & 'simultaneously' CALL local_stop ENDIF IF ( passive_scalar .AND. scalar_advec == 'ups-scheme' ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: UPS-scheme', & 'is not implemented for passive_scalar' CALL local_stop ENDIF IF ( grid_matching /= 'strict' .AND. grid_matching /= 'match' ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: illegal value "', & TRIM( grid_matching ), & '" found for parameter grid_matching' CALL local_stop ENDIF ! !-- In case of no model continuation run, check initialising parameters and !-- deduce further quantities IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN ! !-- Initial profiles for 1D and 3D model, respectively u_init = ug_surface v_init = vg_surface pt_init = pt_surface IF ( humidity ) q_init = q_surface IF ( ocean ) sa_init = sa_surface IF ( passive_scalar ) q_init = s_surface ! !-- !-- If required, compute initial profile of the geostrophic wind !-- (component ug) i = 1 gradient = 0.0 IF ( .NOT. ocean ) THEN ug_vertical_gradient_level_ind(1) = 0 ug(0) = ug_surface DO k = 1, nzt+1 IF ( ug_vertical_gradient_level(i) < zu(k) .AND. & ug_vertical_gradient_level(i) >= 0.0 ) THEN gradient = ug_vertical_gradient(i) / 100.0 ug_vertical_gradient_level_ind(i) = k - 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of array', & ' "ug_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= 1 ) THEN ug(k) = ug(k-1) + dzu(k) * gradient ELSE ug(k) = ug_surface + 0.5 * dzu(k) * gradient ENDIF ELSE ug(k) = ug(k-1) ENDIF ENDDO ELSE ug_vertical_gradient_level_ind(1) = nzt+1 DO k = nzt, 0, -1 IF ( ug_vertical_gradient_level(i) > zu(k) .AND. & ug_vertical_gradient_level(i) <= 0.0 ) THEN gradient = ug_vertical_gradient(i) / 100.0 ug_vertical_gradient_level_ind(i) = k + 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of array', & ' "ug_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= nzt ) THEN ug(k) = ug(k+1) - dzu(k+1) * gradient ELSE ug(k) = ug_surface - 0.5 * dzu(k+1) * gradient ug(k+1) = ug_surface + 0.5 * dzu(k+1) * gradient ENDIF ELSE ug(k) = ug(k+1) ENDIF ENDDO ENDIF u_init = ug ! !-- In case of no given gradients for ug, choose a vanishing gradient IF ( ug_vertical_gradient_level(1) == -9999999.9 ) THEN ug_vertical_gradient_level(1) = 0.0 ENDIF ! !-- !-- If required, compute initial profile of the geostrophic wind !-- (component vg) i = 1 gradient = 0.0 IF ( .NOT. ocean ) THEN vg_vertical_gradient_level_ind(1) = 0 vg(0) = vg_surface DO k = 1, nzt+1 IF ( vg_vertical_gradient_level(i) < zu(k) .AND. & vg_vertical_gradient_level(i) >= 0.0 ) THEN gradient = vg_vertical_gradient(i) / 100.0 vg_vertical_gradient_level_ind(i) = k - 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of array', & ' "vg_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= 1 ) THEN vg(k) = vg(k-1) + dzu(k) * gradient ELSE vg(k) = vg_surface + 0.5 * dzu(k) * gradient ENDIF ELSE vg(k) = vg(k-1) ENDIF ENDDO ELSE vg_vertical_gradient_level_ind(1) = 0 DO k = nzt, 0, -1 IF ( vg_vertical_gradient_level(i) > zu(k) .AND. & vg_vertical_gradient_level(i) <= 0.0 ) THEN gradient = vg_vertical_gradient(i) / 100.0 vg_vertical_gradient_level_ind(i) = k + 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of array', & ' "vg_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= nzt ) THEN vg(k) = vg(k+1) - dzu(k+1) * gradient ELSE vg(k) = vg_surface - 0.5 * dzu(k+1) * gradient vg(k+1) = vg_surface + 0.5 * dzu(k+1) * gradient ENDIF ELSE vg(k) = vg(k+1) ENDIF ENDDO ENDIF v_init = vg ! !-- In case of no given gradients for vg, choose a vanishing gradient IF ( vg_vertical_gradient_level(1) == -9999999.9 ) THEN vg_vertical_gradient_level(1) = 0.0 ENDIF ! !-- Compute initial temperature profile using the given temperature gradients i = 1 gradient = 0.0 IF ( .NOT. ocean ) THEN pt_vertical_gradient_level_ind(1) = 0 DO k = 1, nzt+1 IF ( pt_vertical_gradient_level(i) < zu(k) .AND. & pt_vertical_gradient_level(i) >= 0.0 ) THEN gradient = pt_vertical_gradient(i) / 100.0 pt_vertical_gradient_level_ind(i) = k - 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of array', & ' "pt_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= 1 ) THEN pt_init(k) = pt_init(k-1) + dzu(k) * gradient ELSE pt_init(k) = pt_surface + 0.5 * dzu(k) * gradient ENDIF ELSE pt_init(k) = pt_init(k-1) ENDIF ENDDO ELSE pt_vertical_gradient_level_ind(1) = nzt+1 DO k = nzt, 0, -1 IF ( pt_vertical_gradient_level(i) > zu(k) .AND. & pt_vertical_gradient_level(i) <= 0.0 ) THEN gradient = pt_vertical_gradient(i) / 100.0 pt_vertical_gradient_level_ind(i) = k + 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of array', & ' "pt_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= nzt ) THEN pt_init(k) = pt_init(k+1) - dzu(k+1) * gradient ELSE pt_init(k) = pt_surface - 0.5 * dzu(k+1) * gradient pt_init(k+1) = pt_surface + 0.5 * dzu(k+1) * gradient ENDIF ELSE pt_init(k) = pt_init(k+1) ENDIF ENDDO ENDIF ! !-- In case of no given temperature gradients, choose gradient of neutral !-- stratification IF ( pt_vertical_gradient_level(1) == -9999999.9 ) THEN pt_vertical_gradient_level(1) = 0.0 ENDIF ! !-- Store temperature gradient at the top boundary for possible Neumann !-- boundary condition bc_pt_t_val = ( pt_init(nzt+1) - pt_init(nzt) ) / dzu(nzt+1) ! !-- If required, compute initial humidity or scalar profile using the given !-- humidity/scalar gradient. In case of scalar transport, initially store !-- values of the scalar parameters on humidity parameters IF ( passive_scalar ) THEN bc_q_b = bc_s_b bc_q_t = bc_s_t q_surface = s_surface q_surface_initial_change = s_surface_initial_change q_vertical_gradient = s_vertical_gradient q_vertical_gradient_level = s_vertical_gradient_level surface_waterflux = surface_scalarflux ENDIF IF ( humidity .OR. passive_scalar ) THEN i = 1 gradient = 0.0 q_vertical_gradient_level_ind(1) = 0 DO k = 1, nzt+1 IF ( q_vertical_gradient_level(i) < zu(k) .AND. & q_vertical_gradient_level(i) >= 0.0 ) THEN gradient = q_vertical_gradient(i) / 100.0 q_vertical_gradient_level_ind(i) = k - 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of arr', & 'ay "q_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= 1 ) THEN q_init(k) = q_init(k-1) + dzu(k) * gradient ELSE q_init(k) = q_init(k-1) + 0.5 * dzu(k) * gradient ENDIF ELSE q_init(k) = q_init(k-1) ENDIF ! !-- Avoid negative humidities IF ( q_init(k) < 0.0 ) THEN q_init(k) = 0.0 ENDIF ENDDO ! !-- In case of no given humidity gradients, choose zero gradient !-- conditions IF ( q_vertical_gradient_level(1) == -1.0 ) THEN q_vertical_gradient_level(1) = 0.0 ENDIF ! !-- Store humidity gradient at the top boundary for possile Neumann !-- boundary condition bc_q_t_val = ( q_init(nzt+1) - q_init(nzt) ) / dzu(nzt+1) ENDIF ! !-- If required, compute initial salinity profile using the given salinity !-- gradients IF ( ocean ) THEN i = 1 gradient = 0.0 sa_vertical_gradient_level_ind(1) = nzt+1 DO k = nzt, 0, -1 IF ( sa_vertical_gradient_level(i) > zu(k) .AND. & sa_vertical_gradient_level(i) <= 0.0 ) THEN gradient = sa_vertical_gradient(i) / 100.0 sa_vertical_gradient_level_ind(i) = k + 1 i = i + 1 IF ( i > 10 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: upper bound 10 of array', & ' "sa_vertical_gradient_level_ind" exceeded' ENDIF CALL local_stop ENDIF ENDIF IF ( gradient /= 0.0 ) THEN IF ( k /= nzt ) THEN sa_init(k) = sa_init(k+1) - dzu(k+1) * gradient ELSE sa_init(k) = sa_surface - 0.5 * dzu(k+1) * gradient sa_init(k+1) = sa_surface + 0.5 * dzu(k+1) * gradient ENDIF ELSE sa_init(k) = sa_init(k+1) ENDIF ENDDO ENDIF ENDIF ! !-- Compute Coriolis parameter f = 2.0 * omega * SIN( phi / 180.0 * pi ) fs = 2.0 * omega * COS( phi / 180.0 * pi ) ! !-- Ocean runs always use reference values in the buoyancy term. Therefore !-- set the reference temperature equal to the surface temperature. IF ( ocean .AND. pt_reference == 9999999.9 ) pt_reference = pt_surface ! !-- Reference value has to be used in buoyancy terms IF ( pt_reference /= 9999999.9 ) use_reference = .TRUE. ! !-- Sign of buoyancy/stability terms IF ( ocean ) atmos_ocean_sign = -1.0 ! !-- Ocean version must use flux boundary conditions at the top IF ( ocean .AND. .NOT. use_top_fluxes ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: use_top_fluxes ',& 'must be .TRUE. in ocean version' CALL local_stop ENDIF ! !-- In case of a given slope, compute the relevant quantities IF ( alpha_surface /= 0.0 ) THEN IF ( ABS( alpha_surface ) > 90.0 ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: ABS( alpha_surface',& '=', alpha_surface, ' ) must be < 90.0' CALL local_stop ENDIF sloping_surface = .TRUE. cos_alpha_surface = COS( alpha_surface / 180.0 * pi ) sin_alpha_surface = SIN( alpha_surface / 180.0 * pi ) ENDIF ! !-- Check time step and cfl_factor IF ( dt /= -1.0 ) THEN IF ( dt <= 0.0 .AND. dt /= -1.0 ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: dt=', dt, ' <= 0.0' CALL local_stop ENDIF dt_3d = dt dt_fixed = .TRUE. ENDIF IF ( cfl_factor <= 0.0 .OR. cfl_factor > 1.0 ) THEN IF ( cfl_factor == -1.0 ) THEN IF ( momentum_advec == 'ups-scheme' .OR. & scalar_advec == 'ups-scheme' ) THEN cfl_factor = 0.8 ELSE IF ( timestep_scheme == 'runge-kutta-2' ) THEN cfl_factor = 0.8 ELSEIF ( timestep_scheme == 'runge-kutta-3' ) THEN cfl_factor = 0.9 ELSE cfl_factor = 0.1 ENDIF ENDIF ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: cfl_factor=', cfl_factor, & ' out of range' PRINT*, '+++ 0.0 < cfl_factor <= 1.0 is required' ENDIF CALL local_stop ENDIF ENDIF ! !-- Store simulated time at begin simulated_time_at_begin = simulated_time ! !-- Set wind speed in the Galilei-transformed system IF ( galilei_transformation ) THEN IF ( use_ug_for_galilei_tr .AND. & ug_vertical_gradient_level(1) == 0.0 .AND. & vg_vertical_gradient_level(1) == 0.0 ) THEN u_gtrans = ug_surface v_gtrans = vg_surface ELSEIF ( use_ug_for_galilei_tr .AND. & ug_vertical_gradient_level(1) /= 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' baroclinicity (ug) not allowed' PRINT*, ' simultaneously with galilei transformation' ENDIF CALL local_stop ELSEIF ( use_ug_for_galilei_tr .AND. & vg_vertical_gradient_level(1) /= 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' baroclinicity (vg) not allowed' PRINT*, ' simultaneously with galilei transformation' ENDIF CALL local_stop ELSE IF ( myid == 0 ) THEN PRINT*, '+++ WARNING: check_parameters:' PRINT*, ' variable translation speed used for galilei-tran' // & 'sformation, which' PRINT*, ' may cause instabilities in stably stratified regions' ENDIF ENDIF ENDIF ! !-- In case of using a prandtl-layer, calculated (or prescribed) surface !-- fluxes have to be used in the diffusion-terms IF ( prandtl_layer ) use_surface_fluxes = .TRUE. ! !-- Check boundary conditions and set internal variables: !-- Lateral boundary conditions IF ( bc_lr /= 'cyclic' .AND. bc_lr /= 'dirichlet/radiation' .AND. & bc_lr /= 'radiation/dirichlet' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_lr = ', bc_lr ENDIF CALL local_stop ENDIF IF ( bc_ns /= 'cyclic' .AND. bc_ns /= 'dirichlet/radiation' .AND. & bc_ns /= 'radiation/dirichlet' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_ns = ', bc_ns ENDIF CALL local_stop ENDIF ! !-- Non-cyclic lateral boundaries require the multigrid method and Piascek- !-- Willimas advection scheme. Several schemes and tools do not work with !-- non-cyclic boundary conditions. IF ( bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' ) THEN IF ( psolver /= 'multigrid' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' non-cyclic lateral boundaries do not allow', & ' psolver = ', psolver ENDIF CALL local_stop ENDIF IF ( momentum_advec /= 'pw-scheme' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' non-cyclic lateral boundaries do not allow', & ' momentum_advec = ', momentum_advec ENDIF CALL local_stop ENDIF IF ( scalar_advec /= 'pw-scheme' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' non-cyclic lateral boundaries do not allow', & ' scalar_advec = ', scalar_advec ENDIF CALL local_stop ENDIF IF ( galilei_transformation ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' non-cyclic lateral boundaries do not allow', & ' galilei_transformation = .T.' ENDIF CALL local_stop ENDIF ! IF ( conserve_volume_flow ) THEN ! IF ( myid == 0 ) THEN ! PRINT*, '+++ check_parameters:' ! PRINT*, ' non-cyclic lateral boundaries do not allow', & ! ' conserve_volume_flow = .T.' ! ENDIF ! CALL local_stop ! ENDIF ENDIF ! !-- Bottom boundary condition for the turbulent Kinetic energy IF ( bc_e_b == 'neumann' ) THEN ibc_e_b = 1 IF ( adjust_mixing_length .AND. prandtl_layer ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ WARNING: check_parameters:' PRINT*, ' adjust_mixing_length = TRUE and bc_e_b = ', bc_e_b ENDIF ENDIF ELSEIF ( bc_e_b == '(u*)**2+neumann' ) THEN ibc_e_b = 2 IF ( .NOT. adjust_mixing_length .AND. prandtl_layer ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ WARNING: check_parameters:' PRINT*, ' adjust_mixing_length = FALSE and bc_e_b = ', bc_e_b ENDIF ENDIF IF ( .NOT. prandtl_layer ) THEN bc_e_b = 'neumann' ibc_e_b = 1 IF ( myid == 0 ) THEN PRINT*, '+++ WARNING: check_parameters:' PRINT*, ' boundary condition bc_e_b changed to "', bc_e_b, '"' ENDIF ENDIF ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_e_b = ', bc_e_b ENDIF CALL local_stop ENDIF ! !-- Boundary conditions for perturbation pressure IF ( bc_p_b == 'dirichlet' ) THEN ibc_p_b = 0 ELSEIF ( bc_p_b == 'neumann' ) THEN ibc_p_b = 1 ELSEIF ( bc_p_b == 'neumann+inhomo' ) THEN ibc_p_b = 2 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_p_b = ', bc_p_b ENDIF CALL local_stop ENDIF IF ( ibc_p_b == 2 .AND. .NOT. prandtl_layer ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' boundary condition: bc_p_b = ', TRIM( bc_p_b ), & ' not allowed with' PRINT*, ' prandtl_layer = .FALSE.' ENDIF CALL local_stop ENDIF IF ( bc_p_t == 'dirichlet' ) THEN ibc_p_t = 0 ELSEIF ( bc_p_t == 'neumann' ) THEN ibc_p_t = 1 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_p_t = ', bc_p_t ENDIF CALL local_stop ENDIF ! !-- Boundary conditions for potential temperature IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN ibc_pt_b = 2 ELSE IF ( bc_pt_b == 'dirichlet' ) THEN ibc_pt_b = 0 ELSEIF ( bc_pt_b == 'neumann' ) THEN ibc_pt_b = 1 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_pt_b = ', bc_pt_b ENDIF CALL local_stop ENDIF ENDIF IF ( bc_pt_t == 'dirichlet' ) THEN ibc_pt_t = 0 ELSEIF ( bc_pt_t == 'neumann' ) THEN ibc_pt_t = 1 ELSEIF ( bc_pt_t == 'initial_gradient' ) THEN ibc_pt_t = 2 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_pt_t = ', bc_pt_t ENDIF CALL local_stop ENDIF IF ( surface_heatflux == 9999999.9 ) constant_heatflux = .FALSE. IF ( top_heatflux == 9999999.9 ) constant_top_heatflux = .FALSE. IF ( top_momentumflux_u /= 9999999.9 .AND. & top_momentumflux_v /= 9999999.9 ) THEN constant_top_momentumflux = .TRUE. ELSEIF ( .NOT. ( top_momentumflux_u == 9999999.9 .AND. & top_momentumflux_v == 9999999.9 ) ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' both, top_momentumflux_u AND top_momentumflux_v' PRINT*, ' must be set' ENDIF CALL local_stop ENDIF ! !-- A given surface temperature implies Dirichlet boundary condition for !-- temperature. In this case specification of a constant heat flux is !-- forbidden. IF ( ibc_pt_b == 0 .AND. constant_heatflux .AND. & surface_heatflux /= 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' boundary_condition: bc_pt_b = ', bc_pt_b PRINT*, ' is not allowed with constant_heatflux = .TRUE.' ENDIF CALL local_stop ENDIF IF ( constant_heatflux .AND. pt_surface_initial_change /= 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: constant_heatflux = .TRUE. is not' PRINT*, ' allowed with pt_surface_initial_change (/=0) = ', & pt_surface_initial_change ENDIF CALL local_stop ENDIF ! !-- A given temperature at the top implies Dirichlet boundary condition for !-- temperature. In this case specification of a constant heat flux is !-- forbidden. IF ( ibc_pt_t == 0 .AND. constant_top_heatflux .AND. & top_heatflux /= 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' boundary_condition: bc_pt_t = ', bc_pt_t PRINT*, ' is not allowed with constant_top_heatflux = .TRUE.' ENDIF CALL local_stop ENDIF ! !-- Boundary conditions for salinity IF ( ocean ) THEN IF ( bc_sa_t == 'dirichlet' ) THEN ibc_sa_t = 0 ELSEIF ( bc_sa_t == 'neumann' ) THEN ibc_sa_t = 1 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_sa_t = ', bc_sa_t ENDIF CALL local_stop ENDIF IF ( top_salinityflux == 9999999.9 ) constant_top_salinityflux = .FALSE. IF ( ibc_sa_t == 1 .AND. top_salinityflux == 9999999.9 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' boundary_condition: bc_sa_t = ', bc_sa_t PRINT*, ' requires to set top_salinityflux ' ENDIF CALL local_stop ENDIF ! !-- A fixed salinity at the top implies Dirichlet boundary condition for !-- salinity. In this case specification of a constant salinity flux is !-- forbidden. IF ( ibc_sa_t == 0 .AND. constant_top_salinityflux .AND. & top_salinityflux /= 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' boundary_condition: bc_sa_t = ', bc_sa_t PRINT*, ' is not allowed with constant_top_salinityflux = ', & '.TRUE.' ENDIF CALL local_stop ENDIF ENDIF ! !-- In case of humidity or passive scalar, set boundary conditions for total !-- water content / scalar IF ( humidity .OR. passive_scalar ) THEN IF ( humidity ) THEN sq = 'q' ELSE sq = 's' ENDIF IF ( bc_q_b == 'dirichlet' ) THEN ibc_q_b = 0 ELSEIF ( bc_q_b == 'neumann' ) THEN ibc_q_b = 1 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_', sq, '_b = ', bc_q_b ENDIF CALL local_stop ENDIF IF ( bc_q_t == 'dirichlet' ) THEN ibc_q_t = 0 ELSEIF ( bc_q_t == 'neumann' ) THEN ibc_q_t = 1 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_', sq, '_t = ', bc_q_t ENDIF CALL local_stop ENDIF IF ( surface_waterflux == 0.0 ) constant_waterflux = .FALSE. ! !-- A given surface humidity implies Dirichlet boundary condition for !-- humidity. In this case specification of a constant water flux is !-- forbidden. IF ( ibc_q_b == 0 .AND. constant_waterflux ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' boundary_condition: bc_', sq, '_b = ', bc_q_b PRINT*, ' is not allowed with prescribed surface flux' ENDIF CALL local_stop ENDIF IF ( constant_waterflux .AND. q_surface_initial_change /= 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: a prescribed surface flux is not' PRINT*, ' allowed with ', sq, '_surface_initial_change (/=0)', & ' = ', q_surface_initial_change ENDIF CALL local_stop ENDIF ENDIF ! !-- Boundary conditions for horizontal components of wind speed IF ( bc_uv_b == 'dirichlet' ) THEN ibc_uv_b = 0 ELSEIF ( bc_uv_b == 'neumann' ) THEN ibc_uv_b = 1 IF ( prandtl_layer ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' boundary condition: bc_uv_b = ', TRIM( bc_uv_b ), & ' is not allowed with' PRINT*, ' prandtl_layer = .TRUE.' ENDIF CALL local_stop ENDIF ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_uv_b = ', bc_uv_b ENDIF CALL local_stop ENDIF IF ( coupling_mode == 'ocean_to_atmosphere' ) THEN bc_uv_t = 'neumann' ibc_uv_t = 1 ELSE IF ( bc_uv_t == 'dirichlet' ) THEN ibc_uv_t = 0 ELSEIF ( bc_uv_t == 'neumann' ) THEN ibc_uv_t = 1 ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown boundary condition: bc_uv_t = ', bc_uv_t ENDIF CALL local_stop ENDIF ENDIF ! !-- Compute and check, respectively, the Rayleigh Damping parameter IF ( rayleigh_damping_factor == -1.0 ) THEN IF ( momentum_advec == 'ups-scheme' ) THEN rayleigh_damping_factor = 0.01 ELSE rayleigh_damping_factor = 0.0 ENDIF ELSE IF ( rayleigh_damping_factor < 0.0 .OR. rayleigh_damping_factor > 1.0 ) & THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' rayleigh_damping_factor = ', rayleigh_damping_factor,& ' out of range [0.0,1.0]' ENDIF CALL local_stop ENDIF ENDIF IF ( rayleigh_damping_height == -1.0 ) THEN IF ( .NOT. ocean ) THEN rayleigh_damping_height = 0.66666666666 * zu(nzt) ELSE rayleigh_damping_height = 0.66666666666 * zu(nzb) ENDIF ELSE IF ( .NOT. ocean ) THEN IF ( rayleigh_damping_height < 0.0 .OR. & rayleigh_damping_height > zu(nzt) ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' rayleigh_damping_height = ', rayleigh_damping_height,& ' out of range [0.0,', zu(nzt), ']' ENDIF CALL local_stop ENDIF ELSE IF ( rayleigh_damping_height > 0.0 .OR. & rayleigh_damping_height < zu(nzb) ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' rayleigh_damping_height = ', rayleigh_damping_height,& ' out of range [0.0,', zu(nzb), ']' ENDIF CALL local_stop ENDIF ENDIF ENDIF ! !-- Check limiters for Upstream-Spline scheme IF ( overshoot_limit_u < 0.0 .OR. overshoot_limit_v < 0.0 .OR. & overshoot_limit_w < 0.0 .OR. overshoot_limit_pt < 0.0 .OR. & overshoot_limit_e < 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' overshoot_limit_... < 0.0 is not allowed' ENDIF CALL local_stop ENDIF IF ( ups_limit_u < 0.0 .OR. ups_limit_v < 0.0 .OR. ups_limit_w < 0.0 .OR. & ups_limit_pt < 0.0 .OR. ups_limit_e < 0.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' ups_limit_... < 0.0 is not allowed' ENDIF CALL local_stop ENDIF ! !-- Check number of chosen statistic regions. More than 10 regions are not !-- allowed, because so far no more than 10 corresponding output files can !-- be opened (cf. check_open) IF ( statistic_regions > 9 .OR. statistic_regions < 0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: Number of statistic_regions = ', & statistic_regions+1 PRINT*, ' Only 10 regions are allowed' ENDIF CALL local_stop ENDIF IF ( normalizing_region > statistic_regions .OR. & normalizing_region < 0) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: normalizing_region = ', & normalizing_region, ' is unknown' PRINT*, ' Must be <= ', statistic_regions ENDIF CALL local_stop ENDIF ! !-- Set the default intervals for data output, if necessary !-- NOTE: dt_dosp has already been set in package_parin IF ( dt_data_output /= 9999999.9 ) THEN IF ( dt_dopr == 9999999.9 ) dt_dopr = dt_data_output IF ( dt_dopts == 9999999.9 ) dt_dopts = dt_data_output IF ( dt_do2d_xy == 9999999.9 ) dt_do2d_xy = dt_data_output IF ( dt_do2d_xz == 9999999.9 ) dt_do2d_xz = dt_data_output IF ( dt_do2d_yz == 9999999.9 ) dt_do2d_yz = dt_data_output IF ( dt_do3d == 9999999.9 ) dt_do3d = dt_data_output IF ( dt_data_output_av == 9999999.9 ) dt_data_output_av = dt_data_output ENDIF ! !-- Set the default skip time intervals for data output, if necessary IF ( skip_time_dopr == 9999999.9 ) & skip_time_dopr = skip_time_data_output IF ( skip_time_dosp == 9999999.9 ) & skip_time_dosp = skip_time_data_output IF ( skip_time_do2d_xy == 9999999.9 ) & skip_time_do2d_xy = skip_time_data_output IF ( skip_time_do2d_xz == 9999999.9 ) & skip_time_do2d_xz = skip_time_data_output IF ( skip_time_do2d_yz == 9999999.9 ) & skip_time_do2d_yz = skip_time_data_output IF ( skip_time_do3d == 9999999.9 ) & skip_time_do3d = skip_time_data_output IF ( skip_time_data_output_av == 9999999.9 ) & skip_time_data_output_av = skip_time_data_output ! !-- Check the average intervals (first for 3d-data, then for profiles and !-- spectra) IF ( averaging_interval > dt_data_output_av ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: average_interval=', & averaging_interval, ' must be <= dt_data_output=', & dt_data_output ENDIF CALL local_stop ENDIF IF ( averaging_interval_pr == 9999999.9 ) THEN averaging_interval_pr = averaging_interval ENDIF IF ( averaging_interval_pr > dt_dopr ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: averaging_interval_pr=', & averaging_interval_pr, ' must be <= dt_dopr=', dt_dopr ENDIF CALL local_stop ENDIF IF ( averaging_interval_sp == 9999999.9 ) THEN averaging_interval_sp = averaging_interval ENDIF IF ( averaging_interval_sp > dt_dosp ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: averaging_interval_sp=', & averaging_interval_sp, ' must be <= dt_dosp=', dt_dosp ENDIF CALL local_stop ENDIF ! !-- Set the default interval for profiles entering the temporal average IF ( dt_averaging_input_pr == 9999999.9 ) THEN dt_averaging_input_pr = dt_averaging_input ENDIF ! !-- Set the default interval for the output of timeseries to a reasonable !-- value (tries to minimize the number of calls of flow_statistics) IF ( dt_dots == 9999999.9 ) THEN IF ( averaging_interval_pr == 0.0 ) THEN dt_dots = MIN( dt_run_control, dt_dopr ) ELSE dt_dots = MIN( dt_run_control, dt_averaging_input_pr ) ENDIF ENDIF ! !-- Check the sample rate for averaging (first for 3d-data, then for profiles) IF ( dt_averaging_input > averaging_interval ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: dt_averaging_input=', & dt_averaging_input, ' must be <= averaging_interval=', & averaging_interval ENDIF CALL local_stop ENDIF IF ( dt_averaging_input_pr > averaging_interval_pr ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: dt_averaging_input_pr=', & dt_averaging_input_pr, & ' must be <= averaging_interval_pr=', & averaging_interval_pr ENDIF CALL local_stop ENDIF ! !-- Set the default value for the integration interval of precipitation amount IF ( precipitation ) THEN IF ( precipitation_amount_interval == 9999999.9 ) THEN precipitation_amount_interval = dt_do2d_xy ELSE IF ( precipitation_amount_interval > dt_do2d_xy ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: ', & 'precipitation_amount_interval =', & precipitation_amount_interval, & ' must not be larger than dt_do2d_xy', & ' = ', dt_do2d_xy CALL local_stop ENDIF ENDIF ENDIF ! !-- Determine the number of output profiles and check whether they are !-- permissible DO WHILE ( data_output_pr(dopr_n+1) /= ' ' ) dopr_n = dopr_n + 1 i = dopr_n ! !-- Determine internal profile number (for hom, homs) !-- and store height levels SELECT CASE ( TRIM( data_output_pr(i) ) ) CASE ( 'u', '#u' ) dopr_index(i) = 1 dopr_unit(i) = 'm/s' hom(:,2,1,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 5 hom(:,2,5,:) = SPREAD( zu, 2, statistic_regions+1 ) data_output_pr(i) = data_output_pr(i)(2:) ENDIF CASE ( 'v', '#v' ) dopr_index(i) = 2 dopr_unit(i) = 'm/s' hom(:,2,2,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 6 hom(:,2,6,:) = SPREAD( zu, 2, statistic_regions+1 ) data_output_pr(i) = data_output_pr(i)(2:) ENDIF CASE ( 'w' ) dopr_index(i) = 3 dopr_unit(i) = 'm/s' hom(:,2,3,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'pt', '#pt' ) IF ( .NOT. cloud_physics ) THEN dopr_index(i) = 4 dopr_unit(i) = 'K' hom(:,2,4,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 7 hom(:,2,7,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,7,:) = 0.0 ! because zu(nzb) is negative data_output_pr(i) = data_output_pr(i)(2:) ENDIF ELSE dopr_index(i) = 43 dopr_unit(i) = 'K' hom(:,2,43,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 28 hom(:,2,28,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,28,:) = 0.0 ! because zu(nzb) is negative data_output_pr(i) = data_output_pr(i)(2:) ENDIF ENDIF CASE ( 'e' ) dopr_index(i) = 8 dopr_unit(i) = 'm2/s2' hom(:,2,8,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,8,:) = 0.0 CASE ( 'km', '#km' ) dopr_index(i) = 9 dopr_unit(i) = 'm2/s' hom(:,2,9,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,9,:) = 0.0 IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 23 hom(:,2,23,:) = hom(:,2,9,:) data_output_pr(i) = data_output_pr(i)(2:) ENDIF CASE ( 'kh', '#kh' ) dopr_index(i) = 10 dopr_unit(i) = 'm2/s' hom(:,2,10,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,10,:) = 0.0 IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 24 hom(:,2,24,:) = hom(:,2,10,:) data_output_pr(i) = data_output_pr(i)(2:) ENDIF CASE ( 'l', '#l' ) dopr_index(i) = 11 dopr_unit(i) = 'm' hom(:,2,11,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,11,:) = 0.0 IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 25 hom(:,2,25,:) = hom(:,2,11,:) data_output_pr(i) = data_output_pr(i)(2:) ENDIF CASE ( 'w"u"' ) dopr_index(i) = 12 dopr_unit(i) = 'm2/s2' hom(:,2,12,:) = SPREAD( zw, 2, statistic_regions+1 ) IF ( prandtl_layer ) hom(nzb,2,12,:) = zu(1) CASE ( 'w*u*' ) dopr_index(i) = 13 dopr_unit(i) = 'm2/s2' hom(:,2,13,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w"v"' ) dopr_index(i) = 14 dopr_unit(i) = 'm2/s2' hom(:,2,14,:) = SPREAD( zw, 2, statistic_regions+1 ) IF ( prandtl_layer ) hom(nzb,2,14,:) = zu(1) CASE ( 'w*v*' ) dopr_index(i) = 15 dopr_unit(i) = 'm2/s2' hom(:,2,15,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w"pt"' ) dopr_index(i) = 16 dopr_unit(i) = 'K m/s' hom(:,2,16,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w*pt*' ) dopr_index(i) = 17 dopr_unit(i) = 'K m/s' hom(:,2,17,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'wpt' ) dopr_index(i) = 18 dopr_unit(i) = 'K m/s' hom(:,2,18,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'wu' ) dopr_index(i) = 19 dopr_unit(i) = 'm2/s2' hom(:,2,19,:) = SPREAD( zw, 2, statistic_regions+1 ) IF ( prandtl_layer ) hom(nzb,2,19,:) = zu(1) CASE ( 'wv' ) dopr_index(i) = 20 dopr_unit(i) = 'm2/s2' hom(:,2,20,:) = SPREAD( zw, 2, statistic_regions+1 ) IF ( prandtl_layer ) hom(nzb,2,20,:) = zu(1) CASE ( 'w*pt*BC' ) dopr_index(i) = 21 dopr_unit(i) = 'K m/s' hom(:,2,21,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'wptBC' ) dopr_index(i) = 22 dopr_unit(i) = 'K m/s' hom(:,2,22,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'sa', '#sa' ) IF ( .NOT. ocean ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for ocean = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 23 dopr_unit(i) = 'psu' hom(:,2,23,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 26 hom(:,2,26,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,26,:) = 0.0 ! weil zu(nzb) negativ ist data_output_pr(i) = data_output_pr(i)(2:) ENDIF ENDIF CASE ( 'u*2' ) dopr_index(i) = 30 dopr_unit(i) = 'm2/s2' hom(:,2,30,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'v*2' ) dopr_index(i) = 31 dopr_unit(i) = 'm2/s2' hom(:,2,31,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'w*2' ) dopr_index(i) = 32 dopr_unit(i) = 'm2/s2' hom(:,2,32,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'pt*2' ) dopr_index(i) = 33 dopr_unit(i) = 'K2' hom(:,2,33,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'e*' ) dopr_index(i) = 34 dopr_unit(i) = 'm2/s2' hom(:,2,34,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'w*2pt*' ) dopr_index(i) = 35 dopr_unit(i) = 'K m2/s2' hom(:,2,35,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w*pt*2' ) dopr_index(i) = 36 dopr_unit(i) = 'K2 m/s' hom(:,2,36,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w*e*' ) dopr_index(i) = 37 dopr_unit(i) = 'm3/s3' hom(:,2,37,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w*3' ) dopr_index(i) = 38 dopr_unit(i) = 'm3/s3' hom(:,2,38,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'Sw' ) dopr_index(i) = 39 dopr_unit(i) = 'none' hom(:,2,39,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'q', '#q' ) IF ( .NOT. humidity ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for humidity = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 41 dopr_unit(i) = 'kg/kg' hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 26 hom(:,2,26,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,26,:) = 0.0 ! weil zu(nzb) negativ ist data_output_pr(i) = data_output_pr(i)(2:) ENDIF ENDIF CASE ( 's', '#s' ) IF ( .NOT. passive_scalar ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for passive_scalar = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 41 dopr_unit(i) = 'kg/m3' hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 26 hom(:,2,26,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,26,:) = 0.0 ! weil zu(nzb) negativ ist data_output_pr(i) = data_output_pr(i)(2:) ENDIF ENDIF CASE ( 'qv', '#qv' ) IF ( .NOT. cloud_physics ) THEN dopr_index(i) = 41 dopr_unit(i) = 'kg/kg' hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 26 hom(:,2,26,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,26,:) = 0.0 ! weil zu(nzb) negativ ist data_output_pr(i) = data_output_pr(i)(2:) ENDIF ELSE dopr_index(i) = 42 dopr_unit(i) = 'kg/kg' hom(:,2,42,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 27 hom(:,2,27,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,27,:) = 0.0 ! weil zu(nzb) negativ ist data_output_pr(i) = data_output_pr(i)(2:) ENDIF ENDIF CASE ( 'lpt', '#lpt' ) IF ( .NOT. cloud_physics ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for cloud_physics = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 4 dopr_unit(i) = 'K' hom(:,2,4,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 7 hom(:,2,7,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,7,:) = 0.0 ! weil zu(nzb) negativ ist data_output_pr(i) = data_output_pr(i)(2:) ENDIF ENDIF CASE ( 'vpt', '#vpt' ) dopr_index(i) = 44 dopr_unit(i) = 'K' hom(:,2,44,:) = SPREAD( zu, 2, statistic_regions+1 ) IF ( data_output_pr(i)(1:1) == '#' ) THEN dopr_initial_index(i) = 29 hom(:,2,29,:) = SPREAD( zu, 2, statistic_regions+1 ) hom(nzb,2,29,:) = 0.0 ! weil zu(nzb) negativ ist data_output_pr(i) = data_output_pr(i)(2:) ENDIF CASE ( 'w"vpt"' ) dopr_index(i) = 45 dopr_unit(i) = 'K m/s' hom(:,2,45,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w*vpt*' ) dopr_index(i) = 46 dopr_unit(i) = 'K m/s' hom(:,2,46,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'wvpt' ) dopr_index(i) = 47 dopr_unit(i) = 'K m/s' hom(:,2,47,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w"q"' ) IF ( .NOT. humidity ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for humidity = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 48 dopr_unit(i) = 'kg/kg m/s' hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'w*q*' ) IF ( .NOT. humidity ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for humidity = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 49 dopr_unit(i) = 'kg/kg m/s' hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'wq' ) IF ( .NOT. humidity ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for humidity = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 50 dopr_unit(i) = 'kg/kg m/s' hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'w"s"' ) IF ( .NOT. passive_scalar ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for passive_scalar = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 48 dopr_unit(i) = 'kg/m3 m/s' hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'w*s*' ) IF ( .NOT. passive_scalar ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for passive_scalar = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 49 dopr_unit(i) = 'kg/m3 m/s' hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'ws' ) IF ( .NOT. passive_scalar ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for passive_scalar = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 50 dopr_unit(i) = 'kg/m3 m/s' hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'w"qv"' ) IF ( humidity .AND. .NOT. cloud_physics ) & THEN dopr_index(i) = 48 dopr_unit(i) = 'kg/kg m/s' hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 ) ELSEIF( humidity .AND. cloud_physics ) THEN dopr_index(i) = 51 dopr_unit(i) = 'kg/kg m/s' hom(:,2,51,:) = SPREAD( zw, 2, statistic_regions+1 ) ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for cloud_physics = FALSE', & ' and humidity = FALSE' ENDIF CALL local_stop ENDIF CASE ( 'w*qv*' ) IF ( humidity .AND. .NOT. cloud_physics ) & THEN dopr_index(i) = 49 dopr_unit(i) = 'kg/kg m/s' hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 ) ELSEIF( humidity .AND. cloud_physics ) THEN dopr_index(i) = 52 dopr_unit(i) = 'kg/kg m/s' hom(:,2,52,:) = SPREAD( zw, 2, statistic_regions+1 ) ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for cloud_physics = FALSE', & ' and humidity = FALSE' ENDIF CALL local_stop ENDIF CASE ( 'wqv' ) IF ( humidity .AND. .NOT. cloud_physics ) & THEN dopr_index(i) = 50 dopr_unit(i) = 'kg/kg m/s' hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 ) ELSEIF( humidity .AND. cloud_physics ) THEN dopr_index(i) = 53 dopr_unit(i) = 'kg/kg m/s' hom(:,2,53,:) = SPREAD( zw, 2, statistic_regions+1 ) ELSE IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for cloud_physics = FALSE', & ' and humidity = FALSE' ENDIF CALL local_stop ENDIF CASE ( 'ql' ) IF ( .NOT. cloud_physics .AND. .NOT. cloud_droplets ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for cloud_physics = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 54 dopr_unit(i) = 'kg/kg' hom(:,2,54,:) = SPREAD( zu, 2, statistic_regions+1 ) ENDIF CASE ( 'w*u*u*/dz' ) dopr_index(i) = 55 dopr_unit(i) = 'm2/s3' hom(:,2,55,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'w*p*/dz' ) dopr_index(i) = 56 dopr_unit(i) = 'm2/s3' hom(:,2,56,:) = SPREAD( zw, 2, statistic_regions+1 ) CASE ( 'w"e/dz' ) dopr_index(i) = 57 dopr_unit(i) = 'm2/s3' hom(:,2,57,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'u"pt"' ) dopr_index(i) = 58 dopr_unit(i) = 'K m/s' hom(:,2,58,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'u*pt*' ) dopr_index(i) = 59 dopr_unit(i) = 'K m/s' hom(:,2,59,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'upt_t' ) dopr_index(i) = 60 dopr_unit(i) = 'K m/s' hom(:,2,60,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'v"pt"' ) dopr_index(i) = 61 dopr_unit(i) = 'K m/s' hom(:,2,61,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'v*pt*' ) dopr_index(i) = 62 dopr_unit(i) = 'K m/s' hom(:,2,62,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'vpt_t' ) dopr_index(i) = 63 dopr_unit(i) = 'K m/s' hom(:,2,63,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'rho' ) dopr_index(i) = 64 dopr_unit(i) = 'kg/m3' hom(:,2,64,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'w"sa"' ) IF ( .NOT. ocean ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for ocean = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 65 dopr_unit(i) = 'psu m/s' hom(:,2,65,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'w*sa*' ) IF ( .NOT. ocean ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for ocean = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 66 dopr_unit(i) = 'psu m/s' hom(:,2,66,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'wsa' ) IF ( .NOT. ocean ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: data_output_pr = ', & data_output_pr(i), & ' is not implemented for ocean = FALSE' ENDIF CALL local_stop ELSE dopr_index(i) = 67 dopr_unit(i) = 'psu m/s' hom(:,2,67,:) = SPREAD( zw, 2, statistic_regions+1 ) ENDIF CASE ( 'w*p*' ) dopr_index(i) = 68 dopr_unit(i) = 'm3/s3' hom(:,2,68,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE ( 'w"e' ) dopr_index(i) = 69 dopr_unit(i) = 'm3/s3' hom(:,2,69,:) = SPREAD( zu, 2, statistic_regions+1 ) CASE DEFAULT CALL user_check_data_output_pr( data_output_pr(i), i, unit ) IF ( unit == 'illegal' ) THEN IF ( myid == 0 ) THEN IF ( data_output_pr_user(1) /= ' ' ) THEN PRINT*, '+++ check_parameters: illegal value for data_',& 'output_pr or data_output_pr_user: "', & TRIM( data_output_pr(i) ), '"' ELSE PRINT*, '+++ check_parameters: illegal value for data_',& 'output_pr: "', TRIM( data_output_pr(i) ),'"' ENDIF ENDIF CALL local_stop ENDIF END SELECT ! !-- Check to which of the predefined coordinate systems the profile belongs DO k = 1, crmax IF ( INDEX( cross_profiles(k), ' '//TRIM( data_output_pr(i) )//' ' ) & /=0 ) & THEN dopr_crossindex(i) = k EXIT ENDIF ENDDO ! !-- Generate the text for the labels of the PROFIL output file. "-characters !-- must be substituted, otherwise PROFIL would interpret them as TeX !-- control characters dopr_label(i) = data_output_pr(i) position = INDEX( dopr_label(i) , '"' ) DO WHILE ( position /= 0 ) dopr_label(i)(position:position) = '''' position = INDEX( dopr_label(i) , '"' ) ENDDO ENDDO ! !-- y-value range of the coordinate system (PROFIL). !-- x-value range determined in plot_1d. IF ( .NOT. ocean ) THEN cross_uymin = 0.0 IF ( z_max_do1d == -1.0 ) THEN cross_uymax = zu(nzt+1) ELSEIF ( z_max_do1d < zu(nzb+1) .OR. z_max_do1d > zu(nzt+1) ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: z_max_do1d=', & z_max_do1d,' must be >= ', zu(nzb+1), & ' or <= ', zu(nzt+1) CALL local_stop ELSE cross_uymax = z_max_do1d ENDIF ENDIF ! !-- Check whether the chosen normalizing factor for the coordinate systems is !-- permissible DO i = 1, crmax SELECT CASE ( TRIM( cross_normalized_x(i) ) ) ! TRIM required on IBM CASE ( '', 'wpt0', 'ws2', 'tsw2', 'ws3', 'ws2tsw', 'wstsw2' ) j = 0 CASE DEFAULT IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: unknown normalize method' PRINT*, ' cross_normalized_x="',cross_normalized_x(i),'"' ENDIF CALL local_stop END SELECT SELECT CASE ( TRIM( cross_normalized_y(i) ) ) ! TRIM required on IBM CASE ( '', 'z_i' ) j = 0 CASE DEFAULT IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: unknown normalize method' PRINT*, ' cross_normalized_y="',cross_normalized_y(i),'"' ENDIF CALL local_stop END SELECT ENDDO ! !-- Check normalized y-value range of the coordinate system (PROFIL) IF ( z_max_do1d_normalized /= -1.0 .AND. z_max_do1d_normalized <= 0.0 ) & THEN IF ( myid == 0 ) PRINT*,'+++ check_parameters: z_max_do1d_normalize', & 'd=', z_max_do1d_normalized, ' must be >= 0.0' CALL local_stop ENDIF ! !-- Append user-defined data output variables to the standard data output IF ( data_output_user(1) /= ' ' ) THEN i = 1 DO WHILE ( data_output(i) /= ' ' .AND. i <= 100 ) i = i + 1 ENDDO j = 1 DO WHILE ( data_output_user(j) /= ' ' .AND. j <= 100 ) IF ( i > 100 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: number of output quantitities', & ' given by data_output and data_output_user' PRINT*, ' exceeds the limit of 100' ENDIF CALL local_stop ENDIF data_output(i) = data_output_user(j) i = i + 1 j = j + 1 ENDDO ENDIF ! !-- Check and set steering parameters for 2d/3d data output and averaging i = 1 DO WHILE ( data_output(i) /= ' ' .AND. i <= 100 ) ! !-- Check for data averaging ilen = LEN_TRIM( data_output(i) ) j = 0 ! no data averaging IF ( ilen > 3 ) THEN IF ( data_output(i)(ilen-2:ilen) == '_av' ) THEN j = 1 ! data averaging data_output(i) = data_output(i)(1:ilen-3) ENDIF ENDIF ! !-- Check for cross section or volume data ilen = LEN_TRIM( data_output(i) ) k = 0 ! 3d data var = data_output(i)(1:ilen) IF ( ilen > 3 ) THEN IF ( data_output(i)(ilen-2:ilen) == '_xy' .OR. & data_output(i)(ilen-2:ilen) == '_xz' .OR. & data_output(i)(ilen-2:ilen) == '_yz' ) THEN k = 1 ! 2d data var = data_output(i)(1:ilen-3) ENDIF ENDIF ! !-- Check for allowed value and set units SELECT CASE ( TRIM( var ) ) CASE ( 'e' ) IF ( constant_diffusion ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires constant_diffusion = .FALSE.' ENDIF CALL local_stop ENDIF unit = 'm2/s2' CASE ( 'pc', 'pr' ) IF ( .NOT. particle_advection ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires a "particles_par"-NAMELIST' PRINT*, ' in the parameter file (PARIN)' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'pc' ) unit = 'number' IF ( TRIM( var ) == 'pr' ) unit = 'm' CASE ( 'q', 'vpt' ) IF ( .NOT. humidity ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires humidity = .TRUE.' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'q' ) unit = 'kg/kg' IF ( TRIM( var ) == 'vpt' ) unit = 'K' CASE ( 'ql' ) IF ( .NOT. ( cloud_physics .OR. cloud_droplets ) ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires cloud_physics = .TRUE.' PRINT*, ' or cloud_droplets = .TRUE.' ENDIF CALL local_stop ENDIF unit = 'kg/kg' CASE ( 'ql_c', 'ql_v', 'ql_vp' ) IF ( .NOT. cloud_droplets ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires cloud_droplets = .TRUE.' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'ql_c' ) unit = 'kg/kg' IF ( TRIM( var ) == 'ql_v' ) unit = 'm3' IF ( TRIM( var ) == 'ql_vp' ) unit = 'none' CASE ( 'qv' ) IF ( .NOT. cloud_physics ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires cloud_physics = .TRUE.' ENDIF CALL local_stop ENDIF unit = 'kg/kg' CASE ( 'rho' ) IF ( .NOT. ocean ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires ocean = .TRUE.' ENDIF CALL local_stop ENDIF unit = 'kg/m3' CASE ( 's' ) IF ( .NOT. passive_scalar ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires passive_scalar = .TRUE.' ENDIF CALL local_stop ENDIF unit = 'conc' CASE ( 'sa' ) IF ( .NOT. ocean ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires ocean = .TRUE.' ENDIF CALL local_stop ENDIF unit = 'psu' CASE ( 'u*', 't*', 'lwp*', 'pra*', 'prr*', 'z0*' ) IF ( k == 0 .OR. data_output(i)(ilen-2:ilen) /= '_xy' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: illegal value for data_',& 'output: "', TRIM( var ), '" is only allowed' PRINT*, ' for horizontal cross section' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'lwp*' .AND. .NOT. cloud_physics ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires cloud_physics = .TRUE.' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'pra*' .AND. .NOT. precipitation ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires precipitation = .TRUE.' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'pra*' .AND. j == 1 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: temporal averaging of ', & ' precipitation amount "', TRIM( var ), & '" not possible' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'prr*' .AND. .NOT. precipitation ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: output of "', TRIM( var ), & '" requires precipitation = .TRUE.' ENDIF CALL local_stop ENDIF IF ( TRIM( var ) == 'u*' ) unit = 'm/s' IF ( TRIM( var ) == 't*' ) unit = 'K' IF ( TRIM( var ) == 'lwp*' ) unit = 'kg/kg*m' IF ( TRIM( var ) == 'pra*' ) unit = 'mm' IF ( TRIM( var ) == 'prr*' ) unit = 'mm/s' IF ( TRIM( var ) == 'z0*' ) unit = 'm' CASE ( 'p', 'pt', 'u', 'v', 'w' ) IF ( TRIM( var ) == 'p' ) unit = 'Pa' IF ( TRIM( var ) == 'pt' ) unit = 'K' IF ( TRIM( var ) == 'u' ) unit = 'm/s' IF ( TRIM( var ) == 'v' ) unit = 'm/s' IF ( TRIM( var ) == 'w' ) unit = 'm/s' CONTINUE CASE DEFAULT CALL user_check_data_output( var, unit ) IF ( unit == 'illegal' ) THEN IF ( myid == 0 ) THEN IF ( data_output_user(1) /= ' ' ) THEN PRINT*, '+++ check_parameters: illegal value for data_',& 'output or data_output_user: "', & TRIM( data_output(i) ), '"' ELSE PRINT*, '+++ check_parameters: illegal value for data_',& 'output: "', TRIM( data_output(i) ), '"' ENDIF ENDIF CALL local_stop ENDIF END SELECT ! !-- Set the internal steering parameters appropriately IF ( k == 0 ) THEN do3d_no(j) = do3d_no(j) + 1 do3d(j,do3d_no(j)) = data_output(i) do3d_unit(j,do3d_no(j)) = unit ELSE do2d_no(j) = do2d_no(j) + 1 do2d(j,do2d_no(j)) = data_output(i) do2d_unit(j,do2d_no(j)) = unit IF ( data_output(i)(ilen-2:ilen) == '_xy' ) THEN data_output_xy(j) = .TRUE. ENDIF IF ( data_output(i)(ilen-2:ilen) == '_xz' ) THEN data_output_xz(j) = .TRUE. ENDIF IF ( data_output(i)(ilen-2:ilen) == '_yz' ) THEN data_output_yz(j) = .TRUE. ENDIF ENDIF IF ( j == 1 ) THEN ! !-- Check, if variable is already subject to averaging found = .FALSE. DO k = 1, doav_n IF ( TRIM( doav(k) ) == TRIM( var ) ) found = .TRUE. ENDDO IF ( .NOT. found ) THEN doav_n = doav_n + 1 doav(doav_n) = var ENDIF ENDIF i = i + 1 ENDDO ! !-- Store sectional planes in one shared array section(:,1) = section_xy section(:,2) = section_xz section(:,3) = section_yz ! !-- Upper plot limit (grid point value) for 1D profiles IF ( z_max_do1d == -1.0 ) THEN nz_do1d = nzt+1 ELSE DO k = nzb+1, nzt+1 nz_do1d = k IF ( zw(k) > z_max_do1d ) EXIT ENDDO ENDIF ! !-- Upper plot limit for 2D vertical sections IF ( z_max_do2d == -1.0 ) z_max_do2d = zu(nzt) IF ( z_max_do2d < zu(nzb+1) .OR. z_max_do2d > zu(nzt) ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: z_max_do2d=', & z_max_do2d, ' must be >= ', zu(nzb+1), & '(zu(nzb+1)) and <= ', zu(nzt), ' (zu(nzt))' CALL local_stop ENDIF ! !-- Upper plot limit for 3D arrays IF ( nz_do3d == -9999 ) nz_do3d = nzt + 1 ! !-- Determine and check accuracy for compressed 3D plot output IF ( do3d_compress ) THEN ! !-- Compression only permissible on T3E machines IF ( host(1:3) /= 't3e' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: do3d_compress = .TRUE. not allow', & 'ed on host "', TRIM( host ), '"' ENDIF CALL local_stop ENDIF i = 1 DO WHILE ( do3d_comp_prec(i) /= ' ' ) ilen = LEN_TRIM( do3d_comp_prec(i) ) IF ( LLT( do3d_comp_prec(i)(ilen:ilen), '0' ) .OR. & LGT( do3d_comp_prec(i)(ilen:ilen), '9' ) ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: illegal precision: ', & 'do3d_comp_prec(', i, ')="', TRIM(do3d_comp_prec(i)),'"' ENDIF CALL local_stop ENDIF prec = IACHAR( do3d_comp_prec(i)(ilen:ilen) ) - IACHAR( '0' ) var = do3d_comp_prec(i)(1:ilen-1) SELECT CASE ( var ) CASE ( 'u' ) j = 1 CASE ( 'v' ) j = 2 CASE ( 'w' ) j = 3 CASE ( 'p' ) j = 4 CASE ( 'pt' ) j = 5 CASE DEFAULT IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: unknown variable in ', & 'assignment' PRINT*, ' do3d_comp_prec(', i, ')="', & TRIM( do3d_comp_prec(i) ),'"' ENDIF CALL local_stop END SELECT plot_3d_precision(j)%precision = prec i = i + 1 ENDDO ENDIF ! !-- Check the data output format(s) IF ( data_output_format(1) == ' ' ) THEN ! !-- Default value netcdf_output = .TRUE. ELSE i = 1 DO WHILE ( data_output_format(i) /= ' ' ) SELECT CASE ( data_output_format(i) ) CASE ( 'netcdf' ) netcdf_output = .TRUE. CASE ( 'iso2d' ) iso2d_output = .TRUE. CASE ( 'profil' ) profil_output = .TRUE. CASE ( 'avs' ) avs_output = .TRUE. CASE DEFAULT IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown value for data_output_format "', & TRIM( data_output_format(i) ),'"' ENDIF CALL local_stop END SELECT i = i + 1 IF ( i > 10 ) EXIT ENDDO ENDIF ! !-- Check netcdf precison ldum = .FALSE. CALL define_netcdf_header( 'ch', ldum, 0 ) ! !-- Check, whether a constant diffusion coefficient shall be used IF ( km_constant /= -1.0 ) THEN IF ( km_constant < 0.0 ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: km_constant=', & km_constant, ' < 0.0' CALL local_stop ELSE IF ( prandtl_number < 0.0 ) THEN IF ( myid == 0 ) PRINT*,'+++ check_parameters: prandtl_number=',& prandtl_number, ' < 0.0' CALL local_stop ENDIF constant_diffusion = .TRUE. IF ( prandtl_layer ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: prandtl_layer ',& 'is not allowed with fixed value of km' CALL local_stop ENDIF ENDIF ENDIF ! !-- In case of non-cyclic lateral boundaries, set the default maximum value !-- for the horizontal diffusivity used within the outflow damping layer, !-- and check/set the width of the damping layer IF ( bc_lr /= 'cyclic' ) THEN IF ( km_damp_max == -1.0 ) THEN km_damp_max = 0.5 * dx ENDIF IF ( outflow_damping_width == -1.0 ) THEN outflow_damping_width = MIN( 20, nx/2 ) ENDIF IF ( outflow_damping_width <= 0 .OR. outflow_damping_width > nx ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: outflow_damping w',& 'idth out of range' CALL local_stop ENDIF ENDIF IF ( bc_ns /= 'cyclic' ) THEN IF ( km_damp_max == -1.0 ) THEN km_damp_max = 0.5 * dy ENDIF IF ( outflow_damping_width == -1.0 ) THEN outflow_damping_width = MIN( 20, ny/2 ) ENDIF IF ( outflow_damping_width <= 0 .OR. outflow_damping_width > ny ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: outflow_damping w',& 'idth out of range' CALL local_stop ENDIF ENDIF ! !-- Check value range for rif IF ( rif_min >= rif_max ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: rif_min=', rif_min, & ' must be less than rif_max=', rif_max CALL local_stop ENDIF ! !-- Determine upper and lower hight level indices for random perturbations IF ( disturbance_level_b == -9999999.9 ) THEN IF ( ocean ) THEN disturbance_level_b = zu((nzt*2)/3) disturbance_level_ind_b = ( nzt * 2 ) / 3 ELSE disturbance_level_b = zu(nzb+3) disturbance_level_ind_b = nzb + 3 ENDIF ELSEIF ( disturbance_level_b < zu(3) ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: disturbance_level_b=',& disturbance_level_b, ' must be >= ',zu(3), & '(zu(3))' CALL local_stop ELSEIF ( disturbance_level_b > zu(nzt-2) ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: disturbance_level_b=',& disturbance_level_b, ' must be <= ',zu(nzt-2),& '(zu(nzt-2))' CALL local_stop ELSE DO k = 3, nzt-2 IF ( disturbance_level_b <= zu(k) ) THEN disturbance_level_ind_b = k EXIT ENDIF ENDDO ENDIF IF ( disturbance_level_t == -9999999.9 ) THEN IF ( ocean ) THEN disturbance_level_t = zu(nzt-3) disturbance_level_ind_t = nzt - 3 ELSE disturbance_level_t = zu(nzt/3) disturbance_level_ind_t = nzt / 3 ENDIF ELSEIF ( disturbance_level_t > zu(nzt-2) ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: disturbance_level_t=',& disturbance_level_t, ' must be <= ',zu(nzt-2),& '(zu(nzt-2))' CALL local_stop ELSEIF ( disturbance_level_t < disturbance_level_b ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: disturbance_level_t=',& disturbance_level_t, ' must be >= ', & 'disturbance_level_b=', disturbance_level_b CALL local_stop ELSE DO k = 3, nzt-2 IF ( disturbance_level_t <= zu(k) ) THEN disturbance_level_ind_t = k EXIT ENDIF ENDDO ENDIF ! !-- Check again whether the levels determined this way are ok. !-- Error may occur at automatic determination and too few grid points in !-- z-direction. IF ( disturbance_level_ind_t < disturbance_level_ind_b ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: ', & 'disturbance_level_ind_t=', & disturbance_level_ind_t, ' must be >= ', & 'disturbance_level_ind_b=', & disturbance_level_ind_b CALL local_stop ENDIF ! !-- Determine the horizontal index range for random perturbations. !-- In case of non-cyclic horizontal boundaries, no perturbations are imposed !-- near the inflow and the perturbation area is further limited to ...(1) !-- after the initial phase of the flow. dist_nxl = 0; dist_nxr = nx dist_nys = 0; dist_nyn = ny IF ( bc_lr /= 'cyclic' ) THEN IF ( inflow_disturbance_begin == -1 ) THEN inflow_disturbance_begin = MIN( 10, nx/2 ) ENDIF IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > nx )& THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: inflow_disturbance',& '_begin out of range' CALL local_stop ENDIF IF ( inflow_disturbance_end == -1 ) THEN inflow_disturbance_end = MIN( 100, 3*nx/4 ) ENDIF IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > nx ) & THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: inflow_disturbance',& '_end out of range' CALL local_stop ENDIF ELSEIF ( bc_ns /= 'cyclic' ) THEN IF ( inflow_disturbance_begin == -1 ) THEN inflow_disturbance_begin = MIN( 10, ny/2 ) ENDIF IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > ny )& THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: inflow_disturbance',& '_begin out of range' CALL local_stop ENDIF IF ( inflow_disturbance_end == -1 ) THEN inflow_disturbance_end = MIN( 100, 3*ny/4 ) ENDIF IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > ny ) & THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: inflow_disturbance',& '_end out of range' CALL local_stop ENDIF ENDIF IF ( bc_lr == 'radiation/dirichlet' ) THEN dist_nxr = nx - inflow_disturbance_begin dist_nxl(1) = nx - inflow_disturbance_end ELSEIF ( bc_lr == 'dirichlet/radiation' ) THEN dist_nxl = inflow_disturbance_begin dist_nxr(1) = inflow_disturbance_end ENDIF IF ( bc_ns == 'dirichlet/radiation' ) THEN dist_nyn = ny - inflow_disturbance_begin dist_nys(1) = ny - inflow_disturbance_end ELSEIF ( bc_ns == 'radiation/dirichlet' ) THEN dist_nys = inflow_disturbance_begin dist_nyn(1) = inflow_disturbance_end ENDIF ! !-- Check random generator IF ( random_generator /= 'system-specific' .AND. & random_generator /= 'numerical-recipes' ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters:' PRINT*, ' unknown random generator: random_generator=', & random_generator ENDIF CALL local_stop ENDIF ! !-- Determine damping level index for 1D model IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN IF ( damp_level_1d == -1.0 ) THEN damp_level_1d = zu(nzt+1) damp_level_ind_1d = nzt + 1 ELSEIF ( damp_level_1d < 0.0 .OR. damp_level_1d > zu(nzt+1) ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: damp_level_1d=', & damp_level_1d, ' must be > 0.0 and < ', & 'zu(nzt+1)', zu(nzt+1) CALL local_stop ELSE DO k = 1, nzt+1 IF ( damp_level_1d <= zu(k) ) THEN damp_level_ind_1d = k EXIT ENDIF ENDDO ENDIF ENDIF ! !-- Check some other 1d-model parameters IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model' .AND. & TRIM( mixing_length_1d ) /= 'blackadar' ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: mixing_length_1d = "', & TRIM( mixing_length_1d ), '" is unknown' CALL local_stop ENDIF IF ( TRIM( dissipation_1d ) /= 'as_in_3d_model' .AND. & TRIM( dissipation_1d ) /= 'detering' ) THEN IF ( myid == 0 ) PRINT*, '+++ check_parameters: dissipation_1d = "', & TRIM( dissipation_1d ), '" is unknown' CALL local_stop ENDIF ! !-- Set time for the next user defined restart (time_restart is the !-- internal parameter for steering restart events) IF ( restart_time /= 9999999.9 ) THEN IF ( restart_time > simulated_time ) time_restart = restart_time ELSE ! !-- In case of a restart run, set internal parameter to default (no restart) !-- if the NAMELIST-parameter restart_time is omitted time_restart = 9999999.9 ENDIF ! !-- Set default value of the time needed to terminate a model run IF ( termination_time_needed == -1.0 ) THEN IF ( host(1:3) == 'ibm' ) THEN termination_time_needed = 300.0 ELSE termination_time_needed = 35.0 ENDIF ENDIF ! !-- Check the time needed to terminate a model run IF ( host(1:3) == 't3e' ) THEN ! !-- Time needed must be at least 30 seconds on all CRAY machines, because !-- MPP_TREMAIN gives the remaining CPU time only in steps of 30 seconds IF ( termination_time_needed <= 30.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ check_parameters: termination_time_needed', & termination_time_needed PRINT*, ' must be > 30.0 on host "', host, & '"' ENDIF CALL local_stop ENDIF ELSEIF ( host(1:3) == 'ibm' ) THEN ! !-- On IBM-regatta machines the time should be at least 300 seconds, !-- because the job time consumed before executing palm (for compiling, !-- copying of files, etc.) has to be regarded IF ( termination_time_needed < 300.0 ) THEN IF ( myid == 0 ) THEN PRINT*, '+++ WARNING: check_parameters: termination_time_', & 'needed', termination_time_needed PRINT*, ' should be >= 300.0', & ' on host "', host, '"' ENDIF ENDIF ENDIF END SUBROUTINE check_parameters