<?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: Vastly different time of travel for the same model in 3D and 2D</title>
		<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 06:56:52 +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/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7708</link>
			<pubDate>Tue, 28 Jul 2020 08:50:26 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7708@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Denis,&#60;/p&#62;
&#60;p&#62;Sorry - I should have mentioned that the &#60;code&#62;no_dispersion&#60;/code&#62; option is not supported by the C++/CUDA code, and unfortunately it doesn't give a warning.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Denis on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7701</link>
			<pubDate>Tue, 21 Jul 2020 06:40:09 +0000</pubDate>
			<dc:creator>Denis</dc:creator>
			<guid isPermaLink="false">7701@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hey guys,&#60;/p&#62;
&#60;p&#62;I decided to paste this code in the forum.&#60;br /&#62;
I would be very happy if someone could help me out.&#60;/p&#62;
&#60;p&#62;This is the code:&#60;/p&#62;
&#60;p&#62;close all;&#60;br /&#62;
clearvars;&#60;br /&#62;
clc; &#60;/p&#62;
&#60;p&#62;%% Grid definition&#60;br /&#62;
% create the computational grid&#60;/p&#62;
&#60;p&#62;dx = 1e-4;             % [m/gridpoint]&#60;br /&#62;
dy = dx;               % [m/gridpoint]&#60;br /&#62;
dz = dx;               % [m/gridpoint]&#60;/p&#62;
&#60;p&#62;Nx = 500;    % [gridpoints]&#60;br /&#62;
Ny = 60;     % [gridpoints]&#60;/p&#62;
&#60;p&#62;PML_size            = 10;   % [grid points]&#60;/p&#62;
&#60;p&#62;kgrid2d               = kWaveGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;%% Sensor Definition&#60;br /&#62;
sensor2d.record = {'u_max_all','p_max', 'p_final','p','u','p_max_all','p_min_all'};&#60;br /&#62;
sensor2d.mask = logical(zeros(Nx,Ny));&#60;br /&#62;
sensor2d.mask(1,:) = 1;&#60;/p&#62;
&#60;p&#62;date = datestr(datetime('now'));&#60;/p&#62;
&#60;p&#62;% ABS&#60;br /&#62;
m1.cp = 2000;&#60;br /&#62;
m1.rho = 1000;&#60;br /&#62;
m1.ac = 2.6;&#60;/p&#62;
&#60;p&#62;% Water&#60;br /&#62;
m2.cp = 1500;&#60;br /&#62;
m2.rho = 1000;&#60;br /&#62;
m2.ac = 0.05;&#60;/p&#62;
&#60;p&#62;% Silicon -- unused&#60;br /&#62;
m3.cp = 1000;&#60;br /&#62;
m3.rho = 1200;&#60;br /&#62;
m3.ac = 3;&#60;/p&#62;
&#60;p&#62;%% Time definition&#60;br /&#62;
% create the time array&#60;br /&#62;
cfl                 = 0.1;&#60;br /&#62;
t_end               = 40e-6;&#60;br /&#62;
kgrid2d.makeTime(m1.cp, cfl, t_end);&#60;/p&#62;
&#60;p&#62;%% Medium definition&#60;/p&#62;
&#60;p&#62;mf2d.sound_speed                = m2.cp*ones(Nx, Ny);&#60;br /&#62;
mf2d.density                    = m2.rho*ones(Nx, Ny);&#60;br /&#62;
mf2d.alpha_coeff                = m2.ac*ones(Nx, Ny);&#60;br /&#62;
% Alpha Power&#60;br /&#62;
mf2d.alpha_power                = 2;&#60;/p&#62;
&#60;p&#62;mf2d.sound_speed(251:end,:)       = m1.cp;&#60;br /&#62;
mf2d.density(251:end,:)           = m1.rho;&#60;br /&#62;
mf2d.alpha_coeff(251:end,:)       = m1.ac;&#60;/p&#62;
&#60;p&#62;%% Source definition&#60;br /&#62;
source_freq         = 2000e3;    % [Hz]&#60;br /&#62;
source_strength     = 1e6;      % [Pa]&#60;br /&#62;
source_cycles       = 5;        % number of tone burst cycles&#60;br /&#62;
source2d.p_mask = logical(zeros(Nx,Ny));&#60;br /&#62;
source2d.p_mask(1,:) = 1;&#60;br /&#62;
source2d.p = source_strength*toneBurst(1/kgrid2d.dt, source_freq, source_cycles, 'Plot', false, 'Envelope', 'Rectangular');&#60;/p&#62;
&#60;p&#62;%% run the fluid simulation&#60;br /&#62;
input_args = {  'PMLSize', PML_size,'PlotLayout', true, 'PMLAlpha', 2, 'PlotPML', false, ...&#60;br /&#62;
                'PlotScale', [-0.5, 0.5]*source_strength , 'DataCast', 'gpuArray-single'...&#60;br /&#62;
                'PMLInside', false};&#60;br /&#62;
