我试图将标量(或简单声学)波动方程的有限差分解与解析解进行比较。
该论文中等式 (9) 的解,对于等速介质,在柱坐标中由下式给出:
(一种)
是零阶的第二类汉克尔函数。
是从源到观察点的距离。
还来自转换为傅立叶域的介质速度,在原始标量波动方程中定义为:
定义源位置X飞机。
来自源函数
问题:
- 当以数字方式实现A时,我没有得到有意义的结果。使用A获得的速度与用作输入
我的代码示例如下所示,我正在使用 python 评估A。solution0我在零处和距离 D=8000 处计算解solutionD。然后我使用全局最大值来计算速度的近似值
可能这是我正在做的一个非常简单的错误。如果有人可以为我指出。我得到的速度表明方程(9)可能是错误的,或者我错误地执行它(我认为是这种情况)。
from scipy.special import hankel2
import numpy as np
# a simple source function f(t) gauss derivative normalized
def gaussource(time, wlength, delay=None):
if delay == None: # enough delay time
delay = 3*wlength
t = time - delay
return ((2*np.sqrt(np.e)/(wlength))
*t*np.exp(-2*(t**2)/(wlength**2)))
# analytic solution equation (A) paper
def waves(source, distance, c):
n = len(source)
sourcew = np.fft.fft(source) # source in the frequency domain
hnk_factor = distance/c # distance to source divided by velocity
if not distance == 0.0:
hankelshift = np.complex(0,-np.pi)*np.array([hankel2(0,hnk_factor*omega) for omega in xrange(n)])
hankelshift[0] = 0. # i infinity in limit
return np.real(np.fft.ifft(hankelshift*sourcew))
return source
c = 4000.
fc = 5.0
dt = 0.01
t = np.arange(0., 2., dt) # 2 seconds to evaluate the solution
source = gaussource(t, 1./fc) # source
solution0 = waves(source, 0., c) # solution at zero source (source itself)
solutionD = waves(source, 8000., c) #solution at certain distance D=8000 metres e.g.
t0 = solution0.argmax(); # get max index time at zero
tD = solutionD.argmax(); # get max index time at distance
print "phase velocity aproximation ", 8000./((tD-t0)*dt)
