<?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: Convergence Testing</title>
		<link>http://www.k-wave.org/forum/topic/convergence-testing</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 01:49:21 +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/convergence-testing" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Convergence Testing"</title>
			<link>http://www.k-wave.org/forum/topic/convergence-testing#post-8253</link>
			<pubDate>Wed, 21 Jul 2021 16:10:44 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8253@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Nothing immediately obvious from the code snippet you've provided. I didn't entirely follow what you're changing - can you post an example where you tweak the numbers as part of the convergence test? By the looks of it, you'll need to scale vox, dim/padsize, and foc.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>manueltj on "Convergence Testing"</title>
			<link>http://www.k-wave.org/forum/topic/convergence-testing#post-8218</link>
			<pubDate>Tue, 15 Jun 2021 22:41:07 +0000</pubDate>
			<dc:creator>manueltj</dc:creator>
			<guid isPermaLink="false">8218@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Treeby and Colleagues,&#60;/p&#62;
&#60;p&#62;I am attempting to run a convergence test for a simple simulation, but am not seeing convergence. I am simulating a single 9 mm element at 650 kHz, and am concerned with the pressure field on axis 15 cm away (this is to simulate the element's contribution in a larger array). My results are this:&#60;/p&#62;
&#60;p&#62;Voxel size (mm) &#124;&#124;  Pressure(@15 cm)&#60;br /&#62;
     0.2       ..     365&#60;br /&#62;
     0.3       ..      78.9&#60;br /&#62;
     0.4       ..     266&#60;br /&#62;
     0.5       ..     199&#60;/p&#62;
&#60;p&#62;For the convergence test, I am keeping the grid size constant, keeping the actual size of the transducer (a flat single element) constant by changing its number of pixels, and updating the timestep and continuous wave source using makeTime() and createCWSignals(). The PML does not reach the regions of interest in any of the grid configurations. One thing that stands out as unique is that my grid is [64 64 850] spatial points so is rather long and skinny. &#60;/p&#62;
&#60;p&#62;Does anything stand out to you as notable as to why the pressure in the far field is changing dramatically? &#60;/p&#62;
&#60;p&#62;Thank you!&#60;/p&#62;
&#60;p&#62;Here is my code:&#60;br /&#62;
% script to simulate a single flat element&#60;br /&#62;
clear all&#60;br /&#62;
f0 = 0.65E6;                 % frequency [MHz]&#60;br /&#62;
Amp = 1000;                    % amplitude at source.p_mask&#60;br /&#62;
phase = 0;               % phase of source wave&#60;br /&#62;
sensor.record = {'p_max'};    %set to p_max, or p_rms depending on what you want&#60;/p&#62;
&#60;p&#62;%% pick initial dimensions&#60;br /&#62;
vox = .3E-3;&#60;br /&#62;
dim = [60 60 850];&#60;br /&#62;
'Your simpace size'&#60;br /&#62;
dim&#60;br /&#62;
%checkFactors(min(dim),max(dim)+100)&#60;/p&#62;
&#60;p&#62;%% look at the dimensions of your image and select a final grid size that fits&#60;br /&#62;
% your simspace and is in one of the first 3 rows output by checkFactors&#60;br /&#62;
padsize = [64 64 850];    &#60;/p&#62;
&#60;p&#62;%% setup and run simulation&#60;br /&#62;
% pad arrays&#60;br /&#62;
foo = ones(padsize);&#60;/p&#62;
&#60;p&#62;dim = padsize;&#60;br /&#62;
% get medium properties (density and speed of sound for now)&#60;br /&#62;
medium.sound_speed = 1480.*foo;&#60;br /&#62;
medium.density = 997.*foo;&#60;/p&#62;
&#60;p&#62;% create kgrid&#60;br /&#62;
kgrid = kWaveGrid(dim(1), vox, dim(2), vox, dim(3), vox);&#60;br /&#62;
[kgrid.t_array, dt_SIM] = makeTime(kgrid, medium.sound_speed);&#60;/p&#62;
&#60;p&#62;% create pressure vector&#60;br /&#62;
source.p = createCWSignals(kgrid.t_array, f0, Amp, phase);&#60;br /&#62;
%% make transducer&#60;br /&#62;
foc = [32 32 800]; % location at region of interest (focus of larger array)&#60;br /&#62;
roc = 150; %[mm]   % radius of curvature of larger array&#60;br /&#62;
D = round((9E-3)/vox)+1; %[m] element diameter&#60;br /&#62;
rocp = round((roc.*1E-3)/vox);&#60;br /&#62;
top = [foc(1) foc(2) foc(3)-rocp]; % place the element 150 mm away from foc&#60;/p&#62;
&#60;p&#62;%I want to simulate a flat element, so I change the radius to be huge&#60;br /&#62;
rocp = 10000;&#60;br /&#62;
xdcr = makeBowl(dim,top,rocp,D,foc);&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
source.p_mask = xdcr==1; %only get spherical cap part of xdcr file&#60;br /&#62;
sensor.mask = ones(dim);&#60;br /&#62;
%%&#60;br /&#62;
sensor_data = kspaceFirstOrder3DG(kgrid,medium,source,sensor);&#60;br /&#62;
% grab data&#60;br /&#62;
if sensor.record{1} == 'p_rms'&#60;br /&#62;
    data = sensor_data.p_rms;&#60;br /&#62;
elseif sensor.record{1} == 'p_max'&#60;br /&#62;
    data = sensor_data.p_max;&#60;br /&#62;
else&#60;br /&#62;
    'this script only supports recording p and p_rms'&#60;br /&#62;
end&#60;br /&#62;
%&#60;br /&#62;
data = reshape(data,dim);
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
