I want to do a 2D elastic wave simulation on step geometry, like a small rectangle of different property placed on a big rectangle of different property. How to do that?
k-Wave
A MATLAB toolbox for the time-domain
simulation of acoustic wave fields
I want to do a 2D elastic wave simulation on step geometry
(4 posts) (3 voices)-
Posted 1 year ago #
-
k-Wave probably isn't the best tool for modelling structures like this. I'd suggest looking at different FEM tools, or even the FEM tools within MATLAB.
Posted 1 year ago # -
Hello,
I am new to k-wave simulation, and I am trying to simulate the attenuation through media. First of all, for medium.alpha_coeff, what should the unit be? dB/MHz.cm or Np/MHz.cm? Secondly, how do I make sure the attenuation through the medium is correct? I placed two sensors, one near the source and the other 1.1mm away, and now by looking at sensor signals, I see there is an attenuation, but if I consider the peak-to-peak value of the sensor signal, it does not follow this relationship: P=P0*exp(-alpha*f*x), why? Here is my code:
% Define medium properties
medium.sound_speed = zeros(Nx, Ny);
medium.density = zeros(Nx, Ny);medium.sound_speed(:,:) = 5555;
medium.density(:,:) = 2440;% Define attenuation coefficients (Np/(MHz^y cm))
medium.alpha_coeff = zeros(Nx, Ny); % in dB/(MHz^y cm) but K-Wave expects Np/(MHz^y m)
medium.alpha_coeff(:,:) = 0.1; % low loss (converted to Np/(MHz^y m))
medium.alpha_power = 1.0; % frequency power
medium.alpha_mode = 'no_dispersion';% Simulation time
cfl=0.3;
t_end = 16e-6; % [s]
sound_speed=5555;
dt = cfl * dx / sound_speed;
kgrid.makeTime(sound_speed, cfl,t_end)
% Tone burst source settings
sample_freq = 20e6; % [Hz]
signal_freq = 1e6; % [Hz]
num_cycles = 3;
signal=toneBurst(sample_freq,signal_freq,num_cycles,'Plot',true);%Defining a single source point
source.p_mask = zeros(Nx, Ny);
source.p_mask(round(Nx/2), 1) = 1;% define a time varying sinusoidal source
source_mag = 1e2; % Amplitude in Pascals
source.p=source_mag *signal;% Initialize sensor mask with unique labels
sensor.mask = zeros(Nx, Ny);% Sensor 1: label '1' in second row (just below source)
sensor.mask(round(Nx/2), 2) = 1;% Sensor 2: label '2' in the row right after the glass layer
sensor.mask(round(Nx/2), 24) = 1;sensor.record = {'p', 'p_final','I'};
% Run the simulation with memory-safe options
input_args = {'PMLInside', false, 'PMLSize', 20, 'PMLAlpha',3, 'PlotPML', true, 'DataCast', 'single', 'PlotLayout', true,'RecordMovie', true};
% input_args = {'DisplayMask', display_mask,'PMLInside', false, 'PMLSize', 20, 'PMLAlpha',2, 'PlotPML', true, 'DataCast', 'single', 'PlotLayout', true};
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor,input_args{:});% Extract pressure signals
p_signals = sensor_data.p; % [2 x Nt]
Nt = length(kgrid.t_array);
t_micro = (0:Nt-1) * kgrid.dt * 1e6;% Plot recorded signals
figure;
plot(t_micro, p_signals(1,:), 'b-', 'LineWidth', 1.5);
xlabel('Time (µs)');
ylabel('Pressure (Pa)');
legend('Sensor 1 (near source)');
title('Pressure1 Time‑Series Recorded by Sensors');
figure;
plot(t_micro, p_signals(2,:), 'r-', 'LineWidth', 1.5);
xlabel('Time (µs)');
ylabel('Pressure (Pa)');
legend('Sensor 2 (after 1.1mm)');
title('Pressure2 Time‑Series Recorded by Sensors');
grid on;
[row_sens, col_sens] = find(sensor.mask);
figure;
imagesc(x_mm, y_mm, medium.sound_speed'); axis image tight;
colormap(jet); colorbar;
xlabel('x (mm)'); ylabel('y (mm)');
title('Medium with Sensor and Source Locations');
hold on;% Plot source in red
[row_src, col_src] = find(source.p_mask);
plot(x_mm(row_src), y_mm(col_src), 'rs', 'MarkerSize', 8, 'LineWidth', 1.5);% Plot sensors in green
plot(x_mm(row_sens), y_mm(col_sens), 'go', 'MarkerSize', 8, 'LineWidth', 1.5);
legend('Source', 'Sensor');Posted 11 hours ago # -
I have a follow-up question: when I change the frequency, I observe that the sensor signal is higher for a higher frequency than lower frequency. Why does this happen? The material has an attenuation coefficient that depends on frequency, so for higher frequencies, we should see a lower amplitude at the sensor. Why do I see the reverse behavior? I also tried to use the same number of cycles for each case, but again seeing the same behavior, I am interested to learn how the following papers simulated with reasonable results?
paper1.K‑wave modelling of ultrasound wave propagation in aerogels and the effect of physical parameters on attenuation and loss
paper2.Simultaneous use of pulse-echo and through-transmission methods in determining a combined reflection coefficientPosted 3 hours ago #
Reply
You must log in to post.