Skip to content

Commit c91d5b5

Browse files
wilfonbaclaude
authored andcommitted
add MTHINC with tests
1 parent 9b7a503 commit c91d5b5

79 files changed

Lines changed: 2429 additions & 2031 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.

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ module m_global_parameters
174174
logical :: mixture_err !< Mixture properties correction
175175
logical :: hypoelasticity !< hypoelasticity modeling
176176
logical :: hyperelasticity !< hyperelasticity modeling
177-
logical :: int_comp !< THINC interface compression
177+
integer :: int_comp !< Interface compression: 0=off, 1=THINC, 2=MTHINC
178178
real(wp) :: ic_eps !< THINC Epsilon to compress on surface cells
179-
real(wp) :: ic_beta !< THINC Sharpness Parameter
179+
real(wp) :: ic_beta !< THINC/MTHINC Sharpness Parameter
180180
integer :: hyper_model !< hyperelasticity solver algorithm
181181
logical :: elasticity !< elasticity modeling, true for hyper or hypo
182182
logical, parameter :: chemistry = .${chemistry}$. !< Chemistry modeling
@@ -625,7 +625,7 @@ contains
625625
ptgalpha_eps = dflt_real
626626
hypoelasticity = .false.
627627
hyperelasticity = .false.
628-
int_comp = .false.
628+
int_comp = 0
629629
ic_eps = dflt_ic_eps
630630
ic_beta = dflt_ic_beta
631631
elasticity = .false.

src/simulation/m_mpi_proxy.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ contains
9797
& 'num_probes', 'num_integrals', 'bubble_model', 'thermal', &
9898
& 'num_source', 'relax_model', 'num_ibs', 'n_start', &
9999
& 'num_bc_patches', 'num_igr_iters', 'num_igr_warm_start_iters', &
100-
& 'adap_dt_max_iters' ]
100+
& 'adap_dt_max_iters', 'int_comp' ]
101101
call MPI_BCAST(${VAR}$, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
102102
#:endfor
103103

@@ -113,7 +113,7 @@ contains
113113
& 'bc_z%grcbc_in', 'bc_z%grcbc_out', 'bc_z%grcbc_vel_out', &
114114
& 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', 'surface_tension', &
115115
& 'shear_stress', 'bulk_stress', 'bubbles_lagrange', &
116-
& 'hyperelasticity', 'down_sample', 'int_comp','fft_wrt', &
116+
& 'hyperelasticity', 'down_sample', 'fft_wrt', &
117117
& 'hyper_cleaning', 'ib_state_wrt']
118118
call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
119119
#:endfor

src/simulation/m_muscl.fpp

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ module m_muscl
2323

2424
private; public :: s_initialize_muscl_module, &
2525
s_muscl, &
26-
s_finalize_muscl_module, &
27-
s_interface_compression
26+
s_finalize_muscl_module
2827

2928
integer :: v_size
3029
$:GPU_DECLARE(create='[v_size]')
@@ -225,92 +224,8 @@ contains
225224
#:endfor
226225
end if
227226

228-
if (int_comp) then
229-
call s_interface_compression(vL_rs_vf_x, vL_rs_vf_y, vL_rs_vf_z, &
230-
vR_rs_vf_x, vR_rs_vf_y, vR_rs_vf_z, &
231-
muscl_dir, is1_muscl_d, is2_muscl_d, is3_muscl_d)
232-
end if
233-
234227
end subroutine s_muscl
235228

