<?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: Stability of elastic simulations</title>
		<link>http://www.k-wave.org/forum/topic/stability-of-elastic-simulations</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 12:11:49 +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/stability-of-elastic-simulations" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Stability of elastic simulations"</title>
			<link>http://www.k-wave.org/forum/topic/stability-of-elastic-simulations#post-5681</link>
			<pubDate>Thu, 15 Sep 2016 16:43:32 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">5681@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Bellamy,&#60;/p&#62;
&#60;p&#62;The instability seems to be related to the very high values of absorption, and the PML.&#60;br /&#62;
If you turn either the absorption or the PML off, your simulation seems to run ok. It's possibly because the M-PML that the elastic code uses is derived for lossless media. Unfortunately I don't have time right now to dig any deeper, but I will definitely add it to the to-do list.&#60;/p&#62;
&#60;p&#62;As an aside, a couple of other tips for your code. First, if you set your grid size to have small prime factors, it will be faster (e.g., use &#60;code&#62;Nx = 128*scale+448- 2*PML_size;&#60;/code&#62;). Second, you will use less memory if you just define one source input (this is used for all the source elements), without the trailing zeros. &#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bellamy on "Stability of elastic simulations"</title>
			<link>http://www.k-wave.org/forum/topic/stability-of-elastic-simulations#post-5649</link>
			<pubDate>Mon, 29 Aug 2016 14:47:42 +0000</pubDate>
			<dc:creator>Bellamy</dc:creator>
			<guid isPermaLink="false">5649@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;This is an example of one of the simulations I've tested:&#60;br /&#62;
When plotting the pressure record at one of the points, there is a growing ringing recorded as time goes on, after a certain amount of time. &#60;/p&#62;
&#60;p&#62;clear all;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% SIMULATION PARAMETERS&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% change scale to 2 to reproduce the higher resolution figures used in the&#60;br /&#62;
% help file&#60;br /&#62;
scale = 1;&#60;br /&#62;
lambda=1540/.8E6;&#60;br /&#62;
% create the computational grid&#60;br /&#62;
PML_size = 10;               % size of the PML in grid points&#60;br /&#62;
Nx = 128*scale+450- 2*PML_size; % number of grid points in the x direction&#60;br /&#62;
Ny = 192*scale - 2*PML_size; % number of grid points in the y direction&#60;br /&#62;
dx = lambda/8;           % grid point spacing in the x direction [m]&#60;br /&#62;
dy = dx;           % grid point spacing in the y direction [m]&#60;br /&#62;
kgrid = makeGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;% define the medium properties&#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.1;    % compressional wave absorption [dB/(MHz^2 cm)]&#60;br /&#62;
alpha0_s1 = 0.1;    % shear wave absorption [dB/(MHz^2 cm)]&#60;/p&#62;
&#60;p&#62;cp2 = 3250;         % compressional wave speed [m/s]&#60;br /&#62;
cs2 = 1685;         % shear wave speed [m/s]&#60;br /&#62;
rho2 = 2533;        % density [kg/m^3]&#60;br /&#62;
alpha0_p2 = 38;      % compressional wave absorption [dB/(MHz^2 cm)]&#60;br /&#62;
alpha0_s2 = 38;      % shear wave absorption [dB/(MHz^2 cm)]&#60;/p&#62;
&#60;p&#62;cp3 = 2139;         % compressional wave speed [m/s]&#60;br /&#62;
cs3 = 1100;         % shear wave speed [m/s]&#60;br /&#62;
rho3 = 1500;        % density [kg/m^3]&#60;br /&#62;
alpha0_p3 = 38;      % compressional wave absorption [dB/(MHz^2 cm)]&#60;br /&#62;
alpha0_s3 = 38;      % shear wave absorption [dB/(MHz^2 cm)]&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
cfl   = 0.08;&#60;br /&#62;
t_end = 1.4e-4;&#60;br /&#62;
kgrid.t_array= makeTime(kgrid, cp2, cfl, t_end);&#60;/p&#62;
&#60;p&#62;% define position of heterogeneous slab&#60;br /&#62;
slab = zeros(Nx, Ny);&#60;br /&#62;
slab(20:Nx, :) = 1;&#60;/p&#62;
&#60;p&#62;slab3 = zeros(Nx, Ny);&#60;br /&#62;
slab3(40:60, :) = 1;&#60;/p&#62;
&#60;p&#62;% define the source properties&#60;br /&#62;
source_freq = .8E6;              % [Hz]&#60;/p&#62;
&#60;p&#62;source_cycles = 3;              % number of tone burst cycles&#60;br /&#62;
source_focus_dist = 5*scale;    % position of focus inside slab [grid points]&#60;br /&#62;
source_slab_dist = 5*scale;     % distance between source and slab [grid points]&#60;br /&#62;
%source_mask = makeCircle(Nx, Ny, Nx/2 + source_focus_dist, Ny/2, 50*scale, pi/3);&#60;br /&#62;
source_mask(1:Nx, 1:Ny) = 0;&#60;br /&#62;
source_mask(10, 20:30) = 1;&#60;br /&#62;
sensor.mask=ones(Nx,Ny);&#60;br /&#62;
% define the sensor to record the maximum particle velocity everywhere&#60;br /&#62;
sensor.record = {'p','p_max_all'};&#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;
    'DisplayMask', 'off', 'DataCast', 'single'};&#60;/p&#62;
