Skip to content

Conversation

@GuySten
Copy link
Contributor

@GuySten GuySten commented Jan 26, 2026

Description

Currently the global neutron russian roulette (which is used when survival biasing is turned on) conflicts with the application of weight windows.
As suggested in #2773 (comment), this PR makes global neutron russian roulette apply only when neutrons are outside of the weight windows mesh boundaries.

Fixes #2773

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)

@GuySten GuySten requested a review from nelsonag as a code owner January 26, 2026 22:04
@GuySten GuySten added the Bugs label Jan 26, 2026
@GuySten GuySten changed the title Resolve conflicts with weight windows and global russian roulette Resolve conflict with weight windows and global russian roulette Jan 26, 2026
@GuySten GuySten marked this pull request as draft January 27, 2026 07:45
@GuySten GuySten marked this pull request as ready for review January 27, 2026 08:30
Copy link
Contributor

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

Thanks @GuySten! You are a machine. Some thoughts to consider here in the comments.

}
}
// Play russian roulette if there are no weight windows
if (!settings::weight_windows_on ||
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we may want to limit this to only the first condition. In the case that the weight window check points at collisions are disabled, I expect we'd see the same aggressive rouletting cited in #2773.

Copy link
Contributor Author

@GuySten GuySten Jan 27, 2026

Choose a reason for hiding this comment

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

The problem is that without that check we will not have global rouletting when we are outside the mesh boundary when collision checkpoints are disabled and surface checkpoints are enabled.

EDIT:
Maybe further restructure is needed.
I will think about that.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm understanding right, with weight windows on we'll still check for a valid weight window bin in apply_weight_windows and in the absence of a valid bin (i.e. if the particle is outside the mesh).

It could be that particles exceed the lower or upper energy bounds of the weight windows rather than, but in essence I'd say this is equivalent to the argument about particles leaving the mesh -- if the user is interested in this energy space then it should be part of the weight windows definition.

Now, hypothetically, we could run into a problem where weight windows are enabled in the settings but all checkpoints are turned off, then no rouletting would apply. Maybe an extra initialization check/warning to address this would be a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand correctly, If weight windows are on and collision checkpoints are off we will have global rouletting when outside of mesh only in surface checkpoints which is weird behavior.
Usually we use global rouletting only in collisions.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's different, true. Though the purpose of rouletting is that we address low-weight particles at some point in the simulation so they don't run for an exceedingly long amount of time, but I don't see a reason that this must occur during a collision event.

For infinite media problems we may never hit a surface to roulette these particles, but I also don't think we'd see application of weight windows in those cases.

That said, if you have a way of restructuring things so it aligns better with the current rouletting check points, I'm game! Main thing I'm watching out for is that we avoid an additional weight window look-up or additional particle state if possible, which your PR does well now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weight windows while using survival biasing

2 participants