Runge_Kutta#

class ARK2(params, level)[source]#

Bases: RungeKuttaIMEX

Second order two stage singly diagonally implicit globally stiffly accurate IMEX RK method with explicit first stage. Can be used to integrate simple DAEs because explicit and implicit part are both stiffly accurate.

generator_EXP = <qmat.qcoeff.butcher.ARK222ERK object>#
generator_IMP = <qmat.qcoeff.butcher.ARK222EDIRK object>#
matrix = array([[0.        , 0.        , 0.        ],        [0.        , 0.29289322, 0.        ],        [0.        , 0.70710678, 0.29289322]])#
matrix_explicit = array([[ 0.        ,  0.        ,  0.        ],        [ 0.29289322,  0.        ,  0.        ],        [-0.70710678,  1.70710678,  0.        ]])#
nodes = array([0.        , 0.29289322, 1.        ])#
weights = array([0.        , 0.70710678, 0.29289322])#
weights_explicit = array([-0.70710678,  1.70710678,  0.        ])#
class ARK3(params, level)[source]#

Bases: RungeKuttaIMEX

Third order four stage singly diagonally implicit globally stiffly accurate IMEX RK method with explicit first stage. Can be used to integrate simple DAEs because explicit and implicit part are both stiffly accurate.

generator_EXP = <qmat.qcoeff.butcher.ARK443ERK object>#
generator_IMP = <qmat.qcoeff.butcher.ARK443ESDIRK object>#
matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ],        [ 0.        ,  0.5       ,  0.        ,  0.        ,  0.        ],        [ 0.        ,  0.16666667,  0.5       ,  0.        ,  0.        ],        [ 0.        , -0.5       ,  0.5       ,  0.5       ,  0.        ],        [ 0.        ,  1.5       , -1.5       ,  0.5       ,  0.5       ]])#
matrix_explicit = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ],        [ 0.5       ,  0.        ,  0.        ,  0.        ,  0.        ],        [ 0.61111111,  0.05555556,  0.        ,  0.        ,  0.        ],        [ 0.83333333, -0.83333333,  0.5       ,  0.        ,  0.        ],        [ 0.25      ,  1.75      ,  0.75      , -1.75      ,  0.        ]])#
nodes = array([0.        , 0.5       , 0.66666667, 0.5       , 1.        ])#
weights = array([ 0. ,  1.5, -1.5,  0.5,  0.5])#
weights_explicit = array([ 0.25,  1.75,  0.75, -1.75,  0.  ])#
class ARK32(params, level)[source]#

Bases: RungeKuttaIMEX

Embedded IMEX Runge-Kutta method ARK3(2)4L[2]SA of Kennedy and Carpenter, of orders 3 and 2.

ButcherTableauClass#

alias of ButcherTableauEmbedded

ButcherTableauClass_explicit#

alias of ButcherTableauEmbedded

classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the second order secondary method.

Returns:

int – 3

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ],        [ 0.43586652,  0.43586652,  0.        ,  0.        ],        [ 0.25764825, -0.09351477,  0.43586652,  0.        ],        [ 0.18764102, -0.59529747,  0.97178993,  0.43586652]])#
matrix_explicit = array([[ 0.        ,  0.        ,  0.        ,  0.        ],        [ 0.87173304,  0.        ,  0.        ,  0.        ],        [ 0.52758901,  0.07241099,  0.        ,  0.        ],        [ 0.39909601, -0.43755765,  1.03846165,  0.        ]])#
nodes = array([0.        , 0.87173304, 0.6       , 1.        ])#
weights = array([[ 0.18764102, -0.59529747,  0.97178993,  0.43586652],        [ 0.21474029, -0.48516226,  0.868725  ,  0.40169698]])#
class ARK324L2SAERK(params, level)[source]#

Bases: RungeKutta

Explicit part of ARK32: an explicit embedded Runge-Kutta pair of orders 3 and 2.

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.ARK324L2SAERK object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the second order secondary method.

Returns:

int – 3

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ],        [ 0.87173304,  0.        ,  0.        ,  0.        ],        [ 0.52758901,  0.07241099,  0.        ,  0.        ],        [ 0.39909601, -0.43755765,  1.03846165,  0.        ]])#
nodes = array([0.        , 0.87173304, 0.6       , 1.        ])#
weights = array([[ 0.18764102, -0.59529747,  0.97178993,  0.43586652],        [ 0.21474029, -0.48516226,  0.868725  ,  0.40169698]])#
class ARK324L2SAESDIRK(params, level)[source]#

