source: palm/trunk/SOURCE/parin.f90 @ 4343

Last change on this file since 4343 was 4301, checked in by oliver.maas, 4 years ago

Deleted parameter recycling_yshift. y-shift in case of non-cyclic boundary conditions and turbulent_inflow = .TRUE. is now steered by parameter y_shift, that is also used in case of cyclic boundary conditions.

  • Property svn:keywords set to Id
File size: 35.1 KB
RevLine 
[1682]1!> @file parin.f90
[2000]2!------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]4!
[2000]5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
[1036]9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
[3649]17! Copyright 1997-2019 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[257]20! Current revisions:
[1484]21! -----------------
[2233]22!
[3747]23!
[2233]24! Former revisions:
25! -----------------
26! $Id: parin.f90 4301 2019-11-22 12:09:09Z oliver.maas $
[4301]27! removed recycling_yshift
28!
29! 4227 2019-09-10 18:04:34Z gronemeier
[4227]30! implement new palm_date_time_mod
31!
32! 4146 2019-08-07 07:47:36Z gronemeier
[4196]33! added rotation_angle to initialization_parameters
34!
35! 4191 2019-08-27 15:45:07Z gronemeier
[4191]36! bugfix: add recycling_method_for_thermodynamic_quantities to inipar namelist
37!
38! 4183 2019-08-23 07:33:16Z oliver.maas
[4183]39! replaced recycle_absolute_quantities by recycling_method_for_thermodynamic_quantities
40!
41! 4182 2019-08-22 15:20:23Z scharf
[4182]42! Corrected "Former revisions" section
43!
44! 4176 2019-08-20 14:10:41Z oliver.maas
[4176]45! added recycle_absolute_quantities to initialization_parameters namelist
46!
47! 4173 2019-08-20 12:04:06Z gronemeier
[4173]48! add vdi_internal_controls
49!
50! 4131 2019-08-02 11:06:18Z monakurppa
[4131]51! Allocate hom and hom_sum to allow profile output for salsa variables.
52!
53! 4079 2019-07-09 18:04:41Z suehring
[4079]54! +monotonic_limiter_z
55!
56! 4022 2019-06-12 11:52:39Z suehring
[4022]57! Change default top boundary condition for pressure to Neumann in offline
58! nesting case
59!
60! 4017 2019-06-06 12:16:46Z schwenkel
[3987]61! Introduce alternative switch for debug output during timestepping
62!
63! 3885 2019-04-11 11:29:34Z kanani
[3885]64! Changes related to global restructuring of location messages and introduction
65! of additional debug messages
66!
67! 3806 2019-03-21 12:45:50Z raasch
[3806]68! additional check for lateral boundary conditions added
69!
70! 3747 2019-02-16 15:15:23Z gronemeier
[3747]71! removed setting of parameter region
72!
73! 3746 2019-02-16 12:41:27Z gronemeier
[3668]74! Removed most_method
75!
76! 3649 2019-01-02 16:52:21Z suehring
[3649]77! Delete debug-print statements
[3569]78!
[4182]79! Revision 1.1  1997/07/24 11:22:50  raasch
80! Initial revision
81!
82!
[1]83! Description:
84! ------------
[1682]85!> This subroutine reads variables controling the run from the NAMELIST files
[3298]86!>
87!> @todo: Revise max_pr_cs (profiles for chemistry)
[1]88!------------------------------------------------------------------------------!
[1682]89 SUBROUTINE parin
90 
[1]91
[1320]92    USE arrays_3d,                                                             &
[3274]93        ONLY:  pt_init, q_init, ref_state, s_init, sa_init,                    &
[2696]94               ug, u_init, v_init, vg
[1320]95
[2696]96    USE chem_modules
[1320]97
[1762]98    USE control_parameters
[1320]99
100    USE cpulog,                                                                &
101        ONLY:  cpu_log_barrierwait
102
103    USE grid_variables,                                                        &
104        ONLY:  dx, dy
105
106    USE indices,                                                               &
107        ONLY:  nx, ny, nz
108
[1764]109    USE kinds
110
[2338]111    USE model_1d_mod,                                                          &
[1320]112        ONLY:  damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
113
[3637]114    USE module_interface,                                                      &
115        ONLY:  module_interface_parin
[3159]116
[1783]117    USE netcdf_interface,                                                      &
118        ONLY:  netcdf_data_format, netcdf_deflate, netcdf_precision
119
[2696]120    USE pegrid
[3448]121
[1764]122    USE pmc_interface,                                                         &
[1933]123        ONLY:  nested_run, nesting_mode
[1764]124
[1320]125    USE profil_parameter,                                                      &
[2298]126        ONLY:  cross_profiles, profile_columns, profile_rows
[1320]127
[1402]128    USE progress_bar,                                                          &
[3313]129        ONLY :  progress_bar_disabled
[1402]130
[2894]131    USE read_restart_data_mod,                                                 &
[3637]132        ONLY:  rrd_global
[2894]133
[1320]134    USE statistics,                                                            &
[3746]135        ONLY:  hom, hom_sum, pr_palm, statistic_regions
[1320]136
[3083]137    USE turbulence_closure_mod,                                                &
138        ONLY:  rans_const_c, rans_const_sigma
139
[2365]140    USE vertical_nesting_mod,                                                  &
141        ONLY:  vnest_start_time
[1914]142
[2696]143
[1]144    IMPLICIT NONE
145
[2849]146    CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file
147
[2600]148    INTEGER(iwp) ::  global_id      !< process id with respect to MPI_COMM_WORLD
149    INTEGER(iwp) ::  global_procs   !< # of procs with respect to MPI_COMM_WORLD
150    INTEGER(iwp) ::  i              !<
151    INTEGER(iwp) ::  ioerr          !< error flag for open/read/write
[1]152
[3274]153    NAMELIST /inipar/  alpha_surface, approximation, bc_e_b,     &
[2375]154                       bc_lr, bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b, &
[3294]155             bc_q_t,bc_s_b, bc_s_t, bc_uv_b, bc_uv_t,                 &
156             building_height, building_length_x,          &
[1429]157             building_length_y, building_wall_left, building_wall_south,       &
[2881]158             calc_soil_moisture_during_spinup,                                 &
[3274]159             call_psolver_at_all_substeps,  &
[1484]160             canyon_height,                                                    &
[1429]161             canyon_width_x, canyon_width_y, canyon_wall_left,                 &
[3274]162             canyon_wall_south, cfl_factor, cloud_droplets,   &
163             collective_wait, complex_terrain,           &
[2550]164             conserve_volume_flow,                                             &
[1691]165             conserve_volume_flow_mode, constant_flux_layer,                   &
[3274]166             coupling_start_time,             &
[1831]167             cycle_mg, damp_level_1d,                                          &
[2296]168             data_output_during_spinup,                                        &
[4227]169             origin_date_time,                                                 &
[1429]170             dissipation_1d,                                                   &
[3274]171             dp_external, dp_level_b, dp_smooth, dpdxy,    &
[2296]172             dt, dt_pr_1d, dt_run_control_1d, dt_spinup, dx, dy, dz, dz_max,   &
[3065]173             dz_stretch_factor, dz_stretch_level, dz_stretch_level_start,      &
174             dz_stretch_level_end, end_time_1d, ensemble_member_nr, e_init,    &
[3182]175             e_min, fft_method, flux_input_mode, flux_output_mode,             &
[2037]176             galilei_transformation, humidity,                                 &
[1429]177             inflow_damping_height, inflow_damping_width,                      &
178             inflow_disturbance_begin, inflow_disturbance_end,                 &
[1484]179             initializing_actions, km_constant,                                &
[2575]180             large_scale_forcing, large_scale_subsidence, latitude,            &
[3274]181             longitude,                                 &
[2011]182             loop_optimization, lsf_exception, masking_method, mg_cycles,      &
[1429]183             mg_switch_to_pe0_level, mixing_length_1d, momentum_advec,         &
[4079]184             monotonic_limiter_z,                                              &
[3182]185             netcdf_precision, neutral, ngsrb,                                 &
[3294]186             nsor, nsor_ini, nudging, nx, ny, nz, ocean_mode, omega,           &
187             omega_sor, outflow_source_plane, passive_scalar,                  &
[3274]188             prandtl_number, psolver, pt_damping_factor,        &
[1429]189             pt_damping_width, pt_reference, pt_surface,                       &
190             pt_surface_initial_change, pt_vertical_gradient,                  &
191             pt_vertical_gradient_level, q_surface, q_surface_initial_change,  &
192             q_vertical_gradient, q_vertical_gradient_level,                   &
[3083]193             random_generator, random_heatflux, rans_const_c, rans_const_sigma,&
[1560]194             rayleigh_damping_factor, rayleigh_damping_height,                 &
[4301]195             recycling_method_for_thermodynamic_quantities, recycling_width,   &
[1429]196             reference_state, residual_limit,                                  &
[4196]197             rotation_angle,                                                   &
[3294]198             roughness_length,                                                 &
199             scalar_advec,   &
[3274]200             scalar_rayleigh_damping,                              &
[2296]201             spinup_time, spinup_pt_amplitude, spinup_pt_mean,                 &
[1429]202             statistic_regions, subs_vertical_gradient,                        &
[785]203             subs_vertical_gradient_level, surface_heatflux, surface_pressure, &
[1429]204             surface_scalarflux, surface_waterflux,                            &
205             s_surface, s_surface_initial_change, s_vertical_gradient,         &
[4227]206             s_vertical_gradient_level, timestep_scheme,                       &
[1429]207             topography, topography_grid_convention, top_heatflux,             &
[3294]208             top_momentumflux_u, top_momentumflux_v,                           &
[2232]209             top_scalarflux, transpose_compute_overlap,                        &
210             tunnel_height, tunnel_length, tunnel_width_x, tunnel_width_y,     &
[2696]211             tunnel_wall_depth, turbulence_closure,                            &
[2232]212             turbulent_inflow, turbulent_outflow,                              &
[1429]213             use_subsidence_tendencies, ug_surface, ug_vertical_gradient,      &
[3157]214             use_free_convection_scaling,                                      &
[1429]215             ug_vertical_gradient_level, use_surface_fluxes, use_cmax,         &
216             use_top_fluxes, use_ug_for_galilei_tr, use_upstream_for_tke,      &
[4173]217             uv_heights, u_bulk, u_profile, vdi_checks, vg_surface,            &
218             vg_vertical_gradient,  &
[3274]219             vg_vertical_gradient_level, v_bulk, v_profile,&
[1429]220             wall_adjustment, wall_heatflux, wall_humidityflux,                &
[3294]221             wall_scalarflux, y_shift, zeta_max, zeta_min,  &
[2372]222             z0h_factor
[2932]223
[3294]224    NAMELIST /initialization_parameters/  alpha_surface,                       &
[2932]225             approximation, bc_e_b,                                            &
226             bc_lr, bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b,           &
[3294]227             bc_q_t,bc_s_b, bc_s_t, bc_uv_b, bc_uv_t,                          &
228             building_height, building_length_x,                               &
[2932]229             building_length_y, building_wall_left, building_wall_south,       &
230             calc_soil_moisture_during_spinup,                                 &
[3294]231             call_psolver_at_all_substeps,                                     &
[2932]232             canyon_height,                                                    &
233             canyon_width_x, canyon_width_y, canyon_wall_left,                 &
[3294]234             canyon_wall_south, cfl_factor, cloud_droplets,                    &
235             collective_wait, complex_terrain,                                 &
[2932]236             conserve_volume_flow,                                             &
237             conserve_volume_flow_mode, constant_flux_layer,                   &
[3294]238             coupling_start_time,                                              &
[2932]239             cycle_mg, damp_level_1d,                                          &
240             data_output_during_spinup,                                        &
[4227]241             origin_date_time,                                                 &
[2932]242             dissipation_1d,                                                   &
[3294]243             dp_external, dp_level_b, dp_smooth, dpdxy,                        &
[2932]244             dt, dt_pr_1d, dt_run_control_1d, dt_spinup, dx, dy, dz, dz_max,   &
[3065]245             dz_stretch_factor, dz_stretch_level, dz_stretch_level_start,      &
246             dz_stretch_level_end, end_time_1d, ensemble_member_nr, e_init,    &
[3182]247             e_min, fft_method, flux_input_mode, flux_output_mode,             &
[2932]248             galilei_transformation, humidity,                                 &
249             inflow_damping_height, inflow_damping_width,                      &
250             inflow_disturbance_begin, inflow_disturbance_end,                 &
251             initializing_actions, km_constant,                                &
252             large_scale_forcing, large_scale_subsidence, latitude,            &
[3294]253             longitude,                                                        &
[2932]254             loop_optimization, lsf_exception, masking_method, mg_cycles,      &
255             mg_switch_to_pe0_level, mixing_length_1d, momentum_advec,         &
[4079]256             monotonic_limiter_z,                                              &
[3182]257             netcdf_precision, neutral, ngsrb,                                 &
[3294]258             nsor, nsor_ini, nudging, nx, ny, nz, ocean_mode, omega,           &
259             omega_sor, outflow_source_plane, passive_scalar,                  &
260             prandtl_number, psolver, pt_damping_factor,                       &
[2932]261             pt_damping_width, pt_reference, pt_surface,                       &
262             pt_surface_initial_change, pt_vertical_gradient,                  &
263             pt_vertical_gradient_level, q_surface, q_surface_initial_change,  &
264             q_vertical_gradient, q_vertical_gradient_level,                   &
[3083]265             random_generator, random_heatflux, rans_const_c, rans_const_sigma,&
[2932]266             rayleigh_damping_factor, rayleigh_damping_height,                 &
[4301]267             recycling_method_for_thermodynamic_quantities, recycling_width,   &
[2932]268             reference_state, residual_limit,                                  &
[4196]269             rotation_angle,                                                   &
[3294]270             roughness_length, scalar_advec,                                   &
271             scalar_rayleigh_damping,                                          &
[2932]272             spinup_time, spinup_pt_amplitude, spinup_pt_mean,                 &
273             statistic_regions, subs_vertical_gradient,                        &
274             subs_vertical_gradient_level, surface_heatflux, surface_pressure, &
275             surface_scalarflux, surface_waterflux,                            &
276             s_surface, s_surface_initial_change, s_vertical_gradient,         &
[4227]277             s_vertical_gradient_level, timestep_scheme,                       &
[2932]278             topography, topography_grid_convention, top_heatflux,             &
[3294]279             top_momentumflux_u, top_momentumflux_v,                           &
[2932]280             top_scalarflux, transpose_compute_overlap,                        &
281             tunnel_height, tunnel_length, tunnel_width_x, tunnel_width_y,     &
282             tunnel_wall_depth, turbulence_closure,                            &
283             turbulent_inflow, turbulent_outflow,                              &
284             use_subsidence_tendencies, ug_surface, ug_vertical_gradient,      &
285             ug_vertical_gradient_level, use_surface_fluxes, use_cmax,         &
286             use_top_fluxes, use_ug_for_galilei_tr, use_upstream_for_tke,      &
[3157]287             use_free_convection_scaling,                                      &
[4173]288             uv_heights, u_bulk, u_profile, vdi_checks,                        &
289             vg_surface, vg_vertical_gradient,  &
[3294]290             vg_vertical_gradient_level, v_bulk, v_profile,                    &
[2932]291             wall_adjustment, wall_heatflux, wall_humidityflux,                &
[3294]292             wall_scalarflux, y_shift, zeta_max, zeta_min, z0h_factor
[2932]293             
[1429]294    NAMELIST /d3par/  averaging_interval, averaging_interval_pr,               &
295             cpu_log_barrierwait, create_disturbances,                         &
[2298]296             cross_profiles, data_output, data_output_masks,                   &
[3885]297             data_output_pr, data_output_2d_on_each_pe,                        &
298             debug_output,                                                     &
[3987]299             debug_output_timestep,                                            &
[3885]300             disturbance_amplitude,                                            &
[1429]301             disturbance_energy_limit, disturbance_level_b,                    &
[1327]302             disturbance_level_t, do2d_at_begin, do3d_at_begin,                &
[1429]303             dt, dt_averaging_input, dt_averaging_input_pr,                    &
304             dt_coupling, dt_data_output, dt_data_output_av, dt_disturb,       &
305             dt_domask, dt_dopr, dt_dopr_listing, dt_dots, dt_do2d_xy,         &
306             dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_max, dt_restart,              &
[3435]307             dt_run_control,end_time, force_print_header, mask_k_over_surface, &
[3448]308             mask_scale_x,                                                     &
[1429]309             mask_scale_y, mask_scale_z, mask_x, mask_y, mask_z, mask_x_loop,  &
[1783]310             mask_y_loop, mask_z_loop, netcdf_data_format, netcdf_deflate,     &
311             normalizing_region, npex, npey, nz_do3d,                          &
[3274]312             profile_columns, profile_rows,     &
[1783]313             restart_time, section_xy, section_xz, section_yz,                 &
314             skip_time_data_output, skip_time_data_output_av, skip_time_dopr,  &
315             skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz,          &
316             skip_time_do3d, skip_time_domask, synchronous_exchange,           &
[3045]317             termination_time_needed, vnest_start_time
[1]318
[2932]319    NAMELIST /runtime_parameters/  averaging_interval, averaging_interval_pr,  &
320             cpu_log_barrierwait, create_disturbances,                         &
321             cross_profiles, data_output, data_output_masks,                   &
[3885]322             data_output_pr, data_output_2d_on_each_pe,                        &
323             debug_output,                                                     &
[3987]324             debug_output_timestep,                                            &
[3885]325             disturbance_amplitude,                                            &
[2932]326             disturbance_energy_limit, disturbance_level_b,                    &
327             disturbance_level_t, do2d_at_begin, do3d_at_begin,                &
328             dt, dt_averaging_input, dt_averaging_input_pr,                    &
329             dt_coupling, dt_data_output, dt_data_output_av, dt_disturb,       &
330             dt_domask, dt_dopr, dt_dopr_listing, dt_dots, dt_do2d_xy,         &
331             dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_max, dt_restart,              &
[3435]332             dt_run_control,end_time, force_print_header, mask_k_over_surface, &
[3448]333             mask_scale_x,                                                     &
[2932]334             mask_scale_y, mask_scale_z, mask_x, mask_y, mask_z, mask_x_loop,  &
335             mask_y_loop, mask_z_loop, netcdf_data_format, netcdf_deflate,     &
336             normalizing_region, npex, npey, nz_do3d,                          &
[3274]337             profile_columns, profile_rows,     &
[2932]338             restart_time, section_xy, section_xz, section_yz,                 &
339             skip_time_data_output, skip_time_data_output_av, skip_time_dopr,  &
340             skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz,          &
341             skip_time_do3d, skip_time_domask, synchronous_exchange,           &
[3045]342             termination_time_needed, vnest_start_time
[1]343
[4017]344    NAMELIST /envpar/  progress_bar_disabled, host,                            &
[1429]345                       maximum_cpu_time_allowed, maximum_parallel_io_streams,  &
[2906]346                       read_svf, revision, run_identifier, tasks_per_node,     &
347                       write_binary, write_svf
[1]348
349!
[759]350!-- First read values of environment variables (this NAMELIST file is
[3045]351!-- generated by palmrun)
[3885]352    CALL location_message( 'reading environment parameters from ENVPAR', 'start' )
[2310]353
354    OPEN ( 90, FILE='ENVPAR', STATUS='OLD', FORM='FORMATTED', IOSTAT=ioerr )
355
356    IF ( ioerr /= 0 )  THEN
357       message_string = 'local file ENVPAR not found' //                       &
[3046]358                        '&some variables for steering may not be properly set'
[2310]359       CALL message( 'parin', 'PA0276', 0, 1, 0, 6, 0 )
360    ELSE
361       READ ( 90, envpar, IOSTAT=ioerr )
362       IF ( ioerr < 0 )  THEN
363          message_string = 'no envpar-NAMELIST found in local file '  //       &
[3046]364                           'ENVPAR& or some variables for steering may '  //   &
[2310]365                           'not be properly set'
366          CALL message( 'parin', 'PA0278', 0, 1, 0, 6, 0 )
367       ELSEIF ( ioerr > 0 )  THEN
368          message_string = 'errors in local file ENVPAR' //                    &
[3046]369                           '&some variables for steering may not be properly set'
[2310]370          CALL message( 'parin', 'PA0277', 0, 1, 0, 6, 0 )
371       ENDIF
372       CLOSE ( 90 )
373    ENDIF
374
[3885]375    CALL location_message( 'reading environment parameters from ENVPAR', 'finished' )
[1]376!
[759]377!-- Calculate the number of groups into which parallel I/O is split.
378!-- The default for files which are opened by all PEs (or where each
379!-- PE opens his own independent file) is, that all PEs are doing input/output
380!-- in parallel at the same time. This might cause performance or even more
381!-- severe problems depending on the configuration of the underlying file
382!-- system.
[2600]383!-- Calculation of the number of blocks and the I/O group must be based on all
384!-- PEs involved in this run. Since myid and numprocs are related to the
385!-- comm2d communicator, which gives only a subset of all PEs in case of
386!-- nested runs, that information must be inquired again from the global
387!-- communicator.
[759]388!-- First, set the default:
[2967]389#if defined( __parallel )
[2600]390    CALL MPI_COMM_RANK( MPI_COMM_WORLD, global_id, ierr )
391    CALL MPI_COMM_SIZE( MPI_COMM_WORLD, global_procs, ierr )
[2967]392#else
393    global_id    = 0
394    global_procs = 1
395#endif
[1429]396    IF ( maximum_parallel_io_streams == -1  .OR.                               &
[2600]397         maximum_parallel_io_streams > global_procs )  THEN
398       maximum_parallel_io_streams = global_procs
[759]399    ENDIF
400!
401!-- Now calculate the number of io_blocks and the io_group to which the
402!-- respective PE belongs. I/O of the groups is done in serial, but in parallel
403!-- for all PEs belonging to the same group.
[2600]404    io_blocks = global_procs / maximum_parallel_io_streams
405    io_group  = MOD( global_id+1, io_blocks )
[2599]406   
[3885]407    CALL location_message( 'reading NAMELIST parameters from PARIN', 'start' )
[759]408!
409!-- Data is read in parallel by groups of PEs
410    DO  i = 0, io_blocks-1
411       IF ( i == io_group )  THEN
[559]412
[1]413!
[759]414!--       Open the NAMELIST-file which is send with this job
415          CALL check_open( 11 )
[559]416
[1]417!
[759]418!--       Read the control parameters for initialization.
[996]419!--       The namelist "inipar" must be provided in the NAMELIST-file.
[2932]420          READ ( 11, initialization_parameters, ERR=10, END=11 )
[3246]421          GOTO 14
422         
423 10       BACKSPACE( 11 )
[3248]424          READ( 11 , '(A)') line
425          CALL parin_fail_message( 'initialization_parameters', line )
[807]426
[2932]427 11       REWIND ( 11 )
[3246]428          READ ( 11, inipar, ERR=12, END=13 )
[2932]429 
[3046]430          message_string = 'namelist inipar is deprecated and will be ' //    &
431                          'removed in near future. & Please use namelist ' // &
432                          'initialization_parameters instead'
[3045]433          CALL message( 'parin', 'PA0017', 0, 1, 0, 6, 0 )
[2932]434 
[3246]435          GOTO 14
[2932]436 
[3246]437 12       BACKSPACE( 11 )
[3248]438          READ( 11 , '(A)') line
439          CALL parin_fail_message( 'inipar', line )
[3246]440
441 13       message_string = 'no initialization_parameters-namelist found'
[759]442          CALL message( 'parin', 'PA0272', 1, 2, 0, 6, 0 )
443
[146]444!
[2894]445!--       Try to read runtime parameters given by the user for this run
[2932]446!--       (namelist "runtime_parameters"). The namelist "runtime_parmeters"   
447!--       can be omitted. In that case default values are used for the         
448!--       parameters.
[3246]449 14       line = ' '
[2894]450
451          REWIND ( 11 )
452          line = ' '
[3248]453          DO WHILE ( INDEX( line, '&runtime_parameters' ) == 0 )
[3246]454             READ ( 11, '(A)', END=16 )  line
[2894]455          ENDDO
456          BACKSPACE ( 11 )
457
458!
459!--       Read namelist
[3246]460          READ ( 11, runtime_parameters, ERR = 15 )
461          GOTO 18
[2932]462
[3246]463 15       BACKSPACE( 11 )
[3248]464          READ( 11 , '(A)') line
465          CALL parin_fail_message( 'runtime_parameters', line )
[3246]466
467 16       REWIND ( 11 )
[2932]468          line = ' '
[3248]469          DO WHILE ( INDEX( line, '&d3par' ) == 0 )
[3246]470             READ ( 11, '(A)', END=18 )  line
[2932]471          ENDDO
472          BACKSPACE ( 11 )
[3246]473
474!
[2932]475!--       Read namelist
[3246]476          READ ( 11, d3par, ERR = 17, END = 18 )
477
[2932]478          message_string = 'namelist d3par is deprecated and will be ' //      &
[3046]479                          'removed in near future. &Please use namelist ' //   &
[2932]480                          'runtime_parameters instead'
481          CALL message( 'parin', 'PA0487', 0, 1, 0, 6, 0 )
[2894]482
[3246]483          GOTO 18
484
485 17       BACKSPACE( 11 )
[3248]486          READ( 11 , '(A)') line
487          CALL parin_fail_message( 'd3par', line )
[3246]488
489 18       CONTINUE
490
[2894]491!
[3294]492!--       Check for module namelists and read them
[3637]493          CALL module_interface_parin
[2894]494
495!
[759]496!--       If required, read control parameters from restart file (produced by
497!--       a prior run). All PEs are reading from file created by PE0 (see
498!--       check_open)
[2894]499          IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
[87]500
[2894]501             CALL rrd_global
[1]502!
[759]503!--          Increment the run count
504             runnr = runnr + 1
[3240]505!
506!--          In case of a restart run, the number of user-defined profiles on
507!--          the restart file (already stored in max_pr_user) has to match the
508!--          one given for the current run. max_pr_user_tmp is calculated in
509!--          user_parin and max_pr_user is read in via rrd_global.
510             IF ( max_pr_user /= max_pr_user_tmp )  THEN
511                WRITE( message_string, * ) 'the number of user-defined ',      &
512                      'profiles given in data_output_pr (', max_pr_user_tmp,   &
513                      ') does not match the one ',                             &
514                      'found in the restart file (', max_pr_user, ')'
515                CALL message( 'user_parin', 'UI0009', 1, 2, 0, 6, 0 )
516             ENDIF
517          ELSE
518             max_pr_user = max_pr_user_tmp
[759]519          ENDIF
[87]520!
[2921]521!--       Activate spinup
522          IF ( land_surface .OR. urban_surface )  THEN
523             IF ( spinup_time > 0.0_wp )  THEN
524                coupling_start_time = spinup_time
[2995]525                time_since_reference_point = simulated_time - coupling_start_time
[2921]526                IF ( spinup_pt_mean == 9999999.9_wp )  THEN
527                   spinup_pt_mean = pt_surface
528                ENDIF
529                end_time = end_time + spinup_time
[3646]530                IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
[2941]531                   spinup = .TRUE.
[3646]532                ELSEIF (        TRIM( initializing_actions ) == 'read_restart_data'      &
533                         .AND.  time_since_reference_point > 0.0_wp )  THEN
534                   data_output_during_spinup = .FALSE.  !< required for correct ntdim calculation
535                                                        !< in check_parameters for restart run
536                ENDIF
[2921]537             ENDIF
538          ENDIF
539
540!
[1933]541!--       In case of nested runs, explicitly set nesting boundary conditions.
[2826]542!--       This will overwrite the user settings and basic defaults.
543!--       bc_lr and bc_ns always need to be cyclic for vertical nesting.
544          IF ( nested_run )  THEN
545             IF ( nesting_mode == 'vertical' )  THEN
546                IF (bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' )  THEN
547                   WRITE ( message_string, *) 'bc_lr and bc_ns were set to ,', &
548                        'cyclic for vertical nesting'
549                   CALL message( 'parin', 'PA0428', 0, 0, 0, 6, 0 )
550                   bc_lr   = 'cyclic'
551                   bc_ns   = 'cyclic'
552                ENDIF
[3182]553                IF ( child_domain )  THEN
[2826]554                   bc_uv_t  = 'nested'
555                   bc_pt_t  = 'nested'
556                   bc_q_t   = 'nested'
557                   bc_s_t   = 'nested'
558                   bc_cs_t  = 'nested'
559                   bc_p_t   = 'neumann' 
560                ENDIF
[1933]561!
[2826]562!--          For other nesting modes only set boundary conditions for
563!--          nested domains.
564             ELSE
[3182]565                IF ( child_domain )  THEN
[2826]566                   bc_lr    = 'nested'
567                   bc_ns    = 'nested'
568                   bc_uv_t  = 'nested'
569                   bc_pt_t  = 'nested'
570                   bc_q_t   = 'nested'
571                   bc_s_t   = 'nested'
572                   bc_cs_t  = 'nested'
573                   bc_p_t   = 'neumann'
574                ENDIF
[1933]575             ENDIF
[1764]576          ENDIF
[3182]577!
578!--       Set boundary conditions also in case the model is offline-nested in
579!--       larger-scale models.
580          IF ( nesting_offline )  THEN
581             bc_lr    = 'nesting_offline'
582             bc_ns    = 'nesting_offline'
583             bc_uv_t  = 'nesting_offline'
584             bc_pt_t  = 'nesting_offline'
585             bc_q_t   = 'nesting_offline'
[4022]586           !  bc_s_t   = 'nesting_offline'  ! scalar boundary condition is not clear yet
[3184]587           !  bc_cs_t  = 'nesting_offline'  ! same for chemical species
[4022]588             bc_p_t   = 'neumann'
[2696]589          ENDIF
590
[1955]591!         
592!--       In case of nested runs, make sure that initializing_actions =
593!--       'set_constant_profiles' even though the constant-profiles
594!--       initializations for the prognostic variables will be overwritten
595!--       by pmci_child_initialize and pmci_parent_initialize. This is,
596!--       however, important e.g. to make sure that diagnostic variables
[2397]597!--       are set properly. An exception is made in case of restart runs and
598!--       if user decides to do everything by its own.
[3182]599          IF ( child_domain  .AND.  .NOT. (                                    &
[2980]600               TRIM( initializing_actions ) == 'read_restart_data'      .OR.   &
601               TRIM( initializing_actions ) == 'set_constant_profiles'  .OR.   &
[2938]602               TRIM( initializing_actions ) == 'by_user' ) )  THEN
[2975]603             message_string = 'initializing_actions = ' //                     &
604                              TRIM( initializing_actions ) // ' has been ' //  &
605                              'changed to set_constant_profiles in child ' //  &
606                              'domain.' 
607             CALL message( 'parin', 'PA0492', 0, 0, 0, 6, 0 )
608
[1955]609             initializing_actions = 'set_constant_profiles'
[3182]610          ENDIF           
[1764]611!
612!--       Check validity of lateral boundary conditions. This has to be done
613!--       here because they are already used in init_pegrid and init_grid and
614!--       therefore cannot be check in check_parameters
615          IF ( bc_lr /= 'cyclic'  .AND.  bc_lr /= 'dirichlet/radiation'  .AND. &
[2696]616               bc_lr /= 'radiation/dirichlet'  .AND.  bc_lr /= 'nested'  .AND. &
[3182]617               bc_lr /= 'nesting_offline' )  THEN
[1764]618             message_string = 'unknown boundary condition: bc_lr = "' // &
619                              TRIM( bc_lr ) // '"'
[2975]620             CALL message( 'parin', 'PA0049', 1, 2, 0, 6, 0 )
[1764]621          ENDIF
622          IF ( bc_ns /= 'cyclic'  .AND.  bc_ns /= 'dirichlet/radiation'  .AND. &
[2696]623               bc_ns /= 'radiation/dirichlet'  .AND.  bc_ns /= 'nested'  .AND. &
[3182]624               bc_ns /= 'nesting_offline' )  THEN
[1764]625             message_string = 'unknown boundary condition: bc_ns = "' // &
626                              TRIM( bc_ns ) // '"'
[2975]627             CALL message( 'parin', 'PA0050', 1, 2, 0, 6, 0 )
[1764]628          ENDIF
629!
630!--       Set internal variables used for speed optimization in if clauses
631          IF ( bc_lr /= 'cyclic' )               bc_lr_cyc    = .FALSE.
632          IF ( bc_lr == 'dirichlet/radiation' )  bc_lr_dirrad = .TRUE.
633          IF ( bc_lr == 'radiation/dirichlet' )  bc_lr_raddir = .TRUE.
634          IF ( bc_ns /= 'cyclic' )               bc_ns_cyc    = .FALSE.
635          IF ( bc_ns == 'dirichlet/radiation' )  bc_ns_dirrad = .TRUE.
636          IF ( bc_ns == 'radiation/dirichlet' )  bc_ns_raddir = .TRUE.
637!
[3806]638!--       Radiation-Dirichlet conditions are allowed along one of the horizontal directions only.
639!--       In general, such conditions along x and y may work, but require a) some code changes
640!--       (e.g. concerning allocation of c_u, c_v ... arrays), and b) a careful model setup by the
641!--       user, in order to guarantee that there is a clearly defined outflow at two sides.
642!--       Otherwise, the radiation condition may produce wrong results.
643          IF ( ( bc_lr_dirrad .OR. bc_lr_raddir )  .AND.  ( bc_ns_dirrad .OR. bc_ns_raddir ) )  THEN
644             message_string = 'bc_lr = "' // TRIM( bc_lr ) // '" and bc_ns = "' //                 &
645                              TRIM( bc_ns ) // '" are not allowed to be set at the same time'
646             CALL message( 'parin', 'PA0589', 1, 2, 0, 6, 0 )
647          ENDIF
648!
[759]649!--       Check in case of initial run, if the grid point numbers are well
650!--       defined and allocate some arrays which are already needed in
651!--       init_pegrid or check_parameters. During restart jobs, these arrays
[2894]652!--       will be allocated in rrd_global. All other arrays are allocated
[759]653!--       in init_3d_model.
654          IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
[667]655
[759]656             IF ( nx <= 0 )  THEN
[1429]657                WRITE( message_string, * ) 'no value or wrong value given',    &
[759]658                                           ' for nx: nx=', nx
659                CALL message( 'parin', 'PA0273', 1, 2, 0, 6, 0 )
660             ENDIF
661             IF ( ny <= 0 )  THEN
[1429]662                WRITE( message_string, * ) 'no value or wrong value given',    &
[759]663                                           ' for ny: ny=', ny
664                CALL message( 'parin', 'PA0274', 1, 2, 0, 6, 0 )
665             ENDIF
666             IF ( nz <= 0 )  THEN
[1429]667                WRITE( message_string, * ) 'no value or wrong value given',    &
[759]668                                           ' for nz: nz=', nz
669                CALL message( 'parin', 'PA0275', 1, 2, 0, 6, 0 )
670             ENDIF
[3204]671
[759]672!
[3204]673!--          As a side condition, routine flow_statistics require at least 14
674!--          vertical grid levels (they are used to store time-series data)
675!>           @todo   Remove this restriction
676             IF ( nz < 14 )  THEN
677                WRITE( message_string, * ) 'nz >= 14 is required'
678                CALL message( 'parin', 'PA0362', 1, 2, 0, 6, 0 )
679             ENDIF
680
681!
[759]682!--          ATTENTION: in case of changes to the following statement please
[2894]683!--                  also check the allocate statement in routine rrd_global
[1960]684             ALLOCATE( pt_init(0:nz+1), q_init(0:nz+1), s_init(0:nz+1),        &
[1429]685                       ref_state(0:nz+1), sa_init(0:nz+1), ug(0:nz+1),         &
686                       u_init(0:nz+1), v_init(0:nz+1), vg(0:nz+1),             &
[4131]687                    hom(0:nz+1,2,pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0:statistic_regions),  &
688                    hom_sum(0:nz+1,pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0:statistic_regions) )
[1]689
[1353]690             hom = 0.0_wp
[1]691
[759]692          ENDIF
693
[1]694!
[759]695!--       NAMELIST-file is not needed anymore
696          CALL close_file( 11 )
[1]697
[759]698       ENDIF
[1804]699#if defined( __parallel )
[759]700       CALL MPI_BARRIER( MPI_COMM_WORLD, ierr )
701#endif
702    ENDDO
703
[3885]704    CALL location_message( 'reading NAMELIST parameters from PARIN', 'finished' )
[1384]705
[1]706 END SUBROUTINE parin
Note: See TracBrowser for help on using the repository browser.