From 89db332f83da61ea318800af1f292a39a42e52fe Mon Sep 17 00:00:00 2001 From: Chris Keckler Date: Fri, 19 Jan 2024 22:25:33 +0000 Subject: [PATCH 1/8] Add longer descriptions for fuelCycle impls --- .../physics/fuelCycle/fuelHandlerInterface.py | 17 +++++++ armi/physics/fuelCycle/fuelHandlers.py | 46 +++++++++++++++---- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlerInterface.py b/armi/physics/fuelCycle/fuelHandlerInterface.py index 31d17917f..a79f281c9 100644 --- a/armi/physics/fuelCycle/fuelHandlerInterface.py +++ b/armi/physics/fuelCycle/fuelHandlerInterface.py @@ -36,6 +36,23 @@ class FuelHandlerInterface(interfaces.Interface): :id: I_ARMI_SHUFFLE :implements: R_ARMI_SHUFFLE + This interface allows for a user to define custom shuffle logic that + modifies to the core model. Being based on the :py:class:`~armi.interfaces.Interface` + class, it has direct access to the current core model. + + User logic is able to be executed from within the + :py:meth:`~armi.physics.fuelCycle.fuelHandlerInterface.FuelHandlerInterface.manageFuel` method, + which will use the :py:meth:`~armi.physics.fuelCycle.fuelHandlerFactory.fuelHandlerFactory` + to search for a Python file specified by the case settings + ``fuelHandlerName`` and ``shuffleLogic``. If it exists, the user-specified + fuel handler will be imported, and any actions in its ``outage`` method + will be executed at the :py:meth:`~armi.physics.fuelCycle.fuelHandlerInterface.FuelHandlerInterface.interactBOC` + hook. + + If no class with the name specified by the ``fuelHandlerName`` setting is found + in the file with path ``shuffleLogic``, an error is returned. + + See the user manual for how the custom shuffle logic file should be constructed. """ name = "fuelHandler" diff --git a/armi/physics/fuelCycle/fuelHandlers.py b/armi/physics/fuelCycle/fuelHandlers.py index ac463bf5e..a70c14517 100644 --- a/armi/physics/fuelCycle/fuelHandlers.py +++ b/armi/physics/fuelCycle/fuelHandlers.py @@ -727,10 +727,31 @@ def swapAssemblies(self, a1, a2): :id: I_ARMI_SHUFFLE_MOVE :implements: R_ARMI_SHUFFLE_MOVE + For the two assemblies that are passed in, call to their :py:meth:`~armi.reactor.assemblies.Assembly.moveTo` + methods to transfer their underlying ``spatialLocator`` attributes to + each other. This will also update the ``childrenByLocator`` list on the + core as well as the assembly parameters ``numMoves`` and ``daysSinceLastMove``. + .. impl:: User-specified blocks can be left in place and not moved. :id: I_ARMI_SHUFFLE_STATIONARY0 :implements: R_ARMI_SHUFFLE_STATIONARY + Before assemblies are moved, + calls to the ``_transferStationaryBlocks`` class method to + check if there are any block types specified by the user as stationary + via the ``stationaryBlockFlags`` case setting. Using these flags, gather + blocks from each assembly which should remain stationary and check + to make sure that both assemblies have the same number and same + height of stationary blocks. If not, return an error. + + If all checks pass, use the :py:meth:`~armi.reactor.assemblies.Assembly.remove` + and :py:meth:`~armi.reactor.assemblies.Assembly.insert`` + methods to swap the stationary blocks between the two assemblies. + + Once this process is complete, the actual assembly movement can take + place. Through this process, the stationary blocks remain in the same + core location. + Parameters ---------- a1 : :py:class:`Assembly ` @@ -738,11 +759,6 @@ def swapAssemblies(self, a1, a2): a2 : :py:class:`Assembly ` The second assembly - Notes - ----- - The implementation for ``R_ARMI_SHUFFLE_STATIONARY`` occurs within - :py:meth:` Date: Wed, 24 Jan 2024 20:07:58 +0000 Subject: [PATCH 2/8] Clarify the use of case settings in I_ARMI_SHUFFLE --- armi/physics/fuelCycle/fuelHandlerInterface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlerInterface.py b/armi/physics/fuelCycle/fuelHandlerInterface.py index a79f281c9..79637c320 100644 --- a/armi/physics/fuelCycle/fuelHandlerInterface.py +++ b/armi/physics/fuelCycle/fuelHandlerInterface.py @@ -43,9 +43,9 @@ class FuelHandlerInterface(interfaces.Interface): User logic is able to be executed from within the :py:meth:`~armi.physics.fuelCycle.fuelHandlerInterface.FuelHandlerInterface.manageFuel` method, which will use the :py:meth:`~armi.physics.fuelCycle.fuelHandlerFactory.fuelHandlerFactory` - to search for a Python file specified by the case settings - ``fuelHandlerName`` and ``shuffleLogic``. If it exists, the user-specified - fuel handler will be imported, and any actions in its ``outage`` method + to search for a Python file specified by the case setting ``shuffleLogic``. + If it exists, the fuel handler with name specified by the user via the ``fuelHandlerName`` + case setting will be imported, and any actions in its ``outage`` method will be executed at the :py:meth:`~armi.physics.fuelCycle.fuelHandlerInterface.FuelHandlerInterface.interactBOC` hook. From 60f63348cfb076d20f635aa6dfcafb7e486e3537 Mon Sep 17 00:00:00 2001 From: Chris Keckler Date: Wed, 24 Jan 2024 14:09:45 -0600 Subject: [PATCH 3/8] Change impl description voicing Co-authored-by: bsculac <102382931+bsculac@users.noreply.github.com> --- armi/physics/fuelCycle/fuelHandlers.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlers.py b/armi/physics/fuelCycle/fuelHandlers.py index a70c14517..0756cd79a 100644 --- a/armi/physics/fuelCycle/fuelHandlers.py +++ b/armi/physics/fuelCycle/fuelHandlers.py @@ -737,12 +737,12 @@ def swapAssemblies(self, a1, a2): :implements: R_ARMI_SHUFFLE_STATIONARY Before assemblies are moved, - calls to the ``_transferStationaryBlocks`` class method to + the ``_transferStationaryBlocks`` class method is called to check if there are any block types specified by the user as stationary - via the ``stationaryBlockFlags`` case setting. Using these flags, gather - blocks from each assembly which should remain stationary and check - to make sure that both assemblies have the same number and same - height of stationary blocks. If not, return an error. + via the ``stationaryBlockFlags`` case setting. Using these flags, blocks + are gathered from each assembly which should remain stationary and + checked to make sure that both assemblies have the same number + and same height of stationary blocks. If not, return an error. If all checks pass, use the :py:meth:`~armi.reactor.assemblies.Assembly.remove` and :py:meth:`~armi.reactor.assemblies.Assembly.insert`` From 46de12de0d40b503bae8946dbf32584fdb88a8e9 Mon Sep 17 00:00:00 2001 From: Chris Keckler Date: Wed, 24 Jan 2024 14:10:08 -0600 Subject: [PATCH 4/8] Update armi/physics/fuelCycle/fuelHandlers.py Co-authored-by: bsculac <102382931+bsculac@users.noreply.github.com> --- armi/physics/fuelCycle/fuelHandlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlers.py b/armi/physics/fuelCycle/fuelHandlers.py index 0756cd79a..24ddd8d3e 100644 --- a/armi/physics/fuelCycle/fuelHandlers.py +++ b/armi/physics/fuelCycle/fuelHandlers.py @@ -744,9 +744,9 @@ def swapAssemblies(self, a1, a2): checked to make sure that both assemblies have the same number and same height of stationary blocks. If not, return an error. - If all checks pass, use the :py:meth:`~armi.reactor.assemblies.Assembly.remove` + If all checks pass, the :py:meth:`~armi.reactor.assemblies.Assembly.remove` and :py:meth:`~armi.reactor.assemblies.Assembly.insert`` - methods to swap the stationary blocks between the two assemblies. + methods are used to swap the stationary blocks between the two assemblies. Once this process is complete, the actual assembly movement can take place. Through this process, the stationary blocks remain in the same From 795caad9adb52a0f31e1458ac52442f9945bdee2 Mon Sep 17 00:00:00 2001 From: Chris Keckler Date: Wed, 24 Jan 2024 14:10:33 -0600 Subject: [PATCH 5/8] Update armi/physics/fuelCycle/fuelHandlers.py Co-authored-by: bsculac <102382931+bsculac@users.noreply.github.com> --- armi/physics/fuelCycle/fuelHandlers.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlers.py b/armi/physics/fuelCycle/fuelHandlers.py index 24ddd8d3e..a629d4859 100644 --- a/armi/physics/fuelCycle/fuelHandlers.py +++ b/armi/physics/fuelCycle/fuelHandlers.py @@ -852,12 +852,12 @@ def dischargeSwap(self, incoming, outgoing): :implements: R_ARMI_SHUFFLE_STATIONARY Before assemblies are moved, - calls to the ``_transferStationaryBlocks`` class method to + the ``_transferStationaryBlocks`` class method is called to check if there are any block types specified by the user as stationary - via the ``stationaryBlockFlags`` case setting. Using these flags, gather - blocks from each assembly which should remain stationary and check - to make sure that both assemblies have the same number and same - height of stationary blocks. If not, return an error. + via the ``stationaryBlockFlags`` case setting. Using these flags, blocks + are gathered from each assembly which should remain stationary and + checked to make sure that both assemblies have the same number + and same height of stationary blocks. If not, return an error. If all checks pass, use the :py:meth`~armi.reactor.assemblies.Assembly.remove` and :py:meth:`~armi.reactor.assemblies.Assembly.insert`` From 03aeaa97d49a9b7b86aae06aef3f99e63850b76e Mon Sep 17 00:00:00 2001 From: Chris Keckler Date: Wed, 24 Jan 2024 14:10:46 -0600 Subject: [PATCH 6/8] Update armi/physics/fuelCycle/fuelHandlers.py Co-authored-by: bsculac <102382931+bsculac@users.noreply.github.com> --- armi/physics/fuelCycle/fuelHandlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlers.py b/armi/physics/fuelCycle/fuelHandlers.py index a629d4859..d0cb477e0 100644 --- a/armi/physics/fuelCycle/fuelHandlers.py +++ b/armi/physics/fuelCycle/fuelHandlers.py @@ -859,9 +859,9 @@ def dischargeSwap(self, incoming, outgoing): checked to make sure that both assemblies have the same number and same height of stationary blocks. If not, return an error. - If all checks pass, use the :py:meth`~armi.reactor.assemblies.Assembly.remove` + If all checks pass, the :py:meth:`~armi.reactor.assemblies.Assembly.remove` and :py:meth:`~armi.reactor.assemblies.Assembly.insert`` - methods to swap the stationary blocks between the two assemblies. + methods are used to swap the stationary blocks between the two assemblies. Once this process is complete, the actual assembly movement can take place. Through this process, the stationary blocks from the outgoing From 39d55597b00ba43df7be17ad69db9aedcdc0889d Mon Sep 17 00:00:00 2001 From: Chris Keckler Date: Wed, 24 Jan 2024 20:14:16 +0000 Subject: [PATCH 7/8] Disambiguate the implementations for R_ARMI_SHUFFLE_STATIONARY --- armi/physics/fuelCycle/fuelHandlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlers.py b/armi/physics/fuelCycle/fuelHandlers.py index a70c14517..7391cd832 100644 --- a/armi/physics/fuelCycle/fuelHandlers.py +++ b/armi/physics/fuelCycle/fuelHandlers.py @@ -732,7 +732,7 @@ def swapAssemblies(self, a1, a2): each other. This will also update the ``childrenByLocator`` list on the core as well as the assembly parameters ``numMoves`` and ``daysSinceLastMove``. - .. impl:: User-specified blocks can be left in place and not moved. + .. impl:: User-specified blocks can be left in place during within-core swaps. :id: I_ARMI_SHUFFLE_STATIONARY0 :implements: R_ARMI_SHUFFLE_STATIONARY @@ -847,7 +847,7 @@ def dischargeSwap(self, incoming, outgoing): outgoing : :py:class:`Assembly ` The assembly getting discharged out the core. - .. impl:: User-specified blocks can be left in place and not moved. + .. impl:: User-specified blocks can be left in place for the discharge swap. :id: I_ARMI_SHUFFLE_STATIONARY1 :implements: R_ARMI_SHUFFLE_STATIONARY From 4d467247217ea4ed7dedb66ee6c1f6d1ea578332 Mon Sep 17 00:00:00 2001 From: Chris Keckler Date: Wed, 24 Jan 2024 20:18:33 +0000 Subject: [PATCH 8/8] black --- armi/physics/fuelCycle/fuelHandlers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/armi/physics/fuelCycle/fuelHandlers.py b/armi/physics/fuelCycle/fuelHandlers.py index 0b3bea684..12b98da69 100644 --- a/armi/physics/fuelCycle/fuelHandlers.py +++ b/armi/physics/fuelCycle/fuelHandlers.py @@ -740,8 +740,8 @@ def swapAssemblies(self, a1, a2): the ``_transferStationaryBlocks`` class method is called to check if there are any block types specified by the user as stationary via the ``stationaryBlockFlags`` case setting. Using these flags, blocks - are gathered from each assembly which should remain stationary and - checked to make sure that both assemblies have the same number + are gathered from each assembly which should remain stationary and + checked to make sure that both assemblies have the same number and same height of stationary blocks. If not, return an error. If all checks pass, the :py:meth:`~armi.reactor.assemblies.Assembly.remove` @@ -855,8 +855,8 @@ def dischargeSwap(self, incoming, outgoing): the ``_transferStationaryBlocks`` class method is called to check if there are any block types specified by the user as stationary via the ``stationaryBlockFlags`` case setting. Using these flags, blocks - are gathered from each assembly which should remain stationary and - checked to make sure that both assemblies have the same number + are gathered from each assembly which should remain stationary and + checked to make sure that both assemblies have the same number and same height of stationary blocks. If not, return an error. If all checks pass, the :py:meth:`~armi.reactor.assemblies.Assembly.remove`