Note
Click here to download the full example code
EM: Magnetic Dipole in a Whole-SpaceΒΆ
Here we plot the magnetic flux density from a harmonic dipole in a wholespace.

Out:
/Users/lindseyjh/git/simpeg/simpeg/examples/07-fdem/plot_analytic_mag_dipole_wholespace.py:53: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
plt.show()
import numpy as np
from SimPEG import Utils
import SimPEG.EM as EM
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
def run(XYZ=None, loc=np.r_[0., 0., 0.], sig=1.0, freq=1.0, orientation='Z',
plotIt=True):
if XYZ is None:
# avoid putting measurement points where source is
x = np.arange(-100.5, 100.5, step=1.)
y = np.r_[0]
z = x
XYZ = Utils.ndgrid(x, y, z)
Bx, By, Bz = EM.Analytics.FDEM.MagneticDipoleWholeSpace(
XYZ,
loc,
sig,
freq,
orientation=orientation
)
absB = np.sqrt(Bx*Bx.conj()+By*By.conj()+Bz*Bz.conj()).real
if plotIt:
fig, ax = plt.subplots(1, 1, figsize=(6, 5))
bxplt = Bx.reshape(x.size, z.size)
bzplt = Bz.reshape(x.size, z.size)
pc = ax.pcolor(x, z, absB.reshape(x.size, z.size), norm=LogNorm())
ax.streamplot(x, z, bxplt.real, bzplt.real, color='k', density=1)
ax.set_xlim([x.min(), x.max()])
ax.set_ylim([z.min(), z.max()])
ax.set_xlabel('x')
ax.set_ylabel('z')
cb = plt.colorbar(pc, ax=ax)
cb.set_label('|B| (T)')
return fig, ax
if __name__ == '__main__':
run()
plt.show()
Total running time of the script: ( 0 minutes 1.252 seconds)