Example #1
0
 def __init__(self,
              geoFile,
              materialDict,
              bcDict,
              srcDict,
              nGroups=10,
              legOrder=8,
              sNords=2):
     """
     Matierial dict in:
         {'material_str': material_class_instance, ...}
     format
     """
     quadSet = gaussLegQuadSet(sNords)  # quadrature set
     self.sNords = sNords  # number of discrete dirs tracked
     self.sNmu, self.wN = quadSet[0], quadSet[1]  # quadrature weights
     self.maxLegOrder = legOrder  # remember to range(maxLegORder + 1)
     self.nG = nGroups  # number of energy groups
     self.legArray = createLegArray(self.sNmu,
                                    self.maxLegOrder)  # Stores leg polys
     #
     gmshMesh = gmsh1DMesh(geoFile=geoFile)  # Run gmsh
     self.nodes = gmshMesh.nodes
     self.superMesh = superMesh(gmshMesh, materialDict, bcDict, srcDict,
                                nGroups, sNords)  # build the mesh
     self.depth = 0  # scattering source iteration depth
     self.keff = 1
     self.buildTransOp()
     self.buildRHS()
     self.applyBCs()
Example #2
0
 def __init__(self,
              xpos,
              deltaX,
              nGroups=10,
              legOrder=8,
              sNords=2,
              **kwargs):
     quadSet = gaussLegQuadSet(sNords)
     self.faceNormals = np.array([-1, 1])
     self.centroid = xpos
     self.deltaX = deltaX
     self.sNords = sNords  # number of discrete dirs tracked
     self.sNmu, self.wN = quadSet[0], quadSet[1]  # quadrature weights
     self.maxLegOrder = legOrder  # remember to range(maxLegORder + 1)
     self.legweights = np.zeros(legOrder + 1)
     self.nG = nGroups  # number of energy groups
     self.legArray = self._createLegArray(
         self.maxLegOrder)  # Stores leg polys
     #
     # initial flux guess
     iguess = kwargs.pop('iFlux', np.ones((nGroups, 3, self.sNords)))
     #
     # Ord flux vector: 0 is cell centered, 1 is left, 2 is right face
     self.ordFlux = iguess
     self.totOrdFlux = iguess
     #
     # Scattering Source term(s)
     self.qin = np.zeros(
         (nGroups, 3, self.sNords))  # init scatter/fission source
     #self.qin[0, 0, :] = 5e10
     self.previousQin = np.ones(
         (nGroups, 3, self.sNords))  # init scatter/fission source
     #
     # optional volumetric source (none by default, fission or user-set possible)
     self.S = kwargs.pop('source', np.zeros((nGroups, 3, self.sNords)))
     #
     # set bc, if any given
     bc = kwargs.pop('bc', None)  # none denotes interior cell
     if bc is not None:
         self.setBC(bc)
     self.multiplying = False
     if type(self.S) is str:
         if self.S == 'fission':
             self.multiplying = True
         else:
             self.S = np.zeros((nGroups, 3, self.sNords))
     elif self.S is None:
         self.S = np.zeros((nGroups, 3, self.sNords))
     elif type(self.S) is np.ndarray:
         if self.S.shape != (nGroups, 3, self.sNords):
             sys.exit(
                 "FATALITY: Invalid shape of source vector. Shape must be (nGrps, 3, sNords)."
             )
Example #3
0
 def __init__(self, nodes, fluxStor, source, **kwargs):
     """
     takes ([nodeIDs], [nodePos]) tuple.
     Optionally specify number of groups, leg order and number of ordinates
     """
     #
     # Basic data needed for scattering source calcs
     self.sNords = kwargs.pop("sNords",
                              2)  # number of discrete dirs tracked
     quadSet = kwargs.pop("quadSet",
                          gaussLegQuadSet(self.sNords))  # quadrature set
     self.sNmu, self.wN = quadSet[0], quadSet[1]  # quadrature weights
     self.maxLegOrder = kwargs.pop("legOrder",
                                   8)  # remember to range(maxLegORder + 1)
     self.nG = kwargs.pop("nGroups", 10)  # number of energy groups
     self.legArray = kwargs.pop(
         "legP", createLegArray(self.sNmu,
                                self.maxLegOrder))  # Stores leg polys
     #
     # Store node IDs in element and node positions
     self.nodeIDs, self.nodeVs = nodes
     self._computeDeltaX()  # Compute deltaX
     #
     # Flux and source storage
     self.setEleScFlux(fluxStor[0])
     self.setEleTotFlux(fluxStor[1])
     #
     # Scattering Source term(s)
     self.qin = np.zeros(
         (self.nG, self.sNords))  # init scatter/fission source
     self.previousQin = np.ones(
         self.qin.shape)  # required for over relaxation
     #
     # Volumetric source
     self.S = source
     self.multiplying = False
     if type(self.S) is str:
         if self.S == 'fission':
             self.multiplying = True
         else:
             self.S = np.zeros((self.nG, self.sNords))
     elif self.S is None:
         self.S = np.zeros((self.nG, self.sNords))
     elif type(self.S) is np.ndarray:
         if self.S.shape != (self.nG, self.sNords):
             sys.exit(
                 "FATALITY: Invalid shape of source vector. Shape must be (nGrps, 3, sNords)."
             )
         else:
             pass
