Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle reflex angles in CylinderSector #3303

Merged

Conversation

paulromano
Copy link
Contributor

Description

This PR fixes #3293 and is an alternative solution to that proposed in #3296. First, thanks @nplinden for identifying the issue and proposing a solution. As I was looking over your PR, I realized there was a simpler solution, which is to simply use a | operator instead of & between the planar halfspaces if the angle is greater than 180°. I made a few other improvements in the implementation while I was at it:

  • Removed __pos__, which is no longer needed for composite surfaces (the default inherited from CompositeSurface works fine)
  • Flipped the normal on the planes when axis='y', which avoids the need for a check on the type in __neg__

@nplinden Please give this a try and let me know if it works for you.

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)

@nplinden
Copy link
Contributor

Seems a lot better indeed, it works great. Thanks for taking a look!

@JoffreyDorville JoffreyDorville self-assigned this Feb 20, 2025
@paulromano paulromano added this to the v0.15.1 milestone Feb 21, 2025
Copy link
Contributor

@JoffreyDorville JoffreyDorville left a comment

Choose a reason for hiding this comment

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

Thanks @paulromano for this PR and thanks @nplinden for pointing out this issue and helping in finding a solution!

I also encountered this limitation some time ago while developing a generic control drum builder for a model. I am glad that I will be able to use the corrected CylinderSector to simplify my own code!

Also, the inversion of the planes normal is definitely an elegant solution to the x-axis inversion occurring during the change of frames. I really like this one!

@JoffreyDorville JoffreyDorville merged commit fefe825 into openmc-dev:develop Feb 21, 2025
16 checks passed
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.

CylinderSector can't have an aperture angle greater than 180°
3 participants