armi.reactor.grids.hexagonal module
- class armi.reactor.grids.hexagonal.HexGrid(unitSteps=(0, 0, 0), bounds=(None, None, None), unitStepLimits=((0, 1), (0, 1), (0, 1)), offset=None, geomType='', symmetry='', armiObject=None)[source]
Bases:
StructuredGrid
Has 6 neighbors in plane.
It is recommended to use
fromPitch()
rather than calling the__init__
constructor directly.Notes
In an axial plane (i, j) are as follows (second one is pointedEndUp):
( 0, 1) (-1, 1) ( 1, 0) ( 0, 0) (-1, 0) ( 1,-1) ( 0,-1) ( 0, 1) ( 1, 0) (-1, 1) ( 0, 0) ( 1,-1) (-1, 0) ( 0,-1)
- static fromPitch(pitch, numRings=25, armiObject=None, pointedEndUp=False, symmetry='')[source]
Build a finite step-based 2-D hex grid from a hex pitch in cm.
- Parameters:
pitch (float) – Hex pitch (flat-to-flat) in cm
numRings (int, optional) – The number of rings in the grid to pre-populate with locatator objects. Even if positions are not pre-populated, locators will be generated there on the fly.
armiObject (ArmiObject, optional) – The object that this grid is anchored to (i.e. the reactor for a grid of assemblies)
pointedEndUp (bool, optional) – Rotate the hexagons 30 degrees so that the pointed end faces up instead of the flat.
symmetry (string, optional) – A string representation of the symmetry options for the grid.
- Returns:
A functional hexagonal grid object.
- Return type:
- property pitch: float
Get the hex-pitch of a regular hexagonal array.
See also
armi.reactor.grids.HexGrid.fromPitch
- static indicesToRingPos(i: int, j: int) Tuple[int, int] [source]
Convert spatialLocator indices to ring/position.
One benefit it has is that it never has negative numbers.
Notes
Ring, pos index system goes in counterclockwise hex rings.
- getMinimumRings(n: int) int [source]
Return the minimum number of rings needed to fit
n
objects.Notes
self
is not used because hex grids always behave the same w.r.t. rings/positions.
- getNeighboringCellIndices(i: int, j: int = 0, k: int = 0) List[Tuple[int, int, int]] [source]
Return the indices of the immediate neighbors of a mesh point in the plane.
Note that these neighbors are ordered counter-clockwise beginning from the 30 or 60 degree direction. Exact direction is dependent on pointedEndUp arg.
- getLabel(indices)[source]
Hex labels start at 1, and are ring/position based rather than i,j.
This difference is partially because ring/pos is easier to understand in hex geometry, and partially because it is used in some codes ARMI originally was focused on.
- getRingPos(indices: Tuple[int, int, int]) Tuple[int, int] [source]
Get 1-based ring and position from normal indices.
See also
getIndicesFromRingAndPos
does the reverse
- overlapsWhichSymmetryLine(indices: Tuple[int, int]) Optional[int] [source]
Return a list of which lines of symmetry this is on.
- Parameters:
indices (tuple of [int, int]) – Indices for the requested object
- Returns:
None if not line of symmetry goes through the object at the requested index. Otherwise, some grid constants like
BOUNDARY_CENTER
will be returned.- Return type:
None or int
Notes
Only the 1/3 core view geometry is actually coded in here right now.
Being “on” a symmetry line means the line goes through the middle of you.
- triangleCoords(indices: Tuple[int, int, int]) ndarray [source]
Return 6 coordinate pairs representing the centers of the 6 triangles in a hexagon centered here.
Ignores z-coordinate and only operates in 2D for now.
- isInFirstThird(locator, includeTopEdge=False) bool [source]
True if locator is in first third of hex grid.
- generateSortedHexLocationList(nLocs: int)[source]
Generate a list IndexLocations, sorted based on their distance from the center.
IndexLocation are taken from a full core.
Ties between locations with the same distance (e.g. A3001 and A3003) are broken by ring number then position number.