Bases: ARK324L2SAERK

Implicit part of ARK32: an L-stable, stiffly accurate ESDIRK pair of orders 3 and 2.

generator = <qmat.qcoeff.butcher.ARK324L2SAESDIRK object>#
matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ],        [ 0.43586652,  0.43586652,  0.        ,  0.        ],        [ 0.25764825, -0.09351477,  0.43586652,  0.        ],        [ 0.18764102, -0.59529747,  0.97178993,  0.43586652]])#
class ARK54(params, level)[source]#

Bases: RungeKuttaIMEX

IMEX Runge-Kutta method ARK5(4)8L[2]SA of Kennedy and Carpenter, combining ARK548L2SAERK and ARK548L2SAESDIRK. Pair of pairs of ARK5(4)8L[2]SA-ERK and ARK5(4)8L[2]SA-ESDIRK from [here](https://doi.org/10.1016/S0168-9274(02)00138-1).

ButcherTableauClass#

alias of ButcherTableauEmbedded

ButcherTableauClass_explicit#

alias of ButcherTableauEmbedded

classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the fourth order secondary method.

Returns:

int – 5

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.205     ,  0.205     ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.1025    , -0.04757042,  0.205     ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.07389944,  0.        , -0.08074895,  0.205     ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.29921812,  0.        ,  2.46382067, -2.04803878,  0.205     ,          0.        ,  0.        ,  0.        ],        [ 0.14689238,  0.        ,  0.11740333, -0.22170197, -0.00759375,          0.205     ,  0.        ,  0.        ],        [ 0.1784573 ,  0.        ,  1.01974675, -0.22154535, -0.03612492,         -0.54553377,  0.205     ,  0.        ],        [-0.09554859,  0.        ,  0.        ,  2.3386928 , -0.14043176,         -2.07058771,  0.76287525,  0.205     ]])#
matrix_explicit = array([[  0.        ,   0.        ,   0.        ,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.41      ,   0.        ,   0.        ,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.17753521,   0.08239438,   0.        ,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.12262308,   0.        ,   0.07552741,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  2.29017765,   0.        ,  11.24492577, -12.61510341,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.40294452,   0.        ,   1.35401238,  -1.4857009 ,          -0.031256  ,   0.        ,   0.        ,   0.        ],        [  1.46413844,   0.        ,   7.23046868,  -7.84460712,          -0.125     ,  -0.125     ,   0.        ,   0.        ],        [ -1.674808  ,   0.        ,  -6.38943865,  14.69220068,           0.09466623,  -7.21115733,   1.48853707,   0.        ]])#
nodes = array([0.        , 0.41      , 0.25992958, 0.19815049, 0.92      ,        0.24      , 0.6       , 1.        ])#
weights = array([[-0.09554859,  0.        ,  0.        ,  2.3386928 , -0.14043176,         -2.07058771,  0.76287525,  0.205     ],        [-0.09957696,  0.        ,  0.        ,  2.40716288, -0.16014818,         -2.1442366 ,  0.77956562,  0.21723324]])#
class ARK548L2SA(params, level)[source]#

Bases: RungeKuttaIMEX

