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

Allow source particles with energy below cutoff #2319

Merged

Conversation

paulromano
Copy link
Contributor

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

// Kill photon if below energy cutoff -- an extra check is made here because
// photons with energy below the cutoff may have been produced by neutrons
// reactions or atomic relaxation
int photon = static_cast<int>(ParticleType::photon);
if (p.E() < settings::energy_cutoff[photon]) {
p.E() = 0.0;
p.wgt() = 0.0;
return;
}

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.

@shimwell
Copy link
Member

shimwell commented Dec 5, 2022

This looks great, certainly a nicer way to deal with the low energy photons from these decays sources. I'm looking forward to giving this a go tomorrow.

Copy link
Member

@shimwell shimwell left a comment

Choose a reason for hiding this comment

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

Super stuff just what we needed for the R2S work Ethan and Patrick are working on. Many thanks

@paulromano paulromano merged commit 3addc25 into openmc-dev:develop Dec 8, 2022
@paulromano paulromano deleted the allow-low-source-energies branch December 8, 2022 04:35
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