%% alpha_power = 2&#60;br /&#62;
sensor_data_fluid2d1 = kspaceFirstOrder2DG(kgrid2d, mf2d, source2d, sensor2d, input_args{:});&#60;/p&#62;
&#60;p&#62;%% alpha_power = 2 &#38;amp; 'no_dispersion'&#60;br /&#62;
mf2d.alpha_mode = 'no_absorption';&#60;br /&#62;
sensor_data_fluid2d2 = kspaceFirstOrder2DG(kgrid2d, mf2d, source2d, sensor2d, input_args{:});&#60;/p&#62;
&#60;p&#62;%% alpha_power = 1.01&#60;br /&#62;
clear mf2d&#60;br /&#62;
%% Correction of the absorption factors at frequency of sender for lower alpha_power&#60;br /&#62;
m1.ac = m1.ac*4;&#60;br /&#62;
m2.ac = m2.ac*4;&#60;br /&#62;
mf2d.sound_speed                = m2.cp*ones(Nx, Ny);&#60;br /&#62;
mf2d.density                    = m2.rho*ones(Nx, Ny);&#60;br /&#62;
mf2d.alpha_coeff                = m2.ac*ones(Nx, Ny);&#60;br /&#62;
mf2d.alpha_power                = 1.01;&#60;/p&#62;
&#60;p&#62;mf2d.sound_speed(251:end,:)   	= m1.cp;&#60;br /&#62;
mf2d.density(251:end,:)        	= m1.rho;&#60;br /&#62;
mf2d.alpha_coeff(251:end,:)    	= m1.ac;&#60;br /&#62;
sensor_data_fluid2d3 = kspaceFirstOrder2DG(kgrid2d, mf2d, source2d, sensor2d, input_args{:});&#60;/p&#62;
&#60;p&#62;%% alpha_power = 1.01 &#38;amp; 'no_dispersion'&#60;br /&#62;
mf2d.alpha_mode = 'no_absorption';&#60;br /&#62;
sensor_data_fluid2d4 = kspaceFirstOrder2DG(kgrid2d, mf2d, source2d, sensor2d, input_args{:});&#60;/p&#62;
&#60;p&#62;%% Visualization&#60;/p&#62;
&#60;p&#62;figure&#60;br /&#62;
y_vec = (kgrid2d.y_vec)*1e3;&#60;br /&#62;
x_vec = (kgrid2d.x_vec)*1e3;&#60;br /&#62;
t = [1:size(sensor_data_fluid2d1.p,2)]*kgrid2d.dt*1e6;&#60;br /&#62;
plot(t,mean(sensor_data_fluid2d1.p),t,0.1E6+mean(sensor_data_fluid2d2.p),...&#60;br /&#62;
    t,0.2E6+mean(sensor_data_fluid2d3.p),t,0.3E6+mean(sensor_data_fluid2d4.p))&#60;br /&#62;
