From 2283e08fdcccbc4b2f49f6fc212f2d424fb419b7 Mon Sep 17 00:00:00 2001 From: Ethan Peterson Date: Thu, 10 Nov 2022 13:00:11 -0500 Subject: [PATCH] add abs_tol to prevent cones with infinite or 0 slope --- openmc/model/surface_composite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py index 5d1553a38..002fad9d9 100644 --- a/openmc/model/surface_composite.py +++ b/openmc/model/surface_composite.py @@ -849,7 +849,7 @@ class Polygon(CompositeSurface): facet_eq = np.array([dx, dy, c]) on_boundary = any([np.allclose(facet_eq, eq) for eq in boundary_eqns]) # Check if the facet is horizontal - if isclose(dx, 0): + if isclose(dx, 0, abs_tol=1e-8): if basis in ('xz', 'yz', 'rz'): surf = openmc.ZPlane(z0=-c/dy) else: @@ -857,7 +857,7 @@ class Polygon(CompositeSurface): # if (0, 1).(dx, dy) < 0 we want positive halfspace instead op = operator.pos if dy < 0 else operator.neg # Check if the facet is vertical - elif isclose(dy, 0): + elif isclose(dy, 0, abs_tol=1e-8): if basis in ('xy', 'xz'): surf = openmc.XPlane(x0=-c/dx) elif basis == 'yz':