コード例 #1
0
ファイル: DiffOperators.py プロジェクト: KyuboNoh/HY
 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
コード例 #2
0
ファイル: DiffOperators.py プロジェクト: gitter-badger/simpeg
 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
コード例 #3
0
ファイル: DiffOperators.py プロジェクト: KyuboNoh/HY
 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
コード例 #4
0
ファイル: DiffOperators.py プロジェクト: gitter-badger/simpeg
 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
コード例 #5
0
ファイル: CylMesh.py プロジェクト: dakentod/simpeg
 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
コード例 #6
0
ファイル: DiffOperators.py プロジェクト: KyuboNoh/HY
 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
コード例 #7
0
ファイル: DiffOperators.py プロジェクト: gitter-badger/simpeg
 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
コード例 #8
0
ファイル: CylMesh.py プロジェクト: dakentod/simpeg
 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
コード例 #9
0
ファイル: CylMesh.py プロジェクト: gitter-badger/simpeg
 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
コード例 #10
0
ファイル: CylMesh.py プロジェクト: gitter-badger/simpeg
 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
コード例 #11
0
ファイル: DiffOperators.py プロジェクト: KyuboNoh/HY
 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
コード例 #12
0
ファイル: DiffOperators.py プロジェクト: gitter-badger/simpeg
 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
コード例 #13
0
ファイル: DiffOperators.py プロジェクト: zyex1108/simpeg
 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
コード例 #14
0
 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
コード例 #15
0
ファイル: DiffOperators.py プロジェクト: KyuboNoh/HY
 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
コード例 #16
0
ファイル: DiffOperators.py プロジェクト: westamine/simpeg
 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