Skip to content
Lab
numerical acoustics FDTD · diffraction · phased arrays · Doppler · room modes

Wave Lab

Nothing here is drawn from a formula. The 2D acoustic wave equation is solved step by step on a staggered FDTD grid, so reflection from walls, diffraction through slits and interference between array elements all come out of the simulation. The tables then put those measurements next to λL/d, the array factor, the Doppler formula and the room-mode frequencies, and show the error. Drag the listener around and the level and pitch measured at its two ears become sound.

solver2D FDTD · Yeegrid512 × 300 · 1 cmboundarysplit-field PMLchecks10 analytic tests
Experiments
t 0.00 ms READY
Pressure p(x, y, t) left ear right ear theory
drag the listener
L ear—
R ear—
ILD L−R—
heard f—
fringe Δy—
theory—
Listener · ear signals —
Listener · spectrum —
Screen intensity FDTD (lock-in) Huygens prediction λL/d spacing settling
Measured vs theory settling
QuantityFDTDTheoryΔ

Sweep queued

Wave equation · FDTD

∂p/∂t = −c ∇·v′ + s(x, t),  ∂v′/∂t = −c ∇p (v′ = ρc·v)

v′xn+½ = v′xn−½ − S (pi − pi−1)n,  pn+1 = pn − S ∇h·v′n+½

S = cΔt/Δx = 0.6 ≤ 1/√2  ·  sin(ωΔt/2) = S·√(sin²(kxΔx/2) + sin²(kyΔx/2))

Staggered Yee grid, second order in space and time. The second relation is the scheme's own dispersion: waves resolved by fewer cells travel slightly slower than c, which the panel reports as cnum/c.

Boundaries · sources

p = px + py,  ∂px/∂t + σxpx = −c ∂v′x/∂x

σ(ξ) = σmax(ξ/L)²,  σmax = 3c·ln(1/R)/2L,  R = 10−5

rigid walls: v′·n = 0  ·  point source: |p(1 m)| = A via |p| = (ωQ/4)·|H0(kr)|

Split-field PML with exponential time stepping; a pulse test measures its reflection at about −100 dB. Sources are injected on a Gaussian footprint so moving ones don't radiate grid noise.

Theory under test

maxima: d sinθ = mλ  ⇒  Δy ≈ λL/d  (small angle)

I(y) ∝ |Σapertures ½(1+cosθ) eikr/√r|²

The Huygens sum uses the true path lengths to the screen, so it includes the large-angle and near-field corrections that λL/d leaves out.

What is modelled

What is computed, and what it is checked against

Pressure and particle velocity live on grids offset by half a cell, and ∂p/∂t = −c∇·v′, ∂v′/∂t = −c∇p are integrated to second order. A split-field PML absorbs at the outer boundary; walls are rigid, with zero normal velocity. Each experiment asks one question. Does the fringe spacing really follow λL/d as the slits move apart? Does a delayed array send its beam where it was told? When the element spacing passes λ, do grating lobes appear where predicted? Is the pitch ahead of and behind a moving source f/(1∓M)? Does the room resonate at fmn?

The same engine is checked by scripts/test-wave.ts: wave speed (within 1% of the scheme's dispersion relation), 1/√r spreading and source calibration, PML reflection (about −100 dB), array main-lobe and grating-lobe angles, fringe spacing (including the live lock-in readout the page shows), Doppler shift at fixed mics and at a listener while the pitch sweeps, and room-mode frequencies.

Honest scope

What is simplified

  • The simulation is 2D, so every source is a line source normal to the plane and free-field pressure falls as 1/√r, not 1/r.
  • Air is lossless and linear. Only the room has a uniform loss γ, and its walls are perfectly rigid.
  • Waves resolved by few cells travel slightly slow (numerical dispersion). The panel shows this as cnum/c, and it matters most where wavelengths shrink, such as ahead of a fast source.
  • The array's measurement arc (R = 2.1 m) is not in the far field of a long array, so it is compared with the exact sum of Green's functions at that radius.
  • The simulation runs hundreds of times slower than real time. The sound is not the waveform played back but a sine resynthesised from each ear's measured level and zero-crossing pitch, and the phase between the ears is not reproduced.
  • Heard pitch is a zero-crossing count over the last six periods, so while it sweeps it lags the instantaneous f′(t). The table compares it with f′ averaged over the same window; the instantaneous curve is drawn dotted.
  • Supersonic runs show the Mach cone, but no single heard frequency is predicted there: several emission times arrive at once.