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')