armi.reactor.flags module

Handles flags that formally bind certain categories to reactor parts.

Flags are used to formally categorize the various ArmiObject objects that make up a reactor model. These categories allow parts of the ARMI system to treat different Assemblies, Blocks, Components, etc. differently.

By default, the specific Flags that are bound to each object are derived by that object’s name when constructed; if the name contains any valid flag names, those Flags will be assigned to the object. However, specific Flags may be specified within blueprints, in which case the name is ignored and only the explicitly-requested Flags are applied (see The Blueprints Input File for more details).

Individual Flags tend to be various nouns and adjectives that describe common objects that go into a reactor (e.g. “fuel”, “shield”, “control”, “duct”, “plenum”, etc.). In addition, there are some generic Flags (e.g., “A”, “B”, “C”, etc.) that aid in disambiguating between objects that need to be targeted separately but would otherwise have the same Flags. Flags are stored as integer bitfields within the parameter system, allowing them to be combined arbitrarily on any ARMI object. Since they are stored in bitfields, each new flag definition requires widening this bitfield; therefore, the number of defined Flags should be kept relatively small, and each flag should provide maximum utility.

Within the code, Flags are usually combined into a “type specification (TypeSpec)”, which is either a single combination of Flags, or a list of Flag combinations. More information about how TypeSpec is interpreted can be found in armi.reactor.composites.ArmiObject.hasFlags().

Flags are intended to describe what something is, rather than what something should do. Historically, Flags have been used to do both, which has led to confusion. The binding of specific behavior to certain Flags should ideally be controlled through settings with reasonable defaults, rather than being hard-coded. Currently, much of the code still uses hard-coded TypeSpecs, and certain Flags are clearly saying what something should do (e.g., Flags.DEPLETABLE).

Note

Flags have a rather storied history. Way back when, code that needed to operate on specific objects would do substring searches against object names to decide if they were relevant. This was very prone to error, and led to all sorts of surprising behavior based on the names used in input files. To improve the situation, Flags were developed to better formalize which strings mattered, and to define canonical names for things. Still almost all flag checks were hard-coded, and aside from up-front error checks, many of the original issues persisted. For instance, developing a comprehensive manual of which Flags lead to which behavior was very difficult.

Migrating the meaning of Flags into settings will allow us to better document how those Flags/settings affect ARMI’s behavior.

As mentioned above, plenty of code still hard-codes Flag TypeSpecs, and certain Flags do not follow the what something is convention. Future work should improve upon this as possible.

Things that Flags are used for include:

  • Fuel management: Different kinds of assemblies (LTAs, fuel, reflectors) have different shuffling operations and must be distinguished. Certain blocks in an assembly are stationary, and shouldn’t be moved along with the rest of the assembly when shuffling is performed. Filtering for stationary blocks can also be done using Flags (e.g., Flags.GRID_PLATE).

  • Fuel performance: Knowing what’s fuel (Flags.FUEL) and what isn’t (e.g., Flags.PLENUM) is important to figure out what things to grow and where to move fission gas to.

  • Fluid fuel reactors need to find all the fuel that ever circulates through the reactor so it can be depleted with the average flux.

  • Core Mechanical analyses often need to know if an object is solid, fluid, or void (material subclassing can handle this).

  • T/H needs to find the pin bundle in different kinds of assemblies (radial shield block in radial shield assemblies, fuel in fuel, etc.). Also needs to generate 3-layer pin models with pin (fuel/control/shield/slug), then gap (liners/gap/bond), then clad.

Examples

>>> block.hasFlags(Flags.PRIMARY | Flags.TEST | Flags.FUEL)
True
>>> block.hasFlags([Flags.PRIMARY, Flags.TEST, Flags.FUEL])
True
>>> block.getComponent(Flags.INTERDUCTCOOLANT)
<component InterDuctCoolant>
>>> block.getComponents(Flags.FUEL)
[<component fuel1>, <component fuel2>, ...]
class armi.reactor.flags.Flags(init=0)[source]

Bases: Flag

Defines the valid flags used in the framework.

