Schemes
Choose a scheme and its storage form
Pick the order you need, then the form with the fewest registers. Use the Butcher form only when you need what only it gives (the step residual dq), or when the scheme has no other form.
character(14), parameter :: FORMS(4) = [character(14) :: FORM_BUTCHER, FORM_SHU_OSHER_2R, FORM_WILLIAMSON_2N, &
FORM_KETCHESON_2R]
type(butcher_tableau) :: bt
integer(I4P) :: s, f, n, best
character(14) :: form
print '(A)', 'scheme order SSP fewest registers in form'
do s=1, size(RK_SCHEMES)
bt = butcher(trim(RK_SCHEMES(s)))
best = huge(1_I4P)
do f=1, size(FORMS)
n = registers_needed(trim(RK_SCHEMES(s)), trim(FORMS(f)))
if (n > 0 .and. n < best) then
best = n ; form = FORMS(f)
endif
enddo
print '(A8,I6,A6,I12,6X,A)', RK_SCHEMES(s), bt%order, merge(' yes', ' no', bt%ssp_coefficient > 0._R_P), &
best, trim(form)
enddo$ cookbook_schemes choose
scheme order SSP fewest registers in form
euler 1 yes 2 butcher
ssp-22 2 yes 2 shu-osher-2r
ssp-33 3 yes 2 shu-osher-2r
ssp-54 4 yes 6 butcher
ssp-104 4 yes 2 ketcheson-2r
rk4 4 no 5 butcher
lsrk-33 3 no 2 williamson-2n
lsrk-54 4 no 2 williamson-2nssp-54 and rk4 have only the Butcher form. Every other scheme runs in two registers.
The largest strong-stability-preserving time step
If your spatial operator is TVD (or positivity-preserving, or bounded in any convex functional) under a forward-Euler step up to
real(R_P), parameter :: DT_FE = 1.e-3_R_P ! the forward-Euler limit of your spatial operator (CFL_FE dx / a)
type(butcher_tableau) :: bt
integer(I4P) :: s
print '(A)', 'scheme C (SSP coeff) dt_max = C dt_FE residuals per unit time C / stages'
do s=1, size(RK_SCHEMES)
bt = butcher(trim(RK_SCHEMES(s)))
if (bt%ssp_coefficient <= 0._R_P) cycle ! not SSP: no strong-stability guarantee
print '(A8,F12.4,ES17.3,F21.1,F15.3)', RK_SCHEMES(s), bt%ssp_coefficient, bt%ssp_coefficient * DT_FE, &
bt%stages / (bt%ssp_coefficient * DT_FE), bt%ssp_coefficient / bt%stages
enddo$ cookbook_schemes ssp-dt
scheme C (SSP coeff) dt_max = C dt_FE residuals per unit time C / stages
euler 1.0000 1.000E-03 1000.0 1.000
ssp-22 1.0000 1.000E-03 2000.0 0.500
ssp-33 1.0000 1.000E-03 3000.0 0.333
ssp-54 1.5082 1.508E-03 3315.3 0.302
ssp-104 6.0000 6.000E-03 1666.7 0.600C / stagesis the effective coefficient: the fraction of a forward-Euler step gained per residual evaluation.ssp-104(Ketcheson's SSPRK(10,4)) has the best: 0.6. It needs half the residuals ofssp-54per unit time, in two registers instead of six.
The bound is verified on a TVD advection in P1.
Not SSP is not unstable
rk4 and the lsrk-* schemes have no SSP coefficient: they are not guaranteed to preserve TVD-like properties at any step. They are still stable for smooth problems up to their linear stability limit (A5).