From 5aab24c82d4a264afa7658a980c511fb61aa76d4 Mon Sep 17 00:00:00 2001 From: Seda Yilmaz <133794379+nsedayilmaz@users.noreply.github.com> Date: Sun, 13 Oct 2024 21:01:34 +0300 Subject: [PATCH 1/7] Add a composite surface called vessel, which includes a 'ZCylinder' with ellipsoids on top and bottom. --- openmc/model/surface_composite.py | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index df290329647..668c2b72b8f 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -1837,3 +1837,49 @@ def __init__(self, center_base: Sequence[float], axis: Sequence[float], def __neg__(self) -> openmc.Region: return +self.plane_bottom & -self.plane_top & -self.cone + +class Z_Vessel(CompositeSurface): + """Vessel as a composite surface parallel to z-axis + includes composite surfaces with a ZCylinder and + semi-ellipsoids on top and the bottom of this cylinder. + """ + + _surface_names = ('cycl', 'zmin', 'zmax', 'bottom', 'top') + + def __init__(self, x0, y0, r, zmin, zmax, hbottom, htop, **kwargs): + if zmin >= zmax: + raise ValueError('zmin must be less than zmax') + + self.cycl = openmc.ZCylinder(x0=x0, y0=y0, r=r, **kwargs) + self.zmin = openmc.ZPlane(z0=zmin, **kwargs) + self.zmax = openmc.ZPlane(z0=zmax, **kwargs) + + """ + Coefficients for quadric surface to create an ellipsoid + + General equation for an ellipsoid: + (x-xo)^2/r^2 + (y-yo)^2/r^2 + (z-zo)^2/h^2 = 1 + + General form of a quadric surface equation: + Ax^2 + By^2 + Cz^2 + Gx + Hy + Jz + K = 0 + """ + + A = 1/r**2 + B = 1/r**2 + C1 = 1/hbottom**2 + C2 = 1/htop**2 + G = -(2*x0)/r**2 + H = -(2*y0)/r**2 + J1 = -(2*zmin)/hbottom**2 + J2 = -(2*zmax)/htop**2 + K1 = x0**2/r**2 + y0**2/r**2 + zmin**2/hbottom**2 - 1 + K2 = x0**2/r**2 + y0**2/r**2 + zmax**2/htop**2 - 1 + + self.bottom = openmc.Quadric(a=A, b=B, c=C1, g=G, h=H, j=J1, k=K1, **kwargs) + self.top = openmc.Quadric(a=A, b=B, c=C2, g=G, h=H, j=J2, k=K2, **kwargs) + + def __neg__(self): + return (-self.cycl & +self.zmin & -self.zmax) | (-self.bottom & -self.zmin) | (-self.top & +self.zmax) + + def __pos__(self): + return (+self.cycl | -self.zmin | +self.zmax) & (+self.bottom | +self.zmin) & (+self.top | -self.zmax) From 365fae6c392cc2a42b2885b9b074536fd26a7db6 Mon Sep 17 00:00:00 2001 From: Seda Yilmaz <133794379+nsedayilmaz@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:12:08 +0300 Subject: [PATCH 2/7] Update openmc/model/surface_composite.py Co-authored-by: Patrick Shriwise --- openmc/model/surface_composite.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 668c2b72b8f..951745a7d17 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -1855,14 +1855,9 @@ def __init__(self, x0, y0, r, zmin, zmax, hbottom, htop, **kwargs): self.zmax = openmc.ZPlane(z0=zmax, **kwargs) """ - Coefficients for quadric surface to create an ellipsoid - - General equation for an ellipsoid: - (x-xo)^2/r^2 + (y-yo)^2/r^2 + (z-zo)^2/h^2 = 1 - - General form of a quadric surface equation: - Ax^2 + By^2 + Cz^2 + Gx + Hy + Jz + K = 0 - """ + General equation for an ellipsoid: + (x-xo)^2/r^2 + (y-yo)^2/r^2 + (z-zo)^2/h^2 = 1 + """ A = 1/r**2 B = 1/r**2 From 4ad38ff514fe5138ea3575c07abf06774819e1f5 Mon Sep 17 00:00:00 2001 From: Seda Yilmaz <133794379+nsedayilmaz@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:13:00 +0300 Subject: [PATCH 3/7] Update openmc/model/surface_composite.py Co-authored-by: Patrick Shriwise --- 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 951745a7d17..f0b4e26cf68 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -1838,7 +1838,7 @@ def __init__(self, center_base: Sequence[float], axis: Sequence[float], def __neg__(self) -> openmc.Region: return +self.plane_bottom & -self.plane_top & -self.cone -class Z_Vessel(CompositeSurface): +class ZVessel(CompositeSurface): """Vessel as a composite surface parallel to z-axis includes composite surfaces with a ZCylinder and semi-ellipsoids on top and the bottom of this cylinder. From b6e6e366d3e604040635b8f4273c23779ec9ce25 Mon Sep 17 00:00:00 2001 From: Seda Yilmaz <133794379+nsedayilmaz@users.noreply.github.com> Date: Thu, 7 Nov 2024 00:32:06 +0300 Subject: [PATCH 4/7] Update test_surface_composite.py Add a test for ZVessel composite surface --- tests/unit_tests/test_surface_composite.py | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index 963bbe00d19..8a6cdf66dfe 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -596,3 +596,38 @@ def test_conical_frustum(): # Denegenerate case with r1 = r2 s = openmc.model.ConicalFrustum(center_base, axis, r1, r1) assert (1., 1., -0.01) in -s + +def test_ZVessel(): + x0 = 3.0 + y0 = 3.0 + r = 10.0 + zmin = 5.0 + zmax = 30.0 + hbottom = 4.0 + htop = 4.0 + s = openmc.model.ZVessel(x0, y0, r, zmin, zmax, bottom, htop) + assert isinstance(s.cycl, openmc.ZCylinder) + assert isinstance(s.zmin, openmc.ZPlane) + assert isinstance(s.zmax, openmc.ZPlane) + assert isinstance(s.bottom, openmc.Quadric) + assert isinstance(s.top, openmc.Quadric) + + # Make sure boundary condition propagates + s.boundary_type = 'reflective' + assert s.boundary_type == 'reflective' + assert s.cycl.boundary_type == 'reflective' + assert s.bottom.boundary_type == 'reflective' + assert s.top.boundary_type == 'reflective' + + # __contains__ on associated half-spaces + assert (-6.0, 4.0, 32.0) in +s + assert (-6.0, 4.0, 32.0) not in -s + assert (-2.0, 4.0, 32.0) in -s + assert (-2.0, 4.0, 32.0) not in +s + + # translate method + s_t = s.translate((1., 1., 0.)) + assert (-3.3, -2.5, 32.) in +s_t + + # Make sure repr works + repr(s) From 064e1829f938c0bedacee413065bd74ed69149e3 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 25 Oct 2024 10:50:26 -0500 Subject: [PATCH 5/7] Generalize vessel to x, y, or z axis --- openmc/model/surface_composite.py | 126 +++++++++++++++++++++--------- 1 file changed, 89 insertions(+), 37 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index f0b4e26cf68..8b73dbb752a 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -89,8 +89,8 @@ class CylinderSector(CompositeSurface): 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), (x, z), or (x, y) - basis. Defaults to (0,0). + Coordinate for central axes of cylinders in the (y, z), (x, z), 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'. @@ -118,7 +118,7 @@ def __init__(self, r2, theta1, theta2, - center=(0.,0.), + center=(0., 0.), axis='z', **kwargs): @@ -1838,43 +1838,95 @@ def __init__(self, center_base: Sequence[float], axis: Sequence[float], def __neg__(self) -> openmc.Region: return +self.plane_bottom & -self.plane_top & -self.cone -class ZVessel(CompositeSurface): - """Vessel as a composite surface parallel to z-axis - includes composite surfaces with a ZCylinder and - semi-ellipsoids on top and the bottom of this cylinder. - """ - _surface_names = ('cycl', 'zmin', 'zmax', 'bottom', 'top') +class Vessel(CompositeSurface): + """Vessel composed of cylinder with semi-ellipsoid top and bottom. - def __init__(self, x0, y0, r, zmin, zmax, hbottom, htop, **kwargs): - if zmin >= zmax: - raise ValueError('zmin must be less than zmax') + This composite surface is represented by a finite cylinder with ellipsoidal + top and bottom surfaces. This surface is equivalent to the 'vesesl' surface + in Serpent. - self.cycl = openmc.ZCylinder(x0=x0, y0=y0, r=r, **kwargs) - self.zmin = openmc.ZPlane(z0=zmin, **kwargs) - self.zmax = openmc.ZPlane(z0=zmax, **kwargs) + .. versionadded:: 0.15.1 - """ - General equation for an ellipsoid: - (x-xo)^2/r^2 + (y-yo)^2/r^2 + (z-zo)^2/h^2 = 1 - """ + Parameters + ---------- + r : float + Radius of vessel. + pmin : float + Minimum coordinate for cylindrical part of vessel. + pmax : float + Maximum coordinate for cylindrical part of vessel. + hbottom : float + Height of bottom ellipsoidal part of vessel. + htop : float + Hiehgt of top ellipsoidal part of vessel. + center : 2-tuple of float + Coordinate for central axis of the cylinder in the (y, z), (x, z), or + (x, y) basis. Defaults to (0,0). + axis : {'x', 'y', 'z'} + Central axis of the cylinder. + + """ + + _surface_names = ('cyl', 'zmin', 'zmax', 'bottom', 'top') + + def __init__(self, r: float, pmin: float, pmax: float, hbottom: float, + htop: float, center: Sequence[float] = (0., 0.), axis='z', + **kwargs): + if pmin >= pmax: + raise ValueError('pmin must be less than pmax') + + p1, p2 = center + cyl_class = getattr(openmc, f'{axis.upper()}Cylinder') + plane_class = getattr(openmc, f'{axis.upper()}Plane') + self.cyl = cyl_class(p1, p2, r, **kwargs) + self.zmin = plane_class(pmin) + self.zmax = plane_class(pmax) + + # General equation for an ellipsoid: + # (x-x₀)²/r² + (y-y₀)²/r² + (z-z₀)²/h² = 1 + # (x-x₀)² + (y-y₀)² + (z-z₀)²s² = r² + # Let s = r/h: + # (x² - 2x₀x + x₀²) + (y² - 2y₀y + y₀²) + (z² - 2z₀z + z₀²)s² = r² + # x² + y² + s²z² - 2x₀x - 2y₀y - 2s²z₀z + (x₀² + y₀² + z₀²s² - r²) = 0 + + sb = (r/hbottom) + st = (r/htop) + kwargs['a'] = kwargs['b'] = kwargs['c'] = 1.0 + kwargs_bottom = kwargs + kwargs_top = kwargs.copy() + + sb2 = sb*sb + st2 = st*st + kwargs_bottom['k'] = p1*p1 + p2*p2 + pmin*pmin*sb2 - r*r + kwargs_top['k'] = p1*p1 + p2*p2 + pmax*pmax*st2 - r*r + + if axis == 'x': + kwargs_bottom['a'] *= sb2 + kwargs_top['a'] *= st2 + kwargs_bottom['g'] = -2*pmin*sb2 + kwargs_top['g'] = -2*pmax*st2 + kwargs_top['h'] = kwargs_bottom['h'] = -2*p1 + kwargs_top['j'] = kwargs_bottom['j'] = -2*p2 + elif axis == 'y': + kwargs_bottom['b'] *= sb2 + kwargs_top['b'] *= st2 + kwargs_top['g'] = kwargs_bottom['g'] = -2*p1 + kwargs_bottom['h'] = -2*pmin*sb2 + kwargs_top['h'] = -2*pmax*st2 + kwargs_top['j'] = kwargs_bottom['j'] = -2*p2 + elif axis == 'z': + kwargs_bottom['c'] *= sb2 + kwargs_top['c'] *= st2 + kwargs_top['g'] = kwargs_bottom['g'] = -2*p1 + kwargs_top['h'] = kwargs_bottom['h'] = -2*p2 + kwargs_bottom['j'] = -2*pmin*sb2 + kwargs_top['j'] = -2*pmax*st2 + + self.bottom = openmc.Quadric(**kwargs_bottom) + self.top = openmc.Quadric(**kwargs_top) - A = 1/r**2 - B = 1/r**2 - C1 = 1/hbottom**2 - C2 = 1/htop**2 - G = -(2*x0)/r**2 - H = -(2*y0)/r**2 - J1 = -(2*zmin)/hbottom**2 - J2 = -(2*zmax)/htop**2 - K1 = x0**2/r**2 + y0**2/r**2 + zmin**2/hbottom**2 - 1 - K2 = x0**2/r**2 + y0**2/r**2 + zmax**2/htop**2 - 1 - - self.bottom = openmc.Quadric(a=A, b=B, c=C1, g=G, h=H, j=J1, k=K1, **kwargs) - self.top = openmc.Quadric(a=A, b=B, c=C2, g=G, h=H, j=J2, k=K2, **kwargs) - def __neg__(self): - return (-self.cycl & +self.zmin & -self.zmax) | (-self.bottom & -self.zmin) | (-self.top & +self.zmax) - - def __pos__(self): - return (+self.cycl | -self.zmin | +self.zmax) & (+self.bottom | +self.zmin) & (+self.top | -self.zmax) + return ((-self.cyl & +self.zmin & -self.zmax) | + (-self.bottom & -self.zmin) | + (-self.top & +self.zmax)) From 28139dd0b16f0811ae9155e5f2b87593431f1981 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Sat, 9 Nov 2024 11:11:33 -0600 Subject: [PATCH 6/7] Update argment names, add tests for Vessel --- docs/source/pythonapi/model.rst | 1 + openmc/model/surface_composite.py | 74 +++++++++++----------- tests/unit_tests/test_surface_composite.py | 56 ++++++++++------ 3 files changed, 74 insertions(+), 57 deletions(-) diff --git a/docs/source/pythonapi/model.rst b/docs/source/pythonapi/model.rst index e7d6d320f1e..3034826bddd 100644 --- a/docs/source/pythonapi/model.rst +++ b/docs/source/pythonapi/model.rst @@ -32,6 +32,7 @@ Composite Surfaces openmc.model.RectangularParallelepiped openmc.model.RectangularPrism openmc.model.RightCircularCylinder + openmc.model.Vessel openmc.model.XConeOneSided openmc.model.YConeOneSided openmc.model.ZConeOneSided diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 8b73dbb752a..be16c78d8bd 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -40,9 +40,11 @@ def boundary_type(self): def boundary_type(self, boundary_type): # Set boundary type on underlying surfaces, but not for ambiguity plane # on one-sided cones + classes = (XConeOneSided, YConeOneSided, ZConeOneSided, Vessel) for name in self._surface_names: - if name != 'plane': - getattr(self, name).boundary_type = boundary_type + if isinstance(self, classes) and name.startswith('plane'): + continue + getattr(self, name).boundary_type = boundary_type def __repr__(self): return f"<{type(self).__name__} at 0x{id(self):x}>" @@ -1852,14 +1854,14 @@ class Vessel(CompositeSurface): ---------- r : float Radius of vessel. - pmin : float + p1 : float Minimum coordinate for cylindrical part of vessel. - pmax : float + p2 : float Maximum coordinate for cylindrical part of vessel. - hbottom : float + h1 : float Height of bottom ellipsoidal part of vessel. - htop : float - Hiehgt of top ellipsoidal part of vessel. + h2 : float + Height of top ellipsoidal part of vessel. center : 2-tuple of float Coordinate for central axis of the cylinder in the (y, z), (x, z), or (x, y) basis. Defaults to (0,0). @@ -1868,20 +1870,20 @@ class Vessel(CompositeSurface): """ - _surface_names = ('cyl', 'zmin', 'zmax', 'bottom', 'top') + _surface_names = ('cyl', 'plane_bottom', 'plane_top', 'bottom', 'top') - def __init__(self, r: float, pmin: float, pmax: float, hbottom: float, - htop: float, center: Sequence[float] = (0., 0.), axis='z', - **kwargs): - if pmin >= pmax: - raise ValueError('pmin must be less than pmax') + def __init__(self, r: float, p1: float, p2: float, h1: float, h2: float, + center: Sequence[float] = (0., 0.), axis='z', **kwargs): + if p1 >= p2: + raise ValueError('p1 must be less than p2') + check_value('axis', axis, {'x', 'y', 'z'}) - p1, p2 = center + c1, c2 = center cyl_class = getattr(openmc, f'{axis.upper()}Cylinder') plane_class = getattr(openmc, f'{axis.upper()}Plane') - self.cyl = cyl_class(p1, p2, r, **kwargs) - self.zmin = plane_class(pmin) - self.zmax = plane_class(pmax) + self.cyl = cyl_class(c1, c2, r, **kwargs) + self.plane_bottom = plane_class(p1) + self.plane_top = plane_class(p2) # General equation for an ellipsoid: # (x-x₀)²/r² + (y-y₀)²/r² + (z-z₀)²/h² = 1 @@ -1890,43 +1892,43 @@ def __init__(self, r: float, pmin: float, pmax: float, hbottom: float, # (x² - 2x₀x + x₀²) + (y² - 2y₀y + y₀²) + (z² - 2z₀z + z₀²)s² = r² # x² + y² + s²z² - 2x₀x - 2y₀y - 2s²z₀z + (x₀² + y₀² + z₀²s² - r²) = 0 - sb = (r/hbottom) - st = (r/htop) + sb = (r/h1) + st = (r/h2) kwargs['a'] = kwargs['b'] = kwargs['c'] = 1.0 kwargs_bottom = kwargs kwargs_top = kwargs.copy() sb2 = sb*sb st2 = st*st - kwargs_bottom['k'] = p1*p1 + p2*p2 + pmin*pmin*sb2 - r*r - kwargs_top['k'] = p1*p1 + p2*p2 + pmax*pmax*st2 - r*r + kwargs_bottom['k'] = c1*c1 + c2*c2 + p1*p1*sb2 - r*r + kwargs_top['k'] = c1*c1 + c2*c2 + p2*p2*st2 - r*r if axis == 'x': kwargs_bottom['a'] *= sb2 kwargs_top['a'] *= st2 - kwargs_bottom['g'] = -2*pmin*sb2 - kwargs_top['g'] = -2*pmax*st2 - kwargs_top['h'] = kwargs_bottom['h'] = -2*p1 - kwargs_top['j'] = kwargs_bottom['j'] = -2*p2 + kwargs_bottom['g'] = -2*p1*sb2 + kwargs_top['g'] = -2*p2*st2 + kwargs_top['h'] = kwargs_bottom['h'] = -2*c1 + kwargs_top['j'] = kwargs_bottom['j'] = -2*c2 elif axis == 'y': kwargs_bottom['b'] *= sb2 kwargs_top['b'] *= st2 - kwargs_top['g'] = kwargs_bottom['g'] = -2*p1 - kwargs_bottom['h'] = -2*pmin*sb2 - kwargs_top['h'] = -2*pmax*st2 - kwargs_top['j'] = kwargs_bottom['j'] = -2*p2 + kwargs_top['g'] = kwargs_bottom['g'] = -2*c1 + kwargs_bottom['h'] = -2*p1*sb2 + kwargs_top['h'] = -2*p2*st2 + kwargs_top['j'] = kwargs_bottom['j'] = -2*c2 elif axis == 'z': kwargs_bottom['c'] *= sb2 kwargs_top['c'] *= st2 - kwargs_top['g'] = kwargs_bottom['g'] = -2*p1 - kwargs_top['h'] = kwargs_bottom['h'] = -2*p2 - kwargs_bottom['j'] = -2*pmin*sb2 - kwargs_top['j'] = -2*pmax*st2 + kwargs_top['g'] = kwargs_bottom['g'] = -2*c1 + kwargs_top['h'] = kwargs_bottom['h'] = -2*c2 + kwargs_bottom['j'] = -2*p1*sb2 + kwargs_top['j'] = -2*p2*st2 self.bottom = openmc.Quadric(**kwargs_bottom) self.top = openmc.Quadric(**kwargs_top) def __neg__(self): - return ((-self.cyl & +self.zmin & -self.zmax) | - (-self.bottom & -self.zmin) | - (-self.top & +self.zmax)) + return ((-self.cyl & +self.plane_bottom & -self.plane_top) | + (-self.bottom & -self.plane_bottom) | + (-self.top & +self.plane_top)) diff --git a/tests/unit_tests/test_surface_composite.py b/tests/unit_tests/test_surface_composite.py index 8a6cdf66dfe..5504b1c52d5 100644 --- a/tests/unit_tests/test_surface_composite.py +++ b/tests/unit_tests/test_surface_composite.py @@ -597,37 +597,51 @@ def test_conical_frustum(): s = openmc.model.ConicalFrustum(center_base, axis, r1, r1) assert (1., 1., -0.01) in -s -def test_ZVessel(): - x0 = 3.0 - y0 = 3.0 - r = 10.0 - zmin = 5.0 - zmax = 30.0 - hbottom = 4.0 - htop = 4.0 - s = openmc.model.ZVessel(x0, y0, r, zmin, zmax, bottom, htop) - assert isinstance(s.cycl, openmc.ZCylinder) - assert isinstance(s.zmin, openmc.ZPlane) - assert isinstance(s.zmax, openmc.ZPlane) + +def test_vessel(): + center = (3.0, 2.0) + r = 1.0 + p1, p2 = -5.0, 5.0 + h1 = h2 = 1.0 + s = openmc.model.Vessel(r, p1, p2, h1, h2, center) + assert isinstance(s.cyl, openmc.Cylinder) + assert isinstance(s.plane_bottom, openmc.Plane) + assert isinstance(s.plane_top, openmc.Plane) assert isinstance(s.bottom, openmc.Quadric) assert isinstance(s.top, openmc.Quadric) - # Make sure boundary condition propagates + # Make sure boundary condition propagates (but not for planes) s.boundary_type = 'reflective' assert s.boundary_type == 'reflective' - assert s.cycl.boundary_type == 'reflective' + assert s.cyl.boundary_type == 'reflective' assert s.bottom.boundary_type == 'reflective' assert s.top.boundary_type == 'reflective' + assert s.plane_bottom.boundary_type == 'transmission' + assert s.plane_top.boundary_type == 'transmission' + + # 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 np.all(np.isinf(ll)) + assert np.all(np.isinf(ur)) # __contains__ on associated half-spaces - assert (-6.0, 4.0, 32.0) in +s - assert (-6.0, 4.0, 32.0) not in -s - assert (-2.0, 4.0, 32.0) in -s - assert (-2.0, 4.0, 32.0) not in +s + assert (3., 2., 0.) in -s + assert (3., 2., -5.0) in -s + assert (3., 2., 5.0) in -s + assert (3., 2., -5.9) in -s + assert (3., 2., 5.9) in -s + assert (3., 2., -6.1) not in -s + assert (3., 2., 6.1) not in -s + assert (4.5, 2., 0.) in +s + assert (3., 3.2, 0.) in +s + assert (3., 2., 7.) in +s # translate method - s_t = s.translate((1., 1., 0.)) - assert (-3.3, -2.5, 32.) in +s_t - + s_t = s.translate((0., 0., 1.)) + assert (3., 2., 6.1) in -s_t + # Make sure repr works repr(s) From 79dd4427da0964d99cb64ff2f683121c31443a49 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Sat, 9 Nov 2024 17:29:08 -0600 Subject: [PATCH 7/7] Add missing type hint --- 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 be16c78d8bd..e9458f70658 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -1873,7 +1873,7 @@ class Vessel(CompositeSurface): _surface_names = ('cyl', 'plane_bottom', 'plane_top', 'bottom', 'top') def __init__(self, r: float, p1: float, p2: float, h1: float, h2: float, - center: Sequence[float] = (0., 0.), axis='z', **kwargs): + center: Sequence[float] = (0., 0.), axis: str = 'z', **kwargs): if p1 >= p2: raise ValueError('p1 must be less than p2') check_value('axis', axis, {'x', 'y', 'z'})