- added capability for adding a mu model

- added variable mu in the FDEM testing
- also added capability to add a small random vector to sigma and mu for testing
This commit is contained in:
Lindsey
2015-02-24 11:43:59 -08:00
parent bc7fb2f1d7
commit 71881c7ce8
+16 -1
View File
@@ -2,9 +2,12 @@ import unittest
from SimPEG import *
import simpegEM as EM
import sys
from scipy.constants import mu_0
TOL = 1e-4
CONDUCTIVITY = 1e3
MU = mu_0
addrandoms = True
def getProblem(fdemType, comp):
cs = 5.
@@ -44,7 +47,14 @@ def adjointTest(fdemType, comp):
prb = getProblem(fdemType, comp)
print 'Adjoint %s formulation - %s' % (fdemType, comp)
m = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY)
m = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY)
mu = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY)
if addrandoms is True:
m = m + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3
mu = mu + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3
prb.mu = mu
survey = prb.survey
v = np.random.rand(survey.nD)
@@ -61,6 +71,11 @@ def derivTest(fdemType, comp):
prb = getProblem(fdemType, comp)
print '%s formulation - %s' % (fdemType, comp)
x0 = np.log(np.ones(prb.mesh.nC)*CONDUCTIVITY)
if addrandoms is True:
x0 = x0 + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3
mu = mu + np.random.randn(prb.mesh.nC)*CONDUCTIVITY*1e-3
survey = prb.survey
def fun(x):
return survey.dpred(x), lambda x: prb.Jvec(x0, x)