-
Notifications
You must be signed in to change notification settings - Fork 126
Add positivity-limiter to the AMRCallback
#2396
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
base: main
Are you sure you want to change the base?
Conversation
Review checklistThis checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging. Purpose and scope
Code quality
Documentation
Testing
Performance
Verification
Created with ❤️ by the Trixi.jl community. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2396 +/- ##
==========================================
- Coverage 96.68% 96.68% -0.01%
==========================================
Files 511 511
Lines 42278 42298 +20
==========================================
+ Hits 40875 40892 +17
- Misses 1403 1406 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 for add this generic capability! It is much better than my hotfix from TrixiSW. My main question regards T8codeMesh
@@ -174,16 +174,21 @@ function refine!(u_ode::AbstractVector, adaptor, mesh::Union{TreeMesh{2}, P4estM | |||
@assert ninterfaces(cache.interfaces)==ndims(mesh) * nelements(dg, cache) ("For $(ndims(mesh))D and periodic domains and conforming elements, the number of interfaces must be $(ndims(mesh)) times the number of elements") | |||
end | |||
|
|||
# Apply the positivity limiter to the solution |
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.
Should the coarsen / refine for T8codeMesh
be given the same functionality to apply the limiter @jmark ?
Co-authored-by: Andrew Winters <andrew.ross.winters@liu.se>
Does it makes sense to call the limiter after refinement as well and not only after coarsening? Maybe make this also optional with a boolean variable? Normally, coarsening should be the troublemaker |
There is no guarantee on that the sign of values after the refinement (interpolation) or coarsening (L2 projection in this case) when the solution is near vacuum. |
For the |
Right now this only ensures positivity after the coarsening / refine step. I think in order to fix #2064 we would also need to add positivity-limiting after the mortar projection in For the specialized SWE implementation in trixi-framework/TrixiShallowWater.jl#97 this additional limiting should not be necessary as we obtain positive values from the reconstruction strategy. |
True - but this PR itself is already an improvement compared to the existing code. One option would be that we add the I add this to the agenda of Tuesday's Trixi meeting. |
Passing the limiter to the mortar would also be my favored option. If we do this, the limiter would be available to both the Passing it only once reduces the risk that someone forgets to set the limiter at both places. On the other hand passing it explicitly to the |
An option could be to store the limiter inside the mortar similar to how it was drafted for the EC mortars. struct LobattoLegendrePositivityPreservingMortarL2{RealT <: Real, NNODES,
ForwardMatrix <: AbstractMatrix{RealT},
ReverseMatrix <: AbstractMatrix{RealT}, Limiter} <:
AbstractMortarL2{RealT}
forward_upper::ForwardMatrix
forward_lower::ForwardMatrix
reverse_upper::ReverseMatrix
reverse_lower::ReverseMatrix
limiter::Limiter
end |
@patrickersing so what I would suggest is to add a limiter to a mortar first and then see if we can extract the limter from the mortar (via |
That sounds like a good plan! If we manage to set the mortar limiter by default, but keep the flexibility to pass different limiters to the AMR callback that would be great. Going forward I would then keep this PR dedicated to the AMR callback, and create a separate PR to implement the new mortar type. |
I'm currently working on IDP limiting at mortars, and I'm interested in using the Shu limiter to ensure positivity when transferring the solution while refinement and coarsening. So, I only need this positivity limiter for AMR.
|
Interesting, this sounds like AMR is happening " too late" in some sense.
What do you mean by "simultaneous shifting"? |
With "initialization of the amr callback" I really mean the refinement at the very start of the simulation to get to
I added a remark above to clarify this. Simultaneous shifting is when I use the same (minimum) theta for all just refined child elements:
|
Ah I somehow missed that you were really talking about the init, my bad. Thanks for the explanations, though 👍 |
Thanks a lot for taking the initiative on this @bennibolm!
Does this appear with or without the simultaneous shifting technique? I also think without any fixes this is to be expected due to the reinterpolation.
So both approaches lose conservation? Do you already have an idea in which step we lose the conservation? How big are the conservation errors that you observe? |
This PR introduces the possibility to pass a positivity-preserving limiter to the
AMRCallback
. The limiter is applied at the end of thecoarsen!
,refine!
oradapt!
step to ensure positivity after adaptation in the AMR callback. This generalizes the strategy from trixi-framework/TrixiShallowWater.jl#97 for arbitrary equations.This should fix #2064