DiffractionVizzard · Open-source browser-based simulation suite
Source CodeDocumentation
Launch 3D Simulation → ← Electromagnetic Waves
Module 02 · Electromagnetic Waves · 3D

3D Electromagnetic Waves

Extend the 2D Helmholtz framework to a full three-dimensional domain. Visualise how scalar waves propagate, scatter, and form interference patterns around 3D obstacles — solved in the browser via WebAssembly.

Launch 3D Simulation → ← Electromagnetic Waves
3D Helmholtz wave simulation illustration

The 3D Helmholtz Equation

The scalar Helmholtz equation governs time-harmonic wave propagation in any spatial dimension. In three dimensions it describes acoustic pressure fields, electromagnetic fields (under appropriate polarisation assumptions), and quantum wave functions in free space:

∇²u + k²u = 0, k = ω/c, ∇² = ∂²/∂x² + ∂²/∂y² + ∂²/∂z²

Point sources in 3D radiate spherical waves with amplitude decaying as 1/r, in contrast to the cylindrical waves (decaying as 1/√r) produced by line sources in 2D. This difference in geometric spreading has significant consequences for the signal-to-noise ratio in physical measurements, including X-ray diffraction experiments.

Boundary Conditions and Perfectly Matched Layers

Truncating an unbounded 3D domain for numerical computation requires absorbing boundary conditions that eliminate spurious reflections. The Perfectly Matched Layer (PML) surrounds the physical domain with a stretched-coordinate region where the wave equation is modified so that outgoing waves decay exponentially without being reflected:

ũ(x̃) = u(x) · e^{−σ(x̃) x̃ / k}, σ → ∞ at the outer boundary

In 3D the PML must be applied independently in each coordinate direction, and corner/edge regions require careful treatment to prevent artefacts. The WebAssembly solver implements an optimised split-field PML formulation that remains stable for the full range of physically relevant wavenumbers.

In the Simulation

The 3D viewer renders volumetric wave fields on an isosurface or a cross-sectional slice through the domain. Adjustable parameters include:

Wavenumber k — controls wavelength and diffraction regime · Source type — point source (spherical wave) or plane wave incidence · Obstacle shape — sphere, cube, or cylinder, placed interactively in the domain · Visualisation mode — real part, magnitude, or phase on a 2D slice or 3D isosurface · PML thickness — trade accuracy against computational cost.
All computations run in a compiled WebAssembly module directly in the browser. No server or GPU required.

The 3D simulation connects naturally to the diffraction module: X-rays interacting with a crystal lattice satisfy the same Helmholtz equation, and Bragg diffraction emerges from the constructive interference of waves scattered by periodic scatterers.