armi.reactor.grids.grid module
- class armi.reactor.grids.grid.Grid(geomType: str | GeomType = '', symmetry: str | SymmetryType = '', armiObject: ArmiObject | None = None)[source]
Bases:
ABC
Base class that defines the interface for grids.
Most work will be done with structured grids, e.g., hexagonal grid, Cartesian grids, but some physics codes accept irregular or unstructured grids. Consider a Cartesian grid but with variable stepping between cells, where
dx
may not be constant.So here, we define an interface so things that rely on grids can worry less about how the location data are stored.
The reactor will usually have (i,j,k) coordinates to define a simple mesh for locating objects in the reactor. But inside that mesh can be a smaller mesh to define the layout of pins in a reactor, or fuel pellets in a pin, or the layout of some intricate ex-core structure.
Every time the
armi.reactor.grids.locations.IndexLocation
of an object in the reactor is returned, ARMI will look to see if the grid this object is in has aparent
, and if so, ARMI will try to sum theindices
of the two nested grids to give a resultant, more finely-grained grid position. ARMI can only handle grids nested 3 deep.- Parameters:
geomType (str or armi.reactor.geometry.GeomType) – Underlying geometric representation
symmetry (str or armi.reactor.geometry.SymmetryType) – Symmetry conditions
armiObject (optional, armi.reactor.composites.ArmiObject) – If given, what is this grid attached to or what does it describe? Something like a
armi.reactor.Core
- property symmetry: str
Symmetry applied to the grid.
Every grid contains a
armi.reactor.geometry.SymmetryType
or string that defines a grid as full core or a partial core: 1/3, 1/4, 1/8, or 1/16 core. The idea is that the user can define 1/3 or 1/4 of the reactor, so the analysis can be run faster on a smaller reactor. And if a non-full core reactor grid is defined, the boundaries of the grid can be reflective or periodic, to determine what should happen at the boundaries of the reactor core.It is important to note, that not all of these geometries will apply to every reactor or core. If your core is made of hexagonal assemblies, then a 1/3 core grid would make sense, but not if your reactor core was made up of square assemblies. Likewise, a hexagonal core would not make be able to support a 1/4 grid. You want to leave assemblies (and other objects) whole when dividing a grid up fractionally.
- abstract property isAxialOnly: bool
Indicate to parts of ARMI if this Grid handles only axial cells.
- abstract items() Iterable[Tuple[Tuple[int, int, int], IndexLocation]] [source]
Return list of ((i, j, k), IndexLocation) tuples.
- abstract locatorInDomain(locator: LocationBase, symmetryOverlap: bool | None = False) bool [source]
Return whether the passed locator is in the domain represented by the Grid.
For instance, if we have a 1/3rd core hex grid, this would return False for locators that are outside of the first third of the grid.
- Parameters:
locator (LocationBase) – The location to test
symmetryOverlap (bool, optional) – Whether grid locations along the symmetry line should be considered “in the represented domain”. This can be useful when assemblies are split along the domain boundary, with fractions of the assembly on either side.
- Returns:
If the given locator is within the given grid
- Return type:
- abstract getSymmetricEquivalents(indices: Tuple[int, int]) List[Tuple[int, int]] [source]
Return a list of grid indices that contain matching contents based on symmetry.
The length of the list will depend on the type of symmetry being used, and potentially the location of the requested indices. E.g., third-core will return the two sets of indices at the matching location in the other two thirds of the grid, unless it is the central location, in which case no indices will be returned.
- abstract overlapsWhichSymmetryLine(indices: Tuple[int, int]) int | None [source]
Return lines of symmetry position at a given index can be found.
- abstract getCoordinates(indices: Tuple[int, int, int] | List[Tuple[int, int, int]], nativeCoords: bool = False) ndarray [source]
- abstract getCellBase(indices: Tuple[int, int, int]) ndarray [source]
Return the lower left case of this cell in cm.
- abstract getCellTop(indices: Tuple[int, int, int]) ndarray [source]
Get the upper right of this cell in cm.
- static getLabel(indices)[source]
Get a string label from a 0-based spatial locator.
Returns a string representing i, j, and k indices of the locator
- abstract reduce() Tuple[Hashable, ...] [source]
Return the set of arguments used to create this Grid.
This is very much like the argument tuple from
__reduce__
, but we do not implement__reduce__
for real, because we are generally happy with__getstate__
and__setstate__
for pickling purposes. However, getting these arguments to__init__
is useful for storing Grids to the database, as they are more stable (less likely to change) than the actual internal state of the objects.The return value should be hashable, such that a set of these can be created.
The return type should be symmetric such that a similar grid can be created just with the outputs of
Grid.reduce
, e.g.,type(grid)(*grid.reduce())
Notes
For consistency, the second to last argument must be the geomType