Newer order-5 IMEX Runge-Kutta method ARK5(4)8L[2]SA of Kennedy and Carpenter, an alternative to ARK54. It is based on the explicit method ARK548L2SAERK2 and the implicit method ARK548L2SAESDIRK2 from [here](https://doi.org/10.1016/j.apnum.2018.10.007).

According to Kennedy and Carpenter (see reference), the two IMEX RK methods of order 5 are the only ones available as of now. And we are not aware of higher order ones. This one is newer then the other one and apparently better.

ButcherTableauClass#

alias of ButcherTableauEmbedded

ButcherTableauClass_explicit#

alias of ButcherTableauEmbedded

classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the fourth order secondary method.

Returns:

int – 5

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.22222222,  0.22222222,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.26824595,  0.26824595,  0.22222222,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.05794559, -0.05794559,  0.0089384 ,  0.22222222,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.04330529, -0.04330529, -0.03401389,  0.25515937,  0.22222222,          0.        ,  0.        ,  0.        ],        [ 0.13179599,  0.13179599, -0.03237673,  0.12385474,  0.14270778,          0.22222222,  0.        ,  0.        ],        [ 0.30932282,  0.30932282, -0.68291993, -0.05882276, -0.04130861,          0.89718343,  0.22222222,  0.        ],        [ 0.        ,  0.        ,  0.17366254,  0.25479166,  0.24190177,          0.30740486, -0.19998305,  0.22222222]])#
matrix_explicit = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.11111111,  0.64760301,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.09182987,  0.03544857, -0.012009  ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.34252355, -0.26767786,  0.11056894,  0.85638959,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.00977228,  0.21070865,  0.07592412,  0.20765519,  0.23548432,          0.        ,  0.        ,  0.        ],        [ 0.46686371,  1.29035988,  0.37840597, -0.56345584, -0.28832383,         -0.32884988,  0.        ,  0.        ],        [ 0.61439672,  0.61439672,  0.3174778 , -0.71215206,  0.11498708,          0.09139032, -0.04049657,  0.        ]])#
nodes = array([0.        , 0.44444444, 0.75871412, 0.11526943, 0.35675713,        0.72      , 0.955     , 1.        ])#
weights = array([[ 0.        ,  0.        ,  0.17366254,  0.25479166,  0.24190177,          0.30740486, -0.19998305,  0.22222222],        [ 0.        ,  0.        ,  0.06272422,  0.25523316,  0.23902755,          0.39907952, -0.14315725,  0.18709281]])#
class ARK548L2SAERK(params, level)[source]#

Bases: RungeKutta

Explicit part of the ARK54 scheme.

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.ARK548L2SAERK object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the fourth order secondary method.

Returns:

int – 5

matrix = array([[  0.        ,   0.        ,   0.        ,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.41      ,   0.        ,   0.        ,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.17753521,   0.08239438,   0.        ,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.12262308,   0.        ,   0.07552741,   0.        ,           0.        ,   0.        ,   0.        ,   0.        ],        [  2.29017765,   0.        ,  11.24492577, -12.61510341,           0.        ,   0.        ,   0.        ,   0.        ],        [  0.40294452,   0.        ,   1.35401238,  -1.4857009 ,          -0.031256  ,   0.        ,   0.        ,   0.        ],        [  1.46413844,   0.        ,   7.23046868,  -7.84460712,          -0.125     ,  -0.125     ,   0.        ,   0.        ],        [ -1.674808  ,   0.        ,  -6.38943865,  14.69220068,           0.09466623,  -7.21115733,   1.48853707,   0.        ]])#
nodes = array([0.        , 0.41      , 0.25992958, 0.19815049, 0.92      ,        0.24      , 0.6       , 1.        ])#
weights = array([[-0.09554859,  0.        ,  0.        ,  2.3386928 , -0.14043176,         -2.07058771,  0.76287525,  0.205     ],        [-0.09957696,  0.        ,  0.        ,  2.40716288, -0.16014818,         -2.1442366 ,  0.77956562,  0.21723324]])#
class ARK548L2SAERK2(params, level)[source]#

Bases: ARK548L2SAESDIRK2

Explicit part of ARK548L2SA: an explicit embedded Runge-Kutta pair of orders 5 and 4. Taken from [here](https://doi.org/10.1016/j.apnum.2018.10.007). This method is part of the IMEX method ARK548L2SA.

generator_EXP = <qmat.qcoeff.butcher.ARK548L2SAERK2 object>#
matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.11111111,  0.64760301,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.09182987,  0.03544857, -0.012009  ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.34252355, -0.26767786,  0.11056894,  0.85638959,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.00977228,  0.21070865,  0.07592412,  0.20765519,  0.23548432,          0.        ,  0.        ,  0.        ],        [ 0.46686371,  1.29035988,  0.37840597, -0.56345584, -0.28832383,         -0.32884988,  0.        ,  0.        ],        [ 0.61439672,  0.61439672,  0.3174778 , -0.71215206,  0.11498708,          0.09139032, -0.04049657,  0.        ]])#
class ARK548L2SAESDIRK(params, level)[source]#

Bases: ARK548L2SAERK

Implicit part of the ARK54 scheme. As Kennedy and Carpenter state, the embedded method has order 4 and the main method order 5. The fifth-order conditions of the embedded method are violated only by about 1e-4, however, so it can look like order 5 in convergence tests at moderate step sizes.

