Skip to content

Commit 322c7e9

Browse files
committed
MTHINC interface compression method
1 parent 52e8af1 commit 322c7e9

81 files changed

Lines changed: 2505 additions & 2098 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/documentation/case.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ See @ref equations "Equations" for the mathematical models these parameters cont
433433
| `mp_weno` | Logical | Monotonicity preserving WENO |
434434
| `muscl_order` | Integer | MUSCL order [1,2] |
435435
| `muscl_lim` | Integer | MUSCL Slope Limiter: [1] minmod; [2] monotonized central; [3] Van Albada; [4] Van Leer; [5] SUPERBEE |
436+
| `int_comp` | Integer | Interface Compression [1] THINC [2] MTHINC |
436437
| `flux_lim` | Integer | Flux limiter for post-process: [1] minmod; [2] MUSCL; [3] OSPRE; [4] SUPERBEE |
437-
| `int_comp` | Logical | THINC Interface Compression |
438438
| `ic_eps` | Real | Interface compression threshold (default: 1e-4) |
439439
| `ic_beta` | Real | Interface compression sharpness parameter (default: 1.6) |
440440
| `riemann_solver` | Integer | Riemann solver algorithm: [1] HLL*; [2] HLLC; [3] Exact*; [4] HLLD (only for MHD) |
@@ -530,7 +530,7 @@ It is recommended to set `weno_eps` to $10^{-6}$ for WENO-JS, and to $10^{-40}$
530530
- `muscl_lim` specifies the slope limiter that is used in 2nd order MUSCL Reconstruction by an integer from 1 through 5.
531531
`muscl_lim = 1`, `2`, `3`, `4`, and `5` correspond to minmod, monotonized central, Van Albada, Van Leer, and SUPERBEE, respectively.
532532

533-
- `int_comp` activates interface compression using THINC used in MUSCL Reconstruction, with control parameters (`ic_eps`, and `ic_beta`).
533+
- `int_comp` activates interface compression using [1] THINC or [2] MTHINC used in variable reconstruction, with control parameters (`ic_eps`, and `ic_beta`).
534534

535535
- `riemann_solver` specifies the choice of the Riemann solver that is used in simulation by an integer from 1 through 4.
536536
`riemann_solver = 1`, `2`, and `3` correspond to HLL, HLLC, and Exact Riemann solver, respectively (\cite Toro09).

