From 098afaf4a1395bafec3354775a16458b78d0602e Mon Sep 17 00:00:00 2001 From: jstilley Date: Mon, 26 Aug 2024 16:47:37 -0700 Subject: [PATCH 1/3] Removing defunct flags CORE and REACTOR --- armi/bookkeeping/db/database3.py | 17 +++++------------ .../neutronics/tests/test_crossSectionTable.py | 3 +-- armi/reactor/flags.py | 3 --- armi/reactor/reactors.py | 4 +--- armi/reactor/tests/test_assemblies.py | 4 ++-- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/armi/bookkeeping/db/database3.py b/armi/bookkeeping/db/database3.py index f1f35d572..871ff9ebf 100644 --- a/armi/bookkeeping/db/database3.py +++ b/armi/bookkeeping/db/database3.py @@ -72,9 +72,8 @@ from armi.reactor.blocks import Block from armi.reactor.components import Component from armi.reactor.composites import ArmiObject -from armi.reactor.flags import Flags from armi.reactor.parameters import parameterCollections -from armi.reactor.reactors import Core +from armi.reactor.reactors import Core, Reactor from armi.settings.fwSettings.globalSettings import CONF_SORT_REACTOR from armi.utils import getNodesPerCycle from armi.utils.textProcessors import resolveMarkupInclusions @@ -854,11 +853,7 @@ def _compose(self, comps, cs, parent=None): comp.add(child) if isinstance(comp, Core): - # TODO: This is also an issue related to geoms and which core is "The Core". - # We only have a good geom for the main core, so can't do process loading on - # the SFP, etc. - if comp.hasFlags(Flags.CORE): - comp.processLoading(cs, dbLoad=True) + comp.processLoading(cs, dbLoad=True) elif isinstance(comp, Assembly): comp.calculateZCoords() @@ -1311,8 +1306,7 @@ def getHistories( Returns ------- dict - Dictionary ArmiObject (input): dict of str/list pairs containing ((cycle, - node), value). + Dictionary ArmiObject (input): dict of str/list pairs containing ((cycle, node), value). """ histData: Histories = { c: collections.defaultdict(collections.OrderedDict) for c in comps @@ -1329,8 +1323,7 @@ def getHistories( if "layout" not in h5TimeNodeGroup: # Layout hasn't been written for this time step, so whatever is in there # didn't come from the DatabaseInterface. Probably because it's the - # current time step and something has created the group to store aux - # data + # current time step and something has created the group to store aux data continue cycle = h5TimeNodeGroup.attrs["cycle"] @@ -1419,7 +1412,7 @@ def getHistories( histData[c][paramName][cycle, timeNode] = val - r = comps[0].getAncestorWithFlags(Flags.REACTOR) + r = comps[0].getAncestor(lambda c: isinstance(c, Reactor)) cycleNode = r.p.cycle, r.p.timeNode for c, paramHistories in histData.items(): for paramName, hist in paramHistories.items(): diff --git a/armi/physics/neutronics/tests/test_crossSectionTable.py b/armi/physics/neutronics/tests/test_crossSectionTable.py index b69593a06..8dfc878b8 100644 --- a/armi/physics/neutronics/tests/test_crossSectionTable.py +++ b/armi/physics/neutronics/tests/test_crossSectionTable.py @@ -20,7 +20,6 @@ isotopicDepletionInterface as idi, ) from armi.physics.neutronics.latticePhysics import ORDER -from armi.reactor.flags import Flags from armi.reactor.tests.test_blocks import loadTestBlock from armi.reactor.tests.test_reactors import loadTestReactor from armi.settings import Settings @@ -37,7 +36,7 @@ def test_makeTable(self): """ obj = loadTestBlock() obj.p.mgFlux = range(33) - core = obj.getAncestorWithFlags(Flags.CORE) + core = obj.parent.parent core.lib = isotxs.readBinary(ISOAA_PATH) table = crossSectionTable.makeReactionRateTable(obj) diff --git a/armi/reactor/flags.py b/armi/reactor/flags.py index 6366432a8..14bcff7e8 100644 --- a/armi/reactor/flags.py +++ b/armi/reactor/flags.py @@ -205,9 +205,6 @@ class Flags(Flag): MEDIUM = auto() LOW = auto() - CORE = auto() - REACTOR = auto() - # general kinds of assemblies or blocks MATERIAL = auto() FUEL = auto() diff --git a/armi/reactor/reactors.py b/armi/reactor/reactors.py index 3553fb9b9..08852000b 100644 --- a/armi/reactor/reactors.py +++ b/armi/reactor/reactors.py @@ -98,7 +98,6 @@ def __init__(self, name, blueprints): self.spatialLocator = None self.p.maxAssemNum = 0 self.p.cycle = 0 - self.p.flags |= Flags.REACTOR self.core = None self.sfp = None self.blueprints = blueprints @@ -123,7 +122,7 @@ def __repr__(self): def add(self, container): composites.Composite.add(self, container) - cores = self.getChildrenWithFlags(Flags.CORE) + cores = [c for c in self.getChildren(deep=True) if isinstance(c, Core)] if cores: if len(cores) != 1: raise ValueError( @@ -283,7 +282,6 @@ def __init__(self, name): Name of the object. Flags will inherit from this. """ composites.Composite.__init__(self, name) - self.p.flags = Flags.fromStringIgnoreErrors(name) self.assembliesByName = {} self.circularRingList = {} self.blocksByName = {} # lookup tables diff --git a/armi/reactor/tests/test_assemblies.py b/armi/reactor/tests/test_assemblies.py index 248aa743b..9bde09ffe 100644 --- a/armi/reactor/tests/test_assemblies.py +++ b/armi/reactor/tests/test_assemblies.py @@ -605,8 +605,8 @@ def test_duplicate(self): for refBlock, curBlock in zip(self.assembly, assembly2): numNucs = 0 - for nuc in self.assembly.getAncestorWithFlags( - Flags.REACTOR + for nuc in self.assembly.getAncestor( + lambda c: isinstance(c, reactors.Reactor) ).blueprints.allNuclidesInProblem: numNucs += 1 # Block level density From 4fd921e884aaeb61ead4950ca9ab4f0a62bddc82 Mon Sep 17 00:00:00 2001 From: jstilley Date: Mon, 26 Aug 2024 16:50:39 -0700 Subject: [PATCH 2/3] Adding release note --- doc/release/0.4.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release/0.4.rst b/doc/release/0.4.rst index 7ede41007..7773c5e62 100644 --- a/doc/release/0.4.rst +++ b/doc/release/0.4.rst @@ -14,6 +14,7 @@ New Features API Changes ----------- +#. Removing flags ``CORE`` and ``REACTOR``. (`PR#1835 `_) #. TBD Bug Fixes @@ -24,6 +25,7 @@ Bug Fixes Quality Work ------------ #. Removing code that causes a deprecation warning (converting ``axialUnitGrid`` to ``AxialGrid.fromNCells``) (`PR#1809 `_) +#. TBD Changes that Affect Requirements -------------------------------- From a58ba029f8854e11430a6df7d386519ca1490caf Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 27 Aug 2024 10:27:08 -0700 Subject: [PATCH 3/3] Fixing the language of the Core impl tag --- armi/reactor/assemblyLists.py | 1 - armi/reactor/reactors.py | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/armi/reactor/assemblyLists.py b/armi/reactor/assemblyLists.py index 0abb974f0..1355ad811 100644 --- a/armi/reactor/assemblyLists.py +++ b/armi/reactor/assemblyLists.py @@ -201,7 +201,6 @@ def add(self, assem, loc=None): ---------- assem : Assembly The Assembly to add to the list - loc : LocationBase, optional If provided, the assembly is inserted at that location. If it is not provided, the locator on the Assembly object will be used. If the diff --git a/armi/reactor/reactors.py b/armi/reactor/reactors.py index 08852000b..0b1def1a3 100644 --- a/armi/reactor/reactors.py +++ b/armi/reactor/reactors.py @@ -250,10 +250,9 @@ class Core(composites.Composite): :implements: R_ARMI_R_CORE A :py:class:`Core ` object is typically a child of a - :py:class:`Reactor ` object. A Reactor can contain multiple - objects of the Core type. The instance attribute name ``r.core`` is reserved for the object - representating the active core. A reactor may also have a spent fuel pool instance - attribute, ``r.sfp``\ , which is also of type :py:class:`core `. + :py:class:`Reactor ` object. A Reactor should only contain + one object of the Core type. The instance attribute name ``r.core`` is reserved for the + object representating the active core. Most of the operations to retrieve information from the ARMI reactor data model are mediated through Core objects. For example, @@ -265,7 +264,6 @@ class Core(composites.Composite): params : dict Core-level parameters are scalar values that have time dependence. Examples are keff, maxPercentBu, etc. - assemblies : list List of assembly objects that are currently in the core """