<?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: Elseliv</title>
		<link><a href='http://www.k-wave.org/forum/profile/elseliv'>elseliv</a></link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 03:48:29 +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>HD Y on "Grid size and magnitude of pressure"</title>
			<link>http://www.k-wave.org/forum/topic/grid-size-and-magnitude-of-pressure#post-9187</link>
			<pubDate>Wed, 19 Feb 2025 23:18:09 +0000</pubDate>
			<dc:creator>HD Y</dc:creator>
			<guid isPermaLink="false">9187@http://www.k-wave.org/forum/</guid>
			<description>&#60;br /&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Validation of the tissue velocity recorded by sensor"</title>
			<link>http://www.k-wave.org/forum/topic/validation-of-the-tissue-velocity-recorded-by-sensor#post-8125</link>
			<pubDate>Mon, 19 Apr 2021 13:46:57 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8125@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Ekaterina,&#60;/p&#62;
&#60;p&#62;I couldn't view the image, however, if you experience an instability you could try reducing the time step size.&#60;/p&#62;
&#60;p&#62;On the topic of reflections, I'm not sure these will match any physically realistic scenario, as you are imposing a time-varying boundary condition, thus the reflections will depend on the values for the velocity that you are imposing at each time step in the simulation.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Elseliv on "Validation of the tissue velocity recorded by sensor"</title>
			<link>http://www.k-wave.org/forum/topic/validation-of-the-tissue-velocity-recorded-by-sensor#post-8108</link>
			<pubDate>Thu, 25 Mar 2021 19:13:33 +0000</pubDate>
			<dc:creator>Elseliv</dc:creator>
			<guid isPermaLink="false">8108@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I actually tried using the Dirichlet condition but this brought instability and the simulation got totally crashed. Here is a link with 2 plots for Dirichlet and NoDirichlet cases &#60;a href=&#34;https://we.tl/t-Dft5lKj5vd&#34; rel=&#34;nofollow&#34;&#62;https://we.tl/t-Dft5lKj5vd&#60;/a&#62; and it depicts in the top row - source velocities as I imposed them and on the 2-nd and 3-d rows - velocities measure by the sensor exactly next to the source. Could you then assume what might be a reason for such a crash?&#60;br /&#62;
Concerning reflections, the source I use is located at the boundary between tissue and water so reflections are expected to happen anyway.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Validation of the tissue velocity recorded by sensor"</title>
			<link>http://www.k-wave.org/forum/topic/validation-of-the-tissue-velocity-recorded-by-sensor#post-8106</link>
			<pubDate>Thu, 25 Mar 2021 17:52:22 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8106@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Ekaterina,&#60;/p&#62;
&#60;p&#62;By default, a velocity source is a force source. It will inject or &#34;add&#34; to the field that is already there, and thus the actual velocity will be higher than the velocity you specify. If you want the source to act like a boundary condition (exactly impose the values you specify), then you can set &#60;code&#62;source.u_mode = &#38;#39;dirichlet&#38;#39;&#60;/code&#62;. Keep in mind that in this case, the imposed boundary condition will also reflect any ways coming back to the source.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Elseliv on "Validation of the tissue velocity recorded by sensor"</title>
			<link>http://www.k-wave.org/forum/topic/validation-of-the-tissue-velocity-recorded-by-sensor#post-8091</link>
			<pubDate>Wed, 24 Mar 2021 01:32:51 +0000</pubDate>
			<dc:creator>Elseliv</dc:creator>
			<guid isPermaLink="false">8091@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello Dr.Treeby,&#60;/p&#62;
&#60;p&#62;Thank you for the great toolbox!&#60;/p&#62;
&#60;p&#62;I`m doing shear wave simulation in a thin tissue layer using pstdElastic2D. As a source.ux, I use a line where each element imposes one cycle of a sine wave with a frequency of 50 Hz and max amplitude of 0.03 m/s. Then I record u_split_field with a line of sensors perpendicular to the source line and get values significantly higher (sensor_data.ux_split_s ~ 0.1 m/s sensor_data.uy_split_s ~ 0.5 m/s), than those imposed by source. Even for the sensors placed tight to the source.&#60;/p&#62;
&#60;p&#62;What could become a reason for differences in the velocities imposed and observed? Is there a way to validate the magnitude of output data? May there be a problem with output units or something else?  &#60;/p&#62;
&#60;p&#62;Best regards,&#60;br /&#62;
Ekaterina
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Want to run a program on a GPU"</title>
			<link>http://www.k-wave.org/forum/topic/want-to-run-a-program-on-a-gpu#post-7449</link>
			<pubDate>Fri, 01 May 2020 08:14:35 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7449@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Jack,&#60;/p&#62;
