openmc-dev / openmc

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

Support UnstructuredMesh for IndependentSource #2949

Closed pshriwise closed 2 weeks ago

pshriwise commented 3 weeks ago

Description

This PR contains a fix in source.py that allows for application of the UnstructuredMesh class in a MeshSource object. It also has some quality-of-life updates for the UnstrucutredMesh class:

Partially Fixes #2929 -- I'll be creating a follow-on PR to support addition of the statepoint properties from the Python API next.

Checklist

shimwell commented 3 weeks ago

Many thanks Patrick, I can give this go and feedback.

shimwell commented 3 weeks ago

Just been making use of this branch, it successfully produced a mesh source on an unstructured mesh.

Tagging @rlbarker for your interest

I used this python script, attached .h5m file and produced a nice html plot of the result. meshsource.zip

shimwell commented 3 weeks ago

This all looks good @pshriwise and it works nicely over here. The only part I don't quite get is why are the indices a list of tuples instead of a plain old list

shimwell commented 3 weeks ago

Thanks for explaining that tuple use. All looks good here to me. Shall we leave it open for a few days in case other comments come in.