From ac234f514f2ebf2b44e0fcb3423252ec61d09c50 Mon Sep 17 00:00:00 2001 From: John Stilley <1831479+john-science@users.noreply.github.com> Date: Wed, 26 Oct 2022 08:29:38 -0700 Subject: [PATCH] Removing getMasterCs from getMicroSuffix (#951) --- armi/reactor/blocks.py | 38 +++++++++++++++++-------------- armi/reactor/tests/test_blocks.py | 14 ++++++++++++ 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/armi/reactor/blocks.py b/armi/reactor/blocks.py index d2c4015b4..683631c2a 100644 --- a/armi/reactor/blocks.py +++ b/armi/reactor/blocks.py @@ -20,32 +20,32 @@ Blocks are made of components. """ -import math -import copy -import collections from typing import Optional, Type, Tuple, ClassVar +import collections +import copy +import math import numpy -from armi.reactor import composites from armi import runLog from armi import settings +from armi.bookkeeping import report from armi.nucDirectory import nucDir -from armi.reactor import geometry -from armi.reactor import parameters +from armi.physics.neutronics import GAMMA +from armi.physics.neutronics import NEUTRON from armi.reactor import blockParameters +from armi.reactor import components +from armi.reactor import composites +from armi.reactor import geometry from armi.reactor import grids +from armi.reactor import parameters from armi.reactor.flags import Flags -from armi.reactor import components +from armi.reactor.parameters import ParamLocation +from armi.utils import densityTools +from armi.utils import hexagon from armi.utils import units from armi.utils.plotting import plotBlockFlux -from armi.bookkeeping import report from armi.utils.units import TRACE_NUMBER_DENSITY -from armi.utils import hexagon -from armi.utils import densityTools -from armi.physics.neutronics import NEUTRON -from armi.physics.neutronics import GAMMA -from armi.reactor.parameters import ParamLocation PIN_COMPONENTS = [ Flags.CONTROL, @@ -437,18 +437,22 @@ def getMicroSuffix(self): setting has length 1 (i.e. no burnup groups are defined). This is useful for high-fidelity XS modeling of V&V models such as the ZPPRs. """ - bu = self.p.buGroup if not bu: raise RuntimeError( "Cannot get MicroXS suffix because {0} in {1} does not have a burnup group" "".format(self, self.parent) ) + xsType = self.p.xsType - if len(xsType) == 2 and len(settings.getMasterCs()["buGroups"]) == 1: - return xsType - else: + if len(xsType) == 1: return xsType + bu + elif len(xsType) == 2 and ord(bu) > ord("A"): + raise ValueError( + f"Use of multiple burnup groups is not allowed with multi-character xs groups!" + ) + else: + return xsType def getHeight(self): """Return the block height.""" diff --git a/armi/reactor/tests/test_blocks.py b/armi/reactor/tests/test_blocks.py index 055245f06..8716de645 100644 --- a/armi/reactor/tests/test_blocks.py +++ b/armi/reactor/tests/test_blocks.py @@ -869,6 +869,20 @@ def test_getFissileMassEnrich(self): self.assertAlmostEqual(cur, ref, places=places) self.block.remove(self.fuelComponent) + def test_getMicroSuffix(self): + self.assertEqual(self.block.getMicroSuffix(), "AA") + + self.block.p.xsType = "Z" + self.assertEqual(self.block.getMicroSuffix(), "ZA") + + self.block.p.xsType = "RS" + self.assertEqual(self.block.getMicroSuffix(), "RS") + + self.block.p.buGroup = "X" + self.block.p.xsType = "AB" + with self.assertRaises(ValueError): + self.block.getMicroSuffix() + def test_getUraniumMassEnrich(self): self.block.adjustUEnrich(0.25)