choclo.prism.magnetic_field(easting, northing, upward, prism, magnetization)[source]#

Magnetic field due to a rectangular prism

Returns the three components of the magnetic field due to a single rectangular prism on a single computation point.


Use this function when all the three component of the magnetic fields are needed. Running this function is faster than computing each component separately. Use one of magnetic_e, magnetic_n, magnetic_u if you need only one of them.

  • easting (float) – Easting coordinate of the observation point. Must be in meters.

  • northing (float) – Northing coordinate of the observation point. Must be in meters.

  • upward (float) – Upward coordinate of the observation point. Must be in meters.

  • prism (1d-array) – One dimensional array containing the coordinates of the prism in the following order: west, east, south, north, bottom, top in a Cartesian coordinate system. All coordinates should be in meters.

  • magnetization (1d-array) – Magnetization vector of the prism. It should have three components in the following order: magnetization_easting, magnetization_northing, magnetization_upward. Should be in \(A m^{-1}\).


b_e, b_n, b_u (floats) – The three components of the magnetic field generated by the prism on the observation point in \(\text{T}\). The components are returned in the following order: b_e, b_n, b_u.


Consider an observation point \(\mathbf{p}\) and a prism \(R\) with a magnetization vector \(\mathbf{M}\). The magnetic field \(\mathbf{B}\) it generates on the observation point \(\mathbf{p}\) is defined as:

\[\mathbf{B}(\mathbf{p}) = - \frac{\mu_0}{4\pi} \nabla_\mathbf{p} \left[ \int\limits_R \mathbf{M} \cdot \nabla_\mathbf{q} \left( \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} \right) dv \right]\]

Since the magnetization vector is constant inside the boundaries of the prism, we can write the easting component of \(\mathbf{B}\) as:

\[B_x(\mathbf{p}) = - \frac{\mu_0}{4\pi} \left[ M_x \int\limits_R \frac{\partial}{\partial x_p} \left[ \frac{\partial}{\partial x_q} \left( \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} \right) \right] dv + M_y \int\limits_R \frac{\partial}{\partial x_p} \left[ \frac{\partial}{\partial y_q} \left( \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} \right) \right] dv + M_z \int\limits_R \frac{\partial}{\partial x_p} \left[ \frac{\partial}{\partial z_q} \left( \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} \right) \right] dv \right]\]

where \(M_x\), \(M_y\) and \(M_z\) are the components of the magnetization vector. The other components can be expressed in an analogous way.

It can be proved that

\[\frac{\partial}{\partial x_q} \left( \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} \right) = - \frac{\partial}{\partial x_p} \left( \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} \right)\]

and that it also holds for the two other directions. Therefore, we can rewrite \(B_x\) as:

\[B_x(\mathbf{p}) = + \frac{\mu_0}{4\pi} \left[ M_x \frac{\partial^2}{\partial x_p^2} \int\limits_R \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} dv + M_y \frac{\partial^2}{\partial x_p \partial y_p} \int\limits_R \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} dv + M_z \frac{\partial^2}{\partial x_p \partial z_p} \int\limits_R \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} dv \right]\]

Solutions to each one of the integrals in the previous equation and their second derivatives are given by [Nagy2000].

Following [Oliveira2015] we can define a symmetrical 3x3 matrix \(\mathbf{U}\) whose elements are the second derivatives of the previous integrals, such as:

\[u_{ij} = \frac{\partial}{\partial i} \frac{\partial}{\partial j} \int\limits_R \frac{1}{\lVert \mathbf{p} - \mathbf{q} \rVert} dv\]

with \(i, j \in \{x, y z\}\).

We can then express the magnetic field \(\mathbf{B}(\mathbf{p})\) generated by the prism in a compact form:

\[\mathbf{B}(\mathbf{p}) = \frac{\mu_0}{4\pi} \mathbf{U} \cdot \mathbf{M}\]