Clamp particles shifted from plo boundary against rhi, rather than back to plo#2814
Merged
atmyers merged 1 commit intoAMReX-Codes:developmentfrom Jun 14, 2022
Merged
Conversation
Contributor
Author
WeiqunZhang
reviewed
Jun 9, 2022
| } | ||
| // clamp to avoid precision issues; | ||
| if (p.pos(idim) >= rhi[idim]) { | ||
| p.pos(idim) = static_cast<ParticleReal>(plo[idim]); |
Member
There was a problem hiding this comment.
@atmyers I am guessing the reason for the old approach is rhi might be >= phi, which would fail the assertion later in this function. Maybe we should change function computeRoundoffDomain to make sure rhi < phi. We could test if phi - tolerance passes the test. If so, we don't need to the bisect. If not, we use that as the upper bound for bisect.
Member
There was a problem hiding this comment.
I will address this in a follow-on PR, where I'll also handle having both a roundoff_hi_d and roundoff_hi_f
atmyers
approved these changes
Jun 14, 2022
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
BLAST-WarpX/warpx#3155
Particles found outside the low end of the periodic boundary were shifted up by the domain size to be close to the high end boundary. If they were outside the rounding domain, and would thus trip up integer index calculations, they were being clamped back to the low end of the domain, rather than the high end. Looking again, I think this was actually just erroneous.
Additional background
See #2679 (comment)
Checklist
The proposed changes: