Hi.
The various documentation suggest that decreasing dt and dx will help accuracy.
I have a 2D water simulation of a strip source (just a 0.3mm line) radiating a pulse of center freq=10MHz. This should produce a field pattern with a beam half-width of about 30 degrees. However as I decrease dt or dx, the beam just keeps getting more and more narrow. I start with grid points per wavelength=7, and dt=0.3*dx/Cwater.
Thanks!
code:
freq=10e6;
DiscWid=.31e-3;
xlen=5e-3;
ylen=7e-3; %(xdcr axis)
xdcrloc=.5e-3;
epw=15; %points per wavelength
Cwater = 1500;
rhoWater=1e3;
% setup grid =========================================
lambda=Cwater/freq;
dx=lambda/epw;
dy=dx;
Nx= ceil(xlen/dx);
Ny= ceil(ylen/dx);
kgrid = makeGrid(Nx, dx, Ny, dy);
medium.sound_speed=ones(kgrid.Nx, kgrid.Ny)*Cwater;
medium.density=ones(kgrid.Nx, kgrid.Ny)*rhoWater;
T_END=7e-3/Cwater;
dt=.3*dx/(2*Cwater); %set this velocity for time steps (C should be Cmax)
kgrid.t_array = 0:dt:T_END;
% define source ==========================================
DiscX1=round((xlen/2-DiscWid/2)/dx);DiscX2=round((xlen/2+DiscWid/2)/dx);
DiscY=round(xdcrloc/dx);
source.p_mask = makeLine(Nx, Ny, [DiscX1,DiscY], [DiscX2,DiscY]);
NoPtsWave=round(4/freq/dt); %make a wavelet pulse.
signal = wavelet(freq,4,0,0); %,NoPtsWave);
%signal=sin(2*pi*freq*kgrid.t_array)
source.p=signal;
% define receiver ======================================
sensor.mask=[1;1;Nx;Ny];
sensor.record = {'p','p_max'};
display_mask = source.p_mask;
% run model
input_args = {'DisplayMask', display_mask, 'PMLInside', false, 'PlotPML', false,'PlotScale',[-1 1]};
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});
% handle data
figure;imagesc(kgrid.y_vec, kgrid.x_vec, sensor_data.p_max);% sensor_data.ux_max.^2+sensor_data.uy_max.^2);
axis equal;grid on
figure;imagesc(kgrid.y_vec, kgrid.x_vec, squeeze(sensor_data.p(:,:,end)));
axis equal;grid on