mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Handle reflex angles in CylinderSector (#3303)
This commit is contained in:
parent
6ae2001400
commit
fefe825e65
2 changed files with 23 additions and 8 deletions
|
|
@ -135,6 +135,11 @@ class CylinderSector(CompositeSurface):
|
|||
if theta2 <= theta1:
|
||||
raise ValueError('theta2 must be greater than theta1.')
|
||||
|
||||
# Determine whether the angle between theta1 and theta2 is a reflex
|
||||
# angle, in which case we need to use a union between the planar
|
||||
# half-spaces
|
||||
self._reflex = (theta2 - theta1 > 180.0)
|
||||
|
||||
phi1 = pi / 180 * theta1
|
||||
phi2 = pi / 180 * theta2
|
||||
|
||||
|
|
@ -169,6 +174,9 @@ class CylinderSector(CompositeSurface):
|
|||
**kwargs)
|
||||
self.plane2 = openmc.Plane.from_points(p1, p2_plane2, p3_plane2,
|
||||
**kwargs)
|
||||
if axis == 'y':
|
||||
self.plane1.flip_normal()
|
||||
self.plane2.flip_normal()
|
||||
|
||||
@classmethod
|
||||
def from_theta_alpha(cls,
|
||||
|
|
@ -223,17 +231,11 @@ class CylinderSector(CompositeSurface):
|
|||
return cls(r1, r2, theta1, theta2, center=center, axis=axis, **kwargs)
|
||||
|
||||
def __neg__(self):
|
||||
if isinstance(self.inner_cyl, openmc.YCylinder):
|
||||
return -self.outer_cyl & +self.inner_cyl & +self.plane1 & -self.plane2
|
||||
if self._reflex:
|
||||
return -self.outer_cyl & +self.inner_cyl & (-self.plane1 | +self.plane2)
|
||||
else:
|
||||
return -self.outer_cyl & +self.inner_cyl & -self.plane1 & +self.plane2
|
||||
|
||||
def __pos__(self):
|
||||
if isinstance(self.inner_cyl, openmc.YCylinder):
|
||||
return +self.outer_cyl | -self.inner_cyl | -self.plane1 | +self.plane2
|
||||
else:
|
||||
return +self.outer_cyl | -self.inner_cyl | +self.plane1 | -self.plane2
|
||||
|
||||
|
||||
class IsogonalOctagon(CompositeSurface):
|
||||
r"""Infinite isogonal octagon composite surface
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue