Exemplo n.º 1
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')
Exemplo n.º 2
0
 def testKeigenSweep(self):
     print("\n========= INITIATING K-EIGEN TEST ==========")
     width, dX = 4.0, 0.05
     mesh1D = sn.Mesh1Dsn([0, width], dX, pinMaterial, sN=8)
     #bcs = {0: {'vac': (1, 0)}, -1: {'vac': (2, 0)}}  # vac bc test
     bcs = {0: {'ref': (1, 0)}, -1: {'ref': (2, 0)}}  # ref bc test
     mesh1D.setBCs(bcs)
     #
     fissionSrc = []
     mesh1D.setKeff(1.)
     fissionSrc.append(np.sum(mesh1D.fissionSrc()))  # todo mult by width
     scalarFlux = mesh1D.getScalarFlux()
     sfp.plot1DScalarFlux(scalarFlux[:][:, 1], np.arange(0, width, dX))
     for pI in range(8):
         # Perform source iterations
         nSourceIterations = 80
         for si in range(nSourceIterations):
             mesh1D.sweepMesh(10)
         fissionSrc.append(np.sum(mesh1D.fissionSrc()))
         knew = mesh1D.keff * (fissionSrc[-1] / fissionSrc[-2])
         print("Outter iteration: " + str(pI) + "  k-eff :" + str(knew))
         scalarFlux = mesh1D.getScalarFlux()
         flxPlt.plotFluxE(scalarFlux[len(np.arange(0, width, dX)) /
                                     2][::-1])
         sfp.plot1DScalarFlux(scalarFlux[:][:, 1], np.arange(0, width, dX))
         mesh1D.setKeff(knew)
         mesh1D.postSI()
Exemplo n.º 3
0
 def testKeigenSweep(self):
     print("\n========= INITIATING K-EIGEN TEST ==========")
     width, dX = 4.0, 0.05
     mesh1D = sn.Mesh1Dsn([0, width], dX, pinMaterial, sN=8)
     #bcs = {0: {'vac': (1, 0)}, -1: {'vac': (2, 0)}}  # vac bc test
     bcs = {0: {'ref': (1, 0)}, -1: {'ref': (2, 0)}}   # ref bc test
     mesh1D.setBCs(bcs)
     #
     fissionSrc = []
     mesh1D.setKeff(1.)
     fissionSrc.append(np.sum(mesh1D.fissionSrc()))  # todo mult by width
     scalarFlux = mesh1D.getScalarFlux()
     sfp.plot1DScalarFlux(scalarFlux[:][:, 1], np.arange(0, width, dX))
     for pI in range(8):
         # Perform source iterations
         nSourceIterations = 80
         for si in range(nSourceIterations):
             mesh1D.sweepMesh(10)
         fissionSrc.append(np.sum(mesh1D.fissionSrc()))
         knew = mesh1D.keff * (fissionSrc[-1] / fissionSrc[-2])
         print("Outter iteration: " + str(pI) + "  k-eff :" + str(knew))
         scalarFlux = mesh1D.getScalarFlux()
         flxPlt.plotFluxE(scalarFlux[len(np.arange(0, width, dX)) / 2][::-1])
         sfp.plot1DScalarFlux(scalarFlux[:][:, 1], np.arange(0, width, dX))
         mesh1D.setKeff(knew)
         mesh1D.postSI()
Exemplo n.º 4
0
 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')
Exemplo n.º 5
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')
Exemplo n.º 6
0
    # Load xs database
    import materials.materialMixxer as mx
    import utils.pinCellMatCalc as pcm
    mx.genMaterialDict('./materials/newXS')
    # Create pin cell material
    pinCellMaterial = pcm.createPinCellMat()
    modDict = {'u235': False, 'u238': False, 'zr90': False}
    resDict = {'h1': False, 'o16': False, 'zr90': False}
    ssPinCellMaterial = pinCellMaterial.selfSheild(modDict, resDict)
    # ssPinCellMaterial = pinCellMaterial.selfSheild()
    # Solve k-eigenvalue problem
    kVec, fluxVec = solveCrit(ssPinCellMaterial, k0=1.1)
    # Print f-factors for u238 and u235
    print(ssPinCellMaterial.microDat['u235']['f'])
    print(ssPinCellMaterial.microDat['u238']['f'])
    # Compute U235 and U238 reaction rates
    # numberDensity235 = pinCellMaterial.nDdict['u235']
    # numberDensity238 = pinCellMaterial.nDdict['u238']
    # u235 = mx.mixedMat({'u235': numberDensity235})
    # u238 = mx.mixedMat({'u238': numberDensity238})
    # Ru238 = np.sum(u238.macroProp['Nnufission'] * fluxVec[-1])
    # Ru235 = np.sum(u235.macroProp['Nnufission'] * fluxVec[-1])
    # fRR = np.sum([Ru238, Ru235])
    # print("Relative U238 fission reaction rate: " + str(Ru238 / fRR))
    # print("Relative U235 fission reaction rate: " + str(Ru235 / fRR))
    # plot results
    import plotters.fluxEplot as flxPlt
    flxPlt.plotFluxE(fluxVec[-1][::-1], label='Self Shield ON')
    kVec, fluxVec = solveCrit(pinCellMaterial, k0=1.1)
    flxPlt.plotFluxE(fluxVec[-1][::-1], label='Self Shield OFF')