Ensure that two surfaces with different boundary type are not considered redundant (#2942)

This commit is contained in:
Paul Romano 2024-04-11 15:00:41 +02:00 committed by GitHub
parent 569c087597
commit 256150f567
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -701,7 +701,7 @@ class Geometry:
coeffs = tuple(round(surf._coefficients[k],
self.surface_precision)
for k in surf._coeff_keys)
key = (surf._type,) + coeffs
key = (surf._type, surf._boundary_type) + coeffs
redundancies[key].append(surf)
redundant_surfaces = {replace.id: keep

View file

@ -390,3 +390,16 @@ def test_get_all_nuclides():
c2 = openmc.Cell(fill=m2, region=+s)
geom = openmc.Geometry([c1, c2])
assert geom.get_all_nuclides() == ['Be9', 'Fe56']
def test_redundant_surfaces():
# Make sure boundary condition is accounted for
s1 = openmc.Sphere(r=5.0)
s2 = openmc.Sphere(r=5.0, boundary_type="vacuum")
c1 = openmc.Cell(region=-s1)
c2 = openmc.Cell(region=+s1)
u_lower = openmc.Universe(cells=[c1, c2])
c3 = openmc.Cell(fill=u_lower, region=-s2)
geom = openmc.Geometry([c3])
redundant_surfs = geom.remove_redundant_surfaces()
assert len(redundant_surfs) == 0