<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: Simulation of Ultrasonic Testing (Borehole in Solid)</title>
		<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 22:33:30 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/simulation-of-ultrasonic-testing-borehole-in-solid" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6735</link>
			<pubDate>Tue, 29 Jan 2019 22:36:57 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6735@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Rola, &#60;/p&#62;
&#60;p&#62;No, keep the velocity the same. The sound speeds are much closer in magnitude than the density (factor of 5 vs 1000).&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Rola on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6709</link>
			<pubDate>Tue, 15 Jan 2019 19:18:22 +0000</pubDate>
			<dc:creator>Rola</dc:creator>
			<guid isPermaLink="false">6709@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad and Ben, &#60;/p&#62;
&#60;p&#62;If I inflate the air density artificially by a factor of 100, do I need to inflate the inflate the air velocity too?&#60;/p&#62;
&#60;p&#62;Best
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6687</link>
			<pubDate>Sun, 09 Dec 2018 23:28:27 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">6687@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;HI fabwo, &#60;/p&#62;
&#60;p&#62;You're putting in a toneburst at 40 MHz, so it's not surprising it's changing when you filter at 100 kHz or so. Perhaps use the &#60;code&#62;...&#38;#39;PlotSpectrums&#38;#39;, true)&#60;/code&#62; option in &#60;code&#62;filterTimeSeries&#60;/code&#62; to see the spectrum of your signal before and after filtering.&#60;/p&#62;
&#60;p&#62;If you are only interested in propagation in one direction, then could you use the 1D code? It would be much more computationally efficient.&#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fabwo on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6574</link>
			<pubDate>Fri, 31 Aug 2018 18:01:45 +0000</pubDate>
			<dc:creator>fabwo</dc:creator>
			<guid isPermaLink="false">6574@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Ben,&#60;/p&#62;