generator_IMP = <qmat.qcoeff.butcher.ARK548L2SAESDIRK object>#
matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.205     ,  0.205     ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.1025    , -0.04757042,  0.205     ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.07389944,  0.        , -0.08074895,  0.205     ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.29921812,  0.        ,  2.46382067, -2.04803878,  0.205     ,          0.        ,  0.        ,  0.        ],        [ 0.14689238,  0.        ,  0.11740333, -0.22170197, -0.00759375,          0.205     ,  0.        ,  0.        ],        [ 0.1784573 ,  0.        ,  1.01974675, -0.22154535, -0.03612492,         -0.54553377,  0.205     ,  0.        ],        [-0.09554859,  0.        ,  0.        ,  2.3386928 , -0.14043176,         -2.07058771,  0.76287525,  0.205     ]])#
class ARK548L2SAESDIRK2(params, level)[source]#

Bases: RungeKutta

Implicit part of ARK548L2SA: an L-stable, stiffly accurate ESDIRK pair of orders 5 and 4. Stiffly accurate singly diagonally L-stable implicit embedded Runge-Kutta pair of orders 5 and 4 with explicit first stage from [here](https://doi.org/10.1016/j.apnum.2018.10.007). This method is part of the IMEX method ARK548L2SA.

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.ARK548L2SAESDIRK2 object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the fourth order secondary method.

Returns:

int – 5

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.22222222,  0.22222222,  0.        ,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [ 0.26824595,  0.26824595,  0.22222222,  0.        ,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.05794559, -0.05794559,  0.0089384 ,  0.22222222,  0.        ,          0.        ,  0.        ,  0.        ],        [-0.04330529, -0.04330529, -0.03401389,  0.25515937,  0.22222222,          0.        ,  0.        ,  0.        ],        [ 0.13179599,  0.13179599, -0.03237673,  0.12385474,  0.14270778,          0.22222222,  0.        ,  0.        ],        [ 0.30932282,  0.30932282, -0.68291993, -0.05882276, -0.04130861,          0.89718343,  0.22222222,  0.        ],        [ 0.        ,  0.        ,  0.17366254,  0.25479166,  0.24190177,          0.30740486, -0.19998305,  0.22222222]])#
nodes = array([0.        , 0.44444444, 0.75871412, 0.11526943, 0.35675713,        0.72      , 0.955     , 1.        ])#
weights = array([[ 0.        ,  0.        ,  0.17366254,  0.25479166,  0.24190177,          0.30740486, -0.19998305,  0.22222222],        [ 0.        ,  0.        ,  0.06272422,  0.25523316,  0.23902755,          0.39907952, -0.14315725,  0.18709281]])#
class BackwardEuler(params, level)[source]#

Bases: RungeKutta

Backward Euler. A favorite among true connoisseurs of the heat equation.

A-stable first order method.

generator = <qmat.qcoeff.butcher.BE object>#
matrix = array([[1.]])#
nodes = array([1.])#
weights = array([1.])#
class ButcherTableau(weights, nodes, matrix)[source]#

Bases: object

check_method(weights, nodes, matrix)[source]#

Check that the method is entered in the correct format

check_weights(weights, nodes, matrix)[source]#

Check that the weights of the method are entered in the correct format

property globally_stiffly_accurate[source]#

Whether the last row of the Butcher matrix equals the weights, such that the last stage is the solution of the step.

Returns:

bool – True if the method is stiffly accurate

class ButcherTableauEmbedded(weights, nodes, matrix)[source]#

Bases: ButcherTableau

check_weights(weights, nodes, matrix)[source]#

Check that the weights of the method are entered in the correct format

property globally_stiffly_accurate[source]#

Whether the last row of the Butcher matrix equals the weights of the primary (higher order) method, such that the last stage is the solution of the step.

Returns:

bool – True if the method is stiffly accurate

class Cash_Karp(params, level)[source]#

Bases: RungeKutta

