armi.reactor.grids.grid module
- class armi.reactor.grids.grid.Grid(geomType: Union[str, GeomType] = '', symmetry: Union[str, SymmetryType] = '', armiObject: Optional[ArmiObject] = 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.
- 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
- 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: Optional[bool] = 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]) Optional[int] [source]
Return lines of symmetry position at a given index can be found.
- abstract getCoordinates(indices: Union[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