Dear Treeby and collegues,
I’m new to k-wave, and I’m running some initial simple tests with a point-source ultrasound source.
I ran simulation with the same grid size and source, but the pressure along time measured at four different sensors changed (both in terms of amplitude and phase) depending on the grid spacing (dx,dy). I am quite surprise to observe this quite big difference, because the grid spacing was in all case always smaller than 1/10 of the wavelength. Below you can fine the code I used.
Best regards,
Cristina
------------------------------- MATLAB CODE ------------------------------
% create the computational grid
Nx = 83; % I chose 83, 216, 431 % number of grid points in the x (row) direction
Ny = Nx; % number of grid points in the y (column) direction
dx = 0.05/Nx; % grid point spacing in the x direction [m]
dy = dx; % grid point spacing in the y direction [m]
kgrid = kWaveGrid(Nx, dx, Ny, dy);
% define the properties of the propagation medium
medium.sound_speed = 1500; % [m/s]
medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
% create the time array
kgrid.makeTime(medium.sound_speed);
mask_source=zeros(Nx,Ny);
mask_source(round(Nx/2),round(Ny/2))=1;
source.p_mask = mask_source;
% define a time varying sinusoidal source
source_freq = 0.25e6; % [Hz]
source_mag = 0.5; % [Pa]
source.p = source_mag * sin(2 * pi * source_freq * kgrid.t_array);
% filter the source to remove high frequencies not supported by the grid
source.p = filterTimeSeries(kgrid, medium, source.p);
% create a display mask to display the transducer
display_mask = source.p_mask;
sensor.mask=[[-24e-3:1e-3:24e-3];[-24e-3:1e-3:24e-3]];
% assign the input options
input_args = {'DisplayMask', display_mask, 'PMLInside', false, 'PlotPML', false};
% plot the initial pressure and sensor distribution
figure('color','white');
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, source.p_mask, [-1, 1]);
hold on; plot(sensor.mask(1,20)*1e3,sensor.mask(2,20)*1e3,'ro','MarkerFaceColor','r')
hold on; plot(sensor.mask(1,15)*1e3,sensor.mask(2,15)*1e3,'ko','MarkerFaceColor','k')
hold on; plot(sensor.mask(1,10)*1e3,sensor.mask(2,10)*1e3,'mo','MarkerFaceColor','m')
hold on; plot(sensor.mask(1,5)*1e3,sensor.mask(2,5)*1e3,'go','MarkerFaceColor','g')
colormap(getColorMap);
ylabel('x-position [mm]');
xlabel('y-position [mm]');
axis image;
%% run simulation
figure;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});
% =========================================================================
% VISUALISATION
% =========================================================================
figure; plot(kgrid.t_array,sensor_data(20,:),'r')
hold on; plot(kgrid.t_array,sensor_data(15,:),'k')
hold on; plot(kgrid.t_array,sensor_data(10,:),'m')
hold on; plot(kgrid.t_array,sensor_data(5,:),'g')
legend('20','15','10','5')