コード例 #1
0
    def growToFullCore(self):
        """
        Convert geometry input to full core.

        Notes
        -----
        This only works for Hex 1/3rd core geometry inputs.
        """
        if self.symmetry == FULL_CORE:
            # already full core from geometry file. No need to copy symmetry over.
            runLog.important(
                "Detected that full core geometry already exists. Cannot expand."
            )
            return
        elif self.symmetry != THIRD_CORE + PERIODIC:
            raise ValueError(
                "Cannot convert symmetry `{}` to full core, must be {}".format(
                    self.symmetry, THIRD_CORE + PERIODIC
                )
            )

        grid = grids.hexGridFromPitch(1.0)

        # need to cast to a list because we will modify during iteration
        for (ring, pos), specifierID in list(self.assemTypeByIndices.items()):
            indices = grids.getIndicesFromRingAndPos(ring, pos)
            for symmetricI, symmetricJ in grid.getSymmetricIdenticalsThird(indices):
                symmetricRingPos = grids.indicesToRingPos(symmetricI, symmetricJ)
                self.assemTypeByIndices[symmetricRingPos] = specifierID

        self.symmetry = FULL_CORE
コード例 #2
0
    def addDetailAssembliesBOL(self):
        """
        Find and activate assemblies that the user requested detailed treatment of.
        """
        if self.cs["detailAssemLocationsBOL"]:
            for locLabel in self.cs["detailAssemLocationsBOL"]:
                ring, pos, _axial = grids.ringPosFromRingLabel(locLabel)
                i, j = grids.getIndicesFromRingAndPos(ring, pos)
                aLoc = self.r.core.spatialGrid[i, j, 0]
                try:
                    a = self.r.core.childrenByLocator[aLoc]
                except KeyError:
                    runLog.error(
                        "Detail assembly in location {} (requested via "
                        "`detailAssemLocationsBOL`) is not in core. "
                        "Update settings.".format(locLabel))
                    raise
                self.addDetailAssembly(a)

        if self.cs["detailAllAssems"]:
            for a in self.r.getAssemblies():
                if a.hasFlags(Flags.FUEL):
                    self.addDetailAssembly(a)

        # This also gets called at BOC but we still
        # do it here for operators that do not call BOC.
        self.addDetailAssemsByAssemNums()
コード例 #3
0
    def _writeAsciiMap(self):
        """Generate an ASCII map representation."""
        lattice = {}
        for ring, pos in sorted(list(self.assemTypeByIndices)):
            specifier = self.assemTypeByIndices[(ring, pos)]
            i, j = grids.getIndicesFromRingAndPos(ring, pos)
            lattice[i, j] = specifier

        geomMap = asciimaps.AsciiMapHexThird(lattice)
        geomMap.writeMap(sys.stdout)
コード例 #4
0
    def toGridBlueprint(self, name: str = "core"):
        """Migrate old-style SystemLayoutInput to new GridBlueprint."""
        from armi.reactor.blueprints.gridBlueprint import GridBlueprint

        geom = self.geomType
        symmetry = self.symmetry

        bounds = None

        if self.geomType == RZT:
            # We need a grid in order to go from whats in the input to indices, and to
            # be able to provide grid bounds to the blueprint.
            rztGrid = grids.thetaRZGridFromGeom(self)
            theta, r, _ = rztGrid.getBounds()
            bounds = {"theta": theta, "r": r}

        gridContents = dict()
        for indices, spec in self.assemTypeByIndices.items():
            if HEX in self.geomType:
                i, j = grids.getIndicesFromRingAndPos(*indices)
            elif RZT in self.geomType:
                i, j, _ = rztGrid.indicesOfBounds(*indices[0:4])
            else:
                i, j = indices
            gridContents[i, j] = spec

        bp = GridBlueprint(
            name=name,
            gridContents=gridContents,
            geom=geom,
            symmetry=symmetry,
            gridBounds=bounds,
        )

        bp.eqPathInput = self.eqPathInput

        return bp
コード例 #5
0
ファイル: geometry.py プロジェクト: Jimmy-INL/armi
    def toGridBlueprints(self, name: str = "core"):
        """
        Migrate old-style SystemLayoutInput to new GridBlueprint.

        Returns a list of GridBlueprint objects. There will at least be one entry,
        containing the main core layout. If equilibrium fuel paths are specified, it
        will occupy the second element.
        """
        from armi.reactor.blueprints.gridBlueprint import GridBlueprint

        geom = self.geomType
        symmetry = self.symmetry

        bounds = None

        if self.geomType == RZT:
            # We need a grid in order to go from whats in the input to indices, and to
            # be able to provide grid bounds to the blueprint.
            rztGrid = grids.ThetaRZGrid.fromGeom(self)
            theta, r, _ = rztGrid.getBounds()
            bounds = {"theta": theta.tolist(), "r": r.tolist()}

        gridContents = dict()
        for indices, spec in self.assemTypeByIndices.items():
            if HEX in self.geomType:
                i, j = grids.getIndicesFromRingAndPos(*indices)
            elif RZT in self.geomType:
                i, j, _ = rztGrid.indicesOfBounds(*indices[0:4])
            else:
                i, j = indices
            gridContents[(i, j)] = spec

        bp = GridBlueprint(
            name=name,
            gridContents=gridContents,
            geom=geom,
            symmetry=symmetry,
            gridBounds=bounds,
        )

        bps = [bp]

        if any(val != (None, None) for val in self.eqPathInput.values()):
            # We could probably just copy eqPathInput, but we don't want to preserve
            # (None, None) entries.
            eqPathContents = dict()
            for idx, eqPath in self.eqPathInput.items():
                if eqPath == (None, None):
                    continue
                if HEX in self.geomType:
                    i, j = grids.getIndicesFromRingAndPos(*idx)
                elif RZT in self.geomType:
                    i, j, _ = rztGrid.indicesOfBounds(*idx[0:4])
                else:
                    i, j = idx
                eqPathContents[i, j] = copy(self.eqPathInput[idx])

            pathBp = GridBlueprint(
                name=name + "EqPath",
                gridContents=eqPathContents,
                geom=geom,
                symmetry=symmetry,
                gridBounds=bounds,
            )

            bps.append(pathBp)

        return bps