&#60;p&#62;I adjusted my grid dimensions in x-direction (wave propagation is only in x-direction), shortened the time steps and tried different tone burst frequencies.&#60;br /&#62;
Unfortunately I didn't get better results. I also have some questions about the k-wave filter function.&#60;/p&#62;
&#60;p&#62;My grid dimension without the PML are Nx=1004, Ny=16, Nz=16 with dx=2.5e-5, dy=1e-3, dz=1e-3&#60;br /&#62;
My time steps are created using the function kgrid.makeTime with cfl=0.3, t_end=2e-5. This leads to 8002 time steps in the kgrid.t_array with 2.5e-9 seconds apart, but I have also tried shorter ones (e.g. dt=1e-9).&#60;br /&#62;
I modelled time varying stress at each of the source positions only in xx using the toneBurst function.&#60;br /&#62;
toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst-cycles) with tone_burst_freq=4e7 (4Mhz), tone_burst-cycles=3&#60;/p&#62;
&#60;p&#62;The filterTimeSeries function uses by default 3 PPW of the largest grid point spacing to compute the cutoff frequency. Is there a way to consider only the grid spacing in x-direction (because it is the only direction the waves are propagating)?&#60;br /&#62;
At the moment my filter cutoff frequency is 114.3333 kHz (3PPW). But somehow this filter changes even a tone burst with a frequency of 100 kHz. The amplitude of the tone burst is reduces by a factor of 100. How is this possible?&#60;br /&#62;
When I simulated with a tone burst of 100 kHz the pressure in sensor_data still blows up. Do you know where my mistakes are?&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://ibb.co/iQfJee&#34; rel=&#34;nofollow&#34;&#62;https://ibb.co/iQfJee&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;https://ibb.co/cOZdee&#34; rel=&#34;nofollow&#34;&#62;https://ibb.co/cOZdee&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;https://ibb.co/cRx9kK&#34; rel=&#34;nofollow&#34;&#62;https://ibb.co/cRx9kK&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;https://ibb.co/nD9dee&#34; rel=&#34;nofollow&#34;&#62;https://ibb.co/nD9dee&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Fabian&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% 3D ULTRASONIC SIMULATION - BOREHOLE IN A FRP COMPONENT&#60;br /&#62;
% CIRCULAR TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINITION OF THE K-WAVE GRID&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% PML size (perfectly matched layer) on the outside of the k-wave grid&#60;br /&#62;
% Grid points == GP&#60;br /&#62;
PML_X_SIZE = 10;           % [GP]&#60;br /&#62;
PML_Y_SIZE = 8;            % [GP]&#60;br /&#62;
PML_Z_SIZE = 8;            % [GP]&#60;br /&#62;
PML_SIZE = [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE];&#60;/p&#62;
&#60;p&#62;% Computational grid: number of GP without PML&#60;br /&#62;
% The number of GP (computational grid + PML) in each dimension should be&#60;br /&#62;
% given by a power of 2 or have a small primefactor because of&#60;br /&#62;
% computational advantages for later FFT use.&#60;br /&#62;
Nx = 1024 - 2*PML_X_SIZE;   % [GP]&#60;br /&#62;
Ny = 32 - 2*PML_Y_SIZE;     % [GP]&#60;br /&#62;
Nz = 32 - 2*PML_Z_SIZE;     % [GP]&#60;/p&#62;
&#60;p&#62;% Distance between GP&#60;br /&#62;
dx = 2.5e-5;                  % [m]&#60;br /&#62;
dy = 1e-3;                    % [m]&#60;br /&#62;
dz = 1e-3;                    % [m]&#60;/p&#62;
&#60;p&#62;% Creation of the k-space grid&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% TEST SET-UP &#38;amp; MEDIUM PARAMETER &#38;amp; TIME ARRAY&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Test set-up&#60;br /&#62;
frp_thickness = 5.5e-3;        % [m] FRP plate thickness&#60;br /&#62;
hole_diameter = 4e-3;          % [m] borehole diameter&#60;br /&#62;
hole_depth = 2e-3;             % [m] borehole depth&#60;br /&#62;
wedge_diameter = 6e-3;         % [m] PMMA wedge diameter&#60;br /&#62;
wedge_length = 11e-3;          % [m] PMMA wedge length&#60;/p&#62;
&#60;p&#62;% Transformation [m] into [GP]&#60;br /&#62;
frp_thickness_GP = single(frp_thickness / dx);      % [GP] plate thickness&#60;br /&#62;
hole_radius_GP = single((hole_diameter/2) / dy);    % [GP] borehole radius&#60;br /&#62;
hole_depth_GP = single(hole_depth / dx);            % [GP] borehole depth&#60;br /&#62;
wedge_radius_GP = single((wedge_diameter/2) / dy);  % [GP] wedge radius&#60;br /&#62;
wedge_length_GP = single(wedge_length / dx);        % [GP] wedge lenth&#60;/p&#62;
&#60;p&#62;%% Medium properties&#60;br /&#62;
c_gel = 1500;       % [m/s] speed of sound gel&#60;br /&#62;
rho_gel = 1002;     % [kg/m^3] density gel&#60;br /&#62;
c_air = 343;        % [m/s] speed of sound air&#60;br /&#62;
% The simulation is unstable for the correct density of air (1.2 [kg/m^3])&#60;br /&#62;
% because of the very large impedance contrast. To fix this problem the air&#60;br /&#62;
% density is artificially inflated by factor 100. The reflection&#60;br /&#62;
% coefficient is still close to 1.&#60;br /&#62;
rho_air = 120;      % [kg/m^3] density air&#60;br /&#62;
cp_FRP = 3000;      % [m/s] speed of sound FRP Compression (longitudinal)&#60;br /&#62;
cs_FRP = 3000;      % [m/s] speed of sound FRP Shear (transversal)&#60;br /&#62;
rho_FRP = 1500;     % [kg/m^3] density FRP&#60;br /&#62;
cp_PMMA = 2700;     % [m/s] speed of sound PMMA Compression (longitudinal)&#60;br /&#62;
cs_PMMA = 1300;     % [m/s] speed of sound PMMA Shear (transversal)&#60;br /&#62;
rho_PMMA = 1180;    % [kg/m^3] density PMMA&#60;/p&#62;
&#60;p&#62;%% Medium model:&#60;br /&#62;
% Creating matrices with the dimension of the k-space grid for the density&#60;br /&#62;
% and the sound speed of longitudinal and transversal waves.&#60;/p&#62;
&#60;p&#62;% Initializing medium model matrices with air&#60;br /&#62;
medium.sound_speed_compression = c_air * ones(Nx, Ny, Nz); % [m/s]&#60;br /&#62;
medium.sound_speed_shear = c_air * ones(Nx, Ny, Nz);       % [m/s]&#60;br /&#62;
medium.density = rho_air * ones(Nx, Ny, Nz);               % [kg/m^3]&#60;/p&#62;
&#60;p&#62;% FRP plate&#60;br /&#62;
for m = (Nx - frp_thickness_GP) : Nx&#60;br /&#62;
    medium.sound_speed_compression(m,:,:) = cp_FRP;     % [m/s]&#60;br /&#62;
    medium.sound_speed_shear(m,:,:) = cs_FRP;           % [m/s]&#60;br /&#62;
    medium.density(m,:,:) = rho_FRP;                    % [kg/m^3]&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% Defects in the FRP plate (1 borehole)&#60;br /&#62;
disc2 = makeDisc(Ny, Nz, Ny/2, Nz/2, hole_radius_GP);	% position, radius&#60;br /&#62;
flaw1 = repmat(disc2, [1, 1, Nx]);      % 3D disc extrusion&#60;br /&#62;
flaw1 = permute (flaw1, [3,1,2]);       % rearranging dimensions&#60;br /&#62;
for n = 1 : (Nx - hole_depth_GP - 1)	% borehole model using 0 and 1&#60;br /&#62;
    flaw1(n,:,:) = 0;&#60;br /&#62;
