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()
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
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