<?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: Attenuation measurement in 3D</title>
		<link>http://www.k-wave.org/forum/topic/attenuation-measurement-in-3d</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 22:33:02 +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/attenuation-measurement-in-3d" rel="self" type="application/rss+xml" />

		<item>
			<title>LewisR on "Attenuation measurement in 3D"</title>
			<link>http://www.k-wave.org/forum/topic/attenuation-measurement-in-3d#post-8204</link>
			<pubDate>Thu, 10 Jun 2021 11:21:31 +0000</pubDate>
			<dc:creator>LewisR</dc:creator>
			<guid isPermaLink="false">8204@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thanks Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Attenuation measurement in 3D"</title>
			<link>http://www.k-wave.org/forum/topic/attenuation-measurement-in-3d#post-8192</link>
			<pubDate>Tue, 08 Jun 2021 17:25:40 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8192@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Lewis,&#60;/p&#62;
&#60;p&#62;Regarding your second point, if you have a power law close to 1, the sound speed is very strongly dependent on frequency because of dispersion (physical, not numerical). This means that the sound speed at the frequency you're interested in might be much higher than the DC sound speed specified by &#60;code&#62;medium.sound_speed&#60;/code&#62;. The exact sound speed can be calculated from the dispersion relation, e.g., try running:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;figure;
f = 0:1e3:1e6;
ckk = powerLawKramersKronig(2*pi*f, 0, 3000, db2neper(13, 1.1), 1.1);
plot(f, ckk);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You will see the sound speed in the 100s of kHz range is much higher than 3000. Although maybe unexpected, this is the correct behaviour for power law absorption / dispersion.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>LewisR on "Attenuation measurement in 3D"</title>
			<link>http://www.k-wave.org/forum/topic/attenuation-measurement-in-3d#post-8167</link>
			<pubDate>Fri, 04 Jun 2021 11:00:47 +0000</pubDate>
			<dc:creator>LewisR</dc:creator>
			<guid isPermaLink="false">8167@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;So, I've solved my problem ish. There were two issues:&#60;/p&#62;
&#60;p&#62;1.) I'm currently using k-wave 1.2, so can't account for the latest version, but in this version it appears that when using c++ or cuda the alpha_mode = 'no_dispersion' flag is ignored. This is the reason I was seeing things performing differently from my 1-D model, as I had been doing this using full Matlab mode. I'm not sure if this is a bug or not, and it might be fixed in version 1.3.&#60;/p&#62;
&#60;p&#62;2.) Setting alpha_power close to 1 was leading to the increase of wavelength. I'm still not sure why this is, maybe someone can shed some light on it. I changed this value back to 2 and no increase in wavelength occurs. Now this doesn't give me the correct attenuation I need, but as I'm using just a CW then I can easily adjust the alpha_coeff to give me what I want. However, if I was doing a broadband simulation this might be an issue.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>LewisR on "Attenuation measurement in 3D"</title>
			<link>http://www.k-wave.org/forum/topic/attenuation-measurement-in-3d#post-8165</link>
			<pubDate>Wed, 02 Jun 2021 18:33:01 +0000</pubDate>
			<dc:creator>LewisR</dc:creator>
			<guid isPermaLink="false">8165@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I'm currently trying to simulate the attenuation in a homogeneous medium (it happens to be bone) in 3D. My source is a simple disc lying centred in the one of the grid planes. I'm trying to confirm that I do indeed get the expected attenuation that I might expect from the values that apply to the medium. The properties are:&#60;/p&#62;
&#60;p&#62;medium.alpha_coeff    = 13.02;&#60;br /&#62;
medium.alpha_power    = 1.03;&#60;br /&#62;
medium.speed_of_sound = 3000;&#60;br /&#62;
medium.density        = 1850;&#60;/p&#62;
&#60;p&#62;The power is set to 1.03, as I want it to essentially be inversely linear with frequency, as a simple approximation.&#60;/p&#62;
&#60;p&#62;The simulation is being conducted with a CW of 0.5MHz. There is a PML of 10 pts and an alpha of 2 at each boundary. The grid spacing is 0.5mm in all dimensions, and the stepsize is 0.5e-8s.&#60;/p&#62;
&#60;p&#62;I take a measurement along the axial direction of the beam created by the disc, and either take RMS values of the last X cycles of the signal at each location, or the maximum value reached throughout the time series at each location. It's my understanding that once out of the near field, the wave along this axis will essentially be planar.&#60;/p&#62;
&#60;p&#62;I have already run 1D simulations of a similar scenario, and once turning dispersion off, saw the behaviour that I would expect. However, in 3D I just can't seem to get the attenuation as predicted (~6.5dB/cm @ 0.5MHz). In addition, I seem to see some odd effects. If the alpha_coeff is any value greater than zero, the wavelength of the CW seems to increase greater than I would expect. This I certainly did not expect and has confused me greatly. Interestingly, if I use the source.p0 approach then the delta function seems to decay as expected. In addition, when running the 3D model turning dispersion on or off makes no difference, unlike in the 1D case.&#60;/p&#62;
&#60;p&#62;Below I've include the 3D simulation code.&#60;/p&#62;
&#60;p&#62;Thanks in advance for any help,&#60;/p&#62;
&#60;p&#62;Regards,&#60;/p&#62;
&#60;p&#62;Lewis&#60;/p&#62;
&#60;p&#62;% --------------------------------------------------------------------&#60;/p&#62;
&#60;p&#62;clear;&#60;/p&#62;
&#60;p&#62;%% Define grid.&#60;/p&#62;
&#60;p&#62;Nx = 128;&#60;br /&#62;
Ny = 512;&#60;br /&#62;
Nz = 128;&#60;br /&#62;
dx = 0.5e-3;&#60;br /&#62;
dy = 0.5e-3;&#60;br /&#62;
dz = 0.5e-3;&#60;br /&#62;
kgrid = kWaveGrid(Nx,dx,Ny,dy,Nz,dz);&#60;br /&#62;
kgrid.dt  = 0.5e-8;&#60;br /&#62;
kgrid.Nt  = 5000;&#60;br /&#62;
pml_size  = [10 10 10];&#60;br /&#62;
pml_alpha = 2;&#60;/p&#62;
&#60;p&#62;%% Define medium.&#60;/p&#62;
&#60;p&#62;medium.alpha_coeff = ones(Nx,Ny,Nz)*13.02;&#60;br /&#62;
medium.alpha_power = 1.03;                  % Must be a scalar.&#60;br /&#62;
medium.sound_speed = ones(Nx,Ny,Nz)*3000;&#60;br /&#62;
medium.density     = ones(Nx,Ny,Nz)*1850;&#60;/p&#62;
&#60;p&#62;%% Define source.&#60;/p&#62;
&#60;p&#62;src_type = 'circ_piston';&#60;br /&#62;
source.p_mask = false(Nx,Ny,Nz);&#60;br /&#62;
switch src_type&#60;br /&#62;
    case 'monopole'&#60;br /&#62;
        source.p_mask(Nx/2,Ny/2,Nz/2) = true;&#60;br /&#62;
    case 'circ_piston'&#60;br /&#62;
        disc = makeDisc(Nx,Nz,0,0,Nx/4);&#60;br /&#62;
        source.p_mask(:,Ny/2,:) = disc;&#60;br /&#62;
