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/post_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# 9 "/home/runner/work/MFC/MFC/src/common/include/case.fpp"
13
14! For moving immersed boundaries in simulation
15# 14 "/home/runner/work/MFC/MFC/src/common/include/case.fpp"
16# 6 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp" 2
17
18!> @brief Global parameters for the post-process: domain geometry, equation of state, and output database settings
20
21#ifdef MFC_MPI
22 use mpi !< message passing interface (mpi) module
23#endif
24
27 use m_thermochem, only: num_species, species_names
28
29 implicit none
30
31 !> @name Logistics
32 !> @{
33 integer :: num_procs !< Number of processors
34 character(LEN=path_len) :: case_dir !< Case folder location
35 !> @}
36
37 ! Computational Domain Parameters
38
39 integer :: proc_rank !< Rank of the local processor
40 !> @name Number of cells in the x-, y- and z-coordinate directions
41 !> @{
42 integer :: m, m_root
43 integer :: n
44 integer :: p
45 !> @}
46
47 !> @name Max and min number of cells in a direction of each combination of x-,y-, and z-
49 integer(kind=8) :: nglobal !< Total number of cells in global domain
50
51 !> @name Cylindrical coordinates (either axisymmetric or full 3D)
52 !> @{
53 logical :: cyl_coord
54 integer :: grid_geometry
55 !> @}
56
57 !> @name Global number of cells in each direction
58 !> @{
59 integer :: m_glb, n_glb, p_glb
60 !> @}
61
62 integer :: num_dims !< Number of spatial dimensions
63 integer :: num_vels !< Number of velocity components (different from num_dims for mhd)
64 !> @name Cell-boundary locations in the x-, y- and z-coordinate directions
65 !> @{
66 real(wp), allocatable, dimension(:) :: x_cb, x_root_cb, y_cb, z_cb
67 !> @}
68
69 !> @name Cell-center locations in the x-, y- and z-coordinate directions
70 !> @{
71 real(wp), allocatable, dimension(:) :: x_cc, x_root_cc, y_cc, z_cc
72 real(sp), allocatable, dimension(:) :: x_root_cc_s, x_cc_s
73 !> @}
74
75 !> Cell-width distributions in the x-, y- and z-coordinate directions
76 !> @{
77 real(wp), allocatable, dimension(:) :: dx, dy, dz
78 !> @}
79
80 integer :: buff_size !< Number of ghost cells for boundary condition storage
81 integer :: t_step_start !< First time-step directory
82 integer :: t_step_stop !< Last time-step directory
83 integer :: t_step_save !< Interval between consecutive time-step directory
84 !> @name IO options for adaptive time-stepping
85 !> @{
87 real(wp) :: t_save
88 real(wp) :: t_stop
89 real(wp) :: cfl_target
90 integer :: n_save
91 integer :: n_start
92 !> @}
93
94 ! NOTE: m_root, x_root_cb, x_root_cc = defragmented grid (1D only; equals m, x_cb, x_cc in serial)
95
96 !> @name Simulation Algorithm Parameters
97 !> @{
98 integer :: model_eqns !< Multicomponent flow model
99 integer :: num_fluids !< Number of different fluids present in the flow
100 logical :: relax !< phase change
101 integer :: relax_model !< Phase change relaxation model
102 logical :: mpp_lim !< Maximum volume fraction limiter
103 integer :: sys_size !< Number of unknowns in the system of equations
104 integer :: recon_type !< Which type of reconstruction to use
105 integer :: weno_order !< Order of accuracy for the WENO reconstruction
106 integer :: muscl_order !< Order of accuracy for the MUSCL reconstruction
107 logical :: mixture_err !< Mixture error limiter
108 logical :: alt_soundspeed !< Alternate sound speed
109 logical :: mhd !< Magnetohydrodynamics
110 logical :: relativity !< Relativity for RMHD
111 logical :: hypoelasticity !< Turn hypoelasticity on
112 logical :: hyperelasticity !< Turn hyperelasticity on
113 logical :: elasticity !< elasticity modeling, true for hyper or hypo
114 integer :: b_size !< Number of components in the b tensor
115 integer :: tensor_size !< Number of components in the nonsymmetric tensor
116 logical :: cont_damage !< Continuum damage modeling
117 logical :: hyper_cleaning !< Hyperbolic cleaning for MHD
118 logical :: igr !< enable IGR
119 integer :: igr_order !< IGR reconstruction order
120 logical, parameter :: chemistry = .false. !< Chemistry modeling
121 !> @}
122
123 integer :: avg_state !< Average state evaluation method
124 !> @name Annotations of the structure, i.e. the organization, of the state vectors
125 !> @{
126 type(eqn_idx_info) :: eqn_idx !< All conserved-variable equation index ranges and scalars.
127 type(qbmm_idx_info) :: qbmm_idx !< QBMM moment index mappings.
128 integer :: beta_idx !< Index of lagrange bubbles beta
129 !> @}
130
131 ! Cell Indices for the (local) interior points (O-m, O-n, 0-p). Stands for "InDices With BUFFer".
133
134 ! Cell indices (InDices With BUFFer): includes buffer in simulation only
136 integer :: num_bc_patches
137 logical :: bc_io
138 !> @name Boundary conditions in the x-, y- and z-coordinate directions
139 !> @{
141 !> @}
142
143 integer :: shear_num !< Number of shear stress components
144 integer, dimension(3) :: shear_indices !< Indices of the stress components that represent shear stress
145 integer :: shear_bc_flip_num !< Number of shear stress components to reflect for boundary conditions
146 integer, dimension(3, 2) :: shear_bc_flip_indices !< Shear stress BC reflection indices (1:3, 1:shear_BC_flip_num)
147 logical :: parallel_io !< Format of the data files
148 logical :: sim_data
149 logical :: file_per_process !< output format
150 integer, allocatable, dimension(:) :: proc_coords !< Processor coordinates in MPI_CART_COMM
151 integer, allocatable, dimension(:) :: start_idx !< Starting cell-center index of local processor in global grid
152 integer :: num_ibs !< Number of immersed boundaries
153#ifdef MFC_MPI
154 type(mpi_io_var), public :: mpi_io_data
158 real(wp), allocatable, dimension(:,:), public :: mpi_io_data_lg_bubbles
159#endif
160
161 !> @name MPI info for parallel IO with Lustre file systems
162 !> @{
163 character(LEN=name_len) :: mpiiofs
164 integer :: mpi_info_int
165 !> @}
166
167 type(physical_parameters), dimension(num_fluids_max) :: fluid_pp !< Stiffened gas EOS parameters and Reynolds numbers per fluid
168 ! Subgrid Bubble Parameters
170 real(wp), allocatable, dimension(:) :: adv !< Advection variables
171 ! Formatted Database File(s) Structure Parameters
172
173 integer :: format !< Format of the database file(s)
174 integer :: precision !< Floating point precision of the database file(s)
175 logical :: down_sample !< down sampling of the database file(s)
176 logical :: output_partial_domain !< Specify portion of domain to output for post-processing
177 type(bounds_info) :: x_output, y_output, z_output !< Portion of domain to output for post-processing
178 type(int_bounds_info) :: x_output_idx, y_output_idx, z_output_idx !< Indices of domain to output for post-processing
179 !> @name Size of the ghost zone layer in the x-, y- and z-coordinate directions. The definition of the ghost zone layers is only
180 !! necessary when using the Silo database file format in multidimensions. These zones provide VisIt with the subdomain
181 !! connectivity information that it requires in order to produce smooth plots.
182 !> @{
184 !> @}
185
186 !> @name The list of all possible flow variables that may be written to a database file. It includes partial densities, density,
187 !! momentum, velocity, energy, pressure, volume fraction(s), specific heat ratio function, specific heat ratio, liquid stiffness
188 !! function, liquid stiffness, primitive variables, conservative variables, speed of sound, the vorticity, and the numerical
189 !! Schlieren function.
190 !> @{
191 logical, dimension(num_fluids_max) :: alpha_rho_wrt
192 logical :: rho_wrt
193 logical, dimension(3) :: mom_wrt
194 logical, dimension(3) :: vel_wrt
195 integer :: flux_lim
196 logical, dimension(3) :: flux_wrt
197 logical :: e_wrt
198 logical, dimension(num_fluids_max) :: alpha_rho_e_wrt
199 logical :: fft_wrt
200 logical :: dummy !< AMDFlang workaround for case-optimization + GPU-kernel bug
201 logical :: pres_wrt
202 logical, dimension(num_fluids_max) :: alpha_wrt
203 logical :: gamma_wrt
204 logical :: heat_ratio_wrt
205 logical :: pi_inf_wrt
206 logical :: pres_inf_wrt
207 logical :: prim_vars_wrt
208 logical :: cons_vars_wrt
209 logical :: c_wrt
210 logical, dimension(3) :: omega_wrt
211 logical :: qm_wrt
212 logical :: liutex_wrt
213 logical :: schlieren_wrt
214 logical :: cf_wrt
215 logical :: ib
216 logical :: ib_state_wrt
217 logical :: chem_wrt_y(1:num_species)
218 logical :: chem_wrt_t
219 logical :: lag_header
220 logical :: lag_txt_wrt
221 logical :: lag_db_wrt
222 logical :: lag_id_wrt
223 logical :: lag_pos_wrt
225 logical :: lag_vel_wrt
226 logical :: lag_rad_wrt
227 logical :: lag_rvel_wrt
228 logical :: lag_r0_wrt
229 logical :: lag_rmax_wrt
230 logical :: lag_rmin_wrt
231 logical :: lag_dphidt_wrt
232 logical :: lag_pres_wrt
233 logical :: lag_mv_wrt
234 logical :: lag_mg_wrt
235 logical :: lag_betat_wrt
236 logical :: lag_betac_wrt
237 !> @}
238
239 real(wp), dimension(num_fluids_max) :: schlieren_alpha !< Per-fluid Schlieren intensity amplitude coefficients
240 integer :: fd_order !< Finite-difference order for vorticity and Schlieren derivatives
241 integer :: fd_number !< Finite-difference half-stencil size: MAX(1, fd_order/2)
242 !> @name Reference parameters for Tait EOS
243 !> @{
244 real(wp) :: rhoref, pref
245 !> @}
246
248 !> @name Bubble modeling variables and parameters
249 !> @{
250 integer :: nb
251 real(wp) :: eu, ca, web, re_inv
252 real(wp), dimension(:), allocatable :: weight, r0
253 logical :: bubbles_euler
254 logical :: qbmm
255 logical :: polytropic
256 logical :: polydisperse
257 logical :: adv_n
258 integer :: thermal !< 1 = adiabatic, 2 = isotherm, 3 = transfer
259 real(wp) :: phi_vg, phi_gv, pe_c, tw, k_vl, k_gl
260 real(wp) :: gam_m
261 real(wp), dimension(:), allocatable :: pb0, mass_g0, mass_v0, pe_t, k_v, k_g
262 real(wp), dimension(:), allocatable :: re_trans_t, re_trans_c, im_trans_t, im_trans_c, omegan
264 real(wp) :: g
265 real(wp) :: poly_sigma
266 real(wp) :: sigr
267 integer :: nmom
268 !> @}
269
270 !> @name surface tension coefficient
271 !> @{
272 real(wp) :: sigma
274 !> @}
275
276 !> @name Lagrangian bubbles
277 !> @{
279 !> @}
280
281 real(wp) :: bx0 !< Constant magnetic field in the x-direction (1D)
282 real(wp) :: wall_time, wall_time_avg !< Wall time measurements
283
284contains
285
286 !> Assigns default values to user inputs prior to reading them in. This allows for an easier consistency check of these
287 !! parameters once they are read from the input file.
289
290 integer :: i !< Generic loop iterator
291 ! Logistics
292
293 case_dir = '.'
294
295 ! Computational domain parameters
296 m = dflt_int; n = 0; p = 0
298
299 m_root = dflt_int
300 cyl_coord = .false.
301
302 t_step_start = dflt_int
303 t_step_stop = dflt_int
304 t_step_save = dflt_int
305
306 cfl_adap_dt = .false.
307 cfl_const_dt = .false.
308 cfl_dt = .false.
309 cfl_target = dflt_real
310 t_save = dflt_real
311 n_start = dflt_int
312 t_stop = dflt_real
313
314 ! Simulation algorithm parameters
315 model_eqns = dflt_int
316 num_fluids = dflt_int
317 recon_type = weno_type
318 weno_order = dflt_int
319 muscl_order = dflt_int
320 mixture_err = .false.
321 alt_soundspeed = .false.
322 relax = .false.
323 relax_model = dflt_int
324
325 mhd = .false.
326 relativity = .false.
327
328 hypoelasticity = .false.
329 hyperelasticity = .false.
330 elasticity = .false.
331 b_size = dflt_int
332 tensor_size = dflt_int
333 cont_damage = .false.
334 hyper_cleaning = .false.
335 igr = .false.
336
337 bc_x%beg = dflt_int; bc_x%end = dflt_int
338 bc_y%beg = dflt_int; bc_y%end = dflt_int
339 bc_z%beg = dflt_int; bc_z%end = dflt_int
340 bc_io = .false.
341 num_bc_patches = dflt_int
342
343# 333 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
344# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
345 bc_x%vb1 = 0._wp
346 bc_x%ve1 = 0._wp
347# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
348 bc_x%vb2 = 0._wp
349 bc_x%ve2 = 0._wp
350# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
351 bc_x%vb3 = 0._wp
352 bc_x%ve3 = 0._wp
353# 337 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
354# 333 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
355# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
356 bc_y%vb1 = 0._wp
357 bc_y%ve1 = 0._wp
358# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
359 bc_y%vb2 = 0._wp
360 bc_y%ve2 = 0._wp
361# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
362 bc_y%vb3 = 0._wp
363 bc_y%ve3 = 0._wp
364# 337 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
365# 333 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
366# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
367 bc_z%vb1 = 0._wp
368 bc_z%ve1 = 0._wp
369# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
370 bc_z%vb2 = 0._wp
371 bc_z%ve2 = 0._wp
372# 334 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
373 bc_z%vb3 = 0._wp
374 bc_z%ve3 = 0._wp
375# 337 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
376# 338 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
377
378# 340 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
379 bc_y%isothermal_in = .false.
380 bc_y%isothermal_out = .false.
381 bc_y%Twall_in = dflt_real
382 bc_y%Twall_out = dflt_real
383# 340 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
384 bc_x%isothermal_in = .false.
385 bc_x%isothermal_out = .false.
386 bc_x%Twall_in = dflt_real
387 bc_x%Twall_out = dflt_real
388# 340 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
389 bc_z%isothermal_in = .false.
390 bc_z%isothermal_out = .false.
391 bc_z%Twall_in = dflt_real
392 bc_z%Twall_out = dflt_real
393# 345 "/home/runner/work/MFC/MFC/src/post_process/m_global_parameters.fpp"
394
395 chem_params%gamma_method = 1
396 chem_params%transport_model = 1
397
398 ! Fluids physical parameters
399 do i = 1, num_fluids_max
400 fluid_pp(i)%gamma = dflt_real
401 fluid_pp(i)%pi_inf = dflt_real
402 fluid_pp(i)%cv = 0._wp
403 fluid_pp(i)%qv = 0._wp
404 fluid_pp(i)%qvp = 0._wp
405 fluid_pp(i)%G = dflt_real
406 end do
407
408 ! Subgrid bubble parameters
409 bub_pp%R0ref = dflt_real; r0ref = dflt_real
410 bub_pp%p0ref = dflt_real; p0ref = dflt_real
411 bub_pp%rho0ref = dflt_real; rho0ref = dflt_real
412 bub_pp%T0ref = dflt_real; t0ref = dflt_real
413 bub_pp%ss = dflt_real; ss = dflt_real
414 bub_pp%pv = dflt_real; pv = dflt_real
415 bub_pp%vd = dflt_real; vd = dflt_real
416 bub_pp%mu_l = dflt_real; mu_l = dflt_real
417 bub_pp%mu_v = dflt_real; mu_v = dflt_real
418 bub_pp%mu_g = dflt_real; mu_g = dflt_real
419 bub_pp%gam_v = dflt_real; gam_v = dflt_real
420 bub_pp%gam_g = dflt_real; gam_g = dflt_real
421 bub_pp%M_v = dflt_real; m_v = dflt_real
422 bub_pp%M_g = dflt_real; m_g = dflt_real
423 bub_pp%k_v = dflt_real
424 bub_pp%k_g = dflt_real
425 bub_pp%cp_v = dflt_real; cp_v = dflt_real
426 bub_pp%cp_g = dflt_real; cp_g = dflt_real
427 bub_pp%R_v = dflt_real; r_v = dflt_real
428 bub_pp%R_g = dflt_real; r_g = dflt_real
429
430 ! Formatted database file(s) structure parameters
431 format = dflt_int
432
433 precision = dflt_int
434 down_sample = .false.
435
436 alpha_rho_wrt = .false.
437 alpha_rho_e_wrt = .false.
438 rho_wrt = .false.
439 mom_wrt = .false.
440 vel_wrt = .false.
441 chem_wrt_y = .false.
442 chem_wrt_t = .false.
443 flux_lim = dflt_int
444 flux_wrt = .false.
445 parallel_io = .false.
446 file_per_process = .false.
447 e_wrt = .false.
448 fft_wrt = .false.
449 dummy = .false.
450 pres_wrt = .false.
451 alpha_wrt = .false.
452 gamma_wrt = .false.
453 heat_ratio_wrt = .false.
454 pi_inf_wrt = .false.
455 pres_inf_wrt = .false.
456 prim_vars_wrt = .false.
457 cons_vars_wrt = .false.
458 c_wrt = .false.
459 omega_wrt = .false.
460 qm_wrt = .false.
461 liutex_wrt = .false.
462 schlieren_wrt = .false.
463 sim_data = .false.
464 cf_wrt = .false.
465 ib = .false.
466 ib_state_wrt = .false.
467 lag_txt_wrt = .false.
468 lag_header = .true.
469 lag_db_wrt = .false.
470 lag_id_wrt = .true.
471 lag_pos_wrt = .true.
472 lag_pos_prev_wrt = .false.
473 lag_vel_wrt = .true.
474 lag_rad_wrt = .true.
475 lag_rvel_wrt = .false.
476 lag_r0_wrt = .false.
477 lag_rmax_wrt = .false.
478 lag_rmin_wrt = .false.
479 lag_dphidt_wrt = .false.
480 lag_pres_wrt = .false.
481 lag_mv_wrt = .false.
482 lag_mg_wrt = .false.
483 lag_betat_wrt = .false.
484 lag_betac_wrt = .false.
485
486 schlieren_alpha = dflt_real
487
488 fd_order = dflt_int
489 avg_state = dflt_int
490
491 ! Tait EOS
492 rhoref = dflt_real
493 pref = dflt_real
494
495 ! Bubble modeling
496 bubbles_euler = .false.
497 qbmm = .false.
498 r0ref = dflt_real
499 nb = dflt_int
500 polydisperse = .false.
501 poly_sigma = dflt_real
502 sigr = dflt_real
503 sigma = dflt_real
504 surface_tension = .false.
505 adv_n = .false.
506
507 ! Lagrangian bubbles modeling
508 bubbles_lagrange = .false.
509
510 ! IBM
511 num_ibs = dflt_int
512
513 ! Output partial domain
514 output_partial_domain = .false.
515 x_output%beg = dflt_real
516 x_output%end = dflt_real
517 y_output%beg = dflt_real
518 y_output%end = dflt_real
519 z_output%beg = dflt_real
520 z_output%end = dflt_real
521
522 ! MHD
523 bx0 = dflt_real
524
526
527 !> Computation of parameters, allocation procedures, and/or any other tasks needed to properly setup the module
529
530 integer :: i, j, fac
531
532 ! Setting m_root equal to m in the case of a 1D serial simulation
533
534 if (n == 0) m_root = m_glb
535
536 ! Gamma/Pi_inf Model
537 if (model_eqns == 1) then
538 ! Setting number of fluids
539 num_fluids = 1
540
541 ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number
542 ! of spatial dimensions and the gamma/pi_inf model
543 eqn_idx%cont%beg = 1
544 eqn_idx%cont%end = eqn_idx%cont%beg
545 eqn_idx%mom%beg = eqn_idx%cont%end + 1
546 eqn_idx%mom%end = eqn_idx%cont%end + num_vels
547 eqn_idx%E = eqn_idx%mom%end + 1
548 eqn_idx%adv%beg = eqn_idx%E + 1
549 eqn_idx%adv%end = eqn_idx%adv%beg + 1
550 eqn_idx%gamma = eqn_idx%adv%beg
551 eqn_idx%pi_inf = eqn_idx%adv%end
552 sys_size = eqn_idx%adv%end
553
554 ! Volume Fraction Model (5-equation model)
555 else if (model_eqns == 2) then
556 ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number
557 ! of spatial dimensions and the volume fraction model
558 eqn_idx%cont%beg = 1
559 eqn_idx%cont%end = num_fluids
560 eqn_idx%mom%beg = eqn_idx%cont%end + 1
561 eqn_idx%mom%end = eqn_idx%cont%end + num_vels
562 eqn_idx%E = eqn_idx%mom%end + 1
563
564 if (igr) then
565 ! Volume fractions are stored in the indices immediately following the energy equation. IGR tracks a total of (N-1)
566 ! volume fractions for N fluids, hence the "-1" in eqn_idx%adv%end. If num_fluids = 1 then eqn_idx%adv%end <
567 ! eqn_idx%adv%beg, which skips all loops over the volume fractions since there is no volume fraction to track
568 eqn_idx%adv%beg = eqn_idx%E + 1 ! Alpha for fluid 1
569 eqn_idx%adv%end = eqn_idx%E + num_fluids - 1
570 else
571 ! Volume fractions are stored in the indices immediately following the energy equation. WENO/MUSCL + Riemann tracks
572 ! a total of (N) volume fractions for N fluids, hence the lack of "-1" in eqn_idx%adv%end
573 eqn_idx%adv%beg = eqn_idx%E + 1
574 eqn_idx%adv%end = eqn_idx%E + num_fluids
575 end if
576
577 sys_size = eqn_idx%adv%end
578
579 if (bubbles_euler) then
580 eqn_idx%alf = eqn_idx%adv%end
581 else
582 eqn_idx%alf = 1
583 end if
584
585 if (qbmm) then
586 nmom = 6
587 end if
588
589 if (bubbles_euler) then
590 eqn_idx%bub%beg = sys_size + 1
591 if (qbmm) then
592 eqn_idx%bub%end = eqn_idx%adv%end + nb*nmom
593 else
594 if (.not. polytropic) then
595 eqn_idx%bub%end = sys_size + 4*nb
596 else
597 eqn_idx%bub%end = sys_size + 2*nb
598 end if
599 end if
600 sys_size = eqn_idx%bub%end
601
602 if (adv_n) then
603 eqn_idx%n = eqn_idx%bub%end + 1
604 sys_size = eqn_idx%n
605 end if
606
607 allocate (qbmm_idx%rs(nb), qbmm_idx%vs(nb))
608 allocate (qbmm_idx%ps(nb), qbmm_idx%ms(nb))
609
610 if (qbmm) then
611 allocate (qbmm_idx%moms(nb, nmom))
612 do i = 1, nb
613 do j = 1, nmom
614 qbmm_idx%moms(i, j) = eqn_idx%bub%beg + (j - 1) + (i - 1)*nmom
615 end do
616 qbmm_idx%rs(i) = qbmm_idx%moms(i, 2)
617 qbmm_idx%vs(i) = qbmm_idx%moms(i, 3)
618 end do
619 else
620 do i = 1, nb
621 if (polytropic .neqv. .true.) then
622 fac = 4
623 else
624 fac = 2
625 end if
626
627 qbmm_idx%rs(i) = eqn_idx%bub%beg + (i - 1)*fac
628 qbmm_idx%vs(i) = qbmm_idx%rs(i) + 1
629
630 if (polytropic .neqv. .true.) then
631 qbmm_idx%ps(i) = qbmm_idx%vs(i) + 1
632 qbmm_idx%ms(i) = qbmm_idx%ps(i) + 1
633 end if
634 end do
635 end if
636 end if
637
638 if (bubbles_lagrange) then
639 beta_idx = sys_size + 1
641 end if
642
643 if (mhd) then
644 eqn_idx%B%beg = sys_size + 1
645 if (n == 0) then
646 eqn_idx%B%end = sys_size + 2 ! 1D: By, Bz
647 else
648 eqn_idx%B%end = sys_size + 3 ! 2D/3D: Bx, By, Bz
649 end if
650 sys_size = eqn_idx%B%end
651 end if
652
653 ! Volume Fraction Model (6-equation model)
654 else if (model_eqns == 3) then
655 ! Annotating structure of the state and flux vectors belonging to the system of equations defined by the selected number
656 ! of spatial dimensions and the volume fraction model
657 eqn_idx%cont%beg = 1
658 eqn_idx%cont%end = num_fluids
659 eqn_idx%mom%beg = eqn_idx%cont%end + 1
660 eqn_idx%mom%end = eqn_idx%cont%end + num_vels
661 eqn_idx%E = eqn_idx%mom%end + 1
662 eqn_idx%adv%beg = eqn_idx%E + 1
663 eqn_idx%adv%end = eqn_idx%E + num_fluids
664 eqn_idx%int_en%beg = eqn_idx%adv%end + 1
665 eqn_idx%int_en%end = eqn_idx%adv%end + num_fluids
666 sys_size = eqn_idx%int_en%end
667 eqn_idx%alf = 1 ! dummy, cannot actually have a void fraction
668 else if (model_eqns == 4) then
669 eqn_idx%cont%beg = 1 ! one continuity equation
670 eqn_idx%cont%end = 1 ! num_fluids
671 eqn_idx%mom%beg = eqn_idx%cont%end + 1 ! one momentum equation in each
672 eqn_idx%mom%end = eqn_idx%cont%end + num_vels
673 eqn_idx%E = eqn_idx%mom%end + 1 ! one energy equation
674 eqn_idx%adv%beg = eqn_idx%E + 1
675 eqn_idx%adv%end = eqn_idx%adv%beg ! one volume advection equation
676 eqn_idx%alf = eqn_idx%adv%end
677 sys_size = eqn_idx%alf ! eqn_idx%adv%end
678
679 if (bubbles_euler) then
680 eqn_idx%bub%beg = sys_size + 1
681 eqn_idx%bub%end = sys_size + 2*nb
682 if (polytropic .neqv. .true.) then
683 eqn_idx%bub%end = sys_size + 4*nb
684 end if
685 sys_size = eqn_idx%bub%end
686
687 allocate (qbmm_idx%rs(nb), qbmm_idx%vs(nb))
688 allocate (qbmm_idx%ps(nb), qbmm_idx%ms(nb))
689 allocate (weight(nb), r0(nb))
690
691 do i = 1, nb
692 if (polytropic .neqv. .true.) then
693 fac = 4
694 else
695 fac = 2
696 end if
697
698 qbmm_idx%rs(i) = eqn_idx%bub%beg + (i - 1)*fac
699 qbmm_idx%vs(i) = qbmm_idx%rs(i) + 1
700
701 if (polytropic .neqv. .true.) then
702 qbmm_idx%ps(i) = qbmm_idx%vs(i) + 1
703 qbmm_idx%ms(i) = qbmm_idx%ps(i) + 1
704 end if
705 end do
706
707 if (nb == 1) then
708 weight(:) = 1._wp
709 r0(:) = 1._wp
710 else if (nb < 1) then
711 stop 'Invalid value of nb'
712 end if
713
714 if (polytropic) then
715 rhoref = 1._wp
716 pref = 1._wp
717 end if
718 end if
719 end if
720
721 if (model_eqns == 2 .or. model_eqns == 3) then
722 if (hypoelasticity .or. hyperelasticity) then
723 elasticity = .true.
724 eqn_idx%stress%beg = sys_size + 1
725 eqn_idx%stress%end = sys_size + (num_dims*(num_dims + 1))/2
726 if (cyl_coord) eqn_idx%stress%end = eqn_idx%stress%end + 1
727 ! number of stresses is 1 in 1D, 3 in 2D, 4 in 2D-Axisym, 6 in 3D
728 sys_size = eqn_idx%stress%end
729
730 ! shear stress index is 2 for 2D and 2,4,5 for 3D
731 if (num_dims == 1) then
732 shear_num = 0
733 else if (num_dims == 2) then
734 shear_num = 1
735 shear_indices(1) = eqn_idx%stress%beg - 1 + 2
738 ! Both x-dir and y-dir: flip tau_xy only
739 else if (num_dims == 3) then
740 shear_num = 3
741 shear_indices(1:3) = eqn_idx%stress%beg - 1 + (/2, 4, 5/)
743 shear_bc_flip_indices(1,1:2) = shear_indices((/1, 2/))
744 shear_bc_flip_indices(2,1:2) = shear_indices((/1, 3/))
745 shear_bc_flip_indices(3,1:2) = shear_indices((/2, 3/))
746 ! x-dir: flip tau_xy and tau_xz y-dir: flip tau_xy and tau_yz z-dir: flip tau_xz and tau_yz
747 end if
748 end if
749
750 if (hyperelasticity) then
751 eqn_idx%xi%beg = sys_size + 1
752 eqn_idx%xi%end = sys_size + num_dims
753 ! adding three more equations for the \xi field and the elastic energy
754 sys_size = eqn_idx%xi%end + 1
755 ! number of entries in the symmetric btensor plus the jacobian
756 b_size = (num_dims*(num_dims + 1))/2 + 1
757 tensor_size = num_dims**2 + 1
758 end if
759
760 if (surface_tension) then
761 eqn_idx%c = sys_size + 1
762 sys_size = eqn_idx%c
763 end if
764
765 if (cont_damage) then
766 eqn_idx%damage = sys_size + 1
767 sys_size = eqn_idx%damage
768 else
769 eqn_idx%damage = dflt_int
770 end if
771
772 if (hyper_cleaning) then
773 eqn_idx%psi = sys_size + 1
774 sys_size = eqn_idx%psi
775 else
776 eqn_idx%psi = dflt_int
777 end if
778 end if
779
780 if (chemistry) then
781 eqn_idx%species%beg = sys_size + 1
782 eqn_idx%species%end = sys_size + num_species
783 sys_size = eqn_idx%species%end
784 else
785 eqn_idx%species%beg = 1
786 eqn_idx%species%end = 1
787 end if
788
789 if (output_partial_domain) then
790 x_output_idx%beg = 0
791 x_output_idx%end = 0
792 y_output_idx%beg = 0
793 y_output_idx%end = 0
794 z_output_idx%beg = 0
795 z_output_idx%end = 0
796 end if
797
798#ifdef MFC_MPI
799 if (qbmm .and. .not. polytropic) then
800 allocate (mpi_io_data%view(1:sys_size + 2*nb*nnode))
801 allocate (mpi_io_data%var(1:sys_size + 2*nb*nnode))
802 else
803 allocate (mpi_io_data%view(1:sys_size))
804 allocate (mpi_io_data%var(1:sys_size))
805 end if
806
807 do i = 1, sys_size
808 if (down_sample) then
809 allocate (mpi_io_data%var(i)%sf(-1:m + 1,-1:n + 1,-1:p + 1))
810 else
811 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
812 end if
813 mpi_io_data%var(i)%sf => null()
814 end do
815 if (qbmm .and. .not. polytropic) then
816 do i = sys_size + 1, sys_size + 2*nb*nnode
817 allocate (mpi_io_data%var(i)%sf(0:m,0:n,0:p))
818 mpi_io_data%var(i)%sf => null()
819 end do
820 end if
821
822 if (ib) allocate (mpi_io_ib_data%var%sf(0:m,0:n,0:p))
823#endif
824
825 ! Size of the ghost zone layer is non-zero only when post-processing the raw simulation data of a parallel multidimensional
826 ! computation in the Silo-HDF5 format. If this is the case, one must also verify whether the raw simulation data is 2D or
827 ! 3D. In the 2D case, size of the z-coordinate direction ghost zone layer must be zeroed out.
828 if (num_procs == 1 .or. format /= 1) then
829 offset_x%beg = 0
830 offset_x%end = 0
831 offset_y%beg = 0
832 offset_y%end = 0
833 offset_z%beg = 0
834 offset_z%end = 0
835 else if (n == 0) then
836 offset_y%beg = 0
837 offset_y%end = 0
838 offset_z%beg = 0
839 offset_z%end = 0
840 else if (p == 0) then
841 offset_z%beg = 0
842 offset_z%end = 0
843 end if
844
845 ! Determining the finite-difference number and the buffer size. Note that the size of the buffer is unrelated to the order
846 ! of the WENO scheme. Rather, it is directly dependent on maximum size of ghost zone layers and possibly the order of the
847 ! finite difference scheme used for the computation of vorticity and/or numerical Schlieren function.
848 buff_size = max(offset_x%beg, offset_x%end, offset_y%beg, offset_y%end, offset_z%beg, offset_z%end)
849
850 if (any(omega_wrt) .or. schlieren_wrt .or. qm_wrt .or. liutex_wrt) then
851 fd_number = max(1, fd_order/2)
853 end if
854
855 ! Configuring Coordinate Direction Indexes
856 idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
857 idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
858
859 idwbuff(1)%beg = -buff_size
860 if (num_dims > 1) then; idwbuff(2)%beg = -buff_size; else; idwbuff(2)%beg = 0; end if
861 if (num_dims > 2) then; idwbuff(3)%beg = -buff_size; else; idwbuff(3)%beg = 0; end if
862
863 idwbuff(1)%end = idwint(1)%end - idwbuff(1)%beg
864 idwbuff(2)%end = idwint(2)%end - idwbuff(2)%beg
865 idwbuff(3)%end = idwint(3)%end - idwbuff(3)%beg
866
867 ! Allocating single precision grid variables if needed
868 allocate (x_cc_s(-buff_size:m + buff_size))
869
870 ! Allocating the grid variables in the x-coordinate direction
871 allocate (x_cb(-1 - offset_x%beg:m + offset_x%end))
872 allocate (x_cc(-buff_size:m + buff_size))
873 allocate (dx(-buff_size:m + buff_size))
874
875 ! Allocating grid variables in the y- and z-coordinate directions
876 if (n > 0) then
877 allocate (y_cb(-1 - offset_y%beg:n + offset_y%end))
878 allocate (y_cc(-buff_size:n + buff_size))
879 allocate (dy(-buff_size:n + buff_size))
880
881 if (p > 0) then
882 allocate (z_cb(-1 - offset_z%beg:p + offset_z%end))
883 allocate (z_cc(-buff_size:p + buff_size))
884 allocate (dz(-buff_size:p + buff_size))
885 end if
886
887 ! Allocating the grid variables, only used for the 1D simulations, and containing the defragmented computational domain
888 ! grid data
889 else
890 allocate (x_root_cb(-1:m_root))
891 allocate (x_root_cc(0:m_root))
892
893 if (precision == 1) then
894 allocate (x_root_cc_s(0:m_root))
895 end if
896 end if
897
898 allocate (adv(num_fluids))
899
900 if (cyl_coord .neqv. .true.) then ! Cartesian grid
901 grid_geometry = 1
902 else if (cyl_coord .and. p == 0) then ! Axisymmetric cylindrical grid
903 grid_geometry = 2
904 else ! Fully 3D cylindrical grid
905 grid_geometry = 3
906 end if
907
909
910 !> Subroutine to initialize parallel infrastructure
911 impure subroutine s_initialize_parallel_io
912
913#ifdef MFC_MPI
914 integer :: ierr !< Generic flag used to identify and report MPI errors
915#endif
916
917 num_dims = 1 + min(1, n) + min(1, p)
918
919 if (mhd) then
920 num_vels = 3
921 else
923 end if
924
925 allocate (proc_coords(1:num_dims))
926
927 if (parallel_io .neqv. .true.) return
928
929#ifdef MFC_MPI
930 ! Option for Lustre file system (Darter/Comet/Stampede)
931 write (mpiiofs, '(A)') '/lustre_'
932 mpiiofs = trim(mpiiofs)
933 call mpi_info_create(mpi_info_int, ierr)
934 call mpi_info_set(mpi_info_int, 'romio_ds_write', 'disable', ierr)
935
936 ! Option for UNIX file system (Hooke/Thomson) WRITE(mpiiofs, '(A)') '/ufs_' mpiiofs = TRIM(mpiiofs) mpi_info_int =
937 ! MPI_INFO_NULL
938
939 allocate (start_idx(1:num_dims))
940#endif
941
942 end subroutine s_initialize_parallel_io
943
944 !> Deallocation procedures for the module
946
947 integer :: i
948
949 if (bubbles_euler) then
950 deallocate (qbmm_idx%rs, qbmm_idx%vs, qbmm_idx%ps, qbmm_idx%ms)
951 if (qbmm) deallocate (qbmm_idx%moms)
952 end if
953
954 ! Deallocating the grid variables for the x-coordinate direction
955
956 deallocate (x_cc, x_cb, dx)
957
958 ! Deallocating grid variables for the y- and z-coordinate directions
959 if (n > 0) then
960 deallocate (y_cc, y_cb, dy)
961 if (p > 0) then
962 deallocate (z_cc, z_cb, dz)
963 end if
964 else
965 ! Deallocating the grid variables, only used for the 1D simulations, and containing the defragmented computational
966 ! domain grid data
967 deallocate (x_root_cb, x_root_cc)
968 end if
969
970 deallocate (proc_coords)
971
972 deallocate (adv)
973
974#ifdef MFC_MPI
975 if (parallel_io) then
976 deallocate (start_idx)
977 do i = 1, sys_size
978 mpi_io_data%var(i)%sf => null()
979 end do
980
981 deallocate (mpi_io_data%var)
982 deallocate (mpi_io_data%view)
983 end if
984
985 if (ib) mpi_io_ib_data%var%sf => null()
986#endif
987
989
990end module m_global_parameters
integer, intent(in) j
Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures.
Global parameters for the post-process: domain geometry, equation of state, and output database setti...
real(sp), dimension(:), allocatable x_cc_s
type(mpi_io_levelset_norm_var), public mpi_io_levelsetnorm_data
logical cont_damage
Continuum damage modeling.
integer, dimension(3, 2) shear_bc_flip_indices
Shear stress BC reflection indices (1:3, 1:shear_BC_flip_num).
logical hypoelasticity
Turn hypoelasticity on.
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
Deallocation procedures for the module.
integer thermal
1 = adiabatic, 2 = isotherm, 3 = transfer
integer avg_state
Average state evaluation method.
real(wp), dimension(:), allocatable im_trans_c
type(int_bounds_info), dimension(1:3) idwint
integer recon_type
Which type of reconstruction to use.
logical, parameter chemistry
Chemistry modeling.
integer beta_idx
Index of lagrange bubbles beta.
type(int_bounds_info) offset_y
real(wp), dimension(num_fluids_max) schlieren_alpha
Per-fluid Schlieren intensity amplitude coefficients.
real(wp), dimension(:), allocatable pb0
integer num_fluids
Number of different fluids present in the flow.
real(wp), dimension(:), allocatable im_trans_t
type(qbmm_idx_info) qbmm_idx
QBMM moment index mappings.
real(wp), dimension(:,:), allocatable, public mpi_io_data_lg_bubbles
logical, dimension(3) flux_wrt
real(wp), dimension(:), allocatable y_cc
integer format
Format of the database file(s).
integer proc_rank
Rank of the local processor.
real(wp), dimension(:), allocatable re_trans_t
logical mixture_err
Mixture error limiter.
logical output_partial_domain
Specify portion of domain to output for post-processing.
real(wp), dimension(:), allocatable adv
Advection variables.
real(wp), dimension(:), allocatable x_root_cc
type(int_bounds_info) z_output_idx
Indices of domain to output for post-processing.
type(mpi_io_ib_var), public mpi_io_ib_data
logical dummy
AMDFlang workaround for case-optimization + GPU-kernel bug.
integer, dimension(:), allocatable proc_coords
Processor coordinates in MPI_CART_COMM.
real(wp), dimension(:), allocatable y_cb
character(len=name_len) mpiiofs
integer, dimension(:), allocatable start_idx
Starting cell-center index of local processor in global grid.
integer sys_size
Number of unknowns in the system of equations.
real(wp), dimension(:), allocatable dz
real(wp), dimension(:), allocatable weight
real(wp), dimension(:), allocatable k_v
integer muscl_order
Order of accuracy for the MUSCL reconstruction.
logical alt_soundspeed
Alternate sound speed.
integer relax_model
Phase change relaxation model.
logical, dimension(3) mom_wrt
real(wp), dimension(:), allocatable x_root_cb
integer fd_number
Finite-difference half-stencil size: MAX(1, fd_order/2).
logical, dimension(num_fluids_max) alpha_wrt
logical, dimension(num_fluids_max) alpha_rho_wrt
type(mpi_io_levelset_var), public mpi_io_levelset_data
logical, dimension(num_fluids_max) alpha_rho_e_wrt
integer tensor_size
Number of components in the nonsymmetric tensor.
type(int_bounds_info), dimension(1:3) idwbuff
integer model_eqns
Multicomponent flow model.
integer buff_size
Number of ghost cells for boundary condition storage.
integer precision
Floating point precision of the database file(s).
logical hyperelasticity
Turn hyperelasticity on.
real(wp), dimension(:), allocatable z_cb
type(physical_parameters), dimension(num_fluids_max) fluid_pp
Stiffened gas EOS parameters and Reynolds numbers per fluid.
type(bounds_info) z_output
Portion of domain to output for post-processing.
integer num_dims
Number of spatial dimensions.
integer shear_bc_flip_num
Number of shear stress components to reflect for boundary conditions.
real(wp), dimension(:), allocatable r0
type(int_bounds_info) x_output_idx
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
real(wp), dimension(:), allocatable k_g
type(chemistry_parameters) chem_params
integer fd_order
Finite-difference order for vorticity and Schlieren derivatives.
integer num_vels
Number of velocity components (different from num_dims for mhd).
real(wp), dimension(:), allocatable x_cb
real(wp), dimension(:), allocatable dy
integer t_step_save
Interval between consecutive time-step directory.
type(int_bounds_info) offset_x
logical hyper_cleaning
Hyperbolic cleaning for MHD.
real(wp), dimension(:), allocatable z_cc
real(wp) bx0
Constant magnetic field in the x-direction (1D).
integer b_size
Number of components in the b tensor.
logical, dimension(3) omega_wrt
integer num_procs
Number of processors.
character(len=path_len) case_dir
Case folder location.
type(int_bounds_info) y_output_idx
integer weno_order
Order of accuracy for the WENO reconstruction.
type(int_bounds_info) offset_z
logical mhd
Magnetohydrodynamics.
integer shear_num
Number of shear stress components.
integer, dimension(3) shear_indices
Indices of the stress components that represent shear stress.
logical parallel_io
Format of the data files.
type(cell_num_bounds) cells_bounds
logical down_sample
down sampling of the database file(s)
real(wp), dimension(:), allocatable mass_g0
logical file_per_process
output format
integer t_step_start
First time-step directory.
real(wp) wall_time_avg
Wall time measurements.
logical elasticity
elasticity modeling, true for hyper or hypo
type(mpi_io_var), public mpi_io_data
impure subroutine s_initialize_parallel_io
Subroutine to initialize parallel infrastructure.
logical mpp_lim
Maximum volume fraction limiter.
real(wp), dimension(:), allocatable omegan
integer igr_order
IGR reconstruction order.
real(wp), dimension(:), allocatable re_trans_c
logical, dimension(3) vel_wrt
type(subgrid_bubble_physical_parameters) bub_pp
logical, dimension(1:num_species) chem_wrt_y
logical relativity
Relativity for RMHD.
real(sp), dimension(:), allocatable x_root_cc_s
real(wp), dimension(:), allocatable dx
Cell-width distributions in the x-, y- and z-coordinate directions.
real(wp), dimension(:), allocatable pe_t
type(eqn_idx_info) eqn_idx
All conserved-variable equation index ranges and scalars.
real(wp), dimension(:), allocatable mass_v0
integer num_ibs
Number of immersed boundaries.
integer(kind=8) nglobal
Total number of cells in global domain.
integer t_step_stop
Last time-step directory.
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.
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-.
All conserved-variable equation indices, computed at startup from model_eqns and enabled features....
Integer bounds for variables.
Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat rat...
QBMM moment index mappings - separate from bub beg/end so eqn_idx contains no allocatables.
Derived type annexing the physical parameters required for sub-grid bubble models.