Allow source particles with energy below cutoff #2319
Merged
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.
This PR allows a source energy distribution to include particles below the user-defined cutoff (default 1 keV for photons). Right now, if you have a discrete distribution and some of the points are below the cutoff, you will get an error about the source energies. However, a more desirable behavior would be to allow source particles of these energies and just have them immediately deposit their energy. We already have an early check to kill off photons below the cutoff before any collision processing:
openmc/src/physics.cpp
Lines 269 to 277 in d7fc8e5
So with that, the fix is as simple as allowing the source particles to be born in the first place.
This has come up in the context of fusion dose rate calculations where a decay photon source is generated from an activated material. The new
decay_photon_energy
function/method often results in a distribution that includes low-energy photons that will trigger the aforementioned error.