Skip to content

Prevent Adjoint Sources from Trending towards Infinity - #3449

Merged
paulromano merged 2 commits into
openmc-dev:developfrom
jtramm:ww_gen_improve
Jun 18, 2025
Merged

paulromano merged 2 commits into
openmc-dev:developfrom
jtramm:ww_gen_improve

Conversation

@jtramm

@jtramm jtramm commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

Description

This PR adds two minor enhancements to support FW-CADIS on large fusion models like JET.

Specifically, it makes the following changes:

  1. Addition of ZERO_FLUX_CUTOFF macro (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.

  2. When pulling data from the MGXS interface, check Chi for values of NaN. For some reason, when I generate MGXS data with the model.convert_to_multigroup() function on JET, some materials will end up having extremely low sigma_f values but will return NaN for Chi. 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 set Chi to zero.

  3. Fixed a variable capitalization to be more consistent.

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)

@jtramm
jtramm requested a review from paulromano June 16, 2025 19:49

@paulromano paulromano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks for the improvements @jtramm!

Regarding the chi issue, pinging @nelsonag to see if he has any ideas.

@paulromano
paulromano merged commit f31130d into openmc-dev:develop 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants