Limit a stage admissibly
A strong-stability-preserving scheme is a convex combination of forward-Euler steps, and the residual of stage ssp-54 with a mask.
The forward-Euler step of each stage
stage_euler_fraction(k) of a stepper, or euler_step_fractions of the form itself, with ssp_coefficient beside it:
type(shu_osher_form) :: so
integer(I4P) :: s
print '(A)', 'scheme C 1/C f_k'
do s=1, size(RK_SCHEMES)
so = shu_osher(trim(RK_SCHEMES(s)))
if (so%stages == 0) cycle ! no Shu–Osher form, no guarantee
if (ssp_coefficient(so) <= 0._R_P) cycle ! a form with a negative coefficient (jiang-shu-4)
print '(A8,2F6.3,2X,*(F6.3))', RK_SCHEMES(s), ssp_coefficient(so), 1 / ssp_coefficient(so), &
euler_step_fractions(so)
enddo$ cookbook_limiters fractions
scheme C 1/C f_k
euler 1.000 1.000 1.000
ssp-22 1.000 1.000 1.000 1.000
ssp-33 1.000 1.000 1.000 1.000 1.000
ssp-54 1.508 0.663 0.392 0.663 0.663 0.663 0.584
ssp-104 6.000 0.167 0.167 0.167 0.167 0.167 0.167 0.167 0.167 0.167 0.167 0.167
ssp-53 2.651 0.377 0.377 0.377 0.377 0.377 0.377
ssp-43 2.000 0.500 0.500 0.500 0.500 0.500ssp-54 has stages of different steps; ssp-104 takes rk4 and the lsrk schemes have no Shu–Osher form: no convex decomposition, no guarantee.
The limiter in the stage loop
ssp-104 in its two registers (FORM_KETCHESON_2R), on a 1-D density slab advected by central differences, which do not preserve positivity, at a Courant number of 4 (below the scheme's imaginary-axis bound, 4.92). The stage state is state_aliases_q()), so the limiter reads
call st%initialize(SCHEME_SSP_104, FORM_KETCHESON_2R, lb=[0], ub=[NC+1], components=.false.)
if (.not. st%state_aliases_q()) error stop 'the limiter below works on q: a low-storage form'
dt = 4 * DX ! a Courant number of 4 (imag_axis_bound(): 4.92)call st%begin_step(bx, q)
do k=1, st%stages()
call st%begin_stage(k, bx, dt, q) ! the stage state is q itself
call st%rhs_register_view(r)
lowest = min(lowest, minval(q(1:NC)))
q(0) = q(NC) ; q(NC+1) = q(1)
r(1:NC) = -(q(2:NC+1) - q(0:NC-1)) / (2 * DX) ! central: not positivity-preserving
tau = merge(dt, st%stage_euler_fraction(k) * dt, run == 2) ! the forward-Euler step to make admissible
if (run > 1) then
do i=1, NC
if (q(i) + tau * r(i) < RHO_MIN) then ! cut the residual: q + tau r = RHO_MIN
r(i) = (RHO_MIN - q(i)) / tau
limited = limited + 1
endif
enddo
endif
call st%end_stage(k, bx, dt, q)
enddo
call st%finish_step(bx, dt, q)$ cookbook_limiters limit
limiter lowest density cells limited
no limiter -6.500E-01 0
tau = dt (whole step) 1.156E-03 658
tau = f_k dt (the stage) 1.000E-03 149
[exit status 0]- Without a limiter the density goes negative.
- With
every stage state stays at or above the floor . - With
, the forward-Euler step of the whole step, the result is admissible too, but the limiter cuts more than four times as many residuals: it enforces a step six times longer than the one each stage takes. - A
below loses the guarantee (Tutorial 11 shows going negative).