<?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; User Favorites: dsm194</title>
		<link><a href='http://www.k-wave.org/forum/profile/dsm194'>dsm194</a></link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 01:51:01 +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/profile/" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-7232</link>
			<pubDate>Wed, 12 Feb 2020 16:19:48 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7232@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi DLam,&#60;/p&#62;
&#60;p&#62;I'd suggest recording a time varying pressure signal for an integer number of periods at the end of the simulation. Then spectrally decompose the signal, and sum the absorption coefficient times intensity (calculated using p^2) at each harmonic.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DLam on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-7200</link>
			<pubDate>Tue, 28 Jan 2020 17:26:28 +0000</pubDate>
			<dc:creator>DLam</dc:creator>
			<guid isPermaLink="false">7200@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;I'm replying to this thread since the work here is similar to what I wanted to ask.&#60;br /&#62;
I have been using the C++ version of the simulator, where there is no I_avg output flag available.&#60;/p&#62;
&#60;p&#62;Currently, I am using the approximation that I_avg = (P_max^2)/(2*density*soundspeed) to calculate the scalar intensity array.&#60;br /&#62;
Can I still use Q = -div(&#38;lt;I&#38;gt;) in this case?  I suppose the vector field will have to be assumed somehow, e.g. to be along the transducer beam axis.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mithun on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4849</link>
			<pubDate>Fri, 21 Nov 2014 16:40:12 +0000</pubDate>
			<dc:creator>Mithun</dc:creator>
			<guid isPermaLink="false">4849@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;That was of great help. Thank you.&#60;/p&#62;
&#60;p&#62;Kind Regards,&#60;br /&#62;
Mithun
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4810</link>
			<pubDate>Sat, 01 Nov 2014 11:30:51 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4810@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Mithun,&#60;/p&#62;
&#60;p&#62;If you plot the simulation, you'll see the wave from the edge of the aperture. It looks like a spherical wave (or cylindrical wave depending on your aperture shape), but varies in polarity on either side of planar wave front. I've created a very simple example to illustrate:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;clear all;

% create the computational grid
Nx = 64;            % number of grid points in the x direction
Ny = 32;            % number of grid points in the y direction
Nz = 96;            % number of grid points in the z 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]
dz = 0.1e-3;        % grid point spacing in the z direction [m]
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);

% define the properties of the propagation medium
medium.sound_speed = 1500;

% create time array
kgrid.t_array = makeTime(kgrid, medium.sound_speed, 0.5, 4e-6);

% create initial pressure distribution
source.p0 = zeros(Nx, Ny, Nz);
source.p0(20, 14:19, 38:59) = 1;  

% define sensor mask
sensor.mask = zeros(Nx, Ny, Nz);
sensor.mask(Nx/2, Ny/2, Nz/4) = 1;
sensor.mask(3*Nx/4, Ny/2, Nz/2) = 1;

% input arguments
input_args = {&#38;#39;PlotPML&#38;#39;, false, &#38;#39;DataCast&#38;#39;, &#38;#39;single&#38;#39;};

% run the simulation
sensor_data = kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:});

