예제 #1
0
    def test_calcMGFluence(self):
        """
        This test confirms that mg flux has many groups when loaded with the history tracker.

        armi.bookeeping.db.hdf.hdfDB.readBlocksHistory requires
        historical_values[historical_indices] to be cast as a list to read more than the
        first energy group. This test shows that this behavior is preserved.
        """
        o = self.o
        b = o.r.core.childrenByLocator[o.r.core.spatialGrid[0, 0,
                                                            0]].getFirstBlock(
                                                                Flags.FUEL)
        bVolume = b.getVolume()
        bName = b.name

        hti = o.getInterface("history")

        timesInYears = [duration or 1.0 for duration in hti.getTimeSteps()
                        ]  # duration is None in this DB
        timeStepsToRead = [
            utils.getCycleNode(i, self.o.cs) for i in range(len(timesInYears))
        ]
        hti.preloadBlockHistoryVals([bName], ["mgFlux"], timeStepsToRead)

        mgFluence = None
        for ts, years in enumerate(timesInYears):
            cycle, node = utils.getCycleNode(ts, self.o.cs)
            # get coverage for getTimeStepNum by checking against getcycleNode
            testTS = utils.getTimeStepNum(cycle, node, self.o.cs)
            self.assertEqual(ts, testTS)
            mgFlux = (hti.getBlockHistoryVal(bName, "mgFlux",
                                             (cycle, node)) / bVolume
                      )  #  b.p.mgFlux is vol integrated
            timeInSec = years * 365 * 24 * 3600
            if mgFluence is None:
                mgFluence = timeInSec * mgFlux
            else:
                mgFluence += timeInSec * mgFlux

        self.assertTrue(
            len(mgFluence) > 1, "mgFluence should have more than 1 group")
예제 #2
0
파일: xtviewDB.py 프로젝트: wilcoxjd/armi
 def genTimeSteps(self):
     timeInts = self.getAllTimesteps()
     cs = self.loadCS()
     for ti in timeInts:
         yield utils.getCycleNode(ti, cs)