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