openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Feature Request: arbitrary plane plotting

Open lewisgross1296 opened this issue 2 years ago • 1 comments

Description

The OpenMC Plotter can plot using an XY,XZ, or YZ basis, but viewing planes with other normal vectors currently is not possible. I propose that we add the ability to generate an arbitrary plane plot either by supplying three points or by giving a normal vector to the plane and some reference view/point. We could re-use code in openmc.Plane() nicely for both of these options. The normal vector would also need some kind of orientation description for the plot itself. @pshriwise suggested some kind of clever automated selection for the view related to the normal or allowing the user to specify.

Alternatives

No OpenMC alternatives, as far as I'm aware. @shimwell suggested exporting to VTK and viewing planes in ParaView as a work around for now.

Compatibility

This will be a breaking change that requires implementation discussion. For example, if you use an older version of OpenMC with a newer version of the plotter and attempt to use this feature. The source code will need to be carefully changed along for reverse and forward compatibility. Very open to hearing peoples' thoughts and concerns.

lewisgross1296 avatar Sep 29 '23 16:09 lewisgross1296

There's a workaround, but it's a little bit clunky. Instead of picking the plane that you want to take a plot in, you can rotate your entire model, so that any of the XY, YZ, or ZX planes cut the model in your desired orientation.

let's say you have a universe called my_universe, what you can do is create a cell, fill it with your original universe, rotate the cell, and then create a new universe with that rotated cell

# my_universe is your original universe
rot_cell = openmc.Cell(fill = my_universe)
rot_cell.rotation = (a,b,c) # whatever angle you want
rot_universe = openmc.Universe(cells = [rot_cell])

But yeah, this is just a simple workaround. A dedicated feature to select a plane for plotting will be much better.

ray-pH avatar Nov 12 '23 11:11 ray-pH