-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Hi all
I've been exploring the landscape for plotting openmc materials, geometry and meshes.
I've got a few ideas about possible developments to the plotter that I wanted to share. and get peoples thoughts on.
-
🐛🐻 When plotting a just a geometry we currently need to also load up materials. I've started trying to decouple the two with this PR but further PRs are needed if we want to remove this requirement.
-
🐛🐻 When launching the plotter it loads up local xml files automatically. If we want to plot geometry or materials or meshtally we need openmc install and the openmc binary. For instance the plotter runs openmc in plot mode then loads up the resulting image. But there are other ways of finding the materials and geometry on a grid, using the openmc.Geometry.find() method I've written two functions that monkey patch openmc.Geometry to allow the materials or cells to be found on a grid and this grid becomes and image. These are not c++ based like the openmc plot but as there is no need to load nuclear data or run openmc the time to plot is comparable. Also the for loop could be parallelised if speed becomes an issue.
Proposal
Regardless of if we make use of the Geometry.find method I think it makes sense to migrate all data extraction functionality to openmc and then call it from the plotter. This will help keep the code in the plotter minimal and avoid duplication with openmc. If we do this then users have the option of using the plotter and the python API to make batch plots. This issue has come up on the forum and I've put in a PR for slicing regular meshes. I think there are 3 data extraction functions we need (cells, materials, mesh tally result). I think there are also some axis manipulation needed as well but that varies across the plotting tools (imshow is different to contour and plotly is different to mpl).
- add slicing to the openmc.geometry class for materials and cells that uses openmc.geometry.find function
- add slicing to the openmc openmc.RegularMesh class
- make use of both functions here in the plotter and remove local versions
Questions
Is this totally going in the wrong direction?
Is the 🐍 python based find method robust enough to rely on?
Is it worth moving code to openmc so that it can be shared with API users?