Added DIRK methods and testsets from Hairer/Wanner book#146
Conversation
Added DIRK methods from E. Hairer, G. Wanner. Solving ordinary differential equations II: Stiff and Differential-Algebraic Problems
Added tests for the methods from Solving Ordinary Differential Equations II: Stiff and Differential Algebraic Problems, Springer 1996. Pages 100f
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
Attempt to implement the requested changes
Attempt to fix the indentation
MarcoArtiano
left a comment
There was a problem hiding this comment.
Thanks! I left a few suggestions after a first quick review.
Changed Numbers in comments to words (e.g. "5th-order, 5-stage" to "fifth-order, five-stage"); Changed cospi(1/18) to π_val = convert(RealT, π) cos(π_val/18) in CrouzeixRaviart34
ranocha
left a comment
There was a problem hiding this comment.
Thanks! I just have a few minor additional suggestions.
|
@MagalieHeinrich I left some additional comments. Please incorporate them and ping me afterward. |
|
|
||
| c = zeros(RealT, nstage) | ||
| c[1] = γ | ||
| c[2] = (6 + 9 * sqrt6) / 35 # Corrected from the row 2 c-column |
There was a problem hiding this comment.
I don't understand the comment here. There was a typo in the Hairer-Wanner book?
There was a problem hiding this comment.
I removed the comment.
I made a typo while typing from the book. When checking, I put the comment. I then forgot to remove the comment. That's why it was there.
Removed helper comment that I had forgotten
Added suggested changes. I'm very unsure about the citation "M. Crouzeix. Sur l’approximation des équations différentielles opérationnelles linéaires par des méthodes de Runge-Kutta. Thèse d'état, Univ. Paris 6 192pp, 1975." because I can't check wether the tableau is in it or not. But its the only literature by M. Crouzeix before 1980 that Hairer and Wanner cite in their book, They specifically assign this method to the year 1980. Thats why I chose the 1975 citation even though I can't check for the method in it.
|
@ranocha I added your and @MarcoArtiano 's suggested changes. "M. Crouzeix. Sur l’approximation des équations différentielles opérationnelles linéaires par des méthodes de Runge-Kutta. failed the spell check saying "sur" should be "sure". I suppose thats because the spell check checks for english. Any suggestions? |
|
You can add a line |
Les mots francais dans la citation relative a la methode CrouzeixRaviart34 ont ete ajoutes au spellchecker
Removed the unnecessary words
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/libs/Theseus/src/dirk/tableau.jl b/libs/Theseus/src/dirk/tableau.jl
index 90b11f4..652029e 100644
--- a/libs/Theseus/src/dirk/tableau.jl
+++ b/libs/Theseus/src/dirk/tableau.jl
@@ -117,16 +117,16 @@ struct CooperSayfy5 <: DIRK{5} end
function RKTableau(alg::CooperSayfy5, RealT)
nstage = 5
sqrt6 = sqrt(convert(RealT, 6))
-
+
γ = (6 - sqrt6) / 10
-
+
a = zeros(RealT, nstage, nstage)
-
+
a[1, 1] = γ
a[2, 1] = (6 + 5 * sqrt6) / 14
a[2, 2] = γ
-
+
a[3, 1] = (888 + 607 * sqrt6) / 2850
a[3, 2] = (126 - 161 * sqrt6) / 1425
a[3, 3] = γ
@@ -141,21 +141,21 @@ function RKTableau(alg::CooperSayfy5, RealT)
a[5, 3] = (1329 - 544 * sqrt6) / 2500
a[5, 4] = (-96 + 131 * sqrt6) / 625
a[5, 5] = γ
-
+
b = zeros(RealT, nstage)
b[1] = 0
b[2] = 0
b[3] = 1 // 9
b[4] = (16 - sqrt6) / 36
b[5] = (16 + sqrt6) / 36
-
+
c = zeros(RealT, nstage)
c[1] = γ
c[2] = (6 + 9 * sqrt6) / 35
- c[3] = 1
+ c[3] = 1
c[4] = (4 - sqrt6) / 10
c[5] = (4 + sqrt6) / 10
-
+
return DIRKButcher(a, b, c)
end
@@ -173,23 +173,23 @@ struct HairerWannerSDIRK4 <: DIRK{5} end
function RKTableau(alg::HairerWannerSDIRK4, RealT)
nstage = 5
a = zeros(RealT, nstage, nstage)
-
+
γ = 1 // 4
-
+
a[1, 1] = γ
-
+
a[2, 1] = 1 // 2
a[2, 2] = γ
-
+
a[3, 1] = 17 // 50
a[3, 2] = -1 // 25
a[3, 3] = γ
-
+
a[4, 1] = 371 // 1360
a[4, 2] = -137 // 2720
a[4, 3] = 15 // 544
a[4, 4] = γ
-
+
a[5, 1] = 25 // 24
a[5, 2] = -49 // 48
a[5, 3] = 125 // 16
@@ -202,14 +202,14 @@ function RKTableau(alg::HairerWannerSDIRK4, RealT)
b[3] = 125 // 16
b[4] = -85 // 12
b[5] = 1 // 4
-
+
c = zeros(RealT, nstage)
c[1] = 1 // 4
c[2] = 3 // 4
c[3] = 11 // 20
c[4] = 1 // 2
c[5] = 1
-
+
return DIRKButcher(a, b, c)
end
@@ -228,11 +228,11 @@ A fourth-order, three-stage, L-stable SDIRK method.
struct CrouzeixRaviart34 <: DIRK{3} end
function RKTableau(alg::CrouzeixRaviart34, RealT)
nstage = 3
-
+
sqrt3 = sqrt(convert(RealT, 3))
γ = (1 / sqrt3) * cospi(one(RealT) / 18) + 1 // 2
δ = 1 / (6 * (2 * γ - 1)^2)
-
+
a = zeros(RealT, nstage, nstage)
a[1, 1] = γ
@@ -243,18 +243,18 @@ function RKTableau(alg::CrouzeixRaviart34, RealT)
a[3, 1] = 2 * γ
a[3, 2] = 1 - 4 * γ
a[3, 3] = γ
-
+
b = zeros(RealT, nstage)
b[1] = δ
b[2] = 1 - 2 * δ
b[3] = δ
-
+
c = zeros(RealT, nstage)
c[1] = γ
c[2] = 1 // 2
c[3] = 1 - γ
-
+
return DIRKButcher(a, b, c)
end
-
+
diff --git a/libs/Theseus/test/convergence.jl b/libs/Theseus/test/convergence.jl
index 4e2f9d1..e32333f 100644
--- a/libs/Theseus/test/convergence.jl
+++ b/libs/Theseus/test/convergence.jl
@@ -84,7 +84,7 @@ end
eoc = compute_eoc(dts, errors)
@test isapprox(eoc, order; atol = 0.1)
end
-
+
@testset "CooperSayfy5" begin
alg = Theseus.CooperSayfy5()
order = 5 |
Added DIRK methods and testsets from E. Hairer, G. Wanner. Solving ordinary differential equations II: Stiff and Differential-Algebraic Problems.