From c732336536669e5232fef19b0261fb2d941e0ef7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Aug 2019 13:38:13 -0500 Subject: [PATCH] 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. --- openmc/deplete/helpers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openmc/deplete/helpers.py b/openmc/deplete/helpers.py index 43a835908c..8f35fac433 100644 --- a/openmc/deplete/helpers.py +++ b/openmc/deplete/helpers.py @@ -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 = []