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

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

added new surface temperature forcing method for bc_pt_b = 'dirichlet': surface temperature pt(0) can be linearly increased by pt_surface_heating_rate (in K/h)

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