# Dagmc.h5m set boundary

**URL:** <https://openmc.discourse.group/t/dagmc-h5m-set-boundary/2487>\
**Category:** User Support\
**Created:** [November 18, 2022, 2:35am UTC](https://openmc.discourse.group/t/dagmc-h5m-set-boundary/2487 "2022-11-18T02:35:42Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Shimwell](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shimwell/32/3876_2.png) [@Shimwell](https://openmc.discourse.group/u/Shimwell)\
**Post date:** [November 18, 2022, 8:53pm UTC](https://openmc.discourse.group/t/dagmc-h5m-set-boundary/2487/3 "2022-11-18T20:53:18Z")

</div>

Great to see a few package being useful. I never know if anyone uses these things I throw out on github but great to see vertices-to-h5m and dagmc-file-inspector being useful.

I think Jiankai has solved it but I just wanted to add that there is a auto bounding option as well.

Traditionally DAGMC geometry was made with a hollow cube surrounding the geometry which had the material tag graveyard assigned to it. This acted as the vacuum boundary and killed particles when they got to this outer volume. This functionality is still supported so you could make another set of triangles to encompass your geometry.

More recently openmc was able to contain a graveyard free dagmc geometry in a cage surface like Jiankai example above. This makes visualization easier as there is no large encompassing dagmc volume.

Really recently we added this pull request which simplifies things further

> <https://github.com/openmc-dev/openmc/pull/2118>
>
> As discussed with @pshriwise in issue #2104 and building on the work from PR #21…11 this is another small PR that adds the ability to automatically generate a bounding region around a DAGMC geometry.
> 
> This adds the \`\`\`DAGMCUniverse.bounding\_region()\`\`\` method
> 
> This would be useful for creating a spherical or box shaped vacuum surface to bound the DAGMC geometry or other uses (boundary type is user controllable)
> 
> This is based on some code from another micro package I made a while back :recycle: \[here\](https://github.com/fusion-energy/openmc-dagmc-wrapper/blob/9c4485d4f40e7df2bac5333be68fe6d4e0caa570/openmc\_dagmc\_wrapper/Geometry.py#L114-L153) and \[here\](https://github.com/fusion-energy/openmc-dagmc-wrapper/blob/9c4485d4f40e7df2bac5333be68fe6d4e0caa570/openmc\_dagmc\_wrapper/Geometry.py#L50-L55)
> 
> I've added some simple tests to the DAGMC universe test and type checking
> 
> 
> Current method of bringing a graveyard free DAGMC geometry file into to OpenMC
> \`\`\`python
> \# makes use of the dagmc geometry
> dag\_univ = openmc.DAGMCUniverse("dagmc.h5m")
> 
> \# creates an edge of universe boundary at a large radius
> vac\_surf = openmc.Sphere(r=10000, surface\_id=9999, boundary\_type="vacuum")
> 
> \# specifies the region as below the universe boundary
> region = -vac\_surf
> 
> \# creates a cell from the region and fills the cell with the dagmc geometry
> containing\_cell = openmc.Cell(cell\_id=9999, region=region, fill=dag\_univ)
> 
> model = openmc.Model()
> model.geometry = openmc.Geometry(root=\[containing\_cell\])
> \`\`\`
> 
> 
> method possible with this PR of bringing a DAGMC geometry file into to OpenMC
> \`\`\`python
> \# loads up dagmc file and automatically bounds the geometry with a vacuum surface
> bound\_dag\_univ= openmc.DAGMCUniverse("dagmc.h5m").bounded\_universe()
> 
> model = openmc.Model()
> model.geometry = openmc.Geometry(root=bound\_dag\_univ)
> \`\`\`

This allows combined universe to be made in one line

```python
dagunv = openmc.DAGMCUniverse("dagmc.h5m").bounded_universe()

```

---

_[View the full topic](https://openmc.discourse.group/t/dagmc-h5m-set-boundary/2487)._
