Beispiel #1
0
 def manageFuel(self, cycle):
     """Perform the fuel management for this cycle."""
     fh = fuelHandlerFactory.fuelHandlerFactory(self.o)
     fh.prepCore()
     fh.prepShuffleMap()
     # take note of where each assembly is located before the outage
     # for mapping after the outage
     self.r.core.locateAllAssemblies()
     shuffleFactors, _ = fh.getFactorList(cycle)
     fh.outage(shuffleFactors)  # move the assemblies around
     if self.cs["plotShuffleArrows"]:
         arrows = fh.makeShuffleArrows()
         plotting.plotFaceMap(
             self.r.core,
             "percentBu",
             labelFmt=None,
             fName="{}.shuffles_{}.png".format(self.cs.caseTitle,
                                               self.r.p.cycle),
             shuffleArrows=arrows,
         )
         plotting.close()
Beispiel #2
0
def insertBlockDiagrams(cs, blueprint, report, cold):
    """Adds Block Diagrams to the report

    Parameters
    ----------
    cs: Case Settings
    blueprint: Blueprint
    report: ReportContent
    cold: boolean
        True for dimensions at cold temps
    """
    materialList = []
    for bDesign in blueprint.blockDesigns:
        block = bDesign.construct(cs, blueprint, 0, 1, 0, "A", dict())
        for component in block:
            if isinstance(component.material, custom.Custom):
                materialName = component.p.customIsotopicsName
            else:
                materialName = component.material.name
            if materialName not in materialList:
                materialList.append(materialName)

    report[DESIGN]["Block Diagrams"] = newReports.Section("Block Diagrams")
    for bDesign in blueprint.blockDesigns:
        block = bDesign.construct(cs, blueprint, 0, 1, 0, "A", dict())
        fileName = plotting.plotBlockDiagram(
            block, "{}.svg".format(bDesign.name), cold, materialList=materialList
        )
        plotting.close()
        if fileName is not None:
            report[DESIGN]["Block Diagrams"][
                bDesign.name.capitalize()
            ] = newReports.Image(
                "Diagram of {} Block at Cold Temperature".format(
                    bDesign.name.capitalize()
                ),
                fileName,
                "{}".format(bDesign.name.capitalize()),
            )
Beispiel #3
0
def makeCoreAndAssemblyMaps(r,
                            cs,
                            generateFullCoreMap=False,
                            showBlockAxMesh=True):
    r"""Create core and assembly design plots

    Parameters
    ----------
    r : armi.reactor.reactors.Reactor
    cs: armi.settings.caseSettings.Settings
    generateFullCoreMap : bool, default False
    showBlockAxMesh : bool, default True
    """
    assemsInCore = list(r.blueprints.assemblies.values())
    core = r.core
    for plotNum, assemBatch in enumerate(iterables.chunk(
            assemsInCore, MAX_ASSEMS_PER_ASSEM_PLOT),
                                         start=1):
        assemPlotImage = copy(report.ASSEM_TYPES)
        assemPlotImage.title = assemPlotImage.title + " ({})".format(plotNum)
        report.data.Report.groupsOrderFirst.insert(-1, assemPlotImage)
        report.data.Report.componentWellGroups.insert(-1, assemPlotImage)
        assemPlotName = os.path.abspath(
            f"{core.name}AssemblyTypes{plotNum}.png")
        plotting.plotAssemblyTypes(
            core.parent.blueprints,
            assemPlotName,
            assemBatch,
            maxAssems=MAX_ASSEMS_PER_ASSEM_PLOT,
            showBlockAxMesh=showBlockAxMesh,
        )
        report.setData(
            "Assem Types {}".format(plotNum),
            assemPlotName,
            assemPlotImage,
            report.DESIGN,
        )

    # Create radial core map
    if generateFullCoreMap:
        core.growToFullCore(cs)

    counts = {
        assemDesign.name: len(core.getChildrenOfType(assemDesign.name))
        for assemDesign in r.blueprints.assemDesigns
    }
    # assemDesigns.keys is ordered based on input, assemOrder only contains types that are in the core
    assemOrder = [
        aType for aType in r.blueprints.assemDesigns.keys()
        if counts[aType] > 0
    ]
    data = [assemOrder.index(a.p.type) for a in core]
    labels = [r.blueprints.assemDesigns[a.p.type].specifier for a in core]
    legendMap = [(
        ai,
        assemDesign.specifier,
        "{} ({})".format(assemDesign.name, counts[assemDesign.name]),
    ) for ai, assemDesign in enumerate(r.blueprints.assemDesigns)
                 if counts[assemDesign.name] > 0]

    fName = "".join(
        [cs.caseTitle, "RadialCoreMap.", cs["outputFileExtension"]])
    plotting.plotFaceMap(
        core,
        title="{} Radial Core Map".format(cs.caseTitle),
        fName=fName,
        cmapName="RdYlBu",
        data=data,
        labels=labels,
        legendMap=legendMap,
        axisEqual=True,
        bare=True,
        titleSize=10,
        fontSize=8,
    )
    plotting.close()

    report.setData("Radial Core Map", os.path.abspath(fName), report.FACE_MAP,
                   report.DESIGN)
