Hello,
I am new in k-wave and i tried to create a linear source with a time varying signal in an homogenous elastic medium. I want to simulate a compressional wave only (x direction). During the simulation, we can see appear à wave (in the y direction) in the source that i've not created and i can't explain where this wave comes from. Do you have an explanation please ?
%% %% Test de sensor.record_start_index et verif des vitesses et temps de vol
clear all
close all
%% On définit le maillage
Nx = 600; % number of grid points in the x (row) direction
Ny = 600; % 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 = kWaveGrid(Nx, dx, Ny, dy);
%% Medium properties
medium.sound_speed_compression = 1000*ones(Nx,Ny); % [m/s]
medium.sound_speed_shear = 0*ones(Nx,Ny); % [m/s]
medium.density = 1000*ones(Nx,Ny); % [kg/m^3]
medium.alpha_coeff_compression = 0.1*ones(Nx,Ny); % [dB/(MHz^2 cm)]
medium.alpha_coeff_shear = 0.00001; % [dB/(MHz^2 cm)]
Nb_pt_par_lambda = 30;
%% Vecteur temps
cfl = 0.1; % Courant-Friedrichs-Lewy number
t_end = 35e-6; % [s]
kgrid.makeTime(max(medium.sound_speed_compression(:)), cfl, t_end);
% Signal d'émission
source_freq = 1e6; % [Hz]
Nb_periode = 1.5;
t = (0:kgrid.dt:Nb_periode/source_freq);
magnitude = 400; % [Pa] % [Pa]
w = zeros(1,size(kgrid.t_array,2));
w(1,1:size(t,2)) = hann(size(t,2));
source.sxx = magnitude * sin(2 * pi * source_freq * kgrid.t_array).*w;
source.syy = 0;
source.sxy = 0;
%% Position emetteur
x_pos = Nx/4; % [grid points]
y_pos = Ny/2; % [grid points]
source.s_mask = zeros(Nx,Ny);
source.s_mask(x_pos,270:330) =1;
%% Position recepteur
D_E_R1 = round(0.02/dx); % distance emetteur/recepteur1 en terme d'échantillon
D_R1_R2 = round(0.01/dx);
Recep1_x = Nx/4 + D_E_R1;
Recep1_y = y_pos ;
Recep2_x = Recep1_x + D_R1_R2;
Recep2_y = y_pos ;
Recep_start1 = [Recep1_x Recep1_y];
Recep_start2 = [Recep2_x Recep2_y];
Recep_angle = 0;
length = 10;
SM1 = makeLine(Nx, Ny, Recep_start1, Recep_angle, length); % Le Premier point est le point le plus bas à gauche
SM2 = makeLine(Nx, Ny, Recep_start2, Recep_angle, length);
sensor_mask = SM1+SM2;
% Map with E and R1-R2
figure
imagesc(source.s_mask + sensor_mask)
axis equal
title('carte emetteur/recepteur')
cartesian_pos_center = [Nx/2*dx, Ny/2*dy];
[x_SM1, y_SM1] = find(SM1>0);
x_SM1 = x_SM1';
y_SM1 = y_SM1';
for i = 1:size(x_SM1,2)
x_SM1(i) = x_SM1(i)*dx - cartesian_pos_center(1);
y_SM1(i) = y_SM1(i)*dy - cartesian_pos_center(2);
end
[x_SM2, y_SM2] = find(SM2>0);
x_SM2 = x_SM2';
y_SM2 = y_SM2';
for i = 1:size(x_SM2,2)
x_SM2(i) = x_SM2(i)*dx - cartesian_pos_center(1);
y_SM2(i) = y_SM2(i)*dy - cartesian_pos_center(2);
end
x_SM = [x_SM1, x_SM2];
y_SM = [y_SM1, y_SM2];
sensor.mask = [x_SM
y_SM];
sensor.record = {'p', 'u','p_final'};
sensor.record_start_index = 1;
% run the simulation
sensor_data = pstdElastic2D(kgrid, medium, source, sensor );
for i=1:size(sensor_data.p,2)
p_somme_R1(i) = mean(sensor_data.p(1:size(sensor_data.p,1)/2,i));
p_somme_R2(i) = mean(sensor_data.p(size(sensor_data.p,1)/2+1:end,i));
end
figure
plot(kgrid.t_array,p_somme_R1)
hold on
plot(kgrid.t_array,p_somme_R2,'r')
hold off
hhh = legend('R1','R2','R3');
xlabel('temps (s)')
ylabel('Amplitude')
title('signaux recus par chaque recepteur')
sensor_data.p_final = sensor_data.p_final/max(max(sensor_data.p_final));
Thank you by advance for your answer.
Antoine Malrin