-
Notifications
You must be signed in to change notification settings - Fork 355
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
Fix periodic boundary bug in #3199 #3243
Conversation
I had setup |
Maybe |
In that case, it seems that we need to change the code in EDIT - crossed in the air with Weiqun. |
if (p.pos(idim) > rhi[idim]) { | ||
p.pos(idim) = rhi[idim]; | ||
if (p.pos(idim) >= rhi[idim]) { | ||
p.pos(idim) = std::nextafter(p.pos(idim), rlo[idim]); |
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.
Yes, this looks like the right thing to do.
Hi, I think we have a similar test in pyAMReX that breaks with GNU 10.1 now. |
There seem to be also a series of regressions in WarpX: |
There was a flaw in amrex::Geometry::computeRoundoffDomain. If probhi is close to zero, std::nextafter towards negative infinity will be a very small number (e.g., 1.e-300). So the function will be able to find the lowest value of roundoff_hi that's outside the domain within a reasonable number of iterations. In the new implementation, we use bisection to find the lowest value of roundoff_lo that's inside the domain and the highest value fo roundoff_hi that's inside the domain, up to a tolerance. X-ref: - #3243 - #3199
PR AMReX-Codes#3199 broke the Nyx regression tests. The issue is we require the particle positions to be in [plo, phi). This won't happen if rhi is exactly equal to phi. The fix is to make sure rhi is always slightly inside the domain. EDIT - fixed this in a different way. Now, when applying periodic boundaries, the particle positions will be set to be strictly less than rhi.
There was a flaw in amrex::Geometry::computeRoundoffDomain. If probhi is close to zero, std::nextafter towards negative infinity will be a very small number (e.g., 1.e-300). So the function will be able to find the lowest value of roundoff_hi that's outside the domain within a reasonable number of iterations. In the new implementation, we use bisection to find the lowest value of roundoff_lo that's inside the domain and the highest value fo roundoff_hi that's inside the domain, up to a tolerance. X-ref: - AMReX-Codes#3243 - AMReX-Codes#3199
* Rework handling of roundoff domain extent (AMReX-Codes#3199) * Fix periodic boundary bug in AMReX-Codes#3199 (AMReX-Codes#3243) * Fix Roundoff Domain (AMReX-Codes#3247) * Add Tests/RoundoffDomain (AMReX-Codes#3248) * Roundoff errors in computeRoundoffDomain (AMReX-Codes#3255)
PR #3199 broke the Nyx regression tests. The issue is we require the particle positions to be in [plo, phi). This won't happen if rhi is exactly equal to phi. The fix is to make sure rhi is always slightly inside the domain.
EDIT - fixed this in a different way. Now, when applying periodic boundaries, the particle positions will be set to be strictly less than rhi.
The proposed changes: