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