Ejemplo n.º 1
0
    def test_reattach(
        self,
    ):  # TODO: this got changed, should make sure it still tests what is intended
        # Remake original assembly
        self.Assembly = makeTestAssembly(self.assemNum, self.assemNum)

        # add some blocks with a component
        for i in range(self.assemNum):
            b = blocks.HexBlock("TestBlock", self.cs)

            # Set the 1st block to have higher params than the rest.
            self.blockParamsTemp = {}
            for key, val in self.blockParams.items():
                b.p[key] = self.blockParamsTemp[key] = val * (
                    i + 1
                )  # Iterate with i in self.assemNum, so higher assemNums get the high values.

            b.setHeight(self.height)
            b.setType("fuel")

            self.hexDims = {
                "Tinput": 273.0,
                "Thot": 273.0,
                "op": 0.76,
                "ip": 0.0,
                "mult": 1.0,
            }

            h = components.Hexagon("intercoolant", "Sodium", **self.hexDims)
            b.add(h)

            self.Assembly.add(b)
Ejemplo n.º 2
0
    def test_reattach(self):
        # Remake original assembly
        self.assembly = makeTestAssembly(self.assemNum, self.assemNum)
        self.assertEqual(0, len(self.assembly.getBlocks()))

        # add some blocks with a component
        for i in range(self.assemNum):
            b = blocks.HexBlock("TestBlock")

            # Set the 1st block to have higher params than the rest.
            self.blockParamsTemp = {}
            for key, val in self.blockParams.items():
                # Iterate with i in self.assemNum, so higher assemNums get the high values.
                b.p[key] = self.blockParamsTemp[key] = val * (i + 1)

            b.setHeight(self.height)
            b.setType("fuel")

            self.hexDims = {
                "Tinput": 273.0,
                "Thot": 273.0,
                "op": 0.76,
                "ip": 0.0,
                "mult": 1.0,
            }

            h = components.Hexagon("intercoolant", "Sodium", **self.hexDims)
            b.add(h)

            self.assembly.add(b)

        self.assertEqual(self.assemNum, len(self.assembly.getBlocks()))
        for b in self.assembly.getBlocks():
            self.assertEqual("fuel", b.getType())
Ejemplo n.º 3
0
    def test_makeAxialSnapList(self):
        # Make a second assembly with 4 times the resolution
        assemNum2 = self.assemNum * 4
        height2 = self.height / 4.0
        assembly2 = makeTestAssembly(assemNum2, assemNum2)

        # add some blocks with a component
        for _i in range(assemNum2):

            self.hexDims = {
                "Tinput": 273.0,
                "Thot": 273.0,
                "op": 0.76,
                "ip": 0.0,
                "mult": 1.0,
            }

            h = components.Hexagon("fuel", "UZr", **self.hexDims)
            b = blocks.HexBlock("fuel")
            b.setType("igniter fuel")
            b.add(h)
            b.setHeight(height2)
            assembly2.add(b)

        self.assembly.makeAxialSnapList(assembly2)

        cur = []
        for b in self.assembly:
            cur.append(b.p.topIndex)

        ref = [3, 7, 11]
        self.assertEqual(cur, ref)
Ejemplo n.º 4
0
    def setUp(self):
        r"""
        Build a dummy reactor without using input files. There are some igniters and feeds
        but none of these have any number densities.
        """
        self.o, self.r = test_reactors.loadTestReactor(
            self.directoryChanger.destination
        )
        blockList = self.r.core.getBlocks()
        for bi, b in enumerate(blockList):
            b.p.flux = 5e10
            if b.isFuel():
                b.p.percentBu = 30.0 * bi / len(blockList)
        self.nfeed = len(self.r.core.getAssemblies(Flags.FEED))
        self.nigniter = len(self.r.core.getAssemblies(Flags.IGNITER))
        self.nSfp = len(self.r.core.sfp)

        # generate a reactor with assemblies
        # generate components with materials
        nPins = 271

        fuelDims = {"Tinput": 273.0, "Thot": 273.0, "od": 1.0, "id": 0.0, "mult": nPins}
        fuel = components.Circle("fuel", "UZr", **fuelDims)

        cladDims = {"Tinput": 273.0, "Thot": 273.0, "od": 1.1, "id": 1.0, "mult": nPins}
        clad = components.Circle("clad", "HT9", **cladDims)

        interDims = {
            "Tinput": 273.0,
            "Thot": 273.0,
            "op": 16.8,
            "ip": 16.0,
            "mult": 1.0,
        }
        interSodium = components.Hexagon("interCoolant", "Sodium", **interDims)

        # generate a block
        self.block = blocks.HexBlock("TestHexBlock", self.o.cs)
        self.block.setType("fuel")
        self.block.setHeight(10.0)
        self.block.add(fuel)
        self.block.add(clad)
        self.block.add(interSodium)

        # generate an assembly
        self.assembly = assemblies.HexAssembly("TestAssemblyType")
        self.assembly.spatialGrid = grids.axialUnitGrid(1)
        for _ in range(1):
            self.assembly.add(copy.deepcopy(self.block))

        # copy the assembly to make a list of assemblies and have a reference assembly
        self.aList = []
        for _ in range(6):
            self.aList.append(copy.deepcopy(self.assembly))

        self.refAssembly = copy.deepcopy(self.assembly)
        self.directoryChanger.open()
