qmat.qcoeff.butcher
\(Q\)-coefficients based on Butcher tables of Runge-Kutta in the literature.
Examples
>>> from qmat.qcoeff.butcher import RK_SCHEMES
>>> c, b, A = RK_SCHEMES["RK4"]().genCoeffs()
>>> c, (b1, b2), A = RK_SCHEMES["ESDIRK53"]().genCoeffs(embedded=True)
>>> from qmat.qcoeff.butcher import CashKarp
>>> gen = CashKarp()
>>> c, b, A = gen.c, gen.b, gen.A
Attributes
Dictionary storing all the implemented RK methods |
Classes
Base class for Runge-Kutta generators |
|
Forward Euler method (cf Wikipedia) |
|
Explicit Runge-Kutta in 2 steps of order 1 from [Wang & Spiteri, 2007] |
|
Classical Runge-Kutta method of order 2 (cf Wikipedia) |
|
Heun method of order 2 (cf Wikipedia) |
|
Explicit Runge-Kutta in 3 steps of order 2 from [Wang & Spiteri, 2007] |
|
Explicit Runge-Kutta in 3 steps of order 3 from [Wang & Spiteri, 2007] |
|
Explicit Runge-Kutta in 5 steps of order 3 from [Wang & Spiteri, 2007] |
|
Classical Runge Kutta method of order 4 (cf Wikipedia) |
|
The 3/8-rule due to Kutta, order 4 (cf Wikipedia) |
|
Explicit Runge-Kutta in 6 steps of order 5, (236a) from [Butcher, 2016] |
|
Fifth order explicit embedded Runge-Kutta from [Cash & Karp, 1990]. |
|
Backward Euler method (also SDIRK1, see [Alexander, 1977]) |
|
Implicit Mid-Point Rule, see Wikipedia. |
|
Trapeze method, see Wikipedia. |
|
First S-stable Diagonally Implicit Runge Kutta method of order 2 in two stages from [Alexander, 1977]. |
|
Second S-stable Diagonally Implicit Runge Kutta method of order 2 in two stages from [Alexander, 1977]. |
|
S-stable Diagonally Implicit Runge Kutta method of order 3 in three stages from [Alexander, 1977]. |
|
L-stable Diagonally Implicit RK method with four stages of order 3 from Wikipedia. |
|
Gauss-Legendre method of order 4 (cf Wikipedia). |
|
S-stable Diagonally Implicit Runge Kutta method of order 4 in five stages from [Hairer & Wanner, 1996]. |
|
Embedded A-stable diagonally implicit RK pair of order 3 and 4 from [Norsett & Thomsen, 1984]. |
|
Stiffly accurate, fourth-order EDIRK with four stages, taken from [Kennedy & Carpenter, 2016], second one in eq. (216). |
|
A-stable embedded RK pair of orders 4 and 3, ESDIRK4(3)6L[2]SA, from [Kennedy & Carpenter, 2016]. |
|
A-stable embedded RK pair of orders 5 and 3, ESDIRK5(3)6L[2]SA, from [Kennedy & Carpenter, 2016]. |
|
Explicit part of the ARK54 scheme. |
|
Implicit part of the ARK54 scheme. |
|
Stiffly accurate singly diagonally L-stable implicit embedded Runge-Kutta pair of orders 5 and 4 with explicit first stage from [Kennedy & Carpenter, 2019]. |
|
Explicit embedded pair of Runge-Kutta methods of orders 5 and 4 from [Kennedy & Carpenter, 2019]. |
|
Explicit part of embedded additive Runge-Kutta pair of orders 3 and 2 from [Kennedy & Carpenter, 2003]. |
|
Implicit part of embedded additive Runge-Kutta pair of orders 3 and 2 from [Kennedy & Carpenter, 2003]. |
|
2nd-order 2-stages EDIRK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.6]. |
|
2nd-order 2-stages ERK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.6]. |
|
3rd-order 4-stages ESDIRK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.8]. |
|
3rd-order 4-stages ERK scheme [Ascher, Ruuth & Spiteri, 1997 - sec 2.8]. |
|
3rd-order 3-stages ESDIRK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.7]. |
|
4rd-order 4-stages ERK scheme [Ascher, Ruuth & Spiteri, 1997 - sec 2.7]. |
|
A stable 7-stages fourth order diagonally implicit stiffly accurate Runge-Kutta method with explicit first stage. |
|
7-stages fourth order explicit stiffly accurate Runge-Kutta method. |
Functions
|
Check that a RK-inherited class is correctly implemented (and store it into the |
|
Class decorator registering a RK method in qmat |
Module Contents
- class RK(padding=None)[source]

Base class for Runge-Kutta generators
- Parameters:
padding (str, optional) – Eventually add padding to the Butcher table. Can be
LEFT : add padding corresponding to an additional node at t=0
RIGHT : add padding corresponding to an additional node at t=1
BOTH : add both LEFT and RIGHT padding
The default is None.
- A = None
\(A\) matrix of the Butcher table
- b = None
\(b\) coefficients of the Butcher table
- c = None
\(c\) coefficients of the Butcher table
- b2 = None
\(b_2\) coefficients for the embedded methods
- property nodes: numpy.ndarray
Nodes \(\tau\) (\(c\) coefficients in Butcher table)
- property weights: numpy.ndarray
Weights \(\omega\) (\(b\) coefficients in Butcher table)
- property weightsEmbedded: numpy.ndarray
Weights for a secondary lower order method from the same stages.
- property Q: numpy.ndarray
\(Q\) coefficients (\(A\) Butcher table)
- property hCoeffs: numpy.ndarray
\(h\) interpolation coefficients for the right boundary
- RK_SCHEMES
Dictionary storing all the implemented RK methods
- checkAndStore(cls: RK) RK[source]
Check that a RK-inherited class is correctly implemented (and store it into the
RK_SCHEMESdict)
- class FE(padding=None)[source]

Forward Euler method (cf Wikipedia)
- aliases = ['EE']
- A = [[0]]
\(A\) matrix of the Butcher table
- b = [1]
\(b\) coefficients of the Butcher table
- c = [0]
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class RK21(padding=None)[source]

Explicit Runge-Kutta in 2 steps of order 1 from [Wang & Spiteri, 2007]
- aliases = ['ERK21']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class RK2(padding=None)[source]

Classical Runge-Kutta method of order 2 (cf Wikipedia)
- aliases = ['ERK2', 'ExplicitMidPoint', 'EMP']
- A
\(A\) matrix of the Butcher table
- b = [0, 1]
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class HEUN2(padding=None)[source]

Heun method of order 2 (cf Wikipedia)
- aliases = ['HEUN', 'HeunEuler']
- A = [[0, 0], [1, 0]]
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c = [0, 1.0]
\(c\) coefficients of the Butcher table
- b2 = [1, 0]
\(b_2\) coefficients for the embedded methods
- property order: int
Global convergence order of the method
- class RK32(padding=None)[source]

Explicit Runge-Kutta in 3 steps of order 2 from [Wang & Spiteri, 2007]
- aliases = ['ERK32', 'RK32-SSP']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class RK33(padding=None)[source]

Explicit Runge-Kutta in 3 steps of order 3 from [Wang & Spiteri, 2007]
- aliases = ['ERK33', 'RK33-SSP']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class RK53(padding=None)[source]

Explicit Runge-Kutta in 5 steps of order 3 from [Wang & Spiteri, 2007]
- aliases = ['ERK53']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class RK4(padding=None)[source]

Classical Runge Kutta method of order 4 (cf Wikipedia)
- aliases = ['ERK4']
- A = [[0, 0, 0, 0], [0.5, 0, 0, 0], [0, 0.5, 0, 0], [0, 0, 1, 0]]
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class RK4_38(padding=None)[source]

The 3/8-rule due to Kutta, order 4 (cf Wikipedia)
- aliases = ['ERK4_38']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class RK65(padding=None)[source]

Explicit Runge-Kutta in 6 steps of order 5, (236a) from [Butcher, 2016]
- aliases = ['ERK65']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c = [0, 0.25, 0.25, 0.5, 0.75, 1]
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class CashKarp(padding=None)[source]

Fifth order explicit embedded Runge-Kutta from [Cash & Karp, 1990].
- aliases = ['Cash_Karp']
- c
\(c\) coefficients of the Butcher table
- b
\(b\) coefficients of the Butcher table
- b2
\(b_2\) coefficients for the embedded methods
- A
\(A\) matrix of the Butcher table
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [32, 64, 128]
- class BE(padding=None)[source]

Backward Euler method (also SDIRK1, see [Alexander, 1977])
- aliases = ['IE', 'SDIRK1']
- A = [[1]]
\(A\) matrix of the Butcher table
- b = [1]
\(b\) coefficients of the Butcher table
- c = [1]
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class MidPoint(padding=None)[source]

Implicit Mid-Point Rule, see Wikipedia.
- aliases = ['IMP', 'ImplicitMidPoint']
- A
\(A\) matrix of the Butcher table
- b = [1]
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class TRAP(padding=None)[source]

Trapeze method, see Wikipedia.
- aliases = ['TRAPZ', 'CN', 'CrankNicolson']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c = [0, 1]
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class SDIRK2(padding=None)[source]

First S-stable Diagonally Implicit Runge Kutta method of order 2 in two stages from [Alexander, 1977].
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class SDIRK2_2(padding=None)[source]

Second S-stable Diagonally Implicit Runge Kutta method of order 2 in two stages from [Alexander, 1977].
- aliases = ['SDIRK2-2']
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [64, 128, 256]
- class SDIRK3(padding=None)[source]

S-stable Diagonally Implicit Runge Kutta method of order 3 in three stages from [Alexander, 1977].
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c = [0.43586652150845967, 0.7179332607542298, 1.0]
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class DIRK43(padding=None)[source]

L-stable Diagonally Implicit RK method with four stages of order 3 from Wikipedia.
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class GAUSS_LG(padding=None)[source]

Gauss-Legendre method of order 4 (cf Wikipedia).
- aliases = ['GAUSS-LG']
- A
\(A\) matrix of the Butcher table
- b = [0.5, 0.5]
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class SDIRK54(padding=None)[source]

S-stable Diagonally Implicit Runge Kutta method of order 4 in five stages from [Hairer & Wanner, 1996].
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class EDIRK43(padding=None)[source]

Embedded A-stable diagonally implicit RK pair of order 3 and 4 from [Norsett & Thomsen, 1984].
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- b2
\(b_2\) coefficients for the embedded methods
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [32, 64, 128]
- class EDIRK4(padding=None)[source]

Stiffly accurate, fourth-order EDIRK with four stages, taken from [Kennedy & Carpenter, 2016], second one in eq. (216).
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [32, 64, 128]
- class ESDIRK43(padding=None)[source]

A-stable embedded RK pair of orders 4 and 3, ESDIRK4(3)6L[2]SA, from [Kennedy & Carpenter, 2016].
- s2 = 1.4142135623730951
- c
\(c\) coefficients of the Butcher table
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- b2
\(b_2\) coefficients for the embedded methods
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [64, 128, 256]
- class ESDIRK53(padding=None)[source]

A-stable embedded RK pair of orders 5 and 3, ESDIRK5(3)6L[2]SA, from [Kennedy & Carpenter, 2016].
- c
\(c\) coefficients of the Butcher table
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- b2
\(b_2\) coefficients for the embedded methods
- property orderEmbedded: int
Global convergence order of the associated embedded method
- property order: int
Global convergence order of the method
- class ARK548L2SAERK(padding=None)[source]

Explicit part of the ARK54 scheme.
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- c
\(c\) coefficients of the Butcher table
- b2
\(b_2\) coefficients for the embedded methods
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [32, 64, 128]
- class ARK548L2SAESDIRK(padding=None)[source]

Implicit part of the ARK54 scheme. Be careful with the embedded scheme : it seems that both schemes are order 5 as opposed to 5 and 4 as claimed. This may cause issues when doing adaptive time-stepping.
- A
\(A\) matrix of the Butcher table
- property orderEmbedded: int
Global convergence order of the associated embedded method
- class ARK548L2SAESDIRK2(padding=None)[source]

Stiffly accurate singly diagonally L-stable implicit embedded Runge-Kutta pair of orders 5 and 4 with explicit first stage from [Kennedy & Carpenter, 2019]. This method is part of the IMEX method ARK548L2SA.
- gamma = 0.2222222222222222
- c
\(c\) coefficients of the Butcher table
- b
\(b\) coefficients of the Butcher table
- A
\(A\) matrix of the Butcher table
- b2
\(b_2\) coefficients for the embedded methods
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [16, 32, 64]
- class ARK548L2SAERK2(padding=None)[source]

Explicit embedded pair of Runge-Kutta methods of orders 5 and 4 from [Kennedy & Carpenter, 2019]. This method is part of the IMEX method ARK548L2SA.
- A
\(A\) matrix of the Butcher table
- class ARK324L2SAERK(padding=None)[source]

Explicit part of embedded additive Runge-Kutta pair of orders 3 and 2 from [Kennedy & Carpenter, 2003].
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- b2
\(b_2\) coefficients for the embedded methods
- c
\(c\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class ARK324L2SAESDIRK(padding=None)[source]

Implicit part of embedded additive Runge-Kutta pair of orders 3 and 2 from [Kennedy & Carpenter, 2003].
- A
\(A\) matrix of the Butcher table
- CONV_TEST_NSTEPS = [120, 100, 80]
- class ARK222EDIRK(padding=None)[source]

2nd-order 2-stages EDIRK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.6]. Use as implicit part for ARK scheme in combination with ARK222ERK.
- gamma
- delta
- c
\(c\) coefficients of the Butcher table
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class ARK222ERK(padding=None)[source]

2nd-order 2-stages ERK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.6]. Use as explicit part for ARK scheme in combination with ARK222EDIRK.
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- class ARK443ESDIRK(padding=None)[source]