end&#60;br /&#62;
% Filling the flaw model with air properties in the medium matrices&#60;br /&#62;
medium.sound_speed_compression(flaw1==1) = c_air;     % [m/s]&#60;br /&#62;
medium.sound_speed_shear(flaw1==1) = c_air;           % [m/s]&#60;br /&#62;
medium.density(flaw1==1) = rho_air;                   % [kg/m^3]&#60;/p&#62;
&#60;p&#62;% Gel layer between FRP plate and PMMA wedge&#60;br /&#62;
gel_layer1 = (Nx - frp_thickness_GP - 1);	% [GP] gel layer position&#60;br /&#62;
medium.sound_speed_compression(gel_layer1,:,:) = c_gel; % [m/s]&#60;br /&#62;
medium.sound_speed_shear(gel_layer1,:,:) = c_air;       % [m/s]&#60;br /&#62;
medium.density(gel_layer1,:,:) = rho_gel;               % [kg/m^3]&#60;/p&#62;
&#60;p&#62;% PMMA wedge&#60;br /&#62;
disc1 = makeDisc(Ny, Nz, Ny/2, Nz/2, wedge_radius_GP);	% position, radius&#60;br /&#62;
wedge = repmat(disc1, [1, 1, Nx]);              % 3D disc extrusion&#60;br /&#62;
wedge = permute (wedge, [3,1,2]);               % rearranging dimensions&#60;br /&#62;
for h = gel_layer1 : Nx       % PMMA model using 0 and 1&#60;br /&#62;
    wedge(h,:,:) = 0;&#60;br /&#62;
end&#60;br /&#62;
for k = 1 : (gel_layer1 - wedge_length_GP)&#60;br /&#62;
    wedge(k,:,:) = 0;&#60;br /&#62;
end&#60;br /&#62;
% Filling the wedge model with PMMA properties in the medium matrices&#60;br /&#62;
medium.sound_speed_compression(wedge==1) = cp_PMMA;   % [m/s]&#60;br /&#62;
medium.sound_speed_shear(wedge==1) = cs_PMMA;         % [m/s]&#60;br /&#62;
medium.density(wedge==1) = rho_PMMA;                  % [kg/m^3]&#60;/p&#62;
&#60;p&#62;% Gel layer above PMMA wedge (transducer position)&#60;br /&#62;
gel_layer2 = ((gel_layer1 - wedge_length_GP) - 1);	% [GP] gel layer position&#60;br /&#62;
medium.sound_speed_compression(gel_layer2,:,:) = c_gel; % [m/s]&#60;br /&#62;
medium.sound_speed_shear(gel_layer2,:,:) = c_air;       % [m/s]&#60;br /&#62;
medium.density(gel_layer2,:,:) = rho_gel;               % [kg/m^3]&#60;/p&#62;
&#60;p&#62;%% Time array&#60;br /&#62;
cfl = 0.3;                    % default = 0.3&#60;br /&#62;
t_end = 2e-5;                 % [s]&#60;br /&#62;
kgrid.makeTime(max(medium.sound_speed_compression,medium.sound_speed_shear), cfl, t_end);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% INPUT SIGNAL&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Tone burst&#60;br /&#62;
tone_burst_freq = 4e7;    % [Hz]&#60;br /&#62;
tone_burst_cycles = 3;&#60;br /&#62;
% Time varying stress at each of the source positions&#60;br /&#62;
source_prefilter = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);&#60;br /&#62;
source.syy = 0;&#60;br /&#62;
source.szz = 0;&#60;br /&#62;
source.sxy = 0;&#60;br /&#62;
source.sxz = 0;&#60;br /&#62;
source.syz = 0;&#60;/p&#62;
&#60;p&#62;%% Filter the source to remove high frequencies not supported by the grid&#60;br /&#62;
source.sxx = filterTimeSeries(kgrid, medium, source_prefilter);&#60;br /&#62;
source.syy = filterTimeSeries(kgrid, medium, source.syy);&#60;br /&#62;
source.szz = filterTimeSeries(kgrid, medium, source.szz);&#60;br /&#62;
source.sxy = filterTimeSeries(kgrid, medium, source.sxy);&#60;br /&#62;
source.sxz = filterTimeSeries(kgrid, medium, source.sxz);&#60;br /&#62;
source.syz = filterTimeSeries(kgrid, medium, source.syz);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% TRANSDUCER DEFINITION [SOURCE AND SENSOR]&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Transducer model using 0 and 1&#60;br /&#62;
% Source&#60;br /&#62;
source.s_mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
source.s_mask(1,:,:) = disc1;       % same dimensions as the wedge&#60;br /&#62;
% Sensor&#60;br /&#62;
sensor.mask = source.s_mask;&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% RUN THE SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Assign additional input options&#60;br /&#62;
% place PML outside of the computational grid&#60;br /&#62;
input_args = { ...&#60;br /&#62;
    'PMLInside', false, 'DisplayMask', sensor.mask, 'PlotPML', false, ...&#60;br /&#62;
    'PMLSize', PML_SIZE};&#60;/p&#62;
