Hi @all,
I have a problem when changing the type of source in the Example Explosive Source In A Layered Medium, I get two 'sources' at the medium changes that are not disappearing.
Nx = 256; % number of grid points in the x (row) direction
Ny = 256; % number of grid points in the y (column) direction
dx = 0.1e-3; % grid point spacing in the x direction [m]
dy = 0.1e-3; % grid point spacing in the y direction [m]
kgrid = makeGrid(Nx, dx, Ny, dy);
% define the properties of the upper layer of the propagation medium
medium.sound_speed_compression = 1500*ones(Nx, Ny); % [m/s]
medium.sound_speed_shear = zeros(Nx, Ny); % [m/s]
medium.density = 1000*ones(Nx, Ny); % [kg/m^3]
% define the properties of the lower layer of the propagation medium
medium.sound_speed_compression(Nx/2:end, :) = 2000; % [m/s]
medium.sound_speed_shear(Nx/2:end, :) = 800; % [m/s]
medium.density(Nx/2:end, :) = 1200; % [kg/m^3]
% define the absorption properties
medium.alpha_coeff_compression = 0.1; % [dB/(MHz^2 cm)]
medium.alpha_coeff_shear = 0.5; % [dB/(MHz^2 cm)]
% create the time array
cfl = 0.1; % Courant-Friedrichs-Lewy number
t_end = 20e-6; % [s]
kgrid.t_array = makeTime(kgrid, max(medium.sound_speed_compression(:)), cfl, t_end);
% create initial pressure distribution using makeDisc
disc_magnitude = 5; % [Pa]
disc_x_pos = 30*128/Nx; % [grid points]
disc_y_pos = Ny/2; % [grid points]
disc_radius = 5*128/Nx; % [grid points]
source.s_mask = makeDisc(Nx, Ny, disc_x_pos, disc_y_pos, disc_radius);
source.syy=1e-3*filterTimeSeries(kgrid,medium,toneBurst(1/kgrid.dt,218e3,1));
source.syy=[source.syy,0 0 0 0 ];
source.sxx=-source.syy;
% source.s_mode='dirichlet';
% define a centered circular sensor
sensor.mask = makeCircle(Nx, Ny, Nx/2, Ny/2, 20);
% define a custom display mask showing the position of the interface from
% the fluid side
display_mask = false(Nx, Ny);
display_mask(Nx/2 - 1, :) = 1;
% define input arguments
input_args = {'PlotScale', [-0.25, 0.25, -0.05, 0.05], 'PlotPML', false,...
'DisplayMask', display_mask,'DataCast','gpuArray-single','DataRecast',true};
% run the simulation
sensor_data = pstdElastic2D(kgrid, medium, source, sensor, input_args{:});
%% reorder the simulation data
sensor_data_reordered = reorderSensorData(kgrid, sensor, gather(sensor_data));
% =========================================================================
% VISUALISATION
% =========================================================================
% plot source, sensor, and position of the interface
% figure;
% imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, double(source.p0 | sensor.mask | display_mask), [-1 1]);
% colormap(getColorMap);
% ylabel('x-position [mm]');
% xlabel('y-position [mm]');
% axis image;
%% plot the re-ordered sensor data
figure;
imagesc(sensor_data_reordered,[-1e-6 1e-6]);
colormap(getColorMap);
ylabel('Sensor Position');
xlabel('Time Step');
colorbar;