Fifth order explicit embedded Runge-Kutta. See [here](https://doi.org/10.1145/79505.79507).

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.CashKarp object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the fourth order secondary method.

Returns:

int – 5

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ],        [ 0.2       ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ],        [ 0.075     ,  0.225     ,  0.        ,  0.        ,  0.        ,          0.        ],        [ 0.3       , -0.9       ,  1.2       ,  0.        ,  0.        ,          0.        ],        [-0.2037037 ,  2.5       , -2.59259259,  1.2962963 ,  0.        ,          0.        ],        [ 0.0294958 ,  0.34179688,  0.04159433,  0.40034541,  0.06176758,          0.        ]])#
nodes = array([0.   , 0.2  , 0.3  , 0.6  , 1.   , 0.875])#
weights = array([[0.0978836 , 0.        , 0.40257649, 0.21043771, 0.        ,         0.2891022 ],        [0.10217737, 0.        , 0.3839079 , 0.24459274, 0.01932199,         0.25      ]])#
class CrankNicolson(params, level)[source]#

Bases: RungeKutta

Implicit Runge-Kutta method of second order, A-stable.

generator = <qmat.qcoeff.butcher.TRAP object>#
matrix = array([[0. , 0. ],        [0.5, 0.5]])#
nodes = array([0., 1.])#
weights = array([0.5, 0.5])#
class DIRK43(params, level)[source]#

Bases: RungeKutta

Embedded A-stable diagonally implicit RK pair of order 3 and 4.

Taken from [here](https://doi.org/10.1007/BF01934920).

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.EDIRK43 object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the third order secondary method.

Returns:

int – 4

matrix = array([[ 0.83333333,  0.        ,  0.        ,  0.        ],        [-0.57692308,  0.83333333,  0.        ,  0.        ],        [ 3.98148148, -4.81481481,  0.83333333,  0.        ],        [ 0.65958848, -1.27699588, -0.04925926,  0.83333333]])#
nodes = array([0.83333333, 0.25641026, 0.        , 0.16666667])#
weights = array([[ 0.40666667,  1.04619048,  0.19      , -0.64285714],        [ 0.42666667,  0.56333333,  0.01      ,  0.        ]])#
class DIRK43_2(params, level)[source]#

Bases: RungeKutta

L-stable Diagonally Implicit RK method with four stages of order 3. Taken from [here](https://en.wikipedia.org/wiki/List_of_Runge%E2%80%93Kutta_methods).

generator = <qmat.qcoeff.butcher.DIRK43 object>#
matrix = array([[ 0.5       ,  0.        ,  0.        ,  0.        ],        [ 0.16666667,  0.5       ,  0.        ,  0.        ],        [-0.5       ,  0.5       ,  0.5       ,  0.        ],        [ 1.5       , -1.5       ,  0.5       ,  0.5       ]])#
nodes = array([0.5       , 0.66666667, 0.5       , 1.        ])#
weights = array([ 1.5, -1.5,  0.5,  0.5])#
class EDIRK4(params, level)[source]#

Bases: RungeKutta

Stiffly accurate, fourth-order EDIRK with four stages. Taken from [here](https://ntrs.nasa.gov/citations/20160005923), second one in eq. (216).

generator = <qmat.qcoeff.butcher.EDIRK4 object>#
matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ],        [ 0.75      ,  0.75      ,  0.        ,  0.        ],        [ 0.66222222, -0.52888889,  1.26666667,  0.        ],        [ 0.30952381,  2.        , -2.97619048,  1.66666667]])#
nodes = array([0. , 1.5, 1.4, 1. ])#
weights = array([ 0.30952381,  2.        , -2.97619048,  1.66666667])#
class ESDIRK43(params, level)[source]#

Bases: RungeKutta

A-stable embedded RK pair of orders 4 and 3, ESDIRK4(3)6L[2]SA. Taken from [here](https://ntrs.nasa.gov/citations/20160005923)

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.ESDIRK43 object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the third order secondary method.

Returns:

int – 4

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ],        [ 0.25      ,  0.25      ,  0.        ,  0.        ,  0.        ,          0.        ],        [-0.0517767 , -0.0517767 ,  0.25      ,  0.        ,  0.        ,          0.        ],        [-0.07655461, -0.07655461,  0.52810922,  0.25      ,  0.        ,          0.        ],        [-0.72740635, -0.72740635,  1.58499506,  0.65981763,  0.25      ,          0.        ],        [-0.01558764, -0.01558764,  0.38765767,  0.50177262, -0.10825502,          0.25      ]])#
nodes = array([0.        , 0.5       , 0.14644661, 0.625     , 1.04      ,        1.        ])#
weights = array([[-0.01558764, -0.01558764,  0.38765767,  0.50177262, -0.10825502,          0.25      ],        [-0.09651334, -0.09651334,  0.52281995,  0.52056786, -0.08255805,          0.23219692]])#
class ESDIRK53(params, level)[source]#

