mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Avoid adding ParentNuclideFilter twice when calling prepare_tallies (#3506)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
8be65513b7
commit
a649d7bc69
2 changed files with 7 additions and 2 deletions
|
|
@ -243,7 +243,7 @@ def prepare_tallies(
|
|||
for f in tally.filters:
|
||||
if isinstance(f, openmc.ParticleFilter):
|
||||
if list(f.bins) == ['photon']:
|
||||
tally.filters.append(filter)
|
||||
if not tally.contains_filter(openmc.ParentNuclideFilter):
|
||||
tally.filters.append(filter)
|
||||
break
|
||||
|
||||
return nuclides
|
||||
|
|
|
|||
|
|
@ -84,6 +84,11 @@ def test_prepare_tallies(model):
|
|||
assert tally.contains_filter(openmc.ParentNuclideFilter)
|
||||
assert sorted(tally.filters[-1].bins) == sorted(radionuclides)
|
||||
|
||||
assert len(tally.filters) == 2
|
||||
# calling prepare_tallies twice should not add another ParentNuclideFilter
|
||||
d1s.prepare_tallies(model, chain_file=CHAIN_PATH)
|
||||
assert len(tally.filters) == 2
|
||||
|
||||
|
||||
def test_apply_time_correction(run_in_tmpdir):
|
||||
# Make simple sphere model with elemental Ni
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue