Skip to content

Conversation

@GuySten
Copy link
Contributor

@GuySten GuySten commented Jan 1, 2026

Description

This PR simplify rectangular lattice crossing algorithm and add support for corner crossing.
The test case was taken from #2445 with lower resolution like #3355.

Fixes #3355 and fixes #2445.

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 added the Bugs label Jan 1, 2026
@GuySten GuySten changed the title Simplify lattice crossing and correctly handle corner checks Simplify rectangular lattice crossing and correctly handle corner checks Jan 1, 2026
@nuclearkevin
Copy link
Contributor

Thanks for resurrecting this @GuySten! I'll close #3355 once this is merged.

@GuySten GuySten requested a review from gridley January 4, 2026 18:01
@GuySten
Copy link
Contributor Author

GuySten commented Jan 5, 2026

@pshriwise, could you take some time to review this PR?
Without the added test it is a very small change (+12 -35 in lattice.cpp).

@pshriwise
Copy link
Contributor

@pshriwise, could you take some time to review this PR?
Without the added test it is a very small change (+12 -35 in lattice.cpp).

Happy to. I was staring at it a bit this morning already in fact.

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

Just made two updates here:

  1. Added another guard against direction components being zero when setting lattice_trans
  2. Cleaned up the model in the test

Good to go as far as I'm concerned! @pshriwise do you want to review before we merge?

@pshriwise
Copy link
Contributor

Good to go as far as I'm concerned! @pshriwise do you want to review before we merge?

Nope! The two changes you noted to account for direction components that are zero are in and it seems the tests pass with the lost particle setting removed in the model -- the only other change I was going to suggest.

@GuySten GuySten enabled auto-merge (squash) January 6, 2026 05:14
@GuySten GuySten merged commit 818fd11 into openmc-dev:develop Jan 6, 2026
14 checks passed
@gridley
Copy link
Contributor

gridley commented Jan 7, 2026

This is awesome; I'm delighted to see this resolved!

@GuySten GuySten deleted the simplify-lattice-crossing branch January 7, 2026 14:24
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.

Lattice corner crossings leak particles

5 participants