Skip to content

Commit 755fba3

Browse files
committed
MTHINC interface compression method
1 parent 52e8af1 commit 755fba3

81 files changed

Lines changed: 2583 additions & 2099 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: 54 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,15 @@ 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 !<
64+
!! Locations of the domain bounds in the x-, y- and z-coordinate directions
6165
!> @name Cell-width distributions in the x-, y- and z-directions, respectively
6266
!> @{
6367
real(wp), target, allocatable, dimension(:) :: dx, dy, dz
6468
!> @}
6569

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

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

8287
logical :: cfl_adap_dt, cfl_const_dt, cfl_dt
8388
integer :: t_step_print !< Number of time-steps between printouts
89+
8490
! Simulation Algorithm Parameters
8591
integer :: model_eqns !< Multicomponent flow model
8692
#:if MFC_CASE_OPTIMIZATION
@@ -162,7 +168,7 @@ module m_global_parameters
162168
logical :: mixture_err !< Mixture properties correction
163169
logical :: hypoelasticity !< hypoelasticity modeling
164170
logical :: hyperelasticity !< hyperelasticity modeling
165-
logical :: int_comp !< THINC interface compression
171+
integer :: int_comp !< Interface compression: 0=off, 1=THINC, 2=MTHINC
166172
real(wp) :: ic_eps !< THINC Epsilon to compress on surface cells
167173
real(wp) :: ic_beta !< THINC Sharpness Parameter
168174
integer :: hyper_model !< hyperelasticity solver algorithm
@@ -206,6 +212,7 @@ module m_global_parameters
206212
integer :: relax_model !< Relaxation model
207213
real(wp) :: palpha_eps !< trigger parameter for the p relaxation procedure, phase change model
208214
real(wp) :: ptgalpha_eps !< trigger parameter for the pTg relaxation procedure, phase change model
215+
209216
$:GPU_DECLARE(create='[relax, relax_model, palpha_eps, ptgalpha_eps]')
210217

211218
integer :: num_bc_patches
@@ -293,7 +300,9 @@ module m_global_parameters
293300

294301
$:GPU_DECLARE(create='[Re_size, Re_size_max, Re_idx]')
295302

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

312321
$:GPU_DECLARE(create='[dir_idx, dir_flg, dir_idx_tau]')
313322

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

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
329+
integer :: shear_num !! Number of shear stress components
330+
integer, dimension(3) :: shear_indices !< Indices of the stress components that represent shear stress
331+
integer :: shear_BC_flip_num !< Number of shear stress components to reflect for boundary conditions
332+
!> Indices of shear stress components to reflect for boundary conditions. Size: (1:3, 1:shear_BC_flip_num) for (x/y/z,
333+
!! [indices])
320334
integer, dimension(3, 2) :: shear_BC_flip_indices !< Shear stress BC reflection indices (1:3, 1:shear_BC_flip_num)
335+
321336
$:GPU_DECLARE(create='[shear_num, shear_indices, shear_BC_flip_num, shear_BC_flip_indices]')
322337

323338
! END: Simulation Algorithm Parameters
324339

325340
! Fluids Physical Parameters
326341

342+
!> Database of the physical parameters of each of the fluids that is present in the flow. These include the stiffened gas
343+
!! equation of state parameters, and the Reynolds numbers.
327344
type(physical_parameters), dimension(num_fluids_max) :: fluid_pp !< Stiffened gas EOS parameters and Reynolds numbers per fluid
345+
328346
! Subgrid Bubble Parameters
329347
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)
348+
349+
!> The order of the finite-difference (fd) approximations of the first-order derivatives that need to be evaluated when the CoM
350+
!! or flow probe data files are to be written at each time step
351+
integer :: fd_order
352+
353+
!> The finite-difference number is given by MAX(1, fd_order/2). Essentially, it is a measure of the half-size of the
354+
!! finite-difference stencil for the selected order of accuracy.
355+
integer :: fd_number
332356
$:GPU_DECLARE(create='[fd_order, fd_number]')
333357

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