&#60;p&#62;Open the MATLAB help browser and have a look at the examples under the &#34;Using the C++ code&#34; heading.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jackYANG on "Want to run a program on a GPU"</title>
			<link>http://www.k-wave.org/forum/topic/want-to-run-a-program-on-a-gpu#post-7446</link>
			<pubDate>Thu, 30 Apr 2020 04:04:26 +0000</pubDate>
			<dc:creator>jackYANG</dc:creator>
			<guid isPermaLink="false">7446@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello everyone, since my simulation model is relatively large, it takes a long time to run on the CPU, now I want to switch to running on the GPU.Can someone tell me in detail how my kspaceFirstOrder3D program works on a GPU.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rainbowwhale on "Grid size and magnitude of pressure"</title>
			<link>http://www.k-wave.org/forum/topic/grid-size-and-magnitude-of-pressure#post-7389</link>
			<pubDate>Mon, 13 Apr 2020 10:25:44 +0000</pubDate>
			<dc:creator>rainbowwhale</dc:creator>
			<guid isPermaLink="false">7389@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thank you for kind answer.&#60;br /&#62;
I may confused between Pressure and power.&#60;br /&#62;
I'll tried to integrate the power and make comparisons.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "Grid size and magnitude of pressure"</title>
			<link>http://www.k-wave.org/forum/topic/grid-size-and-magnitude-of-pressure#post-7381</link>
			<pubDate>Fri, 10 Apr 2020 10:52:42 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">7381@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi rainbowwhale,&#60;/p&#62;
&#60;p&#62;Yes, you will see a change in the amplitude for a couple of reasons. The most obvious is that you are inputting the source on more grid points per unit length so the amplitude will be correspondingly higher. (Think of the sources as point sources on a collection of grid points, not sources filling voxels ie. not spread continuously over an area.) The second is that the grid can support higher frequencies as you reduce the grid spacing, and as your &#60;code&#62;source.p&#60;/code&#62; signal contains a broad range of frequencies, more of the higher frequencies will be propagated in the grids with smaller grid spacing&#60;code&#62;dG&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;Final point. You're currently changing the size of the sensor and the source simultaneously. It might be worth investigating the size of the source with the sensor as a single grid point, and then subsequently to investigate the effect of having a larger sensor area.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rainbowwhale on "Grid size and magnitude of pressure"</title>
			<link>http://www.k-wave.org/forum/topic/grid-size-and-magnitude-of-pressure#post-7340</link>
			<pubDate>Wed, 01 Apr 2020 07:30:03 +0000</pubDate>
			<dc:creator>rainbowwhale</dc:creator>
			<guid isPermaLink="false">7340@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi&#60;br /&#62;
I'm new to k-Wave and have a question about grid size&#60;/p&#62;
&#60;p&#62;I made a source shaped in square with same size for different grid size.&#60;br /&#62;
I thought all cases have same area of source and result in same pressure magnitude&#60;br /&#62;
but small grid case which have more grid cells in source showed higher pressure.&#60;br /&#62;
Magnitude of pressure is proportional to the number of grid per length (not area!)&#60;br /&#62;
and thus increased linearly with respect to sqrt(number of grid in source area).&#60;/p&#62;
&#60;p&#62;I have tried to use 'dirichlet' type source but showed same results.&#60;br /&#62;
--&#38;gt; There was an typo and with a correct command, 'dirichlet' type worked.&#60;/p&#62;
&#60;p&#62;I'll appreciate your kind advises.&#60;br /&#62;
Thank you&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
clearvars&#60;br /&#62;
clc&#60;/p&#62;
&#60;p&#62;PML_Size = 20;&#60;br /&#62;
PML_Alpha = 2;&#60;br /&#62;
input_args = {'PMLSize', PML_Size, 'PMLInside', true, 'PMLAlpha', PML_Alpha};&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
CFL = 0.15;&#60;br /&#62;
dG = 0.01*1e-3; % reference grid size&#60;br /&#62;
dt = CFL*dG/1500;&#60;br /&#62;
Nt = 5000;&#60;br /&#62;
Nx = 512;&#60;br /&#62;
Nz = 512;&#60;/p&#62;
&#60;p&#62;pulse_Rect = conv(ones(1, ceil(40e-9/dt)), ones(1,7)/7);&#60;br /&#62;
Tx_Rect = [pulse_Rect, zeros(1, Nt - length(pulse_Rect))];&#60;/p&#62;
&#60;p&#62;medium.sound_speed = 1500;&#60;br /&#62;
medium.density = 1000;&#60;/p&#62;
&#60;p&#62;% number of grid per source (and sensor)&#60;br /&#62;
NG = [2, 4, 8, 16, 32, 64];&#60;/p&#62;
&#60;p&#62;results = zeros(Nt, length(NG));&#60;br /&#62;
for k=1:length(NG)&#60;br /&#62;
    dG = 0.16*1e-3/NG(k);&#60;br /&#62;
    kgrid = kWaveGrid(Nx, dG, Nz, dG);&#60;br /&#62;
    kgrid.dt = dt;&#60;br /&#62;
    kgrid.Nt = Nt;&#60;br /&#62;
    kgrid.t_array = (0:kgrid.Nt-1)*dt;&#60;/p&#62;
