Esempio n. 1
0
 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 = Utils.av(n[0])[:, 1:]
             avR[0, 0] = 1.
             self._aveF2CC = ((0.5)*sp.hstack((sp.kron(Utils.speye(n[2]),
                                                       avR),
                                               sp.kron(Utils.av(n[2]),
                                                       Utils.speye(n[0]))),
                                              format="csr"))
         else:
             raise NotImplementedError('wrapping in the averaging is not '
                                       'yet implemented')
             # self._aveF2CC = (1./3.)*sp.hstack((Utils.kron3(Utils.speye(n[2]),
             #                                                Utils.speye(n[1]),
             #                                                Utils.av(n[0])),
             #                                    Utils.kron3(Utils.speye(n[2]),
             #                                                Utils.av(n[1]),
             #                                                Utils.speye(n[0])),
             #                                    Utils.kron3(Utils.av(n[2]),
             #                                                Utils.speye(n[1]),
             #                                                Utils.speye(n[0]))),
             #                                   format="csr")
     return self._aveF2CC
Esempio n. 2
0
 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 = Utils.av(n[0])[:, 1:]
             avR[0, 0] = 1.0
             self._aveF2CCV = sp.block_diag(
                 (sp.kron(Utils.speye(n[2]), avR), sp.kron(Utils.av(n[2]), Utils.speye(n[0]))), format="csr"
             )
         else:
             raise NotImplementedError("wrapping in the averaging is not " "yet implemented")
     return self._aveF2CCV
Esempio n. 3
0
 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 = Utils.av(n[0])[:, 1:]
             avR[0, 0] = 1.
             self._aveF2CCV = sp.block_diag(
                 (sp.kron(Utils.speye(n[2]),
                          avR), sp.kron(Utils.av(n[2]), Utils.speye(n[0]))),
                 format="csr")
         else:
             raise NotImplementedError('wrapping in the averaging is not '
                                       'yet implemented')
     return self._aveF2CCV
Esempio n. 4
0
 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 = Utils.av(n[0])[:, 1:]
             avR[0, 0] = 1.0
             self._aveE2CC = sp.kron(Utils.av(n[2]), avR, format="csr")
         else:
             raise NotImplementedError("wrapping in the averaging is not " "yet implemented")
             # self._aveE2CC = (1./3)*sp.hstack((Utils.kron3(Utils.av(n[2]),
             #                                               Utils.av(n[1]),
             #                                               Utils.speye(n[0])),
             #                                   Utils.kron3(Utils.av(n[2]),
             #                                               Utils.speye(n[1]),
             #                                               Utils.av(n[0])),
             #                                   Utils.kron3(Utils.speye(n[2]),
             #                                               Utils.av(n[1]),
             #                                               Utils.av(n[0]))),
             #                                  format="csr")
     return self._aveE2CC
Esempio n. 5
0
 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 = Utils.av(n[0])[:, 1:]
             avR[0, 0] = 1.
             self._aveE2CC = sp.kron(Utils.av(n[2]), avR, format="csr")
         else:
             raise NotImplementedError('wrapping in the averaging is not '
                                       'yet implemented')
             # self._aveE2CC = (1./3)*sp.hstack((Utils.kron3(Utils.av(n[2]),
             #                                               Utils.av(n[1]),
             #                                               Utils.speye(n[0])),
             #                                   Utils.kron3(Utils.av(n[2]),
             #                                               Utils.speye(n[1]),
             #                                               Utils.av(n[0])),
             #                                   Utils.kron3(Utils.speye(n[2]),
             #                                               Utils.av(n[1]),
             #                                               Utils.av(n[0]))),
             #                                  format="csr")
     return self._aveE2CC