2D Acoustic Slit Diffraction Simulation
Introduction
Wave diffraction is one of the most fundamental phenomena in physics, demonstrating how waves bend around obstacles and spread through apertures. When a plane wave encounters a barrier with a slit, the wave diffracts and creates an interference pattern that depends on the ratio of wavelength to slit width.
This post explores 2D acoustic slit diffraction—a classic problem that illustrates Huygens’ principle and wave interference. The simulation is implemented using two complementary tools:
- k-Wave: An open-source MATLAB toolbox using the k-space pseudospectral method
- COMSOL Multiphysics: A commercial finite element software suite
Theoretical Background
Wave Diffraction and Huygens’ Principle
When a plane wave encounters an aperture (slit), each point within the aperture acts as a secondary source of spherical waves (Huygens’ principle). The superposition of these secondary waves produces the diffraction pattern.
For a slit of width $w$ illuminated by a wave of wavelength $\lambda$:
- $\lambda \approx w$: Strong diffraction, nearly hemispherical wave spreading
- $\lambda \ll w$: Weak diffraction, wave passes through with minimal spreading
- $\lambda \gg w$: Very strong diffraction, wave completely spreads
The Acoustic Wave Equation (2D)
In two dimensions, the coupled first-order acoustic equations are:
$$\frac{\partial p}{\partial t} = -\rho_0 c_0^2 \left( \frac{\partial u_x}{\partial x} + \frac{\partial u_y}{\partial y} \right)$$
$$\frac{\partial u_x}{\partial t} = -\frac{1}{\rho_0} \frac{\partial p}{\partial x}$$
$$\frac{\partial u_y}{\partial t} = -\frac{1}{\rho_0} \frac{\partial p}{\partial y}$$
where:
- $p$ is the acoustic pressure [Pa]
- $u_x$, $u_y$ are the particle velocity components [m/s]
- $\rho_0$ is the ambient density [kg/m³]
- $c_0$ is the sound speed [m/s]
High-Impedance Barrier
The barrier is modeled as a region with significantly higher acoustic impedance than the background medium. With an impedance ratio of 20:1, approximately 82% of the incident energy is reflected at the barrier surface (using the intensity reflection coefficient $R = \left(\dfrac{Z_2 - Z_1}{Z_2 + Z_1}\right)^2 \approx 0.82$). This high reflection ensures that most wave energy is blocked, while the remaining portion transmits or diffracts through the slit opening.
Problem Setup
The simulation uses a 2D square domain with the following configuration:
| Parameter | Value |
|---|---|
| Domain size | 50 × 50 mm |
| Grid points | 128 × 128 |
| Grid spacing | 0.391 mm |
| Sound speed | 1500 m/s |
| Density | 1000 kg/m³ |
| Simulation time | 40 μs |
Barrier and Slit Geometry
| Parameter | Value |
|---|---|
| Barrier position | x = Lx/4 (left side) |
| Barrier thickness | 2 grid points (0.78 mm) |
| Slit width | 10 grid points (3.91 mm) |
| Slit center | y = Ly/2 (domain center) |
| Impedance ratio | 20× background |
Source Configuration
A plane wave source is placed at the left boundary, propagating from left to right toward the barrier:
- Source type: Sinusoidal velocity source (plane wave)
- Wavelength: Equal to slit width (3.91 mm)
- Frequency: 384 kHz
When $\lambda \approx w$, significant diffraction occurs, producing a characteristic spreading pattern beyond the slit.
k-Wave Implementation
k-Wave is an open-source MATLAB toolbox for time-domain acoustic and ultrasound simulations. It uses a k-space pseudospectral method that is highly efficient for wave propagation problems.
Simulation Setup
| |
Source Definition
| |
k-Wave Results
The following figure shows the final pressure field after the wave has propagated through the slit:

The wave propagation animation:

