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