mirror of
https://github.com/wassname/simpeg.git
synced 2026-08-14 12:50:10 +08:00
Edge inner products are derivatives w/ testing.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user