In [1]:
from SimPEG import *
In [6]:
%pylab inline
In [69]:
cs = 25.
hx = [(cs,7, -1.3),(cs,21),(cs,7, 1.3)]
hy = [(cs,7, -1.3),(cs,21),(cs,7, 1.3)]
hz = [(cs,7, -1.3),(cs,20)]
In [72]:
mesh = Mesh.TensorMesh([hx, hy, hz], "CCN")
sigma = np.ones(mesh.nC)
In [79]:
print mesh
In [81]:
mesh.nC
Out[81]:
In [82]:
Div = mesh.faceDiv
In [83]:
mesh.setCellGradBC("neumann")
Out[83]:
In [84]:
Grad = mesh.cellGrad
In [101]:
Afc = mesh.aveF2CC
Msig = Utils.sdiag(1./(Afc.T*(1./sigma)))
In [102]:
A = Div*Msig*Grad
In [103]:
# A[-1, -1] / mesh.vol[-1]
In [104]:
A[0,0] /= mesh.vol[0]
In [105]:
inds = Utils.closestPoints(mesh, np.r_[0., 0., 0.])
In [106]:
q = np.zeros(mesh.nC)
q[inds] = 1.
In [109]:
from pymatsolver import MumpsSolver
In [110]:
Ainv = MumpsSolver(A)
In [111]:
phi = Ainv*q
In [115]:
mesh.vectorCCz.shape
Out[115]:
In [117]:
mesh.plotSlice(phi,ind=26, grid=True)
Out[117]:
In [120]:
xyzM = Utils.ndgrid(mesh.vectorCCx+5., mesh.vectorCCy, np.r_[0.])
xyzN = Utils.ndgrid(mesh.vectorCCx-5., mesh.vectorCCy, np.r_[0.])
In [123]:
PM = mesh.getInterpolationMat(xyzM, "CC")
PN = mesh.getInterpolationMat(xyzN, "CC")
In [ ]:
PM = mesh.getInterpolationMat
In [124]:
data = PM*phi-PN*phi
In [126]:
plt.imshow(data.reshape(mesh.nCx, mesh.nCy))
Out[126]:
In [ ]: