From 9350e99061bf8bd08935fef5c88d44272e3e997f Mon Sep 17 00:00:00 2001 From: yardasol Date: Fri, 1 Apr 2022 15:54:29 -0500 Subject: [PATCH 01/24] added CylinderSector composite surface --- openmc/model/surface_composite.py | 89 +++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 09a3c0170..0151d19e8 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -165,6 +165,95 @@ class RectangularParallelepiped(CompositeSurface): def __pos__(self): return -self.xmin | +self.xmax | -self.ymin | +self.ymax | -self.zmin | +self.zmax +class CylinderSector(CompositeSurface): + """Infinite cylindrical sector composite surface + + This class + acts as a proper surface, meaning that unary `+` and `-` operators applied + to it will produce a half-space. The negative side is defined to be the + region inside of the octogonal prism. + + Parameters + ---------- + center_axis : 2-tuple + (x,y), (x,z), or (y,z) coordiante of cylinders' central axes. + Defaults to (0,0) + r1, r2 : float + Inner and outer cylinder radii + alpha1, alpha2 : float + Angular segmentation in degrees relative to the x-, x-, or y-axis. + axis : {'z', 'y', 'x'} + Axes of the cylinders + **kwargs + Keyword arguments passed to underlying plane classes + + Attributes + ---------- + outer : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder + Outer cylinder surface + inner : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder + Inner cylinder surface + plane_1 : openmc.Plane + Segment plane corresponding to :attr:`alpha1` + plane_2 : openmc.Plane + Segmenting plane correspodning to :attr:`alpha2` + + """ + + _surface_names = ('outer','inner', + 'plane_a', 'plane_b') + + def __init__(self, center, r1, r2, alpha1, alpha2, **kwargs): + + alpha1 = np.pi / 180 * alpha1 + alpha2 = np.pi / 180 * alpha2 + # Coords for axis-perpendicular planes + p1 = np.array([0,0,1]) + + p2_plane1 = np.array([r1 * np.cos(alpha1), -r1 * np.sin(alpha1), 0]) + p3_plane1 = np.array([r2 * np.cos(alpha1), -r2 * np.sin(alpha1), 0]) + + p2_plane2 = np.array([r1 * np.cos(alpha2), r1 * np.sin(alpha2), 0]) + p3_plane2 = np.array([r2 * np.cos(alpha2), r2 * np.sin(alpha2), 0]) + + points = [p1, p2_plane1, p3_plane1, p2_plane2, p3_plane2] + if axis == 'x': + self.inner = openmc.XCylinder(*center_axis, r=r1, **kwargs) + self.outer = openmc.XCylinder(*center_axis, r=r2, **kwargs) + coord_map = [2,0,1] + elif axis == 'y': + self.inner = openmc.YCylinder(*center_axis, r=r1, **kwargs) + self.outer = openmc.YCylinder(*center_axis, r=r2, **kwargs) + coord_map = [0,2,1] + elif axis == 'z': + self.inner = openmc.ZCylinder(*center_axis, r=r1, **kwargs) + self.outer = openmc.ZCylinder(*center_axis, r=r2, **kwargs) + coord_map = [0,1,2] + + calibrated_points = [] + for p in points: + p_temp = [] + for i in coord_map: + p_temp += [p[i]] + calibrated_points += [np.array(p_temp)] + + p1, p2_plane1, p3_plane1, p2_plane2, p3_plane2 = calibrated_points + + plane1_params = _plane_from_points(p1, p2_plane1, p3_plane1) + plane2_params = _plane_from_points(p1, p2_plane2, p3_plane2) + + self.inner = openmc.ZCylinder(x0=x0, y0=y0, r=r1, **kwargs) + self.outer = openmc.ZCylinder(x0=x0, y0=y0, r=r2, **kwargs) + self.plane1 = openmc.Plane(*plane1_params, **kwargs) + self.plane2 = openmc.Plane(*plane2_params, **kwargs) + + + def __neg__(self): + return -self.outer & +self.inner & -self.plane1 & +self.plane2 + + + def __pos__(self): + return +self.outer | -self.inner | +self.plane1 | -self.plane2 class XConeOneSided(CompositeSurface): """One-sided cone parallel the x-axis From 1cc80135f3158a8c9c51199ab282a546c554bc20 Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 4 Apr 2022 16:21:42 -0500 Subject: [PATCH 02/24] consitency changes to CylinderSector --- openmc/model/surface_composite.py | 89 ++++++++++++++++--------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 0151d19e8..9b674b494 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -2,6 +2,7 @@ from abc import ABC, abstractmethod from copy import copy import openmc +from math import sin, cos, sqrt from openmc.checkvalue import check_greater_than, check_value @@ -168,22 +169,24 @@ class RectangularParallelepiped(CompositeSurface): class CylinderSector(CompositeSurface): """Infinite cylindrical sector composite surface - This class - acts as a proper surface, meaning that unary `+` and `-` operators applied - to it will produce a half-space. The negative side is defined to be the - region inside of the octogonal prism. + This class acts as a proper surface, meaning that unary `+` and `-` + operators applied to it will produce a half-space. The negative + side is defined to be the region inside of the cylinder sector. Parameters ---------- - center_axis : 2-tuple - (x,y), (x,z), or (y,z) coordiante of cylinders' central axes. - Defaults to (0,0) + center : iterable of float + Coordinate for central axes of cylinders in the (y, z), (x,z), or + (x, y) basis. Defaults to (0,0) r1, r2 : float Inner and outer cylinder radii - alpha1, alpha2 : float - Angular segmentation in degrees relative to the x-, x-, or y-axis. + theta0 : float + Angular offset of the sector in degrees relative to the primary basis + axis (+y or +x). + theta : float + Angular width of the sector in degrees. axis : {'z', 'y', 'x'} - Axes of the cylinders + Central axis of the cylinders. Defaults to z **kwargs Keyword arguments passed to underlying plane classes @@ -193,67 +196,67 @@ class CylinderSector(CompositeSurface): Outer cylinder surface inner : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder Inner cylinder surface - plane_1 : openmc.Plane - Segment plane corresponding to :attr:`alpha1` - plane_2 : openmc.Plane - Segmenting plane correspodning to :attr:`alpha2` + plane0 : openmc.Plane + Plane at angle :math:`\theta_0` relative to the first basis axis + plane1 : openmc.Plane + Plane at angle :math:`\theta_0 + \theta` relative to the first + basis axis. """ _surface_names = ('outer','inner', - 'plane_a', 'plane_b') + 'plane0', 'plane1') - def __init__(self, center, r1, r2, alpha1, alpha2, **kwargs): + def __init__(self, center, r1, r2, theta0, theta, axis='z', **kwargs): + + theta0 = np.pi / 180 * theta0 + theta = np.pi / 180 * theta + theta1 = theta0 + theta - alpha1 = np.pi / 180 * alpha1 - alpha2 = np.pi / 180 * alpha2 # Coords for axis-perpendicular planes - p1 = np.array([0,0,1]) + p1 = np.array([0,0]) - p2_plane1 = np.array([r1 * np.cos(alpha1), -r1 * np.sin(alpha1), 0]) - p3_plane1 = np.array([r2 * np.cos(alpha1), -r2 * np.sin(alpha1), 0]) + p2_plane0 = np.array([r1 * cos(theta0), r1 * sin(theta0)]) + p3_plane0 = np.array([r2 * cos(theta0), r2 * sin(theta0)]) - p2_plane2 = np.array([r1 * np.cos(alpha2), r1 * np.sin(alpha2), 0]) - p3_plane2 = np.array([r2 * np.cos(alpha2), r2 * np.sin(alpha2), 0]) + p2_plane1 = np.array([r1 * cos(theta1), r1 * sin(theta1)]) + p3_plane1 = np.array([r2 * cos(theta1), r2 * sin(theta1)]) - points = [p1, p2_plane1, p3_plane1, p2_plane2, p3_plane2] + points = [p2_plane0, p3_plane0, p2_plane1, p3_plane1] if axis == 'x': - self.inner = openmc.XCylinder(*center_axis, r=r1, **kwargs) - self.outer = openmc.XCylinder(*center_axis, r=r2, **kwargs) - coord_map = [2,0,1] + self.inner = openmc.XCylinder(*center, r=r1, **kwargs) + self.outer = openmc.XCylinder(*center, r=r2, **kwargs) + axis_idx = 0 elif axis == 'y': - self.inner = openmc.YCylinder(*center_axis, r=r1, **kwargs) - self.outer = openmc.YCylinder(*center_axis, r=r2, **kwargs) - coord_map = [0,2,1] + self.inner = openmc.YCylinder(*center, r=r1, **kwargs) + self.outer = openmc.YCylinder(*center, r=r2, **kwargs) + axis_idx = 1 elif axis == 'z': - self.inner = openmc.ZCylinder(*center_axis, r=r1, **kwargs) - self.outer = openmc.ZCylinder(*center_axis, r=r2, **kwargs) - coord_map = [0,1,2] + self.inner = openmc.ZCylinder(*center, r=r1, **kwargs) + self.outer = openmc.ZCylinder(*center, r=r2, **kwargs) + axis_idx = 3 calibrated_points = [] for p in points: p_temp = [] for i in coord_map: - p_temp += [p[i]] - calibrated_points += [np.array(p_temp)] + calibrated_points += [np.insert(p, axis_idx, 0)] - p1, p2_plane1, p3_plane1, p2_plane2, p3_plane2 = calibrated_points - - plane1_params = _plane_from_points(p1, p2_plane1, p3_plane1) - plane2_params = _plane_from_points(p1, p2_plane2, p3_plane2) + p2_plane0, p3_plane0, p2_plane1, p3_plane1 = calibrated_points + p1 = np.insert(p1, axis_idx, 1) + self.plane0 = openmc.Plane.from_points(p1, p2_plane0, p3_plane0, **kwargs) + self.plane1 = openmc.Plane.from_points(p1, p2_plane1, p3_plane1, **kwargs) self.inner = openmc.ZCylinder(x0=x0, y0=y0, r=r1, **kwargs) self.outer = openmc.ZCylinder(x0=x0, y0=y0, r=r2, **kwargs) - self.plane1 = openmc.Plane(*plane1_params, **kwargs) - self.plane2 = openmc.Plane(*plane2_params, **kwargs) def __neg__(self): - return -self.outer & +self.inner & -self.plane1 & +self.plane2 + return -self.outer & +self.inner & -self.plane0 & +self.plane1 def __pos__(self): - return +self.outer | -self.inner | +self.plane1 | -self.plane2 + return +self.outer | -self.inner | +self.plane0 | -self.plane1 class XConeOneSided(CompositeSurface): """One-sided cone parallel the x-axis From e10e2bbcf02165db2a5f324f6a41761f56633724 Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 4 Apr 2022 16:47:06 -0500 Subject: [PATCH 03/24] streamline the remapping of coordinates --- openmc/model/surface_composite.py | 47 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 9b674b494..2b55615a1 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -1,8 +1,9 @@ from abc import ABC, abstractmethod from copy import copy +from math import sqrt, pi, sin, cos +from numpy import array import openmc -from math import sin, cos, sqrt from openmc.checkvalue import check_greater_than, check_value @@ -209,41 +210,39 @@ class CylinderSector(CompositeSurface): def __init__(self, center, r1, r2, theta0, theta, axis='z', **kwargs): - theta0 = np.pi / 180 * theta0 - theta = np.pi / 180 * theta + theta0 = pi / 180 * theta0 + theta = pi / 180 * theta theta1 = theta0 + theta # Coords for axis-perpendicular planes - p1 = np.array([0,0]) + p1 = array([0.,0.,1.]) - p2_plane0 = np.array([r1 * cos(theta0), r1 * sin(theta0)]) - p3_plane0 = np.array([r2 * cos(theta0), r2 * sin(theta0)]) + p2_plane0 = array([r1 * cos(theta0), r1 * sin(theta0), 0.]) + p3_plane0 = array([r2 * cos(theta0), r2 * sin(theta0), 0.]) - p2_plane1 = np.array([r1 * cos(theta1), r1 * sin(theta1)]) - p3_plane1 = np.array([r2 * cos(theta1), r2 * sin(theta1)]) + p2_plane1 = array([r1 * cos(theta1), r1 * sin(theta1), 0.]) + p3_plane1 = array([r2 * cos(theta1), r2 * sin(theta1), 0.]) - points = [p2_plane0, p3_plane0, p2_plane1, p3_plane1] - if axis == 'x': - self.inner = openmc.XCylinder(*center, r=r1, **kwargs) - self.outer = openmc.XCylinder(*center, r=r2, **kwargs) - axis_idx = 0 - elif axis == 'y': - self.inner = openmc.YCylinder(*center, r=r1, **kwargs) - self.outer = openmc.YCylinder(*center, r=r2, **kwargs) - axis_idx = 1 - elif axis == 'z': + points = [p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1] + if axis == 'z': + coord_map = [0,1,2] self.inner = openmc.ZCylinder(*center, r=r1, **kwargs) self.outer = openmc.ZCylinder(*center, r=r2, **kwargs) - axis_idx = 3 + + elif axis == 'y': + coord_map = [0,2,1] + self.inner = openmc.YCylinder(*center, r=r1, **kwargs) + self.outer = openmc.YCylinder(*center, r=r2, **kwargs) + elif axis == 'x': + coord_map = [2,0,1] + self.inner = openmc.XCylinder(*center, r=r1, **kwargs) + self.outer = openmc.XCylinder(*center, r=r2, **kwargs) calibrated_points = [] for p in points: - p_temp = [] - for i in coord_map: - calibrated_points += [np.insert(p, axis_idx, 0)] + calibrated_points += [p[coord_map]] - p2_plane0, p3_plane0, p2_plane1, p3_plane1 = calibrated_points - p1 = np.insert(p1, axis_idx, 1) + p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1 = calibrated_points self.plane0 = openmc.Plane.from_points(p1, p2_plane0, p3_plane0, **kwargs) self.plane1 = openmc.Plane.from_points(p1, p2_plane1, p3_plane1, **kwargs) From 41460568a6a743051f90b8fc7b907e74303ca1e0 Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 4 Apr 2022 17:13:39 -0500 Subject: [PATCH 04/24] minor syntax fix --- openmc/model/surface_composite.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 2b55615a1..1635e21b6 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -257,6 +257,7 @@ class CylinderSector(CompositeSurface): def __pos__(self): return +self.outer | -self.inner | +self.plane0 | -self.plane1 + class XConeOneSided(CompositeSurface): """One-sided cone parallel the x-axis From ae881a126d8239d64ff8b31a67342e121005dafa Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 4 Apr 2022 18:05:40 -0500 Subject: [PATCH 05/24] Added unit test --- tests/unit_tests/test_surface_composite.py | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index a1a218311..bafff706e 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -150,3 +150,59 @@ def test_cone_one_sided(axis, point_pos, point_neg, ll_true): # Make sure repr works repr(s) + +@pytest.mark.parametrize( + "axis, indices", [ + ("X", [0, 1, 2]), + ("Y", [1, 2, 0]), + ("Z", [2, 0, 1]), + ] +) +def test_cylinder_sector(axis, indices): + center = [0., 0.] + r1, r2 = 0.5, 1.5 + d = (r2 - r1) / 2 + theta0 = -60. + theta = 120. + s = openmc.model.CylinderSector(center, r1, r2, theta0, theta, + axis=axis.lower()) + assert isinstance(s.outer_cyl, getattr(openmc, axis + "Cylinder")) + assert isinstance(s.inner_cyl, getattr(openmc, axis + "Cylinder")) + assert isinstance(s.plane0, openmc.Plane) + assert isinstance(s.plane1, openmc.Plane) + + # Make sure boundary condition propagates + s.boundary_type = 'reflective' + assert s.boundary_type == 'reflective' + assert s.outer_cyl.boundary_type == 'reflective' + assert s.inner_cyl.boundary_type == 'reflective' + assert s.plane0.boundary_type == 'reflective' + assert s.plane1.boundary_type == 'reflective' + + # Check bounding box + ll, ur = (+s).bounding_box + assert np.all(np.isinf(ll)) + assert np.all(np.isinf(ur)) + ll, ur = (-s).bounding_box + assert ll == pytest.approx(np.roll([-np.inf, -r2, -r2], indices[0])) + assert ur == pytest.approx(np.roll([np.inf, r2, r2], indices[0])) + + # __contains__ on associated half-spaces + point_pos = np.roll([0, r2 + 1, 0], indices[0]) + assert point_pos in +s + assert point_pos not in -s + point_neg = np.roll([0, r1 + d/2, r1 + d/2], indices[0]) + assert point_neg in -s + assert point_neg not in +s + + # translate method + t = uniform(-5.0, 5.0) + s_t = s.translate((t, t, t)) + ll_t, ur_t = (-s_t).bounding_box + assert ur_t == pytest.approx(ur + t) + assert ll_t == pytest.approx(ll + t) + + # Make sure repr works + repr(s) + + From 10123bf55a9c74df880f261460381af4092f975c Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 4 Apr 2022 18:05:54 -0500 Subject: [PATCH 06/24] consistency changes --- openmc/model/surface_composite.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 1635e21b6..a7c8d173e 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -205,11 +205,12 @@ class CylinderSector(CompositeSurface): """ - _surface_names = ('outer','inner', + _surface_names = ('outer_cyl','inner_cyl', 'plane0', 'plane1') def __init__(self, center, r1, r2, theta0, theta, axis='z', **kwargs): + self._axis = axis theta0 = pi / 180 * theta0 theta = pi / 180 * theta theta1 = theta0 + theta @@ -226,17 +227,16 @@ class CylinderSector(CompositeSurface): points = [p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1] if axis == 'z': coord_map = [0,1,2] - self.inner = openmc.ZCylinder(*center, r=r1, **kwargs) - self.outer = openmc.ZCylinder(*center, r=r2, **kwargs) - + self.inner_cyl = openmc.ZCylinder(*center, r=r1, **kwargs) + self.outer_cyl = openmc.ZCylinder(*center, r=r2, **kwargs) elif axis == 'y': - coord_map = [0,2,1] - self.inner = openmc.YCylinder(*center, r=r1, **kwargs) - self.outer = openmc.YCylinder(*center, r=r2, **kwargs) + coord_map = [0,2,1] + self.inner_cyl = openmc.YCylinder(*center, r=r1, **kwargs) + self.outer_cyl = openmc.YCylinder(*center, r=r2, **kwargs) elif axis == 'x': coord_map = [2,0,1] - self.inner = openmc.XCylinder(*center, r=r1, **kwargs) - self.outer = openmc.XCylinder(*center, r=r2, **kwargs) + self.inner_cyl = openmc.XCylinder(*center, r=r1, **kwargs) + self.outer_cyl = openmc.XCylinder(*center, r=r2, **kwargs) calibrated_points = [] for p in points: @@ -246,16 +246,20 @@ class CylinderSector(CompositeSurface): self.plane0 = openmc.Plane.from_points(p1, p2_plane0, p3_plane0, **kwargs) self.plane1 = openmc.Plane.from_points(p1, p2_plane1, p3_plane1, **kwargs) - self.inner = openmc.ZCylinder(x0=x0, y0=y0, r=r1, **kwargs) - self.outer = openmc.ZCylinder(x0=x0, y0=y0, r=r2, **kwargs) def __neg__(self): - return -self.outer & +self.inner & -self.plane0 & +self.plane1 + if self._axis == 'y': + return -self.outer_cyl & +self.inner_cyl & +self.plane0 & -self.plane1 + else: + return -self.outer_cyl & +self.inner_cyl & -self.plane0 & +self.plane1 def __pos__(self): - return +self.outer | -self.inner | +self.plane0 | -self.plane1 + if self._axis == 'y': + return +self.outer_cyl | -self.inner_cyl | -self.plane0 | +self.plane1 + else: + return +self.outer_cyl | -self.inner_cyl | +self.plane0 | -self.plane1 class XConeOneSided(CompositeSurface): From 370625be5532050f8c8ac0f581b9e35f0575ab03 Mon Sep 17 00:00:00 2001 From: yardasol Date: Mon, 4 Apr 2022 18:06:48 -0500 Subject: [PATCH 07/24] Added reference to CylinderSector in the sphinx documentation --- docs/source/pythonapi/model.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/pythonapi/model.rst b/docs/source/pythonapi/model.rst index a6c89be7c..686bc8d1c 100644 --- a/docs/source/pythonapi/model.rst +++ b/docs/source/pythonapi/model.rst @@ -25,6 +25,7 @@ Composite Surfaces :nosignatures: :template: myclass.rst + openmc.model.CylinderSector openmc.model.RectangularParallelepiped openmc.model.RightCircularCylinder openmc.model.XConeOneSided From be6afdc3355bfa26ca3c093f3cab01842a14e7ea Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 5 Apr 2022 10:31:31 -0500 Subject: [PATCH 08/24] optimize implementation --- openmc/model/surface_composite.py | 178 ++++++++++++++---------------- 1 file changed, 84 insertions(+), 94 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index a7c8d173e..03595ff4b 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -53,6 +53,90 @@ class CompositeSurface(ABC): """Return the negative half-space of the composite surface.""" +class CylinderSector(CompositeSurface): + """Infinite cylindrical sector composite surface + + This class acts as a proper surface, meaning that unary `+` and `-` + operators applied to it will produce a half-space. The negative + side is defined to be the region inside of the cylinder sector. + + Parameters + ---------- + center : iterable of float + Coordinate for central axes of cylinders in the (y, z), (z, x), or + (x, y) basis. Defaults to (0,0) + r1, r2 : float + Inner and outer cylinder radii + theta0 : float + Angular offset of the sector in degrees relative to the primary basis + axis (+y, +z, or +x). + theta : float + Angular width of the sector in degrees. + axis : {'z', 'y', 'x'} + Central axis of the cylinders. Defaults to z + **kwargs + Keyword arguments passed to underlying plane classes + + Attributes + ---------- + outer : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder + Outer cylinder surface + inner : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder + Inner cylinder surface + plane0 : openmc.Plane + Plane at angle :math:`\theta_0` relative to the first basis axis + plane1 : openmc.Plane + Plane at angle :math:`\theta_0 + \theta` relative to the first + basis axis. + + """ + + _surface_names = ('outer_cyl','inner_cyl', + 'plane0', 'plane1') + + def __init__(self, center, r1, r2, theta0, theta, axis='z', **kwargs): + theta0 = pi / 180 * theta0 + theta = pi / 180 * theta + theta1 = theta0 + theta + + # Coords for axis-perpendicular planes + p1 = array([0.,0.,1.]) + + p2_plane0 = array([r1 * cos(theta0), r1 * sin(theta0), 0.]) + p3_plane0 = array([r2 * cos(theta0), r2 * sin(theta0), 0.]) + + p2_plane1 = array([r1 * cos(theta1), r1 * sin(theta1), 0.]) + p3_plane1 = array([r2 * cos(theta1), r2 * sin(theta1), 0.]) + + points = [p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1] + if axis == 'z': + coord_map = [0,1,2] + self.inner_cyl = openmc.ZCylinder(*center, r1, **kwargs) + self.outer_cyl = openmc.ZCylinder(*center, r2, **kwargs) + elif axis == 'y': + coord_map = [1,2,0] + self.inner_cyl = openmc.YCylinder(*center, r1, **kwargs) + self.outer_cyl = openmc.YCylinder(*center, r2, **kwargs) + elif axis == 'x': + coord_map = [2,0,1] + self.inner_cyl = openmc.XCylinder(*center, r1, **kwargs) + self.outer_cyl = openmc.XCylinder(*center, r2, **kwargs) + + for p in points: + p[:] = p[coord_map] + + self.plane0 = openmc.Plane.from_points(p1, p2_plane0, p3_plane0, + **kwargs) + self.plane1 = openmc.Plane.from_points(p1, p2_plane1, p3_plane1, + **kwargs) + + def __neg__(self): + return -self.outer_cyl & +self.inner_cyl & -self.plane0 & +self.plane1 + + def __pos__(self): + return +self.outer_cyl | -self.inner_cyl | +self.plane0 | -self.plane1 + + class RightCircularCylinder(CompositeSurface): """Right circular cylinder composite surface @@ -167,100 +251,6 @@ class RectangularParallelepiped(CompositeSurface): def __pos__(self): return -self.xmin | +self.xmax | -self.ymin | +self.ymax | -self.zmin | +self.zmax -class CylinderSector(CompositeSurface): - """Infinite cylindrical sector composite surface - - This class acts as a proper surface, meaning that unary `+` and `-` - operators applied to it will produce a half-space. The negative - side is defined to be the region inside of the cylinder sector. - - Parameters - ---------- - center : iterable of float - Coordinate for central axes of cylinders in the (y, z), (x,z), or - (x, y) basis. Defaults to (0,0) - r1, r2 : float - Inner and outer cylinder radii - theta0 : float - Angular offset of the sector in degrees relative to the primary basis - axis (+y or +x). - theta : float - Angular width of the sector in degrees. - axis : {'z', 'y', 'x'} - Central axis of the cylinders. Defaults to z - **kwargs - Keyword arguments passed to underlying plane classes - - Attributes - ---------- - outer : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder - Outer cylinder surface - inner : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder - Inner cylinder surface - plane0 : openmc.Plane - Plane at angle :math:`\theta_0` relative to the first basis axis - plane1 : openmc.Plane - Plane at angle :math:`\theta_0 + \theta` relative to the first - basis axis. - - """ - - _surface_names = ('outer_cyl','inner_cyl', - 'plane0', 'plane1') - - def __init__(self, center, r1, r2, theta0, theta, axis='z', **kwargs): - - self._axis = axis - theta0 = pi / 180 * theta0 - theta = pi / 180 * theta - theta1 = theta0 + theta - - # Coords for axis-perpendicular planes - p1 = array([0.,0.,1.]) - - p2_plane0 = array([r1 * cos(theta0), r1 * sin(theta0), 0.]) - p3_plane0 = array([r2 * cos(theta0), r2 * sin(theta0), 0.]) - - p2_plane1 = array([r1 * cos(theta1), r1 * sin(theta1), 0.]) - p3_plane1 = array([r2 * cos(theta1), r2 * sin(theta1), 0.]) - - points = [p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1] - if axis == 'z': - coord_map = [0,1,2] - self.inner_cyl = openmc.ZCylinder(*center, r=r1, **kwargs) - self.outer_cyl = openmc.ZCylinder(*center, r=r2, **kwargs) - elif axis == 'y': - coord_map = [0,2,1] - self.inner_cyl = openmc.YCylinder(*center, r=r1, **kwargs) - self.outer_cyl = openmc.YCylinder(*center, r=r2, **kwargs) - elif axis == 'x': - coord_map = [2,0,1] - self.inner_cyl = openmc.XCylinder(*center, r=r1, **kwargs) - self.outer_cyl = openmc.XCylinder(*center, r=r2, **kwargs) - - calibrated_points = [] - for p in points: - calibrated_points += [p[coord_map]] - - p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1 = calibrated_points - - self.plane0 = openmc.Plane.from_points(p1, p2_plane0, p3_plane0, **kwargs) - self.plane1 = openmc.Plane.from_points(p1, p2_plane1, p3_plane1, **kwargs) - - - def __neg__(self): - if self._axis == 'y': - return -self.outer_cyl & +self.inner_cyl & +self.plane0 & -self.plane1 - else: - return -self.outer_cyl & +self.inner_cyl & -self.plane0 & +self.plane1 - - - def __pos__(self): - if self._axis == 'y': - return +self.outer_cyl | -self.inner_cyl | -self.plane0 | +self.plane1 - else: - return +self.outer_cyl | -self.inner_cyl | +self.plane0 | -self.plane1 - class XConeOneSided(CompositeSurface): """One-sided cone parallel the x-axis From e341c20822b2cdadde9960b420ad619fa30eb2c7 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 7 Apr 2022 11:36:04 -0500 Subject: [PATCH 09/24] pep8, consistency changes --- openmc/model/surface_composite.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 03595ff4b..7106730a8 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -1,7 +1,7 @@ from abc import ABC, abstractmethod from copy import copy from math import sqrt, pi, sin, cos -from numpy import array +import numpy as np import openmc from openmc.checkvalue import check_greater_than, check_value @@ -72,16 +72,16 @@ class CylinderSector(CompositeSurface): axis (+y, +z, or +x). theta : float Angular width of the sector in degrees. - axis : {'z', 'y', 'x'} - Central axis of the cylinders. Defaults to z + axis : {'x', 'y', 'z'} + Central axis of the cylinders. Defaults to 'z'. **kwargs - Keyword arguments passed to underlying plane classes + Keyword arguments passed to underlying plane classes. Attributes ---------- - outer : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder + outer_cyl : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder Outer cylinder surface - inner : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder + inner_cyl : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder Inner cylinder surface plane0 : openmc.Plane Plane at angle :math:`\theta_0` relative to the first basis axis @@ -100,7 +100,7 @@ class CylinderSector(CompositeSurface): theta1 = theta0 + theta # Coords for axis-perpendicular planes - p1 = array([0.,0.,1.]) + p1 = array([0., 0., 1.]) p2_plane0 = array([r1 * cos(theta0), r1 * sin(theta0), 0.]) p3_plane0 = array([r2 * cos(theta0), r2 * sin(theta0), 0.]) @@ -110,15 +110,15 @@ class CylinderSector(CompositeSurface): points = [p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1] if axis == 'z': - coord_map = [0,1,2] + coord_map = [0, 1, 2] self.inner_cyl = openmc.ZCylinder(*center, r1, **kwargs) self.outer_cyl = openmc.ZCylinder(*center, r2, **kwargs) elif axis == 'y': - coord_map = [1,2,0] + coord_map = [1, 2, 0] self.inner_cyl = openmc.YCylinder(*center, r1, **kwargs) self.outer_cyl = openmc.YCylinder(*center, r2, **kwargs) elif axis == 'x': - coord_map = [2,0,1] + coord_map = [2, 0, 1] self.inner_cyl = openmc.XCylinder(*center, r1, **kwargs) self.outer_cyl = openmc.XCylinder(*center, r2, **kwargs) From 3340673dc58363e68d36c4f293698f48254dfe1a Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 7 Apr 2022 12:42:56 -0500 Subject: [PATCH 10/24] fix array syntax --- openmc/model/surface_composite.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 7106730a8..c82200128 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -100,13 +100,13 @@ class CylinderSector(CompositeSurface): theta1 = theta0 + theta # Coords for axis-perpendicular planes - p1 = array([0., 0., 1.]) + p1 = np.array([0., 0., 1.]) - p2_plane0 = array([r1 * cos(theta0), r1 * sin(theta0), 0.]) - p3_plane0 = array([r2 * cos(theta0), r2 * sin(theta0), 0.]) + p2_plane0 = np.array([r1 * cos(theta0), r1 * sin(theta0), 0.]) + p3_plane0 = np.array([r2 * cos(theta0), r2 * sin(theta0), 0.]) - p2_plane1 = array([r1 * cos(theta1), r1 * sin(theta1), 0.]) - p3_plane1 = array([r2 * cos(theta1), r2 * sin(theta1), 0.]) + p2_plane1 = np.array([r1 * cos(theta1), r1 * sin(theta1), 0.]) + p3_plane1 = np.array([r2 * cos(theta1), r2 * sin(theta1), 0.]) points = [p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1] if axis == 'z': From d08f2afa1c3bbc0cb3019523d07eba69bae60c82 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 7 Apr 2022 13:32:58 -0500 Subject: [PATCH 11/24] docstring typo fixes --- openmc/model/surface_composite.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index c82200128..ec4143912 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -65,8 +65,10 @@ class CylinderSector(CompositeSurface): center : iterable of float Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) basis. Defaults to (0,0) - r1, r2 : float - Inner and outer cylinder radii + r1 : float + Inner cylinder radii + r2 : float + Outer cylinder radii theta0 : float Angular offset of the sector in degrees relative to the primary basis axis (+y, +z, or +x). @@ -84,9 +86,9 @@ class CylinderSector(CompositeSurface): inner_cyl : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder Inner cylinder surface plane0 : openmc.Plane - Plane at angle :math:`\theta_0` relative to the first basis axis + Plane at angle :math:`\\theta_0` relative to the first basis axis plane1 : openmc.Plane - Plane at angle :math:`\theta_0 + \theta` relative to the first + Plane at angle :math:`\\theta_0 + \\theta` relative to the first basis axis. """ From 8e1880b01cb0039272eb063c9f82a501d3ee8d18 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 7 Apr 2022 19:00:57 -0500 Subject: [PATCH 12/24] formatting fixes --- openmc/model/surface_composite.py | 9 ++++----- tests/unit_tests/test_surface_composite.py | 10 ++++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 70cdb33e1..e1696edce 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -58,10 +58,10 @@ class CylinderSector(CompositeSurface): This class acts as a proper surface, meaning that unary `+` and `-` operators applied to it will produce a half-space. The negative side is defined to be the region inside of the cylinder sector. - + Parameters ---------- - center : iterable of float + center : iterable of float Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) basis. Defaults to (0,0) r1 : float @@ -136,8 +136,8 @@ class CylinderSector(CompositeSurface): def __pos__(self): return +self.outer_cyl | -self.inner_cyl | +self.plane0 | -self.plane1 - - + + class IsogonalOctagon(CompositeSurface): """Infinite isogonal octagon composite surface @@ -155,7 +155,6 @@ class IsogonalOctagon(CompositeSurface): Parameters ---------- center : iterable of float - Coordinate for the central axis of the octagon in the (y, z), (z, x), or (x, y) basis. r1 : float diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index f7dbeca4e..6b9b6c7a5 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -171,7 +171,7 @@ def test_cylinder_sector(axis, indices): assert isinstance(s.inner_cyl, getattr(openmc, axis + "Cylinder")) assert isinstance(s.plane0, openmc.Plane) assert isinstance(s.plane1, openmc.Plane) - + # Make sure boundary condition propagates s.boundary_type = 'reflective' assert s.boundary_type == 'reflective' @@ -179,7 +179,7 @@ def test_cylinder_sector(axis, indices): assert s.inner_cyl.boundary_type == 'reflective' assert s.plane0.boundary_type == 'reflective' assert s.plane1.boundary_type == 'reflective' - + # Check bounding box ll, ur = (+s).bounding_box assert np.all(np.isinf(ll)) @@ -237,7 +237,7 @@ def test_isogonal_octagon(axis, plane_tb, plane_lr, axis_idx): assert isinstance(s.lower_right, openmc.Plane) assert isinstance(s.upper_left, openmc.Plane) assert isinstance(s.lower_left, openmc.Plane) - + # Make sure boundary condition propagates s.boundary_type = 'reflective' assert s.boundary_type == 'reflective' @@ -285,4 +285,6 @@ def test_isogonal_octagon(axis, plane_tb, plane_lr, axis_idx): openmc.model.IsogonalOctagon(center, r1=10., r2=1.) # Make sure repr works - repr(s) \ No newline at end of file + repr(s) + + From e53be38712630b684019469cafd25497716ece48 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 7 Apr 2022 19:01:09 -0500 Subject: [PATCH 13/24] pep8 fixes --- openmc/model/surface_composite.py | 9 +++++---- tests/unit_tests/test_surface_composite.py | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index e1696edce..e3ac7e345 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -6,6 +6,7 @@ import numpy as np import openmc from openmc.checkvalue import check_greater_than, check_value + class CompositeSurface(ABC): """Multiple primitive surfaces combined into a composite surface""" @@ -92,7 +93,7 @@ class CylinderSector(CompositeSurface): """ - _surface_names = ('outer_cyl','inner_cyl', + _surface_names = ('outer_cyl', 'inner_cyl', 'plane0', 'plane1') def __init__(self, center, r1, r2, theta0, theta, axis='z', **kwargs): @@ -132,7 +133,7 @@ class CylinderSector(CompositeSurface): **kwargs) def __neg__(self): - return -self.outer_cyl & +self.inner_cyl & -self.plane0 & +self.plane1 + return -self.outer_cyl & +self.inner_cyl & -self.plane0 & +self.plane1 def __pos__(self): return +self.outer_cyl | -self.inner_cyl | +self.plane0 | -self.plane1 @@ -206,10 +207,10 @@ class IsogonalOctagon(CompositeSurface): # Side lengths if r2 > r1 * sqrt(2): - raise ValueError(f'r2 is greater than sqrt(2) * r1. Octagon' + \ + raise ValueError(f'r2 is greater than sqrt(2) * r1. Octagon' + ' may be erroneous.') if r1 > r2 * sqrt(2): - raise ValueError(f'r1 is greater than sqrt(2) * r2. Octagon' + \ + raise ValueError(f'r1 is greater than sqrt(2) * r2. Octagon' + ' may be erroneous.') L_basis_ax = (r2 * sqrt(2) - r1) diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index 6b9b6c7a5..7985a2aae 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -12,7 +12,8 @@ def test_rectangular_parallelepiped(): ymax = ymin + uniform(0., 5.) zmin = uniform(-5., 5.) zmax = zmin + uniform(0., 5.) - s = openmc.model.RectangularParallelepiped(xmin, xmax, ymin, ymax, zmin, zmax) + s = openmc.model.RectangularParallelepiped( + xmin, xmax, ymin, ymax, zmin, zmax) assert isinstance(s.xmin, openmc.XPlane) assert isinstance(s.xmax, openmc.XPlane) assert isinstance(s.ymin, openmc.YPlane) @@ -286,5 +287,3 @@ def test_isogonal_octagon(axis, plane_tb, plane_lr, axis_idx): # Make sure repr works repr(s) - - From 3c2f0c03ffdce64c72b51202c089cc804b82df7b Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 26 Apr 2022 13:32:14 -0500 Subject: [PATCH 14/24] apply feedback from @paulromano: add checks for sector bounds; make variables less ambiguous --- openmc/model/surface_composite.py | 59 ++++++++++++---------- tests/unit_tests/test_surface_composite.py | 20 +++++--- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index e3ac7e345..7a6a50ba4 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -66,16 +66,18 @@ class CylinderSector(CompositeSurface): Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) basis. Defaults to (0,0) r1 : float - Inner cylinder radii + Inner radius of sector. Must be less than r2. r2 : float - Outer cylinder radii - theta0 : float - Angular offset of the sector in degrees relative to the primary basis - axis (+y, +z, or +x). - theta : float - Angular width of the sector in degrees. + Outer radius of sector. Must be greater than r1. + central_angle : float + Central angle, :math:`\\theta`, of the sector in degrees. Must be greater + that 0 and less than 360. + alpha : float + Angular offset of the clockwise-most side of the sector in degrees + relative to the primary basis axis (+y, +z, or +x). axis : {'x', 'y', 'z'} - Central axis of the cylinders. Defaults to 'z'. + Central axis of the cylinders defining the inner and outer surfaces + of the sector. Defaults to 'z'. **kwargs Keyword arguments passed to underlying plane classes. @@ -85,32 +87,37 @@ class CylinderSector(CompositeSurface): Outer cylinder surface inner_cyl : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder Inner cylinder surface - plane0 : openmc.Plane - Plane at angle :math:`\\theta_0` relative to the first basis axis plane1 : openmc.Plane - Plane at angle :math:`\\theta_0 + \\theta` relative to the first + Plane at angle :math:`\\phi_1 = \\alpha` relative to the first basis axis + plane2 : openmc.Plane + Plane at angle :math:`\\phi_2 = \\alpha + \\theta` relative to the first basis axis. """ - _surface_names = ('outer_cyl', 'inner_cyl', - 'plane0', 'plane1') + _surface_names = ('outer_cyl', 'inner_cyl', 'plane1', 'plane2') - def __init__(self, center, r1, r2, theta0, theta, axis='z', **kwargs): - theta0 = pi / 180 * theta0 - theta = pi / 180 * theta - theta1 = theta0 + theta + def __init__(self, center, r1, r2, central_angle, alpha, axis='z', **kwargs): + + if r2 <= r1 * sqrt(2): + raise ValueError(f'r2 must be greater than r1.') + + if central_angle >= 360. or central_angle <= 0: + raise ValueError(f'theta must be less than 360.') + + phi1 = pi / 180 * alpha + phi2 = pi / 180 * (alpha + central_angle) # Coords for axis-perpendicular planes p1 = np.array([0., 0., 1.]) - p2_plane0 = np.array([r1 * cos(theta0), r1 * sin(theta0), 0.]) - p3_plane0 = np.array([r2 * cos(theta0), r2 * sin(theta0), 0.]) + p2_plane1 = np.array([r1 * cos(phi1), r1 * sin(phi1), 0.]) + p3_plane1 = np.array([r2 * cos(phi1), r2 * sin(phi1), 0.]) - p2_plane1 = np.array([r1 * cos(theta1), r1 * sin(theta1), 0.]) - p3_plane1 = np.array([r2 * cos(theta1), r2 * sin(theta1), 0.]) + p2_plane2 = np.array([r1 * cos(phi2), r1 * sin(phi2), 0.]) + p3_plane2 = np.array([r2 * cos(phi2), r2 * sin(phi2), 0.]) - points = [p1, p2_plane0, p3_plane0, p2_plane1, p3_plane1] + points = [p1, p2_plane1, p3_plane1, p2_plane2, p3_plane2] if axis == 'z': coord_map = [0, 1, 2] self.inner_cyl = openmc.ZCylinder(*center, r1, **kwargs) @@ -127,16 +134,16 @@ class CylinderSector(CompositeSurface): for p in points: p[:] = p[coord_map] - self.plane0 = openmc.Plane.from_points(p1, p2_plane0, p3_plane0, - **kwargs) self.plane1 = openmc.Plane.from_points(p1, p2_plane1, p3_plane1, **kwargs) + self.plane2 = openmc.Plane.from_points(p1, p2_plane2, p3_plane2, + **kwargs) def __neg__(self): - return -self.outer_cyl & +self.inner_cyl & -self.plane0 & +self.plane1 + return -self.outer_cyl & +self.inner_cyl & -self.plane1 & +self.plane2 def __pos__(self): - return +self.outer_cyl | -self.inner_cyl | +self.plane0 | -self.plane1 + return +self.outer_cyl | -self.inner_cyl | +self.plane1 | -self.plane2 class IsogonalOctagon(CompositeSurface): diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index 7985a2aae..00e51e6d9 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -164,22 +164,22 @@ def test_cylinder_sector(axis, indices): center = [0., 0.] r1, r2 = 0.5, 1.5 d = (r2 - r1) / 2 - theta0 = -60. - theta = 120. - s = openmc.model.CylinderSector(center, r1, r2, theta0, theta, + central_angle = 120. + alpha = -60. + s = openmc.model.CylinderSector(center, r1, r2, central_angle, alpha, axis=axis.lower()) assert isinstance(s.outer_cyl, getattr(openmc, axis + "Cylinder")) assert isinstance(s.inner_cyl, getattr(openmc, axis + "Cylinder")) - assert isinstance(s.plane0, openmc.Plane) assert isinstance(s.plane1, openmc.Plane) + assert isinstance(s.plane2, openmc.Plane) # Make sure boundary condition propagates s.boundary_type = 'reflective' assert s.boundary_type == 'reflective' assert s.outer_cyl.boundary_type == 'reflective' assert s.inner_cyl.boundary_type == 'reflective' - assert s.plane0.boundary_type == 'reflective' assert s.plane1.boundary_type == 'reflective' + assert s.plane2.boundary_type == 'reflective' # Check bounding box ll, ur = (+s).bounding_box @@ -193,7 +193,7 @@ def test_cylinder_sector(axis, indices): point_pos = np.roll([0, r2 + 1, 0], indices[0]) assert point_pos in +s assert point_pos not in -s - point_neg = np.roll([0, r1 + d/2, r1 + d/2], indices[0]) + point_neg = np.roll([0, r1 + d, r1 + d], indices[0]) assert point_neg in -s assert point_neg not in +s @@ -206,9 +206,13 @@ def test_cylinder_sector(axis, indices): # Check invalid r1, r2 combinations with pytest.raises(ValueError): - openmc.model.IsogonalOctagon(center, r1=1.0, r2=10.) + openmc.model.CylinderSector(center, 10., 1., central_angle, alpha) + + # Check invalid sector width with pytest.raises(ValueError): - openmc.model.IsogonalOctagon(center, r1=10., r2=1.) + openmc.model.CylinderSector(center, 1., 10., 360, alpha) + with pytest.raises(ValueError): + openmc.model.CylinderSector(center, 1., 10., -1, alpha) # Make sure repr works repr(s) From 020e0bd945ee9ac3a385c6ae02cf25239cbd7dae Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 26 Apr 2022 13:33:04 -0500 Subject: [PATCH 15/24] minor docstring addition --- openmc/model/surface_composite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 7a6a50ba4..3b4a1f42f 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -73,7 +73,7 @@ class CylinderSector(CompositeSurface): Central angle, :math:`\\theta`, of the sector in degrees. Must be greater that 0 and less than 360. alpha : float - Angular offset of the clockwise-most side of the sector in degrees + Angular offset, :math:`\\alpha`, of the clockwise-most side of the sector in degrees relative to the primary basis axis (+y, +z, or +x). axis : {'x', 'y', 'z'} Central axis of the cylinders defining the inner and outer surfaces From be97beb1c44ed4f46c175454a940a4e15a80f696 Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 26 Apr 2022 13:41:50 -0500 Subject: [PATCH 16/24] make description of 'first basis axis' consistent' --- openmc/model/surface_composite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 3b4a1f42f..9a44d1955 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -74,7 +74,7 @@ class CylinderSector(CompositeSurface): that 0 and less than 360. alpha : float Angular offset, :math:`\\alpha`, of the clockwise-most side of the sector in degrees - relative to the primary basis axis (+y, +z, or +x). + relative to the first basis axis (+y, +z, or +x). axis : {'x', 'y', 'z'} Central axis of the cylinders defining the inner and outer surfaces of the sector. Defaults to 'z'. From 5abd01d4df7534b7be6aee8723791c6706afdd80 Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 26 Apr 2022 13:49:21 -0500 Subject: [PATCH 17/24] add description of surfaces --- openmc/model/surface_composite.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 9a44d1955..c39439ed3 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -56,6 +56,10 @@ class CompositeSurface(ABC): class CylinderSector(CompositeSurface): """Infinite cylindrical sector composite surface + A cylinder sector is composed of two cylindrical and two planar surfaces. + The cylindrical surfaces are concentric, and the planar surfaces intersect + the central axis of the cylindrical surfaces. + This class acts as a proper surface, meaning that unary `+` and `-` operators applied to it will produce a half-space. The negative side is defined to be the region inside of the cylinder sector. From 09711e9672cbdd50682c20af8575da2db5e8c541 Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 26 Apr 2022 14:05:47 -0500 Subject: [PATCH 18/24] alpha -> ccw_offset; consistency changes --- openmc/model/surface_composite.py | 25 +++++++++++++++------- tests/unit_tests/test_surface_composite.py | 10 ++++----- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index c39439ed3..5ad87d719 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -74,11 +74,13 @@ class CylinderSector(CompositeSurface): r2 : float Outer radius of sector. Must be greater than r1. central_angle : float - Central angle, :math:`\\theta`, of the sector in degrees. Must be greater - that 0 and less than 360. - alpha : float - Angular offset, :math:`\\alpha`, of the clockwise-most side of the sector in degrees - relative to the first basis axis (+y, +z, or +x). + Central angle, :math:`\\theta`, of the sector in degrees. Must be + greater that 0 and less than 360. + ccw_offset : float + Angular offset, :math:`\\alpha`, in the counter-clockwise direction + with respect to the first basis axis (+y, +z, or +x) of the + clockwise-most side of the sector in degrees. Note that negative values + translate to a clockwise offset. axis : {'x', 'y', 'z'} Central axis of the cylinders defining the inner and outer surfaces of the sector. Defaults to 'z'. @@ -101,7 +103,14 @@ class CylinderSector(CompositeSurface): _surface_names = ('outer_cyl', 'inner_cyl', 'plane1', 'plane2') - def __init__(self, center, r1, r2, central_angle, alpha, axis='z', **kwargs): + def __init__(self, + center, + r1, + r2, + central_angle, + ccw_offset, + axis='z', + **kwargs): if r2 <= r1 * sqrt(2): raise ValueError(f'r2 must be greater than r1.') @@ -109,8 +118,8 @@ class CylinderSector(CompositeSurface): if central_angle >= 360. or central_angle <= 0: raise ValueError(f'theta must be less than 360.') - phi1 = pi / 180 * alpha - phi2 = pi / 180 * (alpha + central_angle) + phi1 = pi / 180 * ccw_offset + phi2 = pi / 180 * (ccw_offset + central_angle) # Coords for axis-perpendicular planes p1 = np.array([0., 0., 1.]) diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index 00e51e6d9..458f11c60 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -165,8 +165,8 @@ def test_cylinder_sector(axis, indices): r1, r2 = 0.5, 1.5 d = (r2 - r1) / 2 central_angle = 120. - alpha = -60. - s = openmc.model.CylinderSector(center, r1, r2, central_angle, alpha, + ccw_offset = -60. + s = openmc.model.CylinderSector(center, r1, r2, central_angle, ccw_offset, axis=axis.lower()) assert isinstance(s.outer_cyl, getattr(openmc, axis + "Cylinder")) assert isinstance(s.inner_cyl, getattr(openmc, axis + "Cylinder")) @@ -206,13 +206,13 @@ def test_cylinder_sector(axis, indices): # Check invalid r1, r2 combinations with pytest.raises(ValueError): - openmc.model.CylinderSector(center, 10., 1., central_angle, alpha) + openmc.model.CylinderSector(center, 10., 1., central_angle, ccw_offset) # Check invalid sector width with pytest.raises(ValueError): - openmc.model.CylinderSector(center, 1., 10., 360, alpha) + openmc.model.CylinderSector(center, 1., 10., 360, ccw_offset) with pytest.raises(ValueError): - openmc.model.CylinderSector(center, 1., 10., -1, alpha) + openmc.model.CylinderSector(center, 1., 10., -1, ccw_offset) # Make sure repr works repr(s) From 3cb3f9e673bca24a95f3c35aab65a415e3ba0905 Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 26 Apr 2022 14:26:11 -0500 Subject: [PATCH 19/24] clean up run-on sentence for ccw_offset; fix formatting in description for center --- openmc/model/surface_composite.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 5ad87d719..0f62c07ac 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -67,8 +67,8 @@ class CylinderSector(CompositeSurface): Parameters ---------- center : iterable of float - Coordinate for central axes of cylinders in the (y, z), (z, x), or - (x, y) basis. Defaults to (0,0) + Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) + basis. Defaults to (0,0) r1 : float Inner radius of sector. Must be less than r2. r2 : float @@ -77,13 +77,13 @@ class CylinderSector(CompositeSurface): Central angle, :math:`\\theta`, of the sector in degrees. Must be greater that 0 and less than 360. ccw_offset : float - Angular offset, :math:`\\alpha`, in the counter-clockwise direction - with respect to the first basis axis (+y, +z, or +x) of the - clockwise-most side of the sector in degrees. Note that negative values - translate to a clockwise offset. + Angular offset, :math:`\\alpha`, of the clockwise-most side of the + sector in degrees. The offset is in the counter-clockwise direction + with respect to the first basis axis (+y, +z, or +x). Note that + negative values translate to an offset in the clockwise direction. axis : {'x', 'y', 'z'} - Central axis of the cylinders defining the inner and outer surfaces - of the sector. Defaults to 'z'. + Central axis of the cylinders defining the inner and outer surfaces of + the sector. Defaults to 'z'. **kwargs Keyword arguments passed to underlying plane classes. From fc3809c2df6d5705b5167276a39dd0cd98faf199 Mon Sep 17 00:00:00 2001 From: yardasol Date: Tue, 26 Apr 2022 14:28:08 -0500 Subject: [PATCH 20/24] add periods --- openmc/model/surface_composite.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 0f62c07ac..af84670cf 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -54,7 +54,7 @@ class CompositeSurface(ABC): class CylinderSector(CompositeSurface): - """Infinite cylindrical sector composite surface + """Infinite cylindrical sector composite surface. A cylinder sector is composed of two cylindrical and two planar surfaces. The cylindrical surfaces are concentric, and the planar surfaces intersect @@ -68,7 +68,7 @@ class CylinderSector(CompositeSurface): ---------- center : iterable of float Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) - basis. Defaults to (0,0) + basis. Defaults to (0,0). r1 : float Inner radius of sector. Must be less than r2. r2 : float @@ -90,11 +90,11 @@ class CylinderSector(CompositeSurface): Attributes ---------- outer_cyl : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder - Outer cylinder surface + Outer cylinder surface. inner_cyl : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder - Inner cylinder surface + Inner cylinder surface. plane1 : openmc.Plane - Plane at angle :math:`\\phi_1 = \\alpha` relative to the first basis axis + Plane at angle :math:`\\phi_1 = \\alpha` relative to the first basis axis. plane2 : openmc.Plane Plane at angle :math:`\\phi_2 = \\alpha + \\theta` relative to the first basis axis. From 51e5d1ccd2ce7b08953c4bb24314e884345e352d Mon Sep 17 00:00:00 2001 From: yardasol Date: Wed, 27 Apr 2022 12:56:39 -0500 Subject: [PATCH 21/24] make theta1,theta2 formulation the default; add alternate constructor for theta,alpha formulation --- openmc/model/surface_composite.py | 102 ++++++++++++++++----- tests/unit_tests/test_surface_composite.py | 36 ++++++-- 2 files changed, 106 insertions(+), 32 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index af84670cf..d4b25436d 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -66,26 +66,27 @@ class CylinderSector(CompositeSurface): Parameters ---------- - center : iterable of float - Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) - basis. Defaults to (0,0). r1 : float Inner radius of sector. Must be less than r2. r2 : float Outer radius of sector. Must be greater than r1. - central_angle : float - Central angle, :math:`\\theta`, of the sector in degrees. Must be - greater that 0 and less than 360. - ccw_offset : float - Angular offset, :math:`\\alpha`, of the clockwise-most side of the - sector in degrees. The offset is in the counter-clockwise direction - with respect to the first basis axis (+y, +z, or +x). Note that - negative values translate to an offset in the clockwise direction. + theta1 : float + Clockwise-most bound of sector in degrees. Assumed to be in the + counterclockwise direction with respect to the first basis axis + (+y, +z, or +x). Must be less than :attr:`theta2`. + theta2 : float + Counterclockwise-most bound of sector in degrees. Assumed to be in the + counterclockwise direction with respect to the first basis axis + (+y, +z, or +x). Must be greater than :attr:`theta1`. + center : iterable of float + Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) + basis. Defaults to (0,0). + axis : {'x', 'y', 'z'} Central axis of the cylinders defining the inner and outer surfaces of the sector. Defaults to 'z'. - **kwargs - Keyword arguments passed to underlying plane classes. + kwargs : dict + Keyword arguments passed to the :class:`Cylinder` and :class:`Plane` constructors. Attributes ---------- @@ -94,32 +95,34 @@ class CylinderSector(CompositeSurface): inner_cyl : openmc.ZCylinder, openmc.YCylinder, or openmc.XCylinder Inner cylinder surface. plane1 : openmc.Plane - Plane at angle :math:`\\phi_1 = \\alpha` relative to the first basis axis. + Plane at angle :math:`\\theta_1` relative to the first basis axis. plane2 : openmc.Plane - Plane at angle :math:`\\phi_2 = \\alpha + \\theta` relative to the first - basis axis. + Plane at angle :math:`\\theta_2` relative to the first basis axis. """ _surface_names = ('outer_cyl', 'inner_cyl', 'plane1', 'plane2') def __init__(self, - center, r1, r2, - central_angle, - ccw_offset, + theta1, + theta2, + center=(0.,0.), axis='z', **kwargs): if r2 <= r1 * sqrt(2): raise ValueError(f'r2 must be greater than r1.') - if central_angle >= 360. or central_angle <= 0: - raise ValueError(f'theta must be less than 360.') + if theta2 <= theta1: + raise ValueError(f'theta2 must be greater than theta1.') - phi1 = pi / 180 * ccw_offset - phi2 = pi / 180 * (ccw_offset + central_angle) + self._theta1 = theta1 + self._theta2 = theta2 + + phi1 = pi / 180 * theta1 + phi2 = pi / 180 * theta2 # Coords for axis-perpendicular planes p1 = np.array([0., 0., 1.]) @@ -152,6 +155,59 @@ class CylinderSector(CompositeSurface): self.plane2 = openmc.Plane.from_points(p1, p2_plane2, p3_plane2, **kwargs) + @classmethod + def from_theta_alpha(cls, + r1, + r2, + theta, + alpha, + center = (0.,0.), + axis='z', + **kwargs): + """Alternate constructor for :attr:`CylinderSector`. Returns an + :attr:`CylinderSector` object based on a central angle :math:`\\theta` + and an angular offset :math:`\\alpha`. Note that + :math:`\\theta_1 = \\alpha` and :math:`\\theta_2 = \\alpha + \\theta`. + + Parameters + ---------- + r1 : float + Inner radius of sector. Must be less than r2. + r2 : float + Outer radius of sector. Must be greater than r1. + theta : float + Central angle, :math:`\\theta`, of the sector in degrees. Must be + greater that 0 and less than 360. + alpha : float + Angular offset, :math:`\\alpha`, of sector in degrees. + The offset is in the counter-clockwise direction + with respect to the first basis axis (+y, +z, or +x). Note that + negative values translate to an offset in the clockwise direction. + center : iterable of float + Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) + basis. Defaults to (0,0). + + axis : {'x', 'y', 'z'} + Central axis of the cylinders defining the inner and outer surfaces of + the sector. Defaults to 'z'. + + kwargs : dict + Keyword arguments passed to the :class:`Cylinder` and :class:`Plane` constructors. + + Returns + ------- + CylinderSector + CylinderSector with the given central angle at the given + offset. + """ + if theta >= 360. or theta <= 0: + raise ValueError(f'theta must be less than 360 and greater than 0.') + + theta1 = alpha + theta2 = alpha + theta + + return cls(r1, r2, theta1, theta2, center=center, axis=axis, **kwargs) + def __neg__(self): return -self.outer_cyl & +self.inner_cyl & -self.plane1 & +self.plane2 diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index 458f11c60..d4c180d26 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -161,12 +161,11 @@ def test_cone_one_sided(axis, point_pos, point_neg, ll_true): ] ) def test_cylinder_sector(axis, indices): - center = [0., 0.] r1, r2 = 0.5, 1.5 d = (r2 - r1) / 2 - central_angle = 120. - ccw_offset = -60. - s = openmc.model.CylinderSector(center, r1, r2, central_angle, ccw_offset, + phi1 = -60. + phi2 = 60 + s = openmc.model.CylinderSector(r1, r2, phi1, phi2, axis=axis.lower()) assert isinstance(s.outer_cyl, getattr(openmc, axis + "Cylinder")) assert isinstance(s.inner_cyl, getattr(openmc, axis + "Cylinder")) @@ -206,18 +205,37 @@ def test_cylinder_sector(axis, indices): # Check invalid r1, r2 combinations with pytest.raises(ValueError): - openmc.model.CylinderSector(center, 10., 1., central_angle, ccw_offset) + openmc.model.CylinderSector(r2, r1, phi1, phi2) - # Check invalid sector width + # Check invalid angles with pytest.raises(ValueError): - openmc.model.CylinderSector(center, 1., 10., 360, ccw_offset) - with pytest.raises(ValueError): - openmc.model.CylinderSector(center, 1., 10., -1, ccw_offset) + openmc.model.CylinderSector(r1, r2, phi2, phi1) # Make sure repr works repr(s) +def test_cylinder_sector_from_theta_alpha(): + r1, r2 = 0.5, 1.5 + d = (r2 - r1) / 2 + theta = 120. + alpha = -60. + s = openmc.model.CylinderSector.from_theta_alpha(r1, + r2, + theta, + alpha) + + # Check that the angles are correct + assert s._theta1 == alpha + assert s._theta2 == alpha + theta + + # Check invalid sector width + with pytest.raises(ValueError): + openmc.model.CylinderSector.from_theta_alpha(r1, r2, 360, alpha) + with pytest.raises(ValueError): + openmc.model.CylinderSector.from_theta_alpha(r1, r2, -1, alpha) + + @pytest.mark.parametrize( "axis, plane_tb, plane_lr, axis_idx", [ ("x", "Z", "Y", 0), From 1d7265de3ea1012bfa935a48ec96384897847b03 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 28 Apr 2022 10:24:31 -0500 Subject: [PATCH 22/24] check surface coefficients match between CylinderSector objects from different constructors --- tests/unit_tests/test_surface_composite.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index d4c180d26..4d680ae7c 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -220,14 +220,19 @@ def test_cylinder_sector_from_theta_alpha(): d = (r2 - r1) / 2 theta = 120. alpha = -60. - s = openmc.model.CylinderSector.from_theta_alpha(r1, + theta1 = alpha + theta2 = alpha + theta + s = openmc.model.CylinderSector(r1, r2, theta1, theta2) + s_alt = openmc.model.CylinderSector.from_theta_alpha(r1, r2, theta, alpha) # Check that the angles are correct - assert s._theta1 == alpha - assert s._theta2 == alpha + theta + assert s.plane1.coefficients == s_alt.plane1.coefficients + assert s.plane2.coefficients == s_alt.plane2.coefficients + assert s.inner_cyl.coefficients == s_alt.inner_cyl.coefficients + assert s.outer_cyl.coefficients == s_alt.outer_cyl.coefficients # Check invalid sector width with pytest.raises(ValueError): From 2cccc1b788d8dfee99b805e05eab089ff895f4f4 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 28 Apr 2022 10:26:58 -0500 Subject: [PATCH 23/24] docstring fixes for from_theta_alpha; remove cruft attributes --- openmc/model/surface_composite.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index d4b25436d..590fe13a4 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -112,15 +112,12 @@ class CylinderSector(CompositeSurface): axis='z', **kwargs): - if r2 <= r1 * sqrt(2): + if r2 <= r1: raise ValueError(f'r2 must be greater than r1.') if theta2 <= theta1: raise ValueError(f'theta2 must be greater than theta1.') - self._theta1 = theta1 - self._theta2 = theta2 - phi1 = pi / 180 * theta1 phi2 = pi / 180 * theta2 @@ -164,10 +161,10 @@ class CylinderSector(CompositeSurface): center = (0.,0.), axis='z', **kwargs): - """Alternate constructor for :attr:`CylinderSector`. Returns an - :attr:`CylinderSector` object based on a central angle :math:`\\theta` - and an angular offset :math:`\\alpha`. Note that - :math:`\\theta_1 = \\alpha` and :math:`\\theta_2 = \\alpha + \\theta`. + r"""Alternate constructor for :class:`CylinderSector`. Returns a + :class:`CylinderSector` object based on a central angle :math:`\theta` + and an angular offset :math:`\alpha`. Note that + :math:`\theta_1 = \alpha` and :math:`\theta_2 = \alpha + \theta`. Parameters ---------- @@ -176,22 +173,20 @@ class CylinderSector(CompositeSurface): r2 : float Outer radius of sector. Must be greater than r1. theta : float - Central angle, :math:`\\theta`, of the sector in degrees. Must be + Central angle, :math:`\theta`, of the sector in degrees. Must be greater that 0 and less than 360. alpha : float - Angular offset, :math:`\\alpha`, of sector in degrees. + Angular offset, :math:`\alpha`, of sector in degrees. The offset is in the counter-clockwise direction with respect to the first basis axis (+y, +z, or +x). Note that negative values translate to an offset in the clockwise direction. center : iterable of float Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) basis. Defaults to (0,0). - axis : {'x', 'y', 'z'} Central axis of the cylinders defining the inner and outer surfaces of the sector. Defaults to 'z'. - - kwargs : dict + **kwargs : dict Keyword arguments passed to the :class:`Cylinder` and :class:`Plane` constructors. Returns From 77b4ec564718e8c876ac1ec4dbc83c9adc2d5921 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 28 Apr 2022 10:30:47 -0500 Subject: [PATCH 24/24] pep8 and consistency fixes in docstring --- openmc/model/surface_composite.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 590fe13a4..74f64c54a 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -81,12 +81,12 @@ class CylinderSector(CompositeSurface): center : iterable of float Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) basis. Defaults to (0,0). - axis : {'x', 'y', 'z'} Central axis of the cylinders defining the inner and outer surfaces of the sector. Defaults to 'z'. - kwargs : dict - Keyword arguments passed to the :class:`Cylinder` and :class:`Plane` constructors. + **kwargs : dict + Keyword arguments passed to the :class:`Cylinder` and + :class:`Plane` constructors. Attributes ---------- @@ -184,10 +184,11 @@ class CylinderSector(CompositeSurface): Coordinate for central axes of cylinders in the (y, z), (z, x), or (x, y) basis. Defaults to (0,0). axis : {'x', 'y', 'z'} - Central axis of the cylinders defining the inner and outer surfaces of - the sector. Defaults to 'z'. + Central axis of the cylinders defining the inner and outer surfaces + of the sector. Defaults to 'z'. **kwargs : dict - Keyword arguments passed to the :class:`Cylinder` and :class:`Plane` constructors. + Keyword arguments passed to the :class:`Cylinder` and + :class:`Plane` constructors. Returns -------