armi.reactor.geometry module

This module contains constants and enumerations that are useful for describing system geometry.

class armi.reactor.geometry.GeomType[source]

Bases: enum.Enum

Enumeration of geometry types.

Historically, ARMI has used strings to specify and express things like geometry type and symmetry conditions. This makes interpretation of user input straightforward, but is less ergonomic, less efficient, and more error-prone within the code. For instance:

  • is “quarter reflective” the same as “reflective quarter”? Should it be?

  • code that needs to interpret these need to use string operations, which are non-trivial compared to enum comparisons.

  • rules about mutual exclusion (hex and Cartesian can’t both be used in the same context) and composability (geometry type + domain + symmetry type) are harder to enforce.

Instead, we hope to parse user input into a collection of enumerations and use those internally throughout the code. Future work should expand this to satisfy all needs of the geometry system and refactor to replace use of the string constants.

HEX = 1
CARTESIAN = 2
RZT = 3
RZ = 4
fromAny = <bound method GeomType.fromAny of <enum 'GeomType'>>[source]
fromStr = <bound method GeomType.fromStr of <enum 'GeomType'>>[source]
property label

Human-presentable label

class armi.reactor.geometry.DomainType[source]

Bases: enum.Enum

Enumeration of shape types.

NULL = 0
FULL_CORE = 1
THIRD_CORE = 3
QUARTER_CORE = 4
EIGHTH_CORE = 8
SIXTEENTH_CORE = 16
fromAny = <bound method DomainType.fromAny of <enum 'DomainType'>>[source]
fromStr = <bound method DomainType.fromStr of <enum 'DomainType'>>[source]
property label

Human-presentable label

symmetryFactor() → float[source]
class armi.reactor.geometry.BoundaryType[source]

Bases: enum.Enum

Enumeration of boundary types.

NO_SYMMETRY = 0
PERIODIC = 1
REFLECTIVE = 2
fromAny = <bound method BoundaryType.fromAny of <enum 'BoundaryType'>>[source]
fromStr = <bound method BoundaryType.fromStr of <enum 'BoundaryType'>>[source]
property label

Human-presentable label

hasSymmetry()[source]
class armi.reactor.geometry.SymmetryType(domainType: armi.reactor.geometry.DomainType = <DomainType.THIRD_CORE: 3>, boundaryType: armi.reactor.geometry.BoundaryType = <BoundaryType.PERIODIC: 1>, throughCenterAssembly: Optional[bool] = False)[source]

Bases: object

A wrapper for DomainType and BoundaryType enumerations.

The goal of this class is to provide simple functions for storing these options in enumerations and using them to check symmetry conditions, while also providing a standard string representation of the options that facilitates interfacing with yaml and/or the database nicely.

VALID_SYMMETRY = {(<DomainType.EIGHTH_CORE: 8>, <BoundaryType.REFLECTIVE: 2>, False), (<DomainType.FULL_CORE: 1>, <BoundaryType.NO_SYMMETRY: 0>, True), (<DomainType.THIRD_CORE: 3>, <BoundaryType.PERIODIC: 1>, False), (<DomainType.SIXTEENTH_CORE: 16>, <BoundaryType.REFLECTIVE: 2>, False), (<DomainType.FULL_CORE: 1>, <BoundaryType.NO_SYMMETRY: 0>, False), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.REFLECTIVE: 2>, True), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.PERIODIC: 1>, True), (<DomainType.EIGHTH_CORE: 8>, <BoundaryType.PERIODIC: 1>, True), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.PERIODIC: 1>, False), (<DomainType.EIGHTH_CORE: 8>, <BoundaryType.PERIODIC: 1>, False), (<DomainType.SIXTEENTH_CORE: 16>, <BoundaryType.PERIODIC: 1>, False), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.REFLECTIVE: 2>, False), (<DomainType.EIGHTH_CORE: 8>, <BoundaryType.REFLECTIVE: 2>, True)}
static _checkIfThroughCenter(centerString: str) → bool[source]
classmethod createValidSymmetryStrings()[source]

Create a list of valid symmetry strings based on the set of tuples in VALID_SYMMETRY

classmethod fromStr(symmetryString: str) → armi.reactor.geometry.SymmetryType[source]

Construct a SymmetryType object from a valid string

classmethod fromAny(source: Union[str, SymmetryType]) → armi.reactor.geometry.SymmetryType[source]

Safely convert from string representation, no-op if already an enum instance.

This is useful as we transition to using enumerations more throughout the code. There will remain situations where a SymmetryType may be provided in string or enum form, in which the consuming code would have to check the type before proceeding. This function serves two useful purposes:

  • Relieve client code from having to if/elif/else on isinstance() checks

  • Provide a location to instrument these conversions for when we actually try to deprecate the strings. E.g., produce a warning when this is called, or eventually forbidding the conversion entirely.

__str__()[source]

Combined string of domain and boundary symmetry type

__eq__(other)[source]

Compare two SymmetryType instances. False if other is not a SymmetryType.

__hash__()[source]

Hash a SymmetryType object based on a tuple of its options.

checkValidSymmetry() → bool[source]

Check if the tuple representation of the SymmetryType can be found in VALID_SYMMETRY.

symmetryFactor() → float[source]
armi.reactor.geometry.checkValidGeomSymmetryCombo(geomType: Union[str, GeomType], symmetryInput: Union[str, SymmetryType]) → bool[source]

Check if the given combination of GeomType and SymmetryType is valid. Return a boolean indicating the outcome of the check.