Volume calculation of polygon region

Hello,

I have made a geometry using openmc.model.Polygon, but when I try to use the stochastic volume calculation to find the volume of the materials in my polygons the volume is always returned as zero, with an error of zero.

I have made a minimum working example (below) - the script runs in full and the settings.xml file has a volume calculation section, but the output of the volume calculation is always zero.

Has anyone experienced this before or have any ideas as to how I can calculate the volume of a polygon?

Many thanks in advance.

import openmc
import openmc.deplete

# Materials
material = openmc.Material(material_id=1)
material.add_element(element="Fe", percent=1.0)
material.depletable = True

my_materials = openmc.Materials([material])
my_materials.export_to_xml()

# Geometry
radius1 = 5
radius2 = 40

points = [
        (radius2, 37),
        (radius1, 11.4),
        (radius1, 2.78),
        (radius2, 29)
    ]
model_surface = openmc.model.Polygon(points=points,
                                        basis='rz')
model_region = model_surface.region
cell1 = openmc.Cell(region=model_region, cell_id=1, fill=material)

surf2 = openmc.ZCylinder(r=radius2+1, boundary_type='vacuum')
surf3 = openmc.ZPlane(z0=40, boundary_type='vacuum')
surf4 = openmc.ZPlane(z0=0, boundary_type='vacuum')
reg2 = -surf2 & +surf4 & -surf3 & ~model_region

cell2 = openmc.Cell(region=reg2, cell_id=2)

my_geometry = openmc.Geometry([cell1, cell2])
my_geometry.export_to_xml()
    
num_of_samples = 10_000_000
lower_left, upper_right = my_geometry.bounding_box

settings=openmc.Settings()
vol_calc = openmc.VolumeCalculation([material], num_of_samples, lower_left, upper_right)
settings.run_mode = 'volume'
settings.volume_calculations = [vol_calc]
settings.export_to_xml()
model = openmc.Model(geometry=my_geometry, materials=my_materials, settings=settings)

model.run()
material_vol_calc_results = openmc.VolumeCalculation.from_hdf5('volume_1.h5')
print(' material volume', material_vol_calc_results.volumes[1], 'cm3')

Just to add I have run this same example and got the same 0 value.

I’ve tried replacing the polygon with a sphere and got the expected volume of the sphere so I think the code is good.

Looking at the bounding box, it does appear to contains an inf value

setting

model_region.bounding_box
BoundingBox(lower_left=(-40.0, -40.0, -0.9657142857142813), upper_right=(40.0, 40.0, inf))

So perhaps the the upper_rightarg for the openmc.VolumeCalculation would need manually

Thank you! Setting the upper_right variable myself so that it does not contain and infinity makes the calculation work.