&#60;p&#62;% Run the simulation&#60;br /&#62;
sensor_data = pstdElastic3D(kgrid, medium, source, sensor, input_args{:});&#60;br /&#62;
save('Workspace_SmallGrid.mat');
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6556</link>
			<pubDate>Thu, 16 Aug 2018 20:45:50 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">6556@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Fabian, &#60;/p&#62;
&#60;p&#62;It's not an instability problem, in that using too high a source frequency won't lead to the simulation blowing up. However, if you use a source with a frequency higher than the grid can support, then most of the energy will just not propagate anywhere. It's lost. Look at the amplitude of your source before and after you filter it to remove the frequencies not supported on the grid. It is almost set to zero. So I suspect you're just seeing an artifact rather than a real signal. Perhaps try a lower frequency source and see what happens. &#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fabwo on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6552</link>
			<pubDate>Thu, 16 Aug 2018 18:05:25 +0000</pubDate>
			<dc:creator>fabwo</dc:creator>
			<guid isPermaLink="false">6552@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Ben,&#60;/p&#62;
&#60;p&#62;thanks for your response. I will adjust my grid to prevent instability after a certain time. However I still do not understand why the peak at 0.3 microseconds in the source signal occours at 0.4 microsenconds in the sensor signal. In my oppinion the signal returns way too fast (see calculation in my second post). Will this problem dissapear with the grid changes as well?&#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Fabian
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6549</link>
			<pubDate>Thu, 16 Aug 2018 14:14:56 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">6549@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Fabwo, &#60;/p&#62;
&#60;p&#62;Sorry for the delay in getting back to you. If you look at the toneburst signal you use as a source signal, 0.3 microseconds is where the peak occurs. However, the more serious problem is that the frequency you use is too high to be supported by a grid of that spacing. &#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fabwo on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6524</link>
			<pubDate>Sat, 14 Jul 2018 12:52:06 +0000</pubDate>
			<dc:creator>fabwo</dc:creator>
			<guid isPermaLink="false">6524@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thanks Brad, inflating the density of air worked perfectly.&#60;/p&#62;
&#60;p&#62;Unfortunately I encountered a different problem which I can not solve by myself.&#60;br /&#62;
I modelled a PMMA wedge of a simple circular transducer on top of a solid block with a borehole drilled from underneath.&#60;br /&#62;
The source/sensor (same grid points) is placed on top of the wedge in an additional gel layer, another gel layer exists between the wedge and the solid block.&#60;br /&#62;
The source signal is a tone burst with a frequency of 5 Mhz and 3 cycles. When I run my pstdElastic3D simulation the sensor detects an echo-signal which has a plausible shape but is reflected way too fast.&#60;br /&#62;
I expected an echo-signal after ~14 µs (calculation below) , not after 0.3µs. Furthermore I experience very high negative pressure values after a certain simulation time. Therefore I have two questions:&#60;/p&#62;
&#60;p&#62;1) Why does the echo-signal return so quickly to the transducer?&#60;br /&#62;
2) Why do I get very high negative pressure values after ~ simulation time?&#60;/p&#62;
&#60;p&#62;Graph of source and sensor signal: &#60;a href=&#34;https://imgur.com/a/0EdSQU4&#34; rel=&#34;nofollow&#34;&#62;https://imgur.com/a/0EdSQU4&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Fabian&#60;/p&#62;
&#60;p&#62;Calculation of the echo-signal time difference:&#60;br /&#62;
		t = 2 * (length_wedge / soundspeed_wedge + length_solid / soundspeed_solid)&#60;br /&#62;
	The length of the different materials is given in gridpoints...&#60;br /&#62;
		t = 2 * (110 * dx / soundspeed_wedge + 101 * dx / soundspeed_solid)&#60;br /&#62;
	With soundspeed_wedge = 2700 m/s, soundspeed_solid = 3000 m/s, dx = 0,0001 m/s&#60;br /&#62;
		t = 1.481e-5 = 14.81 µs&#60;/p&#62;
