DagMC Geometry - Incorrect part shape

Tagging @pshriwise & @Shimwell as you were both helpful in my previous thread on dagmc geometry (DagMC Geometry - "Open MC aborted unexpectedly"), but question is open to all.

I am using the DagMC toolchain to run simulations using CAD-based geometry and there is one particular part in my model that is either not being generated correctly by cubit/DagMC or is not being plotted correctly by OpenMC. Below are screenshots of a section view of the xz and yz planes in onshape, compared with those plotted by OpenMC:

xz onshape:

xz openmc:

yz onshape:

yz openmc:

As you can see, some areas that should be void are filled in as metal, and others that should be metal are void. I used high resolution in the OpenMC plots above (code below). I am using a 1.0e-4 faceting tolerance in cubit, and I believe OpenMC uses the same as what is used in the .h5m file that it’s given.

What I have tried:

  • Increasing faceting tolerance. This hasn’t helped, but starts to crash the program at 1.0e-6 – so I guess this can’t be completely ruled out, but it doesn’t seem to be the issue
  • Looking for issues in the cad model, i.e. overlapping volumes. I’ve inspected all of the edges that are flush with each other in the assembly, and all the connections in this part itself and have not found any issues. An overlapping volume is normally not hard to spot in onshape as it gets highlighted in red.

I was thinking of trying to break the volume into smaller pieces, but ideally I’d like to avoid this. The part represents geometry of the same material that is all touching, so for workflow purposes it is best if it can be imported as one part.


import matplotlib
import openmc

inconel = openmc.Material(name='metal',temperature=977.5944)

mats = openmc.Materials([inconel])

dag_univ = openmc.DAGMCUniverse('metal.h5m')
geom = openmc.Geometry(root=dag_univ)

#plotting geometry
plots = openmc.Plots()

#xz plot
p2 = openmc.Plot()
p2.origin = (0, 0, 50)
p2.basis = 'xz'
p2.width = (400, 400)
p2.pixels = (8000, 8000)
p2.color_by = 'material'

#yz plot
p3 = openmc.Plot()
p3.origin = (0,0,50)
p3.basis = 'yz'
p3.width = (400, 400)
p3.pixels = (8000, 8000)
p3.color_by = 'material'



Just wondering if it possible to share the stp files that make the h5m geometry

Sure, although it’s not letting me upload a step file here.

Here is a link to the part studio: Onshape

I can share it some other way if you prefer.

Ah it looks like a login $$$ is needed for Onshape and chance you could share the stp files via another method. Perhaps a Git repo if you are super keen

This repo contains (for now) just the .step file from the code sample above

This is quite a complex for a single solid. I wonder if some of the surface normals got have confused in the process and end up flipping the “inside” and “outside”. I would recommend splitting the geometry up into much smaller components and gradually building up to something this detailed one component at a time.

Confirming that splitting it up indeed solved the problem. Thanks again Jonathan!