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