OpenMC 'aborts unexpectedly' when plotting

Hi @srichr221, here you go!

First, I create the cells and whatnot in my first universe. This is only one of a few cells I have, so this doesn’t define the entire universe, but it gives you an idea of how I create it.

Geometry for Beryllium Reflector (Source)

innerCylinder = openmc.ZCylinder(x0=-45, y0=0, r=25, boundary_type=‘transmission’, name=‘InnerCylinder’)
outerCylinder = openmc.ZCylinder(x0=-45, y0=0, r=35, boundary_type=‘transmission’, name=‘OuterCylinder’)

topOuter = openmc.ZPlane(z0=55, boundary_type=‘transmission’, name=‘topOuter’) #p1
topInner = openmc.ZPlane(z0=25, boundary_type=‘transmission’, name=‘topInner’) #p2
bottomInner = openmc.ZPlane(z0=-25, boundary_type=‘transmission’, name=‘bottomInner’) #p3
bottomOuter = openmc.ZPlane(z0=-55, boundary_type=‘transmission’, name=‘bottomOuter’) # p4

reflectorSideRegion = +innerCylinder & -outerCylinder & -topInner & +bottomInner

reflectorTopRegion = -outerCylinder & -topOuter & +topInner

reflectorBottomRegion = -outerCylinder & -bottomInner & +bottomOuter

totalReflectorRegion = reflectorSideRegion | reflectorTopRegion | reflectorBottomRegion

internalSourceVoidRegion = -innerCylinder & -topInner & +bottomInner

reflectorCell = openmc.Cell(region=totalReflectorRegion, fill=reflectorMat)

voidSourceCell = openmc.Cell(region=internalSourceVoidRegion)

universe.add_cell(reflectorCell)
universe.add_cell(voidSourceCell)

Next, I create my root cell, but not yet my root universe

OpenMC requires a “root” universe. Create “root cell” for root universe

root_cell = openmc.Cell(name=‘root cell’)
root_cell.fill = universe

Then, I assign an overarching region to my root cell. In this case, the back and far planes are the “kill” planes where anything that goes past them are just destroyed or leaked. Right now, my geometry is only bound in the x-direction. If you wanted it bound in more then you’d obviously have to further define your region

Assign root cell region

root_cell.region = +back_plane & -far_plane

Now I create my root universe, which only contains one cell, the root cell

Create root universe

root_universe = openmc.Universe(universe_id=0, name=‘root universe’)
root_universe.add_cell(root_cell)

You’ll also need to add a cell that’s everything NOT in your root cell

Create empty cell

not_root_cell = openmc.Cell(name=‘notInUniverse’)
not_root_cell.region = -back_plane & +far_plane
root_universe.add_cell(not_root_cell)

Then, I create my geometry and geometry.xml file (technically I don’t think you need to do this in order for the plot to work, I just have it next in my code)

Create geometry and include root universe

geometry = openmc.Geometry(root_universe)

Export to a geometry.xml file

geometry.export_to_xml()

Finally, I plot the root universe.

Plotting root universe

root_universe.plot(basis=‘xz’, color_by=‘material’, width=(200., 200.),
pixels=(500, 500), origin=(-25,0,0), colors={reflectorMat: 'blue’})

Hope this helps!

1 Like