Esempio n. 1
0
def migrate(bp: Blueprints, cs):
    """
    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 a ``core`` 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.
    """
    from armi.reactor import blueprints
    from armi.reactor.blueprints import gridBlueprint

    if bp.systemDesigns is None:
        bp.systemDesigns = Systems()
    if bp.gridDesigns is None:
        bp.gridDesigns = gridBlueprint.Grids()

    if "core" in [rd.name for rd in bp.gridDesigns]:
        raise ValueError("Cannot auto-create a 2nd `core` grid. Adjust input.")

    geom = geometry.SystemLayoutInput()
    geom.readGeomFromFile(os.path.join(cs.inputDirectory, cs["geomFile"]))
    gridDesigns = geom.toGridBlueprints("core")
    for design in gridDesigns:
        bp.gridDesigns[design.name] = design

    if "core" in [rd.name for rd in bp.systemDesigns]:
        raise ValueError(
            "Core map is defined in both the ``geometry`` setting and in "
            "the blueprints file. Only one definition may exist. "
            "Update inputs."
        )
    bp.systemDesigns["core"] = SystemBlueprint("core", "core", Triplet())

    if geom.geomType in (geometry.RZT, geometry.RZ):
        aziMeshes = {indices[4] for indices, _ in geom.assemTypeByIndices.items()}
        radMeshes = {indices[5] for indices, _ in geom.assemTypeByIndices.items()}

        if len(aziMeshes) > 1 or len(radMeshes) > 1:
            raise ValueError(
                "The system layout described in {} has non-uniform "
                "azimuthal and/or radial submeshing. This migration is currently "
                "only smart enough to handle a single radial and single azimuthal "
                "submesh for all assemblies.".format(cs["geomFile"])
            )
        radMesh = next(iter(radMeshes))
        aziMesh = next(iter(aziMeshes))

        for _, aDesign in bp.assemDesigns.items():
            aDesign.radialMeshPoints = radMesh
            aDesign.azimuthalMeshPoints = aziMesh
Esempio n. 2
0
def migrate(bp, cs):
    """
    Make a system and a grid representing the Core from a ``geomFile`` setting.

    This allows settings-driven core map for backwards compatibility.
    """
    from armi.reactor.blueprints import gridBlueprint

    if bp.systemDesigns is None:
        bp.systemDesigns = Systems()
    if bp.gridDesigns is None:
        bp.gridDesigns = gridBlueprint.Grids()

    if "core" in [rd.name for rd in bp.gridDesigns]:
        raise ValueError("Cannot auto-create a 2nd `core` grid. Adjust input.")
    bp.gridDesigns["core"] = gridBlueprint.GridBlueprint(
        "core",
        latticeFile=cs["geomFile"],
    )

    if "core" in [rd.name for rd in bp.systemDesigns]:
        raise ValueError(
            "Core map is defined in both the ``geometry`` setting and in "
            "the blueprints file. Only one definition may exist. "
            "Update inputs.")
    bp.systemDesigns["core"] = SystemBlueprint("core", "core", Triplet())
Esempio n. 3
0
def buildGrids():
    """Build the core map grid"""

    coreGrid = gridBlueprint.GridBlueprint("core")
    coreGrid.geom = "hex"
    coreGrid.symmetry = "third periodic"
    coreGrid.origin = gridBlueprint.Triplet()

    coreGrid.latticeMap = """
         RR   RR
           IC   RR
         IC   IC   RR"""

    grids = gridBlueprint.Grids()
    grids["core"] = coreGrid
    return grids