&#60;p&#62;    %source.p_mode = 'dirichlet';&#60;br /&#62;
    source.p_mask = zeros(Nx, Nz);&#60;br /&#62;
    source.p_mask((1:NG(k)) - 0.5*NG(k) + Nx/2, (1:NG(k)) - 0.5*NG(k) + Nz/2 - 3*NG(k)) = 1;&#60;br /&#62;
    source.p = Tx_Rect;&#60;/p&#62;
&#60;p&#62;    sensor.mask = zeros(Nx, Nz);&#60;br /&#62;
    sensor.mask((1:NG(k)) - 0.5*NG(k) + Nx/2, (1:NG(k)) - 0.5*NG(k) + Nz/2 + 3*NG(k)) = 1;&#60;/p&#62;
&#60;p&#62;    subplot(2, length(NG)+1, k)&#60;br /&#62;
    imagesc(kgrid.x_vec, kgrid.y_vec, (source.p_mask-sensor.mask))&#60;br /&#62;
    axis image&#60;br /&#62;
    xlim([-1, 1]*0.9*1e-3)&#60;br /&#62;
    ylim([-1, 1]*0.9*1e-3)&#60;br /&#62;
    subplot(2, length(NG)+1, k + length(NG)+1)&#60;br /&#62;
    imagesc(kgrid.x_vec, kgrid.y_vec, (source.p_mask-sensor.mask))&#60;br /&#62;
    axis image&#60;br /&#62;
    drawnow&#60;/p&#62;
&#60;p&#62;    data = kspaceFirstOrder2DG(kgrid, medium, source, sensor, input_args{:});&#60;br /&#62;
    results(:,k) = mean(data, 1)';&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;subplot(2, length(NG)+1, length(NG) + 1)&#60;br /&#62;
plot(results)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Dirichlet condition doesnt work as expected"</title>
			<link>http://www.k-wave.org/forum/topic/dirichlet-condition-doesnt-work-as-expected#post-7212</link>
			<pubDate>Tue, 11 Feb 2020 12:00:44 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7212@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi grabka,&#60;/p&#62;
&#60;p&#62;I haven't quite managed to get to the bottom of your problem yet. First, I don't think you're plotting the same point. So I changed &#60;code&#62;sensor.mask = source.u_mask;&#60;/code&#62; and then plotted&#60;/p&#62;
&#60;p&#62;&#60;code&#62;plot(kgrid.t_array, sensor_data.uz(1,:), kgrid.t_array, source.uz(1,:))&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;If you set the shear sound speed to zero, everything works as expected. However, when the shear speed is non-zero, the input and output don't agree. I'll keep digging and come back to you. &#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>grabka on "Dirichlet condition doesnt work as expected"</title>
			<link>http://www.k-wave.org/forum/topic/dirichlet-condition-doesnt-work-as-expected#post-7133</link>
			<pubDate>Thu, 21 Nov 2019 23:31:11 +0000</pubDate>
			<dc:creator>grabka</dc:creator>
			<guid isPermaLink="false">7133@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello.&#60;br /&#62;
