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¶
-
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¶
-
property
label
¶ Human-presentable label
-
-
class
armi.reactor.geometry.
BoundaryType
[source]¶ Bases:
enum.Enum
Enumeration of boundary types.
-
NO_SYMMETRY
= 0¶
-
PERIODIC
= 1¶
-
REFLECTIVE
= 2¶
-
property
label
¶ Human-presentable label
-
-
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)}¶
-
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()
checksProvide 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.
-