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