Edge inner products are derivatives w/ testing.

This commit is contained in:
rowanc1
2014-03-01 06:54:30 -08:00
parent b5c7b11265
commit 3eb8224e28
3 changed files with 92 additions and 10 deletions
+13 -2
View File
@@ -11,7 +11,6 @@ class TestInnerProductsDerivs(unittest.TestCase):
def test_FaceIP_derivs_isotropic(self):
for d in range(3):
mesh = Mesh.TensorMesh([10,5,4][d:])
M,Ps = mesh.getFaceInnerProduct(returnP=True)
v = np.random.rand(mesh.nF)
def fun(sig):
M = mesh.getFaceInnerProduct(sig)
@@ -21,10 +20,22 @@ class TestInnerProductsDerivs(unittest.TestCase):
passed = checkDerivative(fun, sig, plotIt=False)
self.assertTrue(passed)
def test_EdgeIP_derivs_isotropic(self):
for h in [[10,5],[10,5,4]]:
mesh = Mesh.TensorMesh(h)
v = np.random.rand(mesh.nE)
def fun(sig):
M = mesh.getEdgeInnerProduct(sig)
Md = mesh.getEdgeInnerProductDeriv(sig)
return M*v, Utils.sdiag(v)*Md
sig = np.random.rand(mesh.nC)
passed = checkDerivative(fun, sig, plotIt=False)
self.assertTrue(passed)
def test_FaceIP_derivs_anisotropic(self):
for d in range(3):
mesh = Mesh.TensorMesh([10,5,4][d:])
M,Ps = mesh.getFaceInnerProduct(returnP=True)
v = np.random.rand(mesh.nF)
def fun(sig):
M = mesh.getFaceInnerProduct(sig)