xline((0.025/m2.cp*2)*1e6);&#60;br /&#62;
legend([&#34;alpha power = 2&#34; &#34;alpha power = 2 &#38;amp; 'no dispersion'&#34;...&#60;br /&#62;
    &#34;alpha power = 1.01&#34; &#34;alpha power = 1.01 &#38;amp; 'no dispersion'&#34; ...&#60;br /&#62;
    &#34;expected first echo&#34;]);&#60;/p&#62;
&#60;p&#62;This code runs 4 simulations of the same impuls echo setup with 25mm water and 25mm ABS. The main parameters are alpha_power and alpha_mode. If you try out the code, you will see that alpha_mode has no influence in this example and that alpha_power has a huge influence on the time of travel.&#60;/p&#62;
&#60;p&#62;I've seen the same effect in my other simulations and I am hard stuck, because I need proper results for time of travel and even the simplest examples like the one above yield wrong results. I am still hoping that it is a simple coding error of mine and not a limitation of k-wave.&#60;/p&#62;
&#60;p&#62;Best regards,&#60;br /&#62;
Denis
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Denis on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7696</link>
			<pubDate>Sun, 12 Jul 2020 10:01:33 +0000</pubDate>
			<dc:creator>Denis</dc:creator>
			<guid isPermaLink="false">7696@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I reuploaded the files because the upload onlz lasts 7 days.&#60;br /&#62;
This is the new code: 5f0ad218c873c
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Denis on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7691</link>
			<pubDate>Mon, 06 Jul 2020 14:55:42 +0000</pubDate>
			<dc:creator>Denis</dc:creator>
			<guid isPermaLink="false">7691@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;first of all, thanks for your reply.&#60;/p&#62;
&#60;p&#62;I see your point about the sound speed dispersion. In my simulations I am using a toneburst with 5 sinoid cycles and a rectangular envelope function. Therefore the frequency band of this source signal should be quite small. This would explain why I am getting the same results with a constant alpha_power and alpha_mode set to 'no_dispersion'.&#60;/p&#62;
&#60;p&#62;At this point I am using very simple model to verify the simulation. I've got an impulse-echo setup with water and a reflector. The source is also the sensor. When the alpha_power is set to 2, I get very close to the expected result. When I set alpha_power to 1.01 however, I get a signal that arrives a couple periods earlier - regardles of the alpha_mode parameter.&#60;/p&#62;
&#60;p&#62;I uploaded this example, so you can have a look at it. You can download it at this link:&#60;br /&#62;
&#60;a href=&#34;https://dateiaustausch.hs-merseburg.de/&#34; rel=&#34;nofollow&#34;&#62;https://dateiaustausch.hs-merseburg.de/&#60;/a&#62;&#60;br /&#62;
with this code:&#60;br /&#62;
5f032bf6c17fb&#60;/p&#62;
&#60;p&#62;Please have a look at the code. &#60;/p&#62;
&#60;p&#62;Sincerely,&#60;br /&#62;
Denis
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7689</link>
			<pubDate>Sat, 04 Jul 2020 13:36:58 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7689@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Denis,&#60;/p&#62;
&#60;p&#62;This is expected behaviour due to the dispersion relation on which k-Wave is based. The link between the sound speed dispersion (dependence on frequency) and absorption comes from the Kramers-Kronig relations. If you want to turn off the dispersion, you can do this (to first order) by setting &#60;code&#62;medium.alpha_mode = &#38;#39;no_dispersion&#38;#39;&#60;/code&#62;. If you have the power law exponent set to 2, there won't be much dispersion. For values close to 1, there will be a lot.&#60;/p&#62;
&#60;p&#62;For your second point, yes, there is no way to have more than one power law exponent due to the way the absorption values are calculated in k-Wave. However, you can perturb the &#60;code&#62;alpha_coeff&#60;/code&#62; values to give you the desired absorption at a particular reference frequency. This works well when you have relatively narrow band sources. You can use the additional function &#60;a href=&#34;http://www.k-wave.org/downloads/fitPowerLawParamsMulti.m&#34;&#62;fitPowerLawParamsMulti.m&#60;/a&#62; to do the perturbation for you.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Denis on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7675</link>
			<pubDate>Mon, 29 Jun 2020 09:26:33 +0000</pubDate>
			<dc:creator>Denis</dc:creator>
			<guid isPermaLink="false">7675@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;I think I figured out the cause of my problem. &#60;/p&#62;
&#60;p&#62;I overlooked one significant difference between my scripts. Although the 2d and 3d mediums were nearly identical, the alpha_power value was 1.01 and 2. This value has a huge effect on the travel time that I am measuring. &#60;/p&#62;
&#60;p&#62;I don't know why the absoroption would have this effect. Furthermore there is no way that I know of to set multiple alpha_power values for my materials which behave quite differently in terms of absorption. That means that I have to model the power law acoustic absorption for my different materials with the same alpha_power value. Therefore I am not able to model their proper behaviour and will always have quite big errors on the travel time that I measure.&#60;/p&#62;
&#60;p&#62;I hope that you can help me out.&#60;/p&#62;
&#60;p&#62;Sincecerly,&#60;br /&#62;
Denis
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Denis on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7674</link>
			<pubDate>Sun, 28 Jun 2020 17:10:24 +0000</pubDate>
			<dc:creator>Denis</dc:creator>
			<guid isPermaLink="false">7674@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Ok, i've tried this one too and the results are still the same.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7667</link>
			<pubDate>Sat, 27 Jun 2020 18:04:59 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7667@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;You will need to replicate the 2D plane across the entire z dimension.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Denis on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7666</link>
			<pubDate>Sat, 27 Jun 2020 17:16:26 +0000</pubDate>
			<dc:creator>Denis</dc:creator>
			<guid isPermaLink="false">7666@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hey Brad,&#60;/p&#62;
&#60;p&#62;I have tried running the 3D Sim with two stacked 2D planes. The result is the same faster travel times with the 3d sim than with the 2D sim.&#60;/p&#62;
&#60;p&#62;I don't know whats wrong... &#60;/p&#62;
&#60;p&#62;Sincecerly,&#60;br /&#62;
Denis
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7663</link>
			<pubDate>Sat, 27 Jun 2020 14:06:01 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7663@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Denis,&#60;/p&#62;
&#60;p&#62;Modelling sound speeds between 1000 and 3000 shouldn't be a problem for k-Wave. &#60;/p&#62;
&#60;p&#62;One thing to try would be to replicate your 2D geometry in 3D and check the results are the same. In other words, stack up the 2D geometry in the 3D direction. (If you extend the geometry to the edge and turn off the PML in that direction, if all other settings are the same the results will agree to machine precision, although you likely don't need to take it that far.) Once you have the 2D and 3D simulations agreeing, you can gradually add back in aspects of the geometry to find the reason for the different time of arrival.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Denis on "Vastly different time of travel for the same model in 3D and 2D"</title>
			<link>http://www.k-wave.org/forum/topic/vastly-different-time-of-travel-for-the-same-model-in-3d-and-2d#post-7638</link>
			<pubDate>Wed, 24 Jun 2020 13:24:18 +0000</pubDate>
			<dc:creator>Denis</dc:creator>
			<guid isPermaLink="false">7638@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Bradley,&#60;/p&#62;
&#60;p&#62;I am currently simulating a whole ultrasound sensor assembly. I have got a 3D model of the whole assembly, that I voxelize and then generate the &#34;medium&#34; grid, with the appropriate material Values (sos, density, absoroption coefficient and so on). I then use the kspaceFirstOrder3D function to do the 3D Simulation. For performance reasons I also slice the voxellated model and simulate the cross-section with kspaceFirstOrder2D. As far as I can trust my code, I am applying the identical material properties to both mediums and I also trust my other conditions to be the same. The cross-section is the most important plane and I would expect that the simulaiton result should only be marginally different between the 2D and the 3D simulation.&#60;/p&#62;
&#60;p&#62;When I evaluate the travel time between my transducer and my sensor, then the time varies vastly between those 2 simulations. In the video that I record I can also see that the wavelength in some parts of my model is higher in the 3D sim than in the 2D sim. It's almost as if I programmed higher sos values. I made sure to double check that though.&#60;/p&#62;
&#60;p&#62;That said, I am using materials whose SOS varies between 1000 and 3000 m/s. As far as I understand, this toolbox was not designed for that usecase.&#60;/p&#62;
&#60;p&#62;I have also tried running both the matlab and the c++ implemantation of the code but both yield the same results.&#60;/p&#62;
&#60;p&#62;I am uploading the videos, the sos and density plots of the mediums, so you can have a look. You can download the files at this link: &#60;a href=&#34;https://dateiaustausch.hs-merseburg.de/&#34; rel=&#34;nofollow&#34;&#62;https://dateiaustausch.hs-merseburg.de/&#60;/a&#62;&#60;br /&#62;
with this code: 5ef344f66ec84 &#60;/p&#62;
&#60;p&#62;I would be very happy if you or somebody else can help me out.&#60;/p&#62;
&#60;p&#62;Sincerely,&#60;br /&#62;
Denis
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