I have set up a simulation with homogeneous viscoelastic material and excite by a Velocity Gauss impulse in the middle. I have noticed that the velocities at the source positions are not equal to the defined ones, although I have defined dirichlet conditions.  Why is that?&#60;/p&#62;
&#60;p&#62;In the manual it states: ‘dirichlet’: at each time step, the input pressure and velocity values are used to replace the existing values&#60;/p&#62;
&#60;p&#62;Here my code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;%% variables
f_max = 300; %[Hz]
%%  create the computational grid
spacing = 5e-3;
x_size = 0.15;            %[m] total size x-direction
y_size = 0.15;            %[m] total size y-direction
z_size = 0.014;           %[m] total size z-direction
dx = spacing;             % grid point spacing in the x direction [m]
dy = spacing;             % grid point spacing in the y direction [m]
dz = spacing;             % grid point spacing in the z direction [m]
Nx = ceil(x_size/dx)+2;   % number of grid points in the x direction
Ny = ceil(y_size/dy)+2;   % number of grid points in the y direction
Nz = ceil(z_size/dz)+2    % number of grid points in the z direction
disp(&#38;#39;Number of grid points: &#38;#39;); disp(Nx*Ny*Nz);
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);
%% simulation time and step size
dt = 0.1 * spacing / 1440.3;    % CFL*dx/c_max CFL 0.3 default
t_end = 0.5/300;                % [s]
kgrid.t_array = 0:dt:t_end;
%% define the properties of the propagation medium
medium.sound_speed_compression = ones(Nx,Ny,Nz) * 1440.3;    % [m/s]
medium.sound_speed_shear = ones(Nx,Ny,Nz) * 201.74;          % [m/s]
medium.alpha_coeff_compression = ones(Nx,Ny,Nz) * 0.5;       % [10–3 m–1]
medium.alpha_coeff_shear = ones(Nx,Ny,Nz) * 0.5;             % [10–3 m–1]
medium.density = ones(Nx,Ny,Nz) * 923.47;                    % [kg/m^3]
%% define the source
% define a square source element
source_radius = 0.005/dx;  % [grid points]
source.u_mask = zeros(Nx,Ny,Nz);
source.u_mask(Nx/2 - source_radius:Nx/2 + source_radius, Ny/2 - source_radius:Ny/2 + source_radius, Nz) = 1;
nbr_of_sources = sum(source.u_mask,&#38;quot;all&#38;quot;);
% define a gaussian impulse
pos = gaussmf(kgrid.t_array, [t_end/20 t_end/6]);
vel_gaussian = [0 diff(pos)/dt];
source.uz = repelem(vel_gaussian,nbr_of_sources, 1);
source.u_mode= &#38;#39;dirichlet&#38;#39;;
%% define sensor
sensor.mask = ones(Nx, Ny, Nz);
%% run the simulation
sensor.record = {&#38;#39;u&#38;#39;} % u particle velocity
PML_size=5;             % size of the PML in grid points
input_args = {&#38;#39;PMLSize&#38;#39;, PML_size, &#38;#39;PlotPML&#38;#39;, true, &#38;#39;PMLInside&#38;#39;, false};
sensor_data = pstdElastic3D(kgrid, medium, source, sensor, input_args{:});&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;plotting the input vs ouput at sensor position gives different plots:&#60;br /&#62;
plot(kgrid.t_array, sensor_data.uz(4659,:), kgrid.t_array, source.uz(1,:))
&#60;/p&#62;</description>
		</item>
		<item>
			<title>genny_p on "Instability in shear wave absorption simulation"</title>
			<link>http://www.k-wave.org/forum/topic/instability-in-shear-wave-absorption-simulation#post-6939</link>
			<pubDate>Fri, 28 Jun 2019 11:07:46 +0000</pubDate>
			<dc:creator>genny_p</dc:creator>
			<guid isPermaLink="false">6939@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;br /&#62;
Thanks for the suggestion. The simulation seems to actually only be stable with longer time steps (sparser grid spacing and higher CFL number) and when I decrease the time step then the simulation becomes unstable (you can see this by changing the factors in the sample code I provided). I take it then this is not a result of a numerical instability. What other types of instabilities could be possible?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Genny
&#60;/p&#62;</description>
		</item>
		<item>
			<title>xurui on "When will be released C++/CUDA GPU Simulation Codes?"</title>
			<link>http://www.k-wave.org/forum/topic/when-will-be-released-ccuda-gpu-simulation-codes#post-6934</link>
			<pubDate>Thu, 27 Jun 2019 14:59:49 +0000</pubDate>
			<dc:creator>xurui</dc:creator>
			<guid isPermaLink="false">6934@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;Thanks, I'm looking forward to it. I'll content myself with the Matlab version for now.&#60;/p&#62;
&#60;p&#62;Cheers,&#60;br /&#62;
Rui.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "When will be released C++/CUDA GPU Simulation Codes?"</title>
			<link>http://www.k-wave.org/forum/topic/when-will-be-released-ccuda-gpu-simulation-codes#post-6900</link>
			<pubDate>Sat, 22 Jun 2019 20:56:27 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6900@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Rui,&#60;/p&#62;
&#60;p&#62;This code is in a relatively stable beta, but won't be part of the upcoming V1.3 release. We hope to have it out later this year.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Instability in shear wave absorption simulation"</title>
			<link>http://www.k-wave.org/forum/topic/instability-in-shear-wave-absorption-simulation#post-6894</link>
			<pubDate>Sat, 22 Jun 2019 20:18:49 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6894@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Genny,&#60;/p&#62;
&#60;p&#62;For the shear code, we don't have an out of the box function to test for stability with an absorbing medium. For the fluid code, we have an approximate way of checking for the stable time step size (see the &#60;code&#62;checkStability&#60;/code&#62; function). It might be possible to find a relationship for the elastic code, but I haven't looked at it. If it is a numerical instability, then keep making the CFL smaller, it should eventually work. Let me know if it doesn't.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>xurui on "When will be released C++/CUDA GPU Simulation Codes?"</title>
			<link>http://www.k-wave.org/forum/topic/when-will-be-released-ccuda-gpu-simulation-codes#post-6864</link>
			<pubDate>Wed, 29 May 2019 16:03:43 +0000</pubDate>
			<dc:creator>xurui</dc:creator>
			<guid isPermaLink="false">6864@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;Will the GPU-accelerated 3D elastic wave propagation code (presented last year at the 2018 International Conference on High Performance Computing &#38;amp; Simulation) be released to the masses anytime soon?&#60;/p&#62;
&#60;p&#62;Cheers,&#60;br /&#62;
Rui.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>genny_p on "Instability in shear wave absorption simulation"</title>
			<link>http://www.k-wave.org/forum/topic/instability-in-shear-wave-absorption-simulation#post-6851</link>
			<pubDate>Wed, 15 May 2019 12:05:54 +0000</pubDate>
			<dc:creator>genny_p</dc:creator>
			<guid isPermaLink="false">6851@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad, Ben, and the k-Wave community,&#60;/p&#62;
&#60;p&#62;As I mentioned at Photonics West, I am applying k-Wave to model scattering of planar shear waves in heterogeneous tissue, and so far the toolbox has been very easy to use and is working quite well for elastic scattering problems. I recently started trying to model shear wave absorption using the medium.alpha_coeff_shear factor to account for viscoelasticity. The results look quite reasonable for certain cases, but when I increase the absorption factor enough, the result seems to become unstable. I am using a value on the order of 3e6 dB/(MHz^2 cm), since this is around what we measure for shear wave absorption in tissue-mimicking phantoms with wave frequency on the order of 600 Hz, i.e. 1.08 dB/cm. You can see the instability forming in the example code below, where the edges of the plane wave start to increase with an amplitude much larger than the initial wave amplitude. &#60;/p&#62;
&#60;p&#62;I saw in the Modelling Power Law Absorption Example that you discuss numerical errors (&#60;a href=&#34;http://www.k-wave.org/documentation/example_na_modelling_absorption.php#heading3)&#34; rel=&#34;nofollow&#34;&#62;http://www.k-wave.org/documentation/example_na_modelling_absorption.php#heading3)&#60;/a&#62;, but there it is mentioned that the errors can be minimized by reducing the time step. I found the instability I see seems to worsen with a decreased time step (which I implemented by reducing the CFL number). The instability is also worse when I reduce the grid spacing (which in turn also reduced the time step). &#60;/p&#62;
&#60;p&#62;See the comments in my code below for the factors that influence the instability that I investigated. All the parameters used in the example code are typical for our experiments, except maybe the inital velocity u_0, but there doesn't seem to be any dependence of the instability on this value. This leads me to the following questions:&#60;/p&#62;
&#60;p&#62;1. Is this instability related to the numerical errors discussed in the Modelling Power Law Absorption Example?&#60;br /&#62;
2. Is there some relationship that tells me for which conditions (up to which absorption) the code works for before becoming unstable?&#60;br /&#62;
3. If I have a result that appears stable (i.e. with a low enough medium.alpha_coeff_shear value), how can I check whether the results are reliable, since when I decrease the grid size to check convergence the simulation then blows up?&#60;/p&#62;
&#60;p&#62;I would be grateful if someone had any insight to any of these questions.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Genny&#60;/p&#62;
&#60;p&#62;% -------------------------------------------------------------------------------------&#60;br /&#62;
% Modified from Shear Waves And Critical Angle Reflection Example&#60;br /&#62;
% Simplified code that shows instability during absorption of planar shear wave&#60;br /&#62;
% Heterogeneities removed to focus on instability&#60;br /&#62;
% Grid size cropped for quicker simulation&#60;br /&#62;
% The parameters coded below result in an amplitude that appears to blow up&#60;br /&#62;
% May 2019&#60;br /&#62;
%&#60;br /&#62;
% If one of the factors is changed to as decribed below (with all other parameters constant):&#60;br /&#62;
% * decreasing alpha0_s1 to 2e6 the solution appears stable&#60;br /&#62;
% * increasing alpha0_s1 to 4e6 the solution blows up more&#60;br /&#62;
% * increasing t_end to 5000 the solution blows up more&#60;br /&#62;
% * decreasing t_end to 2000 the solution appears stable&#60;br /&#62;
% * decreasing cfl to 0.1 (decreases dt by a factor of 2) the solution blows up more&#60;br /&#62;
% * increasing scale to 1.25 (decreases dx &#38;amp; dt by a factor of 0.8) the solution blows up much more&#60;br /&#62;
% * decreasing scale to 0.75 (increases dx &#38;amp; dt by a factor of 1.3) the solution appears stable&#60;br /&#62;
% * increasing cp1 to 3000 (decreases dt by a factor of 2) the solution blows up more&#60;br /&#62;
% * decreasing cp1 to  750 (increases dt by a factor of 2) the solution appears stable&#60;br /&#62;
% * increasing cs1 to 4.5 the solution blows up more&#60;br /&#62;
% * decreasing cs1 to 3.5 the solution appears stable&#60;br /&#62;
% * instability appears insensitive to frequency (300-1800 Hz tested)&#60;br /&#62;
% * instability appears insensitive to u_0 (0.5 to 1000 tested)&#60;/p&#62;
&#60;p&#62;close all&#60;br /&#62;
clearvars &#60;/p&#62;
&#60;p&#62;% define the medium properties for the outise material&#60;br /&#62;
cp1                 = 1500;   % compressional wave speed [m/s]&#60;br /&#62;
cs1                 = 4.35;   % shear wave speed [m/s]&#60;br /&#62;
rho1                = 1000;   % density [kg/m^3]&#60;br /&#62;
alpha0_p1           = 0;      % compressional absorption [dB/(MHz^2 cm)]&#60;br /&#62;
alpha0_s1           = 3e6;    % shear absorption [dB/(MHz^2 cm)] (measured approx 1.08 dB/cm at 600 Hz)&#60;/p&#62;
&#60;p&#62;% create the computational grid&#60;br /&#62;
scale               = 1;               % grid spacing factor&#60;br /&#62;
PML_size            = 10;              % [grid points]&#60;br /&#62;
Nx                  = 40*scale ;       % [grid points]&#60;br /&#62;
Ny                  = 20*scale ;       % [grid points]&#60;br /&#62;
dx                  = 0.4e-3/scale;    % [m]&#60;br /&#62;
dy                  = 0.4e-3/scale;    % [m]&#60;br /&#62;
kgrid               = kWaveGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;% create the time array to run until wave passes through entire grid&#60;br /&#62;
cfl                 = 0.2;&#60;br /&#62;
t_end               = 4500*1e-6;&#60;br /&#62;
kgrid.makeTime(max([cp1 cs1]), cfl, t_end);&#60;/p&#62;
&#60;p&#62;% define the source&#60;br /&#62;
source_freq         = 600;      % [Hz]&#60;br /&#62;
u_0                 = 500;      % initial velocity&#60;br /&#62;
source_mask         = zeros(Nx, Ny);&#60;br /&#62;
source_mask(:,1)    = 1;&#60;br /&#62;
source.u_mask       = source_mask;&#60;br /&#62;
source.ux           = u_0 * sin(2 * pi * source_freq * kgrid.t_array);&#60;br /&#62;
source.uy           =   0 * sin(2 * pi * source_freq * kgrid.t_array);&#60;/p&#62;
&#60;p&#62;% define sensor&#60;br /&#62;
sensor.record = {'u_max_all','u_min_all','u_final'};&#60;/p&#62;
&#60;p&#62;% define the medium properties&#60;br /&#62;
clear medium&#60;br /&#62;
medium.sound_speed_compression            = cp1*ones(Nx, Ny);&#60;br /&#62;
medium.sound_speed_shear                  = cs1*ones(Nx, Ny);&#60;br /&#62;
medium.density                            = rho1*ones(Nx, Ny);&#60;br /&#62;
medium.alpha_coeff_compression            = alpha0_p1*ones(Nx, Ny);&#60;br /&#62;
medium.alpha_coeff_shear                  = alpha0_s1*ones(Nx, Ny);&#60;/p&#62;
&#60;p&#62;% set the input arguments&#60;br /&#62;
input_args = {'PMLSize', PML_size, 'PMLAlpha', 2, 'PlotPML', false, ...&#60;br /&#62;
    'PMLInside', false, 'PlotScale', 'auto', ...&#60;br /&#62;
    'DataCast', 'single'};&#60;/p&#62;
&#60;p&#62;% run the elastic simulation&#60;br /&#62;
sensor_data_elastic = pstdElastic2D(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;% visualization&#60;/p&#62;
&#60;p&#62;ui = u_0*cp1/cs1;  % initial velocity&#60;/p&#62;
&#60;p&#62;figure(1)&#60;br /&#62;
subplot(2,2,1);&#60;br /&#62;
    imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, sensor_data_elastic.ux_max_all/ui); caxis([0 1.5])&#60;br /&#62;
    xlabel('y mm');ylabel('x mm');axis image;h = colorbar;ylabel(h, 'Normalized u_x');title('ux max all')&#60;br /&#62;
subplot(2,2,2);&#60;br /&#62;
    imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, sensor_data_elastic.ux_final/ui); caxis([-1.5 1.5])&#60;br /&#62;
    xlabel('y mm');ylabel('x mm');axis image;h = colorbar;ylabel(h, 'Normalized u_x');title('ux final')&#60;br /&#62;
subplot(2,2,3);&#60;br /&#62;
    imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, sensor_data_elastic.uy_max_all/ui); caxis([0 1.5])&#60;br /&#62;
    xlabel('y mm');ylabel('x mm');axis image;h = colorbar;ylabel(h, 'Normalized u_y');title('uy max all')&#60;br /&#62;
subplot(2,2,4);&#60;br /&#62;
    imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, sensor_data_elastic.uy_final/ui); caxis([-1.5 1.5])&#60;br /&#62;
    xlabel('y mm');ylabel('x mm');axis image;h = colorbar;ylabel(h, 'Normalized u_y');title('uy final')
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alexll7 on "Multi-GPU fluid version and Elastic GPU version"</title>
			<link>http://www.k-wave.org/forum/topic/multi-gpu-fluid-version-and-elastic-gpu-version#post-6591</link>
			<pubDate>Thu, 04 Oct 2018 14:55:23 +0000</pubDate>
			<dc:creator>Alexll7</dc:creator>
			<guid isPermaLink="false">6591@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Bradley,&#60;/p&#62;
&#60;p&#62;Thank you for your answer and the excellent work that you're doing for K_Wave. I hope these codes will come out soon.&#60;br /&#62;
Best regards,&#60;/p&#62;
&#60;p&#62;Alex
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Multi-GPU fluid version and Elastic GPU version"</title>
			<link>http://www.k-wave.org/forum/topic/multi-gpu-fluid-version-and-elastic-gpu-version#post-6580</link>
			<pubDate>Thu, 13 Sep 2018 16:00:35 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6580@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Alex,&#60;/p&#62;
&#60;p&#62;The multi-GPU fluid code is finished in regards to capability, but not finished in regards to usability. The current beta requires a reasonable number of command line variables, for example, to bind GPUs and threads to cores, to pad the subdomains to give small prime factors, and so on. Filip (the main programmer for this code) has started working on automating all of this, but it still might be some months before a release.&#60;/p&#62;
&#60;p&#62;The GPU elastic code is also working, however, Kristian (the main programmer for this code) is currently implementing higher-order time-stepping schemes to improve performance. Again, probably some months away before a release.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
