Skip to content

Conversation

@jtramm
Copy link
Contributor

@jtramm jtramm commented Oct 24, 2025

Description

When run in geometry debug mode (openmc -g), the Monte Carlo solver will check for any overlapping cells whenever performing a cross section lookup. As the random ray solver doesn't call this function, no overlap checks are ever performed.

This PR simply adds the same overlapping check logic after each ray tracing step is performed in the random ray solver.

I have tested this fix on a random ray input deck featuring a cell overlap (thanks @shimwell!) and it works as expected.

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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the random ray solver's geometry debug mode to properly detect overlapping cells. When running OpenMC with the -g flag, the Monte Carlo solver performs overlap checks during cross section lookups, but the random ray solver was not performing these checks since it doesn't call that function.

Key Changes:

  • Added overlap checking logic in the random ray solver's event_advance_ray() function
  • The check is conditional on the settings::check_overlaps flag, matching the Monte Carlo solver's behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@shimwell
Copy link
Member

Thanks John, this looks ideal

@shimwell
Copy link
Member

As this is a tiny change I think we can go ahead and merge. Will merge on Monday if there are no objections.

@shimwell shimwell self-assigned this Oct 27, 2025
@shimwell
Copy link
Member

Many thanks for this improvement

@shimwell shimwell merged commit 70b5254 into openmc-dev:develop Oct 27, 2025
15 checks passed
Grego01-biot pushed a commit to Grego01-biot/openmc that referenced this pull request Oct 27, 2025
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