deepwave icon indicating copy to clipboard operation
deepwave copied to clipboard

Amplitude in received signals in forward modeling with ultrasound signal (1MHz)

Open shoaibanwar66 opened this issue 1 year ago • 2 comments

Hi,

I am trying to compare SEM and FDM in USCT applications. I have been working with SPECFEM (a spectral element solver) for acoustic USCT applications and recently started working with deepwave. However, I noticed that the amplitude of the received signal in deepwave is way too low (in e-10). I am wondering if I am making any mistake. Would you please let know if there is any way to increase the signal amplitude in receiver end.

Here is the example code.

`import torch import deepwave import matplotlib.pyplot as plt import numpy as np import torchvision

plotting = True v = 1500 * torch.ones(50, 50)

freq = 1e6 NT = 4500 DT = 2.5e-9

grid_spacing_orig = 2.5e-4 grid_spacing = grid_spacing_orig #4.1441559515042545E-005 dx = grid_spacing

cell_number = 50 / grid_spacing

#print (cell_number)

Src = [0.006, 0.010] Rcv = [0.006, 0.001]

peak_time = 1/freq source_amplitudes = deepwave.wavelets.ricker(freq, NT, DT, peak_time).reshape(1, 1, -1) #print (source_amplitudes.squeeze().detach().numpy().shape)

source_locations=torch.tensor([[[Src[0]/grid_spacing_orig, Src[1]/grid_spacing_orig]]]) receiver_locations=torch.tensor([[[Rcv[0]/grid_spacing_orig, Rcv[1]/grid_spacing_orig]]])

print (Rcv[0]/grid_spacing_orig, Rcv[1]/grid_spacing_orig)

out = deepwave.scalar( v, grid_spacing=grid_spacing, dt=DT, source_amplitudes= source_amplitudes, source_locations=torch.tensor([[[Src[0]/grid_spacing_orig, Src[1]/grid_spacing_orig]]]), receiver_locations=torch.tensor([[[Rcv[0]/grid_spacing_orig, Rcv[1]/grid_spacing_orig]]]), accuracy=8, pml_width=[2, 2, 2, 2], pml_freq=1 )

pred_signals_swap = out[-1]

if plotting == True: y = pred_signals_swap.squeeze() #print(y.shape) freq = 1e6 nt=NT dt=DT plt.figure() plt.plot(np.arange(0, dtnt, dt)-1.21e-6, source_amplitudes.squeeze().detach().numpy()) plt.savefig("STF_deepwave.png") plt.figure() plt.plot(y.detach().numpy()) plt.savefig("sig_pre_0_2")`

I have attached the STF and received signal images bellow. sig_pre_0_2 STF_deepwave

shoaibanwar66 avatar Oct 30 '24 20:10 shoaibanwar66

Hi Shoaib,

Thank you for testing Deepwave and for your message. I apologise for the delay in replying.

Does dividing the output receiver data by dx2 help? In Deepwave the sources will be the size of one grid cell, whereas the other codes you are comparing against probably use point sources, so the Deepwave amplitudes will be dx2 times the size. Since you mentioned that the amplitudes are 1e-10 the value you expected, and your dx value is about 1e-5, I suspect that that is the cause. I hope that resolves your issue. Please let me know if it does not.

Looking at the rest of your code, I see that you set the PML width to two grid cells. That is very small, and will result in the edges of your model being quite reflective. Is that intended? You also use a PML frequency of 1 Hz, but the actual frequency of your source seems to be 1e6 Hz. Did you mean to do that, or do you find the documentation unclear about how to set these values?

ar4 avatar Oct 31 '24 17:10 ar4

Thanks. Dividing by dx**2 actually helped. I need to go through the documentation about PML frequency again. No worries. Thanks again.

shoaibanwar66 avatar Oct 31 '24 18:10 shoaibanwar66

I'm going to close this issue now, but please feel free to reopen it or to create a new one if you have any other questions.

ar4 avatar Dec 07 '25 21:12 ar4