groupeLIAMG / ttcr

Codes to do raytracing for geophysical applications
GNU General Public License v3.0
85 stars 33 forks source link

outside grid error in example3 #49

Closed dylanmikesell closed 2 years ago

dylanmikesell commented 2 years ago

I am trying to run example3.ipynb.

During ray tracing I get the following error. I have directly copied the notebook and have not changed anything.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/home/dmi/GIT/20220087-RUA/example3.ipynb Cell 5 in <cell line: 15>()
     [12] src = np.kron(src, np.ones((3, 1)))
     [13] rcv = np.kron(np.ones((2, 1)), rcv)
---> [15] tt, rays = grid.raytrace(src, rcv, return_rays=True)
     [17]) # Save raypaths
     [18]) grid.to_vtk({'raypaths for shot no 1': rays[:3],
     [19]             'raypaths for shot no 2': rays[3:]}, 'example3_rays')

File ttcrpy/rgrid.pyx:1064, in ttcrpy.rgrid.Grid3d.raytrace()

RuntimeError: Error while computing raypaths: going outside grid 
                Rx: 222.2 3.4 1.2
                Tx: 9 4.3 124.2

I ran into a similar error when doing the 2D version for my own problem. This is the first time I have used this code. Do you have any thoughts on the issue?

bernard-giroux commented 2 years ago

I can reproduce the problem. I'll have a look at it.

bernard-giroux commented 2 years ago

Due to the velocity contrast, the ray path was getting pretty close to the limite of the grid, and due to approximations when computing the travel time gradient, the ray direction was pointing slightly outside the grid. This is a limitation of the approach based on computing ray paths from travel times. I updated the example by moving the source & receiver that were close to the limit, and it now runs fine.

So, in general, when you get this problem, you can either extend a bit the grid, or move the src/rcv away from the grid limits.