armi.reactor.geometry module

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

class armi.reactor.geometry.GeomType(value)[source]

Bases: 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
classmethod fromAny(source: Union[str, GeomType]) GeomType[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 geomType 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.

classmethod fromStr(geomStr: str) GeomType[source]
property label

Human-presentable label.

class armi.reactor.geometry.DomainType(value)[source]

Bases: Enum

Enumeration of shape types.

NULL = 0
FULL_CORE = 1
THIRD_CORE = 3
QUARTER_CORE = 4
EIGHTH_CORE = 8
SIXTEENTH_CORE = 16
classmethod fromAny(source: Union[str, DomainType]) DomainType[source]
classmethod fromStr(shapeStr: str) DomainType[source]
property label

Human-presentable label.

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

Bases: Enum

Enumeration of boundary types.

NO_SYMMETRY = 0
PERIODIC = 1
REFLECTIVE = 2
classmethod fromAny(source: Union[str, BoundaryType]) BoundaryType[source]
classmethod fromStr(symmetryStr: str) BoundaryType[source]
property label

Human-presentable label.

hasSymmetry()[source]
class armi.reactor.geometry.SymmetryType(domainType: DomainType = DomainType.THIRD_CORE, boundaryType: BoundaryType = BoundaryType.PERIODIC, 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.PERIODIC: 1>, False), (<DomainType.EIGHTH_CORE: 8>, <BoundaryType.REFLECTIVE: 2>, False), (<DomainType.FULL_CORE: 1>, <BoundaryType.NO_SYMMETRY: 0>, False), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.REFLECTIVE: 2>, True), (<DomainType.EIGHTH_CORE: 8>, <BoundaryType.REFLECTIVE: 2>, True), (<DomainType.SIXTEENTH_CORE: 16>, <BoundaryType.PERIODIC: 1>, False), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.PERIODIC: 1>, True), (<DomainType.EIGHTH_CORE: 8>, <BoundaryType.PERIODIC: 1>, True), (<DomainType.SIXTEENTH_CORE: 16>, <BoundaryType.REFLECTIVE: 2>, False), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.REFLECTIVE: 2>, False), (<DomainType.QUARTER_CORE: 4>, <BoundaryType.PERIODIC: 1>, False), (<DomainType.THIRD_CORE: 3>, <BoundaryType.PERIODIC: 1>, False), (<DomainType.FULL_CORE: 1>, <BoundaryType.NO_SYMMETRY: 0>, True)}
classmethod createValidSymmetryStrings()[source]

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

classmethod fromStr(symmetryString: str) SymmetryType[source]

Construct a SymmetryType object from a valid string.

classmethod fromAny(source: Union[str, SymmetryType]) SymmetryType[source]
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.