예제 #1
0
def insertEndOfLifeContent(r, report):
    """
    Generate End of Life Content for the report

    Parameters
    ----------
    r : Reactor
        the reactor
    report : ReportContent
        The report to be added to.

    """
    fName2 = "powerMap.png"
    dataForTotalPower = [
        a.getMaxParam("power") / units.WATTS_PER_MW for a in r.core
    ]
    plotting.plotFaceMap(
        r.core,
        param="power",
        data=dataForTotalPower,
        fName=fName2,
        cmapName="RdYlBu_r",
        axisEqual=True,
        bare=True,
        titleSize=10,
        fontSize=8,
        makeColorBar=True,
    )

    report[DESIGN][TOTAL_POWER_EOL] = newReports.Image(
        "Total Assembly Power at EOL in MWt",
        os.path.abspath(fName2),
    )
예제 #2
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()
예제 #3
0
import math

import matplotlib.pyplot as plt

from armi.reactor.tests import test_reactors
from armi.reactor.flags import Flags
from armi.reactor.converters import geometryConverters
from armi.utils import plotting
from armi import configure, runLog

# configure ARMI
configure(permissive=True)

o, r = test_reactors.loadTestReactor()
kgFis = [a.getHMMass() for a in r.core]
plotting.plotFaceMap(r.core, data=kgFis, labelFmt="{:.1e}")

converterSettings = {
    "radialConversionType": "Ring Compositions",
    "axialConversionType": "Axial Coordinates",
    "uniformThetaMesh": True,
    "thetaBins": 1,
    "axialMesh": [50, 100, 150, 175],
    "thetaMesh": [2 * math.pi],
}

converter = geometryConverters.HexToRZConverter(o.cs, converterSettings)
# makes new reactor in converter.convReactor
converter.convert(r)
figs = converter.plotConvertedReactor()
예제 #4
0
from armi import configure, runLog

# configure ARMI
configure(permissive=True)

o, reactor = test_reactors.loadTestReactor(
    inputFileName="refTestCartesian.yaml")

# Apply a dummy burnup distribution roughly in a cosine
for b in reactor.core.getBlocks(Flags.FUEL):
    x, y, z = b.spatialLocator.getGlobalCoordinates()
    d = math.sqrt(x**2 + y**2)
    b.p.percentBu = 5 * math.cos(d * math.pi / 2 / 90)

# show the initial burnup distribution
plotting.plotFaceMap(reactor.core, param="percentBu")

fuelHandler = fuelHandlers.FuelHandler(o)

candidateAssems = reactor.core.getAssemblies(Flags.FUEL)
criterion = lambda a: a.getMaxParam("percentBu")
candidateAssems.sort(key=criterion)

for num in range(12):
    # swap the 12 highest burnup assemblies with the 12 lowest burnup ones
    high = candidateAssems.pop()
    low = candidateAssems.pop(0)
    fuelHandler.swapAssemblies(high, low)

# re-filter the remaining candidates for more complex selections
candidateAssems = [
예제 #5
0
"""
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

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}")
예제 #6
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)
예제 #7
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))