Geometry debugging: overlapping cells

Hello everyone,

I am facing an issue while implementing a relatively complex geometry in OpenMC, and I would appreciate some guidance. Conceptually, I am trying to model a detector volume embedded in air, so I expect the air cell to be defined as the room volume minus all embedded objects.

I have defined all surfaces and cells, but when running openmc.run(geometry_debug=True), I get an error indicating that two cells are overlapping. For simplicity, I will refer to them as cell_air_up and cell_detector. Both cells are filled with air. The geometry is such that cell_detector is a simple sphere, and it is entirely contained within cell_air_up.

The geometry structure is the following:

I define an inner universe:

u_inner = openmc.Universe(cells=[cell_detector, # other cells…])

The upper room volume is defined as:

room_up = openmc.model.RectangularParallelepiped(

-140.05, 199.95,

-905, 350,

-344, 332

)

I then build a combined region of all solid objects:

solids_up = ( cell_detector, # other cells…)

solidup_region = solids_up[0].region

for cell in solids_up[1:]:

solidup_region |= cell.region

The air in the room is defined as:

cell_air_up = openmc.Cell(

name=“Air in room (upper part)”,

fill=air,

region=-room_up & ~solidup_region

)

u_inner.add_cell(cell_air_up)

The bounding structure is then defined:

cell_boundary = openmc.Cell(

name=“Boundary”,

fill=u_inner,

region=(

+xmin & -xmax &

+ymin & -ymax &

+zmin & -zmax

)

)

I also define an external air region:

outer_region = (

+xmin & -xmax &

+ymin & -ymax &

+zmin & -zmax

)

structure_region = ( -room_up # | other structures… )

cell_outside = openmc.Cell(

name=“Outside air”,

fill=air,

region=outer_region & ~structure_region

)

u_inner.add_cell(cell_outside)

Finally:

u_root = openmc.Universe(cells=[cell_boundary])

geometry = openmc.Geometry(u_root)

Despite explicitly subtracting solidup_region from cell_air_up, OpenMC still reports an overlap between cell_air_up and cell_detector.

Any suggestions on how to resolve this overlap issue (or best practices for structuring such geometries) would be greatly appreciated.

Thank you in advance!

Giorgia