Example #1
0
    def test_getChemicals(self):

        u235 = nuclideBases.byName["U235"]
        u238 = nuclideBases.byName["U238"]
        o16 = nuclideBases.byName["O16"]

        uo2 = UO2()
        uo2Chemicals = densityTools.getChemicals(uo2.p.massFrac)
        for symbol in ["U", "O"]:
            self.assertIn(symbol, uo2Chemicals.keys())

        self.assertAlmostEqual(uo2Chemicals["U"],
                               uo2.p.massFrac["U235"] + uo2.p.massFrac["U238"],
                               6)
        self.assertAlmostEqual(uo2Chemicals["O"], uo2.p.massFrac["O"], 6)

        # ensure getChemicals works if the nuclideBase is the dict key
        massFrac = {u238: 0.87, u235: 0.12, o16: 0.01}
        uo2Chemicals = densityTools.getChemicals(massFrac)
        for symbol in ["U", "O"]:
            self.assertIn(symbol, uo2Chemicals.keys())

        self.assertAlmostEqual(uo2Chemicals["U"],
                               massFrac[u235] + massFrac[u238], 2)
        self.assertAlmostEqual(uo2Chemicals["O"], massFrac[o16], 2)
Example #2
0
    def test_applyIsotopicsMix(self):
        """Ensure isotopc classes get mixed properly."""
        uo2 = UO2()
        massFracO = uo2.p.massFrac["O"]
        uo2.p.class1_wt_frac = 0.2
        enrichedMassFracs = {"U235": 0.3, "U234": 0.1, "PU239": 0.6}
        fertileMassFracs = {"U238": 0.3, "PU240": 0.7}
        densityTools.applyIsotopicsMix(uo2, enrichedMassFracs,
                                       fertileMassFracs)

        self.assertAlmostEqual(uo2.p.massFrac["U234"],
                               (1 - massFracO) * 0.2 * 0.1)  # HM blended
        self.assertAlmostEqual(uo2.p.massFrac["U238"],
                               (1 - massFracO) * 0.8 * 0.3)  # HM blended
        self.assertAlmostEqual(uo2.p.massFrac["O"],
                               massFracO)  # non-HM stays unchanged