armi.reactor.blueprints package¶
Blueprints describe the geometric and composition details of the objects in the reactor (e.g. fuel assemblies, control rods, etc.).
Inputs captured within this blueprints module pertain to major design criteria like custom material properties or basic structures like the assemblies in use.
This is essentially a wrapper for a yaml loader. The given yaml file is expected to rigidly adhere to given key:value pairings.
See the blueprints documentation for more details.
The file structure is expectation is:
nuclide flags:
AM241: {burn: true, xs: true}
...
custom isotopics: {} # optional
blocks:
name:
component name:
component dimensions
...
assemblies:
name:
specifier: ABC
blocks: [...]
height: [...]
axial mesh points: [...]
xs types: [...]
# optional
myMaterialModification1: [...]
myMaterialModification2: [...]
# optionally extra settings (note this is probably going to be a removed feature)
# hotChannelFactors: TWRPclad
Examples
>>> design = blueprints.Blueprints.load(self.yamlString)
>>> print(design.gridDesigns)
Notes
The blueprints system was built to enable round trip translations between text representations of input and objects in the code.
-
armi.reactor.blueprints.
loadFromCs
(cs, roundTrip=False)[source]¶ Function to load Blueprints based on supplied
CaseSettings
.
-
class
armi.reactor.blueprints.
_BlueprintsPluginCollector
(name, bases, data)[source]¶ Bases:
yamlize.objects.ObjectType
Simple metaclass for adding yamlize.Attributes from plugins to Blueprints.
This calls the defineBlueprintsSections() plugin hook to discover new class attributes to add before the yamlize code fires off to make the root yamlize.Object. Since yamlize.Object itself uses a metaclass to define the attributes to turn into yamlize.Attributes, these need to be folded in early.
-
class
armi.reactor.blueprints.
Blueprints
[source]¶ Bases:
yamlize.objects.Object
Base Blueprintsobject representing all the subsections in the input file.
-
nuclideFlags
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
customIsotopics
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
gridDesigns
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
componentDesigns
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
componentGroups
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
_resolveFunctions
= []¶
-
systemDesigns
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
assemDesigns
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
blockDesigns
¶ Represents an attribute of a Python class, and a key/value pair in YAML.
- Variables
name (str) – name of the attribute within the Python class
key (str) – name of the attribute within the YAML representation
type (type or ANY) – type of the attribute within the Python class. When
ANY
, the type is a pass-through and whatever YAML determines it should be will be applied.default (value or NODEFAULT) – default value if not supplied in YAML. If
default=NODEFAULT
, then the attribute must be supplied.storage_name (str) –
'_yamlized_' + name
, stored as a separate attribute for speed.
-
constructAssem
(cs, name=None, specifier=None)[source]¶ Construct a new assembly instance from the assembly designs in this Blueprints object.
- Parameters
cs (CaseSettings object) – Used to apply various modeling options when constructing an assembly.
name (str (optional, and should be exclusive with specifier)) – Name of the assembly to construct. This should match the key that was used to define the assembly in the Blueprints YAML file.
specifier (str (optional, and should be exclusive with name)) – Identifier of the assembly to construct. This should match the identifier that was used to define the assembly in the Blueprints YAML file.
- Raises
ValueError – If neither name nor specifier are passed
Notes
There is some possibility for “compiling” the logic with closures to make constructing an assembly / block / component faster. At this point is is pretty much irrelevant because we are currently just deepcopying already constructed assemblies.
Currently, this method is backward compatible with other code in ARMI and generates the .assemblies attribute (the BOL assemblies). Eventually, this should be removed.
-
_prepConstruction
(cs)[source]¶ This method initializes a bunch of information within a Blueprints object such as assigning assembly and block type numbers, resolving the nuclides in the problem, and pre-populating assemblies.
Ideally, it would not be necessary at all, but the
cs
currently contains a bunch of information necessary to create the applicable model. If it were possible, it would be terrific to override the Yamlizable.from_yaml method to run this code after the instance has been created, but we need additional information in order to build the assemblies that is not within the YAML file.This method should not be called directly, but it is used in testing.
-
_resolveNuclides
(cs)[source]¶ Process elements and determine how to expand them to natural isotopics.
Also builds meta-data about which nuclides are in the problem.
This system works by building a dictionary in the
elementsToExpand
attribute withElement
keys and list ofNuclideBase
values.The actual expansion of elementals to isotopics occurs during
Component construction
.
-
__round_trip_data
¶
-
attributes
= <yamlize.attribute_collection.AttributeCollection object>¶
-
classmethod
migrate
(inp: TextIO)[source]¶ Given a stream representation of a blueprints file, migrate it.
- Parameters
inp (typing.TextIO) – Input stream to migrate.
-
classmethod
load
(stream, roundTrip=False)[source]¶ This class method is a wrapper around the yamlize.Object.load() method.
The reason for the wrapper is to allow us to default to Cloader. Essentially, the CLoader class is 10x faster, but doesn’t allow for “round trip” (read- write) access to YAMLs; for that we have the RoundTripLoader.
-
-
armi.reactor.blueprints.
migrate
(bp: armi.reactor.blueprints.Blueprints, cs)[source]¶ Apply migrations to the input structure.
This is a good place to perform migrations that address changes to the system design description (settings, blueprints, geom file). We have access to all three here, so we can even move stuff between files. Namely, this:
creates a grid blueprint to represent the core layout from the old
geomFile
setting, and applies that grid to acore
system.moves the radial and azimuthal submesh values from the
geomFile
to the assembly designs, but only if they are uniform (this is limiting, but could be made more sophisticated in the future, if there is need)
This allows settings-driven core map to still be used for backwards compatibility. At some point once the input stabilizes, we may wish to move this out to the dedicated migration portion of the code, and not perform the migration so implicitly.