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.
Thoughts?
import matplotlib
import openmc
#inconel
inconel = openmc.Material(name='metal',temperature=977.5944)
inconel.add_element('Ni',78.5,percent_type='wo')
inconel.add_element('Cr',14.0,percent_type='wo')
inconel.add_element('Fe',6.5,percent_type='wo')
inconel.add_element('Mn',0.25,percent_type='wo')
inconel.add_element('Si',0.25,percent_type='wo')
inconel.add_element('Cu',0.2,percent_type='wo')
inconel.add_element('Co',0.2,percent_type='wo')
inconel.add_element('Al',0.2,percent_type='wo')
inconel.add_element('Ti',0.2,percent_type='wo')
inconel.add_element('Ta',0.5,percent_type='wo')
inconel.add_element('W',0.5,percent_type='wo')
inconel.add_element('Zn',0.2,percent_type='wo')
inconel.add_element('Zr',0.1,percent_type='wo')
inconel.add_element('C',0.08,percent_type='wo')
inconel.set_density('g/cm3',8.5)
mats = openmc.Materials([inconel])
mats.export_to_xml()
dag_univ = openmc.DAGMCUniverse('metal.h5m')
geom = openmc.Geometry(root=dag_univ)
geom.export_to_xml()
#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'
plots.append(p2)
plots.append(p3)
plots.export_to_xml()
openmc.plot_geometry()