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(int_bounds_info) :: ib_bc_x, ib_bc_y, ib_bc_z !< bc_x/y/z before decomposition overwrites them with MPI neighbor ranks
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, 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 precision = 2
234 mixlayer_vel_profile = .false.
235 mixlayer_vel_coef = 1._wp
236 mixlayer_perturb = .false.
238 mixlayer_perturb_k0 = 0.4446_wp
239 perturb_flow = .false.
240 perturb_flow_fluid = dflt_int
241 perturb_flow_mag = dflt_real
242 perturb_sph = .false.
243 perturb_sph_fluid = dflt_int
244 fluid_rho = dflt_real
245 elliptic_smoothing_iters = dflt_int
246 elliptic_smoothing = .false.
247
248 simplex_perturb = .false.
249 simplex_params%perturb_vel(:) = .false.
250 simplex_params%perturb_vel_freq(:) = dflt_real
251 simplex_params%perturb_vel_scale(:) = dflt_real
252 simplex_params%perturb_vel_offset(:,:) = dflt_real
253 simplex_params%perturb_dens(:) = .false.
254 simplex_params%perturb_dens_freq(:) = dflt_real
255 simplex_params%perturb_dens_scale(:) = dflt_real
256 simplex_params%perturb_dens_offset(:,:) = dflt_real
257
258 ! Initial condition parameters
259 num_patches = dflt_int
260
261 fd_order = dflt_int
262 lag_params%cluster_type = dflt_int
263 lag_params%pressure_corrector = .false.
264 lag_params%smooth_type = dflt_int
265 lag_params%heatTransfer_model = .false.
266 lag_params%massTransfer_model = .false.
267 lag_params%write_bubbles = .false.
268 lag_params%write_bubbles_stats = .false.
269 lag_params%write_void_evol = .false.
270 lag_params%pressure_force = .false.
271 lag_params%gravity_force = .false.
272 lag_params%nBubs_glb = dflt_int
273 lag_params%vel_model = dflt_int
274 lag_params%drag_model = dflt_int
275 lag_params%epsilonb = 1._wp
276 lag_params%charwidth = dflt_real
277 lag_params%charNz = dflt_int
278 lag_params%valmaxvoid = dflt_real
279
280 do i = 1, num_patches_max
281 patch_icpp(i)%geometry = dflt_int
282 patch_icpp(i)%model_id = 0
283 patch_icpp(i)%x_centroid = dflt_real
284 patch_icpp(i)%y_centroid = dflt_real
285 patch_icpp(i)%z_centroid = dflt_real
286 patch_icpp(i)%length_x = dflt_real
287 patch_icpp(i)%length_y = dflt_real
288 patch_icpp(i)%length_z = dflt_real
289 patch_icpp(i)%radius = dflt_real
290 patch_icpp(i)%epsilon = dflt_real
291 patch_icpp(i)%beta = dflt_real
292 patch_icpp(i)%normal = dflt_real
293 patch_icpp(i)%radii = dflt_real
294 patch_icpp(i)%alter_patch = .false.
295 patch_icpp(i)%alter_patch(0) = .true.
296 patch_icpp(i)%smoothen = .false.
297 patch_icpp(i)%smooth_patch_id = i
298 patch_icpp(i)%smooth_coeff = dflt_real
299 patch_icpp(i)%alpha_rho = dflt_real
300 patch_icpp(i)%rho = dflt_real
301 patch_icpp(i)%vel = dflt_real
302 patch_icpp(i)%pres = dflt_real
303 patch_icpp(i)%alpha = dflt_real
304 patch_icpp(i)%gamma = dflt_real
305 patch_icpp(i)%pi_inf = dflt_real
306 patch_icpp(i)%cv = 0._wp
307 patch_icpp(i)%qv = 0._wp
308 patch_icpp(i)%qvp = 0._wp
309 patch_icpp(i)%tau_e = 0._wp
310 patch_icpp(i)%Bx = dflt_real
311 patch_icpp(i)%By = dflt_real
312 patch_icpp(i)%Bz = dflt_real
313 patch_icpp(i)%a(2) = dflt_real
314 patch_icpp(i)%a(3) = dflt_real
315 patch_icpp(i)%a(4) = dflt_real
316 patch_icpp(i)%a(5) = dflt_real
317 patch_icpp(i)%a(6) = dflt_real
318 patch_icpp(i)%a(7) = dflt_real
319 patch_icpp(i)%a(8) = dflt_real
320 patch_icpp(i)%a(9) = dflt_real
321 patch_icpp(i)%non_axis_sym = .false.
322 patch_icpp(i)%fourier_cos(:) = 0._wp
323 patch_icpp(i)%fourier_sin(:) = 0._wp
324 patch_icpp(i)%modal_clip_r_to_min = .false.
325 patch_icpp(i)%modal_r_min = 1.e-12_wp
326 patch_icpp(i)%modal_use_exp_form = .false.
327 patch_icpp(i)%sph_har_coeff(:,:) = 0._wp
328
329 ! should get all of r0's and v0's
330 patch_icpp(i)%r0 = dflt_real
331 patch_icpp(i)%v0 = dflt_real
332
333 patch_icpp(i)%p0 = dflt_real
334 patch_icpp(i)%m0 = dflt_real
335
336 patch_icpp(i)%hcid = dflt_int
337
338 if (chemistry) then
339 patch_icpp(i)%Y(:) = 0._wp
340 end if
341 end do
342
344 bc_io = .false.
345
346 do i = 1, num_bc_patches_max
347 patch_bc(i)%geometry = dflt_int
348 patch_bc(i)%type = dflt_int
349 patch_bc(i)%dir = dflt_int
350 patch_bc(i)%loc = dflt_int
351 patch_bc(i)%centroid(:) = dflt_real
352 patch_bc(i)%length(:) = dflt_real
353 patch_bc(i)%radius = dflt_real
354 end do
355
356 ! Bubble modeling (pre-specific)
357 polytropic = .true.
358 thermal = dflt_int
359 nb = dflt_int
360
361 eu = dflt_real
362 ca = dflt_real
363 re_inv = dflt_real
364 web = dflt_real
365
366 nmom = 1
367 sigv = dflt_real
368 rhorv = 0._wp
369 dist_type = dflt_int
370
371 r_g = dflt_real
372 r_v = dflt_real
373 phi_vg = dflt_real
374 phi_gv = dflt_real
375 pe_c = dflt_real
376 tw = dflt_real
377
378 pi_fac = 1._wp
379
380 do i = 1, num_ib_patches_max_namelist
381 patch_ib(i)%geometry = dflt_int
382 patch_ib(i)%x_centroid = 0._wp
383 patch_ib(i)%y_centroid = 0._wp
384 patch_ib(i)%z_centroid = 0._wp
385 patch_ib(i)%length_x = dflt_real
386 patch_ib(i)%length_y = dflt_real
387 patch_ib(i)%length_z = dflt_real
388 patch_ib(i)%radius = dflt_real
389 patch_ib(i)%airfoil_id = 0
390 patch_ib(i)%model_id = 0
391 patch_ib(i)%slip = .false.
392 patch_ib(i)%v_blow = 0._wp
393 patch_ib(i)%inj_species = 0
394 patch_ib(i)%burn_rate_exp = 0._wp
395 patch_ib(i)%burn_rate_pref = 0._wp
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)%kin_model = 0
403 patch_ib(i)%kin_hinge(:) = 0._wp
404 patch_ib(i)%kin_offset(:) = 0._wp
405 patch_ib(i)%kin_phi0 = 0._wp
406 patch_ib(i)%kin_theta0 = 0._wp
407 patch_ib(i)%kin_theta_mean = 0._wp
408 patch_ib(i)%kin_freq = 0._wp
409 patch_ib(i)%kin_phase = 0._wp
410 patch_ib(i)%kin_t0 = 0._wp
411 patch_ib(i)%kin_ramp = 0._wp
412 patch_ib(i)%kin_pitch_rate = 0._wp
413 patch_ib(i)%kin_smooth = 0._wp
414 patch_ib(i)%mass = dflt_real
415 patch_ib(i)%moment = dflt_real
416 patch_ib(i)%centroid_offset(:) = 0._wp
417
418 ! sets values of a rotation matrix which can be used when calculating rotations
419 patch_ib(i)%rotation_matrix = 0._wp
420 patch_ib(i)%rotation_matrix(1, 1) = 1._wp
421 patch_ib(i)%rotation_matrix(2, 2) = 1._wp
422 patch_ib(i)%rotation_matrix(3, 3) = 1._wp
423 patch_ib(i)%rotation_matrix_inverse = patch_ib(i)%rotation_matrix
424 end do
425
427 do i = 1, num_particle_clouds_max
428 particle_cloud(i)%x_centroid = 0._wp
429 particle_cloud(i)%y_centroid = 0._wp
430 particle_cloud(i)%z_centroid = 0._wp
431 particle_cloud(i)%length_x = dflt_real
432 particle_cloud(i)%length_y = dflt_real
433 particle_cloud(i)%length_z = dflt_real
434 particle_cloud(i)%num_particles = 0
435 particle_cloud(i)%radius = dflt_real
436 particle_cloud(i)%mass = dflt_real
437 particle_cloud(i)%min_spacing = 0._wp
438 particle_cloud(i)%shell_inner_radius = dflt_real
439 particle_cloud(i)%shell_outer_radius = dflt_real
440 particle_cloud(i)%moving_ibm = 0
441 particle_cloud(i)%seed = 0
442 particle_cloud(i)%cloud_geometry = 1
443 particle_cloud(i)%packing_method = dflt_int
444 particle_cloud(i)%periodic = 0
445 end do
446
447 do i = 1, num_ib_airfoils_max
448 ib_airfoil(i)%c = dflt_real
449 ib_airfoil(i)%p = dflt_real
450 ib_airfoil(i)%t = dflt_real
451 ib_airfoil(i)%m = dflt_real
452 end do
453
455
456 do i = 1, num_stl_models_max
457 stl_models(i)%model_filepath(:) = dflt_char
458 stl_models(i)%model_translate(:) = 0._wp
459 stl_models(i)%model_scale(:) = 1._wp
460 stl_models(i)%model_threshold = ray_tracing_threshold
461 end do
462
463 chem_params%gamma_method = 1
464 chem_params%transport_model = 1
465
466 chem_params%reaction_substeps = 0
467 chem_params%adap_substeps = .false.
468 chem_params%reaction_substeps_max = 0
469
470 ! Fluids physical parameters
471 do i = 1, num_fluids_max
472 fluid_pp(i)%eos = eos_stiffened_gas
473 fluid_pp(i)%mg_rho0 = dflt_real
474 fluid_pp(i)%mg_c0 = dflt_real
475 fluid_pp(i)%mg_s = dflt_real
476 fluid_pp(i)%mg_gruneisen = dflt_real
477 fluid_pp(i)%mg_gruneisen_a = 0._wp
478 fluid_pp(i)%mg_t0 = 0._wp
479 fluid_pp(i)%mg_s2 = 0._wp
480 fluid_pp(i)%mg_s3 = 0._wp
481 fluid_pp(i)%jwl_a = dflt_real
482 fluid_pp(i)%jwl_b = dflt_real
483 fluid_pp(i)%jwl_r1 = dflt_real
484 fluid_pp(i)%jwl_r2 = dflt_real
485 fluid_pp(i)%jwl_omega = dflt_real
486 fluid_pp(i)%jwl_rho0 = dflt_real
487 fluid_pp(i)%jwl_t0 = 0._wp
488 fluid_pp(i)%vinet_k0 = dflt_real
489 fluid_pp(i)%vinet_k0p = dflt_real
490 fluid_pp(i)%vinet_rho0 = dflt_real
491 fluid_pp(i)%vinet_gruneisen = dflt_real
492 fluid_pp(i)%vinet_gruneisen_a = 0._wp
493 fluid_pp(i)%vinet_t0 = 0._wp
494 fluid_pp(i)%gamma = dflt_real
495 fluid_pp(i)%pi_inf = dflt_real
496 fluid_pp(i)%cv = 0._wp
497 fluid_pp(i)%qv = 0._wp
498 fluid_pp(i)%qvp = 0._wp
499 fluid_pp(i)%k_therm = 0._wp
500 fluid_pp(i)%G = 0._wp
501 fluid_pp(i)%non_newtonian = .false.
502 fluid_pp(i)%K = dflt_real
503 fluid_pp(i)%nn = dflt_real
504 fluid_pp(i)%tau0 = 0._wp
505 fluid_pp(i)%hb_m = dflt_real
506 fluid_pp(i)%mu_min = dflt_real
507 fluid_pp(i)%mu_max = dflt_real
508 fluid_pp(i)%mu_bulk = dflt_real
509 end do
510
511 ! Subgrid bubble parameters
512 bub_pp%R0ref = dflt_real; r0ref = dflt_real
513 bub_pp%p0ref = dflt_real; p0ref = dflt_real
514 bub_pp%rho0ref = dflt_real; rho0ref = dflt_real
515 bub_pp%T0ref = dflt_real; t0ref = dflt_real
516 bub_pp%ss = dflt_real; ss = dflt_real
517 bub_pp%pv = dflt_real; pv = dflt_real
518 bub_pp%vd = dflt_real; vd = dflt_real
519 bub_pp%mu_l = dflt_real; mu_l = dflt_real
520 bub_pp%mu_v = dflt_real; mu_v = dflt_real
521 bub_pp%mu_g = dflt_real; mu_g = dflt_real
522 bub_pp%gam_v = dflt_real; gam_v = dflt_real
523 bub_pp%gam_g = dflt_real; gam_g = dflt_real
524 bub_pp%M_v = dflt_real; m_v = dflt_real
525 bub_pp%M_g = dflt_real; m_g = dflt_real
526 bub_pp%k_v = dflt_real
527 bub_pp%k_g = dflt_real
528 bub_pp%cp_v = dflt_real; cp_v = dflt_real
529 bub_pp%cp_g = dflt_real; cp_g = dflt_real
530 bub_pp%R_v = dflt_real; r_v = dflt_real
531 bub_pp%R_g = dflt_real; r_g = dflt_real
532
534
535 !> Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the module
537
538 integer :: i, j, fac
539
540 if (recon_type == recon_type_weno) then
541 weno_polyn = (weno_order - 1)/2
542 else if (recon_type == recon_type_muscl) then
544 end if
545
546 ! Gamma/Pi_inf: force num_fluids=1 (pre_process-specific side effect of the gamma-law model)
547 if (model_eqns == model_eqns_gamma_law) num_fluids = 1
548
549 ! Pre-process sets nmom to 6 for qbmm before the shared eqn_idx setup
550 ! (guards match the original site: 5-equation bubbles with 4-node qbmm)
551 if (model_eqns == model_eqns_5eq .and. bubbles_euler .and. qbmm .and. nnode == 4) nmom = 6
552
553 ! Populate eqn_idx, sys_size, shear_* (shared logic)
554 call s_initialize_eqn_idx(nmom, nb, six_eqn_alf_is_advected=.false.)
555
556 ! Per-target (pre_process): qbmm_idx allocations and fills
557 if (model_eqns == model_eqns_5eq .and. bubbles_euler) then
558 allocate (qbmm_idx%rs(nb), qbmm_idx%vs(nb))
559 allocate (qbmm_idx%ps(nb), qbmm_idx%ms(nb))
560
561 if (qbmm) then
562 allocate (qbmm_idx%moms(nb, nmom))
563 allocate (qbmm_idx%fullmom(nb,0:nmom,0:nmom))
564
565 do i = 1, nb
566 do j = 1, nmom
567 qbmm_idx%moms(i, j) = eqn_idx%bub%beg + (j - 1) + (i - 1)*nmom
568 end do
569 qbmm_idx%fullmom(i, 0, 0) = qbmm_idx%moms(i, 1)
570 qbmm_idx%fullmom(i, 1, 0) = qbmm_idx%moms(i, 2)
571 qbmm_idx%fullmom(i, 0, 1) = qbmm_idx%moms(i, 3)
572 qbmm_idx%fullmom(i, 2, 0) = qbmm_idx%moms(i, 4)
573 qbmm_idx%fullmom(i, 1, 1) = qbmm_idx%moms(i, 5)
574 qbmm_idx%fullmom(i, 0, 2) = qbmm_idx%moms(i, 6)
575 qbmm_idx%rs(i) = qbmm_idx%fullmom(i, 1, 0)
576 end do
577 else
578 do i = 1, nb
579 if (.not. polytropic) then
580 fac = 4
581 else
582 fac = 2
583 end if
584
585 qbmm_idx%rs(i) = eqn_idx%bub%beg + (i - 1)*fac
586 qbmm_idx%vs(i) = qbmm_idx%rs(i) + 1
587
588 if (.not. polytropic) then
589 qbmm_idx%ps(i) = qbmm_idx%vs(i) + 1
590 qbmm_idx%ms(i) = qbmm_idx%ps(i) + 1
591 end if
592 end do
593 end if
594 end if
595
596 if (bubbles_lagrange) fd_number = max(1, fd_order/2)
597
600
601#ifdef MFC_MPI
602 if (qbmm .and. .not. polytropic) then
603 allocate (mpi_io_data%view(1:sys_size + 2*nb*nnode))
604 allocate (mpi_io_data%var(1:sys_size + 2*nb*nnode))
605 else
606 allocate (mpi_io_data%view(1:sys_size))
607 allocate (mpi_io_data%var(1:sys_size))
608 end if
609
610 if (.not. down_sample) then
611 do i = 1, sys_size
612 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
613 mpi_io_data%var(i)%sf => null()
614 end do
615 end if
616 if (qbmm .and. .not. polytropic) then
617 do i = sys_size + 1, sys_size + 2*nb*nnode
618 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
619 mpi_io_data%var(i)%sf => null()
620 end do
621 end if
622#endif
623
624 ! Allocating grid variables for the x-direction
625 allocate (x_cc(0:m), x_cb(-1:m))
626 ! Allocating grid variables for the y- and z-directions
627 if (n > 0) then
628 allocate (y_cc(0:n), y_cb(-1:n))
629 if (p > 0) then
630 allocate (z_cc(0:p), z_cb(-1:p))
631 end if
632 end if
633
634 if (cyl_coord .neqv. .true.) then ! Cartesian grid
635 grid_geometry = 1
636 else if (cyl_coord .and. p == 0) then ! Axisymmetric cylindrical grid
637 grid_geometry = 2
638 else ! Fully 3D cylindrical grid
639 grid_geometry = 3
640 end if
641
642 if (.not. igr) then
643 allocate (logic_grid(0:m,0:n,0:p))
644 end if
645
647
648 !> Configure MPI parallel I/O settings and allocate processor coordinate arrays.
653 end subroutine s_initialize_parallel_io
654
655 !> Deallocate all global grid, index, and equation-of-state parameter arrays.
657
658 integer :: i
659
660 if (bubbles_euler) then
661 deallocate (qbmm_idx%rs, qbmm_idx%vs, qbmm_idx%ps, qbmm_idx%ms)
662 if (qbmm) deallocate (qbmm_idx%moms, qbmm_idx%fullmom)
663 end if
664
665 ! Deallocating grid variables for the x-direction
666 deallocate (x_cc, x_cb)
667 ! Deallocating grid variables for the y- and z-directions
668 if (n > 0) then
669 deallocate (y_cc, y_cb)
670 if (p > 0) then
671 deallocate (z_cc, z_cb)
672 end if
673 end if
674
675 ! Shared: deallocate proc_coords and start_idx
677
678#ifdef MFC_MPI
679 if (parallel_io) then
680 do i = 1, sys_size
681 mpi_io_data%var(i)%sf => null()
682 end do
683
684 deallocate (mpi_io_data%var)
685 deallocate (mpi_io_data%view)
686 end if
687#endif
688
689 if (allocated(neighbor_ranks)) deallocate (neighbor_ranks)
690
692
693end 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(particle_cloud_parameters), dimension(num_particle_clouds_max) particle_cloud
Particle bed specifications.
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.
type(int_bounds_info) ib_bc_z
bc_x/y/z before decomposition overwrites them with MPI neighbor ranks
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) ib_bc_y
type(int_bounds_info), dimension(3) nidx
type(int_bounds_info) ib_bc_x
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.