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