Skip to content

Commit

Permalink
TL: added last RK schemes from pySDC
Browse files Browse the repository at this point in the history
  • Loading branch information
tlunet committed Jun 20, 2024
1 parent c211f54 commit e174871
Showing 1 changed file with 226 additions and 0 deletions.
226 changes: 226 additions & 0 deletions qmat/qcoeff/butcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,229 @@ def orderEmbedded(self): return 3

@property
def order(self): return 5


@registerRK
class ARK548L2SAERK(RK):
"""
Explicit part of the ARK54 scheme.
"""
A = np.zeros((8, 8))
A[1, 0] = 41.0 / 100.0
A[2, :2] = [367902744464.0 / 2072280473677.0, 677623207551.0 / 8224143866563.0]
A[3, :3] = [1268023523408.0 / 10340822734521.0, 0.0, 1029933939417.0 / 13636558850479.0]
A[4, :4] = [
14463281900351.0 / 6315353703477.0,
0.0,
66114435211212.0 / 5879490589093.0,
-54053170152839.0 / 4284798021562.0,
]
A[5, :5] = [
14090043504691.0 / 34967701212078.0,
0.0,
15191511035443.0 / 11219624916014.0,
-18461159152457.0 / 12425892160975.0,
-281667163811.0 / 9011619295870.0,
]
A[6, :6] = [
19230459214898.0 / 13134317526959.0,
0.0,
21275331358303.0 / 2942455364971.0,
-38145345988419.0 / 4862620318723.0,
-1.0 / 8.0,
-1.0 / 8.0,
]
A[7, :7] = [
-19977161125411.0 / 11928030595625.0,
0.0,
-40795976796054.0 / 6384907823539.0,
177454434618887.0 / 12078138498510.0,
782672205425.0 / 8267701900261.0,
-69563011059811.0 / 9646580694205.0,
7356628210526.0 / 4942186776405.0,
]
b = [
-872700587467.0 / 9133579230613.0,
0.0,
0.0,
22348218063261.0 / 9555858737531.0,
-1143369518992.0 / 8141816002931.0,
-39379526789629.0 / 19018526304540.0,
32727382324388.0 / 42900044865799.0,
41.0 / 200.0,
]
c = [
0,
41.0 / 100.0,
2935347310677.0 / 11292855782101.0,
1426016391358.0 / 7196633302097.0,
92.0 / 100.0,
24.0 / 100.0,
3.0 / 5.0,
1.0,
]
b2 = [
-975461918565.0 / 9796059967033.0,
0.0,
0.0,
78070527104295.0 / 32432590147079.0,
-548382580838.0 / 3424219808633.0,
-33438840321285.0 / 15594753105479.0,
3629800801594.0 / 4656183773603.0,
4035322873751.0 / 18575991585200.0,
]

@property
def order(self): return 5

CONV_TEST_NSTEPS = [32, 64, 128]


