neutronics-workshop
neutronics-workshop copied to clipboard
polygon example
import openmc
import matplotlib.pyplot as plt
height = 20
width = 30
thickness = 2
center_x=100
center_z=0
surface_1 = openmc.model.Polygon(
points= [
(10,10),
(7,13),
(5,10),
(7,5),
],
basis='rz'
)
# offsetting is very useful when the geometry is not on the central axis
surface_2 = surface_1.offset(1)
region_1 = -surface_1
region_2 = +surface_1 & -surface_2
cell_1 = openmc.Cell(region=region_1)
cell_2 = openmc.Cell(region=region_2)
universe = openmc.Universe(cells=[cell_1, cell_2])
print(universe.bounding_box)
# set width and origin as bounding box can't be automatically found for polyline
universe.plot(width=(25,20),basis='xz', origin=(0,0,10))
plt.show()