Bases: RungeKutta

A-stable embedded RK pair of orders 5 and 3, ESDIRK5(3)6L[2]SA. Taken from [here](https://ntrs.nasa.gov/citations/20160005923)

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.ESDIRK53 object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of the third order secondary method.

Returns:

int – 4

matrix = array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,          0.        ],        [ 0.27805384,  0.27805384,  0.        ,  0.        ,  0.        ,          0.        ],        [ 0.31357496,  0.43697244,  0.27805384,  0.        ,  0.        ,          0.        ],        [-0.09456105, -0.13349473,  0.05000194,  0.27805384,  0.        ,          0.        ],        [-0.22208425, -0.09710432,  0.03123381,  0.06990092,  0.27805384,          0.        ],        [-0.89887281,  0.61640883, -0.12228335, -1.5666084 ,  2.69330188,          0.27805384]])#
nodes = array([0.        , 0.55610768, 1.02860124, 0.1       , 0.06      ,        1.        ])#
weights = array([[-0.89887281,  0.61640883, -0.12228335, -1.5666084 ,  2.69330188,          0.27805384],        [-0.44739556,  0.70955276, -0.11977427, -1.38199341,  1.99233927,          0.24727121]])#
class ExplicitMidpointMethod(params, level)[source]#

Bases: RungeKutta

Explicit Runge-Kutta method of second order.

generator = <qmat.qcoeff.butcher.RK2 object>#
matrix = array([[0. , 0. ],        [0.5, 0. ]])#
nodes = array([0. , 0.5])#
weights = array([0., 1.])#
class ForwardEuler(params, level)[source]#

Bases: RungeKutta

Forward Euler. Still a classic.

Not very stable first order method.

generator = <qmat.qcoeff.butcher.FE object>#
matrix = array([[0.]])#
nodes = array([0.])#
weights = array([1.])#
class Heun_Euler(params, level)[source]#

Bases: RungeKutta

Second order explicit embedded Runge-Kutta method.

ButcherTableauClass#

alias of ButcherTableauEmbedded

generator = <qmat.qcoeff.butcher.HEUN2 object>#
classmethod get_update_order()[source]#

Order in dt of the embedded error estimate, i.e. of the local error of forward Euler.

Returns:

int – 2

matrix = array([[0., 0.],        [1., 0.]])#
nodes = array([0., 1.])#
weights = array([[0.5, 0.5],        [1. , 0. ]])#
class IMEXEuler(params, level)[source]#

Bases: RungeKuttaIMEX

First-order IMEX Euler with one backward Euler stage, at which both parts of the right hand side are evaluated.

This is a Lie splitting of a backward Euler step for fI and a forward Euler step for fE from its result: u1 = u0 + dt fI(u1), u = u1 + dt fE(u1, t + dt). The explicit tableau has node 1 and matrix entry 0, so fE is evaluated at the new time and the implicit stage, not at the start of the step. For the variant with fE at the start of the step, see IMEXEulerStifflyAccurate.

matrix = array([[1.]])#
matrix_explicit = array([[0.]])#
nodes = array([1.])#
weights = array([1.])#
class IMEXEulerStifflyAccurate(params, level)[source]#

Bases: RungeKuttaIMEX

IMEX Euler with the explicit part evaluated at the start of the step, as a stiffly accurate two-stage method. This implements u = fI^-1(u0 + fE(u0)) rather than IMEXEuler’s u = fI^-1(u0) + fE(fI^-1(u0)). This implementation is slightly inefficient with two stages, but the last stage is the solution, making it stiffly accurate and suitable for some DAEs.

matrix = array([[0, 0],        [0, 1]])#
matrix_explicit = array([[0, 0],        [1, 0]])#
nodes = array([0, 1])#
weights = array([0, 1])#
weights_explicit = array([1, 0])#
class ImplicitMidpointMethod(params, level)[source]#

Bases: RungeKutta

Implicit Runge-Kutta method of second order.

