Skip to content

Optimize gravity forward of prism layer#674

Draft
santisoler wants to merge 13 commits intomainfrom
prism-layer-memory-fix
Draft

Optimize gravity forward of prism layer#674
santisoler wants to merge 13 commits intomainfrom
prism-layer-memory-fix

Conversation

@santisoler
Copy link
Copy Markdown
Member

@santisoler santisoler commented Apr 21, 2026

Re-implement the gravity method of the prism layer: rewrite the forward modeling computation of the gravity fields of a prism layer through a custom Numba function that iterates directly over the 1D horizontal coordinates of the layer. Replace the old implementation that used to build the whole set of prism boundaries and call the prism_gravity function. This new implementation doesn't require to store all those prisms in memory, significantly lowering the memory requirements, especially for large problems. Remove obsolete private function and method in layer.py. Also, reorganize prism forward modelling into a submodule: group together prism-related pieces of code inside a new harmonica._forward/prisms module, organized in a similar way as the one for ellipsoids.

Relevant issues/PRs:

This issue has been found by @aguspesce, who noticed a significant amount of memory being used while forward modeling a large prism layer.

Group together prism-related pieces of code inside a new
`harmonica._forward/prisms` module, organized in a similar way as the
one for `ellipsoids`.
Reimplement the forward modeling computation of the gravity fields of
a prism layer through a custom Numba function that iterates directly
over the 1D horizontal coordinates of the layer. Replace the old
implementation that used to build the whole set of prism boundaries and
call the `prism_gravity` function. This new implementation doesn't
require to store all those prisms in memory, significantly lowering the
memory requirements, especially for large problems.
@santisoler santisoler added this to the v0.8.0 milestone Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant