armi.reactor.grids.tests.test_grids module

Tests for grids.

class armi.reactor.grids.tests.test_grids.MockLocator(i: int, j: int, k: int, grid: Grid | None)[source]

Bases: IndexLocation

Locator subclass that with direct location -> location paternity (to avoid needing blocks, assems).

property parentLocation
class armi.reactor.grids.tests.test_grids.MockCoordLocator(i: int, j: int, k: int, grid: Grid | None)[source]

Bases: CoordinateLocation

property parentLocation
class armi.reactor.grids.tests.test_grids.MockArmiObject(parent=None)[source]

Bases: object

Any sort of object that can serve as a grid’s armiObject attribute.

class armi.reactor.grids.tests.test_grids.MockStructuredGrid(unitSteps=(0, 0, 0), bounds=(None, None, None), unitStepLimits=((0, 1), (0, 1), (0, 1)), offset=None, geomType='', symmetry='', armiObject=None)[source]

Bases: StructuredGrid

Need a concrete class to test a lot of inherited methods.

Abstract methods from the parent now raise NotImplementedError

getIndicesFromRingAndPos(**kwargs)
getMinimumRings(**kwargs)
getPositionsInRing(**kwargs)
getSymmetricEquivalents(**kwargs)
locatorInDomain(**kwargs)
overlapsWhichSymmetryLine(**kwargs)
pitch(**kwargs)
class armi.reactor.grids.tests.test_grids.TestSpatialLocator(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_add()[source]
test_multiIndexEq()[source]

Check multi index locations are only true if they live on the same grid and have the same locations.

test_multiIndexEqWithLocations()[source]

Two multi index locators on the same grid are equal.

test_coordinateLocationEq()[source]

Test for equality on the coordinate location object.

test_coordinateLocationHash()[source]

Ensure we can hash the location based on it’s position, not the grid.

test_recursion()[source]

Make sure things work as expected with a chain of locators/grids/locators.

This makes a Cartesian-like reactor out of unit cubes. The origin is in the center of the central cube radially and the bottom axially due to the different way steps and bounds are set up.

test_recursionPin()[source]

Ensure pin the center assem has axial coordinates consistent with a pin in an off-center assembly.

class armi.reactor.grids.tests.test_grids.TestGrid(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_basicPosition()[source]

Ensure a basic Cartesian grid works as expected.

The default stepped grid defines zero at the center of the (0,0,0)th cell. Its centroid is 0., 0., 0). This convention is nicely compatible with 120-degree hex grid.

Full core Cartesian meshes will want to be shifted to bottom left of 0th cell.

test_neighbors()[source]
test_label()[source]
test_isAxialOnly()[source]
test_lookupFactory()[source]
test_quasiReduce()[source]

Make sure our DB-friendly version of reduce works.

test_generateSortedHexLocationList()[source]
test_getitem()[source]

Test that locations are created on demand, and the multi-index locations are returned when necessary.

Test Case: Return the locations of grid items with multiplicity greater than one. T_ARMI_GRID_ELEM_LOC
signature: test_getitem
requirements: R_ARMI_GRID_ELEM_LOC
test_ringPosFromIndicesIncorrect()[source]

Test the getRingPos fails if there is no armiObect or parent.

class armi.reactor.grids.tests.test_grids.TestHexGrid(methodName='runTest')[source]

Bases: TestCase

A set of tests for the Hexagonal Grid.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_getCoordinatesFlatsUp()[source]

Test getCoordinates() for flats up hex grids.

test_getCoordinatesCornersUp()[source]

Test getCoordinates() for corners up hex grids.

test_getLocalCoordinatesHex()[source]

Test getLocalCoordinates() is different for corners up vs flats up hex grids.

test_getLocalCoordinatesCornersUp()[source]

Test getLocalCoordinates() for corners up hex grids.

test_getLocalCoordinatesFlatsUp()[source]

Test getLocalCoordinates() for flats up hex grids.

test_neighbors()[source]
test_ringPosFromIndices()[source]

Test conversion from<–>to ring/position based on hand-prepared right answers.

test_label()[source]
test_overlapsWhichSymmetryLine()[source]
test_getSymmetricIdenticalsThird()[source]

Retrieve equivalent contents based on third symmetry.

Test Case: Equivalent contents in third geometry are retrievable. T_ARMI_GRID_EQUIVALENTS
signature: test_getSymmetricIdenticalsThird
test_thirdAndFullSymmetry()[source]

Test that we can construct a full and a 1/3 core grid.

Test Case: Test 1/3 and full cores have the correct positions and rings. T_ARMI_GRID_SYMMETRY
signature: test_thirdAndFullSymmetry
requirements: R_ARMI_GRID_SYMMETRY
test_cornersUpFlatsUp()[source]

Test the cornersUp attribute of the fromPitch method.

Test Case: Build a points-up and a flats-up hexagonal grids. T_ARMI_GRID_HEX_TYPE
signature: test_cornersUpFlatsUp
requirements: R_ARMI_GRID_HEX_TYPE
test_triangleCoords()[source]
test_getIndexBounds()[source]
test_getAllIndices()[source]
test_buildLocations()[source]
test_is_pickleable()[source]
test_adjustPitchFlatsUp()[source]

Adjust the pitch of a hexagonal lattice, for a flats up grid.

Test Case: Construct a hexagonal lattice with three rings. T_ARMI_GRID_HEX0
signature: test_adjustPitchFlatsUp
requirements: R_ARMI_GRID_HEX
Test Case: Return the grid coordinates of different locations. T_ARMI_GRID_GLOBAL_POS0
signature: test_adjustPitchFlatsUp
test_adjustPitchCornersUp()[source]

Adjust the pich of a hexagonal lattice, for a “corners up” grid.

Test Case: Construct a hexagonal lattice with three rings. T_ARMI_GRID_HEX1
signature: test_adjustPitchCornersUp
requirements: R_ARMI_GRID_HEX
Test Case: Return the grid coordinates of different locations. T_ARMI_GRID_GLOBAL_POS1
signature: test_adjustPitchCornersUp
test_badIndices()[source]
test_isInFirstThird()[source]

Determine if grid is in the first third.

Test Case: Determine if grid is in the first third. T_ARMI_GRID_SYMMETRY_LOC
signature: test_isInFirstThird
test_indicesAndEdgeFromRingAndPos()[source]
test_rotatedIndices()[source]

Test that a hex grid can produce a rotated cell location.

test_inconsistentRotationGrids()[source]

Test that only locations in consistent grids are rotatable.

test_rotatedIndexGridAssignment()[source]

Test that the grid of the rotated index is identical through rotation.

test_rotatedIndexRoughEqualPitch()[source]

Test indices can be rotated in close but not exactly equal grids.

class armi.reactor.grids.tests.test_grids.TestBoundsDefinedGrid(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_positions()[source]
test_base()[source]
test_positionsMixedDefinition()[source]
test_getIndexBounds()[source]
class armi.reactor.grids.tests.test_grids.TestThetaRZGrid(methodName='runTest')[source]

Bases: TestCase

A set of tests for the RZTheta Grid.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_positions()[source]
class armi.reactor.grids.tests.test_grids.TestCartesianGrid(methodName='runTest')[source]

Bases: TestCase

A set of tests for the Cartesian Grid.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_ringPosNoSplit()[source]
test_ringPosSplit()[source]
test_symmetry()[source]
class armi.reactor.grids.tests.test_grids.TestAxialGrid(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_simpleBounds()[source]
test_getLocations()[source]