openmc-dev / openmc

OpenMC Monte Carlo Code
https://docs.openmc.org
Other
771 stars 496 forks source link

feature request: DAGMCUniverse.find() #2322

Open shimwell opened 1 year ago

shimwell commented 1 year ago

Hi all

I am building some sampling scripts that find the material present at a given x,y,z coordinate and making use of the Universe.find method.

I'm thinking it would be super useful (to me at least) if the DAGMCUniverse had a similar function. Then we could query the geometry coordinates and find the cell, material, universe present.

pshriwise commented 1 year ago

This is with the Python API?

shimwell commented 1 year ago

Yes please with the Python API

pshriwise commented 1 year ago

That's fairly tricky with the pure Python API tbh. Our containment methods for DAGMC require firing a ray (sometimes two), which means we need to load the volume's mesh (vertices and connectivity) along with some topological info. In short, it's far from a trivial task.

The openmc.lib.find_cell or openmc.lib.find_material method call into our C++ API and should be able to leverage the DAGMC containment calls without any additional implementation. Would that be an option for you?

shimwell commented 1 year ago

Oh yes that would be an option, I shall take a peak at the openmc.lib functions thanks for the pointer. I shall post back if I get a solution. Many thanks