Ejemplo n.º 5
0
    def test_calcTotalParam(self):
        # Remake original assembly
        self.assembly = makeTestAssembly(self.assemNum, self.assemNum)

        # add some blocks with a component
        for i in range(self.assemNum):
            b = blocks.HexBlock("TestBlock")

            # Set the 1st block to have higher params than the rest.
            self.blockParamsTemp = {}
            for key, val in self.blockParams.items():
                b.p[key] = self.blockParamsTemp[key] = (
                    val * i
                )  # Iterate with i in self.assemNum, so higher assemNums get the high values.

            b.setHeight(self.height)
            b.setType("fuel")

            self.hexDims = {
                "Tinput": 273.0,
                "Thot": 273.0,
                "op": 0.76,
                "ip": 0.0,
                "mult": 1.0,
            }

            h = components.Hexagon("intercoolant", "Sodium", **self.hexDims)

            b.add(h)

            self.assembly.add(b)

        for param in self.blockParamsTemp:
            tot = 0.0
            for b in self.assembly:
                try:
                    tot += b.p[param]
                except TypeError:
                    pass
            ref = tot

            try:
                cur = self.assembly.calcTotalParam(param)
                places = 6
                self.assertAlmostEqual(cur, ref, places=places)
            except TypeError:
                pass
Ejemplo n.º 6
0
def buildTestAssemblies():
    """
    Build some assembly objects that will be used in testing.

    This builds 2 HexBlocks:
        * One with half UZr pins and half UTh pins
        * One with all UThZr pins
    """
    caseSetting = settings.Settings()
    settings.setMasterCs(caseSetting)

    temperature = 273.0
    fuelID = 0.0
    fuelOD = 1.0
    cladOD = 1.1
    # generate a reactor with assemblies
    # generate components with materials
    nPins = 100

    fuelDims = {
        "Tinput": temperature,
        "Thot": temperature,
        "od": fuelOD,
        "id": fuelID,
        "mult": nPins,
    }

    fuelUZr = components.Circle("fuel", "UZr", **fuelDims)
    fuelUTh = components.Circle("fuel UTh", "ThU", **fuelDims)

    fuelDims2nPins = {
        "Tinput": temperature,
        "Thot": temperature,
        "od": fuelOD,
        "id": fuelID,
        "mult": 2 * nPins,
    }

    fuelUThZr = components.Circle("fuel B", "UThZr", **fuelDims2nPins)

    cladDims = {
        "Tinput": temperature,
        "Thot": temperature,
        "od": cladOD,
        "id": fuelOD,
        "mult": 2 * nPins,
    }

    clad = components.Circle("clad", "HT9", **cladDims)

    interDims = {
        "Tinput": temperature,
        "Thot": temperature,
        "op": 16.8,
        "ip": 16.0,
        "mult": 1.0,
    }

    interSodium = components.Hexagon("interCoolant", "Sodium", **interDims)

    block = blocks.HexBlock("fuel")
    block2 = blocks.HexBlock("fuel")
    block.setType("fuel")
    block.setHeight(10.0)
    block.add(fuelUZr)
    block.add(fuelUTh)
    block.add(clad)
    block.add(interSodium)
    block.p.axMesh = 1
    block.p.molesHmBOL = 1.0
    block.p.molesHmNow = 1.0

    block2.setType("fuel")
    block2.setHeight(10.0)
    block2.add(fuelUThZr)
    block2.add(clad)
    block2.add(interSodium)
    block2.p.axMesh = 1
    block2.p.molesHmBOL = 2
    block2.p.molesHmNow = 1.0

    assemblieObjs = []
    for numBlocks, blockTemplate in zip([1, 1, 5, 4],
                                        [block, block2, block, block]):
        assembly = assemblies.HexAssembly("testAssemblyType")
        assembly.spatialGrid = grids.axialUnitGrid(numBlocks)
        assembly.spatialGrid.armiObject = assembly
        for _i in range(numBlocks):
            newBlock = copy.deepcopy(blockTemplate)
            assembly.add(newBlock)
        assembly.calculateZCoords()
        assembly.reestablishBlockOrder()
        assemblieObjs.append(assembly)

    return assemblieObjs