generator = <qmat.qcoeff.butcher.MidPoint object>#
matrix = array([[0.5]])#
nodes = array([0.5])#
weights = array([1.])#
class RK4(params, level)[source]#

Bases: RungeKutta

Explicit Runge-Kutta of fourth order: Everybody’s darling.

generator = <qmat.qcoeff.butcher.RK4 object>#
matrix = array([[0. , 0. , 0. , 0. ],        [0.5, 0. , 0. , 0. ],        [0. , 0.5, 0. , 0. ],        [0. , 0. , 1. , 0. ]])#
nodes = array([0. , 0.5, 0.5, 1. ])#
weights = array([0.16666667, 0.33333333, 0.33333333, 0.16666667])#
class RungeKutta(params, level)[source]#

Bases: Sweeper

Base class for Runge-Kutta methods with lower triangular Butcher tableaux, wrapped in the sweeper interface. Actually, the sweeper idea fits the Runge-Kutta idea when using only lower triangular rules, where solutions at the nodes are successively computed from earlier nodes. However, we only perform a single iteration of this.

We have two choices to realise a Runge-Kutta sweeper: We can choose Q = Q_Delta = <Butcher tableau>, but in this implementation, that would lead to a lot of wasted FLOPS from integrating with Q and then with Q_Delta and subtracting the two. For that reason, we built this new sweeper, which does not have a preconditioner.

This class only supports lower triangular Butcher tableaux such that the system can be solved with forward substitution. In this way, we don’t get the maximum order that we could for the number of stages, but computing the stages is much cheaper. In particular, if the Butcher tableaux is strictly lower triangular, we get an explicit method, which does not require us to solve a system of equations to compute the stages.

Please be aware that all fundamental parameters of the Sweeper are ignored. These include

  • num_nodes

  • collocation_class

  • initial_guess

  • QI

All of these variables are either determined by the RK rule, or are not part of an RK scheme.

The entries of the Butcher tableau are stored as class attributes.

ButcherTableauClass#

alias of ButcherTableau

compute_end_point()[source]#

In this Runge-Kutta implementation, the solution to the step is always stored in the last node

classmethod get_Butcher_tableau()[source]#

Build the Butcher tableau from the class attributes weights, nodes and matrix.

Returns:

ButcherTableau – an instance of ButcherTableauClass

classmethod get_Q_matrix()[source]#

Get the quadrature matrix of the scheme, i.e. the Butcher matrix padded with a leading row and column of zeros for the initial conditions.

Returns:

numpy.ndarray – the quadrature matrix

get_full_f(f)[source]#

Get the full right hand side as a mesh from the right hand side

Parameters:

f (dtype_f) – Right hand side at a single node

Returns:

mesh – Full right hand side as a mesh

classmethod get_update_order()[source]#

Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.

integrate()[source]#

Integrates the right-hand side

Returns:

list of dtype_u – containing the integral as values

classmethod is_embedded()[source]#

Whether the scheme is an embedded pair, i.e. uses ButcherTableauEmbedded and has a secondary solution for error estimation.

Returns:

bool – True if the scheme is embedded

property level[source]#

Returns the current level

Returns:

pySDC.Level.level – Current level

matrix = None#
nodes = None#
predict()[source]#

Predictor to fill values at nodes before first sweep

update_nodes()[source]#

Update the u- and f-values at the collocation nodes

Returns:

None

weights = None#
class RungeKuttaIMEX(params, level)[source]#

Bases: RungeKutta

Implicit-explicit split Runge Kutta base class. Only supports methods that share the nodes and weights.

ButcherTableauClass_explicit#

alias of ButcherTableau

compute_end_point()[source]#

In this Runge-Kutta implementation, the solution to the step is always stored in the last node

classmethod get_Butcher_tableau_explicit()[source]#

Build the Butcher tableau of the explicit part from weights_explicit, nodes and matrix_explicit. Without weights_explicit, the explicit part uses the implicit weights.

Returns:

ButcherTableau – an instance of ButcherTableauClass_explicit

integrate()[source]#

Integrates the right-hand side

Returns:

list of dtype_u – containing the integral as values

matrix_explicit = None#
predict()[source]#

Predictor to fill values at nodes before first sweep

update_nodes()[source]#

Update the u- and f-values at the collocation nodes

Returns:

None

weights_explicit = None#