stepper_kernels Module

Each kernel advances one time step over a FLAT rank-1 view of the whole (halo-padded) solution array, calling back into the dimension's residual assembly through rhs. Stage arithmetic is copied VERBATIM from the historical 1D steppers — the groupings are load-bearing for the project's bit-for-bit refactor invariant; do not re-associate them.

Halo-zero invariant (required of every caller): the whole-array stage updates span halo cells, so they advance halos as ub_halo + cdtresid_halo. This is correct only because resid halo cells are zero — zeroed once at allocation and never written by the residual assembly (which fills interior cells only). Halo u values left stale by the updates are refreshed by halo exchange + BC application inside the next rhs call.

Aliasing: rhs(ctx) writes the same memory resid points at (and reads the memory u points at). The array dummies are POINTERS so this external modification is conforming; do not change them to assumed-shape dummies.


Uses


Abstract Interfaces

abstract interface

  • public subroutine rhs_fn(ctx)

    Recompute the spatial residual for the current solution state. Implementations refresh halos/BCs and fill resid interior cells. Implementations must not modify the context's dt mid-step — kernels freeze dt at entry.

    Arguments

    Type IntentOptional Attributes Name
    class(*), intent(inout), target :: ctx

Subroutines

public subroutine kernel_euler(u, resid, dt, rhs, ctx)

Explicit Euler: Q^{n+1} = Q^n + dt R(Q^n).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), pointer :: u(:)
real(kind=wp), intent(in), pointer :: resid(:)
real(kind=wp), intent(in) :: dt
procedure(rhs_fn) :: rhs
class(*), intent(inout), target :: ctx

public subroutine kernel_ssprk22(u, resid, s1, dt, rhs, ctx)

SSPRK(2,2) (Shu & Osher 1988). 1D-verbatim stage expressions.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), pointer :: u(:)
real(kind=wp), intent(in), pointer :: resid(:)
real(kind=wp), intent(in), pointer :: s1(:)
real(kind=wp), intent(in) :: dt
procedure(rhs_fn) :: rhs
class(*), intent(inout), target :: ctx

public subroutine kernel_tvd_rk3(u, resid, s1, dt, rhs, ctx)

TVD-RK3 (Shu & Osher 1988). 1D-verbatim stage expressions.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), pointer :: u(:)
real(kind=wp), intent(in), pointer :: resid(:)
real(kind=wp), intent(in), pointer :: s1(:)
real(kind=wp), intent(in) :: dt
procedure(rhs_fn) :: rhs
class(*), intent(inout), target :: ctx

public subroutine kernel_rk4(u, resid, s1, s2, dt, rhs, ctx)

Classic RK4 (not SSP). s1 holds Q^n; s2 accumulates the weighted stages.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), pointer :: u(:)
real(kind=wp), intent(in), pointer :: resid(:)
real(kind=wp), intent(in), pointer :: s1(:)
real(kind=wp), intent(in), pointer :: s2(:)
real(kind=wp), intent(in) :: dt
procedure(rhs_fn) :: rhs
class(*), intent(inout), target :: ctx

public subroutine kernel_ssprk54(u, resid, s1, s2, s3, dt, rhs, ctx)

SSPRK(5,4) — Spiteri & Ruuth (2002), SIAM J. Numer. Anal. 40(2), 469-491, Shu-Osher form. Coefficients independently cross-checked against NodePy (ketch/nodepy, runge_kutta_method.py, RK['SSP54']/'SSPRK54', fetched 2026-07-08): converting this routine's Shu-Osher coefficients to Butcher (A, b) form reproduces every one of NodePy's 30-digit A/b entries to 8-12 significant digits, consistent with NodePy's own documented note that its table is a higher-precision (30-digit) re-solve of the same Ruuth-Spiteri method whose originally published coefficients (as coded below, ~15 digits) are only accurate to about 10 digits. Five stages, order 4, SSP coefficient c ~= 1.508. Register use: s1 = u0 (stages 2-4), s2 = u2 then the final stage's partial sum, s3 = u3; the final stage's L(u3) piece is accumulated into s2 before stage 4 overwrites resid (avoids a fourth scratch array). HISTORY: before 2026-07 this routine carried an unpublished 3rd-order tableau (initial-commit transcription defect; see the 2026-07-07 retrospective). The observed-order tripwire test guards against any regression.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), pointer :: u(:)
real(kind=wp), intent(in), pointer :: resid(:)
real(kind=wp), intent(in), pointer :: s1(:)
real(kind=wp), intent(in), pointer :: s2(:)
real(kind=wp), intent(in), pointer :: s3(:)
real(kind=wp), intent(in) :: dt
procedure(rhs_fn) :: rhs
class(*), intent(inout), target :: ctx