356383
$:GPU_DECLARE(create='[ib, num_ibs, patch_ib, Np, airfoil_grid_u, airfoil_grid_l]')
357384
!> @}
@@ -479,7 +506,10 @@ module m_global_parameters
479506
$:GPU_DECLARE(create='[Bx0]')
480507
481508
logical :: fft_wrt
509+
!> AMDFlang workaround: keep a dummy logical to avoid a compiler case-optimization bug when a parameter+GPU-kernel conditional
510+
!! is false
482511
logical :: dummy !< AMDFlang workaround for case-optimization + GPU-kernel bug
512+
483513
!> @name Continuum damage model parameters
484514
!> @{!
485515
real(wp) :: tau_star !< Stress threshold for continuum damage modeling
@@ -502,6 +532,7 @@ contains
502532
impure subroutine s_assign_default_values_to_user_inputs
503533
504534
integer :: i, j !< Generic loop iterator
535+
505536
! Logistics
506537
507538
case_dir = '.'
@@ -561,7 +592,7 @@ contains
561592
ptgalpha_eps = dflt_real
562593
hypoelasticity = .false.
563594
hyperelasticity = .false.
564-
int_comp = .false.
595+
int_comp = 0
565596
ic_eps = dflt_ic_eps
566597
ic_beta = dflt_ic_beta
567598
elasticity = .false.
@@ -837,15 +868,15 @@ contains
837868
838869
end subroutine s_assign_default_values_to_user_inputs
839870
840-
!> Initialize the global parameters module
871+
!> The computation of parameters, the allocation of memory, the association of pointers and/or the execution of any other
872+
!! procedures that are necessary to setup the module.
841873
impure subroutine s_initialize_global_parameters_module
842874
843875
integer :: i, j, k
844876
integer :: fac
845877
846878
#:if not MFC_CASE_OPTIMIZATION
847879
! Determining the degree of the WENO polynomials
848-
849880
if (recon_type == WENO_TYPE) then
850881
weno_polyn = (weno_order - 1)/2
851882
if (teno) then
@@ -863,7 +894,9 @@ contains
863894
$:GPU_UPDATE(device='[igr, igr_order, igr_iter_solver]')
864895
#:endif
865896
866-
! Initialize counts: viscous fluids, surface-tension interfaces, curvature interfaces
897+
! Initializing the number of fluids for which viscous effects will be non-negligible, the number of distinctive material
898+
! interfaces for which surface tension will be important and also, the number of fluids for which the physical and geometric
899+
! curvatures of the interfaces will be computed
867900
Re_size = 0
868901
Re_size_max = 0
869902
@@ -894,8 +927,10 @@ contains
894927
E_idx = mom_idx%end + 1
895928
896929
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
930+
! Volume fractions are stored in the indices immediately following the energy equation. IGR tracks a total of
931+
! (N-1) volume fractions for N fluids, hence the "-1" in adv_idx%end. If num_fluids = 1 then adv_idx%end <
932+
! adv_idx%beg, which skips all loops over the volume fractions since there is no volume fraction to track
933+
adv_idx%beg = E_idx + 1
899934
adv_idx%end = E_idx + num_fluids - 1
900935
else
901936
! Volume fractions are stored in the indices immediately following the energy equation. WENO/MUSCL + Riemann
@@ -1029,7 +1064,8 @@ contains
10291064
end if
10301065
end if
10311066
1032-
! Count fluids with non-negligible viscous effects (Re > 0)
1067+
! Determining the number of fluids for which the shear and the volume Reynolds numbers, e.g. viscous effects, are
1068+
! important
10331069
do i = 1, num_fluids
10341070
if (fluid_pp(i)%Re(1) > 0) Re_size(1) = Re_size(1) + 1
10351071
if (fluid_pp(i)%Re(2) > 0) Re_size(2) = Re_size(2) + 1
@@ -1157,7 +1193,9 @@ contains
11571193
end do
11581194
end if
11591195
1160-
! Configure WENO averaging flag (arithmetic mean vs. unaltered values)
1196+
! Configuring the WENO average flag that will be used to regulate whether any spatial derivatives are to computed in each
1197+
! cell by using the arithmetic mean of left and right, WENO-reconstructed, cell-boundary values or otherwise, the unaltered
1198+
! left and right, WENO-reconstructed, cell-boundary values
11611199
wa_flg = 0._wp; if (weno_avg) wa_flg = 1._wp
11621200
$:GPU_UPDATE(device='[wa_flg]')
11631201

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)