Esempio n. 1
0
 def test_invalidGroupStructureType(self):
     """Test that the reverse lookup fails on non-existent energy group bounds."""
     modifier = 1e-5
     for groupStructureType in units.GROUP_STRUCTURE.keys():
         energyBounds = units.getGroupStructure(groupStructureType)
         energyBounds[0] = energyBounds[0] * modifier
         with self.assertRaises(ValueError):
             units.getGroupStructureType(energyBounds)
Esempio n. 2
0
def updateXSGroupStructure(cs, name, value):
    from armi.utils import units

    try:
        units.getGroupStructure(value)
        return {name: value}
    except KeyError:
        try:
            newValue = value.upper()
            units.getGroupStructure(newValue)
            runLog.info(
                "Updating the cross section group structure from {} to {}".
                format(value, newValue))
            return {name: newValue}
        except KeyError:
            runLog.info(
                "Unable to automatically convert the `groupStructure` setting of {}. Defaulting to {}"
                .format(value, cs.settings["groupStructure"].default))
            return {name: cs.settings["groupStructure"].default}
Esempio n. 3
0
    def test_consistenciesBetweenGroupStructureAndGroupStructureType(self):
        """
        Test that the reverse lookup of the energy group structures work.

        Notes
        -----
        Several group structures point to the same energy group structure so the reverse lookup will fail to
        get the correct group structure type.
        """
        for groupStructureType in units.GROUP_STRUCTURE.keys():
            self.assertEqual(
                groupStructureType,
                units.getGroupStructureType(
                    units.getGroupStructure(groupStructureType)),
            )
Esempio n. 4
0
def makeEmptyBatch(name, cs=None):
    """
    Parameters
    ----------
    name : str

    cs : settings

    Return
    ------
    aB : batch
        a batch that is pretty much empty, but will not crash methods that are assumed to be populated
    """
    if cs is None:
        mgFlux = numpy.array([SMALL_NUMBER] * 45)
    else:
        mgFlux = numpy.array(
            [SMALL_NUMBER for _ in getGroupStructure(cs["groupStructure"])])

    aB = Batch(name=name)
    aB.addMass("HE4", SMALL_NUMBER)
    aB.setIntegratedMgFlux(mgFlux)
    return aB
Esempio n. 5
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.utils import units
from armi.tests import ISOAA_PATH
from armi.nuclearDataIO import isotxs
import armi

armi.configure()

gs = units.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")