Beispiel #4
0
def insertCoreAndAssemblyMaps(r,
                              cs,
                              report,
                              blueprint,
                              generateFullCoreMap=False,
                              showBlockAxMesh=True):
    r"""Create core and assembly design plots

    Parameters
    ----------
    r : armi.reactor.reactors.Reactor
    cs: armi.settings.caseSettings.Settings
    report : armi.bookkeeping.newReports.ReportContent
    blueprint: Blueprint
    generateFullCoreMap : bool, default False
    showBlockAxMesh : bool, default True
    """

    assemPrototypes = set()
    for aKey in blueprint.assemDesigns.keys():
        assemPrototypes.add(blueprint.constructAssem(cs, name=aKey))

    counts = {
        assemDesign.name: len(r.core.getChildrenOfType(assemDesign.name))
        for assemDesign in blueprint.assemDesigns
    }

    core = r.core
    imageCaption = "The axial block and enrichment distributions of assemblies in the core at beginning of life. The percentage represents the block enrichment (U-235 or B-10), where as the additional character represents the cross section id of the block. The number of fine-mesh subdivisions are provided on the secondary y-axis."

    report[DESIGN]["Assembly Designs"] = newReports.Section("Assembly Designs")
    currentSection = report[DESIGN]["Assembly Designs"]
    for plotNum, assemBatch in enumerate(iterables.chunk(
            list(assemPrototypes), MAX_ASSEMS_PER_ASSEM_PLOT),
                                         start=1):
        assemPlotImage = newReports.Image(
            imageCaption,
            os.path.abspath(f"{core.name}AssemblyTypes{plotNum}.png"),
        )
        assemPlotName = os.path.abspath(
            f"{core.name}AssemblyTypes{plotNum}.png")
        plotting.plotAssemblyTypes(
            blueprint,
            assemPlotName,
            assemBatch,
            maxAssems=MAX_ASSEMS_PER_ASSEM_PLOT,
            showBlockAxMesh=showBlockAxMesh,
        )
        currentSection.addChildElement(assemPlotImage, assemPlotName)

    # Create radial core map
    if generateFullCoreMap:
        core.growToFullCore(cs)
    assemList = [a.p.type for a in assemPrototypes]
    # Sort so it has the same colors each time.
    assemList.sort()
    assemTypeMap = {specifier: i for i, specifier in enumerate(assemList)}

    data = [assemTypeMap[a.p.type] for a in core]
    labels = [blueprint.assemDesigns[a.p.type].specifier for a in core]

    legendMap = [(
        assemTypeMap[assemDesign.name],
        assemDesign.specifier,
        "{} ({})".format(assemDesign.name, counts[assemDesign.name]),
    ) for ai, assemDesign in enumerate(blueprint.assemDesigns)
                 if counts[assemDesign.name] > 0]

    fName = "".join(
        [cs.caseTitle, "RadialCoreMap.", cs["outputFileExtension"]])
    plotting.plotFaceMap(
        core,
        title="{} Radial Core Map".format(cs.caseTitle),
        fName=fName,
        cmapName="RdYlBu",
        data=data,
        labels=labels,
        legendMap=legendMap,
        axisEqual=True,
        bare=True,
        titleSize=10,
        fontSize=8,
    )

    plotting.close()
    report[DESIGN][CORE_MAP] = newReports.Image("Map of the Core at BOL",
                                                os.path.abspath(fName))
Beispiel #5
0
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Plot a reactor facemap
======================

Load a test reactor from the test suite and plot a dummy
power distribution from it. You can plot any block parameter.
"""
from armi.reactor.tests import test_reactors
from armi.utils import plotting
from armi import configure, runLog

# configure ARMI
configure(permissive=True)

operator, reactor = test_reactors.loadTestReactor()
reactor.core.growToFullCore(None)
# set dummy power
for b in reactor.core.getBlocks():
    x, y, z = b.spatialLocator.getGlobalCoordinates()
    b.p.pdens = x**2 + y**2 + z**2

plotting.plotFaceMap(reactor.core, param="pdens", labelFmt="{0:.1e}")
plotting.close()