Skip to content

Conversation

@paulromano
Copy link
Contributor

Description

This PR fixes a bug related to when a time boundary is in use that can result in secondary particles not be simulated. The sequence of events that leads to this is as follows:

  • In Particle::event_advance, a time boundary results in the particle's weight getting set to zero.
  • However, this doesn't stop the particle from undergoing a collision because there is no conditional check that the particle is still alive when Particle::event_collide is called. This can result in zero-weight secondaries getting created.
  • Immediately after that, Particle::event_revive_from_secondary sets the particle's state to one of the just-created zero-weight secondaries, which then causes the event loop to terminate because Particle::alive() is false.
  • Thus, any other secondary particles that were still present in the secondary bank don't get simulated.

The solution is to just add a check after calling event_advance() that the particle is still alive before processing a surface crossing or collision.

Fixes #3039

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)

Copy link
Contributor

@cfichtlscherer cfichtlscherer left a comment

Choose a reason for hiding this comment

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

Looks all good for me - amazing that you figured out what was going on. I've been looking at it for hours....

@paulromano paulromano added this to the v0.15.0 milestone Jun 18, 2024
@paulromano paulromano merged commit 390005e into openmc-dev:develop Jun 20, 2024
@paulromano paulromano deleted the time-boundary-bugfix branch June 20, 2024 14:27
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.

Incorrect tally behavior for fixed source, supercritical simulations in neutron-photon coupled mode

2 participants