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

CylinderSector doesn't properly generate planes for off origin centers #3016

Closed
MicahGale opened this issue May 21, 2024 · 1 comment · Fixed by #3018
Closed

CylinderSector doesn't properly generate planes for off origin centers #3016

MicahGale opened this issue May 21, 2024 · 1 comment · Fixed by #3018
Labels

Comments

@MicahGale
Copy link
Contributor

MicahGale commented May 21, 2024

Bug Description

If you create an openmc.model.CylinderSector that is not located at the origin, the planes that define the sector do not appear to intersect the center.

Reading the code it seems like this issue is this line and the next few. It seems to me that the assumption with these planes is that they are going through the origin and they are parallel to the Z-axis. I tried to read through #2027 to better understand the logic, and there doesn't seem to be any discussion of this. @yardasol, am I missing something?

Steps to Reproduce

  1. Create an off-origin cylinder sector
import openmc
center = (10, 0, 0)
sector = openmc.model.CylinderSector(1.0, 1.1, 90, 95, center[0:2])
  1. If we try to plot this we get errors, likely due to the null set region (related to Cell.plot does not have any math sanity checks #3015):
cell = openmc.Cell(region=-sector)
cell.plot()

This leads to errors shown in #3015.

  1. What is going on with these surfaces?
>  print(sector.inner_cyl, sector.outer_cyl, sector.plane1, sector.plane2)
Surface
        ID                 =    16
        Name               =
        Type               =    z-cylinder
        Boundary           =    transmission
        Coefficients
x0                  =   10
y0                  =   0
r                   =   1.0
 Surface
        ID                 =    17
        Name               =
        Type               =    z-cylinder
        Boundary           =    transmission
        Coefficients
x0                  =   10
y0                  =   0
r                   =   1.1
 Surface
        ID                 =    18
        Name               =
        Type               =    plane
        Boundary           =    transmission
        Coefficients
a                   =   0.10000000000000009
b                   =   -6.123233995736777e-18
c                   =   0.0
d                   =   0.0
 Surface
        ID                 =    19
        Name               =
        Type               =    plane
        Boundary           =    transmission
        Coefficients
a                   =   0.09961946980917458
b                   =   0.008715574274765825
c                   =   0.0
d                   =   0.0

The cylinders are properly located. However it looks like the planes go through the origin. This can be easily confirmed:

In [22]: half = -sector.plane1

In [23]: epsilon = 1e-6

In [24]: (epsilon, 0, 0) in half
Out[24]: False

In [25]: (-epsilon, 0, 0) in half
Out[25]: True

Therefore, the plane does go through the origin.

Environment

  • openmc: 0.14.0
@yardasol
Copy link
Contributor

Good catch @MicahGale! I just opened PR #3018 to fix this!

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 a pull request may close this issue.

2 participants