PRIMARY = <Flags.PRIMARY: 1>
SECONDARY = <Flags.SECONDARY: 2>
TERTIARY = <Flags.TERTIARY: 4>
ANNULAR = <Flags.ANNULAR: 8>
A = <Flags.A: 16>
B = <Flags.B: 32>
C = <Flags.C: 64>
D = <Flags.D: 128>
E = <Flags.E: 256>
HIGH = <Flags.HIGH: 512>
MEDIUM = <Flags.MEDIUM: 1024>
LOW = <Flags.LOW: 2048>
MATERIAL = <Flags.MATERIAL: 4096>
FUEL = <Flags.FUEL: 8192>
TEST = <Flags.TEST: 16384>
CONTROL = <Flags.CONTROL: 32768>
ULTIMATE = <Flags.ULTIMATE: 65536>
SHUTDOWN = <Flags.SHUTDOWN: 131072>
SHIELD = <Flags.SHIELD: 262144>
SHIELD_BLOCK = <Flags.SHIELD_BLOCK: 524288>
SLUG = <Flags.SLUG: 1048576>
REFLECTOR = <Flags.REFLECTOR: 2097152>
DRIVER = <Flags.DRIVER: 4194304>
IGNITER = <Flags.IGNITER: 8388608>
FEED = <Flags.FEED: 16777216>
STARTER = <Flags.STARTER: 33554432>
BLANKET = <Flags.BLANKET: 67108864>
BOOSTER = <Flags.BOOSTER: 134217728>
TARGET = <Flags.TARGET: 268435456>
MOX = <Flags.MOX: 536870912>
INNER = <Flags.INNER: 1073741824>
MIDDLE = <Flags.MIDDLE: 2147483648>
OUTER = <Flags.OUTER: 4294967296>
RADIAL = <Flags.RADIAL: 8589934592>
AXIAL = <Flags.AXIAL: 17179869184>
UPPER = <Flags.UPPER: 34359738368>
LOWER = <Flags.LOWER: 68719476736>
DUCT = <Flags.DUCT: 137438953472>
GRID_PLATE = <Flags.GRID_PLATE: 274877906944>
HANDLING_SOCKET = <Flags.HANDLING_SOCKET: 549755813888>
INLET_NOZZLE = <Flags.INLET_NOZZLE: 1099511627776>
PLENUM = <Flags.PLENUM: 2199023255552>
BOND = <Flags.BOND: 4398046511104>
LINER = <Flags.LINER: 8796093022208>
CLAD = <Flags.CLAD: 17592186044416>
PIN = <Flags.PIN: 35184372088832>
GAP = <Flags.GAP: 70368744177664>
WIRE = <Flags.WIRE: 140737488355328>
COOLANT = <Flags.COOLANT: 281474976710656>
INTERCOOLANT = <Flags.INTERCOOLANT: 562949953421312>
LOAD_PAD = <Flags.LOAD_PAD: 1125899906842624>
ACLP = <Flags.ACLP: 2251799813685248>
SKID = <Flags.SKID: 4503599627370496>
VOID = <Flags.VOID: 9007199254740992>
INTERDUCTCOOLANT = <Flags.INTERDUCTCOOLANT: 18014398509481984>
DSPACERINSIDE = <Flags.DSPACERINSIDE: 36028797018963968>
GUIDE_TUBE = <Flags.GUIDE_TUBE: 72057594037927936>
FISSION_CHAMBER = <Flags.FISSION_CHAMBER: 144115188075855872>
MODERATOR = <Flags.MODERATOR: 288230376151711744>
CORE_BARREL = <Flags.CORE_BARREL: 576460752303423488>
DUMMY = <Flags.DUMMY: 1152921504606846976>
BATCHMASSADDITION = <Flags.BATCHMASSADDITION: 2305843009213693952>
POISON = <Flags.POISON: 4611686018427387904>
STRUCTURE = <Flags.STRUCTURE: 9223372036854775808>
DEPLETABLE = <Flags.DEPLETABLE: 18446744073709551616>
MOVEABLE = <Flags.MOVEABLE: 36893488147419103232>
classmethod fromStringIgnoreErrors(typeSpec)[source]
classmethod fromString(typeSpec)[source]

Retrieve flag from a string.

classmethod toString(typeSpec)[source]

Convert a flag to a string.

exception armi.reactor.flags.InvalidFlagsError[source]

Bases: KeyError

Raised when code attempts to look for an undefined flag.