% plot the simulated sensor data
figure;
plot(sensor_data.&#38;#39;)
ylabel(&#38;#39;Pressure&#38;#39;);
xlabel(&#38;#39;Time Step&#38;#39;);
legend(&#38;#39;Off Axis&#38;#39;, &#38;#39;On Axis&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mithun on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4789</link>
			<pubDate>Fri, 24 Oct 2014 10:33:07 +0000</pubDate>
			<dc:creator>Mithun</dc:creator>
			<guid isPermaLink="false">4789@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;Thank you for the valuable comments. Yes of-course, I can zero the first part of the signal. But I would like to understand whats happening actually. The high signal is coming not in the very beginning, but at around 100th sample for the middle element. It is a bipolar signal with negative cycle first and positive next. Then I thought it may be a reflection with phase shift of input signal with 1 cycle. How can I recognize an edge wave?&#60;/p&#62;
&#60;p&#62;Combining sensor data is really useful. Thank you.&#60;/p&#62;
&#60;p&#62;Regards,&#60;br /&#62;
Mithun
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4784</link>
			<pubDate>Tue, 21 Oct 2014 16:04:57 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4784@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Mithun,&#60;/p&#62;
&#60;p&#62;This function was added as part of k-Wave V1.1 (released a couple of weeks ago).&#60;/p&#62;
&#60;p&#62;The signal at the beginning will be your input signal. Inside the code, the source and sensor act independently, so if they are in the same position, the sensor will also record the input signal. There's a couple of ways you could remove this:&#60;/p&#62;
&#60;p&#62;(1) You could zero the first part of the signal, e.g., following the &#34;Simulating B-mode Ultrasound Images Example&#34;.&#60;/p&#62;
&#60;p&#62;(2) You could run a separate simulation in a homogeneous medium, and subtract the recorded signal from the signal you record when you have scatterers.&#60;/p&#62;
&#60;p&#62;Are you sure it's a reflection, and not an edge wave from the edge of the transducer?&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mithun on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4783</link>
			<pubDate>Tue, 21 Oct 2014 15:02:38 +0000</pubDate>
			<dc:creator>Mithun</dc:creator>
			<guid isPermaLink="false">4783@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Brad,&#60;/p&#62;
&#60;p&#62;I fixed it by adding the code you provided in another post to KwaveTransducer class. Thats amazing, it saved lot of time. Thank you.&#60;/p&#62;
&#60;p&#62;My problem is that I am getting a huge initial signal in all elements. This is a phase inverted bipolar signal. Is it the input signal itself?  How can I get rid of it? My transducer is below PML I guess. Even after this initial signal, I have another weak reflection also from unexpected depth. Any ideas on it looking at the code above?&#60;/p&#62;
&#60;p&#62;Thank You,&#60;br /&#62;
Kind Regards,&#60;br /&#62;
Mithun
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mithun on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4781</link>
			<pubDate>Tue, 21 Oct 2014 14:08:29 +0000</pubDate>
			<dc:creator>Mithun</dc:creator>
			<guid isPermaLink="false">4781@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Brad,&#60;br /&#62;
Thanks for the response. Great to know about apodization in c++ code. I am not able to use transducer.combine_sensor_data(sensor_data). Its throwing an error &#34;No appropriate method, property, or field combine_sensor_data for class kWaveTransducer&#34;. Do I have to write the method explicitly? Please help me on this. &#60;/p&#62;
&#60;p&#62;I am not going to use scan_line method as I am interested in data from each elements separately.&#60;/p&#62;
&#60;p&#62;Thank You,&#60;br /&#62;
Regards,&#60;br /&#62;
Mithun
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4771</link>
			<pubDate>Thu, 16 Oct 2014 11:40:56 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4771@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Mithun,&#60;/p&#62;
&#60;p&#62;There is currently a difference in the way the C++ and MATLAB codes return the data when using an object of the &#60;code&#62;kWaveTransducer&#60;/code&#62; class as a sensor. The MATLAB code returns one time series per active transducer element, while the C++ code returns one time series per grid point that forms part of the active transducer. &#60;/p&#62;
&#60;p&#62;If using the C++ code, before using the &#60;code&#62;scan_line&#60;/code&#62; method, you should call:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;sensor_data = transducer.combine_sensor_data(sensor_data);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;This will combine the sensor data to give a single time series per active transducer element, analogous to the output from the MATLAB code.&#60;/p&#62;
&#60;p&#62;Note that transmit apodization is not currently implemented in the C++ code, i.e., the apodization is always the same as:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;transducer.transmit_apodization = &#38;#39;Rectangular&#38;#39;;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;(see the discussion &#60;a href=&#34;http://www.k-wave.org/forum/topic/question-about-the-transducercombine_sensor_data-method&#34;&#62;here&#60;/a&#62;).&#60;/p&#62;
&#60;p&#62;Let me know if that doesn't solve the problem.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mithun on "Image Artefacts - Ultrasound Imaging"</title>
			<link>http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4767</link>
			<pubDate>Sun, 12 Oct 2014 09:34:55 +0000</pubDate>
			<dc:creator>Mithun</dc:creator>
			<guid isPermaLink="false">4767@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear All,&#60;/p&#62;
&#60;p&#62;I am trying to do a simple US image simulation using K-wave [Transducer as source and sensor]. Quite new to it. I created a medium and then a ball in the middle with different speed of sound and density. I expected only the reflection from the ball. Instead I am seeing a very high signal in the beginning of time trace (May be input signal?, How to get rid?) and different reverberations at almost all depths. What may be the reason for this? I put my transducer below PML. I am pasting my script below. Can anyone please throw your views on it? It would be of great help for me to move forward.&#60;/p&#62;
&#60;p&#62;clear all;&#60;br /&#62;
clc&#60;br /&#62;
% simulation settings&#60;br /&#62;
DATA_CAST = 'single';&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE K-WAVE GRID&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% set the size of the perfectly matched layer (PML)&#60;br /&#62;
PML_X_SIZE = 20;            % [grid points]&#60;br /&#62;
PML_Y_SIZE = 10;            % [grid points]&#60;br /&#62;
PML_Z_SIZE = 10;            % [grid points]&#60;/p&#62;
&#60;p&#62;% set total number of grid points not including the PML&#60;br /&#62;
Nx = 512 - 2*PML_X_SIZE;    % [grid points]&#60;br /&#62;
Ny = 512 - 2*PML_Y_SIZE;    % [grid points]&#60;br /&#62;
Nz = 128 - 2*PML_Z_SIZE;     % [grid points]&#60;/p&#62;
&#60;p&#62;% set desired grid size in the x-direction not including the PML&#60;br /&#62;
x = 30e-3;                  % [m]&#60;/p&#62;
&#60;p&#62;% calculate the spacing between the grid points&#60;br /&#62;
dx = x/Nx;                  % [m]&#60;br /&#62;
dy = dx;                    % [m]&#60;br /&#62;
dz = dx;                    % [m]&#60;/p&#62;
&#60;p&#62;% create the k-space grid&#60;br /&#62;
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);&#60;/p&#62;
&#60;p&#62;% Total time, 2 times for US&#60;br /&#62;
t_end = (x/1500)*2;                  % [s]&#60;br /&#62;
[kgrid.t_array,dt] = makeTime(kgrid, 1500, [], t_end);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE INPUT SIGNAL&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% define properties of the input signal&#60;br /&#62;
source_strength = 5e6;          % [Pa]&#60;br /&#62;
tone_burst_freq = 1.5e6;    	% [Hz]&#60;br /&#62;
tone_burst_cycles = 2;&#60;/p&#62;
&#60;p&#62;% create the input signal using toneBurst&#60;br /&#62;
input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);&#60;/p&#62;
&#60;p&#62;% scale the source magnitude by the source_strength divided by the&#60;br /&#62;
% impedance (the source is assigned to the particle velocity)&#60;br /&#62;
input_signal = (source_strength./(1500*1000)).*input_signal;&#60;/p&#62;
&#60;p&#62;medium.sound_speed  =1500;      % [m/s]&#60;br /&#62;
medium.density = 1000;          % [kg/m^3]&#60;br /&#62;
% medium.alpha_coeff = 0.0022;      % [dB/(MHz^y cm)]&#60;br /&#62;
% medium.alpha_power = 2;&#60;br /&#62;
% medium.BonA = 6;&#60;/p&#62;
&#60;p&#62;% define properties&#60;/p&#62;
&#60;p&#62;density_map = 1000*ones(Nx_tot, Ny_tot, Nz_tot);&#60;/p&#62;
&#60;p&#62;medium.density = density_map (:,:,:);&#60;/p&#62;
&#60;p&#62;ball_radius = round(.1e-3/dx);    	% [mm]&#60;/p&#62;
&#60;p&#62;p1 = 962*makeBall(Nx, Ny, Nz,PML_X_SIZE + round(16e-3/dx),PML_Y_SIZE + round(15e-3/dx), PML_Z_SIZE + Nz/2, ball_radius);&#60;br /&#62;
medium.density = medium.density + p1;&#60;/p&#62;
&#60;p&#62;% DEFINE THE ULTRASOUND TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% physical properties of the transducer&#60;br /&#62;
transducer.number_elements = 64;    % total number of transducer elements&#60;br /&#62;
transducer.element_width = 2;       % width of each element [grid points/voxels]&#60;br /&#62;
transducer.element_length = 24;     % length of each element [grid points/voxels]&#60;br /&#62;
transducer.element_spacing = 0;     % spacing (kerf  width) between the elements [grid points/voxels]&#60;br /&#62;
transducer.radius = inf;            % radius of curvature of the transducer [m]&#60;/p&#62;
&#60;p&#62;% calculate the width of the transducer in grid points&#60;br /&#62;
transducer_width = transducer.number_elements*transducer.element_width ...&#60;br /&#62;
    + (transducer.number_elements - 1)*transducer.element_spacing;&#60;/p&#62;
&#60;p&#62;% use this to position the transducer in the middle of the computational grid&#60;br /&#62;
transducer.position = round([PML_X_SIZE+1, Ny/2 - transducer_width/2, Nz/2 - transducer.element_length/2]);&#60;/p&#62;
&#60;p&#62;% properties used to derive the beamforming delays&#60;br /&#62;
transducer.sound_speed = 1500;              % sound speed [m/s]&#60;br /&#62;
transducer.focus_distance = 15e-3;        % focus distance [m]&#60;br /&#62;
transducer.elevation_focus_distance = 16e-3 + PML_X_SIZE; % focus distance in the elevation plane [m]&#60;br /&#62;
transducer.steering_angle = 0;              % steering angle [degrees]&#60;/p&#62;
&#60;p&#62;% apodization&#60;br /&#62;
transducer.transmit_apodization = 'Hanning';&#60;br /&#62;
transducer.receive_apodization = 'Rectangular';&#60;/p&#62;
&#60;p&#62;% define the transducer elements that are currently active&#60;br /&#62;
transducer.active_elements = zeros(transducer.number_elements, 1);&#60;br /&#62;
transducer.active_elements(1:transducer.number_elements) = 1;&#60;/p&#62;
&#60;p&#62;transducer.input_signal = input_signal;&#60;br /&#62;
% create the transducer using the defined settings&#60;br /&#62;
transducer = makeTransducer(kgrid, transducer);&#60;/p&#62;
&#60;p&#62;% print out transducer properties&#60;br /&#62;
transducer.properties;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% RUN THE SIMULATION&#60;br /&#62;
% =========================================================================&#60;br /&#62;
sensor.mask=transducer.all_elements_mask;&#60;br /&#62;
% set the input settings&#60;br /&#62;
input_args = {...&#60;br /&#62;
    'PMLInside', false, 'PlotSim', false, 'PMLSize', [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE], ...&#60;br /&#62;
    'DataCast', DATA_CAST};&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder3DC(kgrid, medium, transducer, transducer, input_args{:});&#60;/p&#62;
&#60;p&#62;% extract a single scan line from the sensor data using the current&#60;br /&#62;
% beamforming settings&#60;br /&#62;
scan_line = transducer.scan_line(sensor_data);&#60;br /&#62;
% reshape sensor data to y, z, t&#60;/p&#62;
&#60;p&#62;sensor_data_rs = reshape(sensor_data, transducer.number_elements*transducer.element_width, transducer.element_length, length(kgrid.t_array));&#60;/p&#62;
&#60;p&#62;Thank You&#60;br /&#62;
Kind Regards,&#60;br /&#62;
Mithun
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-4096</link>
			<pubDate>Wed, 20 Nov 2013 10:24:38 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4096@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Anthony,&#60;/p&#62;
&#60;p&#62;Thanks for your code - I see what you mean. You could try using the &#60;code&#62;gradientSpect&#60;/code&#62; function in k-Wave to see if that makes a difference to your calculation of the divergence. This computes the derivative in the same way as within the simulation functions. &#60;/p&#62;
&#60;p&#62;In regards to the accuracy of the intensity calculation, I've added some code to shift the velocity to the non-staggered spatial and temporal grid before multiplying by the pressure, and this seems to improve things. This will go into the V1.1 release.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-4092</link>
			<pubDate>Fri, 15 Nov 2013 15:45:57 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">4092@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;This small piece of code illustrates what I have just written (you just have to specify the correct path in the 3 first lines).&#60;/p&#62;
&#60;p&#62;Anthony&#60;/p&#62;
&#60;p&#62;********************************* CODE ******************************&#60;/p&#62;
&#60;p&#62;clear all&#60;br /&#62;
close all&#60;br /&#62;
clc&#60;/p&#62;
&#60;p&#62;infilename = 'C:\Users\Grisey\Desktop\checkSource\input.h5';&#60;br /&#62;
outfilename = 'C:\Users\Grisey\Desktop\checkSource\output.h5';&#60;br /&#62;
pathToKwave = '&#34;C:\Users\Grisey\k-wave\k-wave-toolbox-version-1.0-cpp-windows-binaries\Windows Binaries\kspaceFirstOrder3D-OMP.exe&#34;'; %(don't forget the &#34;)&#60;/p&#62;
&#60;p&#62;%% Paramètres&#60;br /&#62;
myPMLsize = 20;&#60;br /&#62;
medium.density = 1000;&#60;br /&#62;
medium.sound_speed = 1500;&#60;br /&#62;
source_mag = 1e5; &#60;/p&#62;
&#60;p&#62;%% Grille de calcul&#60;br /&#62;
f = 1e5;&#60;br /&#62;
N = 128;&#60;br /&#62;
h = 1e-3;&#60;br /&#62;
kgrid = makeGrid(N, h, N, h, N, h);&#60;/p&#62;
&#60;p&#62;%% Definition du transducteur&#60;br /&#62;
R = 10e-3;&#60;br /&#62;
transducerMask = zeros(N,N,N);&#60;br /&#62;
xgrid = h*((1:N)-N/2);&#60;br /&#62;
ygrid = h*((1:N)-N/2);&#60;br /&#62;
zgrid = h*((1:N)-N/2);&#60;br /&#62;
[X,Y,Z] = meshgrid(xgrid,ygrid,zgrid);&#60;br /&#62;
Rmap = (X.^2+Y.^2+Z.^2).^0.5;&#60;br /&#62;
transducerMask(Rmap&#38;lt;=R)=1;&#60;/p&#62;
&#60;p&#62;%% Simulation&#60;br /&#62;
% create the time array&#60;br /&#62;
[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed);&#60;br /&#62;
periode = 1/f;&#60;br /&#62;
recStartTime = numel(kgrid.t_array)-2*round(periode/dt)+1;&#60;/p&#62;
&#60;p&#62;source.p_mask = logical(transducerMask);&#60;br /&#62;
source.p = source_mag*sin(2*pi*f*kgrid.t_array);&#60;br /&#62;
source.p_mode = 'dirichlet';&#60;/p&#62;
&#60;p&#62;% assign the input options&#60;br /&#62;
input_args = {'PlotPML', true, 'PMLSize', myPMLsize,'Smooth',[false true true]};&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
toto = ones(N, N, N);&#60;br /&#62;
sensor.mask = logical(toto);&#60;br /&#62;
clear toto;&#60;br /&#62;
kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:},'SaveToDisk',infilename);&#60;/p&#62;
&#60;p&#62;status = system([pathToKwave ' -i ' infilename ' -o ' outfilename ' --p_rms --I_avg -s' num2str(recStartTime)]);&#60;/p&#62;
&#60;p&#62;%% Lecture du résultat&#60;br /&#62;
p_rms = reshape(h5read(outfilename,'/p_rms'),N,N,N);&#60;br /&#62;
Ix_avg = reshape(h5read(outfilename,'/Ix_avg'),N,N,N);&#60;br /&#62;
Iy_avg = reshape(h5read(outfilename,'/Iy_avg'),N,N,N);&#60;br /&#62;
Iz_avg = reshape(h5read(outfilename,'/Iz_avg'),N,N,N);&#60;br /&#62;
H = -divergence(Ix_avg,Iy_avg,Iz_avg)/h;&#60;/p&#62;
&#60;p&#62;% Calcul de Ir&#60;br /&#62;
Ianalytical = source_mag^2*R^2./(2*medium.sound_speed*medium.density.*Rmap.^2);&#60;br /&#62;
theta = acos(Z./Rmap);&#60;br /&#62;
phi = atan(Y./X)+pi*(X&#38;lt;0);&#60;br /&#62;
Ix_analytical = Ianalytical.*cos(phi).*sin(theta);&#60;br /&#62;
Iy_analytical = Ianalytical.*sin(phi).*sin(theta);&#60;br /&#62;
Iz_analytical = Ianalytical.*cos(theta);&#60;/p&#62;
&#60;p&#62;figure(1)&#60;br /&#62;
subplot(1,3,1)&#60;br /&#62;
imagesc(squeeze(H(round(N/2),:,:)).*(1-squeeze(transducerMask(round(N/2),:,:))))&#60;br /&#62;
caxis([-0.1e5 2e4])&#60;br /&#62;
title('-div(k-wave intensity) (order 1 uncentered divergence)')&#60;/p&#62;
&#60;p&#62;subplot(1,3,2)&#60;br /&#62;
Hanalytical = -divergence(Ix_analytical,Iy_analytical,Iz_analytical)/h;&#60;br /&#62;
imagesc(squeeze(Hanalytical(round(N/2),:,:)).*(1-squeeze(transducerMask(round(N/2),:,:))))&#60;br /&#62;
caxis([-0.1e5 2e4])&#60;br /&#62;
title('-div(analytical intensity) (order 1 uncentered divergence)')&#60;/p&#62;
&#60;p&#62;subplot(1,3,3)&#60;br /&#62;
divx = (Ix_avg(3:end,2:end-1,2:end-1)-Ix_avg(1:end-2,2:end-1,2:end-1))/2/h;&#60;br /&#62;
divy = (Iy_avg(2:end-1,3:end,2:end-1)-Iy_avg(2:end-1,1:end-2,2:end-1))/2/h;&#60;br /&#62;
divz = (Iz_avg(2:end-1,2:end-1,3:end)-Iz_avg(2:end-1,2:end-1,1:end-2))/2/h;&#60;br /&#62;
HnumericalOrder2 = -divx-divy-divz;&#60;br /&#62;
imagesc(squeeze(HnumericalOrder2 (round(N/2),:,:)).*(1-squeeze(transducerMask(round(N/2),2:end-1,2:end-1))))&#60;br /&#62;
caxis([-0.1e5 2e4])&#60;br /&#62;
title('-div(k-wave intensity) (order 2 centered divergence)')
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-4091</link>
			<pubDate>Fri, 15 Nov 2013 13:54:18 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">4091@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;According to some tests I have made, I think it comes from the numerical calculation of the divergence.&#60;/p&#62;
&#60;p&#62;In the simple case of a radiating sphere, with a linear medium and no attenuation, -div(pu)=0 theoretically. If I compute it numerically with an uncentered scheme of order 1, I get strong positive and negative zones along the axis of the cartesian grid. If I use a 2 order centered scheme, it becomes much better.&#60;/p&#62;
&#60;p&#62;However, it does not seem sufficient to solve the problem in the case of a focused field... Is it possible for you to try to do the calculation of the divergence in the spectral domain in k-wave in order to see if it solves the problem?&#60;/p&#62;
&#60;p&#62;Best regards,&#60;br /&#62;
Anthony
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-4047</link>
			<pubDate>Thu, 31 Oct 2013 20:12:43 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4047@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Anthony,&#60;/p&#62;
&#60;p&#62;We are still looking into the heat deposition issue. We've had a few blackboard sessions, but I think more questions have been raised than answered! Certainly you wouldn't expect to see a heat sink, but exactly how the heat deposition should be computed depends partly on where the energy loss terms appear in the conservation equations. If we get any closer, I'll let you know.&#60;/p&#62;
&#60;p&#62;Regarding the variation in the expected power, this might be due to approximations in the way intensity is calculated in V1.0 (see &#60;a href=&#34;http://www.k-wave.org/forum/topic/defining-incident-acoustic-plane-wave-intensity#post-3723&#34;&#62;here&#60;/a&#62;). We've changed the way this is calculated ready for V1.1.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-4044</link>
			<pubDate>Thu, 31 Oct 2013 17:35:17 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">4044@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;I must admit that I couldn't solve the mystery (still using 2*alpha*I in the meantime). Did you have some new insight about this? I wrote a piece of code that shows the problem, if someone has an idea...&#60;/p&#62;
&#60;p&#62;By the way, the acoustic power I get by integrating intensity over a plane is smaller than the value I should theoretically get : I guess it comes from the way I compute the amplitude of the velocity source :&#60;br /&#62;
u0 = sqrt( 2 * acousticPower / ( rho * soundSpeed * transducerSurface ) )&#60;br /&#62;
Is there another way to compute it (without the plane wave approximation, maybe...)?&#60;/p&#62;
&#60;p&#62;Best regards,&#60;br /&#62;
Anthony&#60;/p&#62;
&#60;p&#62;******************************** SAMPLE CODE ************************************&#60;br /&#62;
clear all&#60;br /&#62;
close all&#60;br /&#62;
clc&#60;/p&#62;
&#60;p&#62;%% Files&#60;br /&#62;
work_dir = uigetdir('Set working directory (where the files will be saved) ');&#60;br /&#62;
kspaceFirstOrder3D_OMP_path = uigetdir('Where is kspaceFirstOrder3D-OMP.exe?');&#60;br /&#62;
acousticSimulationInputFileName = 'input.h5';&#60;br /&#62;
acousticSimulationOutputFileName = 'output.h5';&#60;/p&#62;
&#60;p&#62;%% Parameters&#60;br /&#62;
% Source&#60;br /&#62;
acousticPower = 80; % [W]&#60;br /&#62;
source_freq = 2.5e5; %[Hz]&#60;br /&#62;
% Physical parameters&#60;br /&#62;
rho = 1000;&#60;br /&#62;
soundSpeed = 1500;&#60;/p&#62;
&#60;p&#62;%% Geometry&#60;br /&#62;
R = 40e-3;      % [m]&#60;br /&#62;
Rap = 30e-3;      % [m]&#60;br /&#62;
h = 0.5e-3;        % [m]&#60;br /&#62;
N = ceil(62e-3/h)+20;   % acoustic simulation grid size&#60;/p&#62;
&#60;p&#62;%% k-wave parameters&#60;br /&#62;
% Domain geometry&#60;br /&#62;
myPMLsize =         10;  &#60;/p&#62;
&#60;p&#62;% Source&#60;br /&#62;
transducerSurface =  2*pi*R*(R-sqrt(R^2-Rap^2));&#60;br /&#62;
source_mag = sqrt(2 * acousticPower / (rho * soundSpeed * transducerSurface)); %velocity source&#60;/p&#62;
&#60;p&#62;kgrid = makeGrid(N, h, N, h, N, h);&#60;/p&#62;
&#60;p&#62;% define a curved transducer element&#60;br /&#62;
xCenter = round(N/2);&#60;br /&#62;
yCenter = round(N/2);&#60;br /&#62;
zCenter = round(R/h)+2;&#60;br /&#62;
transducerMask = zeros(N,N,N);&#60;br /&#62;
xGrid = (1:N)'*ones(1,N);&#60;br /&#62;
yGrid = ones(N,1)*(1:N);&#60;br /&#62;
for zmap=1:(zCenter-(sqrt(R^2-Rap^2)/h));&#60;br /&#62;
    rmap2D = round(((xGrid-xCenter).^2+(yGrid-yCenter).^2+(zmap-zCenter).^2).^0.5);&#60;br /&#62;
    transducerMask(:,:,zmap) = 0+(rmap2D==round((R)/h));&#60;br /&#62;
end&#60;br /&#62;
clear xGrid yGrid rmap2D&#60;br /&#62;
% voxelPlot(transducerMask)&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium&#60;br /&#62;
medium.density = 1000; % [kg/m3]&#60;br /&#62;
medium.sound_speed = 1500;  % [m/s]&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed);&#60;br /&#62;
periode = 1/source_freq;&#60;br /&#62;
recStartTime = numel(kgrid.t_array)-round(periode/dt)+1;&#60;/p&#62;
&#60;p&#62;source.u_mask = logical(transducerMask);&#60;/p&#62;
&#60;p&#62;% define a time varying sinusoidal source&#60;br /&#62;
[I,J,K] = ind2sub([N,N,N],find(source.u_mask));&#60;br /&#62;
I = xCenter - I;&#60;br /&#62;
J = yCenter - J;&#60;br /&#62;
K = zCenter - K;&#60;br /&#62;
distCenter = (I.^2+J.^2+K.^2).^0.5;&#60;br /&#62;
timeSine = sin(2*pi*source_freq*kgrid.t_array);&#60;br /&#62;
source_ux0 = abs(I./distCenter)*source_mag;&#60;br /&#62;
source_uy0 = abs(J./distCenter)*source_mag;&#60;br /&#62;
source_uz0 = abs(K./distCenter)*source_mag;&#60;br /&#62;
source.ux = source_ux0*timeSine;&#60;br /&#62;
source.uy = source_uy0*timeSine;&#60;br /&#62;
source.uz = source_uz0*timeSine;&#60;/p&#62;
&#60;p&#62;% assign the input options&#60;br /&#62;
input_args = {'PlotPML', true, 'PMLSize', myPMLsize,'Smooth',[false true true]};&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
sensor.mask = logical(ones(N, N, N));&#60;br /&#62;
kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:},'SaveToDisk',[work_dir acousticSimulationInputFileName]);&#60;br /&#62;
clear kgrid medium source sensor&#60;/p&#62;
&#60;p&#62;status = system(['&#34;' kspaceFirstOrder3D_OMP_path '\kspaceFirstOrder3D-OMP.exe&#34; -i ' [work_dir acousticSimulationInputFileName] ' -o ' [work_dir acousticSimulationOutputFileName] ' --I_avg -s' num2str(recStartTime)]);&#60;/p&#62;
&#60;p&#62;%% Load the results&#60;br /&#62;
Ix_avg = h5read([work_dir acousticSimulationOutputFileName],'/Ix_avg');&#60;br /&#62;
Ix_avg = reshape(Ix_avg,N,N,N);&#60;br /&#62;
Iy_avg = h5read([work_dir acousticSimulationOutputFileName],'/Iy_avg');&#60;br /&#62;
Iy_avg = reshape(Iy_avg,N,N,N);&#60;br /&#62;
Iz_avg = h5read([work_dir acousticSimulationOutputFileName],'/Iz_avg');&#60;br /&#62;
Iz_avg = reshape(Iz_avg,N,N,N);&#60;/p&#62;
&#60;p&#62;%% Compute heat source term&#60;br /&#62;
heatSource = -divergence(Ix_avg,Iy_avg,Iz_avg)/h;&#60;br /&#62;
figure(1)&#60;br /&#62;
imagesc(squeeze(heatSource(:,round(N/2),:))')&#60;br /&#62;
xlabel('X')&#60;br /&#62;
ylabel('Z')&#60;br /&#62;
title('Heat source term : -div(I_{avg})')&#60;/p&#62;
&#60;p&#62;% Acoustic power&#60;br /&#62;
Pac_from_I = max(squeeze(sum(sum(Iz_avg(myPMLsize:end-myPMLsize,myPMLsize:end-myPMLsize,myPMLsize:end-myPMLsize),2),1))*h^2);&#60;br /&#62;
disp(['Acoustic power : ' num2str(Pac_from_I) 'W'])
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-3829</link>
			<pubDate>Fri, 26 Jul 2013 09:27:48 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">3829@http://www.k-wave.org/forum/</guid>
			<description>&#60;br /&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-3825</link>
			<pubDate>Thu, 25 Jul 2013 18:46:45 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">3825@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Anthony, &#60;/p&#62;
&#60;p&#62;Interesting question! Leave it with us for a short time, I'd like to check a few things before I give you an answer.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-3818</link>
			<pubDate>Thu, 25 Jul 2013 14:19:15 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">3818@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I realize my question is not clear. &#60;/p&#62;
&#60;p&#62;I understand that the formula simply comes from the Green formula, but... when I apply it to a focused field, I get a strong heat source right before the focal point and a strong (but weaker due to absorption) heat sink right after the focal point, what results in a strange thermal behaviour. (&#60;a href=&#34;http://www.casimages.com/img.php?i=130725031106339995.jpg&#34; title=&#34;example&#34;&#62;see example&#60;/a&#62;)&#60;/p&#62;
&#60;p&#62;From your experience, is this normal? I must probably miss some point...&#60;br /&#62;
Regards,
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Using intensity as heat source term (nonlinear acoustics)"</title>
			<link>http://www.k-wave.org/forum/topic/using-intensity-as-heat-source-term-nonlinear-acoustics#post-3802</link>
			<pubDate>Tue, 23 Jul 2013 08:21:37 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">3802@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Bradley,&#60;/p&#62;
&#60;p&#62;Just to be sure, when you write Q = - div(&#38;lt;I&#38;gt;), the source term become negative at some places, is it normal? If yes, how do you physically explain it? &#60;/p&#62;
&#60;p&#62;Anthony&#60;/p&#62;
&#60;p&#62;PS : I am sorry, I suppose it is probably in Pierce's book but I don't have it and there is nothing in the book of Hamilton &#38;amp; Blackstock... Do you know another ref about this particular topic?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jrosenfield on "Defining Incident Acoustic Plane Wave  Intensity"</title>
			<link>http://www.k-wave.org/forum/topic/defining-incident-acoustic-plane-wave-intensity#post-3726</link>
			<pubDate>Tue, 18 Jun 2013 04:21:25 +0000</pubDate>
			<dc:creator>jrosenfield</dc:creator>
			<guid isPermaLink="false">3726@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;I also meant to let you know that when I compute the average squared acoustic pressure using the time series of pressure values recorded by k-Wave, the average that I calculate also seems susceptible to the same frequency dependence as the average acoustic intensity. Specifically, the average squared pressure approaches the theoretical average as I decrease the source frequency away from the maximum frequency supported by the grid. I am not sure why this would be the case, since my understanding is that the pressure itself is not recorded on a staggered grid, so the issue causing problems with the average intensity calculation should not be a problem with pressure as you mentioned earlier. &#60;/p&#62;
&#60;p&#62;-Jon
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
