Пример #1
0
def plotFlux(block, benchFlux, mcnpFlux, benchEnergy, title):
    armiEnergy = [e for e in energyGroups.getGroupStructure("ANL33")]

    ax = plt.subplot(111)
    ax.set_xscale("log")

    benchFlux = normalizeFlux(benchFlux, benchEnergy)
    mcnpFlux = normalizeFlux(mcnpFlux, benchEnergy)
    # duplicate the last group flux to get a full step in the chart
    benchFlux.append(benchFlux[-1])
    mcnpFlux.append(mcnpFlux[-1])
    plt.step(benchEnergy, benchFlux, label="Benchmark", where="post")
    plt.step(benchEnergy[:-1], mcnpFlux, label="Calculated MCNP", where="post")

    flux = block.getMgFlux()[:-12]
    # make the last flux value the same as the one before it so the step chart doesnt
    # look weird
    flux[-1] = flux[-2]
    energy = armiEnergy[:-12]
    flux = normalizeFlux(flux, energy)

    plt.step(energy, flux, label="ARMI DIF3D", where="post")

    plt.title(title)
    plt.legend()
    plt.xlabel("Energy (eV)")
    plt.ylabel("Normalized Flux")
    plt.show()
Пример #2
0
def defineValidators(inspector):
    """Define settings validation for the DRAGON plugin."""
    if inspector.cs["xsKernel"] != CONF_OPT_DRAGON:
        # No need to validate DRAGON settings if DRAGON is not being used.
        return []
    queries = [
        settingsValidation.Query(
            lambda: shutil.which(inspector.cs[CONF_DRAGON_PATH]) is None,
            f"The path specified in the `{CONF_DRAGON_PATH}` setting does not exist: "
            f"{inspector.cs[CONF_DRAGON_PATH]}",
            "Please update executable location to the correct location.",
            inspector.NO_ACTION,
        ),
        settingsValidation.Query(
            lambda: not os.path.exists(inspector.cs[CONF_DRAGON_DATA_PATH]),
            "The path specified to the dragon nuclear data file in the "
            f"`{CONF_DRAGON_DATA_PATH}` setting does not exist: "
            f"{inspector.cs[CONF_DRAGON_DATA_PATH]}",
            "Please update nuclear data location to the correct location.",
            inspector.NO_ACTION,
        ),
        settingsValidation.Query(
            lambda: len(
                energyGroups.getGroupStructure(inspector.cs["groupStructure"]))
            > 33,
            "DRAGON does not run well with more than 33 groups due to calculating "
            "<400 fine groups. This few number of fine groups may not map well onto "
            "more than 33 groups.",
            "Proceed with caution, or choose a group structure with less than 33 groups.",
            inspector.NO_ACTION,
        ),
        settingsValidation.Query(
            lambda: "7r0" in inspector.cs[CONF_DRAGON_DATA_PATH],
            "ENDF/B-VII.0 is selected for DRAGON, but Mo98 is not available in this "
            "library. Your run will likely fail if there is any Mo in your system. ",
            "It is recommended that the nuclear data be switched to ENDF/B-VII.1 or"
            "ENDF/B-VIII.0, or Mo98 be removed from nuclear modeling.",
            inspector.NO_ACTION,
        ),
        settingsValidation.Query(
            lambda: not os.path.exists(inspector.cs[CONF_DRAGON_TEMPLATE_PATH]
                                       ),
            "The path specified to the DRAGON template file in the "
            f"`{CONF_DRAGON_TEMPLATE_PATH}` setting does not exist: "
            f"{inspector.cs[CONF_DRAGON_TEMPLATE_PATH]}",
            "Please update to the correct location.",
            inspector.NO_ACTION,
        ),
    ]
    return queries
Пример #3
0
===================================

In this example, several cross sections are plotted from
an existing binary cross section library file in :py:mod:`ISOTXS <armi.nuclearDataIO.isotxs>` format.

"""
import matplotlib.pyplot as plt

from armi.physics.neutronics import energyGroups
from armi.tests import ISOAA_PATH
from armi.nuclearDataIO.cccc import isotxs
from armi import configure

configure(permissive=True)

gs = energyGroups.getGroupStructure("ANL33")
lib = isotxs.readBinary(ISOAA_PATH)

fe56 = lib.getNuclide("FE", "AA")
u235 = lib.getNuclide("U235", "AA")
u238 = lib.getNuclide("U238", "AA")
b10 = lib.getNuclide("B10", "AA")

plt.step(gs, fe56.micros.nGamma, label=r"Fe (n, $\gamma$)")
plt.step(gs, u235.micros.fission, label="U-235 (n, fission)")
plt.step(gs, u238.micros.nGamma, label=r"U-238 (n, $\gamma$)")
plt.step(gs, b10.micros.nalph, label=r"B-10 (n, $\alpha$)")

plt.xscale("log")
plt.yscale("log")
plt.xlabel("Neutron Energy, eV")