236-
!> @brief Applies THINC interface-compression to sharpen volume-fraction reconstructions at material interfaces.
237-
subroutine s_interface_compression(vL_rs_vf_x, vL_rs_vf_y, vL_rs_vf_z, vR_rs_vf_x, vR_rs_vf_y, vR_rs_vf_z, &
238-
muscl_dir, &
239-
is1_muscl_d, is2_muscl_d, is3_muscl_d)
240-
241-
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:), intent(inout) :: &
242-
vL_rs_vf_x, vL_rs_vf_y, &
243-
vL_rs_vf_z, vR_rs_vf_x, &
244-
vR_rs_vf_y, vR_rs_vf_z
245-
integer, intent(in) :: muscl_dir
246-
type(int_bounds_info), intent(in) :: is1_muscl_d, is2_muscl_d, is3_muscl_d
247-
248-
integer :: j, k, l
249-
250-
real(wp) :: aCL, aCR, aC, aTHINC, qmin, qmax, A, B, C, sign, moncon
251-
252-
#:for MUSCL_DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')]
253-
if (muscl_dir == ${MUSCL_DIR}$) then
254-
255-
$:GPU_PARALLEL_LOOP(collapse=3,private='[j,k,l,aCL,aC,aCR,aTHINC,moncon,sign,qmin,qmax]')
256-
do l = is3_muscl%beg, is3_muscl%end
257-
do k = is2_muscl%beg, is2_muscl%end
258-
do j = is1_muscl%beg, is1_muscl%end
259-
260-
aCL = v_rs_ws_${XYZ}$_muscl(j - 1, k, l, advxb)
261-
aC = v_rs_ws_${XYZ}$_muscl(j, k, l, advxb)
262-
aCR = v_rs_ws_${XYZ}$_muscl(j + 1, k, l, advxb)
263-
264-
moncon = (aCR - aC)*(aC - aCL)
265-
266-
if (aC >= ic_eps .and. aC <= 1._wp - ic_eps .and. moncon > moncon_cutoff) then ! Interface cell
267-
268-
if (aCR - aCL > 0._wp) then
269-
sign = 1._wp
270-
else
271-
sign = -1._wp
272-
end if
273-
274-
qmin = min(aCR, aCL)
275-
qmax = max(aCR, aCL) - qmin
276-
277-
C = (aC - qmin + sgm_eps)/(qmax + sgm_eps)
278-
B = exp(sign*ic_beta*(2._wp*C - 1._wp))
279-
A = (B/cosh(ic_beta) - 1._wp)/tanh(ic_beta)
280-
281-
! Left reconstruction
282-
aTHINC = qmin + 5e-1_wp*qmax*(1._wp + sign*A)
283-
if (aTHINC < ic_eps) aTHINC = ic_eps
284-
if (aTHINC > 1 - ic_eps) aTHINC = 1 - ic_eps
285-
vL_rs_vf_${XYZ}$ (j, k, l, contxb) = vL_rs_vf_${XYZ}$ (j, k, l, contxb)/ &
286-
vL_rs_vf_${XYZ}$ (j, k, l, advxb)*aTHINC
287-
vL_rs_vf_${XYZ}$ (j, k, l, contxe) = vL_rs_vf_${XYZ}$ (j, k, l, contxe)/ &
288-
(1._wp - vL_rs_vf_${XYZ}$ (j, k, l, advxb))*(1._wp - aTHINC)
289-
vL_rs_vf_${XYZ}$ (j, k, l, advxb) = aTHINC
290-
vL_rs_vf_${XYZ}$ (j, k, l, advxe) = 1 - aTHINC
291-
292-
! Right reconstruction
293-
aTHINC = qmin + 5e-1_wp*qmax*(1._wp + sign*(tanh(ic_beta) + A)/(1._wp + A*tanh(ic_beta)))
294-
if (aTHINC < ic_eps) aTHINC = ic_eps
295-
if (aTHINC > 1 - ic_eps) aTHINC = 1 - ic_eps
296-
vR_rs_vf_${XYZ}$ (j, k, l, contxb) = vL_rs_vf_${XYZ}$ (j, k, l, contxb)/ &
297-
vL_rs_vf_${XYZ}$ (j, k, l, advxb)*aTHINC
298-
vR_rs_vf_${XYZ}$ (j, k, l, contxe) = vL_rs_vf_${XYZ}$ (j, k, l, contxe)/ &
299-
(1._wp - vL_rs_vf_${XYZ}$ (j, k, l, advxb))*(1._wp - aTHINC)
300-
vR_rs_vf_${XYZ}$ (j, k, l, advxb) = aTHINC
301-
vR_rs_vf_${XYZ}$ (j, k, l, advxe) = 1 - aTHINC
302-
303-
end if
304-
305-
end do
306-
end do
307-
end do
308-
$:END_GPU_PARALLEL_LOOP()
309-
end if
310-
#:endfor
311-
312-
end subroutine s_interface_compression
313-
314229
!> @brief Reshapes cell-averaged variable data into direction-local work arrays for MUSCL reconstruction.
315230
subroutine s_initialize_muscl(v_vf, muscl_dir)
316231

src/simulation/m_rhs.fpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ module m_rhs
5656

5757
use m_igr
5858

59+
use m_thinc
60+
5961
use m_pressure_relaxation
6062

6163
implicit none
@@ -744,6 +746,12 @@ contains
744746
call nvtxEndRange
745747
end if
746748
749+
if (int_comp == 2 .and. n > 0) then
750+
call nvtxStartRange("RHS-MTHINC-NORMALS")
751+
call s_compute_mthinc_normals(q_prim_qp%vf)
752+
call nvtxEndRange
753+
end if
754+
747755
! Dimensional Splitting Loop
748756
do id = 1, num_dims
749757
@@ -1922,6 +1930,14 @@ contains
19221930
recon_dir, &
19231931
is1, is2, is3)
19241932
end if
1933+
1934+
if (int_comp > 0 .and. iv%beg <= advxb .and. iv%end >= advxe) then
1935+
call s_thinc_compression(q_prim_qp%vf, &
1936+
vL_x, vL_y, vL_z, &
1937+
vR_x, vR_y, vR_z, &
1938+
recon_dir, &
1939+
is1, is2, is3)
1940+
end if
19251941
end if
19261942
#:endfor
19271943
end subroutine s_reconstruct_cell_boundary_values

0 commit comments

Comments
 (0)