Repository navigation
Prevent Adjoint Sources from Trending towards Infinity - #3449
Merged
Merged
Conversation
paulromano
approved these changes
Jun 18, 2025
yardasol
pushed a commit
to yardasol/openmc
that referenced
this pull request
Dec 25, 2025
apingegno
pushed a commit
to apingegno/openmc
that referenced
this pull request
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR adds two minor enhancements to support FW-CADIS on large fusion models like JET.
Specifically, it makes the following changes:
Addition of
ZERO_FLUX_CUTOFFmacro (define here as 10^-22) to ensure that global adjoint external sources (defined as 1/forward flux) do not tend towards infinity. Especially in low ray density situations, you might end up with a really small flux estimate in a small cell, and we don't want to end up having this source dominate the overall adjoint source term. We check the flux against this new macro when computing the adjoint external source terms, and just set the external source to zero. While we generally want to make weight windows that bias particles towards areas of low flux, there is a limit to what is detectable. In this case, a 22 order of magnitude flux attenuation would essentially produce particle count rates that would be well below background rates even for the strongest fission/fusion starting sources, meaning fluxes below this level become meaningless in practice.When pulling data from the MGXS interface, check
Chifor values ofNaN. For some reason, when I generate MGXS data with themodel.convert_to_multigroup()function on JET, some materials will end up having extremely lowsigma_fvalues but will returnNaNforChi. This may be caused by a bug in the MGXS interface, but for now I simply fix the random ray interface to check for this case and setChito zero.Fixed a variable capitalization to be more consistent.
Checklist