<?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: genny_p</title>
		<link><a href='http://www.k-wave.org/forum/profile/genny_p'>genny_p</a></link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:08:48 +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 "Simulation Time"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-time#post-7084</link>
			<pubDate>Fri, 18 Oct 2019 19:09:52 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7084@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Michael,&#60;/p&#62;
&#60;p&#62;If the screen goes black, it's likely an instability. Unfortunately, the stability criterion for the elastic model means that with high absorption values, you need to use a small CFL. You can try minimising the simulation time by switching to single precision, reducing the size of your domain if possible, using different hardware, etc.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad
&#60;/p&#62;</description>
		</item>
		<item>
			<title>genny_p on "Simulation Time"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-time#post-7026</link>
			<pubDate>Wed, 28 Aug 2019 13:00:09 +0000</pubDate>
			<dc:creator>genny_p</dc:creator>
			<guid isPermaLink="false">7026@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Michael,&#60;/p&#62;
&#60;p&#62;I had a similar problem with a black screen forming (mine was due to some instability) when I increased the attenuation coefficients. I wonder if we are facing the same problem. In my case, I found the whether the simulation goes black is highly sensitive to the grid spacing. Increasing dx seemed to make the simulation more stable (as with increasing the cfl number), but then I couldn't confirm convergenge. I tried putting the parameters you supplied in the Shear Waves And Critical Angle Reflection Example and everything seems to run fine, even with the higher attenuation coefficients, so perhaps something else in your code is different (grid spacing/size probably considering the longer simulation time). Can you post your complete code (or a big enough subset of it to reproduce the problem) so I can see if your problem seems similar to mine?  &#60;/p&#62;
&#60;p&#62;I posted my code at &#60;a href=&#34;http://www.k-wave.org/forum/topic/instability-in-shear-wave-absorption-simulation&#34; rel=&#34;nofollow&#34;&#62;http://www.k-wave.org/forum/topic/instability-in-shear-wave-absorption-simulation&#60;/a&#62; a few months ago, and am still searching for a solution. Perhaps you can try increasing the grid spacing in your simulation and see if a coarser grid helps your simulation like mine (though this would only confirm we are facing the same problem, and still need a solution to confirm for convergence).&#60;/p&#62;
&#60;p&#62;Best,&#60;br /&#62;
Genny
&#60;/p&#62;</description>
		</item>
		<item>
			<title>elliotP on "Simulation Time"</title>
			<link>http://www.k-wave.org/forum/topic/simulation-time#post-7025</link>
			<pubDate>Tue, 27 Aug 2019 18:23:23 +0000</pubDate>
			<dc:creator>elliotP</dc:creator>
			<guid isPermaLink="false">7025@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I have a question about the relationship between elastic simulation time and coefficients.&#60;br /&#62;
For instance, when I use below constants:&#60;br /&#62;
-----------------------------------------&#60;br /&#62;
% water&#60;br /&#62;
cp1 = 1540;           % compressional wave speed [m/s]&#60;br /&#62;
cs1 = 0;              % shear wave speed [m/s]&#60;br /&#62;
rho1 = 1000;          % density [kg/m^3]&#60;br /&#62;
alpha0_p1 = 0;        % compressional wave absorption [dB/(MHz^2 cm)]&#60;br /&#62;
alpha0_s1 = 0;        % shear wave absorption [dB/(MHz^2 cm)]&#60;br /&#62;
% skull&#60;br /&#62;
cp2 = 3000;           % compressional wave speed [m/s]&#60;br /&#62;
cs2 = 1500;           % shear wave speed [m/s]&#60;br /&#62;
rho2 = 1850;          % density [kg/m^3]&#60;br /&#62;
alpha0_p2 = 3;      % compressional wave absorption [dB/(MHz^2 cm)]&#60;br /&#62;
alpha0_s2 = 6;      % shear wave absorption [dB/(MHz^2 cm)]&#60;br /&#62;
% create the time array&#60;br /&#62;
cfl                 = 0.13;&#60;br /&#62;
t_end               = 40e-6;&#60;br /&#62;
-----------------------------------------&#60;br /&#62;
estimated simulation time 1hours 15min 41.4135s...&#60;br /&#62;
-----------------------------------------&#60;/p&#62;
&#60;p&#62;When I change the skull's attenuation values to alpha0_p2 = 8.83, alpha0_s2 = 19.5 (belongs to your paper(Modeling power law absorption and dispersion in viscoelastic solids using a split-field&#60;br /&#62;
and the fractional Laplacian)). Unfortunately, simulation gives a black screen. I think I have to change the cfl number. But, when I decrease the cfl coefficient, simulation time takes much longer.&#60;br /&#62;
How can I minimize the simulation time under these circumstances?&#60;/p&#62;
&#60;p&#62;Best,&#60;br /&#62;
Michael
&#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>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>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>

	</channel>
</rss>
