armi.reactor.blueprints.gridBlueprint module

Input definitions for Grids.

Grids are given names which can be referred to on other input structures (like core maps and pin maps).

These are in turn interpreted into concrete things at lower levels. For example:

  • Core map lattices get turned into armi.reactor.grids, which get set to core.spatialGrid.

  • Block pin map lattices get applied to the components to provide some subassembly spatial details

Lattice inputs here are floating in space. Specific dimensions and anchor points are handled by the lower-level objects definitions. This is intended to maximize lattice reusability.

See also

armi.utils.asciimaps

Description of the ascii maps and their formats.

Examples

grids:
    control:
        geom: hex
        symmetry: full
        lattice map: |
           - - - - - - - - - 1 1 1 1 1 1 1 1 1 4
            - - - - - - - - 1 1 1 1 1 1 1 1 1 1 1
             - - - - - - - 1 8 1 1 1 1 1 1 1 1 1 1
              - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1
               - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                 - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                  - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                   - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                    7 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1
                     1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1
                      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                       1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                        1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                         1 1 1 1 1 1 1 1 1 1 1 1 1 1
                          1 1 1 1 1 1 1 1 1 3 1 1 1
                           1 1 1 1 1 1 1 1 1 1 1 1
                            1 6 1 1 1 1 1 1 1 1 1
                             1 1 1 1 1 1 1 1 1 1
    sfp:
        geom: cartesian
        lattice pitch:
            x: 25.0
            y: 25.0
        lattice map: |
            2 2 2 2 2
            2 1 1 1 2
            2 1 3 1 2
            2 3 1 1 2
            2 2 2 2 2

    core:
        geom: hex
        symmetry: third periodic
        origin:
            x: 0.0
            y: 10.1
            z: 1.1
        lattice map: |
            -     SH   SH   SH
            -  SH   SH   SH   SH
             SH   RR   RR   RR   SH
               RR   RR   RR   RR   SH
             RR   RR   RR   RR   RR   SH
               RR   OC   OC   RR   RR   SH
                 OC   OC   OC   RR   RR   SH
               OC   OC   OC   OC   RR   RR
                 OC   MC   OC   OC   RR   SH
                   MC   MC   PC   OC   RR   SH
                 MC   MC   MC   OC   OC   RR
                   MC   MC   MC   OC   RR   SH
                     PC   MC   MC   OC   RR   SH
                   MC   MC   MC   MC   OC   RR
                     IC   MC   MC   OC   RR   SH
                       IC   US   MC   OC   RR
                     IC   IC   MC   OC   RR   SH
                       IC   MC   MC   OC   RR
                     IC   IC   MC   PC   RR   SH
class armi.reactor.blueprints.gridBlueprint.Triplet(x=0.0, y=0.0, z=0.0)[source]

Bases: yamlize.objects.Object

A x, y, z triplet for coordinates or lattice pitch.

x

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

y

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

z

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

__round_trip_data
attributes = <yamlize.attribute_collection.AttributeCollection object>
class armi.reactor.blueprints.gridBlueprint.GridBlueprint(name=None, geom='hex', latticeMap=None, symmetry='third periodic', gridContents=None, gridBounds=None)[source]

Bases: yamlize.objects.Object

A grid input blueprint.

These directly build Grid objects and contain information about how to populate the Grid with child ArmiObjects for the Reactor Model.

The grids get origins either from a parent block (for pin lattices) or from a System (for Cores, SFPs, and other components).

name

The grid name

Type

str

geom

The geometry of the grid (e.g. ‘cartesian’)

Type

str

latticeMap

An asciimap representation of the lattice contents

Type

str

latticeDimensions

An x/y/z Triplet with grid dimensions in cm. This is used to specify a uniform grid, such as Cartesian or Hex. Mutually exclusive with gridBounds.

Type

Triplet

gridBounds

A dictionary containing explicit grid boundaries. Specific keys used will depend on the type of grid being defined. Mutually exclusive with latticeDimensions.

Type

dict

symmetry

A string defining the symmetry mode of the grid

Type

str

gridContents

A {(i,j): str} dictionary mapping spatialGrid indices in 2-D to string specifiers of what’s supposed to be in the grid.

Type

dict

A Grid blueprint.

Notes

yamlize does not call an __init__ method, instead it uses __new__ and setattr this is only needed for when you want to make this object from a non-YAML source.

Warning

