def testAtten(self):
     print("\n========= INITIATING MULT REGION BEAM TEST ==========")
     sNord = 18
     # define fixed source boundary cond
     srcStrength = 1.e6  # [n / cm**2-s]
     # energy distribution of source (all born at 0.1MeV
     srcEnergy = np.array([1.0, 0, 0.0, 0, 0, 0, 0, 0, 0, 0])
     #
     # ## REGION 1 - GRAPHITE ###
     width1, dX1 = 25.0, 1.0
     region1Mat = mx.mixedMat({'c12': 1.0})
     region1Mat.setDensity(1.96)
     region1mesh1D = sn.Mesh1Dsn([0, width1], dX1, region1Mat, sN=sNord)
     bcs1 = {0: {'fixN': (1, [srcStrength, srcEnergy])}}
     region1mesh1D.setBCs(bcs1)
     # ## REGION 2 - BORATED CARBON ###
     width2, dX2 = 25.0, 0.05
     region2Mat = mx.mixedMat({'c12': 0.99, 'b10': 0.01})
     region2Mat.setDensity(1.9)
     region2mesh1D = sn.Mesh1Dsn([width1 + dX1 / 2. + dX2 / 2., width1 + dX1 / 2. + dX2 / 2. + width2], dX2, region2Mat, sN=sNord)
     bcs2 = {-1: {'vac': (2, 0)}}
     region2mesh1D.setBCs(bcs2)
     #
     # ## BUILD DOMAIN ###
     domain = sn.SubDomain()
     domain.addRegion(region1mesh1D)
     domain.addRegion(region2mesh1D)
     domain.buildSweepTree()
     #
     # ## SWEEP DOMAIN ###
     for si in range(180):
         resid = domain.sweepSubDomain(1)
         if resid < 1e-5:
             break
     scalarFlux = domain.getScalarFlux()
     for g in range(len(srcEnergy)):
         pass
     flxPlt.plotFluxE(scalarFlux[-1][::-1])  # flux vs E at left edge
     centroids = [cell.centroid for cell in domain.regions[0].cells]
     centroids += [cell.centroid for cell in domain.regions[1].cells]
     for g in range(len(srcEnergy)):
         sfp.plot1DScalarFlux(scalarFlux[:][:, g], centroids, label='Group ' + str(g + 1))
         # sfp.plot1DNeutronND(scalarFlux[:][:, g], centroids, g)
     # plot ord fluxes at leading edge
     ordFlux = domain.getOrdFlux()
     angles = np.arccos(domain.regions[0].cells[0].sNmu)
     g = 2
     mag = ordFlux[1][g, 0, :] / sum(ordFlux[1][g, 0, :])
     pof.compass(angles, mag, figName='polar_grp3')
     # plot ord fluxes at mid plane
     g = 3
     mag = ordFlux[1][g, 0, :] / sum(ordFlux[1][g, 0, :])
     pof.compass(angles, mag, figName='polar_grp4')
Beispiel #2
0
 def testAtten(self):
     print("\n========= INITIATING BEAM TEST ==========")
     width, dX = 50.0, 0.4
     sNord = 8
     attnMat = mx.mixedMat({'c12': 1.0})
     attnMat.setDensity(2.24)
     print(attnMat.nDdict)
     mesh1D = sn.Mesh1Dsn([0, width], dX, attnMat, sN=sNord)
     # define fixed boundary cond
     srcStrength = 1.e6  # [n / cm**2-s]
     # energy distribution of source (all born at 0.1MeV
     srcEnergy = np.array([1.0, 0, 0.0, 0, 0, 0, 0, 0, 0, 0])
     bcs = {0: {'fixN': (1, [srcStrength, srcEnergy])},
            -1: {'vac': (2, 0)}}
     mesh1D.setBCs(bcs)
     for si in range(1):
         resid = mesh1D.sweepMesh(1)
         if resid < 1e-5:
             break
     scalarFlux = mesh1D.getScalarFlux()
     for g in range(len(srcEnergy)):
         sfp.plot1DScalarFlux(scalarFlux[:][:, g], np.arange(0, width, dX), label='Group ' + str(g + 1))
         sfp.plot1DNeutronND(scalarFlux[:][:, g], np.arange(0, width, dX), g)
     flxPlt.plotFluxE(scalarFlux[-1][::-1])  # flux vs E at left edge
     # plot ord fluxes at leading edge
     ordFlux = mesh1D.getOrdFlux()
     angles = np.arccos(mesh1D.cells[0].sNmu)
     g = 2
     mag = ordFlux[1][g, 0, :] / sum(ordFlux[1][g, 0, :])
     pof.compass(angles, mag, figName='polar_grp3')
     # plot ord fluxes at mid plane
     g = 3
     mag = ordFlux[1][g, 0, :] / sum(ordFlux[1][g, 0, :])
     pof.compass(angles, mag, figName='polar_grp4')