end&#60;br /&#62;
src_freq_hz = 500000;&#60;br /&#62;
source.p = sin(2*pi*src_freq_hz*kgrid.t_array);&#60;/p&#62;
&#60;p&#62;%% Define Sensor positions.&#60;/p&#62;
&#60;p&#62;sensor.mask = false(Nx,Ny,Nz);&#60;br /&#62;
sensor.mask(:,:,Nz/2) = true;&#60;/p&#62;
&#60;p&#62;%% Run CUDA simulation.&#60;/p&#62;
&#60;p&#62;input_args = {...&#60;br /&#62;
    'PlotLayout',false,'PlotPML',false,...&#60;br /&#62;
    'PMLInside',true,'PMLSize',pml_size,'PMLAlpha',pml_alpha...&#60;br /&#62;
    'DataCast', 'single', 'CartInterp', 'nearest'};&#60;/p&#62;
&#60;p&#62;outputPath = fullfile(def_default_dir('kwave_data'),'kw_test');    % Will need to be changed.&#60;/p&#62;
&#60;p&#62;input_args  = [input_args ...&#60;br /&#62;
    {'SaveToDisk',outputPath}];&#60;br /&#62;
kspaceFirstOrder3D(kgrid,medium,source,sensor,input_args{:});&#60;/p&#62;
&#60;p&#62;cuda_input_args  = {...&#60;br /&#62;
    'BinaryPath' fullfile(def_default_dir('kwave_bin'),'cuda'),... % Will need to be changed.&#60;br /&#62;
    'DataPath'   def_default_dir('kwave_data'),...                 % Will need to be changed.&#60;br /&#62;
    'DataName'   'kw_test',...&#60;br /&#62;
    'DeleteData' false,...&#60;br /&#62;
    'PMLInside'  true,...&#60;br /&#62;
    'PMLSize'    pml_size,...&#60;br /&#62;
    'PMLAlpha'   pml_alpha,...&#60;br /&#62;
    'DataCast'   'single',...&#60;br /&#62;
    'CartInterp' 'nearest',...&#60;br /&#62;
    'BinaryName' 'kspaceFirstOrder3D-CUDA.exe',...&#60;br /&#62;
    'DeviceNum'  0};&#60;/p&#62;
&#60;p&#62;sensor_data = kspaceFirstOrder3DG(kgrid,medium,source,sensor,cuda_input_args{:});&#60;/p&#62;
&#60;p&#62;%% Plot results.&#60;/p&#62;
&#60;p&#62;% Get sensor pressure data from sim.&#60;br /&#62;
output_filename = fullfile(def_default_dir('kwave_data'),'kw_test_output.h5');&#60;br /&#62;
sensor_output = h5read(output_filename,'/p',[1 1 1],[inf inf inf]);&#60;br /&#62;
p = reshape(sensor_output,[Nx Ny kgrid.Nt]);&#60;br /&#62;
p_axial = squeeze(p(Nx/2,:,:));&#60;/p&#62;
&#60;p&#62;figure;&#60;br /&#62;
plot((1:Ny)*dy*1000,20*log10(max(p_axial,[],2)));&#60;br /&#62;
ylabel('spl (dB)')&#60;br /&#62;
xlabel('axial dist. (mm)')&#60;/p&#62;
&#60;p&#62;figure;&#60;br /&#62;
plot((1:Ny)*dy*1000,p_axial(:,end));&#60;br /&#62;
ylabel('amplitude')&#60;br /&#62;
xlabel('axial dist. (mm)')&#60;/p&#62;
&#60;p&#62;%% END.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