This is a Yamlize object, so __init__ never really gets called.

Only __new__ does.

latticeDimensions

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

name

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

geom

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

latticeMap

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

symmetry

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

gridContents

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

gridBounds

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

property readFromLatticeMap

This is implemented as a property, since as a Yamlize object, __init__ is not always called and we have to lazily evaluate its default value.

construct()[source]

Build a Grid from a grid definition.

_constructSpatialGrid()[source]

Build spatial grid.

If you do not enter latticeDimensions, a unit grid will be produced which must be adjusted to the proper dimensions (often by inspection of children) at a later time.

_getMaxIndex()[source]

Find the max index in the grid contents.

Used to limit the size of the spatialGrid. Used to be called maxNumRings.

expandToFull()[source]

Unfold the blueprints to represent full symmetry.

Note

This relatively rudimentary, and copies entries from the currently-represented domain to their corresponding locations in full symmetry. This may not produce the desired behavior for some scenarios, such as when expanding fuel shuffling paths or the like. Future work may make this more sophisticated.

__round_trip_data
_readGridContents()[source]

Read the specifiers as a function of grid position.

The contents can either be provided as:

  • A dict mapping indices to specifiers (default output of this)

  • An asciimap

The output will always be stored in self.gridContents.

attributes = <yamlize.attribute_collection.AttributeCollection object>
_readGridContentsLattice()[source]

Read an ascii map of grid contents.

This update the gridContents attribute, which is a dict mapping grid i,j,k indices to textual specifiers (e.g. IC))

getLocators(spatialGrid: armi.reactor.grids.Grid, latticeIDs: list)[source]

Return spatialLocators in grid corresponding to lattice IDs.

This requires a fully-populated gridContents attribute.

getMultiLocator(spatialGrid, latticeIDs)[source]

Create a MultiIndexLocation based on lattice IDs.

class armi.reactor.blueprints.gridBlueprint.Grids(*args, **kwargs)[source]

Bases: yamlize.maps.KeyedList

Initialize a Map.

Parameters
  • *args

    sequence of key/value pairs.

  • **kwargs

    kwargs for input to OrderedDict.

attributes = <yamlize.attribute_collection.KeyedListAttributeCollection object>
item_type

alias of GridBlueprint

key_attr

Represents an attribute of a Python class, and a key/value pair in YAML.

name

name of the attribute within the Python class

Type

str

key

name of the attribute within the YAML representation

Type

str

type

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.

Type

type or ANY

default

default value if not supplied in YAML. If default=NODEFAULT, then the attribute must be supplied.

Type

value or NODEFAULT

storage_name

'_yamlized_' + name, stored as a separate attribute for speed.

Type

str

armi.reactor.blueprints.gridBlueprint._isMonotonicUnique(l: Sequence[float]) → bool[source]

Check that the provided sequence increases monotonically, and has no duplicates.

armi.reactor.blueprints.gridBlueprint._getGridSize(idx) → Tuple[int, int][source]

Return the number of spaces between the min and max of a collection of (int, int) tuples, inclusive.

This essentially returns the number of grid locations along the i, and j dimesions, given the (i,j) indices of each occupied location. This is useful for determining certain grid offset behavior.

armi.reactor.blueprints.gridBlueprint._filterOutsideDomain(gridBp)[source]

Remove grid contents that lie outside the represented domain.

This removes extra objects; ARMI allows the user input specifiers in regions outside of the represented domain, which is fine as long as the contained specifier is consistent with the corresponding region in the represented domain given the symmetry condition. For instance, if we have a 1/3-core hex model, it is typically okay for an assembly to be specified outside of the first 1/3rd of the core, as long as it is the same assembly as would be there when expanding the first 1/3rd into a full-core model.

However, we do not really want these hanging around, since editing the represented 1/Nth of the core will probably lead to consistency issues, so we remove them.

armi.reactor.blueprints.gridBlueprint.saveToStream(stream, bluep, full=False, tryMap=False)[source]

Save the blueprints to the passed stream.

This can save either the entire blueprints, or just the grids: section of the blueprints, based on the passed full argument. Saving just the grid blueprints can be useful when cobbling blueprints together with !include flags.

stream: file output stream of some kind bluep: armi.reactor.blueprints.Blueprints, or Grids full: bool ~ Is this a full output file, or just a partial/grids? tryMap: regardless of input form, attempt to output as a lattice map. let’s face it; they’re prettier.