Skip to content

Commit

Permalink
Fixing docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Sep 17, 2024
1 parent 2ce80c1 commit 2c441e0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
5 changes: 2 additions & 3 deletions armi/reactor/composites.py
Original file line number Diff line number Diff line change
Expand Up @@ -2732,12 +2732,11 @@ def iterComponents(self, typeSpec: TypeSpec = None, exact=False):
Parameters
----------
typeSpec : TypeSpec
Component flags. Will restrict Components to specific ones matching the
flags specified.
Component flags. Will restrict Components to specific ones matching the flags specified.
exact : bool, optional
Only match exact component labels (names). If True, 'coolant' will not match
'interCoolant'. This has no impact if typeSpec is None.
'interCoolant'. This has no impact if typeSpec is None.
Returns
-------
Expand Down
19 changes: 16 additions & 3 deletions armi/reactor/excoreStructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""TODO: JOHN."""
"""This module provides the simplest base-class tools for representing reactor objects that are
outside the reactor core.
The idea here is that all ex-core objects will be represented first as a spatial grid, and then
arbitrary ArmiObjects can be added to that grid.
"""

from armi.reactor import grids
from armi.reactor.composites import Composite


class ExcoreStructure(Composite):
"""TODO: JOHN.
"""This is meant as the simplest baseclass neede to represent an ex-core reactor thing.
An ex-core structure is expected to:
Expand All @@ -42,7 +47,15 @@ def r(self):
return self.getAncestor(fn=lambda x: x.__class__.__name__ == "Reactor")

def add(self, obj, loc):
"""TODO: JOHN: Add one new child."""
"""Add an ArmiObject to a particular grid location, in this structure.
Parameters
----------
assem : ArmiObject
Any generic ArmiObject to add to the structure.
loc : LocationBase
The location on this structure's grid.
"""
if loc.grid is not self.spatialGrid:
raise ValueError(
f"An Composite cannot be added to {self} using a spatial locator from another grid."
Expand Down
37 changes: 17 additions & 20 deletions armi/reactor/spentFuelPool.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 TerraPower, LLC
# Copyright 2024 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,12 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A nuclear reactor frequently has storage pools (or 'ponds') for spent fuel.
"""
Spent Fuel Pools are core-like objects that store collections of Assemblies on a grid.
There are some utilties to make it easier to drop a spent assembly into the pool when it is removed
from the reactor core.
This file implements a simple/default representation of such as an ARMI "system". ARMI systems, like
the core are grids filled with ArmiObjects. This module also includes some helper tools to aid
transfering spent fuel assemblies from the core to the SFP.
"""
import itertools

Expand All @@ -25,12 +24,15 @@


class SpentFuelPool(ExcoreStructure):
"""TODO: JOHN: A place to put assemblies when they've been discharged. Can tell you inventory stats, etc."""
"""A place to put assemblies when they've been discharged.
This class is a core-like system object, so it has a spatial grid that Assemblies can fit in.
"""

def __init__(self, name, parent=None):
ExcoreStructure.__init__(self, name)
self.parent = parent
self.numColumns = 10 # TODO: JOHN Bad default
self.numColumns = 10 # TODO: JOHN Bad default. Can this come from the grid?

# TODO: JOHN Can I remove this default? Make it None?
# make a Cartesian assembly rack by default. Anything that really cares about the layout
Expand All @@ -46,11 +48,9 @@ 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 Assembly's locator belongs to
``self.spatialGrid``, the Assembly's existing locator will not be used. This is unlike
the Core, which would try to use the same indices, but move the locator to the Core's
grid. With a locator, the associated ``AutoFiller`` will be used.
If provided, the assembly is inserted at this location.
If it is not provided, the locator on the Assembly object will be used.
If the Assembly's loc belongs to ``self.spatialGrid``, it will not be used.
"""
if loc is not None and loc.grid is not self.spatialGrid:
raise ValueError(
Expand Down Expand Up @@ -84,14 +84,11 @@ def getAssembly(self, name):
return None

def getNextLocation(self):
"""TODO: JOHN.
Control automatic insertion of Assemblies when a specific Composite location isn't requested.
This fills the :py:class:`armi.reactor.grids.Grid` by filling subsequent rows with
``numColumns`` assemblies before moving to the next row.
"""Helper method to allow each discharged assembly to be easily dropped into the SFP.
assumes rectangular grid
The logic here is that we assume that the SFP is a rectangular-ish grid, with a set number
of columns per row. So when you add an Assembly here, if you don't provide a location, the
grid is filled in a col/row order with whatever grid cell is found open first.
"""
filledLocations = {a.spatialLocator for a in self}
grid = self.spatialGrid
Expand Down

0 comments on commit 2c441e0

Please sign in to comment.