Skip to content

Commit 02eb4ec

Browse files
muscl_eps (#1383)
Co-authored-by: Spencer Bryngelson <sbryngelson@gmail.com>
1 parent 92e3124 commit 02eb4ec

38 files changed

Lines changed: 2581 additions & 7 deletions

docs/documentation/case.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ See @ref equations "Equations" for the mathematical models these parameters cont
445445
| `mp_weno` | Logical | Monotonicity preserving WENO |
446446
| `muscl_order` | Integer | MUSCL order [1,2] |
447447
| `muscl_lim` | Integer | MUSCL Slope Limiter: [1] minmod; [2] monotonized central; [3] Van Albada; [4] Van Leer; [5] SUPERBEE |
448+
| `muscl_eps` | Real | MUSCL limiter slope-product threshold (default: hard-coded thresholds; set to 0 for textbook behavior) |
448449
| `flux_lim` | Integer | Flux limiter for post-process: [1] minmod; [2] MUSCL; [3] OSPRE; [4] SUPERBEE |
449450
| `int_comp` | Logical | THINC Interface Compression |
450451
| `ic_eps` | Real | Interface compression threshold (default: 1e-4) |
@@ -542,6 +543,10 @@ It is recommended to set `weno_eps` to $10^{-6}$ for WENO-JS, and to $10^{-40}$
542543
- `muscl_lim` specifies the slope limiter that is used in 2nd order MUSCL Reconstruction by an integer from 1 through 5.
543544
`muscl_lim = 1`, `2`, `3`, `4`, and `5` correspond to minmod, monotonized central, Van Albada, Van Leer, and SUPERBEE, respectively.
544545

546+
- `muscl_eps` controls the slope-product activation threshold for all MUSCL limiters.
547+
When not set (default), the threshold is 1e-9 for minmod/MC, and 1e-6 for others.
548+
Setting `muscl_eps = 0` gives textbook limiter behavior where limiters activate whenever both slopes have the same sign.
549+
545550
- `int_comp` activates interface compression using THINC used in MUSCL Reconstruction, with control parameters (`ic_eps`, and `ic_beta`).
546551

547552
- `riemann_solver` specifies the choice of the Riemann solver that is used in simulation by an integer from 1 through 4.

src/simulation/m_global_parameters.fpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ module m_global_parameters
148148
logical :: nv_uvm_pref_gpu !< Enable explicit gpu memory hints (default FALSE)
149149
!> @}
150150

151+
real(wp) :: muscl_eps !< MUSCL limiter slope-product threshold
151152
real(wp) :: weno_eps !< Binding for the WENO nonlinear weights
152153
real(wp) :: teno_CT !< Smoothness threshold for TENO
153154
logical :: mp_weno !< Monotonicity preserving (MP) WENO
@@ -197,6 +198,7 @@ module m_global_parameters
197198
$:GPU_DECLARE(create='[recon_type, muscl_order, muscl_polyn, muscl_lim]')
198199
#:endif
199200

