"ImplicitRungeKutta" Method for NDSolve

Introduction

Implicit Runge–Kutta methods have a number of desirable properties.

The Gauss–Legendre methods, for example, are self-adjoint, meaning that they provide the same solution when integrating forward or backward in time.

This loads packages defining some example problems and utility functions:

Needs["DifferentialEquations`NDSolveProblems`"];
Needs["DifferentialEquations`NDSolveUtilities`"];

Coefficients

A generic framework for implicit Runge–Kutta methods has been implemented. The focus so far is on methods with interesting geometric properties and currently covers the following schemes:

The derivation of the method coefficients can be carried out to arbitrary order and arbitrary precision.

Coefficient Generation

This generates the coefficients for the two-stage fourth-order Gauss–Legendre method to 50 decimal digits of precision:

NDSolve`ImplicitRungeKuttaGaussCoefficients[4, 50]

The coefficients have the form {a,(b^T),(c^T)}.

This generates the coefficients for the two-stage fourth-order Gauss–Legendre method exactly. For high-order methods, generating the coefficients exactly can often take a very long time:

NDSolve`ImplicitRungeKuttaGaussCoefficients[4, Infinity]

This generates the coefficients for the six-stage tenth-order RaduaIA implicit Runge–Kutta method to 20 decimal digits of precision:

NDSolve`ImplicitRungeKuttaRadauIACoefficients[10, 20]

Examples

Load an example problem:

system = GetNDSolveProblem["PerturbedKepler"];
vars = system["DependentVariables"];

This problem has two invariants that should remain constant. A numerical method may not be able to conserve these invariants:

invs = system["Invariants"]

This solves the system using an implicit Runge–Kutta Gauss method. The order of the scheme is selected using the "DifferenceOrder" method option:

sol = NDSolve[system, Method->{"FixedStep", Method->{"ImplicitRungeKutta","DifferenceOrder"->10}}, StartingStepSize->1/10]

A plot of the error in the invariants shows an increase as the integration proceeds:

InvariantErrorPlot[invs, vars, T, sol, PlotStyle->{Red, Blue}, InvariantErrorSampleRate->1]

The "ImplicitSolver" method of "ImplicitRungeKutta" has options (RefLink[AccuracyGoal, paclet:ref/AccuracyGoal]) and (RefLink[PrecisionGoal, paclet:ref/PrecisionGoal]) that specify the absolute and relative error to aim for in solving the nonlinear system of equations.

These options have the same default values as the corresponding options in (RefLink[NDSolve, paclet:ref/NDSolve]), since often there is little point in solving the nonlinear system to much higher accuracy than the local error of the method.

However, for certain types of problems it can be useful to solve the nonlinear system up to the working precision:

sol = NDSolve[system, Method->{"FixedStep", Method->{"ImplicitRungeKutta","DifferenceOrder"->10,"ImplicitSolver"->{"Newton", AccuracyGoal->MachinePrecision, PrecisionGoal->MachinePrecision,"IterationSafetyFactor"->1}}}, StartingStepSize->1/10]

The first invariant is the Hamiltonian of the system, and the error is now bounded, as it should be, since the Gauss implicit Runge–Kutta method is a symplectic integrator.

The second invariant is conserved exactly (up to roundoff) since the Gauss implicit Runge–Kutta method conserves quadratic invariants:

InvariantErrorPlot[invs, vars, T, sol, PlotStyle->{Red, Blue}, InvariantErrorSampleRate->1]

This defines the implicit midpoint method as the one-stage implicit Runge–Kutta method of order two.

For this problem it can be more efficient to use a fixed-point iteration instead of a Newton iteration to solve the nonlinear system:

ImplicitMidpoint ={"FixedStep", Method->{"ImplicitRungeKutta","Coefficients"->"ImplicitRungeKuttaGaussCoefficients", "DifferenceOrder"->2,"ImplicitSolver"->{"FixedPoint","AccuracyGoal"->MachinePrecision,"PrecisionGoal"->MachinePrecision,"IterationSafetyFactor"->1 }}};

NDSolve[system,{T,0,1},Method->ImplicitMidpoint, StartingStepSize->1/100]

At present, the implicit Runge–Kutta method framework does not use banded Newton techniques for uncoupling the nonlinear system.

Option Summary

"ImplicitRungeKutta" Options

Options of the method "ImplicitRungeKutta".

The default setting of (RefLink[Automatic, paclet:ref/Automatic]) for the option "StepSizeSafetyFactors" uses the values {9/10,9/10}.

"ImplicitSolver" Options

Common options of "ImplicitSolver".

Options specific to the "Newton" method of "ImplicitSolver".