Hi everyone
Recently I am helping another guy in our group to simulate the reflection at the hetrogeneous media boundary.
I started from a simple 1D simulation, the code is provided below.
clear all;
% =========================================================================
% SIMULATION
% =========================================================================
% create the computational grid
Nx = 64; % number of grid points in the x (row) direction
dx = 0.05e-3; % grid point spacing in the x direction [m]
kgrid = makeGrid(Nx, dx);
% define the properties of the propagation medium
medium.sound_speed = 1540*ones(Nx, 1); % [m/s]
medium.sound_speed(11:50) = 2690;
medium.sound_speed(51:64) = 340; % [m/s]
medium.density = 1000*ones(Nx, 1); % [kg/m^3]
medium.density(11:50) = 1190; % [kg/m^3]
medium.density(51:64) = 1.204;
medium.alpha_power=2;
medium.alpha_coeff=0.002*ones(Nx,1);
medium.alpha_coeff(11:50)=1.19;
medium.alpha_coeff(51:64)=1.64;
% create initial pressure distribution using a smoothly shaped sinusoid
source_mask=zeros(Nx,1);
source_mask(1)=1;
source.p0 =10^6*source_mask;
% create a Cartesian sensor mask
sensor_mask=zeros(Nx,1)
sensor_mask(9)=1;
sensor.mask = sensor_mask; % [mm]
% set the simulation time to capture the reflections
t_end = dx*10/1540+dx*40/2690+dx*14/340;
% define the time array
[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed, [], t_end);
% run the simulation
sensor.record={'p'};
sensor_data = kspaceFirstOrder1D(kgrid, medium, source, sensor, 'PlotLayout', true);
% =========================================================================
% VISUALISATION
% =========================================================================
% plot the recorded time signals
figure;
plot(kgrid.t_array, abs(sensor_data.p));
xlabel('time step');
ylabel('pressure at the sensor position');
As for the result, a interesting happens, the excitation has a amplitude only of 10^6 Pa, however, the result I got in this end is quite huge, almost 10^60~70 pa, almost infinity and impossible.
I checked the code but can not find the problem. Can anyone helo?
Best Regards