Skip to content

Added DIRK methods and testsets from Hairer/Wanner book#146

Merged
ranocha merged 13 commits into
NumericalMathematics:mainfrom
MagalieHeinrich:main
May 12, 2026
Merged

Added DIRK methods and testsets from Hairer/Wanner book#146
ranocha merged 13 commits into
NumericalMathematics:mainfrom
MagalieHeinrich:main

Conversation

@MagalieHeinrich
Copy link
Copy Markdown
Member

Added DIRK methods and testsets from E. Hairer, G. Wanner. Solving ordinary differential equations II: Stiff and Differential-Algebraic Problems.

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
@codecov-commenter
Copy link
Copy Markdown

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 ☂️

Comment thread libs/Theseus/src/dirk/tableau.jl
Comment thread libs/Theseus/test/convergence.jl
Copy link
Copy Markdown
Collaborator

@MarcoArtiano MarcoArtiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I left a few suggestions after a first quick review.

Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
@MarcoArtiano MarcoArtiano linked an issue May 2, 2026 that may be closed by this pull request
13 tasks
@ranocha ranocha removed a link to an issue May 2, 2026
13 tasks
@ranocha ranocha mentioned this pull request May 2, 2026
13 tasks
MagalieHeinrich and others added 2 commits May 5, 2026 14:00
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
Copy link
Copy Markdown
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I just have a few minor additional suggestions.

Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
Comment thread libs/Theseus/src/dirk/tableau.jl Outdated
@ranocha ranocha requested a review from MarcoArtiano May 7, 2026 10:15
@ranocha
Copy link
Copy Markdown
Member

ranocha commented May 7, 2026

@MagalieHeinrich I left some additional comments. Please incorporate them and ping me afterward.

Copy link
Copy Markdown
Collaborator

@MarcoArtiano MarcoArtiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've left some other minor comments.

Comment thread libs/Theseus/src/dirk/tableau.jl Outdated

c = zeros(RealT, nstage)
c[1] = γ
c[2] = (6 + 9 * sqrt6) / 35 # Corrected from the row 2 c-column
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the comment here. There was a typo in the Hairer-Wanner book?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread libs/Theseus/src/dirk/tableau.jl
Comment thread libs/Theseus/src/dirk/tableau.jl
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.
@MagalieHeinrich
Copy link
Copy Markdown
Member Author

@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.
Thèse d'état, Univ. Paris 6 192pp, 1975."

failed the spell check saying "sur" should be "sure". I suppose thats because the spell check checks for english. Any suggestions?

@ranocha
Copy link
Copy Markdown
Member

ranocha commented May 11, 2026

You can add a line sur = "sur" to https://github.com/NumericalMathematics/Ariadne.jl/blob/main/.typos.toml

MagalieHeinrich and others added 3 commits May 11, 2026 22:54
Les mots francais dans la citation relative a la methode CrouzeixRaviart34 ont ete ajoutes au spellchecker
Removed the unnecessary words
@MagalieHeinrich MagalieHeinrich marked this pull request as ready for review May 12, 2026 08:00
@github-actions
Copy link
Copy Markdown

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

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

Copy link
Copy Markdown
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@ranocha ranocha merged commit bff54bb into NumericalMathematics:main May 12, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants