-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor create_cache
#106
Conversation
pass and dispatch on boundary condition put tmp1 to initial cache (always needed for the RelaxationCallback to work) fix upwind discretization for BBMBBMEquations1D for reflecting boundary conditions and add test
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #106 +/- ##
==========================================
+ Coverage 96.44% 96.71% +0.26%
==========================================
Files 17 17
Lines 1125 1126 +1
==========================================
+ Hits 1085 1089 +4
+ Misses 40 37 -3 ☔ View full report in Codecov by Sentry. |
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.
Thanks! I just have some minor comments that can either be resolved quickly or maybe postponed to later development (issues). Feel free to merge 👍
elseif solver.D1 isa DerivativeOperator || | ||
solver.D1 isa UniformCoupledOperator || | ||
solver.D1 isa UpwindOperators | ||
invImD2 = inv(I - 1 / 6 * D^2 * Matrix(solver.D2)) |
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.
In the long run, one should consider allowing more flexibility here. For example, FD methods should use sparse matrices and just a factorization instead of the inverse of a dense matrix. But that's not critical right now.
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.
Yeah, you are definitely right. IIRC, when I tried that some time ago, I had some problems making that properly work, but I don't remember the exact issue. Back then I focused on something that just works and is easy to implement and understand. But of course this is not the most performant way. I created #107 for that.
Co-authored-by: Hendrik Ranocha <[email protected]>
This passes the
boundary_conditions
tocreate_cache
and dispatches on them instead of looking at the type of the SBP operators to infer whether the problem has periodic or reflecting boundary conditions, e.g. previously it was possible to useboundary_conditions_reflecting
and pass periodic operators to theSolver
, which meant that thecreate_cache
function also created the cache for the periodic problem instead of for reflecting. This was a bit messy. This way it should work more as expected and is also easier to extend.On the fly, I put
tmp1
(needed by theRelaxationCallback
) into theintitial_cache
instead of always creating it increate_cache
, which is weird becausetmp1
is sometimes not needed for the discretization itself.Finally, I fixed the upwind discretization for the reflecting boundary conditions for the
BBMBBMEquations1D
, which was broken before. I also added a test in a similar manner as in #105.