201+
$:GPU_DECLARE(create='[muscl_eps]')
200202
$:GPU_DECLARE(create='[mpp_lim, model_eqns, mixture_err, alt_soundspeed]')
201203
$:GPU_DECLARE(create='[avg_state, mp_weno, weno_eps, teno_CT, hypoelasticity]')
202204
$:GPU_DECLARE(create='[hyperelasticity, hyper_model, elasticity, low_Mach]')
@@ -521,6 +523,7 @@ contains
521523
model_eqns = dflt_int
522524
mpp_lim = .false.
523525
time_stepper = dflt_int
526+
muscl_eps = dflt_real
524527
weno_eps = dflt_real
525528
teno_CT = dflt_real
526529
mp_weno = .false.
@@ -856,6 +859,15 @@ contains
856859
$:GPU_UPDATE(device='[igr, igr_order, igr_iter_solver]')
857860
#:endif
858861
862+
! muscl_eps: use per-limiter defaults when user did not set it
863+
if (f_is_default(muscl_eps)) then
864+
if (muscl_lim <= 2) then
865+
muscl_eps = 1e-9_wp ! minmod, MC
866+
else
867+
muscl_eps = 1e-6_wp ! Van Albada, Van Leer, SUPERBEE
868+
end if
869+
end if
870+
859871
! Initialize counts: viscous fluids, surface-tension interfaces, curvature interfaces
860872
Re_size = 0
861873
Re_size_max = 0
@@ -1220,6 +1232,7 @@ contains
12201232
$:GPU_UPDATE(device='[num_fluids, num_dims, viscous, num_vels, nb, muscl_lim]')
12211233
#:endif
12221234
1235+
$:GPU_UPDATE(device='[muscl_eps]')
12231236
$:GPU_UPDATE(device='[dir_idx, dir_flg, dir_idx_tau]')
12241237
12251238
$:GPU_UPDATE(device='[relax, relax_model, palpha_eps, ptgalpha_eps]')

src/simulation/m_muscl.fpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,27 +170,26 @@ contains
170170
slope = 0._wp
171171

172172
if (muscl_lim == 1) then ! minmod
173-
if (slopeL*slopeR > 1e-9_wp) then
173+
if (slopeL*slopeR > muscl_eps) then
174174
slope = min(abs(slopeL), abs(slopeR))
175175
end if
176176
if (slopeL < 0._wp) slope = -slope
177177
else if (muscl_lim == 2) then ! MC
178-
if (slopeL*slopeR > 1e-9_wp) then
178+
if (slopeL*slopeR > muscl_eps) then
179179
slope = min(2._wp*abs(slopeL), 2._wp*abs(slopeR))
180180
slope = min(slope, 5e-1_wp*(abs(slopeL) + abs(slopeR)))
181181
end if
182182
if (slopeL < 0._wp) slope = -slope
183183
else if (muscl_lim == 3) then ! Van Albada
184-
if (abs(slopeL) > 1e-6_wp .and. abs(slopeR) > 1e-6_wp .and. abs(slopeL + slopeR) &
185-
& > 1e-6_wp .and. slopeL*slopeR > 1e-6_wp) then
184+
if (slopeL*slopeR > muscl_eps) then
186185
slope = ((slopeL + slopeR)*slopeL*slopeR)/(slopeL**2._wp + slopeR**2._wp)
187186
end if
188187
else if (muscl_lim == 4) then ! Van Leer
189-
if (abs(slopeL + slopeR) > 1.e-6_wp .and. slopeL*slopeR > 1.e-6_wp) then
188+
if (slopeL*slopeR > muscl_eps) then
190189
slope = 2._wp*slopeL*slopeR/(slopeL + slopeR)
191190
end if
192191
else if (muscl_lim == 5) then ! SUPERBEE
193-
if (slopeL*slopeR > 1e-6_wp) then
192+
if (slopeL*slopeR > muscl_eps) then
194193
slope = -1._wp*min(-min(2._wp*abs(slopeL), abs(slopeR)), -min(abs(slopeL), &
195194
& 2._wp*abs(slopeR)))
196195
end if

src/simulation/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ contains
8383

8484
namelist /user_inputs/ case_dir, run_time_info, m, n, p, dt, &
8585
t_step_start, t_step_stop, t_step_save, t_step_print, &
86-
model_eqns, mpp_lim, time_stepper, weno_eps, &
86+
model_eqns, mpp_lim, time_stepper, weno_eps, muscl_eps, &
8787
rdma_mpi, teno_CT, mp_weno, weno_avg, &
8888
riemann_solver, low_Mach, wave_speeds, avg_state, &
8989
bc_x, bc_y, bc_z, &

tests/01DC0251/golden-metadata.txt

Lines changed: 157 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/01DC0251/golden.txt

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)