% Absorption profile for an open boundary. % % s = sponge(x, y, L, w, smax) % % All in SI: positions and widths in metres, the result in inverse seconds. % Zero in the interior, ramping up quadratically over a layer of width w % inside each edge of the square [-L/2, L/2]^2 and reaching smax at the wall. % Added to a scene's absorption, this is what makes the finite grid stand in % for an unbounded medium: a wave that leaves the region of interest is % attenuated before it reaches the outer boundary, and whatever reflects off % that boundary is attenuated again on the way back. % % The ramp is gradual on purpose. An absorbing layer is itself an impedance % mismatch, so a sudden one reflects; spreading it over a couple of % wavelengths keeps that reflection small. It is not a perfectly matched % layer, and at grazing incidence it does leak. function s = sponge(x, y, L, w, smax) dx = max(0, w - (L/2 - abs(x))) / w; dy = max(0, w - (L/2 - abs(y))) / w; d = max(dx, dy); s = smax * d.^2; end