Key observations:
- The plane wave approaches the barrier from the left
- Most of the wave is blocked by the barrier (high impedance reflection)
- The wave passes through the slit and diffracts, creating a spreading pattern
- Interference fringes are visible in the diffracted wave
COMSOL Implementation
COMSOL Multiphysics uses the Finite Element Method (FEM) to solve the acoustic wave equation. The model setup follows similar physical parameters to the k-Wave simulation.
Model Setup
Create New Model
- Open COMSOL Multiphysics
- Select Model Wizard → 2D geometry
- Add physics: Acoustics → Pressure Acoustics, Transient
- Select study: Time Dependent
Define Geometry
The geometry consists of three rectangular domains:
| Component | Description |
|---|---|
| Main domain (r1) | 50 × 50 mm rectangle at origin |
| Lower barrier (r2) | Vertical rectangle from y = 0 to slit bottom edge |
| Upper barrier (r3) | Vertical rectangle from slit top edge to y = 50 mm |
The barrier is positioned at x = Lx/4 with thickness matching k-Wave (2 grid points = 0.78 mm).
Define Materials
| Material | Domain | Sound Speed | Density |
|---|---|---|---|
| Background | Main domain | 1500 m/s | 1000 kg/m³ |
| Barrier | Upper & Lower barriers | 30000 m/s | 20000 kg/m³ |
Configure Physics
- Source: Pressure boundary condition on left edge:
2*sin(2*pi*f0*t)(amplitude = 2 Pa). This is equivalent to k-Wave’s velocity sourcesource_mag = 2/(c0*rho0), since $p = \rho_0 c_0 u = 2$ Pa. - Absorbing BC: Plane Wave Radiation on right, top, and bottom boundaries
Why Plane Wave Radiation instead of PML?
In COMSOL, PML (Perfectly Matched Layer) requires adding additional domain layers around the geometry, which increases model complexity and mesh size. The Plane Wave Radiation boundary condition is a simpler alternative that uses an analytical impedance matching condition to absorb outgoing waves with minimal reflection. For problems with waves primarily traveling perpendicular to boundaries, Plane Wave Radiation provides good absorption with lower computational cost.
Mesh and Solve
- Mesh: Free triangular mesh with at least 6 elements per wavelength
- Time stepping: Adaptive BDF scheme for computational efficiency
COMSOL Results
The COMSOL simulation produces comparable results to k-Wave:

Animation showing wave propagation:

Results Comparison
Visual Comparison

Both simulations show:
- Similar diffraction patterns beyond the slit
- Comparable wave reflection from the barrier
- Matching propagation speed and wavelength
Differences
Some differences are expected due to:
- Numerical methods: k-Wave uses pseudospectral (FFT-based) spatial derivatives, while COMSOL uses finite elements
- Boundary conditions: k-Wave uses PML, COMSOL uses Plane Wave Radiation
- Time stepping: Different schemes (k-space corrected vs. BDF)
Efficiency Comparison
| Parameter | k-Wave | COMSOL |
|---|---|---|
| Grid Points | 16,384 (128 × 128) | ~equivalent mesh |
| Time Steps | 7,181 | N/A (adaptive) |
| Source Frequency | 384.0 kHz | 384.0 kHz |
| Slit Width | 3.91 mm | 3.91 mm |
| Simulation Time | 6.78 s | 1676.92 s |
k-Wave is approximately 247× faster than COMSOL for this 2D acoustic slit diffraction simulation.
Conclusion
Both k-Wave and COMSOL successfully simulate 2D acoustic slit diffraction, demonstrating the fundamental wave physics of diffraction and interference. Key findings:
- Wave diffraction through the slit creates a characteristic spreading pattern when $\lambda \approx w$
- k-Wave is highly efficient for wave propagation, ideal for large-scale simulations
- COMSOL provides flexibility and multi-physics capabilities
This simulation demonstrates a classic physics problem that is relevant to:
- Ultrasound imaging
- Non-destructive testing
- Acoustic metamaterials
- Underwater acoustics
References
- Treeby, B. E., & Cox, B. T. (2010). k-Wave: MATLAB toolbox for the simulation and reconstruction of photoacoustic wave fields. Journal of Biomedical Optics, 15(2), 021314.
- COMSOL Multiphysics Reference Manual.
- Hecht, E. (2017). Optics (5th ed.). Pearson. [Diffraction theory applies to all waves]
- Kinsler, L. E., et al. (2000). Fundamentals of Acoustics. John Wiley & Sons.