mirror of
https://github.com/wassname/simpeg.git
synced 2026-06-29 07:41:31 +08:00
Order Test must incorporate different meshes. Current test fails, must support 2D mass matrices.
This commit is contained in:
@@ -2,6 +2,7 @@ import numpy as np
|
||||
from BaseMesh import BaseMesh
|
||||
from DiffOperators import DiffOperators
|
||||
from InnerProducts import InnerProducts
|
||||
from LomView import LomView
|
||||
from utils import mkvc, ndgrid, volTetra, indexCube, faceInfo
|
||||
|
||||
# Some helper functions.
|
||||
@@ -11,7 +12,7 @@ normalize2D = lambda x: x/np.kron(np.ones((1, 2)), mkvc(length2D(x), 2))
|
||||
normalize3D = lambda x: x/np.kron(np.ones((1, 3)), mkvc(length3D(x), 2))
|
||||
|
||||
|
||||
class LogicallyOrthogonalMesh(BaseMesh, DiffOperators, InnerProducts):
|
||||
class LogicallyOrthogonalMesh(BaseMesh, DiffOperators, InnerProducts, LomView):
|
||||
"""
|
||||
LogicallyOrthogonalMesh is a mesh class that deals with logically orthogonal meshes.
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from TensorMesh import TensorMesh
|
||||
from LogicallyOrthogonalMesh import LogicallyOrthogonalMesh
|
||||
import utils
|
||||
from exampleGrid import exampleLomGird
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
sys.path.append('../../')
|
||||
from SimPEG import TensorMesh, utils, LogicallyOrthogonalMesh
|
||||
from SimPEG import TensorMesh, utils, LogicallyOrthogonalMesh, exampleLomGird
|
||||
import numpy as np
|
||||
import unittest
|
||||
|
||||
@@ -92,11 +92,17 @@ class OrderTest(unittest.TestCase):
|
||||
|
||||
elif 'LOM' in self.meshType:
|
||||
if 'uniform' in self.meshType:
|
||||
xx = np.cumsum(np.r_[0, np.ones(nc)/nc])
|
||||
X, Y, Z = utils.ndgrid([xx, xx, xx], vector=False)
|
||||
kwrd = 'rect'
|
||||
elif 'rotate' in self.meshType:
|
||||
kwrd = 'rotate'
|
||||
else:
|
||||
raise Exception('Unexpected meshType')
|
||||
self.M = LogicallyOrthogonalMesh([X, Y, Z])
|
||||
if self.meshDimension == 2:
|
||||
X, Y = exampleLomGird([nc, nc], kwrd)
|
||||
self.M = LogicallyOrthogonalMesh([X, Y])
|
||||
if self.meshDimension == 3:
|
||||
X, Y, Z = exampleLomGird([nc, nc, nc], kwrd)
|
||||
self.M = LogicallyOrthogonalMesh([X, Y, Z])
|
||||
return 1./nc
|
||||
|
||||
def getError(self):
|
||||
@@ -119,7 +125,7 @@ class OrderTest(unittest.TestCase):
|
||||
err = self.getError()
|
||||
if ii == 0:
|
||||
print ''
|
||||
print 'Testing order of: ' + self.name
|
||||
print 'Testing convergence on ' + self.M._meshType + ' of: ' + self.name
|
||||
print '_____________________________________________'
|
||||
print ' h | error | e(i-1)/e(i) | order'
|
||||
print '~~~~~~|~~~~~~~~~~~~~|~~~~~~~~~~~~~|~~~~~~~~~~'
|
||||
|
||||
@@ -32,7 +32,9 @@ from OrderTest import OrderTest
|
||||
class TestInnerProducts(OrderTest):
|
||||
"""Integrate an function over a unit cube domain using edgeInnerProducts and faceInnerProducts."""
|
||||
|
||||
meshType = 'uniformLOM'
|
||||
meshType = 'rotateLOM'
|
||||
meshDimension = 2
|
||||
meshSizes = [16, 32, 64]
|
||||
|
||||
def getError(self):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user