Example #1
0
def insertBlockDesignReport(blueprint, report, cs):
    r"""Summarize the block designs from the loading file

    Parameters
    ----------

    blueprint : Blueprint
    report: ReportContent
    cs: Case Settings

    """
    report[DESIGN]["Block Summaries"] = newReports.Section("Block Summaries")

    for bDesign in blueprint.blockDesigns:
        loadingFileTable = newReports.Table(
            "Summary Of Block: {}".format(bDesign.name), "block contents")
        loadingFileTable.header = ["", "Input Parameter"]
        constructedBlock = bDesign.construct(cs, blueprint, 0, 1, 0, "A",
                                             dict())
        loadingFileTable.addRow(["Number of Components", len(bDesign)])
        lst = [i for i in range(len(bDesign))]
        for i, cDesign, c in zip(lst, bDesign, constructedBlock):
            cType = cDesign.name
            componentSplitter = (i + 1) * " " + "\n"
            loadingFileTable.addRow([componentSplitter, ""])
            loadingFileTable.addRow([
                "{} {}".format(cType, "Shape"),
                "{} {}".format(cDesign.shape, ""),
            ])
            loadingFileTable.addRow([
                "{} {}".format(cType, "Material"),
                "{} {}".format(cDesign.material, ""),
            ])
            loadingFileTable.addRow([
                "{} {}".format(cType, "Hot Temperature"),
                "{} {}".format(cDesign.Thot, ""),
            ])
            loadingFileTable.addRow([
                "{} {}".format(cType, "Cold Temperature"),
                "{} {}".format(cDesign.Tinput, ""),
            ])
            for pd in c.pDefs:
                if pd.name in c.DIMENSION_NAMES:
                    value = c.getDimension(pd.name, cold=True)
                    unit = ""
                    if pd.units is not None:
                        unit = pd.units
                    if value is not None:
                        loadingFileTable.addRow([
                            "{} {}".format(cType, pd.name),
                            "{} {}".format(value, unit),
                        ])
        loadingFileTable.title = "Summary of Block: {}".format(bDesign.name)
        report[DESIGN]["Block Summaries"].addChildElement(
            loadingFileTable, loadingFileTable.title)
Example #2
0
def insertDesignContent(r, report):
    """Adds Beginning of Life content to the Design section of the report.

    Parameters
    ----------
    r: reactor
    report: ReportContent

    """
    report[DESIGN][PIN_ASSEMBLY_DESIGN_SUMMARY] = getPinDesignTable(r.core)

    first_fuel_block = r.core.getFirstBlock(Flags.FUEL)
    if first_fuel_block is not None:
        report[DESIGN]["Dimensions in First Fuel Block"] = newReports.Section(
            "Dimensions in First Fuel Block")

        for component_ in sorted(first_fuel_block):
            report[DESIGN]["Dimensions in First Fuel Block"].addChildElement(
                element=createDimensionReport(component_),
                heading=str(component_.name) + "dimensionReport",
                subheading=None,
            )
Example #3
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()),
            )
Example #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))