&#60;p&#62;Code (with the longer simulation time the simulation takes some hours):&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% 3D ULTRASONIC SIMULATION - BOREHOLE IN A FRP COMPONENT&#60;br /&#62;
% CIRCULAR TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% DEFINITION OF THE K-WAVE GRID&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% PML size (perfectly matched layer) on the outside of the k-wave grid&#60;br /&#62;
PML_X_SIZE = 10;            % [gridpoints]&#60;br /&#62;
PML_Y_SIZE = 10;            % [gridpoints]&#60;br /&#62;
PML_Z_SIZE = 10;            % [gridpoints]&#60;br /&#62;
PML_SIZE = [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE];&#60;/p&#62;
&#60;p&#62;% Computational grid: number of gridpoints without PML&#60;br /&#62;
% The number of gridpoint (computational grid + PML) in each dimension&#60;br /&#62;
% should be given by a power of 2 or have a small primefactor because of&#60;br /&#62;
% computational advantages for FFT use.&#60;br /&#62;
Nx = 256 - 2*PML_X_SIZE;    % [gridpoints]&#60;br /&#62;
Ny = 64 - 2*PML_Y_SIZE;     % [gridpoints]&#60;br /&#62;
Nz = 64 - 2*PML_Z_SIZE;     % [gridpoints]&#60;/p&#62;
&#60;p&#62;% Distance between gridpoints&#60;br /&#62;
dx = 1e-4;                  % [m]&#60;br /&#62;
dy = 1e-3;                  % [m]&#60;br /&#62;
dz = 1e-3;                  % [m]&#60;/p&#62;
&#60;p&#62;% Creation of the k-space grid&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% MEDIUM PARAMETER &#38;amp; TIME ARRAY&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Medium properties&#60;br /&#62;
c_gel = 1500;       % [m/s] speed of sound gel&#60;br /&#62;
rho_gel = 1002;     % [kg/m^3] density gel&#60;br /&#62;
c_air = 343;        % [m/s] speed of sound air&#60;br /&#62;
% The simulation is unstable for the correct density of air (1.2 [kg/m^3])&#60;br /&#62;
% because of the very large impedance contrast. To fix this problem the air&#60;br /&#62;
% density is artificially inflated by factor 100. The reflection coefficient&#60;br /&#62;
% is still close to 1.&#60;br /&#62;
rho_air = 120;      % [kg/m^3] density air&#60;br /&#62;
cp_FRP = 3000;      % [m/s] speed of sound FRP Compression (longitudinal)&#60;br /&#62;
cs_FRP = 3000;      % [m/s] speed of sound FRP Shear (transversal)&#60;br /&#62;
rho_FRP = 1500;     % [kg/m^3] density FRP&#60;br /&#62;
cp_PMMA = 2700;     % [m/s] speed of sound PMMA Compression (longitudinal)&#60;br /&#62;
cs_PMMA = 1300;     % [m/s] speed of sound PMMA Shear (transversal)&#60;br /&#62;
rho_PMMA = 1180;    % [kg/m^3] density PMMA&#60;/p&#62;
&#60;p&#62;% Medium model&#60;br /&#62;
% Creating matrices with the dimension of the k-space grid for the density&#60;br /&#62;
% and the sound speed of longitudinal and transversal waves&#60;br /&#62;
medium.sound_speed_compression = cp_FRP * ones(Nx, Ny, Nz); % [m/s]&#60;br /&#62;
medium.sound_speed_shear = cs_FRP * ones(Nx, Ny, Nz);       % [m/s]&#60;br /&#62;
medium.density = rho_FRP * ones(Nx, Ny, Nz);                % [kg/m^3]&#60;/p&#62;
&#60;p&#62;% Air layer (on top of the plate)&#60;br /&#62;
air_layer = 110;                         % [gridpoints] air layer thickness&#60;br /&#62;
for m = 1 : air_layer&#60;br /&#62;
    medium.sound_speed_compression(m,:,:) = c_air;     % [m/s]&#60;br /&#62;
    medium.sound_speed_shear(m,:,:) = c_air;           % [m/s]&#60;br /&#62;
    medium.density(m,:,:) = rho_air;                   % [kg/m^3]&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% PMMA wedge&#60;br /&#62;
disc1 = makeDisc(Ny, Nz, Ny/2, Nz/2, 3); % disc position, radius&#60;br /&#62;
wedge = repmat(disc1, [1, 1, Nx]);       % 3D disc extrusion&#60;br /&#62;
wedge = permute (wedge, [3,1,2]);        % rearranging dimensions&#60;br /&#62;
% length of wedge +1 because of later added gel layer on top of the wedge&#60;br /&#62;
wedge_length = 110+1;                     % [gridpoints] borehole depth&#60;br /&#62;
for n = (wedge_length+1) : Nx             % PMMA model using 0 and 1&#60;br /&#62;
    wedge(n,:,:) = 0;&#60;br /&#62;
end&#60;br /&#62;
% Filling the medium model with PMMA properties&#60;br /&#62;
medium.sound_speed_compression(wedge==1) = cp_PMMA;   % [m/s]&#60;br /&#62;
medium.sound_speed_shear(wedge==1) = cs_PMMA;         % [m/s]&#60;br /&#62;
medium.density(wedge==1) = rho_PMMA;                  % [kg/m^3]&#60;/p&#62;
&#60;p&#62;% Defects in the FRP component (borehole)&#60;br /&#62;
disc2 = makeDisc(Ny, Nz, Ny/2, Nz/2, 5); % disc position, radius&#60;br /&#62;
flaw1 = repmat(disc2, [1, 1, Nx]);       % 3D disc extrusion&#60;br /&#62;
flaw1 = permute (flaw1, [3,1,2]);        % rearranging dimensions&#60;br /&#62;
hole_depth = 25;                         % [gridpoints] borehole depth&#60;br /&#62;
for n = 1 : (Nx-hole_depth-1)            % borehole model using 0 and 1&#60;br /&#62;
    flaw1(n,:,:) = 0;&#60;br /&#62;
