spectral.RK4#

class spectral.RK4[source]#

Bases: TimeIntegrator

Classical 4th-order Runge-Kutta method (ERK4).

The classical explicit four-stage fourth-order Runge-Kutta method. This is one of the most widely used explicit time integrators, offering a good balance between accuracy and computational cost.

Notes

The method evaluates the right-hand side four times per step at intermediate stages. It is 4th-order accurate and suitable for a wide range of initial value problems, though it lacks special stability properties like SSP methods.

References

Engsig-Karup, “Lecture 5: Initial Value Problems”, p. 58

Methods

__init__

Initialize time integrator.

step

Take one time step.

step(rhs: Callable, u: ndarray, t: float, dt: float) ndarray[source]#

Take one time step.

Parameters:
rhsCallable

Right-hand side function f(u, t)

unp.ndarray

Current solution

tfloat

Current time

dtfloat

Time step

Returns:
np.ndarray

Solution at next time step