RungeKutta Methods

BasicsStability Analysis
Order Conditions and Error AnalysisExtending the RungeKutta Framework
Functionality for RungeKutta methods is provided under the Integreat`RK` context.
This loads the RungeKutta subpackage:
Basics
A RungeKutta method numerically approximates the solution of an initial value problem
One step of a RungeKutta method is given by
where is the time step and . Some methods include an embedded solution to facilitate error estimation and time step adaptivity:
The coefficients which determine the RungeKutta method are often displayed as a Butcher tableau:
Integreat represents RungeKutta methods using the function RK. There are a number of constructors, but some of the primary are
RK[A,b,c]
constructs a RungeKutta method with coefficients A, b, and c.
RK[A,b]
constructs a RungeKutta method with c coefficients that are the row sum of A.
RK[A,b,c,bHat]
constructs an embedded RungeKutta pair.
Creating a RungeKutta method.
This creates Heun's method with forward Euler used as the embedding.
Once a RungeKutta method is constructed, a wide range of properties can be queried. We start by showing how to recover the defining coefficients.
RKA[rk]
gives the coefficients of the RungeKutta method rk.
RKB[rk]
gives the coefficients of the RungeKutta method rk.
RKC[rk]
gives the coefficients of the RungeKutta method rk.
RKBHat[rk]
gives the embedded coefficients of an embedded RungeKutta pair rk.
Access method coefficients.
Extract the coefficients from an embedded pair.
There are three options defined for RKB which play a core role in Integreat's support for advanced features like embedded methods, dense output, and per-stage properties.
EmbeddedFalse
whether to return the embedded coefficients
StageNone
treat a stage as the solution
DenseOutputFalse
how to evaluate dense output
Options for RKB.
Use options for RKB.
Whenever appropriate, functions for computing RungeKutta properties use the same options as RKB. This facilitates, for example, plotting the stability region of an embedded method, generating the order conditions for a dense output solution, and checking the dissipation error of a particular RungeKutta stage. In the next sections, we will explore some of these capabilities.
Order Conditions and Error Analysis
Deriving order conditions for RungeKutta methods by hand is a notoriously tedious and error-prone. Integreat uses B-trees to automate and simplify this process.
RKOrderConditions[rk,p]
generates the order condition residuals of rk up to order p grouped by order.
RKOrder[rk]
computes the order of accuracy of rk.
RKErrorA[rk]
computes the 2-norm of the principal error residuals of rk.
Select functions for order conditions.
Generate order conditions for a two stage RungeKutta method.
Find the order of an embedded method.
Once order conditions are generated, functions like Solve and SolveAlways can be used to find solutions. The parameterization of a method plays a significant role in how well these functions perform. We demonstrate this in the next two examples where we seek a family of explicit, third order RungeKutta methods.
This parameterization of a RungeKutta method leads to complicated solutions with branching.
Here, the method is parameterized so that the row sum of is . When invoking Solve, the abscissae are left as free variables. We recommend this approach as it generally provides simpler and faster solutions.
With order conditions solved, free variables can be used to optimize other properties of the method. One common approach is minimizing the principal error.
Find the explicit, third order RungeKutta method with the smallest error:
Stability Analysis
Linear stability analysis considers the behavior of a RungeKutta method applied to the Dahlquist test problem . The numerical solution for this problem is , where
is the linear stability function and . The set of z for which is known as the region of absolute stability. The size of the stability region determines the range of stable time steps a RungeKutta method can take.
RKLinearStability[rk,z]
evaluates the linear stability function of rk at z.
RKLinearStabilityPlot[rk]
plots the linear stability region of rk.
RKAStable[rk]
returns an algebraic condition equivalent to rk being stable in the left half-plane.
Select functions for linear stability analysis.
Check linear stability properties of the classical fourth order RungeKutta method.
Integreat also include nonlinear stability analysis capabilities.
RKAlgebraicallyStableQ[rk]
returns True if rk is algebraically stable and False, otherwise.
RKAbsoluteMonotonicityRadius[rk]
computes the radius of absolute monotonicity, also known as the strong stability preserving (SSP) coefficient, of rk.
Select functions for nonlinear stability analysis.
Check nonlinear stability properties of a collocation method.
Extending the RungeKutta Framework
Advanced users may need to create custom functions to analyze RungeKutta methods. The patterns _RK and _?RKPairQ can be used to accept an RK object as a function argument. If a custom function uses the coefficients of a method, it probably should accept RKB options.
A custom function to generate linear order condition residuals.