Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward models of prisms gravity fields with Choclo #400

Merged
merged 26 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5a34467
Use Choclo kernels for prism gravity forwards
santisoler Apr 17, 2023
0e5faec
Remove unused GRAVITATIONAL_CONST global
santisoler Apr 17, 2023
bb51d12
Add easting and northing components of acceleration
santisoler Apr 17, 2023
930efe0
Minor style improvement in test
santisoler Apr 17, 2023
0e960b4
Allow to compute gravity tensor components
santisoler Apr 17, 2023
c7ec096
Ditch symmetry tests
santisoler Apr 17, 2023
2498439
Warn for prism gravity tensor on singular points
santisoler Apr 18, 2023
d0f0d2e
Fix wrong word in test comment
santisoler Apr 24, 2023
32ecfc9
Update to new Choclo functions that take only scalars
santisoler May 5, 2023
d397f37
Rename "kernel" argument to "forward_func"
santisoler May 5, 2023
f205e3d
Update tests to use the new Choclo functions
santisoler May 5, 2023
a8e199e
Merge branch 'main' into prisms-choclo
santisoler May 12, 2023
83fa731
Update expected values in example
santisoler May 12, 2023
994419e
Merge branch 'main' into prisms-choclo
santisoler May 12, 2023
fa732f6
Fix test function against infinite slab
santisoler May 12, 2023
16e3172
Actually, use the height variable 🤦
santisoler May 13, 2023
7305fc3
Rename forward_func variable to avoid confusion
santisoler May 17, 2023
ba115ce
Improve docstrings of prism_gravity
santisoler May 17, 2023
ecec17f
Merge branch 'prisms-choclo' into prisms-singular-points
santisoler May 17, 2023
8694500
Fix check for singular points
santisoler May 17, 2023
70250f7
Fix line too long
santisoler May 17, 2023
9e1b7e2
Merge branch 'main' into prisms-choclo
santisoler May 23, 2023
fa13929
Fix typo
santisoler May 23, 2023
59a2dff
Run checks for singular points with Numba
santisoler May 23, 2023
13da7a5
Add user guide section for other fields for prisms
santisoler May 24, 2023
61e060f
Merge branch 'prisms-choclo' of github.com:fatiando/harmonica into pr…
santisoler May 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions doc/user_guide/forward_modelling/prism.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,97 @@ computation point:
print(potential, "J/kg")


Gravitational fields
^^^^^^^^^^^^^^^^^^^^

The :func:`harmonica.prism_gravity` is able to compute the gravitational
potential (``"potential"``), the acceleration components (``"g_e"``, ``"g_n"``,
``"g_z"``), and tensor components (``"g_ee"``, ``"g_nn"``, ``"g_zz"``,
``"g_en"``, ``"g_ez"``, ``"g_nz"``).


Build a regular grid of computation points located a 10m above the zero height:

.. jupyter-execute::

import verde as vd

region = (-10e3, 10e3, -10e3, 10e3)
shape = (51, 51)
height = 10
coordinates = vd.grid_coordinates(region, shape=shape, extra_coords=height)

Define a single prism:

.. jupyter-execute::

prism = [-2e3, 2e3, -2e3, 2e3, -1.6e3, -900]
density = 3300

Compute the gravitational fields that this prism generate on each observation
point:

.. jupyter-execute::

fields = (
"potential",
"g_e", "g_n", "g_z",
"g_ee", "g_nn", "g_zz", "g_en", "g_ez", "g_nz"
)

results = {}
for field in fields:
results[field] = hm.prism_gravity(coordinates, prism, density, field=field)

Plot the results:

.. jupyter-execute::

import matplotlib.pyplot as plt

plt.pcolormesh(coordinates[0], coordinates[1], results["potential"])
plt.gca().set_aspect("equal")
plt.gca().ticklabel_format(style="sci", scilimits=(0, 0))
plt.colorbar(label="J/kg")
plt.show()


.. jupyter-execute::

fig, axes = plt.subplots(nrows=1, ncols=3, sharey=True, figsize=(12, 8))

for field, ax in zip(("g_e", "g_n", "g_z"), axes):
tmp = ax.pcolormesh(coordinates[0], coordinates[1], results[field])
ax.set_aspect("equal")
ax.set_title(field)
ax.ticklabel_format(style="sci", scilimits=(0, 0))
plt.colorbar(tmp, ax=ax, label="mGal", orientation="horizontal", pad=0.08)
plt.show()

.. jupyter-execute::

fig, axes = plt.subplots(nrows=1, ncols=3, sharey=True, figsize=(12, 8))

for field, ax in zip(("g_ee", "g_nn", "g_zz"), axes):
tmp = ax.pcolormesh(coordinates[0], coordinates[1], results[field])
ax.set_aspect("equal")
ax.set_title(field)
ax.ticklabel_format(style="sci", scilimits=(0, 0))
plt.colorbar(tmp, ax=ax, label="Eotvos", orientation="horizontal", pad=0.08)
plt.show()

.. jupyter-execute::

fig, axes = plt.subplots(nrows=1, ncols=3, sharey=True, figsize=(12, 8))

for field, ax in zip(("g_en", "g_ez", "g_nz"), axes):
tmp = ax.pcolormesh(coordinates[0], coordinates[1], results[field])
ax.set_aspect("equal")
ax.set_title(field)
ax.ticklabel_format(style="sci", scilimits=(0, 0))
plt.colorbar(tmp, ax=ax, label="Eotvos", orientation="horizontal", pad=0.08)
plt.show()

Passing multiple prisms
^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
- verde>=1.7.0
- xarray>=0.16
- xrft>=1.0
- choclo>=0.1
# Optional requirements
- pyvista>=0.27
- vtk>=9
Expand Down
Loading