Skip BC check for volume calculations (#2743)

This commit is contained in:
Patrick Shriwise 2023-10-23 17:50:21 -05:00 committed by GitHub
parent 079629b828
commit b465a83806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -81,7 +81,8 @@ void read_geometry_xml(pugi::xml_node root)
}
}
if (settings::run_mode != RunMode::PLOTTING && !boundary_exists) {
if (settings::run_mode != RunMode::PLOTTING &&
settings::run_mode != RunMode::VOLUME && !boundary_exists) {
fatal_error("No boundary conditions were applied to any surfaces!");
}

View file

@ -29,3 +29,17 @@ def test_invalid_id(run_in_tmpdir, cls):
with pytest.raises(RuntimeError):
model.calculate_volumes()
def test_no_bcs(run_in_tmpdir):
"""Ensure that a model without boundary conditions can be used in a volume calculation"""
model = openmc.examples.pwr_pin_cell()
for surface in model.geometry.get_all_surfaces().values():
surface.boundary_type = 'transmission'
bbox = openmc.BoundingBox([-1.]*3, [1.]*3)
cells = list(model.geometry.get_all_cells().values())
vc = openmc.VolumeCalculation(cells, samples=10, lower_left=bbox[0], upper_right=bbox[1])
model.settings.volume_calculations = [vc]
model.calculate_volumes()