<?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: 2D simple case-confused about PML</title>
		<link>http://www.k-wave.org/forum/topic/2d-simple-case-confused-about-pml</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 03:10:36 +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/2d-simple-case-confused-about-pml" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "2D simple case-confused about PML"</title>
			<link>http://www.k-wave.org/forum/topic/2d-simple-case-confused-about-pml#post-7795</link>
			<pubDate>Wed, 09 Sep 2020 19:31:19 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7795@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi RuiLiu,&#60;/p&#62;
&#60;p&#62;If you turn off the PML, then the waves will wrap from one side of the domain to the other. This is due to the periodicity assumed by the FFT used to calculate spatial gradients in k-Wave. &#60;/p&#62;
&#60;p&#62;If you use the default PML parameters (pml_alpha = 2, pml_size = 20) and place your source position outside the PML, e.g., at grid point 21 instead of 2, then the simulation runs as expected.&#60;/p&#62;
&#60;p&#62;Note, your source frequency is above the maximum frequency supported by the grid. If calling &#60;code&#62;filterTimeSeries&#60;/code&#62; you might also want to pad the input signal with some zeros to allow the filter some room to work.&#60;/p&#62;
&#60;p&#62;Brad
&#60;/p&#62;</description>
		</item>
		<item>
			<title>RuiLiu on "2D simple case-confused about PML"</title>
			<link>http://www.k-wave.org/forum/topic/2d-simple-case-confused-about-pml#post-7762</link>
			<pubDate>Fri, 21 Aug 2020 19:33:06 +0000</pubDate>
			<dc:creator>RuiLiu</dc:creator>
			<guid isPermaLink="false">7762@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, &#60;/p&#62;
&#60;p&#62;Here is my code to put one source and two sensors in a line of the medium. The question is why my source wave always appear in my opposite boundary no matter which location I put for source. I know we should put the source out of the PML, but even when I put PML as 0, it still run to opposite boundary first. Could anyone help me to understand the prinple of the model I hope the source running from left to right and not suddenly appeared in the opposite way. Thanks. &#60;/p&#62;
&#60;p&#62;Here is my code: &#60;/p&#62;
&#60;p&#62;clc&#60;br /&#62;
clear&#60;br /&#62;
close all&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% create the computational grid&#60;br /&#62;
Nx = 60;           % number of grid points= in the x (row) direction&#60;br /&#62;
Ny = 120;            % number of grid points in the y (column) direction&#60;br /&#62;
dx = 1e-3;        % grid point spacing in the x direction [m] 1mm&#60;br /&#62;
dy = 1e-3;        % 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 properties of the propagation medium&#60;br /&#62;
medium.sound_speed = 1500;  % [m/s]&#60;/p&#62;
&#60;p&#62;% set the CFL&#60;br /&#62;
cfl = 0.05;&#60;br /&#62;
% set end time&#60;br /&#62;
t_end = 50e-6; % end at 100s &#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed, cfl, t_end);&#60;/p&#62;
&#60;p&#62;% define a single source point&#60;br /&#62;
source.p_mask = zeros(Nx, Ny);&#60;br /&#62;
source.p_mask(Nx/2, 2) = 1;&#60;/p&#62;
&#60;p&#62;% define a time varying sinusoidal source&#60;br /&#62;
source_freq = 1e6;   % [Hz]&#60;br /&#62;
source_mag = 2;         % [Pa]&#60;br /&#62;
t_array = [0:0.1e-6:0.1e-4];&#60;br /&#62;
source.p = source_mag*sin(source_freq*t_array);&#60;/p&#62;
&#60;p&#62;% filter the source to remove high frequencies not supported by the grid&#60;br /&#62;
source.p = filterTimeSeries(kgrid, medium, source.p);&#60;/p&#62;
&#60;p&#62;plot(t_array*1e6, source.p)&#60;/p&#62;
&#60;p&#62;% define a single sensor point&#60;br /&#62;
sensor.mask = zeros(Nx, Ny);&#60;br /&#62;
sensor.mask(Nx/2, Ny/2) = 1;&#60;br /&#62;
sensor.mask(Nx/2, Ny-10) = 1;&#60;br /&#62;
% define the acoustic parameters to record&#60;br /&#62;
sensor.record = {'p'};&#60;/p&#62;
&#60;p&#62;% define the properties of the PML to allow plane wave propagation&#60;br /&#62;
pml_alpha = 0; %&#60;br /&#62;
pml_size  = [0, 0];&#60;/p&#62;
&#60;p&#62;% set the input arguments&#60;br /&#62;
input_args = {'PlotScale', 'auto', 'PMLSize', pml_size,...&#60;br /&#62;
    'PMLAlpha', pml_alpha, 'PlotPML', true, 'PlotLayout', true};&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});&#60;br /&#62;
%%&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% VISUALISATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% plot the sensor data&#60;br /&#62;
figure;&#60;br /&#62;
subplot(2, 1, 1)&#60;br /&#62;
stackedPlot(kgrid.t_array*1e6, sensor_data.p(1,:));&#60;br /&#62;
ylim([-2 2])&#60;br /&#62;
xlabel('Time [\mus]');&#60;/p&#62;
&#60;p&#62;subplot(2, 1, 2)&#60;br /&#62;
stackedPlot(kgrid.t_array*1e6, sensor_data.p(2,:));&#60;br /&#62;
ylim([-2 2])&#60;br /&#62;
xlabel('Time [\mus]');
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
