示例#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
示例#2
0
文件: __init__.py 项目: youngmit/armi
 def __init__(self):
     # again, yamlize does not call __init__, instead we use Blueprints.load which creates and
     # instance of a Blueprints object and initializes it with values using setattr. Since the
     # method is never called, it serves the purpose of preventing pylint from issuing warnings
     # about attributes not existing.
     self.systemDesigns = Systems()
     self.assemDesigns = AssemblyKeyedList()
     self.blockDesigns = BlockKeyedList()
     self.assemblies = {}
示例#3
0
文件: __init__.py 项目: pxm321/armi
 def __init__(self):
     # again, yamlize does not call __init__, instead we use Blueprints.load which
     # creates and instance of a Blueprints object and initializes it with values
     # using setattr. Since the method is never called, it serves the purpose of
     # preventing pylint from issuing warnings about attributes not existing.
     self._assembliesBySpecifier = {}
     self._prepped = False
     self.systemDesigns = Systems()
     self.assemDesigns = AssemblyKeyedList()
     self.blockDesigns = BlockKeyedList()
     self.assemblies = {}
     self.grids = Grids()
     self.elementsToExpand = []