Beispiel #1
0
 def test_componentInteractionsLinkingBySubtraction(self):
     r"""Tests linking of components by subtraction."""
     nPins = 217
     gapDims = {
         "Tinput": 25.0,
         "Thot": 430.0,
         "od": 1.0,
         "id": 0.9,
         "mult": nPins
     }
     gap = Circle("gap", "Void", **gapDims)
     fuelDims = {
         "Tinput": 25.0,
         "Thot": 430.0,
         "od": 0.9,
         "id": 0.0,
         "mult": nPins,
         "modArea": "gap.sub",
     }
     fuel = Circle("fuel", "UZr", components={"gap": gap}, **fuelDims)
     gapArea = (gap.getDimension("mult") * math.pi *
                ((gap.getDimension("od") / 2.0)**2 -
                 (gap.getDimension("id") / 2.0)**2))
     fuelArea = (fuel.getDimension("mult") * math.pi *
                 ((fuel.getDimension("od") / 2.0)**2 -
                  (fuel.getDimension("id") / 2.0)**2))
     ref = fuelArea - gapArea
     cur = fuel.getArea()
     self.assertAlmostEqual(cur, ref)
Beispiel #2
0
    def setUp(self):
        dims = {"Tinput": 25.0, "Thot": 600.0, "od": 10.0, "id": 5.0, "mult": 1.0}
        self.fuel = Circle("fuel", "UZr", **dims)

        class fakeBlock:
            def getHeight(self):  # unit height
                return 1.0

            def getSymmetryFactor(self):
                return 1.0

        self.fuel.parent = fakeBlock()
Beispiel #3
0
 def test_componentInteractionsLinkingByDimensions(self):
     r"""Tests linking of components by dimensions."""
     nPins = 217
     fuelDims = {
         "Tinput": 25.0,
         "Thot": 430.0,
         "od": 0.9,
         "id": 0.0,
         "mult": nPins
     }
     cladDims = {
         "Tinput": 25.0,
         "Thot": 430.0,
         "od": 1.1,
         "id": 1.0,
         "mult": nPins
     }
     fuel = Circle("fuel", "UZr", **fuelDims)
     clad = Circle("clad", "HT9", **cladDims)
     gapDims = {
         "Tinput": 25.0,
         "Thot": 430.0,
         "od": "clad.id",
         "id": "fuel.od",
         "mult": nPins,
     }
     gapDims["components"] = {"clad": clad, "fuel": fuel}
     gap = Circle("gap", "Void", **gapDims)
     mult = gap.getDimension("mult")
     od = gap.getDimension("od")
     id = gap.getDimension("id")
     ref = mult * math.pi * ((od / 2.0)**2 - (id / 2.0)**2)
     cur = gap.getArea()
     self.assertAlmostEqual(cur, ref)
def createDummyReactor():
    """
    Create a dummy reactor with a single fuel assembly and a single fuel block.

    Often, a reactor model like this is built directly from input files rather
    than from code as done here.
    """
    bp = blueprints.Blueprints()
    cs = settings.Settings()

    r = reactors.Reactor("Reactor", bp)
    r.add(reactors.Core("Core"))
    r.core.spatialGrid = grids.HexGrid.fromPitch(1.0)
    r.core.spatialGrid.symmetry = geometry.SymmetryType(
        geometry.DomainType.THIRD_CORE, geometry.BoundaryType.PERIODIC)
    r.core.spatialGrid.geomType = geometry.GeomType.HEX
    r.core.spatialGrid.armiObject = r.core
    r.core.setOptionsFromCs(cs)

    # Create a single fuel assembly
    a = assemblies.HexAssembly("fuel assembly")
    a.spatialGrid = grids.axialUnitGrid(1)
    a.spatialLocator = r.core.spatialGrid[1, 0, 0]

    # Create a single fuel block
    b = blocks.HexBlock("fuel block")
    b.setType("fuel")

    # Create a single fuel component with UZr fuel.
    dims = {"Tinput": 20, "Thot": 900, "id": 0.0, "od": 2.9, "mult": 7}
    c = Circle("fuel", uZr.UZr(), **dims)
    b.add(c)

    # Create a single structure component with HT9.
    dims = {"Tinput": 20, "Thot": 600, "op": 16.0, "ip": 15.0, "mult": 1}
    c = Hexagon("structure", ht9.HT9(), **dims)
    b.add(c)

    # Fill in the rest of the block with sodium coolant.
    dims = {"Tinput": 600, "Thot": 600}
    c = DerivedShape("coolant", sodium.Sodium(), **dims)
    b.add(c)

    a.add(b)
    r.core.add(a)
    _addFlux(b)
    return r
