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
160 stars 55 forks source link

3D Velocity Model Format #49

Open taranye96 opened 5 months ago

taranye96 commented 5 months 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 5 months 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

taranye96 commented 4 months ago

Hi Malcom, Thank you for the reply! My study region is fairly small, so I plan to use cartesian coordinates, but I think I was able to figure out how to do that with solver.solve() and solver.trace_rays(). The 3D velocity model that I'm using as a reference is divided into vertical blocks, where each block has a specific horizontal and vertical resolution. I would like to keep the finer resolution at shallower depths, but I'm not sure if that is compatible with pykonal. Is it possible to use a velocity model with varying resolution? If not, I could upsample the other blocks to all have the same fine-scale resolution, but that would result in a very large velocity model file and would be difficult to load into pykonal. Another option I was considering is having a separate pykonal solver for each of the blocks and then joining the ray path together across the solvers. Do you know if that would work? Thank you,Tara

On Tuesday, June 25, 2024 at 07:01:43 AM PDT, Malcolm White ***@***.***> wrote:  

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.

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

Let me know how it goes.

Cheers, Malcolm

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>