MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_global_parameters.fpp.f90
Go to the documentation of this file.
1# 1 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
2!>
3!! @file
4!! @brief Contains module m_global_parameters
5
6# 1 "/home/runner/work/MFC/MFC/src/common/include/case.fpp" 1
7! This file exists so that Fypp can be run without generating case.fpp files for
8! each target. This is useful when generating documentation, for example. This
9! should also let MFC be built with CMake directly, without invoking mfc.sh.
10
11! For pre-process.
12# 8 "/home/runner/work/MFC/MFC/src/common/include/case.fpp"
13
14! For moving immersed boundaries in simulation
15# 12 "/home/runner/work/MFC/MFC/src/common/include/case.fpp"
16# 6 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp" 2
17
18!> @brief Global parameters for the post-process: domain geometry, equation of state, and output database settings
20
21#ifdef MFC_MPI
22 use mpi !< message passing interface (mpi) module
23#endif
24
27 use m_thermochem, only: species_names
29 ! Shared state: generated_decls, num_dims, num_vels, sys_size, eqn_idx, chemistry, shear_*
31
32 implicit none
33
34 !> @name Logistics
35 !> @{
36 integer :: num_procs !< Number of processors
37 !> @}
38
39 ! Computational Domain Parameters
40
41 integer :: proc_rank !< Rank of the local processor
42 !> @name Number of cells in the x-, y- and z-coordinate directions
43 !> @{
44 integer :: m_root
45 !> @}
46
47 !> @name Max and min number of cells in a direction of each combination of x-,y-, and z-
49 integer(kind=8) :: nglobal !< Total number of cells in global domain
50
51 !> @name Cylindrical coordinates (either axisymmetric or full 3D)
52 !> @{
53 integer :: grid_geometry
54 !> @}
55
56 !> @name Global number of cells in each direction
57 !> @{
58 integer :: m_glb, n_glb, p_glb
59 !> @}
60
61 ! num_dims, num_vels: in m_global_parameters_common
62 !> @name Cell-boundary locations in the x-, y- and z-coordinate directions
63 !> @{
64 real(wp), allocatable, dimension(:) :: x_cb, x_root_cb, y_cb, z_cb
65 ! Single-precision copies, handed to Silo when precision == precision_single.
66 ! Silo stores the mesh coordinates with their own datatype, independent of the
67 ! flow variables, so the mesh needs its own single-precision arrays to follow
68 ! the requested precision.
69 real(sp), allocatable, dimension(:) :: x_cb_s, y_cb_s, z_cb_s
70 !> @}
71
72 !> @name Cell-center locations in the x-, y- and z-coordinate directions
73 !> @{
74 real(wp), allocatable, dimension(:) :: x_cc, x_root_cc, y_cc, z_cc
75 real(sp), allocatable, dimension(:) :: x_root_cc_s, x_cc_s
76 !> @}
77
78 !> Cell-width distributions in the x-, y- and z-coordinate directions
79 !> @{
80 real(wp), allocatable, dimension(:) :: dx, dy, dz
81 !> @}
82
83 integer :: buff_size !< Number of ghost cells for boundary condition storage
84 !> @name IO options for adaptive time-stepping
85 !> @{
86 logical :: cfl_dt
87 integer :: n_save
88 !> @}
89
90 ! NOTE: m_root, x_root_cb, x_root_cc = defragmented grid (1D only; equals m, x_cb, x_cc in serial)
91
92 !> @name Simulation Algorithm Parameters
93 !> @{
94 ! sys_size, chemistry, eqn_idx: in m_global_parameters_common
95 !> @}
96
97 !> @name Annotations of the structure, i.e. the organization, of the state vectors
98 !> @{
99 type(qbmm_idx_info) :: qbmm_idx !< QBMM moment index mappings.
100 integer :: beta_idx !< Index of lagrange bubbles beta
101 !> @}
102
103 ! Cell Indices for the (local) interior points (O-m, O-n, 0-p). Stands for "InDices With BUFFer".
105
106 ! Cell indices (InDices With BUFFer): includes buffer in simulation only
108 logical :: bc_io
109 !> @name Boundary conditions in the x-, y- and z-coordinate directions
110 !> @{
112 type(int_bounds_info) :: ib_bc_x, ib_bc_y, ib_bc_z !< bc_x/y/z before decomposition overwrites them with MPI neighbor ranks
114 !> @}
115
116 ! shear_num, shear_indices, shear_BC_flip_num, shear_BC_flip_indices: in m_global_parameters_common
117 ! proc_coords, start_idx, mpiiofs, mpi_info_int: in m_global_parameters_common
118 type(int_bounds_info), dimension(3) :: nidx !< Neighbor index offsets per direction (#1290 decomposition)
119 integer, allocatable, dimension(:,:,:) :: neighbor_ranks !< MPI ranks of neighbors (#1290 decomposition)
120 type(ib_airfoil_parameters), allocatable, dimension(:) :: ib_airfoil !< Per-airfoil NACA parameters (unused in post_process)
121 !> Per-airfoil computed surface grids (unused in post_process)
122 type(ib_airfoil_grid), allocatable, dimension(:) :: ib_airfoil_grids
123
124#ifdef MFC_MPI
125 type(mpi_io_var), public :: mpi_io_data
129 real(wp), allocatable, dimension(:,:), public :: mpi_io_data_lg_bubbles
130#endif
131
132 ! fluid_pp, bub_pp: auto-generated in generated_decls.fpp
133 real(wp), allocatable, dimension(:) :: adv !< Advection variables
134 ! Formatted Database File(s) Structure Parameters
135
136 type(bounds_info) :: x_output, y_output, z_output !< Portion of domain to output for post-processing
137 type(int_bounds_info) :: x_output_idx, y_output_idx, z_output_idx !< Indices of domain to output for post-processing
138 !> @name Size of the ghost zone layer in the x-, y- and z-coordinate directions. The definition of the ghost zone layers is only
139 !! necessary when using the Silo database file format in multidimensions. These zones provide VisIt with the subdomain
140 !! connectivity information that it requires in order to produce smooth plots.
141 !> @{
143 !> @}
144
145 ! alpha_rho_wrt, mom_wrt, vel_wrt, flux_wrt, alpha_rho_e_wrt, alpha_wrt,
146 ! omega_wrt, chem_wrt_Y, schlieren_alpha: auto-generated in generated_decls.fpp
147 integer :: fd_number !< Finite-difference half-stencil size: MAX(1, fd_order/2)
149 !> @name Bubble modeling variables and parameters
150 !> @{
151 real(wp) :: eu
152 real(wp), dimension(:), allocatable :: weight, r0
153 real(wp) :: phi_vg, phi_gv, pe_c, tw, k_vl, k_gl
154 real(wp) :: gam_m
155 real(wp), dimension(:), allocatable :: pb0, mass_g0, mass_v0, pe_t, k_v, k_g
156 real(wp), dimension(:), allocatable :: re_trans_t, re_trans_c, im_trans_t, im_trans_c, omegan
158 real(wp) :: g
159 integer :: nmom
160 !> @}
161
162 real(wp) :: wall_time, wall_time_avg !< Wall time measurements
163
164contains
165
166 !> Assigns default values to user inputs prior to reading them in. This allows for an easier consistency check of these
167 !! parameters once they are read from the input file.
169
170 integer :: i !< Generic loop iterator
171
172 ! Shared defaults (case_dir, m/n/p, cyl_coord, cfl flags, model_eqns, BC blocks,
173 ! recon/weno/muscl/num_fluids/igr/mhd/relativity under case-opt guard, Tait EOS, bubble flags,
174 ! IB flags, parallel I/O flags, fft_wrt)
175
177
178 ! Boundary conditions (bc_x/y/z are per-target declarations, not visible in common)
179 bc_x%beg = dflt_int; bc_x%end = dflt_int
180 bc_y%beg = dflt_int; bc_y%end = dflt_int
181 bc_z%beg = dflt_int; bc_z%end = dflt_int
182
183# 173 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
184# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
185 bc_x%vb1 = 0._wp
186# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
187 bc_x%ve1 = 0._wp
188# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
189# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
190 bc_x%vb2 = 0._wp
191# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
192 bc_x%ve2 = 0._wp
193# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
194# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
195 bc_x%vb3 = 0._wp
196# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
197 bc_x%ve3 = 0._wp
198# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
199# 177 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
200# 173 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
201# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
202 bc_y%vb1 = 0._wp
203# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
204 bc_y%ve1 = 0._wp
205# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
206# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
207 bc_y%vb2 = 0._wp
208# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
209 bc_y%ve2 = 0._wp
210# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
211# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
212 bc_y%vb3 = 0._wp
213# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
214 bc_y%ve3 = 0._wp
215# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
216# 177 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
217# 173 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
218# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
219 bc_z%vb1 = 0._wp
220# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
221 bc_z%ve1 = 0._wp
222# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
223# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
224 bc_z%vb2 = 0._wp
225# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
226 bc_z%ve2 = 0._wp
227# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
228# 174 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
229 bc_z%vb3 = 0._wp
230# 175 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
231 bc_z%ve3 = 0._wp
232# 176 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
233# 177 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
234# 178 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
235
236# 180 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
237 bc_x%isothermal_in = .false.
238# 181 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
239 bc_x%isothermal_out = .false.
240# 182 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
241 bc_x%Twall_in = dflt_real
242# 183 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
243 bc_x%Twall_out = dflt_real
244# 184 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
245# 180 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
246 bc_y%isothermal_in = .false.
247# 181 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
248 bc_y%isothermal_out = .false.
249# 182 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
250 bc_y%Twall_in = dflt_real
251# 183 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
252 bc_y%Twall_out = dflt_real
253# 184 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
254# 180 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
255 bc_z%isothermal_in = .false.
256# 181 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
257 bc_z%isothermal_out = .false.
258# 182 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
259 bc_z%Twall_in = dflt_real
260# 183 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
261 bc_z%Twall_out = dflt_real
262# 184 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
263# 185 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
264
266
267 ! Computational domain parameters (post-specific)
269
272
273 cfl_dt = .false.
277
278 bc_io = .false.
280
281 chem_params%gamma_method = 1
282 chem_params%transport_model = 1
283
284 chem_params%reaction_substeps = 0
285 chem_params%adap_substeps = .false.
286 chem_params%reaction_substeps_max = 0
287
288 ! Fluids physical parameters (post-specific; G = dflt_real differs from pre/sim)
289 do i = 1, num_fluids_max
291 fluid_pp(i)%mg_rho0 = dflt_real
292 fluid_pp(i)%mg_c0 = dflt_real
293 fluid_pp(i)%mg_s = dflt_real
294 fluid_pp(i)%mg_gruneisen = dflt_real
295 fluid_pp(i)%mg_gruneisen_a = 0._wp
296 fluid_pp(i)%mg_t0 = 0._wp
297 fluid_pp(i)%mg_s2 = 0._wp
298 fluid_pp(i)%mg_s3 = 0._wp
299 fluid_pp(i)%jwl_a = dflt_real
300 fluid_pp(i)%jwl_b = dflt_real
301 fluid_pp(i)%jwl_r1 = dflt_real
302 fluid_pp(i)%jwl_r2 = dflt_real
303 fluid_pp(i)%jwl_omega = dflt_real
304 fluid_pp(i)%jwl_rho0 = dflt_real
305 fluid_pp(i)%jwl_t0 = 0._wp
306 fluid_pp(i)%vinet_k0 = dflt_real
307 fluid_pp(i)%vinet_k0p = dflt_real
308 fluid_pp(i)%vinet_rho0 = dflt_real
309 fluid_pp(i)%vinet_gruneisen = dflt_real
310 fluid_pp(i)%vinet_gruneisen_a = 0._wp
311 fluid_pp(i)%vinet_t0 = 0._wp
312 fluid_pp(i)%gamma = dflt_real
313 fluid_pp(i)%pi_inf = dflt_real
314 fluid_pp(i)%cv = 0._wp
315 fluid_pp(i)%qv = 0._wp
316 fluid_pp(i)%qvp = 0._wp
317 fluid_pp(i)%k_therm = 0._wp
318 fluid_pp(i)%G = dflt_real
319 fluid_pp(i)%non_newtonian = .false.
320 fluid_pp(i)%K = dflt_real
321 fluid_pp(i)%nn = dflt_real
322 fluid_pp(i)%tau0 = 0._wp
323 fluid_pp(i)%hb_m = dflt_real
324 fluid_pp(i)%mu_min = dflt_real
325 fluid_pp(i)%mu_max = dflt_real
326 fluid_pp(i)%mu_bulk = dflt_real
327 end do
328
331 particle_cloud(i)%x_centroid = 0._wp
332 particle_cloud(i)%y_centroid = 0._wp
333 particle_cloud(i)%z_centroid = 0._wp
334 particle_cloud(i)%length_x = dflt_real
335 particle_cloud(i)%length_y = dflt_real
336 particle_cloud(i)%length_z = dflt_real
337 particle_cloud(i)%num_particles = 0
338 particle_cloud(i)%radius = dflt_real
339 particle_cloud(i)%mass = dflt_real
340 particle_cloud(i)%min_spacing = 0._wp
341 particle_cloud(i)%moving_ibm = 0
342 particle_cloud(i)%seed = 0
343 particle_cloud(i)%packing_method = dflt_int
344 end do
345
346 ! Subgrid bubble parameters (bub_pp struct + scalar companions; bub_pp%R0ref is set in common
347 ! via R0ref; the scalar companions are per-target manual declarations)
350 bub_pp%rho0ref = dflt_real; rho0ref = dflt_real
362 bub_pp%k_v = dflt_real
363 bub_pp%k_g = dflt_real
368
369 ! Formatted database file(s) structure parameters (post-specific)
370 format = dflt_int
371
373
374 alpha_rho_wrt = .false.
375 alpha_rho_e_wrt = .false.
376 rho_wrt = .false.
377 mom_wrt = .false.
378 vel_wrt = .false.
379 chem_wrt_y = .false.
380 chem_wrt_t = .false.
382 flux_wrt = .false.
383 e_wrt = .false.
384 pres_wrt = .false.
385 alpha_wrt = .false.
386 gamma_wrt = .false.
387 heat_ratio_wrt = .false.
388 pi_inf_wrt = .false.
389 pres_inf_wrt = .false.
390 prim_vars_wrt = .false.
391 cons_vars_wrt = .false.
392 c_wrt = .false.
393 t_wrt = .false.
394 omega_wrt = .false.
395 qm_wrt = .false.
396 liutex_wrt = .false.
397 schlieren_wrt = .false.
398 sim_data = .false.
399 cf_wrt = .false.
400 ib_state_wrt = .false.
401 lag_txt_wrt = .false.
402 lag_header = .true.
403 lag_db_wrt = .false.
404 lag_id_wrt = .true.
405 lag_pos_wrt = .true.
406 lag_pos_prev_wrt = .false.
407 lag_vel_wrt = .true.
408 lag_rad_wrt = .true.
409 lag_rvel_wrt = .false.
410 lag_r0_wrt = .false.
411 lag_rmax_wrt = .false.
412 lag_rmin_wrt = .false.
413 lag_dphidt_wrt = .false.
414 lag_pres_wrt = .false.
415 lag_mv_wrt = .false.
416 lag_mg_wrt = .false.
417 lag_betat_wrt = .false.
418 lag_betac_wrt = .false.
419
421
423
424 ! Bubble modeling (post-specific)
425 nb = dflt_int
426
427 ! Output partial domain (post-specific)
428 output_partial_domain = .false.
429 x_output%beg = dflt_real
430 x_output%end = dflt_real
431 y_output%beg = dflt_real
432 y_output%end = dflt_real
433 z_output%beg = dflt_real
434 z_output%end = dflt_real
435
437
438 !> Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the module
440
441 integer :: i, j, fac
442
443 ! Setting m_root equal to m in the case of a 1D serial simulation
444
445 if (n == 0) m_root = m_glb
446
447 ! Declared for the common conversion kernel but not a post_process input, so it is neither
448 ! defaulted on non-root ranks nor broadcast. Post-process never carries viscous stresses.
449 viscous = .false.
450
451 ! Particle clouds expand into individual IB patches at simulation startup, so num_ibs as read
452 ! from the case file counts only the namelist patches. Match the global count the simulation
453 ! arrives at (s_read_ib_restart_data) so the IB state records can be read back.
454 do i = 1, num_particle_clouds
455 num_ibs = num_ibs + particle_cloud(i)%num_particles
456 end do
457
458 ! Gamma/Pi_inf: force num_fluids=1 (post_process-specific side effect of the gamma-law model)
460
461 ! post_process sets nmom to 6 for qbmm before the shared eqn_idx setup
462 ! (guard matches the original site: inside the 5-equation branch)
463 if (model_eqns == model_eqns_5eq .and. qbmm) nmom = 6
464
465 ! Populate eqn_idx, sys_size, shear_* (shared logic)
466 call s_initialize_eqn_idx(nmom, nb, six_eqn_alf_is_advected=.false.)
467
468 ! post-only: 6eq alf is a dummy (no void fraction in 6eq)
469 if (model_eqns == model_eqns_6eq) eqn_idx%alf = 1
470
471 ! post-only: set default indices for disabled fields (used by post-processing consumers)
473 if (.not. cont_damage) eqn_idx%damage = dflt_int
474 if (.not. hyper_cleaning) eqn_idx%psi = dflt_int
475 end if
476
477 ! post-only: species defaults when chemistry is off
478 if (.not. chemistry) then
479 eqn_idx%species%beg = 1
480 eqn_idx%species%end = 1
481 end if
482
483 ! Per-target (post_process): beta_idx for bubbles_lagrange (5eq only, after main eqn_idx setup)
485 beta_idx = sys_size + 1
487 end if
488
489 ! Per-target (post_process): qbmm_idx allocations and fills
490 if (model_eqns == model_eqns_5eq .and. bubbles_euler) then
491 allocate (qbmm_idx%rs(nb), qbmm_idx%vs(nb))
492 allocate (qbmm_idx%ps(nb), qbmm_idx%ms(nb))
493
494 if (qbmm) then
495 allocate (qbmm_idx%moms(nb, nmom))
496 do i = 1, nb
497 do j = 1, nmom
498 qbmm_idx%moms(i, j) = eqn_idx%bub%beg + (j - 1) + (i - 1)*nmom
499 end do
500 qbmm_idx%rs(i) = qbmm_idx%moms(i, 2)
501 qbmm_idx%vs(i) = qbmm_idx%moms(i, 3)
502 end do
503 else
504 do i = 1, nb
505 if (polytropic .neqv. .true.) then
506 fac = 4
507 else
508 fac = 2
509 end if
510
511 qbmm_idx%rs(i) = eqn_idx%bub%beg + (i - 1)*fac
512 qbmm_idx%vs(i) = qbmm_idx%rs(i) + 1
513
514 if (polytropic .neqv. .true.) then
515 qbmm_idx%ps(i) = qbmm_idx%vs(i) + 1
516 qbmm_idx%ms(i) = qbmm_idx%ps(i) + 1
517 end if
518 end do
519 end if
520 end if
521
522 if (output_partial_domain) then
523 x_output_idx%beg = 0
524 x_output_idx%end = 0
525 y_output_idx%beg = 0
526 y_output_idx%end = 0
527 z_output_idx%beg = 0
528 z_output_idx%end = 0
529 end if
530
531#ifdef MFC_MPI
532 if (qbmm .and. .not. polytropic) then
533 allocate (mpi_io_data%view(1:sys_size + 2*nb*nnode))
534 allocate (mpi_io_data%var(1:sys_size + 2*nb*nnode))
535 else
536 allocate (mpi_io_data%view(1:sys_size))
537 allocate (mpi_io_data%var(1:sys_size))
538 end if
539
540 do i = 1, sys_size
541 if (down_sample) then
542 allocate (mpi_io_data%var(i)%sf(-1:m + 1,-1:n + 1,-1:p + 1))
543 else
544 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
545 end if
546 mpi_io_data%var(i)%sf => null()
547 end do
548 if (qbmm .and. .not. polytropic) then
549 do i = sys_size + 1, sys_size + 2*nb*nnode
550 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
551 mpi_io_data%var(i)%sf => null()
552 end do
553 end if
554
555 if (ib) allocate (mpi_io_ib_data%var%sf(0:m,0:n,0:p))
556#endif
557
558 ! Size of the ghost zone layer is non-zero only when post-processing the raw simulation data of a parallel multidimensional
559 ! computation in the Silo-HDF5 format. If this is the case, one must also verify whether the raw simulation data is 2D or
560 ! 3D. In the 2D case, size of the z-coordinate direction ghost zone layer must be zeroed out.
561 if (num_procs == 1 .or. format /= format_silo) then
562 offset_x%beg = 0
563 offset_x%end = 0
564 offset_y%beg = 0
565 offset_y%end = 0
566 offset_z%beg = 0
567 offset_z%end = 0
568 else if (n == 0) then
569 offset_y%beg = 0
570 offset_y%end = 0
571 offset_z%beg = 0
572 offset_z%end = 0
573 else if (p == 0) then
574 offset_z%beg = 0
575 offset_z%end = 0
576 end if
577
578 ! Determining the finite-difference number and the buffer size. Note that the size of the buffer is unrelated to the order
579 ! of the WENO scheme. Rather, it is directly dependent on maximum size of ghost zone layers and possibly the order of the
580 ! finite difference scheme used for the computation of vorticity and/or numerical Schlieren function.
581 buff_size = max(offset_x%beg, offset_x%end, offset_y%beg, offset_y%end, offset_z%beg, offset_z%end)
582
583 if (any(omega_wrt) .or. schlieren_wrt .or. qm_wrt .or. liutex_wrt) then
584 fd_number = max(1, fd_order/2)
586 end if
587
588 ! Configuring Coordinate Direction Indexes
589 idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
590 idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
591
592 idwbuff(1)%beg = -buff_size
593 if (num_dims > 1) then; idwbuff(2)%beg = -buff_size; else; idwbuff(2)%beg = 0; end if
594 if (num_dims > 2) then; idwbuff(3)%beg = -buff_size; else; idwbuff(3)%beg = 0; end if
595
596 idwbuff(1)%end = idwint(1)%end - idwbuff(1)%beg
597 idwbuff(2)%end = idwint(2)%end - idwbuff(2)%beg
598 idwbuff(3)%end = idwint(3)%end - idwbuff(3)%beg
599
600 ! Allocating single precision grid variables if needed
601 allocate (x_cc_s(-buff_size:m + buff_size))
602
603 ! Allocating the grid variables in the x-coordinate direction
604 allocate (x_cb(-1 - offset_x%beg:m + offset_x%end))
605 allocate (x_cc(-buff_size:m + buff_size))
606 allocate (dx(-buff_size:m + buff_size))
607
608 if (precision == precision_single) then
609 allocate (x_cb_s(-1 - offset_x%beg:m + offset_x%end))
610 end if
611
612 ! Allocating grid variables in the y- and z-coordinate directions
613 if (n > 0) then
614 allocate (y_cb(-1 - offset_y%beg:n + offset_y%end))
615 allocate (y_cc(-buff_size:n + buff_size))
616 allocate (dy(-buff_size:n + buff_size))
617
618 if (precision == precision_single) then
619 allocate (y_cb_s(-1 - offset_y%beg:n + offset_y%end))
620 end if
621
622 if (p > 0) then
623 allocate (z_cb(-1 - offset_z%beg:p + offset_z%end))
624 allocate (z_cc(-buff_size:p + buff_size))
625 allocate (dz(-buff_size:p + buff_size))
626
627 if (precision == precision_single) then
628 allocate (z_cb_s(-1 - offset_z%beg:p + offset_z%end))
629 end if
630 end if
631
632 ! Allocating the grid variables, only used for the 1D simulations, and containing the defragmented computational domain
633 ! grid data
634 else
635 allocate (x_root_cb(-1:m_root))
636 allocate (x_root_cc(0:m_root))
637
638 if (precision == precision_single) then
639 allocate (x_root_cc_s(0:m_root))
640 end if
641 end if
642
643 allocate (adv(num_fluids))
644
645 if (cyl_coord .neqv. .true.) then ! Cartesian grid
646 grid_geometry = 1
647 else if (cyl_coord .and. p == 0) then ! Axisymmetric cylindrical grid
648 grid_geometry = 2
649 else ! Fully 3D cylindrical grid
650 grid_geometry = 3
651 end if
652
654
655 !> Subroutine to initialize parallel infrastructure
660 end subroutine s_initialize_parallel_io
661
662 !> Deallocation procedures for the module
664
665 integer :: i
666
667 if (bubbles_euler) then
668 deallocate (qbmm_idx%rs, qbmm_idx%vs, qbmm_idx%ps, qbmm_idx%ms)
669 if (qbmm) deallocate (qbmm_idx%moms)
670 end if
671
672 ! Deallocating the grid variables for the x-coordinate direction
673 deallocate (x_cc, x_cb, dx)
674 if (allocated(x_cb_s)) deallocate (x_cb_s)
675
676 ! Deallocating grid variables for the y- and z-coordinate directions
677 if (n > 0) then
678 deallocate (y_cc, y_cb, dy)
679 if (allocated(y_cb_s)) deallocate (y_cb_s)
680 if (p > 0) then
681 deallocate (z_cc, z_cb, dz)
682 if (allocated(z_cb_s)) deallocate (z_cb_s)
683 end if
684 else
685 ! Deallocating the grid variables, only used for the 1D simulations, and containing the defragmented computational
686 ! domain grid data
687 deallocate (x_root_cb, x_root_cc)
688 end if
689
690 ! Shared: deallocate proc_coords and start_idx
692
693 deallocate (adv)
694
695#ifdef MFC_MPI
696 if (parallel_io) then
697 do i = 1, sys_size
698 mpi_io_data%var(i)%sf => null()
699 end do
700
701 deallocate (mpi_io_data%var)
702 deallocate (mpi_io_data%view)
703 end if
704
705 if (ib) mpi_io_ib_data%var%sf => null()
706#endif
707
708 if (allocated(neighbor_ranks)) deallocate (neighbor_ranks)
709
711
712end module m_global_parameters
integer, intent(in) j
Compile-time constant parameters: default values, tolerances, and physical constants.
integer, parameter model_eqns_5eq
integer, parameter format_silo
integer, parameter dflt_int
Default integer value.
integer, parameter num_particle_clouds_max
Maximum number of particle bed patch specifications.
real(wp), parameter dflt_real
Default real value.
integer, parameter num_fluids_max
Maximum number of fluids in the simulation.
integer, parameter nnode
Number of QBMM nodes.
integer, parameter precision_single
integer, parameter eos_stiffened_gas
integer, parameter model_eqns_6eq
integer, parameter model_eqns_gamma_law
Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures.
Shared global parameters and equation-index setup for all three executables. Each per-target m_global...
impure subroutine s_finalize_global_parameters_common
Shared finalize core: deallocate proc_coords and start_idx. Per-target finalize routines call this fi...
type(subgrid_bubble_physical_parameters) bub_pp
Subgrid bubble physical parameters.
integer sys_size
Number of unknowns in system of equations.
logical, dimension(num_fluids_max) alpha_rho_e_wrt
logical, dimension(num_species) chem_wrt_y
real(wp), dimension(num_fluids_max) schlieren_alpha
logical, dimension(num_fluids_max) alpha_wrt
type(physical_parameters), dimension(num_fluids_max) fluid_pp
Per-fluid stiffened-gas EOS parameters, Reynolds numbers, and shear modulus.
logical, dimension(num_fluids_max) alpha_rho_wrt
type(eqn_idx_info) eqn_idx
All conserved-variable equation index ranges and scalars.
impure subroutine s_initialize_parallel_io_common
Configure MPI parallel I/O settings and allocate processor coordinate arrays. Shared across all three...
type(particle_cloud_parameters), dimension(num_particle_clouds_max) particle_cloud
Particle bed specifications.
impure subroutine s_assign_common_defaults
Assign default values to the user-input parameters that are shared across all three executables (pre_...
impure subroutine s_initialize_eqn_idx(nmom_in, nb_in, six_eqn_alf_is_advected)
Initialize equation-index state (eqn_idx and sys_size) from the namelist parameters....
Global parameters for the post-process: domain geometry, equation of state, and output database setti...
type(int_bounds_info) ib_bc_z
bc_x/y/z before decomposition overwrites them with MPI neighbor ranks
real(sp), dimension(:), allocatable x_cc_s
type(mpi_io_levelset_norm_var), public mpi_io_levelsetnorm_data
impure subroutine s_assign_default_values_to_user_inputs
Assigns default values to user inputs prior to reading them in. This allows for an easier consistency...
impure subroutine s_finalize_global_parameters_module
Deallocation procedures for the module.
real(sp), dimension(:), allocatable z_cb_s
real(sp), dimension(:), allocatable x_cb_s
real(wp), dimension(:), allocatable im_trans_c
type(int_bounds_info), dimension(1:3) idwint
integer beta_idx
Index of lagrange bubbles beta.
type(int_bounds_info) offset_y
type(int_bounds_info) ib_bc_y
type(int_bounds_info), dimension(3) nidx
Neighbor index offsets per direction (#1290 decomposition).
type(int_bounds_info) ib_bc_x
real(wp), dimension(:), allocatable pb0
real(wp), dimension(:), allocatable im_trans_t
type(qbmm_idx_info) qbmm_idx
QBMM moment index mappings.
real(wp), dimension(:,:), allocatable, public mpi_io_data_lg_bubbles
real(wp), dimension(:), allocatable y_cc
integer proc_rank
Rank of the local processor.
real(wp), dimension(:), allocatable re_trans_t
real(wp), dimension(:), allocatable adv
Advection variables.
real(wp), dimension(:), allocatable x_root_cc
type(int_bounds_info) z_output_idx
Indices of domain to output for post-processing.
type(mpi_io_ib_var), public mpi_io_ib_data
real(wp), dimension(:), allocatable y_cb
real(wp), dimension(:), allocatable dz
real(wp), dimension(:), allocatable weight
real(wp), dimension(:), allocatable k_v
real(wp), dimension(:), allocatable x_root_cb
integer fd_number
Finite-difference half-stencil size: MAX(1, fd_order/2).
type(mpi_io_levelset_var), public mpi_io_levelset_data
type(int_bounds_info), dimension(1:3) idwbuff
integer buff_size
Number of ghost cells for boundary condition storage.
real(wp), dimension(:), allocatable z_cb
type(bounds_info) z_output
Portion of domain to output for post-processing.
type(ib_airfoil_parameters), dimension(:), allocatable ib_airfoil
Per-airfoil NACA parameters (unused in post_process).
integer, dimension(:,:,:), allocatable neighbor_ranks
MPI ranks of neighbors (#1290 decomposition).
real(wp), dimension(:), allocatable r0
type(int_bounds_info) x_output_idx
impure subroutine s_initialize_global_parameters_module
Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the...
real(wp), dimension(:), allocatable x_cc
real(wp), dimension(:), allocatable k_g
type(ib_airfoil_grid), dimension(:), allocatable ib_airfoil_grids
Per-airfoil computed surface grids (unused in post_process).
type(chemistry_parameters) chem_params
real(wp), dimension(:), allocatable x_cb
real(wp), dimension(:), allocatable dy
type(int_bounds_info) offset_x
real(wp), dimension(:), allocatable z_cc
real(sp), dimension(:), allocatable y_cb_s
integer num_procs
Number of processors.
type(int_bounds_info) y_output_idx
type(int_bounds_info) offset_z
type(cell_num_bounds) cells_bounds
real(wp), dimension(:), allocatable mass_g0
real(wp) wall_time_avg
Wall time measurements.
type(mpi_io_var), public mpi_io_data
impure subroutine s_initialize_parallel_io
Subroutine to initialize parallel infrastructure.
real(wp), dimension(:), allocatable omegan
real(wp), dimension(:), allocatable re_trans_c
real(sp), dimension(:), allocatable x_root_cc_s
real(wp), dimension(:), allocatable dx
Cell-width distributions in the x-, y- and z-coordinate directions.
real(wp), dimension(:), allocatable pe_t
real(wp), dimension(:), allocatable mass_v0
integer(kind=8) nglobal
Total number of cells in global domain.
Basic floating-point utilities: approximate equality, default detection, and coordinate bounds.
elemental subroutine, public s_update_cell_bounds(bounds, m, n, p)
Update the min and max number of cells in each set of axes.
Groups the x, y, z boundary condition begin/end codes for passing as a single argument.
Derived type adding beginning (beg) and end bounds info as attributes.
Max and min number of cells in a direction of each combination of x-,y-, and z-.
Computed surface grid for a NACA airfoil (simulation-only, not in namelist).
User-input parameters for a NACA 4-digit airfoil (namelist-safe: scalars only).
Integer bounds for variables.
QBMM moment index mappings - separate from bub beg/end so eqn_idx contains no allocatables.