&#60;p&#62;% assign the source&#60;br /&#62;
source.p_mask = source_mask;&#60;br /&#62;
source.p = toneBurst(1/kgrid.dt, source_freq, source_cycles);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% ELASTIC SIMULATION&#60;br /&#62;
% =========================================================================&#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_compression(slab == 1) = cp2;&#60;br /&#62;
medium.sound_speed_compression(slab3 == 1) = cp3;&#60;br /&#62;
medium.sound_speed_shear                  = cs1*ones(Nx, Ny);&#60;br /&#62;
medium.sound_speed_shear(slab == 1)       = cs2;&#60;br /&#62;
medium.sound_speed_shear(slab3 == 1)       = cs3;&#60;br /&#62;
medium.density                            = rho1*ones(Nx, Ny);&#60;br /&#62;
medium.density(slab == 1)                 = rho2;&#60;br /&#62;
medium.density(slab3 == 1)                 = rho3;&#60;br /&#62;
medium.alpha_coeff_compression            = alpha0_p1*ones(Nx, Ny);&#60;br /&#62;
medium.alpha_coeff_compression(slab == 1) = alpha0_p2;&#60;br /&#62;
medium.alpha_coeff_compression(slab3 == 1) = alpha0_p3;&#60;br /&#62;
medium.alpha_coeff_shear                  = alpha0_s1*ones(Nx, Ny);&#60;br /&#62;
medium.alpha_coeff_shear(slab == 1)       = alpha0_s2;&#60;br /&#62;
medium.alpha_coeff_shear(slab3 == 1)       = alpha0_s3;&#60;/p&#62;
&#60;p&#62;% assign the source&#60;br /&#62;
clear source&#60;br /&#62;
source.u_mask = source_mask;&#60;br /&#62;
signal = toneBurst(1/kgrid.dt, source_freq, 3,'SignalLength',5000);&#60;/p&#62;
&#60;p&#62;signal= filterTimeSeries(kgrid, medium, signal);&#60;br /&#62;
for i=1:sum(source.u_mask(:))&#60;br /&#62;
    source.ux(i,:)=signal;&#60;br /&#62;
end&#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;p(:,:,:) = reshape(sensor_data_elastic.p, Nx,Ny,[]);&#60;br /&#62;
plot(squeeze(p(10,25,:)))&#60;/p&#62;
&#60;p&#62;I've tried reducing the cfl until I run into out of memory errors, and I still see this instability forming (albeit with a smaller Nx). Does anyone know the source of this instability, and what I can do to get rid of it? Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bellamy on "Stability of elastic simulations"</title>
			<link>http://www.k-wave.org/forum/topic/stability-of-elastic-simulations#post-5647</link>
			<pubDate>Tue, 23 Aug 2016 20:31:34 +0000</pubDate>
			<dc:creator>Bellamy</dc:creator>
			<guid isPermaLink="false">5647@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, &#60;/p&#62;
&#60;p&#62; I'm having some trouble with instabilities in my grid when I simulate a strongly heterogeneous medium, with some high density (max 2700 kg/m^3) and high attenuation values (~38 dB/cm MHz^2). I am using the PSTD elastic code. I've tried reducing the grid size to lambda/12 (actually in testing using the shear example in 2D I found that for the same cfl that it's more stable for lambda/8 than lambda/12 for some reason..?)  and I've tried it with lamba/8 grid spacing and cfl=0.03 using the max compressional speed of sound (3350m/s) as the reference. I've been testing out some simple situations, modifying the shear wave example and I find that it looks ok if I keep the duration of the simulation to be the time it takes for the ultrasound to travel from one side of the grid to the other, but if I make it much longer than that, the simulation becomes unstable. I've tried additive and dirichlet modes, and it was still unstable. Is this an issue with the PML, or am I missing something? &#60;/p&#62;
&#60;p&#62; Thanks!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