Ejemplo n.º 7
0
    def setUp(self):
        self.name = "A0015"
        self.assemNum = 15
        self.height = 10
        self.cs = settings.getMasterCs()
        # Print nothing to the screen that would normally go to the log.
        runLog.setVerbosity("error")

        self.r = tests.getEmptyHexReactor()
        self.r.core.symmetry = geometry.SymmetryType(
            geometry.DomainType.THIRD_CORE, geometry.BoundaryType.PERIODIC)

        self.assembly = makeTestAssembly(NUM_BLOCKS, self.assemNum, r=self.r)
        self.r.core.add(self.assembly)

        # Use these if they are needed
        self.blockParams = {
            "height": self.height,
            "avgFuelTemp": 873.0,
            "bondRemoved": 0.0,
            "bu": 15.1,
            "buGroupNum": 0,
            "buLimit": 35,
            "buRate": 0.0,
            "eqRegion": -1,
            "id": 212.0,
            "pdens": 10.0,
            "percentBu": 25.3,
            "power": 100000.0,
            "residence": 4.0,
            "smearDensity": 0.6996721711791459,
            "timeToLimit": 2.7e5,
            "xsTypeNum": 40,
            "zbottom": 97.3521,
            "ztop": 111.80279999999999,
        }

        self.blockSettings = {
            "axMesh": 1,
            "baseBu": 0.0,
            "basePBu": 0.0,
            "bondBOL": 0.0028698019026172574,
            "buGroup": "A",
            "height": 14.4507,
            "molesHmAtBOL": 65.8572895758245,
            "nHMAtBOL": 0.011241485251783766,
            "nPins": 169.0,
            "name": "B0011F",
            "newDPA": 0.0,
            "pitch": 16.79,
            "regName": False,
            "topIndex": 5,
            "tsIndex": 0,
            "type": "igniter fuel",
            "xsType": "C",
            "z": 104.57745,
        }
        # add some blocks with a component
        self.blockList = []
        for i in range(NUM_BLOCKS):
            b = blocks.HexBlock("TestHexBlock")
            b.setHeight(self.height)

            self.hexDims = {
                "Tinput": 273.0,
                "Thot": 273.0,
                "op": 0.76,
                "ip": 0.0,
                "mult": 1.0,
            }
            h = components.Hexagon("fuel", "UZr", **self.hexDims)

            # non-flaggy name important for testing
            b.setType("igniter fuel unitst")
            b.add(h)
            b.parent = self.assembly
            b.setName(b.makeName(self.assembly.getNum(), i))
            self.assembly.add(b)
            self.blockList.append(b)

        self.assembly.calculateZCoords()
