# DAGMC Geometry Assitance

**URL:** <https://openmc.discourse.group/t/dagmc-geometry-assitance/2676>\
**Category:** User Support\
**Created:** [February 2, 2023, 8:34pm UTC](https://openmc.discourse.group/t/dagmc-geometry-assitance/2676 "2023-02-02T20:34:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnthonyB08](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@AnthonyB08](https://openmc.discourse.group/u/AnthonyB08)\
**Post date:** [February 2, 2023, 8:34pm UTC](https://openmc.discourse.group/t/dagmc-geometry-assitance/2676/1 "2023-02-02T20:34:00Z")

</div>

Hi all, (me again)

I am looking for assistance in creating a custom geometry using Cubit Coreform. I have some experience in meshing and geometry domains, but I struggle to incorporate them into openmc. Below, I share a simple cartesian slab with its respective mesh.

 ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/b/bc3e41d9acefc6f3afb90e4c661a786aa5e40944.png)

In the DAGMC documentation, it was recommended that Cubit , which I assume Cubit Coreform, is used for HDF5 file exportation. I created this slab and was met with Cubit not supporting export dagmc \<file.h5m\>". So instead I exported the geometry in .stl and did a conversion to h5m file.

# Convert Stl to H5M

!mbconvert \<file.stl\> \<file.h5m\>

From then on , I interpreted the files into openmc as followed :

# Import Mesh and Geometry

mesh\_library = ‘moab’ # change to ‘libmesh’ to use libMesh instead  
mesh\_file = ‘Testing.h5m’ # Import h5m files (mesh)

umesh = openmc.UnstructuredMesh(mesh\_file, library=mesh\_library)  
mesh\_filter = openmc.MeshFilter(umesh)

# Create DAGMC universes out of h5m files

PlanarF = openmc.DAGMCUniverse(filename=mesh\_file).bounded\_universe()  
#, auto\_geom\_ids=True, universe\_id=1)

# Create regions

#Fuel\_region = PlanarF.bounding\_region()  
#Fuel\_region = PlanarF.bounding\_region(bounded\_type=‘box’, boundary\_type=‘vacuum’, starting\_id=20000)

# Create openmc Cells

#Fuel\_cell = openmc.Cell(region=Fuel\_region , fill=PlanarF)

# Create openmc Geometry object

#geometry = openmc.Geometry([Fuel\_cell,])  
geometry = openmc.Geometry(root=PlanarF)  
geometry.export\_to\_xml()

# Geometry output

Then when I ! cat the geometry I get  
geometry  
cell fill=“1” id=“1” region=“1 -2 3 -4 5 -6” universe=“2”  
dagmc\_universe auto\_geom\_ids=“true” filename=“PlanarFuel.h5m” id=“1”  
surface boundary=“vacuum” coeffs=“-0.20000000298023224” id=“1” type=“x-plane”  
surface boundary=“vacuum” coeffs=“0.20000000298023224” id=“2” type=“x-plane”  
surface boundary=“vacuum” coeffs=“-0.20000000298023224” id=“3” type=“y-plane”  
surface boundary=“vacuum” coeffs=“0.20000000298023224” id=“4” type=“y-plane”  
surface boundary=“vacuum” coeffs=“0.0” id=“5” type=“z-plane” /\>  
surface boundary=“vacuum” coeffs=“0.0” id=“6” type=“z-plane” /\>  
geometry

Then when I run openmc() it cannot find my source term which is written as :  
point = openmc.stats.Point((0, 0, 0))  
src = openmc.Source(space=point,energy=energy\_distribution)  
settings.source = src  
settings.export\_to\_xml()

# Error :

ERROR: More than 95% of external source sites sampled were rejected. Please check your external source’s spatial definition.

Based off the geometry.xml output I am assuming cells were not created in the mesh, because the point (0,0,0) should exist since it is the center.

I apologize if this explanation is difficult to understand and if I am posting to many issues for support. I am highly interested in coupling the results of openmc with ansys fluent for MSR work. If their is any examples/readings of people explaining how to create and import custom geometries that would be fantastic

---

<div class="post-metadata">

**Author:** ![makeclean](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@makeclean](https://openmc.discourse.group/u/makeclean)\
**Post date:** [February 3, 2023, 11:57am UTC](https://openmc.discourse.group/t/dagmc-geometry-assitance/2676/2 "2023-02-03T11:57:49Z")

</div>

I don’t believe that route will work. You will need to download the DAGMC plugin for Cubit - [Release v0.2.4 · svalinn/Cubit-plugin · GitHub](https://github.com/svalinn/Cubit-plugin/releases/tag/v0.2.4). Its likely you do not have the correct topology setup from the STL file - another route (if you can stomach conda) is [stl-to-h5m · PyPI](https://pypi.org/project/stl-to-h5m/). This should give you a route to a working geometry, however I would recommend going for the plugin if you plan on doing large complex assemblies. For simpler non-coincident geometry the stl-to-h5m route should do the job great 🙂

---

<div class="post-metadata">

**Author:** ![AnthonyB08](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@AnthonyB08](https://openmc.discourse.group/u/AnthonyB08)\
**Post date:** [February 3, 2023, 4:33pm UTC](https://openmc.discourse.group/t/dagmc-geometry-assitance/2676/3 "2023-02-03T16:33:13Z")

</div>

@makeclean Thank you very much, this is a good link and I love your username, haha!
