Skip to content

Comments

Implicit solvers#265

Merged
rtqichen merged 2 commits intortqichen:masterfrom
psv4:implicit-solvers
Apr 4, 2025
Merged

Implicit solvers#265
rtqichen merged 2 commits intortqichen:masterfrom
psv4:implicit-solvers

Conversation

@psv4
Copy link
Contributor

@psv4 psv4 commented Mar 25, 2025

Closes #254 and is related to #263.

This adds abstract Fully Implicit Runge Kutta (FIRK) and Diagonally Implicit Runge Kutta (DIRK) solver classes and defines many different implicit solvers based on their tableaus. The nonlinear system of equations is solved using Broyden's method. The solvers were added to the tests and are passing.

Solvers

  • Implicit Euler
  • Implicit Midpoint
  • Implicit Trapezoid
  • Gauss Legendre 4th and 6th order
  • Radau IIA 3rd and 5th order
  • SDIRK2
  • TRBDF2

More can be added following the Butcher Tableau structure.

psv4 added 2 commits March 25, 2025 16:00
commit 3322092
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Fri Mar 21 12:47:43 2025 -0400

    DIRK solver

    All tests passing

commit a487023
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Thu Mar 20 17:58:46 2025 -0400

    Simplification

commit 445c630
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Thu Mar 20 13:59:40 2025 -0400

    Trapezoid method working

    All tests pass.

    To Do: Add a Diagonally Implicit Runge Kutta (DIRK) solver

commit 62fb87c
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Wed Mar 19 14:14:50 2025 -0400

    Simplify

commit 2f8ee35
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Wed Mar 19 13:18:07 2025 -0400

    Getting tests to work

commit 9d2bd87
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Mar 18 15:15:16 2025 -0400

    Add warning

commit 380ef76
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Mar 18 14:36:31 2025 -0400

    Residual should converge to 0

commit 53fa05b
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Mar 18 11:44:27 2025 -0400

    Broyden's method in Torch to solve system

commit e2e4ef6
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Mon Mar 17 17:27:07 2025 -0400

    Update rk_common.py

commit f9ee7cc
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Mon Mar 17 16:37:17 2025 -0400

    Working for arrays

commit 9e99dec
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Mon Mar 17 16:10:01 2025 -0400

    Using scipy root

commit d6c8ef5
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Mar 11 11:42:47 2025 -0400

    Don't zip beta

    Only needed for a special case

commit df96be0
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Mar 11 11:04:15 2025 -0400

    Update fixed_grid_implicit.py

commit 1318fa5
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Mar 11 10:58:50 2025 -0400

    Make this work for vectors

commit b5b8c34
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Mon Mar 10 20:41:55 2025 -0400

    Using matmul

commit a509be9
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Mon Mar 10 19:01:44 2025 -0400

    Much Faster

commit 0a91246
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Thu Mar 6 16:41:46 2025 -0500

    All zeros case

commit 9fab648
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Thu Mar 6 16:18:04 2025 -0500

    Many solvers included

commit 6ebe639
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Feb 25 17:11:28 2025 -0500

    Update rk_common.py

commit 7a5d83a
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Feb 25 17:10:48 2025 -0500

    Methods with zero alpha and nonzero beta

commit 91cce15
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Tue Feb 25 16:27:29 2025 -0500

    Abstract classes working

commit 7b6704d
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Mon Feb 24 19:57:56 2025 -0500

    Abstract

commit 3cf9065
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Thu Feb 20 14:10:56 2025 -0500

    Abstract Implicit Class

commit b210355
Merge: 6758985 f3135f3
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Thu Feb 13 15:38:45 2025 -0500

    Merge branch 'master' into add-implicit-solvers

commit 6758985
Author: psv4 <44118604+psv4@users.noreply.github.com>
Date:   Thu Feb 6 11:11:50 2025 -0500

    Implicit Solvers
@rtqichen
Copy link
Owner

rtqichen commented Apr 4, 2025

This looks great! Thanks for updating the tests as well.

Main thing I can think of to make this better is to implement the version of Broyden's method with the Sherman-Morrison formula to directly update the Jacobian inverse and avoid the expensive linalg.solve. But this can be addressed in a separate PR should anyone want to make the change.

@rtqichen rtqichen merged commit 657943a into rtqichen:master Apr 4, 2025
@psv4
Copy link
Contributor Author

psv4 commented Apr 4, 2025

Thanks @rtqichen ! I'll add that as an issue for the Sherman-Morrison formula. The textbook I was using did not mention that. Other future work for this could be adding adaptive implicit solvers and auto-switching algorithms between explicit and implicit.

@psv4 psv4 deleted the implicit-solvers branch May 29, 2025 18:07
@hchau630 hchau630 mentioned this pull request Jun 30, 2025
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.

Solvers for stiff problem

2 participants