Beispiel #3
0
 def testSSheild(self):
     testMat = mx.mixedMat({'fe56': 0.5, 'u235': 0.5})
     testMat.setDensity(10.0)
     #testMat._computeBackgroundXsec()
     ssTestMat = testMat.selfSheild()
     #print("Ffactors for fe56")
     #print(testMat.microDat['fe56']['f'])
     #print("Ffactors for u235")
     #print(testMat.microDat['u235']['f'])
     print("Self-sheilded Macro cross sections [1/cm] for fe56, u235 mix:")
     print(ssTestMat.macroProp['Ntotal'])
     print("Inf Dilute cross sections [1/cm] for fe56, u235 mix:")
     print(testMat.macroProp['Ntotal'])
Beispiel #4
0
 def testSSheild(self):
     testMat = mx.mixedMat({'fe56': 0.5, 'u235': 0.5})
     testMat.setDensity(10.0)
     #testMat._computeBackgroundXsec()
     ssTestMat = testMat.selfSheild()
     #print("Ffactors for fe56")
     #print(testMat.microDat['fe56']['f'])
     #print("Ffactors for u235")
     #print(testMat.microDat['u235']['f'])
     print("Self-sheilded Macro cross sections [1/cm] for fe56, u235 mix:")
     print(ssTestMat.macroProp['Ntotal'])
     print("Inf Dilute cross sections [1/cm] for fe56, u235 mix:")
     print(testMat.macroProp['Ntotal'])
Beispiel #5
0
 def testXSplot(self):
     """ Test ability to read XS file, and
     plot xs at multiple dilutions.
     """
     feMat = mx.mixedMat({'fe56': 1.0})
     feMat.setDensity(8.0)
     ffactors = feMat.microDat['fe56']['ffactor']
     totxs = feMat.microDat['fe56']['total']
     # plot at infinite dilution
     xsplt.xsPlot(totxs[::-1], label='Fe56 inf dilution')
     # plot at 10e-1 dilution
     totxs_ssheild = totxs * ffactors[:, 5]
     xsplt.xsPlot(totxs_ssheild[::-1], label='Fe56 10e-1 dilution', style='--')
     # Verify thermal XS is close to true val
     xsAt00253ev = 14.96
     print("Thermal XS diff: " + str(xsAt00253ev - totxs_ssheild[-2]) + " [b]")
     xsplt.xsPlot(np.ones(10) * xsAt00253ev, label='XS at 0.0253eV [KAERI]')
Beispiel #6
0
 def __init__(self, inputDict):
     # specify sub-domain extents.  For serial implementation, one sub-domain
     # is sufficient as all mesh-material regions will belong to the same CPU
     self.subDomains
     self.dim = inputDict.pop("dim", 1)
     #
     # specify mesh-material region extents and materials
     # as key val pairs
     defaultMat = mx.mixedMat({'u235': 0.1, 'h1': 0.6, 'o16': 0.3})
     defaultMat.setDensity(1.0)
     self.matRegions.pop("matRegions", {'glob1': ([0, 10], 0.01, defaultMat)})
     #
     # specify sN order.  Provide pre-computed quadrature, allow user defined
     # quadrature sets as well.
     self.sNord = inputDict.pop("sNorder", 2)  # S2 by default
     #
     # specify material xsdir (xs folder), default to default mat dir
     self.xsdir = inputDict.pop("xsdir", "./materials/hw2")
Beispiel #7
0
 def testXSplot(self):
     """ Test ability to read XS file, and
     plot xs at multiple dilutions.
     """
     feMat = mx.mixedMat({'fe56': 1.0})
     feMat.setDensity(8.0)
     ffactors = feMat.microDat['fe56']['ffactor']
     totxs = feMat.microDat['fe56']['total']
     # plot at infinite dilution
     xsplt.xsPlot(totxs[::-1], label='Fe56 inf dilution')
     # plot at 10e-1 dilution
     totxs_ssheild = totxs * ffactors[:, 5]
     xsplt.xsPlot(totxs_ssheild[::-1],
                  label='Fe56 10e-1 dilution',
                  style='--')
     # Verify thermal XS is close to true val
     xsAt00253ev = 14.96
     print("Thermal XS diff: " + str(xsAt00253ev - totxs_ssheild[-2]) +
           " [b]")
     xsplt.xsPlot(np.ones(10) * xsAt00253ev, label='XS at 0.0253eV [KAERI]')
