Working on MT problem and survey. Fixed bugs and completed example

This commit is contained in:
Gudni Karl Rosenkjaer
2015-02-17 00:09:24 -08:00
parent fb717b5f31
commit 9b650041d1
4 changed files with 126 additions and 47 deletions
+14 -10
View File
@@ -1,36 +1,40 @@
def homo1DModelSource(mesh,freq,bgMod):
import SimPEG as simpeg, numpy as np
from simpegMT.Utils import get1DEfields
def homo1DModelSource(mesh,freq,m_back):
'''
Function that calculates and return background fields
:param Simpeg mesh object mesh: Holds information on the discretization
:param float freq: The frequency to solve at
:param np.array bgMod: Background model to base the calculations on.
:param np.array m_back: Background model of conductivity to base the calculations on.
:rtype: numpy.ndarray (mesh.nE,2)
:return: eBG_bp, E fields for the background model at both polarizations.
'''
# import
import SimPEG as simpeg
from simpegMT.Utils import get1DEfields
# Get a 1d solution for a halfspace background
mesh1d = simpeg.Mesh.TensorMesh([mesh.hz],np.array([mesh.x0[2]]))
e0_1d = get1DEfields(mesh1d,mesh.r(sigBG,'CC','CC','M')[0,0,:],freq)
e0_1d = get1DEfields(mesh1d,mesh.r(m_back,'CC','CC','M')[0,0,:],freq)
# Setup x (east) polarization (_x)
ex_px = np.zeros(mesh.vnEx,dtype=complex)
ey_px = np.zeros((mesh.nEy,1),dtype=complex)
ez_px = np.zeros((mesh.nEz,1),dtype=complex)
# Assign the source to ex_x
for i in arange(mesh.vnEx[0]):
for j in arange(mesh.vnEx[1]):
for i in np.arange(mesh.vnEx[0]):
for j in np.arange(mesh.vnEx[1]):
ex_px[i,j,:] = e0_1d
eBG_px = np.vstack((simpeg.Utils.mkvc(mesh.r(ex_px,'Ex','Ex','V'),2),ey_px,ez_px))
# Setup y (north) polarization (_py)
ex_py = np.zeros(mesh.nEx, dtype='complex128')
ey_py = np.zeros((mesh.vnEy), dtype='complex128')
ez_py = np.zeros(mesh.nEz, dtype='complex128')
ex_py = np.zeros((mesh.nEx,1), dtype='complex128')
ey_py = np.zeros(mesh.vnEy, dtype='complex128')
ez_py = np.zeros((mesh.nEz,1), dtype='complex128')
# Assign the source to ey_py
for i in arange(mesh.vnEy[0]):
for j in arange(mesh.vnEy[1]):
for i in np.arange(mesh.vnEy[0]):
for j in np.arange(mesh.vnEy[1]):
ey_py[i,j,:] = e0_1d
eBG_py = np.vstack((ex_py,simpeg.Utils.mkvc(ey_py,2),ez_py))