Skip to content

Simplify rectangular lattice crossing and correctly handle corner checks - #3703

Merged
GuySten merged 4 commits into
openmc-dev:developfrom
GuySten:simplify-lattice-crossing
Jan 6, 2026
Merged

GuySten merged 4 commits into
openmc-dev:developfrom
GuySten:simplify-lattice-crossing

Conversation

@GuySten

@GuySten GuySten commented Jan 1, 2026 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

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

GuySten commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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.

Comment thread src/lattice.cpp Outdated

@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.

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
Copy Markdown
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

gridley commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

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

@GuySten
GuySten deleted the simplify-lattice-crossing branch January 7, 2026 14:24
jon-proximafusion pushed a commit to shimwell/openmc that referenced this pull request Apr 13, 2026
…cks (openmc-dev#3703)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
apingegno pushed a commit to apingegno/openmc that referenced this pull request May 7, 2026
…cks (openmc-dev#3703)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
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