Skip to content
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 ORANGE bounding box bumping to be consistent with tracking tolerances #940

Merged
merged 3 commits into from
Sep 16, 2023

Conversation

sethrj
Copy link
Member

@sethrj sethrj commented Sep 15, 2023

Particles in EMPIRE were getting lost while crossing the $z=0$ plane because they didn't register as being in the bounding box on the other side. This is because nextafter(0f, -inff) gives a value of -1e-45f whereas it's reasonable and expected for the particles themselves to be bumped on $O(10^{-12})$. We should be using the same bump behavior as in the BumpCalculator: each box coordinate is pushed outward by max(abs_tol, rel_tol * fabs(value)).

Instead of bumping outward by the width, we bump outward by the local value, since semi-infinite bounding boxes are not uncommon.

@sethrj sethrj added bug Something isn't working orange Work on ORANGE geometry engine labels Sep 15, 2023
1e-8 is too small to change the single-precision representation. The
new implementation combines the relative + absolute bump to the
full-precision point, then uses `std::nextafter` to ensure that the
truncated point is outside that value.
@sethrj
Copy link
Member Author

sethrj commented Sep 15, 2023

@tmdelellis @elliottbiondo Looks like you really have to use std::nextafter after all: the universe unit test was failing because the default ORANGE tolerance (1e-8) was bumping O(1) values and then being rounded back to zero during truncation.

With the last implementation we are doing the following:

  1. We expand the bounding box to past the point that any particle can be bumped (or end up logically crossing when machine precision gets thrown in the mix).
  2. We truncate that double-precision box to single-precision.
  3. We expand the single-precision box by one ULP, ensuring it fully encloses the bumped double-precision bounding box.

This gives correct absolute rounds near the small values, and correct values for relative erros.

@sethrj sethrj merged commit 92caa1a into celeritas-project:develop Sep 16, 2023
@sethrj sethrj deleted the bbox-bump branch September 16, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working orange Work on ORANGE geometry engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants