CircularLoopWholeSpace.magnetic_flux_density(xyz, coordinates='cartesian')#

Compute the magnetic flux density for the current loop in a wholespace.

This method computes the magnetic flux density for the cirular current loop at the set of gridded xyz locations provided. Where \(\mu\) is the magnetic permeability, \(I d\mathbf{s}\) represents an infinitessimal segment of current at location \(\mathbf{r_s}\) and \(\mathbf{r}\) is the location at which we want to evaluate the magnetic flux density \(\mathbf{B}\):

\[\mathbf{B}(\mathbf{r}) = - \frac{\mu I}{4\pi} \oint \frac{(\mathbf{r}-\mathbf{r_s}) \times d\mathbf{s}}{|\mathbf{r} - \mathbf{r_0}|^3}\]
xyz(n, 3) numpy.ndarray xyz

gridded locations at which we calculate the magnetic flux density

coordinates: str {‘cartesian’, ‘cylindrical’}

coordinate system that the location (xyz) are provided. The solution is also returned in this coordinate system. Default: “cartesian”

(n, 3) numpy.ndarray

The magnetic flux density at each observation location in the coordinate system specified in units T.


Here, we define a horizontal loop and plot the magnetic flux density on the xz-plane that intercepts at y=0.

>>> from geoana.em.static import CircularLoopWholeSpace
>>> from geoana.utils import ndgrid
>>> from geoana.plotting_utils import plot2Ddata
>>> import numpy as np
>>> import matplotlib.pyplot as plt

Let us begin by defining the loop.

>>> location = np.r_[0., 0., 0.]
>>> orientation = np.r_[0., 0., 1.]
>>> radius = 0.5
>>> simulation = CircularLoopWholeSpace(
>>>     location=location, orientation=orientation, radius=radius
>>> )

Now we create a set of gridded locations and compute the magnetic flux density.

>>> xyz = ndgrid(np.linspace(-1, 1, 50), np.array([0]), np.linspace(-1, 1, 50))
>>> B = simulation.magnetic_flux_density(xyz)

Finally, we plot the magnetic flux density on the plane.

>>> fig = plt.figure(figsize=(4, 4))
>>> ax = fig.add_axes([0.15, 0.15, 0.8, 0.8])
>>> plot2Ddata(xyz[:, 0::2], B[:, 0::2], ax=ax, vec=True, scale='log')
>>> ax.set_xlabel('X')
>>> ax.set_ylabel('Y')
>>> ax.set_title('Magnetic flux density at y=0')

(Source code, png, pdf)