Hi Dr. Treeby/Cox,
I have been using the k-wave 2D simulation to simulate a certain ultrasound setup. It has worked for all me previous setups. But I set up a simulation for a different grid size and it doesn't seem to give what I would expect. My output looks like this: http://tinypic.com/r/29azm79/9
which to me doesn't make any sense since I only have one point in the medium that is reflective. From previous experiments, it should look like the input signal but attenuated(~12000 peak to peak amplitude). If you could kindly provide some insight into what may be wrong, that would be great. Thank you!
%clear all
pml_x_size = 20;
pml_y_size = 20;
Nx = 512 - 2*pml_x_size; %256
Ny = 450 - 2*pml_y_size; %96
dx = 0.2e-3; % was 0.2e-3
dy = 0.2e-3; %
kgrid = makeGrid(Nx, dx, Ny, dy);
gridx_pts =11;
c0 = 1540; % [m/s]
rho0 = 1000; % [kg/m^3]
medium.sound_speed_ref = c0;
medium.alpha_power = 1.5;
medium.alpha_coeff = 0.75;
t_end = (Nx*dx)*2.4/c0; % [s] % was 2.4
kgrid.t_array = 0:15e-9:t_end; % was 15e-9
source_strength = 1e6; % [Pa]
tone_burst_freq = 1.875e6; % [Hz]
tone_burst_cycles = 5;
input_signal = source_strength*toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);
source.p_mask = zeros(Nx,Ny);
num_elements = 48; % [grid points]
x_offset = 1 ; % [grid points]
start_index = Ny/2 - round(num_elements/2) + 1;
source.p_mask(x_offset, start_index:start_index + num_elements - 1) = 1;
source.p = input_signal;
sensor.mask = zeros(Nx,Ny);
sensor.mask(x_offset, start_index:start_index + num_elements - 1) = 1;
cwire = 3000;
scattering_rho0 = cwire/1.5;
%%
Ny_tot = Ny + 400;
p = 2;
sound_speed_map = c0*ones(Nx, Ny_tot);
density_map = rho0*ones(Nx, Ny_tot);
xc = Nx - 7;
yc = floor((Ny_tot/2)-2);
scattering_region = makeDisc(Nx, Ny_tot, xc, yc,1);
sound_speed_map(scattering_region == 1) = cwire;
density_map(scattering_region == 1) = scattering_rho0;
for psny = 0:199
medium.sound_speed = sound_speed_map(:,(psny*2)+1:(psny*2)+1+Ny-1);
medium.density = density_map(:,(psny*2)+1:(psny*2)+1+Ny-1);
input_args = {'PMLInside', false, 'PMLSize', [pml_x_size, pml_y_size],'DataCast','gpuArray-single',PlotSim',false};
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor,input_args{:});
figure;imagesc(medium.sound_speed);
end