While trying to plot a region defined by two polygons I get a ValueError: math domain error while using openmc.Cell.plot. This is caused by a square-root, so I suspect something went negative that shouldn't have.
This was produced while trying to generate "i" in this plot:
.
Steps to Reproduce
MWE:
import openmc
polygon_1 = openmc.model.Polygon([(23.945502, -11.479504), (25.086518, -11.479504), (25.086518, -18.424816), (23.945502, -18.424816)],"xy")
polygon_2 = openmc.model.Polygon([(23.945502, -8.775792800000001), (25.086518, -8.775792800000001), (25.086518, -10.220666000000001), (23.945502, -10.220666000000001)],"xy")
z_bounds = +openmc.ZPlane(0) & - openmc.ZPlane(1)
# I now realize that this is the Null set, but kept as is for error replications
region = -polygon_1 & -polygon_2 & z_bounds
cell = openmc.Cell(region=region)
cell.plot(basis="xy")
I suspect this is an error with how the bounding box was calculated as it is inverted:
BoundingBox(lower_left=(23.945502, -10.220666000000001, 0.0), upper_right=(25.086518, -11.479504, 1.0))
Bug Description
While trying to plot a region defined by two polygons I get a
ValueError: math domain error
while usingopenmc.Cell.plot
. This is caused by a square-root, so I suspect something went negative that shouldn't have.This was produced while trying to generate "i" in this plot: .
Steps to Reproduce
MWE:
This then leads to:
Specifying
cell.plot(basis="xy", pixels = [1000]*2)
fixes this.I suspect this is an error with how the bounding box was calculated as it is inverted:
BoundingBox(lower_left=(23.945502, -10.220666000000001, 0.0), upper_right=(25.086518, -11.479504, 1.0))
Environment
Using Conda package in mamba:
openmc 0.14.0 dagmc_nompi_py310h27bda5d_101 conda-forge
On python 3.10.12 in Ubuntu 20.04.06 in WSL.