Prepare point query data structures on meshes when applying Weight Windows (#3157)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Patrick Shriwise 2024-10-04 22:59:41 -05:00 committed by GitHub
parent c285a2c4ce
commit 9070b8b220
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 53 additions and 13 deletions

View file

@ -296,4 +296,40 @@ def test_ww_attrs_capi(run_in_tmpdir, model):
assert wws.id == 2
assert wws.particle == openmc.ParticleType.PHOTON
openmc.lib.finalize()
openmc.lib.finalize()
@pytest.mark.parametrize('library', ('libmesh', 'moab'))
def test_unstructured_mesh_applied_wws(request, run_in_tmpdir, library):
"""
Ensure that weight windows on unstructured mesh work when
they aren't part of a tally or weight window generator
"""
if library == 'libmesh' and not openmc.lib._libmesh_enabled():
pytest.skip('LibMesh not enabled in this build.')
if library == 'moab' and not openmc.lib._dagmc_enabled():
pytest.skip('DAGMC (and MOAB) mesh not enabled in this build.')
water = openmc.Material(name='water')
water.add_nuclide('H1', 2.0)
water.add_nuclide('O16', 1.0)
water.set_density('g/cc', 1.0)
box = openmc.model.RectangularParallelepiped(*(3*[-10, 10]), boundary_type='vacuum')
cell = openmc.Cell(region=-box, fill=water)
geometry = openmc.Geometry([cell])
mesh_file = str(request.fspath.dirpath() / 'test_mesh_tets.exo')
mesh = openmc.UnstructuredMesh(mesh_file, library)
dummy_wws = np.ones((12_000,))
wws = openmc.WeightWindows(mesh, dummy_wws, upper_bound_ratio=5.0)
model = openmc.Model(geometry)
model.settings.weight_windows = wws
model.settings.weight_windows_on = True
model.settings.run_mode = 'fixed source'
model.settings.particles = 100
model.settings.batches = 2
model.run()

View file

@ -0,0 +1 @@
../../regression_tests/unstructured_mesh/test_mesh_tets.e