end&#60;br /&#62;
% Filling the medium model with air properties&#60;br /&#62;
medium.sound_speed_compression(flaw1==1) = c_air;     % [m/s]&#60;br /&#62;
medium.sound_speed_shear(flaw1==1) = c_air;           % [m/s]&#60;br /&#62;
medium.density(flaw1==1) = rho_air;                   % [kg/m^3]&#60;/p&#62;
&#60;p&#62;% Two gel layers (on both sides of the wedge)&#60;br /&#62;
% Filling the medium model with gel properties&#60;br /&#62;
% Gel layer above the wedge&#60;br /&#62;
medium.sound_speed_compression(1,:,:) = c_gel;        % [m/s]&#60;br /&#62;
medium.sound_speed_shear(1,:,:) = c_air;              % [m/s]&#60;br /&#62;
medium.density(1,:,:) = rho_gel;                      % [kg/m^3]&#60;br /&#62;
% Gel layer under the wedge&#60;br /&#62;
medium.sound_speed_compression((wedge_length+1),:,:) = c_gel; % [m/s]&#60;br /&#62;
medium.sound_speed_shear((wedge_length+1),:,:) = c_air;       % [m/s]&#60;br /&#62;
medium.density((wedge_length+1),:,:) = rho_gel;               % [kg/m^3]&#60;/p&#62;
&#60;p&#62;%% Time array&#60;/p&#62;
&#60;p&#62;dt = 1e-9;                      % [s] simulation timestep&#60;br /&#62;
t_end = 2e-5;                   % [s] time end&#60;br /&#62;
kgrid.t_array = 0:dt:t_end;     % create time array&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% INPUT SIGNAL&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Tone burst&#60;br /&#62;
tone_burst_freq = 5e6;        % [Hz]&#60;br /&#62;
tone_burst_cycles = 3;&#60;br /&#62;
% Time varying stress at each of the source positions&#60;br /&#62;
source.sxx = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);&#60;br /&#62;
source.syy = 0;&#60;br /&#62;
source.szz = 0;&#60;br /&#62;
source.sxy = 0;&#60;br /&#62;
source.sxz = 0;&#60;br /&#62;
source.syz = 0;&#60;/p&#62;
&#60;p&#62;% Filter the source to remove high frequencies not supported by the grid&#60;br /&#62;
source.sxx = filterTimeSeries(kgrid, medium, source.sxx);&#60;br /&#62;
source.syy = filterTimeSeries(kgrid, medium, source.syy);&#60;br /&#62;
source.szz = filterTimeSeries(kgrid, medium, source.szz);&#60;br /&#62;
source.sxy = filterTimeSeries(kgrid, medium, source.sxy);&#60;br /&#62;
source.sxz = filterTimeSeries(kgrid, medium, source.sxz);&#60;br /&#62;
source.syz = filterTimeSeries(kgrid, medium, source.syz);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% TRANSDUCER DEFINITION [SOURCE AND SENSOR]&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Transducer model using 0 and 1&#60;br /&#62;
% Source&#60;br /&#62;
source.s_mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
source.s_mask(1,:,:) = disc1;       % same dimensions as the wedge&#60;br /&#62;
% Sensor&#60;br /&#62;
sensor.mask = source.s_mask;&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% RUN THE SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Assign additional input options&#60;br /&#62;
% place PML outside of the computational grid&#60;br /&#62;
input_args = { ...&#60;br /&#62;
    'PMLInside', false, 'DisplayMask', sensor.mask, 'PlotPML', false, ...&#60;br /&#62;
    'PMLSize', PML_SIZE};&#60;/p&#62;
&#60;p&#62;% Run the simulation&#60;br /&#62;
sensor_data = pstdElastic3D(kgrid, medium, source, sensor, input_args{:});
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6497</link>
			<pubDate>Sun, 24 Jun 2018 19:19:33 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6497@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Fabian,&#60;/p&#62;
&#60;p&#62;1) The simulation is unstable because of the very large impedance contrast to air. You can solve this by reducing the size of the time step. Alternatively, I normally artificially inflate the density of the air by a factor of 100 or so. The reflection coefficient is still close to one, but the simulation should then run without any problems.&#60;/p&#62;
&#60;p&#62;2) If you have a single transducer, you can just sum or average the data, i.e., output = mean(sensor_data, 1);&#60;/p&#62;
&#60;p&#62;3) Depends on the situation - you can always try it with and without the layer to see if makes any difference.&#60;/p&#62;
&#60;p&#62;4) Yes that's correct.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fabwo on "Simulation of Ultrasonic Testing (Borehole in Solid)"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6473</link>
			<pubDate>Fri, 25 May 2018 15:25:55 +0000</pubDate>
			<dc:creator>fabwo</dc:creator>
			<guid isPermaLink="false">6473@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad and Ben,&#60;/p&#62;
