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(*args, **kwargs)[source]

Bases: Object

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

attributes = <yamlize.attribute_collection.AttributeCollection object>
class armi.reactor.blueprints.gridBlueprint.GridBlueprint(*args, **kwargs)[source]

Bases: 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).

Implementation: Define a lattice map in reactor core. I_ARMI_BP_GRID
signature: GridBlueprint
requirements: R_ARMI_BP_GRID

Defines a yaml construct that allows the user to specify a grid from within their blueprints file, including a name, geometry, dimensions, symmetry, and a map with the relative locations of components within that grid.

Relies on the underlying infrastructure from the yamlize package for reading from text files, serialization, and internal storage of the data.

Is implemented as part of a blueprints file by being used in key-value pairs within the Grid class, which is imported and used as an attribute within the larger Blueprints class.

Includes a construct method, which instantiates an instance of one of the subclasses of StructuredGrid. This is typically called from within construct(), which then also associates the individual components in the block with locations specifed in the grid.

Variables:
  • name (str) – The grid name

  • geom (str) – The geometry of the grid (e.g. ‘cartesian’)

  • latticeMap (str) – An asciimap representation of the lattice contents

  • latticeDimensions (Triplet) – 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.

  • gridBounds (dict) – A dictionary containing explicit grid boundaries. Specific keys used will depend on the type of grid being defined. Mutually exclusive with latticeDimensions.

  • symmetry (str) – A string defining the symmetry mode of the grid

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

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.

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.

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

Unfold the blueprints to represent full symmetry.

Notes

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.

getLocators(spatialGrid: 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: 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

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.

Implementation: Write a blueprint file from a blueprint object. I_ARMI_BP_TO_DB
signature: saveToStream
requirements: R_ARMI_BP_TO_DB

First makes a copy of the blueprints that are passed in. Then modifies any grids specified in the blueprints into a canonical lattice map style, if needed. Then uses the dump method that is inherent to all yamlize subclasses to write the blueprints to the given stream object.

If called with the full argument, the entire blueprints is dumped. If not, only the grids portion is dumped.

Parameters:
  • 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 (bool) – regardless of input form, attempt to output as a lattice map