implementations.sweeper_classes.Runge_Kutta module¶
- class ARK54(params)[source]¶
Bases:
RungeKuttaIMEX
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]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- 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)[source]¶
Bases:
RungeKuttaIMEX
IMEX Runge-Kutta method of order 5 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]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- 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)[source]¶
Bases:
RungeKutta
Explicit part of the ARK54 scheme.
- ButcherTableauClass¶
alias of
ButcherTableauEmbedded
- classmethod get_update_order()[source]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- 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)[source]¶
Bases:
ARK548L2SAESDIRK2
Explicit embedded pair of Runge-Kutta methods of orders 5 and 4 from [here](https://doi.org/10.1016/j.apnum.2018.10.007). This method is part of the IMEX method ARK548L2SA.
- 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)[source]¶
Bases:
ARK548L2SAERK
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.
- 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)[source]¶
Bases:
RungeKutta
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
- gamma = 0.2222222222222222¶
- classmethod get_update_order()[source]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- i = 7¶
- 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)[source]¶
Bases:
RungeKutta
Backward Euler. A favorite among true connoisseurs of the heat equation.
A-stable first order method.
- matrix = array([[1.]])¶
- nodes = array([1.])¶
- weights = array([1.])¶
- class Cash_Karp(params)[source]¶
Bases:
RungeKutta
Fifth order explicit embedded Runge-Kutta. See [here](https://doi.org/10.1145/79505.79507).
- ButcherTableauClass¶
alias of
ButcherTableauEmbedded
- classmethod get_update_order()[source]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- 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 CrankNicholson(params)[source]¶
Bases:
RungeKutta
Implicit Runge-Kutta method of second order, A-stable.
- matrix = array([[0. , 0. ], [0.5, 0.5]])¶
- nodes = array([0, 1])¶
- weights = array([0.5, 0.5])¶
- class DIRK43(params)[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
- classmethod get_update_order()[source]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- 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 ESDIRK43(params)[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
- classmethod get_update_order()[source]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- 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. ])¶
- s2 = 1.4142135623730951¶
- 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)[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
- classmethod get_update_order()[source]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- 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)[source]¶
Bases:
RungeKutta
Explicit Runge-Kutta method of second order.
- matrix = array([[0. , 0. ], [0.5, 0. ]])¶
- nodes = array([0. , 0.5])¶
- weights = array([0, 1])¶
- class ForwardEuler(params)[source]¶
Bases:
RungeKutta
Forward Euler. Still a classic.
Not very stable first order method.
- matrix = array([[0.]])¶
- nodes = array([0.])¶
- weights = array([1.])¶
- class Heun_Euler(params)[source]¶
Bases:
RungeKutta
Second order explicit embedded Runge-Kutta method.
- ButcherTableauClass¶
alias of
ButcherTableauEmbedded
- classmethod get_update_order()[source]¶
Get the order of the lower order method for doing adaptivity. Only applies to embedded methods.
- matrix = array([[0., 0.], [1., 0.]])¶
- nodes = array([0, 1])¶
- weights = array([[0.5, 0.5], [1. , 0. ]])¶
- class ImplicitMidpointMethod(params)[source]¶
Bases:
RungeKutta
Implicit Runge-Kutta method of second order.
- matrix = array([[0.5]])¶
- nodes = array([0.5])¶
- weights = array([1])¶
- class RK4(params)[source]¶
Bases:
RungeKutta
Explicit Runge-Kutta of fourth order: Everybody’s darling.
- 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)[source]¶
Bases:
sweeper
- ButcherTableauClass¶
Runge-Kutta scheme that fits the interface of a sweeper. 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.
alias of
ButcherTableau
- compute_end_point()[source]¶
In this Runge-Kutta implementation, the solution to the step is always stored in the last node
- 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:
Full right hand side as a mesh
- Return type:
- 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:
containing the integral as values
- Return type:
list of dtype_u
- property level¶
Returns the current level
- Returns:
Current level
- Return type:
pySDC.Level.level
- matrix = None¶
- nodes = None¶
- weights = None¶
- class RungeKuttaIMEX(params)[source]¶
Bases:
RungeKutta
Implicit-explicit split Runge Kutta base class. Only supports methods that share the nodes and weights.
- ButcherTableauClass_explicit¶
alias of
ButcherTableau
- integrate()[source]¶
Integrates the right-hand side
- Returns:
containing the integral as values
- Return type:
list of dtype_u
- matrix_explicit = None¶