Beispiel #8
0
 def testAtten(self):
     print("\n========= INITIATING BEAM TEST ==========")
     width, dX = 50.0, 0.4
     sNord = 8
     attnMat = mx.mixedMat({'c12': 1.0})
     attnMat.setDensity(2.24)
     print(attnMat.nDdict)
     mesh1D = sn.Mesh1Dsn([0, width], dX, attnMat, sN=sNord)
     # define fixed boundary cond
     srcStrength = 1.e6  # [n / cm**2-s]
     # energy distribution of source (all born at 0.1MeV
     srcEnergy = np.array([1.0, 0, 0.0, 0, 0, 0, 0, 0, 0, 0])
     bcs = {0: {'fixN': (1, [srcStrength, srcEnergy])}, -1: {'vac': (2, 0)}}
     mesh1D.setBCs(bcs)
     for si in range(1):
         resid = mesh1D.sweepMesh(1)
         if resid < 1e-5:
             break
     scalarFlux = mesh1D.getScalarFlux()
     for g in range(len(srcEnergy)):
         sfp.plot1DScalarFlux(scalarFlux[:][:, g],
                              np.arange(0, width, dX),
                              label='Group ' + str(g + 1))
         sfp.plot1DNeutronND(scalarFlux[:][:, g], np.arange(0, width, dX),
                             g)
     flxPlt.plotFluxE(scalarFlux[-1][::-1])  # flux vs E at left edge
     # plot ord fluxes at leading edge
     ordFlux = mesh1D.getOrdFlux()
     angles = np.arccos(mesh1D.cells[0].sNmu)
     g = 2
     mag = ordFlux[1][g, 0, :] / sum(ordFlux[1][g, 0, :])
     pof.compass(angles, mag, figName='polar_grp3')
     # plot ord fluxes at mid plane
     g = 3
     mag = ordFlux[1][g, 0, :] / sum(ordFlux[1][g, 0, :])
     pof.compass(angles, mag, figName='polar_grp4')
Beispiel #9
0
    totProd = 1e10 * 2 * 3   # (n/s-cm^3) * (cm)  -> n/s-cm^2
    # fraction out left and right face
    lfl = leftGrpCurrent / totProd
    rfl = rightGrpCurrent / totProd
    print("Fraction of source neutrons leaking left= " + str(lfl))
    print("Fraction of source neutrons leaking right= " + str(rfl))
    # non leakage prob
    nlp = 1 - (leftGrpCurrent + rightGrpCurrent) / totProd
    print("Non Leakage Probability= " + str(nlp))
    return nlp


if __name__ == "__main__":
    borMult = np.logspace(-2.5, 0, 10)
    # ## MATERIAL DEFS ##
    modMat = mx.mixedMat({'h1': 3.35e22 / 1e24, 'o16': 1.67e22 / 1e24})
    borMat = mx.mixedMat({'h1': 3.35e22 / 1e24, 'o16': 1.67e22 / 1e24, 'b10': 2.e21 / 1e24})
    # ## ABSORBER REGION WIDTHS AND POSITIONS ##
    widths = genZoneWidths([5, 10, 15], [2, 2, 2], 20)
    print(widths)
    # Explicit geom run
    testSlab(widths, modMat, borMat)
    # Homogenized geom run
    #homogenized(widths, modMat, borMat)
    #results = []
    #for mult in borMult:
    #    modMat = mx.mixedMat({'h1': 3.35e22 / 1e24, 'o16': 1.67e22 / 1e24})
    #    borMat = mx.mixedMat({'h1': 3.35e22 / 1e24, 'o16': 1.67e22 / 1e24, 'b10': mult * 2.e21 / 1e24})
    #    nlpE, pi1 = testSlab(widths, modMat, borMat)
    #    nlpH = homogenized(widths, modMat, borMat)
    #    results.append([pi1, nlpH, nlpE, (nlpH - nlpE) / nlpE])