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/pre_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/pre_process/m_global_parameters.fpp" 2
17
18!> @brief Defines global parameters for the computational domain, simulation algorithm, and initial conditions
20
21#ifdef MFC_MPI
22 use mpi ! Message passing interface (MPI) module
23#endif
24
25 use m_derived_types ! Definitions of the derived types
26 use m_helper_basic ! Functions to compare floating point numbers
27 ! Shared state: generated_decls, sys_size, eqn_idx, chemistry, shear_*
29
30 implicit none
31
32 ! Logistics
33 integer :: num_procs !< Number of processors
34 logical :: non_axis_sym !< Use existing IC data
35 logical :: cfl_dt
36
37 ! Computational Domain Parameters
38
39 integer :: proc_rank !< Rank of the local processor Number of cells in the x-, y- and z-coordinate directions
40
41 !> @name Max and min number of cells in a direction of each combination of x-,y-, and z-
43 integer(kind=8) :: nglobal !< Global number of cells in the domain
44 integer :: m_glb, n_glb, p_glb !< Global number of cells in each direction
45 integer :: grid_geometry !< Cylindrical coordinates (either axisymmetric or full 3D)
46 !> Locations of cell-centers (cc) in x-, y- and z-directions, respectively
47 real(wp), allocatable, dimension(:) :: x_cc, y_cc, z_cc
48 !> Locations of cell-boundaries (cb) in x-, y- and z-directions, respectively
49 real(wp), allocatable, dimension(:) :: x_cb, y_cb, z_cb
50 type(bounds_info) :: x_domain, y_domain, z_domain !< Locations of the domain bounds in the x-, y- and z-coordinate directions
51 !> Global (pre-decomposition) domain bounds, needed by s_generate_serial_grid to stretch the grid using the full domain length
52 !! rather than a local processor's sub-domain length
54
55 ! Simulation Algorithm Parameters
56 ! sys_size, eqn_idx, chemistry, shear_*: in m_global_parameters_common
57 ! weno_polyn, muscl_polyn, num_dims, num_vels: in m_global_parameters_common
58 ! Annotations of the structure, i.e. the organization, of the state vectors
59 type(qbmm_idx_info) :: qbmm_idx !< QBMM moment index mappings.
60 ! Cell Indices for the (local) interior points (O-m, O-n, 0-p). Stands for "InDices With BUFFer".
61 type(int_bounds_info) :: idwint(1:3)
62
63 ! Cell indices (InDices With BUFFer): includes buffer except in pre_process
65 type(int_bounds_info) :: bc_x, bc_y, bc_z !< Boundary conditions in the x-, y- and z-coordinate directions
66 type(bc_xyz_info) :: bc !< Combined BC storage (used by the shared beta-buffer routines; pre-process-local)
67 ! simplex_params: auto-generated in generated_decls.fpp
68 ! shear_num/shear_indices/shear_BC_flip_*, bc: in m_global_parameters_common
69 integer :: fd_order !< Finite-difference order for CoM/probe derivative approximations
70 integer :: fd_number !< FD half-stencil size: MAX(1, fd_order/2)
71 type(bubbles_lagrange_parameters) :: lag_params !< Lagrange bubbles' parameters (pre_process-local; not in generated_decls)
72
73 ! fluid_rho (perturbs surrounding-air density to break grid symmetry): auto-generated in generated_decls.fpp
74 ! proc_coords, start_idx, mpiiofs, mpi_info_int: in m_global_parameters_common
75
76 !> @name MPI domain-decomposition neighbor info (Lagrangian-bubble decomposition, #1290)
77 !> @{
78 type(int_bounds_info), dimension(3) :: nidx
79 integer, allocatable, dimension(:,:,:) :: neighbor_ranks !< Neighbor ranks
80 !> @}
81#ifdef MFC_MPI
82 type(mpi_io_var), public :: mpi_io_data
83#endif
84
85 ! Initial Condition Parameters patch_icpp, patch_bc: auto-generated in generated_decls.fpp
86 logical :: bc_io !< whether or not to save BC data
87
88 ! Fluids Physical Parameters fluid_pp, bub_pp: auto-generated in generated_decls.fpp
90 !> @name Bubble modeling
91 !> @{
92 real(wp) :: eu
93 real(wp), dimension(:), allocatable :: weight, r0
94 integer :: nmom !< Number of carried moments
95 !> @}
96
97 !> @name Immersed Boundaries
98 !> @{
99 ! patch_ib, ib_airfoil, stl_models: auto-generated in generated_decls.fpp
100 !> Per-airfoil computed surface grids (unused in pre_process)
101 type(ib_airfoil_grid), allocatable, dimension(:) :: ib_airfoil_grids
102 !> @}
103
104 !> @name Non-polytropic bubble gas compression
105 !> @{
106 real(wp) :: phi_vg, phi_gv, pe_c, tw, k_vl, k_gl
107 real(wp) :: gam_m
108 real(wp), dimension(:), allocatable :: pb0, mass_g0, mass_v0, pe_t, k_v, k_g
109 real(wp), dimension(:), allocatable :: re_trans_t, re_trans_c, im_trans_t, im_trans_c, omegan
111 !> @}
112
113 integer, allocatable, dimension(:,:,:) :: logic_grid
114 type(pres_field) :: pb
115 type(pres_field) :: mv
116 integer :: buff_size !< Number of ghost cells for boundary condition storage
117
118 ! Variables for hardcoded initial conditions that are read from input files
119 character(LEN=2*path_len) :: interface_file
120 real(wp) :: normfac, normmag, g0_ic, p0_ic
121
122contains
123
124 !> Assigns default values to user inputs prior to reading them in. This allows for an easier consistency check of these
125 !! parameters once they are read from the input file.
127
128 integer :: i !< Generic loop operator
129
130 ! Shared defaults (case_dir, m/n/p, cyl_coord, cfl flags, model_eqns, BC blocks,
131 ! recon/weno/muscl/num_fluids/igr/mhd/relativity under case-opt guard, Tait EOS, bubble flags,
132 ! IB flags, parallel I/O flags, fft_wrt)
133
135
136 ! Boundary conditions (bc_x/y/z are per-target declarations, not visible in common)
137 bc_x%beg = dflt_int; bc_x%end = dflt_int
138 bc_y%beg = dflt_int; bc_y%end = dflt_int
139 bc_z%beg = dflt_int; bc_z%end = dflt_int
140
141# 131 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
142# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
143 bc_x%vb1 = 0._wp
144 bc_x%ve1 = 0._wp
145# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
146 bc_x%vb2 = 0._wp
147 bc_x%ve2 = 0._wp
148# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
149 bc_x%vb3 = 0._wp
150 bc_x%ve3 = 0._wp
151# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
152# 131 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
153# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
154 bc_y%vb1 = 0._wp
155 bc_y%ve1 = 0._wp
156# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
157 bc_y%vb2 = 0._wp
158 bc_y%ve2 = 0._wp
159# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
160 bc_y%vb3 = 0._wp
161 bc_y%ve3 = 0._wp
162# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
163# 131 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
164# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
165 bc_z%vb1 = 0._wp
166 bc_z%ve1 = 0._wp
167# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
168 bc_z%vb2 = 0._wp
169 bc_z%ve2 = 0._wp
170# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
171 bc_z%vb3 = 0._wp
172 bc_z%ve3 = 0._wp
173# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
174# 136 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
175
176# 138 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
177 bc_x%isothermal_in = .false.
178 bc_x%isothermal_out = .false.
179 bc_x%Twall_in = dflt_real
180 bc_x%Twall_out = dflt_real
181# 138 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
182 bc_y%isothermal_in = .false.
183 bc_y%isothermal_out = .false.
184 bc_y%Twall_in = dflt_real
185 bc_y%Twall_out = dflt_real
186# 138 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
187 bc_z%isothermal_in = .false.
188 bc_z%isothermal_out = .false.
189 bc_z%Twall_in = dflt_real
190 bc_z%Twall_out = dflt_real
191# 143 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
192
194
195 ! Logistics (pre-specific)
196 file_extension = '000000'
197 files_dir = './'
198 old_grid = .false.
199 old_ic = .false.
200 t_step_old = dflt_int
201 cfl_dt = .false.
202
203 ! Computational domain parameters (pre-specific)
204 x_domain%beg = dflt_real
205 x_domain%end = dflt_real
206 y_domain%beg = dflt_real
207 y_domain%end = dflt_real
208 z_domain%beg = dflt_real
209 z_domain%end = dflt_real
210
211 stretch_x = .false.
212 stretch_y = .false.
213 stretch_z = .false.
214
215 a_x = dflt_real
216 a_y = dflt_real
217 a_z = dflt_real
218 loops_x = 1
219 loops_y = 1
220 loops_z = 1
221 x_a = dflt_real
222 x_b = dflt_real
223 y_a = dflt_real
224 y_b = dflt_real
225 z_a = dflt_real
226 z_b = dflt_real
227
228 ! Simulation algorithm parameters (pre-specific)
229 palpha_eps = dflt_real
230 ptgalpha_eps = dflt_real
231 igr_order = dflt_int
232 precision = 2
233 mixlayer_vel_profile = .false.
234 mixlayer_vel_coef = 1._wp
235 mixlayer_perturb = .false.
237 mixlayer_perturb_k0 = 0.4446_wp
238 perturb_flow = .false.
239 perturb_flow_fluid = dflt_int
240 perturb_flow_mag = dflt_real
241 perturb_sph = .false.
242 perturb_sph_fluid = dflt_int
243 fluid_rho = dflt_real
244 elliptic_smoothing_iters = dflt_int
245 elliptic_smoothing = .false.
246
247 simplex_perturb = .false.
248 simplex_params%perturb_vel(:) = .false.
249 simplex_params%perturb_vel_freq(:) = dflt_real
250 simplex_params%perturb_vel_scale(:) = dflt_real
251 simplex_params%perturb_vel_offset(:,:) = dflt_real
252 simplex_params%perturb_dens(:) = .false.
253 simplex_params%perturb_dens_freq(:) = dflt_real
254 simplex_params%perturb_dens_scale(:) = dflt_real
255 simplex_params%perturb_dens_offset(:,:) = dflt_real
256
257 ! Initial condition parameters
258 num_patches = dflt_int
259
260 fd_order = dflt_int
261 lag_params%cluster_type = dflt_int
262 lag_params%pressure_corrector = .false.
263 lag_params%smooth_type = dflt_int
264 lag_params%heatTransfer_model = .false.
265 lag_params%massTransfer_model = .false.
266 lag_params%write_bubbles = .false.
267 lag_params%write_bubbles_stats = .false.
268 lag_params%write_void_evol = .false.
269 lag_params%pressure_force = .false.
270 lag_params%gravity_force = .false.
271 lag_params%nBubs_glb = dflt_int
272 lag_params%vel_model = dflt_int
273 lag_params%drag_model = dflt_int
274 lag_params%epsilonb = 1._wp
275 lag_params%charwidth = dflt_real
276 lag_params%charNz = dflt_int
277 lag_params%valmaxvoid = dflt_real
278
279 do i = 1, num_patches_max
280 patch_icpp(i)%geometry = dflt_int
281 patch_icpp(i)%model_id = 0
282 patch_icpp(i)%x_centroid = dflt_real
283 patch_icpp(i)%y_centroid = dflt_real
284 patch_icpp(i)%z_centroid = dflt_real
285 patch_icpp(i)%length_x = dflt_real
286 patch_icpp(i)%length_y = dflt_real
287 patch_icpp(i)%length_z = dflt_real
288 patch_icpp(i)%radius = dflt_real
289 patch_icpp(i)%epsilon = dflt_real
290 patch_icpp(i)%beta = dflt_real
291 patch_icpp(i)%normal = dflt_real
292 patch_icpp(i)%radii = dflt_real
293 patch_icpp(i)%alter_patch = .false.
294 patch_icpp(i)%alter_patch(0) = .true.
295 patch_icpp(i)%smoothen = .false.
296 patch_icpp(i)%smooth_patch_id = i
297 patch_icpp(i)%smooth_coeff = dflt_real
298 patch_icpp(i)%alpha_rho = dflt_real
299 patch_icpp(i)%rho = dflt_real
300 patch_icpp(i)%vel = dflt_real
301 patch_icpp(i)%pres = dflt_real
302 patch_icpp(i)%alpha = dflt_real
303 patch_icpp(i)%gamma = dflt_real
304 patch_icpp(i)%pi_inf = dflt_real
305 patch_icpp(i)%cv = 0._wp
306 patch_icpp(i)%qv = 0._wp
307 patch_icpp(i)%qvp = 0._wp
308 patch_icpp(i)%tau_e = 0._wp
309 patch_icpp(i)%Bx = dflt_real
310 patch_icpp(i)%By = dflt_real
311 patch_icpp(i)%Bz = dflt_real
312 patch_icpp(i)%a(2) = dflt_real
313 patch_icpp(i)%a(3) = dflt_real
314 patch_icpp(i)%a(4) = dflt_real
315 patch_icpp(i)%a(5) = dflt_real
316 patch_icpp(i)%a(6) = dflt_real
317 patch_icpp(i)%a(7) = dflt_real
318 patch_icpp(i)%a(8) = dflt_real
319 patch_icpp(i)%a(9) = dflt_real
320 patch_icpp(i)%non_axis_sym = .false.
321 patch_icpp(i)%fourier_cos(:) = 0._wp
322 patch_icpp(i)%fourier_sin(:) = 0._wp
323 patch_icpp(i)%modal_clip_r_to_min = .false.
324 patch_icpp(i)%modal_r_min = 1.e-12_wp
325 patch_icpp(i)%modal_use_exp_form = .false.
326 patch_icpp(i)%sph_har_coeff(:,:) = 0._wp
327
328 ! should get all of r0's and v0's
329 patch_icpp(i)%r0 = dflt_real
330 patch_icpp(i)%v0 = dflt_real
331
332 patch_icpp(i)%p0 = dflt_real
333 patch_icpp(i)%m0 = dflt_real
334
335 patch_icpp(i)%hcid = dflt_int
336
337 if (chemistry) then
338 patch_icpp(i)%Y(:) = 0._wp
339 end if
340 end do
341
343 bc_io = .false.
344
345 do i = 1, num_bc_patches_max
346 patch_bc(i)%geometry = dflt_int
347 patch_bc(i)%type = dflt_int
348 patch_bc(i)%dir = dflt_int
349 patch_bc(i)%loc = dflt_int
350 patch_bc(i)%centroid(:) = dflt_real
351 patch_bc(i)%length(:) = dflt_real
352 patch_bc(i)%radius = dflt_real
353 end do
354
355 ! Bubble modeling (pre-specific)
356 polytropic = .true.
357 thermal = dflt_int
358 nb = dflt_int
359
360 eu = dflt_real
361 ca = dflt_real
362 re_inv = dflt_real
363 web = dflt_real
364
365 nmom = 1
366 sigv = dflt_real
367 rhorv = 0._wp
368 dist_type = dflt_int
369
370 r_g = dflt_real
371 r_v = dflt_real
372 phi_vg = dflt_real
373 phi_gv = dflt_real
374 pe_c = dflt_real
375 tw = dflt_real
376
377 pi_fac = 1._wp
378
379 do i = 1, num_ib_patches_max_namelist
380 patch_ib(i)%geometry = dflt_int
381 patch_ib(i)%x_centroid = dflt_real
382 patch_ib(i)%y_centroid = dflt_real
383 patch_ib(i)%z_centroid = dflt_real
384 patch_ib(i)%length_x = dflt_real
385 patch_ib(i)%length_y = dflt_real
386 patch_ib(i)%length_z = dflt_real
387 patch_ib(i)%radius = dflt_real
388 patch_ib(i)%airfoil_id = 0
389 patch_ib(i)%model_id = 0
390 patch_ib(i)%slip = .false.
391 patch_ib(i)%v_blow = 0._wp
392 patch_ib(i)%inj_species = 0
393 patch_ib(i)%burn_rate_exp = 0._wp
394 patch_ib(i)%burn_rate_pref = 0._wp
395
396 ! Variables to handle moving immersed boundaries, defaulting to no movement
397 patch_ib(i)%moving_ibm = 0
398 patch_ib(i)%vel(:) = 0._wp
399 patch_ib(i)%angles(:) = 0._wp
400 patch_ib(i)%angular_vel(:) = 0._wp
401 patch_ib(i)%mass = dflt_real
402 patch_ib(i)%moment = dflt_real
403 patch_ib(i)%centroid_offset(:) = 0._wp
404
405 ! sets values of a rotation matrix which can be used when calculating rotations
406 patch_ib(i)%rotation_matrix = 0._wp
407 patch_ib(i)%rotation_matrix(1, 1) = 1._wp
408 patch_ib(i)%rotation_matrix(2, 2) = 1._wp
409 patch_ib(i)%rotation_matrix(3, 3) = 1._wp
410 patch_ib(i)%rotation_matrix_inverse = patch_ib(i)%rotation_matrix
411 end do
412
413 do i = 1, num_ib_airfoils_max
414 ib_airfoil(i)%c = dflt_real
415 ib_airfoil(i)%p = dflt_real
416 ib_airfoil(i)%t = dflt_real
417 ib_airfoil(i)%m = dflt_real
418 end do
419
421
422 do i = 1, num_stl_models_max
423 stl_models(i)%model_filepath(:) = dflt_char
424 stl_models(i)%model_translate(:) = 0._wp
425 stl_models(i)%model_scale(:) = 1._wp
426 stl_models(i)%model_threshold = ray_tracing_threshold
427 end do
428
429 chem_params%gamma_method = 1
430 chem_params%transport_model = 1
431
432 chem_params%reaction_substeps = 0
433 chem_params%adap_substeps = .false.
434 chem_params%reaction_substeps_max = 0
435
436 ! Fluids physical parameters
437 do i = 1, num_fluids_max
438 fluid_pp(i)%gamma = dflt_real
439 fluid_pp(i)%pi_inf = dflt_real
440 fluid_pp(i)%cv = 0._wp
441 fluid_pp(i)%qv = 0._wp
442 fluid_pp(i)%qvp = 0._wp
443 fluid_pp(i)%G = 0._wp
444 fluid_pp(i)%non_newtonian = .false.
445 fluid_pp(i)%K = dflt_real
446 fluid_pp(i)%nn = dflt_real
447 fluid_pp(i)%tau0 = 0._wp
448 fluid_pp(i)%hb_m = dflt_real
449 fluid_pp(i)%mu_min = dflt_real
450 fluid_pp(i)%mu_max = dflt_real
451 fluid_pp(i)%mu_bulk = dflt_real
452 end do
453
454 ! Subgrid bubble parameters
455 bub_pp%R0ref = dflt_real; r0ref = dflt_real
456 bub_pp%p0ref = dflt_real; p0ref = dflt_real
457 bub_pp%rho0ref = dflt_real; rho0ref = dflt_real
458 bub_pp%T0ref = dflt_real; t0ref = dflt_real
459 bub_pp%ss = dflt_real; ss = dflt_real
460 bub_pp%pv = dflt_real; pv = dflt_real
461 bub_pp%vd = dflt_real; vd = dflt_real
462 bub_pp%mu_l = dflt_real; mu_l = dflt_real
463 bub_pp%mu_v = dflt_real; mu_v = dflt_real
464 bub_pp%mu_g = dflt_real; mu_g = dflt_real
465 bub_pp%gam_v = dflt_real; gam_v = dflt_real
466 bub_pp%gam_g = dflt_real; gam_g = dflt_real
467 bub_pp%M_v = dflt_real; m_v = dflt_real
468 bub_pp%M_g = dflt_real; m_g = dflt_real
469 bub_pp%k_v = dflt_real
470 bub_pp%k_g = dflt_real
471 bub_pp%cp_v = dflt_real; cp_v = dflt_real
472 bub_pp%cp_g = dflt_real; cp_g = dflt_real
473 bub_pp%R_v = dflt_real; r_v = dflt_real
474 bub_pp%R_g = dflt_real; r_g = dflt_real
475
477
478 !> Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the module
480
481 integer :: i, j, fac
482
483 if (recon_type == recon_type_weno) then
484 weno_polyn = (weno_order - 1)/2
485 else if (recon_type == recon_type_muscl) then
487 end if
488
489 ! Gamma/Pi_inf: force num_fluids=1 (pre_process-specific side effect of the gamma-law model)
490 if (model_eqns == model_eqns_gamma_law) num_fluids = 1
491
492 ! Pre-process sets nmom to 6 for qbmm before the shared eqn_idx setup
493 ! (guards match the original site: 5-equation bubbles with 4-node qbmm)
494 if (model_eqns == model_eqns_5eq .and. bubbles_euler .and. qbmm .and. nnode == 4) nmom = 6
495
496 ! Populate eqn_idx, sys_size, shear_* (shared logic)
497 call s_initialize_eqn_idx(nmom, nb, six_eqn_alf_is_advected=.false.)
498
499 ! Per-target (pre_process): qbmm_idx allocations and fills
500 if (model_eqns == model_eqns_5eq .and. bubbles_euler) then
501 allocate (qbmm_idx%rs(nb), qbmm_idx%vs(nb))
502 allocate (qbmm_idx%ps(nb), qbmm_idx%ms(nb))
503
504 if (qbmm) then
505 allocate (qbmm_idx%moms(nb, nmom))
506 allocate (qbmm_idx%fullmom(nb,0:nmom,0:nmom))
507
508 do i = 1, nb
509 do j = 1, nmom
510 qbmm_idx%moms(i, j) = eqn_idx%bub%beg + (j - 1) + (i - 1)*nmom
511 end do
512 qbmm_idx%fullmom(i, 0, 0) = qbmm_idx%moms(i, 1)
513 qbmm_idx%fullmom(i, 1, 0) = qbmm_idx%moms(i, 2)
514 qbmm_idx%fullmom(i, 0, 1) = qbmm_idx%moms(i, 3)
515 qbmm_idx%fullmom(i, 2, 0) = qbmm_idx%moms(i, 4)
516 qbmm_idx%fullmom(i, 1, 1) = qbmm_idx%moms(i, 5)
517 qbmm_idx%fullmom(i, 0, 2) = qbmm_idx%moms(i, 6)
518 qbmm_idx%rs(i) = qbmm_idx%fullmom(i, 1, 0)
519 end do
520 else
521 do i = 1, nb
522 if (.not. polytropic) then
523 fac = 4
524 else
525 fac = 2
526 end if
527
528 qbmm_idx%rs(i) = eqn_idx%bub%beg + (i - 1)*fac
529 qbmm_idx%vs(i) = qbmm_idx%rs(i) + 1
530
531 if (.not. polytropic) then
532 qbmm_idx%ps(i) = qbmm_idx%vs(i) + 1
533 qbmm_idx%ms(i) = qbmm_idx%ps(i) + 1
534 end if
535 end do
536 end if
537 end if
538
539 if (bubbles_lagrange) fd_number = max(1, fd_order/2)
540
543
544#ifdef MFC_MPI
545 if (qbmm .and. .not. polytropic) then
546 allocate (mpi_io_data%view(1:sys_size + 2*nb*nnode))
547 allocate (mpi_io_data%var(1:sys_size + 2*nb*nnode))
548 else
549 allocate (mpi_io_data%view(1:sys_size))
550 allocate (mpi_io_data%var(1:sys_size))
551 end if
552
553 if (.not. down_sample) then
554 do i = 1, sys_size
555 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
556 mpi_io_data%var(i)%sf => null()
557 end do
558 end if
559 if (qbmm .and. .not. polytropic) then
560 do i = sys_size + 1, sys_size + 2*nb*nnode
561 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
562 mpi_io_data%var(i)%sf => null()
563 end do
564 end if
565#endif
566
567 ! Allocating grid variables for the x-direction
568 allocate (x_cc(0:m), x_cb(-1:m))
569 ! Allocating grid variables for the y- and z-directions
570 if (n > 0) then
571 allocate (y_cc(0:n), y_cb(-1:n))
572 if (p > 0) then
573 allocate (z_cc(0:p), z_cb(-1:p))
574 end if
575 end if
576
577 if (cyl_coord .neqv. .true.) then ! Cartesian grid
578 grid_geometry = 1
579 else if (cyl_coord .and. p == 0) then ! Axisymmetric cylindrical grid
580 grid_geometry = 2
581 else ! Fully 3D cylindrical grid
582 grid_geometry = 3
583 end if
584
585 if (.not. igr) then
586 allocate (logic_grid(0:m,0:n,0:p))
587 end if
588
590
591 !> Configure MPI parallel I/O settings and allocate processor coordinate arrays.
596 end subroutine s_initialize_parallel_io
597
598 !> Deallocate all global grid, index, and equation-of-state parameter arrays.
600
601 integer :: i
602
603 if (bubbles_euler) then
604 deallocate (qbmm_idx%rs, qbmm_idx%vs, qbmm_idx%ps, qbmm_idx%ms)
605 if (qbmm) deallocate (qbmm_idx%moms, qbmm_idx%fullmom)
606 end if
607
608 ! Deallocating grid variables for the x-direction
609 deallocate (x_cc, x_cb)
610 ! Deallocating grid variables for the y- and z-directions
611 if (n > 0) then
612 deallocate (y_cc, y_cb)
613 if (p > 0) then
614 deallocate (z_cc, z_cb)
615 end if
616 end if
617
618 ! Shared: deallocate proc_coords and start_idx
620
621#ifdef MFC_MPI
622 if (parallel_io) then
623 do i = 1, sys_size
624 mpi_io_data%var(i)%sf => null()
625 end do
626
627 deallocate (mpi_io_data%var)
628 deallocate (mpi_io_data%view)
629 end if
630#endif
631
632 if (allocated(neighbor_ranks)) deallocate (neighbor_ranks)
633
635
636end module m_global_parameters
integer, intent(in) j
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...
type(ib_stl_parameters), dimension(num_stl_models_max) stl_models
Per-STL model parameters.
impure subroutine s_finalize_global_parameters_common
Shared finalize core: deallocate proc_coords and start_idx. Per-target finalize routines call this fi...
type(ic_patch_parameters), dimension(num_patches_max) patch_icpp
IC patch parameters.
type(subgrid_bubble_physical_parameters) bub_pp
Subgrid bubble physical parameters.
integer sys_size
Number of unknowns in system of equations.
type(physical_parameters), dimension(num_fluids_max) fluid_pp
Per-fluid stiffened-gas EOS parameters, Reynolds numbers, and shear modulus.
type(bc_patch_parameters), dimension(num_bc_patches_max) patch_bc
Boundary condition patch parameters.
type(eqn_idx_info) eqn_idx
All conserved-variable equation index ranges and scalars.
real(wp), dimension(num_fluids_max) fluid_rho
type(ib_patch_parameters), dimension(num_ib_patches_max_namelist) patch_ib
Immersed boundary patch parameters.
impure subroutine s_initialize_parallel_io_common
Configure MPI parallel I/O settings and allocate processor coordinate arrays. Shared across all three...
type(ib_airfoil_parameters), dimension(num_ib_airfoils_max) ib_airfoil
Per-airfoil NACA user inputs.
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....
Defines global parameters for the computational domain, simulation algorithm, and initial conditions.
integer grid_geometry
Cylindrical coordinates (either axisymmetric or full 3D).
integer p_glb
Global number of cells in each direction.
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
Deallocate all global grid, index, and equation-of-state parameter arrays.
real(wp), dimension(:), allocatable im_trans_c
type(int_bounds_info), dimension(1:3) idwint
type(int_bounds_info), dimension(3) nidx
type(int_bounds_info) bc_z
Boundary conditions in the x-, y- and z-coordinate directions.
real(wp), dimension(:), allocatable pb0
real(wp), dimension(:), allocatable im_trans_t
type(qbmm_idx_info) qbmm_idx
QBMM moment index mappings.
type(bubbles_lagrange_parameters) lag_params
Lagrange bubbles' parameters (pre_process-local; not in generated_decls).
real(wp), dimension(:), allocatable y_cc
logical non_axis_sym
Use existing IC data.
integer proc_rank
Rank of the local processor Number of cells in the x-, y- and z-coordinate directions.
real(wp), dimension(:), allocatable re_trans_t
logical bc_io
whether or not to save BC data
real(wp), dimension(:), allocatable y_cb
type(bounds_info) z_domain
Locations of the domain bounds in the x-, y- and z-coordinate directions.
real(wp), dimension(:), allocatable weight
real(wp), dimension(:), allocatable k_v
integer fd_number
FD half-stencil size: MAX(1, fd_order/2).
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
character(len=2 *path_len) interface_file
type(int_bounds_info) bc_y
integer, dimension(:,:,:), allocatable neighbor_ranks
Neighbor ranks.
real(wp), dimension(:), allocatable r0
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
Locations of cell-centers (cc) in x-, y- and z-directions, respectively.
real(wp), dimension(:), allocatable k_g
type(ib_airfoil_grid), dimension(:), allocatable ib_airfoil_grids
Per-airfoil computed surface grids (unused in pre_process).
type(chemistry_parameters) chem_params
integer fd_order
Finite-difference order for CoM/probe derivative approximations.
type(int_bounds_info) bc_x
real(wp), dimension(:), allocatable x_cb
Locations of cell-boundaries (cb) in x-, y- and z-directions, respectively.
real(wp), dimension(:), allocatable z_cc
integer num_procs
Number of processors.
type(bounds_info) x_domain_glb
Global (pre-decomposition) domain bounds, needed by s_generate_serial_grid to stretch the grid using ...
integer nmom
Number of carried moments.
type(cell_num_bounds) cells_bounds
real(wp), dimension(:), allocatable mass_g0
type(mpi_io_var), public mpi_io_data
impure subroutine s_initialize_parallel_io
Configure MPI parallel I/O settings and allocate processor coordinate arrays.
real(wp), dimension(:), allocatable omegan
integer, dimension(:,:,:), allocatable logic_grid
real(wp), dimension(:), allocatable re_trans_c
type(bc_xyz_info) bc
Combined BC storage (used by the shared beta-buffer routines; pre-process-local).
real(wp), dimension(:), allocatable pe_t
real(wp), dimension(:), allocatable mass_v0
integer(kind=8) nglobal
Global number of cells in the domain.
Basic floating-point utilities: approximate equality, default detection, and coordinate bounds.
subroutine, public s_configure_coordinate_bounds(recon_type, weno_polyn, muscl_polyn, igr_order, buff_size, idwint, idwbuff, viscous, bubbles_lagrange, m, n, p, num_dims, igr, ib, fd_number)
Compute ghost-cell buffer size and set interior/buffered coordinate index 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).
Integer bounds for variables.
Derived type for bubble variables pb and mv at quadrature nodes (qbmm).
QBMM moment index mappings - separate from bub beg/end so eqn_idx contains no allocatables.