geoana.em.static.PointCurrentHalfSpace.electric_field#
- PointCurrentHalfSpace.electric_field(xyz)#
Electric field for a point current in a halfspace.
This method computes the electric field for the point current in a halfspace at the set of gridded xyz locations provided. Where \(- \nabla V\) is the negative gradient of the electric potential for the point current. The electric field \(\mathbf{E}\) is:
\[\mathbf{E} = -\nabla V\]- Parameters:
- xyz(…, 3) numpy.ndarray
Locations to evaluate at in units m.
- Returns:
- E(…, 3) np.ndarray
Electric field of point current in units \(\frac{V}{m}\).
Examples
Here, we define a point current with current=1A in a halfspace and plot the electric field lines in the xy-plane.
>>> import numpy as np >>> import matplotlib.pyplot as plt >>> from geoana.em.static import PointCurrentHalfSpace
Define the point current.
>>> rho = 1.0 >>> current = 1.0 >>> simulation = PointCurrentHalfSpace( >>> current=current, rho=rho, location=None >>> )
Now we create a set of gridded locations and compute the electric field.
>>> X, Y = np.meshgrid(np.linspace(-1, 1, 20), np.linspace(-1, 1, 20)) >>> Z = np.zeros_like(X) >>> xyz = np.stack((X, Y, Z), axis=-1) >>> e = simulation.electric_field(xyz)
Finally, we plot the electric field lines.
>>> e_amp = np.linalg.norm(e, axis=-1) >>> plt.pcolor(X, Y, e_amp) >>> cb = plt.colorbar() >>> cb.set_label(label= 'Amplitude ($V/m$)') >>> plt.streamplot(X, Y, e[..., 0], e[..., 1], density=0.50) >>> plt.xlabel('x') >>> plt.ylabel('y') >>> plt.title('Electric Field Lines for a Point Current in a Halfspace') >>> plt.show()
(
Source code
,png
,pdf
)