Skip to content

2. The catalogue ​

SELAH ships a fixed catalogue: eight Runge–Kutta schemes and four splittings. Each comes with its coefficients, its order, its SSP coefficient and the storage forms it can run in. This chapter prints them.

fortran
program catalogue
!< Tutorial, chapter 2: the catalogue of schemes, their storage forms and their coefficients.
use selah
implicit none
type(butcher_tableau)       :: bt, bt2
type(splitting_composition) :: sc
integer(I4P)                :: s, i

print '(A)', 'scheme   stages order  SSP coeff  butcher two-reg 2N  ketcheson'
do s=1, size(RK_SCHEMES)
   bt = butcher(trim(RK_SCHEMES(s)))                             ! the names are blank-padded: trim them
   print '(A8,I6,I6,F11.4,4I8)', RK_SCHEMES(s), bt%stages, bt%order, bt%ssp_coefficient, &
         registers_needed(trim(RK_SCHEMES(s)), FORM_BUTCHER), registers_needed(trim(RK_SCHEMES(s)), FORM_SHU_OSHER_2R), &
         registers_needed(trim(RK_SCHEMES(s)), FORM_WILLIAMSON_2N), registers_needed(trim(RK_SCHEMES(s)), FORM_KETCHESON_2R)
enddo
bt = butcher(SCHEME_SSP_33)
print '(/,A)', 'ssp-33, Butcher tableau (c | A, then b):'
do i=1, bt%stages
   print '(F6.3,A,3F7.3)', bt%c(i), ' |', bt%a(i,:)
enddo
print '(A,3F7.3)', '       ', bt%b
bt2 = butcher_from_shu_osher_2r(shu_osher_2r(SCHEME_SSP_33))      ! two-register coefficients -> Butcher
print '(A,ES9.2)', 'two-register form of ssp-33, back to Butcher: max |difference| = ', &
      max(maxval(abs(bt2%a - bt%a)), maxval(abs(bt2%b - bt%b)))
print '(A,L1)', 'explicit: ', is_explicit(bt)
print '(/,A)', 'splitting        flows order  sum of the coefficients of partitions 1, 2'
do s=1, size(SPLITTING_SCHEMES)
   sc = splitting(trim(SPLITTING_SCHEMES(s)))
   print '(A15,I7,I6,2F9.4)', SPLITTING_SCHEMES(s), sc%flows, sc%order, &
         sum(sc%coefficient, mask=sc%partition == 1), sum(sc%coefficient, mask=sc%partition == 2)
enddo
endprogram catalogue
  • RK_SCHEMES and SPLITTING_SCHEMES list the names. They are fixed-length strings padded with blanks, so trim them before passing them on.
  • registers_needed(scheme, form) is the number of field-sized buffers a form needs, or −1 when the scheme has no such form. The Butcher form needs s+1: the stage state and one residual per stage.
  • butcher_from_shu_osher_2r converts the two-register coefficients back to a Butcher tableau. The difference is exactly zero: the conversion uses the summation order of ADAM's code.
  • splitting(name) returns the flows of a composition: which partition each flow advances (partition) and by what fraction of the step (coefficient). Both partitions add up to one whole step.

Running it ​

text
$ catalogue
scheme   stages order  SSP coeff  butcher two-reg 2N  ketcheson
 euler       1     1     1.0000       2       2      -1      -1
 ssp-22      2     2     1.0000       3       2      -1      -1
 ssp-33      3     3     1.0000       4       2      -1      -1
 ssp-54      5     4     1.5082       6      -1      -1      -1
 ssp-104    10     4     6.0000      11      -1      -1       2
 rk4         4     4     0.0000       5      -1      -1      -1
 lsrk-33     3     3     0.0000       4      -1       2      -1
 lsrk-54     5     4     0.0000       6      -1       2      -1

ssp-33, Butcher tableau (c | A, then b):
 0.000 |  0.000  0.000  0.000
 1.000 |  1.000  0.000  0.000
 0.500 |  0.250  0.250  0.000
         0.167  0.167  0.667
two-register form of ssp-33, back to Butcher: max |difference| =  0.00E+00
explicit: T

splitting        flows order  sum of the coefficients of partitions 1, 2
strang               3     2   1.0000   1.0000
yoshida-4            7     4   1.0000   1.0000
blanes-moan-s6      13     4   1.0000   1.0000
blanes-moan-s10     21     6   1.0000   1.0000

Read the table by rows. ssp-104 needs 11 registers in Butcher form but 2 in Ketcheson's form. rk4 and the 2N schemes have no SSP coefficient: 0 means "not SSP" (or "not computed", for a tableau you build yourself).

The SSP coefficient is a lower bound

ssp_coefficient is computed from the Shu–Osher coefficients SELAH stores. A different Shu–Osher representation of the same scheme can give a larger value. For the catalogue the values match the published optimal ones (P2).

What you learned

The catalogue, the storage forms and their register counts, and the conversions between coefficient forms. Reference: Schemes, API: L0.

Next: 3. A field and a box.

GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT, at your choice