Avert bad numpy slices unpacking fission yields with no materials

For the case where there are more processes than burnable materials,
e.g. single pin cell or assembly with one burnable material, then
the local_indexes attribute on some FissionYieldHelpers will
be an empty array. This causes errors trying to use this as an
indexer into the tally results.

Instead, simply return from the unpacking if this is the case.
The compute_yields function is called inside the Operator's
unpacking of it's local materials, so that __should__ not be
in a position to call compute_yields for a process with no
burnable materials.
This commit is contained in:
Andrew Johnson 2019-08-06 13:38:13 -05:00
parent 27f2c6b15f
commit c732336536
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB

View file

@ -277,8 +277,14 @@ class FissionYieldHelper(object):
"""Unpack fission rate tallies to produce :attr:`results`
Resets :attr:`libraries` under the assumption this is called
during the :class:`openmc.deplete.Operator` unpackign process
during the :class:`openmc.deplete.Operator` unpacking process
"""
# if this process is not responsible for depleting anything
# [more processes than burnable materials]
# don't do anything
if self.local_indexes.size == 0:
return
# clear old libraries
self.libraries = []