diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 3ab5fcc2d8a..98dfc12a763 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -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!"); } diff --git a/tests/unit_tests/test_volume.py b/tests/unit_tests/test_volume.py index f9343a0b1aa..0993cb66aab 100644 --- a/tests/unit_tests/test_volume.py +++ b/tests/unit_tests/test_volume.py @@ -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()