Updates to object lifecycle for WeightWindows and WeightWindowGenerators (#2582)

This commit is contained in:
Patrick Shriwise 2023-06-30 22:29:47 -05:00 committed by GitHub
parent 36f229eb01
commit 382bcb2e8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 275 additions and 211 deletions

View file

@ -28,13 +28,20 @@ def test_ww_generator(run_in_tmpdir):
energy_bounds = np.linspace(0.0, 1e6, 70)
particle = 'neutron'
# include another tally to make sure user-specified tallies and those automaticaly
# created by weight window generators can coexist
tally = openmc.Tally()
ef = openmc.EnergyFilter(energy_bounds)
tally.filters = [ef]
tally.scores = ['flux']
model.tallies = [tally]
wwg = openmc.WeightWindowGenerator(mesh, energy_bounds, particle)
wwg.update_parameters = {'ratio' : 5.0, 'threshold': 0.8, 'value' : 'mean'}
wwg.update_parameters = {'ratio': 5.0, 'threshold': 0.8, 'value': 'mean'}
model.settings.weight_window_generators = wwg
model.export_to_xml()
model.run()
# we test the effectiveness of the update method elsewhere, so
# just test that the generation happens successfully here
assert os.path.exists('weight_windows.h5')