k-Wave
A MATLAB toolbox for the time-domain
simulation of acoustic wave fields
- Getting Started
- Examples
- Initial Value Problems
- Example: Homogenous Propagation Medium
- Example: Using A Binary Sensor Mask
- Example: Defining A Sensor Mask By Opposing Corners
- Example: Loading External Image Maps
- Example: Heterogeneous Propagation Medium
- Example: Saving Movie Files
- Example: Recording The Particle Velocity
- Example: Defining A Gaussian Sensor Frequency Response
- Example: Comparison Of Modelling Functions
- Example: Setting An Initial Pressure Gradient
- Example: Simulations In One Dimension
- Example: Simulations In Three Dimensions
- Example: Photoacoustic Waveforms in 1D, 2D and 3D
- Time Varying Source Problems
- Example: Monopole Point Source In A Homogeneous Propagation Medium
- Example: Dipole Point Source In A Homogeneous Propagation Medium
- Example: Simulating Transducer Field Patterns
- Example: Steering A Linear Array
- Example: Snell's Law And Critical Angle Reflection
- Example: The Doppler Effect
- Example: Diffraction Through A Slit
- Example: Simulations In Three-Dimensions
- Sensor Directivity
- Example: Focussed Detector in 2D
- Example: Focussed Detector in 3D
- Example: Modelling Sensor Directivity in 2D
- Example: Modelling Sensor Directivity in 3D
- Example: Sensor Element Directivity in 2D
- Example: Focussed 2D Array with Directional Elements
- Photoacoustic Image Reconstruction
- Example: 2D FFT Reconstruction For A Line Sensor
- Example: 3D FFT Reconstruction For A Planar Sensor
- Example: 2D Time Reversal For A Line Sensor
- Example: 2D Time Reversal For A Circular Sensor
- Example: 3D Time Reversal For A Planar Sensor
- Example: 3D Time Reversal For A Spherical Sensor
- Example: Image Reconstruction With Directional Sensors
- Example: Image Reconstruction With Bandlimited Sensors
- Example: Iterative Image Improvement Using Time Reversal
- Example: Attenuation Compensation Using Time Reversal
- Example: Attenuation Compensation Using Time Variant Filtering
- Example: Automatic Sound Speed Selection
- Diagnostic Ultrasound Simulation
- Example: Defining An Ultrasound Transducer
- Example: Simulating Ultrasound Beam Patterns
- Example: Using An Ultrasound Transducer As A Sensor
- Example: Simulating B-mode Ultrasound Images
- Example: Simulating B-mode Images Using A Phased Array
- Numerical Analysis
- Example: Controlling The Absorbing Boundary Layer
- Example: Source Smoothing
- Example: Filtering A Delta Function Input Signal
- Example: Modelling Power Law Absorption
- Example: Modelling Nonlinear Wave Propagation
- Example: Optimising k-Wave Performance
- Using The C++ Code
- Elastic Wave Propagation
- Example: Explosive Source In A Layered Medium
- Example: Plane Wave Absorption
- Example: Shear Waves And Critical Angle Reflection
- Example: Simulations In Three Dimensions
- Functions - By Category
- Functions - Alphabetical List
- Release Notes
- License
k-Wave Toolbox |
Photoacoustic Waveforms in 1D, 2D and 3D Example
On this page… |
---|
Overview
The time-varying pressure signals recorded from a photoacoustic source look different depending on the number of dimensions used in the simulation. This difference occurs because a point source in 1D corresponds to a plane wave in 3D, and a point source in 2D corresponds to an infinite line source in 3D. This examples shows the difference between the signals recorded in each dimension. It builds on the Simulations in One Dimension, Homogeneous Propagation Medium, and Simulations in Three Dimensions examples.
Waves in 1D, 2D and 3D
The fact that the characteristics of plane (1D), cylindrical (2D), and spherical (3D) wave propagation are different in some fundamental ways is often overlooked. This can lead to incorrect insight into the results from photoacoustic simulations. In particular, three key differences between 1D, 2D and 3D propagation are:
- Photoacoustic waves in 1D and 3D are compactly supported. This means they are zero outside some finite region (they "end"), whereas a waveform in 2D has an infinitely long tail. This can be understood by considering a 2D point source as an infinitely long line source in 3D. This means there will always be some signal arriving at the detector from some (increasingly distant) part of the line source. One implication for photoacoustics is that time reversal image reconstruction is not exact in 2D.
- There is no geometrical spreading in 1D, so wave amplitudes do not decay (unless there is absorption). In 2D, the waves undergo cylindrical spreading in which the acoustic energy is spread out over the growing wavefront. This means the acoustic energy is inversely proportional to radius and the acoustic pressure decays as 1/sqrt(radius). In 3D, the spreading is over a spherical wavefront, so the energy is spread over radius^2, and the pressure decays as 1/radius.
- In 1D, the shape of the initial pressure distribution will be retained in the shape of the propagating pulse. This is not true in 2D and 3D.
Note that 1D, 2D, and 3D are used here to refer to the Cartesian coordinate systems in which the variables are (x), (x, y), and (x, y, z). Other cases that could be described as 1D (such as spherically-symmetric with just a radial coordinate) or 2D (such as cylindrically-symmetric with (r, theta) as the coordinates) are not considered.
Running the simulation in 1D
First, the common settings for all three examples are set, including the grid size, properties of the medium, size of the initial pressure distribution, source-receiver separation, time step, and length of time to run the simulation.
% size of the computational grid Nx = 64; % number of grid points in the x (row) direction x = 1e-3; % size of the domain in the x direction [m] dx = x/Nx; % grid point spacing in the x direction [m] % define the properties of the propagation medium medium.sound_speed = 1500; % [m/s] % size of the initial pressure distribution source_radius = 2; % [grid points] % distance between the centre of the source and the sensor source_sensor_distance = 10; % [grid points] % time array dt = 2e-9; % [s] t_end = 300e-9; % [s] % computation settings input_args = {'DataCast', 'single'};
The final line above sets MATLAB to run the simulations in single precision arithmetic, which is faster than double precision and more than sufficient for most simulations. The next set of commands create the k-Wave grid, the array of time points, the initial pressure distribution (source), and the sensor mask used to record the wavefield.
% create the computational grid kgrid = makeGrid(Nx, dx); % create the time array kgrid.t_array = 0:dt:t_end; % create initial pressure distribution source.p0 = zeros(Nx, 1); source.p0(Nx/2 - source_radius:Nx/2 + source_radius) = 1; % define a single sensor point sensor.mask = zeros(Nx, 1); sensor.mask(Nx/2 + source_sensor_distance) = 1;
Finally, the 1D example is run.
% run the simulation sensor_data_1D = kspaceFirstOrder1D(kgrid, medium, source, sensor, input_args{:});
Running the simulation in 2D
Running the simulation in 2D is very similar, except the initial pressure distribution is defined as a disc (filled circle) using makeDisc
, and the sensor mask is defined as a single pixel in two-dimensions.
% create the computational grid kgrid = makeGrid(Nx, dx, Nx, dx); % create initial pressure distribution source.p0 = makeDisc(Nx, Nx, Nx/2, Nx/2, source_radius); % define a single sensor point sensor.mask = zeros(Nx, Nx); sensor.mask(Nx/2 - source_sensor_distance, Nx/2) = 1; % run the simulation sensor_data_2D = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});
Running the simulation in 3D
The 3D example follows the same pattern, except now the source is defined as a ball (filled sphere) using makeBall
.
% create the computational grid kgrid = makeGrid(Nx, dx, Nx, dx, Nx, dx); % create initial pressure distribution source.p0 = makeBall(Nx, Nx, Nx, Nx/2, Nx/2, Nx/2, source_radius); % define a single sensor point sensor.mask = zeros(Nx, Nx, Nx); sensor.mask(Nx/2 - source_sensor_distance, Nx/2, Nx/2) = 1; % run the simulation sensor_data_3D = kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:});
Plotting the waveforms
The three recorded time series for 1D, 2D and 3D are shown below (the magnitudes have been normalised). The fact that the 1D and 3D waveforms are compactly supported can be clearly seen.
Simulations In Three Dimensions | Time Varying Source Problems |
© 2009-2014 Bradley Treeby and Ben Cox.