&#60;p&#62;my goal is to simulate UT (TOFD) of CFRP Components.&#60;br /&#62;
Because I am new to K-Wave I want to start with simulating the CFRP as homogenous material.&#60;br /&#62;
I used pstdElastic3D to simulate propagation in a solid plate.&#60;br /&#62;
The modelled defect in the CFRP plate is a simple borehole from beneath.&#60;br /&#62;
Ultimately I want to model a phased array. For now the transducer is circular and directly centered above the borehole.&#60;br /&#62;
I used a sinusoidal source. In this code I cut of the time steps after 61 because of lower computation time.&#60;/p&#62;
&#60;p&#62;1) My sensor_data always oscillates to very hight values after a few time steps. I have no idea what the reason is. I tried to play with the PML and the absoption coefficients but did not receive better results. Can you help me with this?&#60;/p&#62;
&#60;p&#62;2) I created the circular transducer with the makeDisc command. How can i put all sensor_data together to create an A-Scan at the transducer position?&#60;/p&#62;
&#60;p&#62;3) I modelled a gel layer (sound speed and density) where the transducer is placed. Is this necessary?&#60;/p&#62;
&#60;p&#62;4) When i tried to model a phased array I received a notice telling me that the kWaveTransducer class can not be used in pstdElastic. Is this correct?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;/p&#62;
&#60;p&#62;Fabian&#60;/p&#62;
&#60;p&#62;1 % =========================================================================&#60;br /&#62;
2 % 3D ULTRASONIC SIMULATION BOREHOLE IN A CFRP COMPONENT&#60;br /&#62;
3 % CIRCULAR TRANSDUCER&#60;br /&#62;
4 % =========================================================================&#60;br /&#62;
5&#60;br /&#62;
6&#60;br /&#62;
7 clearvars;&#60;br /&#62;
8&#60;br /&#62;
9&#60;br /&#62;
10 % =========================================================================&#60;br /&#62;
11 % DEFINITION OF THE K-WAVE GRID&#60;br /&#62;
12 % =========================================================================&#60;br /&#62;
13&#60;br /&#62;
14 % PML size (perfectly matched layer)&#60;br /&#62;
15 PML_X_SIZE = 20; % [gridpoints]&#60;br /&#62;
16 PML_Y_SIZE = 20; % [gridpoints]&#60;br /&#62;
17 PML_Z_SIZE = 20; % [gridpoints]&#60;br /&#62;
18 PML_SIZE = [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE];&#60;br /&#62;
19&#60;br /&#62;
20 % Number of gridpoints without PML&#60;br /&#62;
21 Nx = 64 - 2*PML_X_SIZE; % [gridpoints]&#60;br /&#62;
22 Ny = 256 - 2*PML_Y_SIZE; % [gridpoints]&#60;br /&#62;
23 Nz = 256 - 2*PML_Z_SIZE; % [gridpoints]&#60;br /&#62;
24&#60;br /&#62;
25 % Distance between gridpoints&#60;br /&#62;
26 dx = 1e-4; % [m]&#60;br /&#62;
27 dy = 1e-4; % [m]&#60;br /&#62;
28 dz = 1e-4; % [m]&#60;br /&#62;
29&#60;br /&#62;
30 % K-pace grid&#60;br /&#62;
31 kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);&#60;br /&#62;
32&#60;br /&#62;
33&#60;br /&#62;
34 % =========================================================================&#60;br /&#62;
35 % MEDIUM PARAMETER &#38;amp; TIME ARRAY&#60;br /&#62;
36 % =========================================================================&#60;br /&#62;
37&#60;br /&#62;
38 % Medium properties&#60;br /&#62;
39 c_gel = 1500; % [m/s] speed of sound gel&#60;br /&#62;
40 rho_gel = 1200; % [kg/m^3] density gel&#60;br /&#62;
41 c_air = 343; % [m/s] speed of sound air&#60;br /&#62;
42 rho_air = 1.2; % [kg/m^3] density air&#60;br /&#62;
43 cp_cfrp = 3000; % [m/s] speed of sound CFRP Compression (longitudinal)&#60;br /&#62;
44 cs_cfrp = 3000; % [m/s] speed of sound CFRP Shear (transversal)&#60;br /&#62;
45 rho_cfrp = 1500; % [kg/m^3] density CFRP&#60;br /&#62;
46&#60;br /&#62;
47 medium.sound_speed_compression = cp_cfrp * ones(Nx, Ny, Nz); % [m/s]&#60;br /&#62;
48 medium.sound_speed_shear = cs_cfrp * ones(Nx, Ny, Nz); % [m/s]&#60;br /&#62;
49 medium.density = rho_cfrp * ones(Nx, Ny, Nz); % [kg/m^3]&#60;br /&#62;
50&#60;br /&#62;
51 % % Absorption properties&#60;br /&#62;
52 % medium.alpha_coeff_compression = 1; % [?]&#60;br /&#62;
53 % medium.alpha_coeff_shear = 1; % [?]&#60;br /&#62;
54&#60;br /&#62;
55 % Defects in the CFRP component (borehole)&#60;br /&#62;
56 disc1 = makeDisc(Ny, Nz, Ny/2, Nz/2, 5); % Disc position, radius&#60;br /&#62;
57 flaw1 = repmat(disc1, [1, 1, Nx]); % 3D disc extrusion&#60;br /&#62;
58 flaw1 = permute (flaw1, [3,1,2]);&#60;br /&#62;
59 hole_depth = 25; % [gridpoints] borehole depth&#60;br /&#62;
60 for n = 1 : (Nx-hole_depth-1)&#60;br /&#62;
61 flaw1(n,:,:) = 0;&#60;br /&#62;
62 end&#60;br /&#62;
63 medium.sound_speed_compression(flaw1==1) = c_air; % [m/s]&#60;br /&#62;
64 medium.sound_speed_shear(flaw1==1) = c_air; % [m/s]&#60;br /&#62;
65 medium.density(flaw1==1) = rho_air; % [kg/m^3]&#60;br /&#62;
66&#60;br /&#62;
67 % gel layer&#60;br /&#62;
68 medium.sound_speed_compression(1,:,:) = c_gel; % [m/s]&#60;br /&#62;
69 medium.sound_speed_shear(1,:,:) = c_gel; % [m/s]&#60;br /&#62;
70 medium.density(1,:,:) = rho_gel; % [kg/m^3]&#60;br /&#62;
71&#60;br /&#62;
72 % Time array&#60;br /&#62;
73 cfl = 0.1; % default = 0.3&#60;br /&#62;
74 t_end = 0.2e-6; % [s]&#60;br /&#62;
75 kgrid.makeTime(max(medium.sound_speed_compression,medium.sound_speed_shear), cfl,&#60;br /&#62;
t_end);&#60;br /&#62;
76&#60;br /&#62;
77&#60;br /&#62;
78 % =========================================================================&#60;br /&#62;
79 % INPUT SIGNAL&#60;br /&#62;
80 % =========================================================================&#60;br /&#62;
81&#60;br /&#62;
82 % time varying sinusoidal source&#60;br /&#62;
83 source_freq = 1e6; % [Hz]&#60;br /&#62;
84 source_mag = 0.5; % [Pa]&#60;br /&#62;
85 source.sxx = source_mag * sin(2 * pi * source_freq * kgrid.t_array);&#60;br /&#62;
86 source.syy = 0;&#60;br /&#62;
87 source.szz = 0;&#60;br /&#62;
88 source.sxy = 0;&#60;br /&#62;
89 source.sxz = 0;&#60;br /&#62;
90 source.syz = 0;&#60;br /&#62;
91&#60;br /&#62;
92 % filter the source to remove high frequencies not supported by the grid&#60;br /&#62;
93 source.sxx = filterTimeSeries(kgrid, medium, source.sxx);&#60;br /&#62;
94 source.syy = filterTimeSeries(kgrid, medium, source.syy);&#60;br /&#62;
95 source.szz = filterTimeSeries(kgrid, medium, source.szz);&#60;br /&#62;
96 source.sxy = filterTimeSeries(kgrid, medium, source.sxy);&#60;br /&#62;
97 source.sxz = filterTimeSeries(kgrid, medium, source.sxz);&#60;br /&#62;
98 source.syz = filterTimeSeries(kgrid, medium, source.syz);&#60;br /&#62;
99&#60;br /&#62;
100&#60;br /&#62;
101 % =========================================================================&#60;br /&#62;
102 % TRANSDUCER DEFINITION [SOURCE AND SENSOR]&#60;br /&#62;
103 % =========================================================================&#60;br /&#62;
104&#60;br /&#62;
105 % Transducer element (source)&#60;br /&#62;
106 % source.s_mask: time varying stress source&#60;br /&#62;
107 % source.u_mask: time varying verlocity source&#60;br /&#62;
108&#60;br /&#62;
109 source.s_mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
110 source.s_mask(1, Ny/2, Nz/2) = 1;&#60;br /&#62;
111&#60;br /&#62;
112 % Transducer element (sensor)&#60;br /&#62;
113 sensor.mask = source.s_mask;&#60;br /&#62;
114&#60;br /&#62;
115&#60;br /&#62;
116&#60;br /&#62;
117 % =========================================================================&#60;br /&#62;
118 % RUN THE SIMULATION&#60;br /&#62;
119 % =========================================================================&#60;br /&#62;
120&#60;br /&#62;
121 % assign the input options&#60;br /&#62;
122 input_args = { ...&#60;br /&#62;
123 'PMLInside', false, 'DisplayMask', sensor.mask, 'PlotPML', false, ...&#60;br /&#62;
124 'PMLSize', PML_SIZE};&#60;br /&#62;
125&#60;br /&#62;
126 % run the simulation&#60;br /&#62;
127 sensor_data = pstdElastic3D(kgrid, medium, source, sensor, input_args{:});&#60;br /&#62;
128&#60;br /&#62;
129 % size_sensor_data = size(sensor_data);&#60;br /&#62;
130 % unmasked_sensor_data = zeros(Ny, Nz, size_sensor_data(2));&#60;br /&#62;
131&#60;br /&#62;
132 % for i = 1: size_sensor_data(2)&#60;br /&#62;
133 % unmasked_sensor_data(sensor.mask(1,:,:) ~= 0) = sensor_data(:,i);&#60;br /&#62;
134 % end
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
