def aveEz2CC(self): "Construct the averaging operator on cell edges in the z direction to cell centers." if self.dim < 3: return None if getattr(self, '_aveEz2CC', None) is None: # The number of cell centers in each direction n = self.vnC if(self.dim == 3): self._aveEz2CC = kron3(speye(n[2]), av(n[1]), av(n[0])) return self._aveEz2CC
def aveFy2CC(self): "Construct the averaging operator on cell faces in the y direction to cell centers." if self.dim < 2: return None if getattr(self, '_aveFy2CC', None) is None: n = self.vnC if(self.dim == 2): self._aveFy2CC = sp.kron(av(n[1]), speye(n[0])) elif(self.dim == 3): self._aveFy2CC = kron3(speye(n[2]), av(n[1]), speye(n[0])) return self._aveFy2CC
def aveF2CCV(self): "Construct the averaging operator on cell faces to cell centers." if getattr(self, '_aveF2CCV', None) is None: n = self.vnC if self.isSymmetric: avR = av(n[0])[:,1:] avR[0,0] = 1. self._aveF2CCV = sp.block_diag((sp.kron(speye(n[2]), avR), sp.kron(av(n[2]), speye(n[0]))), format="csr") else: raise NotImplementedError('wrapping in the averaging is not yet implemented') return self._aveF2CCV
def aveEx2CC(self): "Construct the averaging operator on cell edges in the x direction to cell centers." if getattr(self, '_aveEx2CC', None) is None: # The number of cell centers in each direction n = self.vnC if(self.dim == 1): self._aveEx2CC = speye(n[0]) elif(self.dim == 2): self._aveEx2CC = sp.kron(av(n[1]), speye(n[0])) elif(self.dim == 3): self._aveEx2CC = kron3(av(n[2]), av(n[1]), speye(n[0])) return self._aveEx2CC
def aveF2CC(self): "Construct the averaging operator on cell faces to cell centers." if getattr(self, '_aveF2CC', None) is None: n = self.vnC if self.isSymmetric: avR = av(n[0])[:,1:] avR[0,0] = 1. self._aveF2CC = (0.5)*sp.hstack((sp.kron(speye(n[2]), avR), sp.kron(av(n[2]), speye(n[0]))), format="csr") else: raise NotImplementedError('wrapping in the averaging is not yet implemented') # self._aveF2CC = (1./3.)*sp.hstack((kron3(speye(n[2]), speye(n[1]), av(n[0])), # kron3(speye(n[2]), av(n[1]), speye(n[0])), # kron3(av(n[2]), speye(n[1]), speye(n[0]))), format="csr") return self._aveF2CC
def aveF2CCV(self): "Construct the averaging operator on cell faces to cell centers." if getattr(self, '_aveF2CCV', None) is None: n = self.vnC if self.isSymmetric: avR = av(n[0])[:, 1:] avR[0, 0] = 1. self._aveF2CCV = sp.block_diag((sp.kron(speye( n[2]), avR), sp.kron(av(n[2]), speye(n[0]))), format="csr") else: raise NotImplementedError( 'wrapping in the averaging is not yet implemented') return self._aveF2CCV
def aveE2CC(self): "Construct the averaging operator on cell edges to cell centers." if getattr(self, '_aveE2CC', None) is None: # The number of cell centers in each direction n = self.vnC if self.isSymmetric: avR = av(n[0])[:, 1:] avR[0, 0] = 1. self._aveE2CC = (0.5) * sp.kron(av(n[2]), avR, format="csr") else: raise NotImplementedError( 'wrapping in the averaging is not yet implemented') # self._aveE2CC = (1./3)*sp.hstack((kron3(av(n[2]), av(n[1]), speye(n[0])), # kron3(av(n[2]), speye(n[1]), av(n[0])), # kron3(speye(n[2]), av(n[1]), av(n[0]))), format="csr") return self._aveE2CC
def aveN2F(self): "Construct the averaging operator on cell nodes to cell faces, keeping each dimension separate." if getattr(self, '_aveN2F', None) is None: # The number of cell centers in each direction n = self.vnC if(self.dim == 1): self._aveN2F = av(n[0]) elif(self.dim == 2): self._aveN2F = sp.vstack((sp.kron(av(n[1]), speye(n[0]+1)), sp.kron(speye(n[1]+1), av(n[0]))), format="csr") elif(self.dim == 3): self._aveN2F = sp.vstack((kron3(av(n[2]), av(n[1]), speye(n[0]+1)), kron3(av(n[2]), speye(n[1]+1), av(n[0])), kron3(speye(n[2]+1), av(n[1]), av(n[0]))), format="csr") return self._aveN2F
def aveFz2CC(self): """ Construct the averaging operator on cell faces in the z direction to cell centers. """ if self.dim < 3: return None if getattr(self, '_aveFz2CC', None) is None: n = self.vnC if (self.dim == 3): self._aveFz2CC = kron3(av(n[2]), speye(n[1]), speye(n[0])) return self._aveFz2CC
def aveFz2CC(self): """ Construct the averaging operator on cell faces in the z direction to cell centers. """ if self.dim < 3: return None if getattr(self, '_aveFz2CC', None) is None: n = self.vnC if(self.dim == 3): self._aveFz2CC = kron3(av(n[2]), speye(n[1]), speye(n[0])) return self._aveFz2CC
def aveN2CC(self): "Construct the averaging operator on cell nodes to cell centers." if getattr(self, '_aveN2CC', None) is None: # The number of cell centers in each direction n = self.vnC if(self.dim == 1): self._aveN2CC = av(n[0]) elif(self.dim == 2): self._aveN2CC = sp.kron(av(n[1]), av(n[0])).tocsr() elif(self.dim == 3): self._aveN2CC = kron3(av(n[2]), av(n[1]), av(n[0])).tocsr() return self._aveN2CC
def aveN2CC(self): "Construct the averaging operator on cell nodes to cell centers." if getattr(self, '_aveN2CC', None) is None: # The number of cell centers in each direction n = self.vnC if (self.dim == 1): self._aveN2CC = av(n[0]) elif (self.dim == 2): self._aveN2CC = sp.kron(av(n[1]), av(n[0])).tocsr() elif (self.dim == 3): self._aveN2CC = kron3(av(n[2]), av(n[1]), av(n[0])).tocsr() return self._aveN2CC