Convert between coefficient forms
A Runge–Kutta scheme has one Butcher tableau and, for some schemes, low-storage forms: the Shu–Osher form (
A scheme of your own
Write the scheme in the form its source gives, convert, and check it. SSP(4,3), four stages of order 3 with
type(shu_osher_2r_form) :: r2
type(shu_osher_form) :: so
type(butcher_tableau) :: bt
real(R_P), allocatable :: c(:), ac(:)
integer(I4P) :: i
! stage i+1 = a(i) u^n + b(i) stage i + c(i) dt F(stage i)
r2 = shu_osher_2r_form(stages=4, a=[0._R_P, 0._R_P, 2._R_P/3, 0._R_P], b=[1._R_P, 1._R_P, 1._R_P/3, 1._R_P], &
c=[0.5_R_P, 0.5_R_P, 1._R_P/6, 0.5_R_P])
so = shu_osher_from_2r(r2) ! alpha, beta of the Shu–Osher form
bt = butcher_from_shu_osher(so, order=3) ! A, b, c; its SSP coefficient from so
print '(A)', 'SSP(4,3), Butcher tableau (c | A, then b):'
do i=1, bt%stages
print '(F6.3,A,4F7.3)', bt%c(i), ' |', bt%a(i,:)
enddo
print '(A,4F7.3)', ' ', bt%b
c = bt%c ; ac = matmul(bt%a, c)
print '(A,L1)', 'explicit: ', is_explicit(bt)
print '(A,4F8.4)', 'order 1-3: b.1 - 1, b.c - 1/2, b.c^2 - 1/3, b.Ac - 1/6 =', sum(bt%b) - 1, &
dot_product(bt%b, c) - 0.5_R_P, dot_product(bt%b, c**2) - 1._R_P/3, dot_product(bt%b, ac) - 1._R_P/6
print '(A,F8.4)', 'order 4: b.A^2c - 1/24 =', dot_product(bt%b, matmul(bt%a, ac)) - 1._R_P/24
print '(A,F6.3,A,F6.3)', 'SSP coefficient ', ssp_coefficient(so), ', C / stages ', ssp_coefficient(so) / bt%stages
print '(A,4F6.3)', 'forward-Euler fractions f_k ', euler_step_fractions(so)
print '(A,5F9.5)', 'stability polynomial g_k ', stability_polynomial(bt)
print '(A,F7.4,A,F7.4)', 'imaginary-axis bound ', imag_axis_bound(bt), ', real-axis bound ', real_axis_bound(bt)$ cookbook_forms own
SSP(4,3), Butcher tableau (c | A, then b):
0.000 | 0.000 0.000 0.000 0.000
0.500 | 0.500 0.000 0.000 0.000
1.000 | 0.500 0.500 0.000 0.000
0.500 | 0.167 0.167 0.167 0.000
0.167 0.167 0.167 0.500
explicit: T
order 1-3: b.1 - 1, b.c - 1/2, b.c^2 - 1/3, b.Ac - 1/6 = 0.0000 0.0000 0.0000 0.0000
order 4: b.A^2c - 1/24 = -0.0208
SSP coefficient 2.000, C / stages 0.500
forward-Euler fractions f_k 0.500 0.500 0.500 0.500
stability polynomial g_k 1.00000 1.00000 0.50000 0.16667 0.02083
imaginary-axis bound 2.1562, real-axis bound 5.1495shu_osher_from_2rgives the Shu–Osher form,butcher_from_shu_osherthe tableau (withorder=as declared, and the SSP coefficient of the form).butcher_from_shu_osher_2rdoes both at once.- The four conditions of order 3 hold, and
: order 3, not 4. in the stability polynomial is the same fact on a linear problem. for four stages, , where ssp-33has(Schemes). The forward-Euler fractions are all . - The stepper takes schemes of the catalogue only, by name. A scheme of your own runs through the flat kernels: A step of your own runs this one.
The catalogue's forms
Every scheme's forms besides the Butcher one, converted back, against butcher(scheme):
type(butcher_tableau) :: bt
type(shu_osher_form) :: so
type(shu_osher_2r_form) :: r2
type(williamson_2n_form) :: w
character(15) :: col(3)
integer(I4P) :: s
print '(A)', 'scheme Shu-Osher two-register Williamson 2N (max |A, b - butcher(scheme)|)'
do s=1, size(RK_SCHEMES)
bt = butcher(trim(RK_SCHEMES(s)))
so = shu_osher(trim(RK_SCHEMES(s))) ! 0 stages: the scheme has no such form
r2 = shu_osher_2r(trim(RK_SCHEMES(s)))
w = williamson_2n(trim(RK_SCHEMES(s)))
col = ' -'
if (so%stages > 0) col(1) = diff(bt, butcher_from_shu_osher(so))
if (r2%stages > 0) col(2) = diff(bt, butcher_from_shu_osher(shu_osher_from_2r(r2)))
if (w%stages > 0) col(3) = diff(bt, butcher_from_williamson_2n(w))
print '(A16,3A15)', RK_SCHEMES(s), col
enddo$ cookbook_forms catalogue
scheme Shu-Osher two-register Williamson 2N (max |A, b - butcher(scheme)|)
euler 0 0 -
ssp-22 0 0 -
ssp-33 0 0 -
ssp-54 0 - -
ssp-104 0 - -
rk4 - - -
lsrk-33 - - 0
lsrk-54 - - 0
lsrk-64 - - 0
lsrk-74 - - 0
lsrk-124 - - 0
lsrk-134 - - 0
lsrk-144 - - 0
heun-euler-21 - - -
cash-karp-54 - - -
dopri-54 - - -
calvo-65 - - -
feagin-108 - - -
runge-2 - - -
heun-2 - - -
kutta-3 - - -
ralston-4 - - -
shanks-4 - - -
butcher-6 - - -
ssp-53 0 - -
jiang-shu-4 0 - -
ssp-43 0 0 -
shanks-7 - - -
shanks-7b - - -
shanks-8 - - -
cooper-verner-8 - - -
tmy-7s - - -
stepanov-10 - - -
zhang-10 - - -
bs-32 - - -
fehlberg-45 - - -
tsitouras-54 - - -
stepanov-54 - - -
pp-54a - - -
pp-54b - - -
dopri-65 - - -
tsit-pap-64 - - -
verner-65a - - -
verner-65r - - -
tsit-pap-75 - - -
verner-76e - - -
verner-76r - - -
sharp-smart-76 - - -
fehlberg-78 - - -
verner-78a - - -
tsit-pap-86 - - -
dopri-87 - - -
verner-87e - - -
verner-87r - - -
enright-ver-87 - - -
fehlberg-89 - - -
verner-89 - - -
tsitouras-98 - - -
verner-98e - - -
verner-98r - - -
sharp-98 - - -
dopri-853 - - -
bs-54 - - -shu_osher(scheme), shu_osher_2r(scheme) and williamson_2n(scheme) return a form of 0 stages when the scheme has no such form (-). Every conversion gives the catalogue's tableau bitwise (0). For ssp-54, ssp-104 and the lsrk schemes that is by construction: butcher stores the conversion of their published form. For euler, ssp-22 and ssp-33 the Butcher literals and their converted low-storage forms agree to the last bit.