@registerRK
class ARK548L2SAESDIRK(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.
"""
A = np.zeros((8, 8))
A[1, :2] = [41.0 / 200.0, 41.0 / 200.0]
A[2, :3] = [41.0 / 400.0, -567603406766.0 / 11931857230679.0, 41.0 / 200.0]
A[3, :4] = [683785636431.0 / 9252920307686.0, 0.0, -110385047103.0 / 1367015193373.0, 41.0 / 200.0]
A[4, :5] = [
3016520224154.0 / 10081342136671.0,
0.0,
30586259806659.0 / 12414158314087.0,
-22760509404356.0 / 11113319521817.0,
41.0 / 200.0,
]
A[5, :6] = [
218866479029.0 / 1489978393911.0,
0.0,
638256894668.0 / 5436446318841.0,
-1179710474555.0 / 5321154724896.0,
-60928119172.0 / 8023461067671.0,
41.0 / 200.0,
]
A[6, :7] = [
1020004230633.0 / 5715676835656.0,
0.0,
25762820946817.0 / 25263940353407.0,
-2161375909145.0 / 9755907335909.0,
-211217309593.0 / 5846859502534.0,
-4269925059573.0 / 7827059040749.0,
41.0 / 200.0,
]
A[7, :] = [
-872700587467.0 / 9133579230613.0,
0.0,
0.0,
22348218063261.0 / 9555858737531.0,
-1143369518992.0 / 8141816002931.0,
-39379526789629.0 / 19018526304540.0,
32727382324388.0 / 42900044865799.0,
41.0 / 200.0,
]

@property
def orderEmbedded(self): return 5


@registerRK
class ARK548L2SAESDIRK2(RK):
"""
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.
"""
gamma = 2.0 / 9.0
c = [
0.0,
4.0 / 9.0,
6456083330201.0 / 8509243623797.0,
1632083962415.0 / 14158861528103.0,
6365430648612.0 / 17842476412687.0,
18.0 / 25.0,
191.0 / 200.0,
1.0,
]
b = [
0.0,
0.0,
3517720773327.0 / 20256071687669.0,
4569610470461.0 / 17934693873752.0,
2819471173109.0 / 11655438449929.0,
3296210113763.0 / 10722700128969.0,
-1142099968913.0 / 5710983926999.0,
gamma,
]
A = np.zeros((8, 8))
A[2, 1] = 2366667076620.0 / 8822750406821.0
A[3, 1] = -257962897183.0 / 4451812247028.0
A[3, 2] = 128530224461.0 / 14379561246022.0
A[4, 1] = -486229321650.0 / 11227943450093.0
A[4, 2] = -225633144460.0 / 6633558740617.0
A[4, 3] = 1741320951451.0 / 6824444397158.0
A[5, 1] = 621307788657.0 / 4714163060173.0
A[5, 2] = -125196015625.0 / 3866852212004.0
A[5, 3] = 940440206406.0 / 7593089888465.0
A[5, 4] = 961109811699.0 / 6734810228204.0
A[6, 1] = 2036305566805.0 / 6583108094622.0
A[6, 2] = -3039402635899.0 / 4450598839912.0
A[6, 3] = -1829510709469.0 / 31102090912115.0
A[6, 4] = -286320471013.0 / 6931253422520.0
A[6, 5] = 8651533662697.0 / 9642993110008.0
for i in range(A.shape[0]):
A[i, i] = gamma
A[i, 0] = A[i, 1]
A[7, i] = b[i]
b2 = [
0.0,
0.0,
520639020421.0 / 8300446712847.0,
4550235134915.0 / 17827758688493.0,
1482366381361.0 / 6201654941325.0,
5551607622171.0 / 13911031047899.0,
-5266607656330.0 / 36788968843917.0,
1074053359553.0 / 5740751784926.0,
]

@property
def order(self): return 5

CONV_TEST_NSTEPS = [16, 32, 64]


@registerRK
class ARK548L2SAERK2(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.
"""
A = np.zeros((8, 8))
A[2, 0] = 1.0 / 9.0
A[2, 1] = 1183333538310.0 / 1827251437969.0
A[3, 0] = 895379019517.0 / 9750411845327.0
A[3, 1] = 477606656805.0 / 13473228687314.0
A[3, 2] = -112564739183.0 / 9373365219272.0
A[4, 0] = -4458043123994.0 / 13015289567637.0
A[4, 1] = -2500665203865.0 / 9342069639922.0
A[4, 2] = 983347055801.0 / 8893519644487.0
A[4, 3] = 2185051477207.0 / 2551468980502.0
A[5, 0] = -167316361917.0 / 17121522574472.0
A[5, 1] = 1605541814917.0 / 7619724128744.0
A[5, 2] = 991021770328.0 / 13052792161721.0
A[5, 3] = 2342280609577.0 / 11279663441611.0
A[5, 4] = 3012424348531.0 / 12792462456678.0
A[6, 0] = 6680998715867.0 / 14310383562358.0
A[6, 1] = 5029118570809.0 / 3897454228471.0
A[6, 2] = 2415062538259.0 / 6382199904604.0
A[6, 3] = -3924368632305.0 / 6964820224454.0
A[6, 4] = -4331110370267.0 / 15021686902756.0
A[6, 5] = -3944303808049.0 / 11994238218192.0
A[7, 0] = 2193717860234.0 / 3570523412979.0
A[7, 1] = 2193717860234.0 / 3570523412979.0
A[7, 2] = 5952760925747.0 / 18750164281544.0
A[7, 3] = -4412967128996.0 / 6196664114337.0
A[7, 4] = 4151782504231.0 / 36106512998704.0
A[7, 5] = 572599549169.0 / 6265429158920.0
A[7, 6] = -457874356192.0 / 11306498036315.0
A[1, 0] = ARK548L2SAESDIRK2.c[1]

0 comments on commit e174871

Please sign in to comment.