Example #4
0
 def __init__(self, xpos, deltaX, nGroups=10, legOrder=8, sNords=2, **kwargs):
     quadSet = gaussLegQuadSet(sNords)
     self.faceNormals = np.array([-1, 1])
     self.centroid = xpos
     self.deltaX = deltaX
     self.sNords = sNords                                    # number of discrete dirs tracked
     self.sNmu, self.wN = quadSet[0], quadSet[1]             # quadrature weights
     self.maxLegOrder = legOrder                             # remember to range(maxLegORder + 1)
     self.legweights = np.zeros(legOrder + 1)
     self.nG = nGroups                                       # number of energy groups
     self.legArray = self._createLegArray(self.maxLegOrder)  # Stores leg polys
     #
     # initial flux guess
     iguess = kwargs.pop('iFlux', np.ones((nGroups, 3, self.sNords)))
     #
     # Ord flux vector: 0 is cell centered, 1 is left, 2 is right face
     self.ordFlux = iguess
     self.totOrdFlux = iguess
     #
     # Scattering Source term(s)
     self.qin = np.zeros((nGroups, 3, self.sNords))  # init scatter/fission source
     #self.qin[0, 0, :] = 5e10
     self.previousQin = np.ones((nGroups, 3, self.sNords))  # init scatter/fission source
     #
     # optional volumetric source (none by default, fission or user-set possible)
     self.S = kwargs.pop('source', np.zeros((nGroups, 3, self.sNords)))
     #
     # set bc, if any given
     bc = kwargs.pop('bc', None)  # none denotes interior cell
     if bc is not None:
         self.setBC(bc)
     self.multiplying = False
     if type(self.S) is str:
         if self.S == 'fission':
             self.multiplying = True
         else:
             self.S = np.zeros((nGroups, 3, self.sNords))
     elif self.S is None:
         self.S = np.zeros((nGroups, 3, self.sNords))
     elif type(self.S) is np.ndarray:
         if self.S.shape != (nGroups, 3, self.sNords):
             sys.exit("FATALITY: Invalid shape of source vector. Shape must be (nGrps, 3, sNords).")
Example #5
0
 def __init__(self, nodes, fluxStor, source, **kwargs):
     """
     takes ([nodeIDs], [nodePos]) tuple.
     Optionally specify number of groups, leg order and number of ordinates
     """
     #
     # Basic data needed for scattering source calcs
     self.sNords = kwargs.pop("sNords", 2)                                    # number of discrete dirs tracked
     quadSet = kwargs.pop("quadSet", gaussLegQuadSet(self.sNords))            # quadrature set
     self.sNmu, self.wN = quadSet[0], quadSet[1]                              # quadrature weights
     self.maxLegOrder = kwargs.pop("legOrder", 8)                             # remember to range(maxLegORder + 1)
     self.nG = kwargs.pop("nGroups", 10)                                      # number of energy groups
     self.legArray = kwargs.pop("legP", createLegArray(self.sNmu, self.maxLegOrder))     # Stores leg polys
     #
     # Store node IDs in element and node positions
     self.nodeIDs, self.nodeVs = nodes
     self._computeDeltaX()  # Compute deltaX
     #
     # Flux and source storage
     self.setEleScFlux(fluxStor[0])
     self.setEleTotFlux(fluxStor[1])
     #
     # Scattering Source term(s)
     self.qin = np.zeros((self.nG, self.sNords))         # init scatter/fission source
     self.previousQin = np.ones(self.qin.shape)  # required for over relaxation
     #
     # Volumetric source
     self.S = source
     self.multiplying = False
     if type(self.S) is str:
         if self.S == 'fission':
             self.multiplying = True
         else:
             self.S = np.zeros((self.nG, self.sNords))
     elif self.S is None:
         self.S = np.zeros((self.nG, self.sNords))
     elif type(self.S) is np.ndarray:
         if self.S.shape != (self.nG, self.sNords):
             sys.exit("FATALITY: Invalid shape of source vector. Shape must be (nGrps, 3, sNords).")
         else:
             pass
Example #6
0
 def __init__(self, geoFile, materialDict, bcDict, srcDict, nGroups=10,
              legOrder=8, sNords=2):
     """
     Matierial dict in:
         {'material_str': material_class_instance, ...}
     format
     """
     quadSet = gaussLegQuadSet(sNords)                       # quadrature set
     self.sNords = sNords                                    # number of discrete dirs tracked
     self.sNmu, self.wN = quadSet[0], quadSet[1]             # quadrature weights
     self.maxLegOrder = legOrder                             # remember to range(maxLegORder + 1)
     self.nG = nGroups                                       # number of energy groups
     self.legArray = createLegArray(self.sNmu, self.maxLegOrder)  # Stores leg polys
     #
     gmshMesh = gmsh1DMesh(geoFile=geoFile)  # Run gmsh
     self.nodes = gmshMesh.nodes
     self.superMesh = superMesh(gmshMesh, materialDict, bcDict, srcDict, nGroups, sNords)    # build the mesh
     self.depth = 0  # scattering source iteration depth
     self.keff = 1
     self.buildTransOp()
     self.buildRHS()
     self.applyBCs()