Skip to content

5. Low-storage forms ​

The Butcher form of an s-stage scheme keeps s+1 field-sized registers. On a GPU, memory is the scarce resource, and several schemes can be run with two:

FormSchemesRegistersThe update, at the end of stage k
FORM_SHU_OSHER_2Reuler, ssp-22, ssp-332q=akqn+bkq+ΔtckR
FORM_WILLIAMSON_2Nlsrk-33, lsrk-542ΔQ=AkΔQ+ΔtR; q=q+BkΔQ
FORM_KETCHESON_2Rssp-1042Ketcheson's recipe: Euler steps of Δt/6, a combination at stage 5

In these forms the stage state is q itself, advanced in place at every end_stage. The caller asks which array holds the stage state with stage_state_is_q(k):

fortran
call st%begin_step(bx, q)
do k=1, st%stages()
   call st%begin_stage(k, bx, dt, q)
   if (st%stage_state_is_q(k)) then                ! the low-storage forms keep the stage state in q itself
      u => q
   else                                            ! the Butcher form keeps it in a register
      u => st%stage_state()
   endif
   r => st%rhs_register()
   call fill_ghosts(u)
   call residual(u, r, dx)
   call st%end_stage(k, bx, dt, q)                 ! the low-storage forms advance q here
enddo
call st%finish_step(bx, dt, q)                     ! the Butcher form advances q here

Running it ​

text
$ low_storage
scheme   low-storage form   registers (Butcher, low-storage)   max |q_butcher - q_low-storage|
 ssp-33  shu-osher-2r             4       2                    1.67E-15
 lsrk-54 williamson-2n            6       2                    9.99E-16
 ssp-104 ketcheson-2r            11       2                    4.66E-15

Each scheme gives the same solution in both forms, to round-off (the forms add the same terms in a different order), with a third of the registers or less.

Which form, then?

On a GPU, take the low-storage form when the scheme has one: less memory and fewer field passes per step (Performance). Keep the Butcher form when you need the step residual dq (chapter 10), which only it can compute, or a scheme that has no other form (ssp-54, rk4).

Next: 6. Splittings.

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