Added analytics directory to Utils. Finished example of TDEM_b. Seems to be working....

This commit is contained in:
Dave Marchant
2014-02-05 23:47:21 -08:00
parent d65705fd0b
commit 08f2020ae9
4 changed files with 29 additions and 4 deletions
+15 -4
View File
@@ -63,11 +63,14 @@ class ProblemTDEM_b(ProblemBaseTDEM):
if __name__ == '__main__':
from SimPEG import *
import simpegEM as EM
from simpegEM.Utils.Ana import hzAnalyticDipoleT
from scipy.constants import mu_0
import matplotlib.pyplot as plt
cs = 5.
ncx = 20
ncy = 6
npad = 15
npad = 20
hx = Utils.meshTensors(((0,cs), (ncx,cs), (npad,cs)))
hy = Utils.meshTensors(((npad,cs), (ncy,cs), (npad,cs)))
mesh = Mesh.Cyl1DMesh([hx,hy], -hy.sum()/2)
@@ -81,8 +84,16 @@ if __name__ == '__main__':
dat = EM.TDEM.DataTDEM1D(txLoc=txLoc, txType=txType, rxLoc=rxLoc, rxType=rxType, timeCh=timeCh)
prb = EM.TDEM.ProblemTDEM_b(mesh, model)
prb.setTimes([1e-5, 5e-5, 2.5e-4], [50, 50, 50])
prb.sigma = np.ones(mesh.nCz)
prb.setTimes([1e-5, 5e-5, 2.5e-4], [150, 150, 150])
prb.sigma = np.ones(mesh.nCz)*1e-8
prb.sigma[mesh.vectorCCz<0] = 0.1
prb.pair(dat)
F = prb.field(prb.sigma)
bz_calc = dat.dpred(-999999)
bz_ana = mu_0*hzAnalyticDipoleT(dat.rxLoc[0], prb.times, prb.sigma[0])
plt.loglog(prb.times, np.abs(bz_calc.flatten()), label='TDEM_b')
plt.loglog(prb.times, np.abs(bz_ana), 'r', label='Analytic')
plt.legend()
plt.show()
+12
View File
@@ -0,0 +1,12 @@
import numpy as np
from scipy.constants import mu_0, pi
from scipy.special import erf
def hzAnalyticDipoleT(r, t, sigma):
theta = np.sqrt((sigma*mu_0)/(4*t))
tr = theta*r
etr = erf(tr)
t1 = (9/(2*tr**2) - 1)*etr
t2 = (1/np.sqrt(pi))*(9/tr + 4*tr)*np.exp(-tr**2)
hz = (t1 - t2)/(4*pi*r**3)
return hz
+1
View File
@@ -0,0 +1 @@
from TEM import hzAnalyticDipoleT
+1
View File
@@ -1 +1,2 @@
import Sources
import Ana