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
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. """ # TODO: After moving SystemLayoutInput out of geometry.py, we may be able to # move this back out to top-level without causing blueprint import order issues. from armi.reactor.blueprints.gridBlueprint import GridBlueprint geom = self.geomType symmetry = self.symmetry bounds = None if self.geomType == geometry.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 self.geomType == geometry.GeomType.HEX: i, j = grids.HexGrid.getIndicesFromRingAndPos(*indices) elif self.geomType == geometry.GeomType.RZT: 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 self.geomType == geometry.GeomType.HEX: i, j = grids.HexGrid.getIndicesFromRingAndPos(*idx) elif self.geomType == geometry.GeomType.RZT: 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