malcolmw / pykonal

Travel-time calculator based on the fast-marching method solution to the Eikonal equation.
https://malcolmw.github.io/pykonal-docs/
GNU General Public License v3.0
147 stars 54 forks source link

3D Velocity Model Format #49

Open taranye96 opened 1 week ago

taranye96 commented 1 week ago

Hi Malcom,

I'd like to use this software to perform ray tracing through a 3D velocity model. I found your example 1D velocity model IASP91.csv. If I want to create a 3D model, should the file still be formatted the same way, just with extra rows for the spatially varying velocity? And if so, does it matter how the rows are ordered (or in other words, whether the depth or horizontal distance is varied first)?

Thanks! Tara

malcolmw commented 1 week ago

Hi, @taranye96,

For tracing rays through a 3-D model, suggest using the PointSourceSolver class. See the brief example here: https://malcolmw.github.io/pykonal-docs/examples/point_source_solver.html for using the PointSourceSolver in spherical coordinates. Note that the PointSourceSolver also implements Cartesian coordinates if you are working at local scales.

Take a look at the example and let me know if you have any questions about it. Keep in mind that spherical coordinates are defined according to the "physics" convention ($\rho, \theta, \phi$ = radial dstance, polar angle, azimuthal angle) with angles specified in radians. Also, because the gradient operator is not defined at $\rho=0$, one must not place a grid node at the center of the Earth when working in spherical coordinates.

To initialize your velocity model, you need to populate a NumPy array with shape n_rho, n_theta, n_phi where n_rho, n_theta, n_phi are the number of nodes in the $\rho, \theta,$ and $\phi$ directions, respectively.

After calling solver.solve(), you can call solver.trace_rays() to trace your ray paths.

Let me know how it goes.

Cheers, Malcolm