Beispiel #5
0
class TestMaterialAdjustments(unittest.TestCase):
    """Tests to make sure enrichment and mass fractions can be adjusted properly."""
    def setUp(self):
        dims = {
            "Tinput": 25.0,
            "Thot": 600.0,
            "od": 10.0,
            "id": 5.0,
            "mult": 1.0
        }
        self.fuel = Circle("fuel", "UZr", **dims)

        class fakeBlock(object):
            def getHeight(self):  # unit height
                return 1.0

            def getSymmetryFactor(self):
                return 1.0

        self.fuel.parent = fakeBlock()

    def test_setMassFrac(self):
        """Make sure we can set a mass fraction properly."""
        target35 = 0.2
        self.fuel.setMassFrac("U235", target35)
        self.assertAlmostEqual(self.fuel.getMassFrac("U235"), target35)

    def test_adjustMassFrac_U235(self):
        zrMass = self.fuel.getMass("ZR")
        uMass = self.fuel.getMass("U")
        zrFrac = zrMass / (uMass + zrMass)

        enrichmentFrac = 0.3
        u235Frac = enrichmentFrac * uMass / (uMass + zrMass)
        u238Frac = (1.0 - enrichmentFrac) * uMass / (uMass + zrMass)

        self.fuel.adjustMassFrac(nuclideToAdjust="U235",
                                 elementToHoldConstant="ZR",
                                 val=u235Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("U235"), u235Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("U238"), u238Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("ZR"), zrFrac)

    def test_adjustMassFrac_U(self):
        self.fuel.adjustMassFrac(elementToAdjust="U", val=0.7)
        uFrac = self.fuel.getMassFrac("U")
        u235Enrichment = 0.1
        u238Frac = (1.0 - u235Enrichment) * uFrac
        u235Frac = u235Enrichment * uFrac

        self.assertAlmostEqual(self.fuel.getMassFrac("U235"), u235Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("U238"), u238Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("ZR"), 0.30)

    def test_adjustMassFrac_clear_ZR(self):
        self.fuel.adjustMassFrac(nuclideToAdjust="ZR", val=0.0)
        self.assertAlmostEqual(self.fuel.getMassFrac("ZR"), 0.0)
        self.assertAlmostEqual(self.fuel.getNumberDensity("ZR"), 0.0)
        self.assertAlmostEqual(
            self.fuel.getMassFrac("U235") + self.fuel.getMassFrac("U238"), 1.0)

    def test_adjustMassFrac_set_ZR(self):
        u235Enrichment = 0.1
        zrFrac = 0.1
        uFrac = 1.0 - zrFrac
        u238Frac = (1.0 - u235Enrichment) * uFrac
        u235Frac = u235Enrichment * uFrac

        self.fuel.adjustMassFrac(nuclideToAdjust="ZR", val=zrFrac)
        self.assertAlmostEqual(self.fuel.getMassFrac("U235"), u235Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("U238"), u238Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("ZR"), zrFrac)

    def test_adjustMassFrac_leave_same(self):
        zrFrac = 0.1
        u238Enrichment = 0.9
        uFrac = 1.0 - zrFrac
        u238Frac = uFrac * u238Enrichment

        self.fuel.adjustMassFrac(nuclideToAdjust="ZR", val=zrFrac)
        self.assertAlmostEqual(self.fuel.getMassFrac("U238"), u238Frac)
        self.assertAlmostEqual(self.fuel.getMassFrac("ZR"), zrFrac)

    def test_adjustMassEnrichment(self):
        self.fuel.adjustMassEnrichment(0.2)
        self.assertAlmostEqual(self.fuel.getMassFrac("U235"), 0.18)
        self.assertAlmostEqual(self.fuel.getMassFrac("U238"), 0.72)
        self.assertAlmostEqual(self.fuel.getMassFrac("ZR"), 0.1)

    def test_getEnrichment(self):
        self.fuel.adjustMassEnrichment(0.3)
        self.assertAlmostEqual(self.fuel.getEnrichment(), 0.3)