Skip to content

Commit

Permalink
Add RectangularPrism and HexagonalPrism composite surfaces (#2739)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
  • Loading branch information
paulromano and pshriwise committed Nov 1, 2023
1 parent 94f02ae commit ac941f7
Show file tree
Hide file tree
Showing 36 changed files with 425 additions and 403 deletions.
4 changes: 2 additions & 2 deletions docs/source/pythonapi/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Convenience Functions
:template: myfunction.rst

openmc.model.borated_water
openmc.model.hexagonal_prism
openmc.model.rectangular_prism
openmc.model.subdivide
openmc.model.pin

Expand All @@ -26,9 +24,11 @@ Composite Surfaces

openmc.model.CruciformPrism
openmc.model.CylinderSector
openmc.model.HexagonalPrism
openmc.model.IsogonalOctagon
openmc.model.Polygon
openmc.model.RectangularParallelepiped
openmc.model.RectangularPrism
openmc.model.RightCircularCylinder
openmc.model.XConeOneSided
openmc.model.YConeOneSided
Expand Down
13 changes: 7 additions & 6 deletions docs/source/usersguide/geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@ For many regions, a bounding-box can be determined automatically::
While a bounding box can be determined for regions involving half-spaces of
spheres, cylinders, and axis-aligned planes, it generally cannot be determined
if the region involves cones, non-axis-aligned planes, or other exotic
second-order surfaces. For example, the :func:`openmc.model.hexagonal_prism`
function returns the interior region of a hexagonal prism; because it is bounded
by a :class:`openmc.Plane`, trying to get its bounding box won't work::
second-order surfaces. For example, the :class:`openmc.model.HexagonalPrism`
class returns a hexagonal prism surface; because it utilizes a
:class:`openmc.Plane`, trying to get the bounding box of its interior won't
work::

>>> hex = openmc.model.hexagonal_prism()
>>> hex.bounding_box
>>> hex = openmc.model.HexagonalPrism()
>>> (-hex).bounding_box
(array([-0.8660254, -inf, -inf]),
array([ 0.8660254, inf, inf]))

Expand Down Expand Up @@ -428,7 +429,7 @@ code would work::
hexlat.universes = [outer_ring, middle_ring, inner_ring]

If you need to create a hexagonal boundary (composed of six planar surfaces) for
a hexagonal lattice, :func:`openmc.model.hexagonal_prism` can be used.
a hexagonal lattice, :class:`openmc.model.HexagonalPrism` can be used.

.. _usersguide_geom_export:

Expand Down
4 changes: 2 additions & 2 deletions examples/assembly/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ def assembly_model():
assembly.universes[gt_pos[:, 0], gt_pos[:, 1]] = guide_tube_pin()

# Create outer boundary of the geometry to surround the lattice
outer_boundary = openmc.model.rectangular_prism(
outer_boundary = openmc.model.RectangularPrism(
pitch, pitch, boundary_type='reflective')

# Create a cell filled with the lattice
main_cell = openmc.Cell(fill=assembly, region=outer_boundary)
main_cell = openmc.Cell(fill=assembly, region=-outer_boundary)

# Finally, create geometry by providing a list of cells that fill the root
# universe
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_source/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
mats.export_to_xml()

# Create a 5 cm x 5 cm box filled with iron
box = openmc.model.rectangular_prism(10.0, 10.0, boundary_type='vacuum')
cell = openmc.Cell(fill=iron, region=box)
box = openmc.model.RectangularPrism(10.0, 10.0, boundary_type='vacuum')
cell = openmc.Cell(fill=iron, region=-box)
geometry = openmc.Geometry([cell])
geometry.export_to_xml()

Expand Down
4 changes: 2 additions & 2 deletions examples/parameterized_custom_source/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
mats.export_to_xml()

# Create a 5 cm x 5 cm box filled with iron
box = openmc.model.rectangular_prism(10.0, 10.0, boundary_type='vacuum')
cell = openmc.Cell(fill=iron, region=box)
box = openmc.model.RectangularPrism(10.0, 10.0, boundary_type='vacuum')
cell = openmc.Cell(fill=iron, region=-box)
geometry = openmc.Geometry([cell])
geometry.export_to_xml()

Expand Down
4 changes: 2 additions & 2 deletions examples/pincell/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@

# Create a region represented as the inside of a rectangular prism
pitch = 1.25984
box = openmc.rectangular_prism(pitch, pitch, boundary_type='reflective')
box = openmc.model.RectangularPrism(pitch, pitch, boundary_type='reflective')

# Create cells, mapping materials to regions
fuel = openmc.Cell(fill=uo2, region=-fuel_or)
gap = openmc.Cell(fill=helium, region=+fuel_or & -clad_ir)
clad = openmc.Cell(fill=zircaloy, region=+clad_ir & -clad_or)
water = openmc.Cell(fill=borated_water, region=+clad_or & box)
water = openmc.Cell(fill=borated_water, region=+clad_or & -box)

# Create a geometry and export to XML
geometry = openmc.Geometry([fuel, gap, clad, water])
Expand Down
4 changes: 2 additions & 2 deletions examples/pincell_depletion/run_depletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
fuel_or = openmc.ZCylinder(r=0.39218, name='Fuel OR')
clad_ir = openmc.ZCylinder(r=0.40005, name='Clad IR')
clad_or = openmc.ZCylinder(r=0.45720, name='Clad OR')
box = openmc.model.rectangular_prism(pitch, pitch, boundary_type='reflective')
box = openmc.model.RectangularPrism(pitch, pitch, boundary_type='reflective')

# Define cells
fuel = openmc.Cell(fill=uo2, region=-fuel_or)
gap = openmc.Cell(fill=helium, region=+fuel_or & -clad_ir)
clad = openmc.Cell(fill=zircaloy, region=+clad_ir & -clad_or)
water = openmc.Cell(fill=borated_water, region=+clad_or & box)
water = openmc.Cell(fill=borated_water, region=+clad_or & -box)

# Define overall geometry
geometry = openmc.Geometry([fuel, gap, clad, water])
Expand Down
4 changes: 2 additions & 2 deletions examples/pincell_multigroup/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@

# Create a region represented as the inside of a rectangular prism
pitch = 1.26
box = openmc.rectangular_prism(pitch, pitch, boundary_type='reflective')
box = openmc.model.RectangularPrism(pitch, pitch, boundary_type='reflective')

# Instantiate Cells
fuel = openmc.Cell(fill=uo2, region=-fuel_or, name='fuel')
moderator = openmc.Cell(fill=water, region=+fuel_or & box, name='moderator')
moderator = openmc.Cell(fill=water, region=+fuel_or & -box, name='moderator')

# Create a geometry with the two cells and export to XML
geometry = openmc.Geometry([fuel, moderator])
Expand Down
2 changes: 1 addition & 1 deletion openmc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from .config import *

# Import a few names from the model module
from openmc.model import rectangular_prism, hexagonal_prism, Model
from openmc.model import Model


__version__ = '0.14.0-dev'

0 comments on commit ac941f7

Please sign in to comment.