Fork me on GitHub

geoscience / scientific computing / visualization / web design / thoughts

simpeg / SimPEG Play - Anisotropic Block

by Rowan Cockett
In [1]:
from SimPEG import *
Warning: mumps solver not available.

In [40]:
M = mesh.TensorMesh([30,40])
In [51]:
D = M.faceDiv
G = M.cellGrad
sig1 = np.ones(M.nC)
sig2 = 2.*np.ones(M.nC)
sig3 = np.zeros(M.nC)
xL = (np.abs(M.gridCC[:,0]-0.5)<0.25)
yL = (np.abs(M.gridCC[:,1]-0.5)<0.25)
sig3[np.logical_and(xL,yL)] = 0.25
sig = np.c_[sig1,sig2,sig3]

Msig_ani = M.getFaceInnerProduct(sig)
Msig_iso = M.getFaceInnerProduct(sig1)

rhs = np.zeros(M.nCv)
rhs[[3,27],[10,30]] = [-1,1]
rhs = utils.mkvc(rhs)
M.plotImage(rhs)
Out[51]:
<matplotlib.collections.QuadMesh at 0x111b2a250>
In [52]:
phi_ani = Solver(D*Msig_ani*G).solve(rhs)
phi_iso = Solver(D*Msig_iso*G).solve(rhs)
M.plotImage(phi_ani, figNum=1)
M.plotImage(phi_iso,figNum=2)
M.plotImage(phi_iso - phi_ani,figNum=3)
Out[52]:
<matplotlib.collections.QuadMesh at 0x111d90590>
In []: