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