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

Add point mass gravity fields in spherical coordinates #51

Open
leouieda opened this issue May 3, 2023 · 2 comments
Open

Add point mass gravity fields in spherical coordinates #51

leouieda opened this issue May 3, 2023 · 2 comments
Labels
enhancement Idea or request for a new feature

Comments

@leouieda
Copy link
Member

leouieda commented May 3, 2023

Description of the desired feature:

For larger scale applications, it would be great to have versions of the point mass code in spherical coordinates. The input coordinates would be in longitude, spherical latitude, and radius and the output vector components would be in a local Cartesian system (east, north, up).

The equations for this can be found in this paper: https://doi.org/10.1007/s00190-008-0219-8

The format for the functions would be pretty much the same as those in choclo/point/_forward.py. The new functions implemented in 2 places (not sure which would be best):

  1. In a module called choclo/point_spherical/_forward.py and they would have the same name as their cartesian counterparts.
  2. In choclo/point/_forward_spherical.py and they would be called gravity_spherical_e, and so on.

I'm leaning towards option 2.

Are you willing to help implement and maintain this feature?

Maybe but it will be a while before I have to do it, so please be my guest!

@leouieda leouieda added the enhancement Idea or request for a new feature label May 3, 2023
@santisoler
Copy link
Member

Sounds a great idea @leouieda!

I do have one design question. The spherical forward modelling functions make use of the cosine and sine of the latitudes of the observation point and the source. When having multiple sources and observation points we would need to compute those cosine and sine functions for each one of them. We've seen (see Harmonica forward models for points in spherical coordinates) that those cosine and sine values can be precomputed for each observation point and source, saving significant computational time in comparison to computing them one time for each combination of observation point and source.

So, should these new functions take the longitude, latitude_spherical and radius as arguments, or it's better if they ask the longitude, cos_latitude_spherical, sin_latitude_spherical and radius?

@leouieda
Copy link
Member Author

leouieda commented May 5, 2023

This is why I wanted to implement them here 😬 I knew they'd test the limits of our design.

I'd say they must take the pre-computed sine and cosine. Otherwise they'll have a huge perfomance hit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea or request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants