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 for erroneously non-zero tally results of photon threshold reactions #3242

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

nelsonag
Copy link
Contributor

@nelsonag nelsonag commented Jan 5, 2025

Description

When pushing photons through a model I noticed that threshold reaction tallies (e.g., pair-production) had small, but non-zero, values for energy bins below the threshold.

This can be observed in the attached orig_tallies.out which was produced by running the attached model.xml file.

The cause of the issue is the line where the log of the xs arrays are taken since they are all log-log interpolated. Here, an xt::where call is used to set all zero-values to -500 instead of taking the logarithm. However, when interpolation is applied e is raised to the power of -500, which results in ~7E-218.

If this -500 is replaced with -900, then a correct value of 0 results. This fix is applied here. The result can be
seen in new_tallies.out within the zip.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

…uly 0 on 64-bit computers instead of ~1e-219. This is needed as photon scores (e.g., photoelectric) below thresholds had non-zero values.
Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix @nelsonag! I made one modification to handle the possibility that the cross section library stores zero photon cross sections as a small positive value (exp(-500)), which can happen for photon libraries derived from ACE files due to #2433. If you concur with the change I made, I'll go ahead and merge.

@nelsonag
Copy link
Contributor Author

nelsonag commented Jan 8, 2025

Thanks for this fix @nelsonag! I made one modification to handle the possibility that the cross section library stores zero photon cross sections as a small positive value (exp(-500)), which can happen for photon libraries derived from ACE files due to #2433. If you concur with the change I made, I'll go ahead and merge.

Love it and I concur with the change. Thanks!

@paulromano paulromano merged commit 8ba66f9 into openmc-dev:develop Jan 8, 2025
16 checks passed
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