Skip to content

Commit

Permalink
Deploy to GitHub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Nov 2, 2023
0 parents commit 8c6d002
Show file tree
Hide file tree
Showing 1,204 changed files with 479,231 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 16d3360a29ba6d075d2077b5939d3251
tags: 645f666f9bcd5a90fca523b33c5a78b7
Empty file added .nojekyll
Empty file.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
geoana.simpeg.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Here, we define a sphere with permeability mu_sphere in a uniform magnetostatic field with permeability
# mu_background and plot the total and secondary magnetic fields.
#
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import patches
from mpl_toolkits.axes_grid1 import make_axes_locatable
from geoana.em.static import MagnetostaticSphere
#
# Define the sphere.
#
mu_sphere = 10. ** -1
mu_background = 10. ** -3
radius = 1.0
simulation = MagnetostaticSphere(
location=None, mu_sphere=mu_sphere, mu_background=mu_background, radius=radius, primary_field=None
)
#
# Now we create a set of gridded locations and compute the magnetic fields.
#
X, Y = np.meshgrid(np.linspace(-2*radius, 2*radius, 20), np.linspace(-2*radius, 2*radius, 20))
Z = np.zeros_like(X) + 0.25
xyz = np.stack((X, Y, Z), axis=-1)
ht = simulation.magnetic_field(xyz, field='total')
hs = simulation.magnetic_field(xyz, field='secondary')
#
# Finally, we plot the total and secondary magnetic fields.
#
fig, axs = plt.subplots(1, 2, figsize=(18,12))
titles = ['Total Magnetic Field', 'Secondary Magnetic Field']
for ax, H, title in zip(axs.flatten(), [ht, hs], titles):
H_amp = np.linalg.norm(H, axis=-1)
im = ax.pcolor(X, Y, H_amp, shading='auto')
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)
cb = plt.colorbar(im, cax=cax)
cb.set_label(label= 'Amplitude ($A/m$)')
ax.streamplot(X, Y, H[..., 0], H[..., 1], density=0.75)
ax.add_patch(patches.Circle((0, 0), radius, fill=False, linestyle='--'))
ax.set_ylabel('Y coordinate ($m$)')
ax.set_xlabel('X coordinate ($m$)')
ax.set_aspect('equal')
ax.set_title(title)
plt.tight_layout()
plt.show()
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Here, we define a transient planewave in the x-direction in a wholespace.
#
from geoana.em.tdem import TransientPlaneWave
import numpy as np
from geoana.utils import ndgrid
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt
#
# Let us begin by defining the transient planewave in the x-direction.
#
time = 1.0
orientation = 'X'
sigma = 1.0
simulation = TransientPlaneWave(
time=time, orientation=orientation, sigma=sigma
)
#
# Now we create a set of gridded locations and compute the electric field.
#
x = np.linspace(-1, 1, 20)
z = np.linspace(-1000, 0, 20)
xyz = ndgrid(x, np.array([0]), z)
e_vec = simulation.electric_field(xyz)
ex = e_vec[..., 0]
#
# Finally, we plot the x-oriented electric field.
#
plt.pcolor(x, z, ex.reshape(20, 20), shading='auto')
cb = plt.colorbar()
cb.set_label(label= 'Electric Field ($V/m$)')
plt.ylabel('Z coordinate ($m$)')
plt.xlabel('X coordinate ($m$)')
plt.title('Electric Field of a Transient Planewave in the x-direction in a Wholespace')
plt.show()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Here, we define a horizontal square loop and plot the magnetic field
# on the xz-plane that intercepts at y=0.
#
from geoana.em.static import LineCurrentFreeSpace
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. Note that to create an inductive
# source, we closed the loop.
#
x_nodes = np.array([-0.5, 0.5, 0.5, -0.5, -0.5])
y_nodes = np.array([-0.5, -0.5, 0.5, 0.5, -0.5])
z_nodes = np.zeros_like(x_nodes)
nodes = np.c_[x_nodes, y_nodes, z_nodes]
simulation = LineCurrentFreeSpace(nodes)
#
# Now we create a set of gridded locations and compute the magnetic field.
#
xyz = ndgrid(np.linspace(-1, 1, 50), np.array([0]), np.linspace(-1, 1, 50))
H = simulation.magnetic_field(xyz)
#
# Finally, we plot the magnetic field.
#
fig = plt.figure(figsize=(4, 4))
ax = fig.add_axes([0.15, 0.15, 0.75, 0.75])
plot2Ddata(xyz[:, [0, 2]], H[:, [0, 2]], ax=ax, vec=True, scale='log', ncontour=25)
ax.set_xlabel('X')
ax.set_ylabel('Z')
ax.set_title('Magnetic field')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Here, we define a z-oriented magnetic dipole and plot the vector
# potential on the xy-plane that intercepts at z=0.
#
from geoana.em.static import MagneticDipoleWholeSpace
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 magnetic dipole.
#
location = np.r_[0., 0., 0.]
orientation = np.r_[0., 0., 1.]
moment = 1.
dipole_object = MagneticDipoleWholeSpace(
location=location, orientation=orientation, moment=moment
)
#
# Now we create a set of gridded locations and compute the vector potential.
#
xyz = ndgrid(np.linspace(-1, 1, 20), np.linspace(-1, 1, 20), np.array([0]))
a = dipole_object.vector_potential(xyz)
#
# Finally, we plot the vector potential on the plane. Given the symmetry,
# there are only horizontal components.
#
fig = plt.figure(figsize=(4, 4))
ax = fig.add_axes([0.15, 0.15, 0.8, 0.8])
plot2Ddata(xyz[:, 0:2], a[:, 0:2], ax=ax, vec=True, scale='log')
ax.set_xlabel('X')
ax.set_ylabel('Z')
ax.set_title('Vector potential at z=0')
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Here, we define a z-oriented magnetic dipole and plot the magnetic
# flux density on the xy-plane that intercepts y=0.
#
from geoana.em.static import MagneticDipoleWholeSpace
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 magnetic dipole.
#
location = np.r_[0., 0., 0.]
orientation = np.r_[0., 0., 1.]
moment = 1.
dipole_object = MagneticDipoleWholeSpace(
location=location, orientation=orientation, moment=moment
)
#
# Now we create a set of gridded locations and compute the vector potential.
#
xyz = ndgrid(np.linspace(-1, 1, 20), np.array([0]), np.linspace(-1, 1, 20))
B = dipole_object.magnetic_flux_density(xyz)
#
# Finally, we plot the vector potential on the plane. Given the symmetry,
# there are only horizontal components.
#
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('Z')
ax.set_title('Magnetic flux density at y=0')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Here, we define a point mass with mass=1kg and plot the gravitational
# field lines in the xy-plane.
#
import numpy as np
import matplotlib.pyplot as plt
from geoana.gravity import PointMass
#
# Define the point mass.
#
location = np.r_[0., 0., 0.]
mass = 1.0
simulation = PointMass(
mass=mass, location=location
)
#
# Now we create a set of gridded locations and compute the gravitational field.
#
X, Y = np.meshgrid(np.linspace(-1, 1, 20), np.linspace(-1, 1, 20))
Z = np.zeros_like(X) + 0.25
xyz = np.stack((X, Y, Z), axis=-1)
g = simulation.gravitational_field(xyz)
#
# Finally, we plot the gravitational field lines.
#
plt.quiver(X, Y, g[:,:,0], g[:,:,1])
plt.xlabel('x')
plt.ylabel('y')
plt.title('Gravitational Field Lines for a Point Mass')
plt.show()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Here, we define an x-oriented electric dipole and plot the current
# density on the xz-plane that intercepts y=0.
#
from geoana.em.fdem import ElectricDipoleWholeSpace
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 electric current dipole.
#
frequency = np.logspace(1, 3, 3)
location = np.r_[0., 0., 0.]
orientation = np.r_[1., 0., 0.]
current = 1.
sigma = 1.0
simulation = ElectricDipoleWholeSpace(
frequency, location=location, orientation=orientation,
current=current, sigma=sigma
)
#
# Now we create a set of gridded locations and compute the current density.
#
xyz = ndgrid(np.linspace(-1, 1, 20), np.array([0]), np.linspace(-1, 1, 20))
J = simulation.current_density(xyz)
#
# Finally, we plot the real and imaginary components of the current density.
#
f_ind = 1
fig = plt.figure(figsize=(6, 3))
ax1 = fig.add_axes([0.15, 0.15, 0.40, 0.75])
plot2Ddata(
xyz[:, 0::2], np.real(J[f_ind, :, 0::2]), vec=True, ax=ax1, scale='log', ncontour=25
)
ax1.set_xlabel('X')
ax1.set_ylabel('Z')
ax1.autoscale(tight=True)
ax1.set_title('Real component {} Hz'.format(frequency[f_ind]))
ax2 = fig.add_axes([0.6, 0.15, 0.40, 0.75])
plot2Ddata(
xyz[:, 0::2], np.imag(J[f_ind, :, 0::2]), vec=True, ax=ax2, scale='log', ncontour=25
)
ax2.set_xlabel('X')
ax2.set_yticks([])
ax2.autoscale(tight=True)
ax2.set_title('Imag component {} Hz'.format(frequency[f_ind]))
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Here, we define a z-oriented electric dipole and plot the time-derivative
# of the magnetic field on the xy-plane that intercepts z=0.
#
from geoana.em.tdem import ElectricDipoleWholeSpace
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 electric current dipole.
#
time = np.logspace(-6, -2, 3)
location = np.r_[0., 0., 0.]
orientation = np.r_[0., 0., 1.]
current = 1.
sigma = 1.0
simulation = ElectricDipoleWholeSpace(
time, location=location, orientation=orientation,
current=current, sigma=sigma
)
#
# Now we create a set of gridded locations and compute the dh/dt.
#
xyz = ndgrid(np.linspace(-10, 10, 20), np.linspace(-10, 10, 20), np.array([0]))
dHdt = simulation.magnetic_field_time_deriv(xyz)
#
# Finally, we plot dH/dt at the desired locations/times.
#
t_ind = 0
fig = plt.figure(figsize=(4, 4))
ax = fig.add_axes([0.15, 0.15, 0.8, 0.8])
plot2Ddata(xyz[:, 0:2], dHdt[t_ind, :, 0:2], ax=ax, vec=True, scale='log')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_title('dH/dt at {} s'.format(time[t_ind]))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Here, we define an z-oriented electric dipole and plot the magnetic field
# on the xy-plane that intercepts z=0.
#
from geoana.em.fdem import ElectricDipoleWholeSpace
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 electric current dipole.
#
frequency = np.logspace(1, 3, 3)
location = np.r_[0., 0., 0.]
orientation = np.r_[0., 0., 1.]
current = 1.
sigma = 1.0
simulation = ElectricDipoleWholeSpace(
frequency, location=location, orientation=orientation,
current=current, sigma=sigma
)
#
# Now we create a set of gridded locations and compute the magnetic field.
#
xyz = ndgrid(np.linspace(-1, 1, 20), np.linspace(-1, 1, 20), np.array([0]))
H = simulation.magnetic_field(xyz)
#
# Finally, we plot the real and imaginary components of the magnetic field.
#
f_ind = 1
fig = plt.figure(figsize=(6, 3))
ax1 = fig.add_axes([0.15, 0.15, 0.40, 0.75])
plot2Ddata(
xyz[:, 0:2], np.real(H[f_ind, :, 0:2]), vec=True, ax=ax1, scale='log', ncontour=25
)
ax1.set_xlabel('X')
ax1.set_ylabel('Y')
ax1.autoscale(tight=True)
ax1.set_title('Real component {} Hz'.format(frequency[f_ind]))
ax2 = fig.add_axes([0.6, 0.15, 0.40, 0.75])
plot2Ddata(
xyz[:, 0:2], np.imag(H[f_ind, :, 0:2]), vec=True, ax=ax2, scale='log', ncontour=25
)
ax2.set_xlabel('X')
ax2.set_yticks([])
ax2.autoscale(tight=True)
ax2.set_title('Imag component {} Hz'.format(frequency[f_ind]))
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 8c6d002

Please sign in to comment.