3rd-order 4-stages ESDIRK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.8]. Use as implicit part for ARK scheme in combination with ARK443ERK.
- c
\(c\) coefficients of the Butcher table
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class ARK443ERK(padding=None)[source]

3rd-order 4-stages ERK scheme [Ascher, Ruuth & Spiteri, 1997 - sec 2.8]. Use as explicit part for ARK scheme in combination with ARK443ESDIRK.
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- class ARK343ESDIRK(padding=None)[source]

3rd-order 3-stages ESDIRK scheme from [Ascher, Ruuth & Spiteri, 1997 - sec 2.7]. Use as implicit part for ARK scheme in combination with ARK443ERK.
- c
\(c\) coefficients of the Butcher table
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- class ARK343ERK(padding=None)[source]

4rd-order 4-stages ERK scheme [Ascher, Ruuth & Spiteri, 1997 - sec 2.7]. Use as explicit part for ARK scheme in combination with ARK343ESDIRK.
- A
\(A\) matrix of the Butcher table
- property order: int
Global convergence order of the method
- class ARK4EDIRK(padding=None)[source]

A stable 7-stages fourth order diagonally implicit stiffly accurate Runge-Kutta method with explicit first stage. Implicit part of Additive RK.4.A.2 from [Liu & Zou, 2006]. Use with ARK4ERK to get fourth order stiffly accurate IMEX method.
- c
\(c\) coefficients of the Butcher table
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table
- property order: int
Global convergence order of the method
- CONV_TEST_NSTEPS = [60, 40, 20, 10]
- class ARK4ERK(padding=None)[source]

7-stages fourth order explicit stiffly accurate Runge-Kutta method. Explicit part of Additive RK.4.A.2 from [Liu & Zou, 2006]. Use with ARK4EDIRK to get fourth order stiffly accurate IMEX method.
- A
\(A\) matrix of the Butcher table
- b
\(b\) coefficients of the Butcher table