Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DIRK-IMEX schemes #106
Add DIRK-IMEX schemes #106
Changes from 16 commits
08d85c8
198cc8e
0a8146d
2f60244
b9e0a31
e48cf44
016d16a
e026c9d
fc10fbf
27d5923
2e66c63
90b6f60
4fa3d56
e922460
ec7cc4d
e58c477
8524b4e
5addfb7
6a9a568
acebd07
05272b1
f671062
02a8441
a2d1dd8
0cbb1a7
dccce50
36504a9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Euler
instead of1
, while other methods have numbers? Maybe we want these in a kind of factory (like PEPRK and WSODIRK) with a more descriptive name likeAscherRuuthSpiteriDIRKIMEX(order)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ascher-Ruuth-Spiteri have a numbering system that obfuscates the schemes to me, writing
(s, sigma, p)
, wheres
is the number of stages,sigma
is the number of explicit stages needed to be calculated (sometimess
, sometimess+1
-- we currently assume it is alwayss+1
, which means we sometimes do an unnecessary mass solve), andp
is order of the scheme. I'd still prefer to avoid that, so perhaps just the factory you describe is sufficient naming?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the right thing to do is write out the loop "both ways" (the general case and optimized to avoid the extra mass solve). Maybe there is a clever way to fuse the loops, or maybe we just want an "if/else" branching on whether that optimization is possible. We could create
advance_normal
andadvance_optimized
methods and setself.advance
to be one of these in the constructor. It would look like code duplication, but avoiding the extra mass solve is worthwhile if you're trying to use IMEX as a performance win.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a small refactor to loop over the solves as each stages' mass solve then implicit solve for the first
ns
stages, then havingfinalize_normal
(compute last explicit stage and general-case update),finalize_no_last_explicit
(general-case update where last explicit stage is not used), andfinalize_stiffly_accurate
(update where last explicit stage is not used, and last implicit stage is newu0
)? That would get us out of code duplication altogether, and we could sniff which case in__init__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a great plan. Does it get the optimal pattern for each case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay - 6a9a568 passes tests locally with the last mass solve and the final update separated into
_final_general
. Now to implement the special casesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And 02a8441 implements the special cases. So, seems like this is good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which brings us back to naming... Shall I just implement a factory that uses the Ascher-Ruuth-Spiteri indexing convention? Seems the easiest for users, even if it is a bit opaque
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the factory approach is probably cleaner for the user interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Factory is now implemented, in a2d1dd8