Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon composite surface #2266

Merged
merged 15 commits into from
Nov 10, 2022
Merged

Conversation

eepeterson
Copy link
Contributor

@eepeterson eepeterson commented Oct 15, 2022

This PR is the addition of a CompositeSurface class for a generalized 2D polygon defined by a series of points, assumed to be connected by linear segments and closed. Essentially this class acts like any other surface and obeys the CompositeSurface protocol. It decomposes any polygon into a set of convex shapes, the union of which is the negative halfspace of the polygon and the complement of the union is the positive half space. You can also easily offset the polygon to form nested regions using the openmc.model.subdivide function. The following couple plots show the output of code similar to the following

polygon = openmc.model.Polygon(rz_points, basis='xz')
p1 = polygon.offset(2)
p2 = polygon.offset(4)
p3 = polygon.offset(6)
p4 = polygon.offset(7)
p5 = polygon.offset(10)
p5.boundary_type = 'vacuum'
regions = openmc.model.subdivide([polygon, p1, p2, p3, p4, p5])
cells = [openmc.Cell(region=r) for r in regions]
geom = openmc.Geometry(cells)
geom.export_to_xml(remove_surfs=True)

Nested vacuum vessel defined by a series of RZ points
full_figure

Zoomed in version of the above
zoomed_figure

Decomposition of polygon into convex subsets
regions

There's still a little clean up that needs to happen and tests to write before this is really ready.

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really cool new feature @eepeterson! Just a few small comments:

openmc/model/surface_composite.py Outdated Show resolved Hide resolved
openmc/model/surface_composite.py Show resolved Hide resolved
openmc/model/surface_composite.py Outdated Show resolved Hide resolved
openmc/model/surface_composite.py Outdated Show resolved Hide resolved
openmc/model/surface_composite.py Outdated Show resolved Hide resolved
openmc/model/surface_composite.py Outdated Show resolved Hide resolved
openmc/model/surface_composite.py Show resolved Hide resolved
openmc/model/surface_composite.py Show resolved Hide resolved
tests/unit_tests/test_surface_composite.py Outdated Show resolved Hide resolved
tests/unit_tests/test_surface_composite.py Outdated Show resolved Hide resolved
@paulromano
Copy link
Contributor

@eepeterson There's just a few more comments to address and then this should be good to merge. Thanks for the updates!

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

@paulromano paulromano merged commit 7d824ce into openmc-dev:develop Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants