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

Prevent divide-by-zero in bins_crossed methods for meshes #1816

Merged
merged 3 commits into from
Apr 20, 2021

Conversation

paulromano
Copy link
Contributor

A user recently reported seeing some NaNs in photon flux mesh tallies. I traced this down to some divide-by-zeros in StructuredMesh::bins_crossed. This PR simply checks whether the total distance in a track is zero (as can happen when secondary electrons/positrons are created and immediately killed) and returns to prevent the divide-by-zero issue.

Also, I noticed that the rectangular_prism function doesn't work cleanly with periodic boundary conditions after our boundary condition refactor (#1701). Also included a fix for that.

@paulromano
Copy link
Contributor Author

FYI, there's some weird issue with GHA ubuntu VMs right now that is causing our tests to fail when MPI is enabled (tests for #1817 are failing for same reason). I've put in a workaround in this PR based on some comments from the linked issue.

@aprilnovak aprilnovak self-requested a review April 19, 2021 15:36
@aprilnovak
Copy link
Contributor

Looks good to me!

@aprilnovak aprilnovak merged commit fc0c784 into openmc-dev:develop Apr 20, 2021
@paulromano paulromano deleted the mesh-nan-fix branch April 20, 2021 19:32
pshriwise pushed a commit to pshriwise/openmc that referenced this pull request Apr 24, 2021
Prevent divide-by-zero in bins_crossed methods for meshes
pshriwise pushed a commit to pshriwise/openmc that referenced this pull request Apr 24, 2021
Prevent divide-by-zero in bins_crossed methods for meshes
pshriwise pushed a commit to pshriwise/openmc that referenced this pull request Apr 24, 2021
Prevent divide-by-zero in bins_crossed methods for meshes
pshriwise pushed a commit to pshriwise/openmc that referenced this pull request Apr 26, 2021
Prevent divide-by-zero in bins_crossed methods for meshes
paulromano pushed a commit that referenced this pull request Apr 26, 2021
Prevent divide-by-zero in bins_crossed methods for meshes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants