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# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
146 bc_x%ve1 = 0._wp
147# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
148# 133 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
149 bc_x%vb2 = 0._wp
150# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
151 bc_x%ve2 = 0._wp
152# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
153# 133 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
154 bc_x%vb3 = 0._wp
155# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
156 bc_x%ve3 = 0._wp
157# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
158# 136 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
159# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
160# 133 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
161 bc_y%vb1 = 0._wp
162# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
163 bc_y%ve1 = 0._wp
164# 135 "/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_y%vb2 = 0._wp
167# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
168 bc_y%ve2 = 0._wp
169# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
170# 133 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
171 bc_y%vb3 = 0._wp
172# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
173 bc_y%ve3 = 0._wp
174# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
175# 136 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
176# 132 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
177# 133 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
178 bc_z%vb1 = 0._wp
179# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
180 bc_z%ve1 = 0._wp
181# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
182# 133 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
183 bc_z%vb2 = 0._wp
184# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
185 bc_z%ve2 = 0._wp
186# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
187# 133 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
188 bc_z%vb3 = 0._wp
189# 134 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
190 bc_z%ve3 = 0._wp
191# 135 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
192# 136 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
193# 137 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
194
195# 139 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
196 bc_x%isothermal_in = .false.
197# 140 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
198 bc_x%isothermal_out = .false.
199# 141 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
200 bc_x%Twall_in = dflt_real
201# 142 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
202 bc_x%Twall_out = dflt_real
203# 143 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
204# 139 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
205 bc_y%isothermal_in = .false.
206# 140 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
207 bc_y%isothermal_out = .false.
208# 141 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
209 bc_y%Twall_in = dflt_real
210# 142 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
211 bc_y%Twall_out = dflt_real
212# 143 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
213# 139 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
214 bc_z%isothermal_in = .false.
215# 140 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
216 bc_z%isothermal_out = .false.
217# 141 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
218 bc_z%Twall_in = dflt_real
219# 142 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
220 bc_z%Twall_out = dflt_real
221# 143 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
222# 144 "/home/runner/work/MFC/MFC/src/pre_process/m_global_parameters.fpp"
223
225
226 ! Logistics (pre-specific)
227 file_extension = '000000'
228 files_dir = './'
229 old_grid = .false.
230 old_ic = .false.
231 t_step_old = dflt_int
232 cfl_dt = .false.
233
234 ! Computational domain parameters (pre-specific)
235 x_domain%beg = dflt_real
236 x_domain%end = dflt_real
237 y_domain%beg = dflt_real
238 y_domain%end = dflt_real
239 z_domain%beg = dflt_real
240 z_domain%end = dflt_real
241
242 stretch_x = .false.
243 stretch_y = .false.
244 stretch_z = .false.
245
246 a_x = dflt_real
247 a_y = dflt_real
248 a_z = dflt_real
249 loops_x = 1
250 loops_y = 1
251 loops_z = 1
252 x_a = dflt_real
253 x_b = dflt_real
254 y_a = dflt_real
255 y_b = dflt_real
256 z_a = dflt_real
257 z_b = dflt_real
258
259 ! Simulation algorithm parameters (pre-specific)
260 palpha_eps = dflt_real
261 ptgalpha_eps = dflt_real
262 igr_order = dflt_int
263 precision = 2
264 mixlayer_vel_profile = .false.
265 mixlayer_vel_coef = 1._wp
266 mixlayer_perturb = .false.
268 mixlayer_perturb_k0 = 0.4446_wp
269 perturb_flow = .false.
270 perturb_flow_fluid = dflt_int
271 perturb_flow_mag = dflt_real
272 perturb_sph = .false.
273 perturb_sph_fluid = dflt_int
274 fluid_rho = dflt_real
275 elliptic_smoothing_iters = dflt_int
276 elliptic_smoothing = .false.
277
278 simplex_perturb = .false.
279 simplex_params%perturb_vel(:) = .false.
280 simplex_params%perturb_vel_freq(:) = dflt_real
281 simplex_params%perturb_vel_scale(:) = dflt_real
282 simplex_params%perturb_vel_offset(:,:) = dflt_real
283 simplex_params%perturb_dens(:) = .false.
284 simplex_params%perturb_dens_freq(:) = dflt_real
285 simplex_params%perturb_dens_scale(:) = dflt_real
286 simplex_params%perturb_dens_offset(:,:) = dflt_real
287
288 ! Initial condition parameters
289 num_patches = dflt_int
290
291 fd_order = dflt_int
292 lag_params%cluster_type = dflt_int
293 lag_params%pressure_corrector = .false.
294 lag_params%smooth_type = dflt_int
295 lag_params%heatTransfer_model = .false.
296 lag_params%massTransfer_model = .false.
297 lag_params%write_bubbles = .false.
298 lag_params%write_bubbles_stats = .false.
299 lag_params%write_void_evol = .false.
300 lag_params%pressure_force = .false.
301 lag_params%gravity_force = .false.
302 lag_params%nBubs_glb = dflt_int
303 lag_params%vel_model = dflt_int
304 lag_params%drag_model = dflt_int
305 lag_params%epsilonb = 1._wp
306 lag_params%charwidth = dflt_real
307 lag_params%charNz = dflt_int
308 lag_params%valmaxvoid = dflt_real
309
310 do i = 1, num_patches_max
311 patch_icpp(i)%geometry = dflt_int
312 patch_icpp(i)%model_id = 0
313 patch_icpp(i)%x_centroid = dflt_real
314 patch_icpp(i)%y_centroid = dflt_real
315 patch_icpp(i)%z_centroid = dflt_real
316 patch_icpp(i)%length_x = dflt_real
317 patch_icpp(i)%length_y = dflt_real
318 patch_icpp(i)%length_z = dflt_real
319 patch_icpp(i)%radius = dflt_real
320 patch_icpp(i)%epsilon = dflt_real
321 patch_icpp(i)%beta = dflt_real
322 patch_icpp(i)%normal = dflt_real
323 patch_icpp(i)%radii = dflt_real
324 patch_icpp(i)%alter_patch = .false.
325 patch_icpp(i)%alter_patch(0) = .true.
326 patch_icpp(i)%smoothen = .false.
327 patch_icpp(i)%smooth_patch_id = i
328 patch_icpp(i)%smooth_coeff = dflt_real
329 patch_icpp(i)%alpha_rho = dflt_real
330 patch_icpp(i)%rho = dflt_real
331 patch_icpp(i)%vel = dflt_real
332 patch_icpp(i)%pres = dflt_real
333 patch_icpp(i)%alpha = dflt_real
334 patch_icpp(i)%gamma = dflt_real
335 patch_icpp(i)%pi_inf = dflt_real
336 patch_icpp(i)%cv = 0._wp
337 patch_icpp(i)%qv = 0._wp
338 patch_icpp(i)%qvp = 0._wp
339 patch_icpp(i)%tau_e = 0._wp
340 patch_icpp(i)%Bx = dflt_real
341 patch_icpp(i)%By = dflt_real
342 patch_icpp(i)%Bz = dflt_real
343 patch_icpp(i)%a(2) = dflt_real
344 patch_icpp(i)%a(3) = dflt_real
345 patch_icpp(i)%a(4) = dflt_real
346 patch_icpp(i)%a(5) = dflt_real
347 patch_icpp(i)%a(6) = dflt_real
348 patch_icpp(i)%a(7) = dflt_real
349 patch_icpp(i)%a(8) = dflt_real
350 patch_icpp(i)%a(9) = dflt_real
351 patch_icpp(i)%non_axis_sym = .false.
352 patch_icpp(i)%fourier_cos(:) = 0._wp
353 patch_icpp(i)%fourier_sin(:) = 0._wp
354 patch_icpp(i)%modal_clip_r_to_min = .false.
355 patch_icpp(i)%modal_r_min = 1.e-12_wp
356 patch_icpp(i)%modal_use_exp_form = .false.
357 patch_icpp(i)%sph_har_coeff(:,:) = 0._wp
358
359 ! should get all of r0's and v0's
360 patch_icpp(i)%r0 = dflt_real
361 patch_icpp(i)%v0 = dflt_real
362
363 patch_icpp(i)%p0 = dflt_real
364 patch_icpp(i)%m0 = dflt_real
365
366 patch_icpp(i)%hcid = dflt_int
367
368 if (chemistry) then
369 patch_icpp(i)%Y(:) = 0._wp
370 end if
371 end do
372
374 bc_io = .false.
375
376 do i = 1, num_bc_patches_max
377 patch_bc(i)%geometry = dflt_int
378 patch_bc(i)%type = dflt_int
379 patch_bc(i)%dir = dflt_int
380 patch_bc(i)%loc = dflt_int
381 patch_bc(i)%centroid(:) = dflt_real
382 patch_bc(i)%length(:) = dflt_real
383 patch_bc(i)%radius = dflt_real
384 end do
385
386 ! Bubble modeling (pre-specific)
387 polytropic = .true.
388 thermal = dflt_int
389 nb = dflt_int
390
391 eu = dflt_real
392 ca = dflt_real
393 re_inv = dflt_real
394 web = dflt_real
395
396 nmom = 1
397 sigv = dflt_real
398 rhorv = 0._wp
399 dist_type = dflt_int
400
401 r_g = dflt_real
402 r_v = dflt_real
403 phi_vg = dflt_real
404 phi_gv = dflt_real
405 pe_c = dflt_real
406 tw = dflt_real
407
408 pi_fac = 1._wp
409
410 do i = 1, num_ib_patches_max_namelist
411 patch_ib(i)%geometry = dflt_int
412 patch_ib(i)%x_centroid = 0._wp
413 patch_ib(i)%y_centroid = 0._wp
414 patch_ib(i)%z_centroid = 0._wp
415 patch_ib(i)%length_x = dflt_real
416 patch_ib(i)%length_y = dflt_real
417 patch_ib(i)%length_z = dflt_real
418 patch_ib(i)%radius = dflt_real
419 patch_ib(i)%airfoil_id = 0
420 patch_ib(i)%model_id = 0
421 patch_ib(i)%slip = .false.
422
423 patch_ib(i)%thermal_bc = 0
424 patch_ib(i)%Twall = 0._wp
425 patch_ib(i)%surface_reaction = 0
426
427 patch_ib(i)%v_blow = 0._wp
428 patch_ib(i)%inj_species = 0
429 patch_ib(i)%burn_rate_exp = 0._wp
430 patch_ib(i)%burn_rate_pref = 0._wp
431
432 ! Variables to handle moving immersed boundaries, defaulting to no movement
433 patch_ib(i)%moving_ibm = 0
434 patch_ib(i)%vel(:) = 0._wp
435 patch_ib(i)%angles(:) = 0._wp
436 patch_ib(i)%angular_vel(:) = 0._wp
437 patch_ib(i)%kin_model = 0
438 patch_ib(i)%kin_hinge(:) = 0._wp
439 patch_ib(i)%kin_offset(:) = 0._wp
440 patch_ib(i)%kin_phi0 = 0._wp
441 patch_ib(i)%kin_theta0 = 0._wp
442 patch_ib(i)%kin_theta_mean = 0._wp
443 patch_ib(i)%kin_freq = 0._wp
444 patch_ib(i)%kin_phase = 0._wp
445 patch_ib(i)%kin_t0 = 0._wp
446 patch_ib(i)%kin_ramp = 0._wp
447 patch_ib(i)%kin_pitch_rate = 0._wp
448 patch_ib(i)%kin_smooth = 0._wp
449 patch_ib(i)%mass = dflt_real
450 patch_ib(i)%moment = dflt_real
451 patch_ib(i)%centroid_offset(:) = 0._wp
452
453 ! sets values of a rotation matrix which can be used when calculating rotations
454 patch_ib(i)%rotation_matrix = 0._wp
455 patch_ib(i)%rotation_matrix(1, 1) = 1._wp
456 patch_ib(i)%rotation_matrix(2, 2) = 1._wp
457 patch_ib(i)%rotation_matrix(3, 3) = 1._wp
458 patch_ib(i)%rotation_matrix_inverse = patch_ib(i)%rotation_matrix
459 end do
460
462 do i = 1, num_particle_clouds_max
463 particle_cloud(i)%x_centroid = 0._wp
464 particle_cloud(i)%y_centroid = 0._wp
465 particle_cloud(i)%z_centroid = 0._wp
466 particle_cloud(i)%length_x = dflt_real
467 particle_cloud(i)%length_y = dflt_real
468 particle_cloud(i)%length_z = dflt_real
469 particle_cloud(i)%num_particles = 0
470 particle_cloud(i)%radius = dflt_real
471 particle_cloud(i)%mass = dflt_real
472 particle_cloud(i)%min_spacing = 0._wp
473 particle_cloud(i)%shell_inner_radius = dflt_real
474 particle_cloud(i)%shell_outer_radius = dflt_real
475 particle_cloud(i)%moving_ibm = 0
476 particle_cloud(i)%seed = 0
477 particle_cloud(i)%cloud_geometry = 1
478 particle_cloud(i)%packing_method = dflt_int
479 particle_cloud(i)%periodic = 0
480 end do
481
482 do i = 1, num_ib_airfoils_max
483 ib_airfoil(i)%c = dflt_real
484 ib_airfoil(i)%p = dflt_real
485 ib_airfoil(i)%t = dflt_real
486 ib_airfoil(i)%m = dflt_real
487 end do
488
490
491 do i = 1, num_stl_models_max
492 stl_models(i)%model_filepath(:) = dflt_char
493 stl_models(i)%model_translate(:) = 0._wp
494 stl_models(i)%model_scale(:) = 1._wp
495 stl_models(i)%model_threshold = ray_tracing_threshold
496 end do
497
498 chem_params%gamma_method = 1
499 chem_params%transport_model = 1
500
501 chem_params%reaction_substeps = 0
502 chem_params%adap_substeps = .false.
503 chem_params%reaction_substeps_max = 0
504
505 ! Fluids physical parameters
506 do i = 1, num_fluids_max
507 fluid_pp(i)%eos = eos_stiffened_gas
508 fluid_pp(i)%mg_rho0 = dflt_real
509 fluid_pp(i)%mg_c0 = dflt_real
510 fluid_pp(i)%mg_s = dflt_real
511 fluid_pp(i)%mg_gruneisen = dflt_real
512 fluid_pp(i)%mg_gruneisen_a = 0._wp
513 fluid_pp(i)%mg_t0 = 0._wp
514 fluid_pp(i)%mg_s2 = 0._wp
515 fluid_pp(i)%mg_s3 = 0._wp
516 fluid_pp(i)%jwl_a = dflt_real
517 fluid_pp(i)%jwl_b = dflt_real
518 fluid_pp(i)%jwl_r1 = dflt_real
519 fluid_pp(i)%jwl_r2 = dflt_real
520 fluid_pp(i)%jwl_omega = dflt_real
521 fluid_pp(i)%jwl_rho0 = dflt_real
522 fluid_pp(i)%jwl_t0 = 0._wp
523 fluid_pp(i)%vinet_k0 = dflt_real
524 fluid_pp(i)%vinet_k0p = dflt_real
525 fluid_pp(i)%vinet_rho0 = dflt_real
526 fluid_pp(i)%vinet_gruneisen = dflt_real
527 fluid_pp(i)%vinet_gruneisen_a = 0._wp
528 fluid_pp(i)%vinet_t0 = 0._wp
529 fluid_pp(i)%gamma = dflt_real
530 fluid_pp(i)%pi_inf = dflt_real
531 fluid_pp(i)%cv = 0._wp
532 fluid_pp(i)%qv = 0._wp
533 fluid_pp(i)%qvp = 0._wp
534 fluid_pp(i)%k_therm = 0._wp
535 fluid_pp(i)%G = 0._wp
536 fluid_pp(i)%non_newtonian = .false.
537 fluid_pp(i)%K = dflt_real
538 fluid_pp(i)%nn = dflt_real
539 fluid_pp(i)%tau0 = 0._wp
540 fluid_pp(i)%hb_m = dflt_real
541 fluid_pp(i)%mu_min = dflt_real
542 fluid_pp(i)%mu_max = dflt_real
543 fluid_pp(i)%mu_bulk = dflt_real
544 end do
545
546 ! Subgrid bubble parameters
547 bub_pp%R0ref = dflt_real; r0ref = dflt_real
548 bub_pp%p0ref = dflt_real; p0ref = dflt_real
549 bub_pp%rho0ref = dflt_real; rho0ref = dflt_real
550 bub_pp%T0ref = dflt_real; t0ref = dflt_real
551 bub_pp%ss = dflt_real; ss = dflt_real
552 bub_pp%pv = dflt_real; pv = dflt_real
553 bub_pp%vd = dflt_real; vd = dflt_real
554 bub_pp%mu_l = dflt_real; mu_l = dflt_real
555 bub_pp%mu_v = dflt_real; mu_v = dflt_real
556 bub_pp%mu_g = dflt_real; mu_g = dflt_real
557 bub_pp%gam_v = dflt_real; gam_v = dflt_real
558 bub_pp%gam_g = dflt_real; gam_g = dflt_real
559 bub_pp%M_v = dflt_real; m_v = dflt_real
560 bub_pp%M_g = dflt_real; m_g = dflt_real
561 bub_pp%k_v = dflt_real
562 bub_pp%k_g = dflt_real
563 bub_pp%cp_v = dflt_real; cp_v = dflt_real
564 bub_pp%cp_g = dflt_real; cp_g = dflt_real
565 bub_pp%R_v = dflt_real; r_v = dflt_real
566 bub_pp%R_g = dflt_real; r_g = dflt_real
567
569
570 !> Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the module
572
573 integer :: i, j, fac
574
575 if (recon_type == recon_type_weno) then
576 weno_polyn = (weno_order - 1)/2
577 else if (recon_type == recon_type_muscl) then
579 end if
580
581 ! Gamma/Pi_inf: force num_fluids=1 (pre_process-specific side effect of the gamma-law model)
582 if (model_eqns == model_eqns_gamma_law) num_fluids = 1
583
584 ! Pre-process sets nmom to 6 for qbmm before the shared eqn_idx setup
585 ! (guards match the original site: 5-equation bubbles with 4-node qbmm)
586 if (model_eqns == model_eqns_5eq .and. bubbles_euler .and. qbmm .and. nnode == 4) nmom = 6
587
588 ! Populate eqn_idx, sys_size, shear_* (shared logic)
589 call s_initialize_eqn_idx(nmom, nb, six_eqn_alf_is_advected=.false.)
590
591 ! Per-target (pre_process): qbmm_idx allocations and fills
592 if (model_eqns == model_eqns_5eq .and. bubbles_euler) then
593 allocate (qbmm_idx%rs(nb), qbmm_idx%vs(nb))
594 allocate (qbmm_idx%ps(nb), qbmm_idx%ms(nb))
595
596 if (qbmm) then
597 allocate (qbmm_idx%moms(nb, nmom))
598 allocate (qbmm_idx%fullmom(nb,0:nmom,0:nmom))
599
600 do i = 1, nb
601 do j = 1, nmom
602 qbmm_idx%moms(i, j) = eqn_idx%bub%beg + (j - 1) + (i - 1)*nmom
603 end do
604 qbmm_idx%fullmom(i, 0, 0) = qbmm_idx%moms(i, 1)
605 qbmm_idx%fullmom(i, 1, 0) = qbmm_idx%moms(i, 2)
606 qbmm_idx%fullmom(i, 0, 1) = qbmm_idx%moms(i, 3)
607 qbmm_idx%fullmom(i, 2, 0) = qbmm_idx%moms(i, 4)
608 qbmm_idx%fullmom(i, 1, 1) = qbmm_idx%moms(i, 5)
609 qbmm_idx%fullmom(i, 0, 2) = qbmm_idx%moms(i, 6)
610 qbmm_idx%rs(i) = qbmm_idx%fullmom(i, 1, 0)
611 end do
612 else
613 do i = 1, nb
614 if (.not. polytropic) then
615 fac = 4
616 else
617 fac = 2
618 end if
619
620 qbmm_idx%rs(i) = eqn_idx%bub%beg + (i - 1)*fac
621 qbmm_idx%vs(i) = qbmm_idx%rs(i) + 1
622
623 if (.not. polytropic) then
624 qbmm_idx%ps(i) = qbmm_idx%vs(i) + 1
625 qbmm_idx%ms(i) = qbmm_idx%ps(i) + 1
626 end if
627 end do
628 end if
629 end if
630
631 if (bubbles_lagrange) fd_number = max(1, fd_order/2)
632
635
636#ifdef MFC_MPI
637 if (qbmm .and. .not. polytropic) then
638 allocate (mpi_io_data%view(1:sys_size + 2*nb*nnode))
639 allocate (mpi_io_data%var(1:sys_size + 2*nb*nnode))
640 else
641 allocate (mpi_io_data%view(1:sys_size))
642 allocate (mpi_io_data%var(1:sys_size))
643 end if
644
645 if (.not. down_sample) then
646 do i = 1, sys_size
647 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
648 mpi_io_data%var(i)%sf => null()
649 end do
650 end if
651 if (qbmm .and. .not. polytropic) then
652 do i = sys_size + 1, sys_size + 2*nb*nnode
653 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
654 mpi_io_data%var(i)%sf => null()
655 end do
656 end if
657#endif
658
659 ! Allocating grid variables for the x-direction
660 allocate (x_cc(0:m), x_cb(-1:m))
661 ! Allocating grid variables for the y- and z-directions
662 if (n > 0) then
663 allocate (y_cc(0:n), y_cb(-1:n))
664 if (p > 0) then
665 allocate (z_cc(0:p), z_cb(-1:p))
666 end if
667 end if
668
669 if (cyl_coord .neqv. .true.) then ! Cartesian grid
670 grid_geometry = 1
671 else if (cyl_coord .and. p == 0) then ! Axisymmetric cylindrical grid
672 grid_geometry = 2
673 else ! Fully 3D cylindrical grid
674 grid_geometry = 3
675 end if
676
677 if (.not. igr) then
678 allocate (logic_grid(0:m,0:n,0:p))
679 end if
680
682
683 !> Configure MPI parallel I/O settings and allocate processor coordinate arrays.
688 end subroutine s_initialize_parallel_io
689
690 !> Deallocate all global grid, index, and equation-of-state parameter arrays.
692
693 integer :: i
694
695 if (bubbles_euler) then
696 deallocate (qbmm_idx%rs, qbmm_idx%vs, qbmm_idx%ps, qbmm_idx%ms)
697 if (qbmm) deallocate (qbmm_idx%moms, qbmm_idx%fullmom)
698 end if
699
700 ! Deallocating grid variables for the x-direction
701 deallocate (x_cc, x_cb)
702 ! Deallocating grid variables for the y- and z-directions
703 if (n > 0) then
704 deallocate (y_cc, y_cb)
705 if (p > 0) then
706 deallocate (z_cc, z_cb)
707 end if
708 end if
709
710 ! Shared: deallocate proc_coords and start_idx
712
713#ifdef MFC_MPI
714 if (parallel_io) then
715 do i = 1, sys_size
716 mpi_io_data%var(i)%sf => null()
717 end do
718
719 deallocate (mpi_io_data%var)
720 deallocate (mpi_io_data%view)
721 end if
722#endif
723
724 if (allocated(neighbor_ranks)) deallocate (neighbor_ranks)
725
727
728end 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.