Merge branch 'master' into Dom_dev

This commit is contained in:
D Fournier
2016-02-04 11:06:53 -08:00
9 changed files with 2187 additions and 581 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+212 -69
View File
File diff suppressed because one or more lines are too long
+146 -33
View File
File diff suppressed because one or more lines are too long
+16 -14
View File
@@ -15,29 +15,31 @@ class FieldsDC_CC(Problem.Fields):
def startup(self):
self._cellGrad = self.survey.prob.mesh.cellGrad
self._Mfinv = self.survey.prob.mesh.getFaceInnerProduct(invMat=True)
def _phi(self, phi_sol, srcList):
phi = phi_sol
for i, src in enumerate(srcList):
phi_p = src.phi_p(self.survey.prob)
if phi_p is not None:
phi[:,i] += phi_p
# for i, src in enumerate(srcList):
# phi_p = src.phi_p(self.survey.prob)
# if phi_p is not None:
# phi[:,i] += phi_p
return phi
def _e(self, phi_sol, srcList):
e = -self._cellGrad*phi_sol
for i, src in enumerate(srcList):
e_p = src.e_p(self.survey.prob)
if e_p is not None:
e[:,i] += e_p
# for i, src in enumerate(srcList):
# e_p = src.e_p(self.survey.prob)
# if e_p is not None:
# e[:,i] += e_p
return e
def _j(self, phi_sol, srcList):
j = -self.survey.prob.Msig*self._cellGrad*phi_sol
for i, src in enumerate(srcList):
j_p = src.j_p(self.survey.prob)
if j_p is not None:
j[:,i] += j_p
j = -self._Mfinv*self.survey.prob.Msig*self._cellGrad*phi_sol
# for i, src in enumerate(srcList):
# j_p = src.j_p(self.survey.prob)
# if j_p is not None:
# j[:,i] += j_p
return j
@@ -176,7 +178,7 @@ class ProblemDC_CC(Problem.BaseProblem):
G = self.mesh.cellGrad
self._A = D*self.Msig*G
# Remove the null space from the matrix.
self._A[-1,-1] = 1. #self.mesh.vol[-1]
self._A[0,0] /= self.mesh.vol[0]
self._A = self._A.tocsc()
return self._A
+4 -4
View File
@@ -6,7 +6,7 @@ from pymatsolver import MumpsSolver
class IPforwardTests(unittest.TestCase):
def test_IPforward(self):
cs = 12.5
nc = 500/cs+1
hx = [(cs,7, -1.3),(cs,nc),(cs,7, 1.3)]
@@ -17,7 +17,7 @@ class IPforwardTests(unittest.TestCase):
sigma = np.ones(mesh.nC)*sighalf
p0 = np.r_[-50., 50., -50.]
p1 = np.r_[ 50.,-50., -150.]
blk_ind = Utils.ModelBuilder.getIndecesBlock(p0, p1, mesh.gridCC)
blk_ind = Utils.ModelBuilder.getIndicesBlock(p0, p1, mesh.gridCC)
sigma[blk_ind] = 1e-3
eta = np.zeros_like(sigma)
eta[blk_ind] = 0.1
@@ -36,7 +36,7 @@ class IPforwardTests(unittest.TestCase):
problem = DC.ProblemDC_CC(mesh, mapping= imap )
problem.Solver = MumpsSolver
problem.pair(survey)
phi0 = survey.dpred(sigma0)
phiInf = survey.dpred(sigmaInf)
@@ -49,7 +49,7 @@ class IPforwardTests(unittest.TestCase):
phiIP_approx = surveyIP.dpred(eta)
err = np.linalg.norm(phiIP_true-phiIP_approx) / np.linalg.norm(phiIP_true)
self.assertTrue(err < 0.02)
+1 -1
View File
@@ -19,7 +19,7 @@ class IPProblemTests(unittest.TestCase):
sigma = np.ones(mesh.nC)*sighalf
p0 = np.r_[-50., 50., -50.]
p1 = np.r_[ 50.,-50., -150.]
blk_ind = Utils.ModelBuilder.getIndecesBlock(p0, p1, mesh.gridCC)
blk_ind = Utils.ModelBuilder.getIndicesBlock(p0, p1, mesh.gridCC)
sigma[blk_ind] = 1e-3
eta = np.zeros_like(sigma)
eta[blk_ind] = 0.1