Ejemplo n.º 8
0
    def test_axiallyExpand(self):
        """Build an assembly, grow it, and check it."""
        self.assemNum = 5

        # Remake original assembly
        self.r.core.removeAssembly(self.Assembly)
        self.Assembly = makeTestAssembly(self.assemNum,
                                         self.assemNum,
                                         r=self.r)
        self.r.core.add(self.Assembly)

        # add some blocks with a component
        for blockI in range(self.assemNum):
            b = blocks.HexBlock("TestBlock", self.cs)

            # Set the 1st block to have higher params than the rest.
            self.blockParamsTemp = {}
            for key, val in self.blockParams.items():
                b.p[key] = self.blockParamsTemp[key] = val * (
                    blockI + 1
                )  # Iterate with i in self.assemNum, so higher assemNums get the high values.
            b.setHeight(self.height)
            self.hexDims = {
                "Tinput": 273.0,
                "Thot": 273.0,
                "op": 0.76,
                "ip": 0.0,
                "mult": 1.0,
            }
            if (blockI == 0) or (blockI == 4):
                b.setType("plenum")
                h = components.Hexagon("intercoolant", "Sodium",
                                       **self.hexDims)
            else:
                b.setType("fuel")
                h = components.Hexagon("fuel", "UZr", **self.hexDims)
            b.add(h)
            self.Assembly.add(b)

        expandFrac = 1.15
        adjustList = ["U238", "ZR", "U235"]

        # Get the original block heights and densities to compare to later.
        heights = {
        }  # Dictionary with keys of block number, values of block heights.
        densities = (
            {}
        )  # Dictionary with keys of block number, values of dictionaries with keys of nuclide, values of block nuclide density
        for i, b in enumerate(self.Assembly):
            heights[i] = b.getHeight()
            densities[i] = {}
            for nuc, dens in b.getNumberDensities().items():
                densities[i][nuc] = dens

        expandPercent = (expandFrac - 1) * 100
        self.Assembly.axiallyExpand(expandPercent, adjustList)

        for i, b in enumerate(self.Assembly):
            # Check height
            if i == 0:
                # bottom block should be unchanged (because plenum)
                ref = heights[i]
            elif i == 4:
                # plenum on top should have grown by 15% of the uniform height * 3 (for each fuel block)
                ref = heights[i] - (expandFrac - 1) * 3 * heights[i]
            else:
                # each of the three fuel blocks should be 15% bigger.
                ref = heights[i] * expandFrac
            self.assertAlmostEqual(b.getHeight(), ref)

            # Check densities
            for nuc, dens in b.getNumberDensities().items():
                if (i == 0) or (i == 4):
                    # these blocks should be unchanged in mass/density.
                    ref = densities[i][nuc]
                else:
                    # fuel blocks should have all three nuclides reduced.
                    ref = densities[i][nuc] / expandFrac
                places = 6
                self.assertAlmostEqual(dens, ref, places=places)
Ejemplo n.º 9
0
    def test_axiallyExpandBlockHeights(self):
        r"""heightList = list of floats.  Entry 0 represents the bottom fuel block closest to the grid plate.
        Entry n represents the top fuel block closes to the plenum
        adjust list = list of nuclides to modify"""

        self.assemNum = 5

        # Remake original assembly
        self.r.core.removeAssembly(self.Assembly)
        self.Assembly = makeTestAssembly(self.assemNum,
                                         self.assemNum,
                                         r=self.r)
        self.r.core.add(self.Assembly)

        # add some blocks with a component
        for i in range(self.assemNum):
            b = blocks.HexBlock("TestBlock", self.cs)

            # Set the 1st block to have higher params than the rest.
            self.blockParamsTemp = {}
            for key, val in self.blockParams.items():
                b.p[key] = self.blockParamsTemp[key] = val * (
                    i + 1
                )  # Iterate with i in self.assemNum, so higher assemNums get the high values.

            b.setHeight(self.height)

            self.hexDims = {
                "Tinput": 273.0,
                "Thot": 273.0,
                "op": 0.76,
                "ip": 0.0,
                "mult": 1.0,
            }

            if (i == 0) or (i == 4):
                b.setType("plenum")
                h = components.Hexagon("intercoolant", "Sodium",
                                       **self.hexDims)
            else:
                b.setType("fuel")
                h = components.Hexagon("fuel", "UZr", **self.hexDims)

            b.add(h)

            self.Assembly.add(b)

        expandFrac = 1.15
        heightList = [
            self.height * expandFrac for x in range(self.assemNum - 2)
        ]
        adjustList = ["U238", "ZR", "U235"]

        # Get the original block heights and densities to compare to later.
        heights = {
        }  # Dictionary with keys of block number, values of block heights.
        densities = (
            {}
        )  # Dictionary with keys of block number, values of dictionaries with keys of nuclide, values of block nuclide density
        for i, b in enumerate(self.Assembly):
            heights[i] = b.getHeight()
            densities[i] = {}
            for nuc, dens in b.getNumberDensities().items():
                densities[i][nuc] = dens

        self.Assembly.axiallyExpandBlockHeights(heightList, adjustList)

        for i, b in enumerate(self.Assembly):
            # Check height
            if i == 0:
                ref = heights[i]
            elif i == 4:
                ref = heights[i] - (expandFrac - 1) * 3 * heights[i]
            else:
                ref = heights[i] * expandFrac
            cur = b.getHeight()
            places = 6
            self.assertAlmostEqual(cur, ref, places=places)

            # Check densities
            for nuc, dens in b.getNumberDensities().items():
                if (i == 0) or (i == 4):
                    ref = densities[i][nuc]
                else:
                    ref = densities[i][nuc] / expandFrac
                cur = b.getNumberDensity(nuc)
                places = 6
                self.assertAlmostEqual(cur, ref, places=places)