docs/module_categories.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"m_weno",
88
"m_riemann_solvers",
99
"m_muscl",
10-
"m_variables_conversion"
10+
"m_variables_conversion",
11+
"m_thinc"
1112
]
1213
},
1314
{

examples/1D_sodshocktube_muscl/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"recon_type": 2,
3737
"muscl_order": 2,
3838
"muscl_lim": 2,
39-
"int_comp": "T",
39+
"int_comp": 1,
4040
"riemann_solver": 2,
4141
"wave_speeds": 1,
4242
"avg_state": 2,

examples/2D_advection_muscl/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"recon_type": 2,
3131
"muscl_order": 2,
3232
"muscl_lim": 2,
33-
"int_comp": "T",
33+
"int_comp": 1,
3434
"null_weights": "F",
3535
"riemann_solver": 2,
3636
"wave_speeds": 1,

examples/2D_riemann_test_muscl/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# "weno_eps": 1e-16,
3535
"muscl_order": 2,
3636
"muscl_lim": 1,
37-
"int_comp": "T",
37+
"int_comp": 1,
3838
"riemann_solver": 2,
3939
"wave_speeds": 1,
4040
"avg_state": 2,

examples/2D_shockdroplet_muscl/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"recon_type": 2,
6060
"muscl_order": 2,
6161
"muscl_lim": 4,
62-
"int_comp": "T",
62+
"int_comp": 1,
6363
"null_weights": "F",
6464
"riemann_solver": 2,
6565
"wave_speeds": 1,

examples/3D_rayleigh_taylor_muscl/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"recon_type": 2,
5858
"muscl_order": 2,
5959
"muscl_lim": 4,
60-
"int_comp": "T",
60+
"int_comp": 1,
6161
"avg_state": 2,
6262
"riemann_solver": 2,
6363
"wave_speeds": 1,

examples/3D_shockdroplet_muscl/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
"recon_type": 2,
203203
"muscl_order": 2,
204204
"muscl_lim": 3,
205-
"int_comp": "T",
205+
"int_comp": 1,
206206
"riemann_solver": 2,
207207
"wave_speeds": 1,
208208
"avg_state": 2,

src/simulation/m_global_parameters.fpp

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module m_global_parameters
1414

1515
use m_derived_types
1616
use m_helper_basic
17+
1718
! $:USE_GPU_MODULE()
1819

1920
implicit none
@@ -26,8 +27,10 @@ module m_global_parameters
2627
character(LEN=path_len) :: case_dir !< Case folder location
2728
logical :: run_time_info !< Run-time output flag
2829
integer :: t_step_old !< Existing IC/grid folder
30+
2931
! Computational Domain Parameters
3032
integer :: proc_rank !< Rank of the local processor
33+
3134
!> @name Number of cells in the x-, y- and z-directions, respectively
3235
!> @{
3336
integer :: m, n, p
@@ -57,13 +60,14 @@ module m_global_parameters
5760
!> @{
5861
real(wp), target, allocatable, dimension(:) :: x_cc, y_cc, z_cc
5962
!> @}
60-
! type(bounds_info) :: x_domain, y_domain, z_domain !< Locations of the domain bounds in the x-, y- and z-coordinate directions
63+
! type(bounds_info) :: x_domain, y_domain, z_domain !<
6164
!> @name Cell-width distributions in the x-, y- and z-directions, respectively
6265
!> @{
6366
real(wp), target, allocatable, dimension(:) :: dx, dy, dz
6467
!> @}
6568

6669
real(wp) :: dt !< Size of the time-step
70+
6771
$:GPU_DECLARE(create='[x_cb, y_cb, z_cb, x_cc, y_cc, z_cc, dx, dy, dz, dt, m, n, p]')
6872

6973
!> @name Starting time-step iteration, stopping time-step iteration and the number of time-step iterations between successive
@@ -81,6 +85,7 @@ module m_global_parameters
8185

8286
logical :: cfl_adap_dt, cfl_const_dt, cfl_dt
8387
integer :: t_step_print !< Number of time-steps between printouts
88+
8489
! Simulation Algorithm Parameters
8590
integer :: model_eqns !< Multicomponent flow model
8691
#:if MFC_CASE_OPTIMIZATION
@@ -162,7 +167,7 @@ module m_global_parameters
162167
logical :: mixture_err !< Mixture properties correction
163168
logical :: hypoelasticity !< hypoelasticity modeling
164169
logical :: hyperelasticity !< hyperelasticity modeling
165-
logical :: int_comp !< THINC interface compression
170+
integer :: int_comp !< Interface compression: 0=off, 1=THINC, 2=MTHINC
166171
real(wp) :: ic_eps !< THINC Epsilon to compress on surface cells
167172
real(wp) :: ic_beta !< THINC Sharpness Parameter
168173
integer :: hyper_model !< hyperelasticity solver algorithm
@@ -206,6 +211,7 @@ module m_global_parameters
206211
integer :: relax_model !< Relaxation model
207212
real(wp) :: palpha_eps !< trigger parameter for the p relaxation procedure, phase change model
208213
real(wp) :: ptgalpha_eps !< trigger parameter for the pTg relaxation procedure, phase change model
214+
209215
$:GPU_DECLARE(create='[relax, relax_model, palpha_eps, ptgalpha_eps]')
210216

211217
integer :: num_bc_patches
@@ -293,7 +299,9 @@ module m_global_parameters
293299

294300
$:GPU_DECLARE(create='[Re_size, Re_size_max, Re_idx]')
295301

296-
! WENO averaging flag: use arithmetic mean or unaltered WENO-reconstructed cell-boundary values
302+
! The WENO average (WA) flag regulates whether the calculation of any cell- average spatial derivatives is carried out in each
303+
! cell by utilizing the arithmetic mean of the left and right, WENO-reconstructed, cell-boundary values or simply, the unaltered
304+
! left and right, WENO-reconstructed, cell- boundary values.
297305
!> @{
298306
real(wp) :: wa_flg
299307
!> @}
@@ -311,24 +319,39 @@ module m_global_parameters
311319

312320
$:GPU_DECLARE(create='[dir_idx, dir_flg, dir_idx_tau]')
313321

322+
!> The number of cells that are necessary to be able to store enough boundary conditions data to march the solution in the
323+
!! physical computational domain to the next time-step.
314324
integer :: buff_size !< Number of ghost cells for boundary condition storage
325+
315326
$:GPU_DECLARE(create='[buff_size]')
316327

317-
integer :: shear_num !< Number of shear stress components
318-
integer, dimension(3) :: shear_indices !< Indices of the stress components that represent shear stress
319-
integer :: shear_BC_flip_num !< Number of shear stress components to reflect for boundary conditions
328+
integer :: shear_num !! Number of shear stress components
329+
integer, dimension(3) :: shear_indices !< Indices of the stress components that represent shear stress
330+
integer :: shear_BC_flip_num !< Number of shear stress components to reflect for boundary conditions
331+
!> Indices of shear stress components to reflect for boundary conditions. Size: (1:3, 1:shear_BC_flip_num) for (x/y/z,
332+
!! [indices])
320333
integer, dimension(3, 2) :: shear_BC_flip_indices !< Shear stress BC reflection indices (1:3, 1:shear_BC_flip_num)
334+
321335
$:GPU_DECLARE(create='[shear_num, shear_indices, shear_BC_flip_num, shear_BC_flip_indices]')
322336

323337
! END: Simulation Algorithm Parameters
324338

325339
! Fluids Physical Parameters
326340

341+
!> Database of the physical parameters of each of the fluids that is present in the flow. These include the stiffened gas
342+
!! equation of state parameters, and the Reynolds numbers.
327343
type(physical_parameters), dimension(num_fluids_max) :: fluid_pp !< Stiffened gas EOS parameters and Reynolds numbers per fluid
344+
328345
! Subgrid Bubble Parameters
329346
type(subgrid_bubble_physical_parameters) :: bub_pp
330-
integer :: fd_order !< Finite-difference order for CoM and flow probe derivatives
331-
integer :: fd_number !< Finite-difference half-stencil size: MAX(1, fd_order/2)
347+
348+
!> The order of the finite-difference (fd) approximations of the first-order derivatives that need to be evaluated when the CoM
349+
!! or flow probe data files are to be written at each time step
350+
integer :: fd_order
351+
352+
!> The finite-difference number is given by MAX(1, fd_order/2). Essentially, it is a measure of the half-size of the
353+
!! finite-difference stencil for the selected order of accuracy.
354+
integer :: fd_number
332355
$:GPU_DECLARE(create='[fd_order, fd_number]')
333356

334357
logical :: probe_wrt
@@ -352,6 +375,9 @@ module m_global_parameters
352375
type(ib_patch_parameters), dimension(num_patches_max) :: patch_ib !< Immersed boundary patch parameters
353376
type(vec3_dt), allocatable, dimension(:) :: airfoil_grid_u, airfoil_grid_l
354377
integer :: Np
378+
!! Database of the immersed boundary patch parameters for each of the patches employed in the configuration of the initial
379+
!! condition. Note that the maximum allowable number of patches, num_patches_max, may be changed in the module
380+
!! m_derived_types.f90.
355381

356382
$:GPU_DECLARE(create='[ib, num_ibs, patch_ib, Np, airfoil_grid_u, airfoil_grid_l]')
357383
!> @}
@@ -479,7 +505,10 @@ module m_global_parameters
479505
$:GPU_DECLARE(create='[Bx0]')
480506
481507
logical :: fft_wrt
508+
!> AMDFlang workaround: keep a dummy logical to avoid a compiler case-optimization bug when a parameter+GPU-kernel conditional
509+
!! is false
482510
logical :: dummy !< AMDFlang workaround for case-optimization + GPU-kernel bug
511+
483512
!> @name Continuum damage model parameters
484513
!> @{!
485514
real(wp) :: tau_star !< Stress threshold for continuum damage modeling
@@ -502,6 +531,7 @@ contains
502531
impure subroutine s_assign_default_values_to_user_inputs
503532
504533
integer :: i, j !< Generic loop iterator
534+
505535
! Logistics
506536
507537
case_dir = '.'
@@ -561,7 +591,7 @@ contains
561591
ptgalpha_eps = dflt_real
562592
hypoelasticity = .false.
563593
hyperelasticity = .false.
564-
int_comp = .false.
594+
int_comp = 0
565595
ic_eps = dflt_ic_eps
566596
ic_beta = dflt_ic_beta
567597
elasticity = .false.
@@ -837,15 +867,15 @@ contains
837867
838868
end subroutine s_assign_default_values_to_user_inputs
839869
840-
!> Initialize the global parameters module
870+
!> The computation of parameters, the allocation of memory, the association of pointers and/or the execution of any other
871+
!! procedures that are necessary to setup the module.
841872
impure subroutine s_initialize_global_parameters_module
842873
843874
integer :: i, j, k
844875
integer :: fac
845876
846877
#:if not MFC_CASE_OPTIMIZATION
847878
! Determining the degree of the WENO polynomials
848-
849879
if (recon_type == WENO_TYPE) then
850880
weno_polyn = (weno_order - 1)/2
851881
if (teno) then
@@ -863,7 +893,9 @@ contains
863893
$:GPU_UPDATE(device='[igr, igr_order, igr_iter_solver]')
864894
#:endif
865895
866-
! Initialize counts: viscous fluids, surface-tension interfaces, curvature interfaces
896+
! Initializing the number of fluids for which viscous effects will be non-negligible, the number of distinctive material
897+
! interfaces for which surface tension will be important and also, the number of fluids for which the physical and geometric
898+
! curvatures of the interfaces will be computed
867899
Re_size = 0
868900
Re_size_max = 0
869901
@@ -894,8 +926,10 @@ contains
894926
E_idx = mom_idx%end + 1
895927
896928
if (igr) then
897-
! IGR: volume fractions after energy (N-1 for N fluids; skipped when num_fluids=1)
898-
adv_idx%beg = E_idx + 1 ! Alpha for fluid 1
929+
! Volume fractions are stored in the indices immediately following the energy equation. IGR tracks a total of
930+
! (N-1) volume fractions for N fluids, hence the "-1" in adv_idx%end. If num_fluids = 1 then adv_idx%end <
931+
! adv_idx%beg, which skips all loops over the volume fractions since there is no volume fraction to track
932+
adv_idx%beg = E_idx + 1
899933
adv_idx%end = E_idx + num_fluids - 1
900934
else
901935
! Volume fractions are stored in the indices immediately following the energy equation. WENO/MUSCL + Riemann
@@ -1029,7 +1063,8 @@ contains
10291063
end if
10301064
end if
10311065
1032-
! Count fluids with non-negligible viscous effects (Re > 0)
1066+
! Determining the number of fluids for which the shear and the volume Reynolds numbers, e.g. viscous effects, are
1067+
! important
10331068
do i = 1, num_fluids
10341069
if (fluid_pp(i)%Re(1) > 0) Re_size(1) = Re_size(1) + 1
10351070
if (fluid_pp(i)%Re(2) > 0) Re_size(2) = Re_size(2) + 1
@@ -1157,7 +1192,9 @@ contains
11571192
end do
11581193
end if
11591194
1160-
! Configure WENO averaging flag (arithmetic mean vs. unaltered values)
1195+
! Configuring the WENO average flag that will be used to regulate whether any spatial derivatives are to computed in each
1196+
! cell by using the arithmetic mean of left and right, WENO-reconstructed, cell-boundary values or otherwise, the unaltered
1197+
! left and right, WENO-reconstructed, cell-boundary values
11611198
wa_flg = 0._wp; if (weno_avg) wa_flg = 1._wp
11621199
$:GPU_UPDATE(device='[wa_flg]')
11631200

src/simulation/m_mpi_proxy.fpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ module m_mpi_proxy
2222

2323
implicit none
2424

25+
!> This variable is utilized to pack and send the buffer of the immersed boundary markers, for a single computational domain
26+
!! boundary at the time, to the relevant neighboring processor.
2527
integer, private, allocatable, dimension(:) :: ib_buff_send !< IB marker send buffer for halo exchange
28+
29+
!> q_cons_buff_recv is utilized to receive and unpack the buffer of the immersed boundary markers, for a single computational
30+
!! domain boundary at the time, from the relevant neighboring processor.
2631
integer, private, allocatable, dimension(:) :: ib_buff_recv !< IB marker receive buffer for halo exchange
2732
integer :: i_halo_size
2833
$:GPU_DECLARE(create='[i_halo_size]')
@@ -76,7 +81,7 @@ contains
7681
& 'num_probes', 'num_integrals', 'bubble_model', 'thermal', &
7782
& 'num_source', 'relax_model', 'num_ibs', 'n_start', &
7883
& 'num_bc_patches', 'num_igr_iters', 'num_igr_warm_start_iters', &
79-
& 'adap_dt_max_iters' ]
84+
& 'adap_dt_max_iters', 'int_comp' ]
8085
call MPI_BCAST(${VAR}$, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
8186
#:endfor
8287

@@ -92,7 +97,7 @@ contains
9297
& 'bc_z%grcbc_in', 'bc_z%grcbc_out', 'bc_z%grcbc_vel_out', &
9398
& 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', 'surface_tension', &
9499
& 'shear_stress', 'bulk_stress', 'bubbles_lagrange', &
95-
& 'hyperelasticity', 'down_sample', 'int_comp','fft_wrt', &
100+
& 'hyperelasticity', 'down_sample', 'fft_wrt', &
96101
& 'hyper_cleaning', 'ib_state_wrt']
97102
call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
98103
#:endfor
@@ -245,7 +250,6 @@ contains
245250

246251
#ifdef MFC_MPI
247252
integer :: ierr !< Generic flag used to identify and report MPI errors
248-
249253
call MPI_BCAST(phi_rn, num_freq, mpi_p, 0, MPI_COMM_WORLD, ierr)
250254
#endif
251255

0 commit comments

Comments
 (0)