Cell centered grid working in LOM

This commit is contained in:
Rowan Cockett
2013-07-24 12:25:31 -07:00
parent 0d298af1d7
commit dc9a92c83a
2 changed files with 60 additions and 4 deletions
+42
View File
@@ -245,6 +245,48 @@ class DiffOperators(object):
_edgeAve = None
edgeAve = property(**edgeAve())
def nodalAve():
doc = "Construct the averaging operator on cell nodes to cell centers."
def fget(self):
if(self._nodalAve is None):
# The number of cell centers in each direction
n = self.n
if(self.dim == 1):
self._nodalAve = av(n[0])
elif(self.dim == 2):
self._nodalAve = sp.hstack((sp.kron(av(n[1]), av(n[0])),
sp.kron(av(n[1]), av(n[0]))), format="csr")
elif(self.dim == 3):
self._nodalAve = sp.hstack((kron3(av(n[2]), av(n[1]), av(n[0])),
kron3(av(n[2]), av(n[1]), av(n[0])),
kron3(av(n[2]), av(n[1]), av(n[0]))), format="csr")
return self._nodalAve
return locals()
_nodalAve = None
nodalAve = property(**nodalAve())
def nodalVectorAve():
doc = "Construct the averaging operator on cell nodes to cell centers, keeping each dimension seperate."
def fget(self):
if(self._nodalVectorAve is None):
# The number of cell centers in each direction
n = self.n
if(self.dim == 1):
self._nodalVectorAve = av(n[0])
elif(self.dim == 2):
self._nodalVectorAve = sp.block_diag((sp.kron(av(n[1]), av(n[0])),
sp.kron(av(n[1]), av(n[0]))), format="csr")
elif(self.dim == 3):
self._nodalVectorAve = sp.block_diag((kron3(av(n[2]), av(n[1]), av(n[0])),
kron3(av(n[2]), av(n[1]), av(n[0])),
kron3(av(n[2]), av(n[1]), av(n[0]))), format="csr")
return self._nodalVectorAve
return locals()
_nodalVectorAve = None
nodalVectorAve = property(**nodalVectorAve())
def getEdgeMass(self, materialProp=None):
"""mass matix for products of edge functions w'*M(materialProp)*e"""
if(materialProp is None):