Skip to content

Commit

Permalink
Skip BC check for volume calculations (#2743)
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise authored Oct 23, 2023
1 parent 079629b commit b465a83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/geometry_aux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}

Expand Down
14 changes: 14 additions & 0 deletions tests/unit_tests/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit b465a83

Please sign in to comment.