groupeLIAMG / ttcr

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

DSPM crush #68

Closed cumttc closed 2 months ago

cumttc commented 3 months ago

selected.xlsx for help.txt Dear Author, Recently when I use the 'DSPM' method of 'ttcrpy' in ipynb to get the 'L', I often encountered the following Kernel' crash.Also, when I used the 'SPM' method, it was even worse and my computer would just seize up. I have tried reducing the amount of src's, it doesn't work.

The error message is as follows:DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)tt_line,M_line= grid.raytrace(src, rcv,slowness=s0_f, compute_L=True)

My code and files have been uploaded and I hope you take the time to answer questions. Thank you very much.

xiehoulin commented 2 months ago

hello bro ,i get the same question as you recently,even i am in a 2D model,did you work it out?

bernard-giroux commented 2 months ago

@cumttc why is you grid cell size equal to 200 in Z? You should use a smaller value. Also make sure that yo uhave at least one cell extending beyond you min/max Tx/Rx coordinates

xiehoulin commented 2 months ago

@bernard-giroux
Hello Prof. Giroux,I have defined a velocity gradient update function based on conjugate gradient method, but there was a memory overflow during the second calculation of L, but it was normal during the first calculation. I would like to ask what is the reason for this

bernard-giroux commented 2 months ago

I am sorry, but without detailed information I have no idea why this is happening. What model size? raytracing method? how steep is the velocity gradient? Is it working for a homoganeous model?

xiehoulin commented 2 months ago

@bernard-giroux Hello Prof. Giroux,here is the detalis ,the originl model is simple
![Uploading 微信图片_20240513225844.png…]()

bernard-giroux commented 2 months ago

the link does not work. try with a homogeneous model and let me know if it works

xiehoulin commented 2 months ago

import ttcrpy.rgrid as rg import numpy as np from scipy.sparse.linalg import cg import matplotlib.pyplot as plt def forward(slowness): tcal, LL = grid.raytrace(srcs, rcv, slowness, compute_L=True) A = LL.todense() zuo = A.T A + 0.618 I deltat = tobs - tcal you = A.T.dot(deltat) you = you.T deltam, info = cg(zuo, you) return deltam if name == 'main': data = np.loadtxt('observe_time_6000.txt') zhangzimian = 90 pao = np.arange(zhangzimian+3,zhangzimian+21,3) srcs = np.array([[25,pao[0]], [25,pao[1]], [25,pao[2]], [25,pao[3]], [25,pao[4]], [25,pao[5]]], float) rcv = np.array([[17,30], [17,40], [17,50], [17,60], [33,30], [33,40], [33,50], [33,60]], float) tobs = data

创建网格

dx = 1
x = np.arange(0, 51.0, dx, float)
z = np.arange(0, 151.0, dx, float)
# 创建速度模型
v = 4500.0 * np.ones((x.size-1, z.size-1))
# 离散网格
grid = rg.Grid2d(x, z, cell_slowness=True, method='DSPM')    #慢度以单元定义
cell_number = grid.get_number_of_cells()
# 速度转换为慢度
slowness = 1. / v
srcs = np.kron(np.ones((8, 1)), srcs)
rcv = np.kron(rcv, np.ones((6, 1)))
# 速度迭代
I = np.eye(7500)
# 开始循环
for i in range(10):
    print(i)
    deltam = forward(slowness)
    deltam = deltam.reshape(50, 150)
    slowness = slowness + deltam
v = 1. / slowness
@bernard-giroux 

Hello Prof. Giroux,here is the codes , in the first step, its really a homogeneous model and it works but in the second step, it stops while calculating L

bernard-giroux commented 2 months ago

see response in #69