Every grid ends somewhere. For a string, a drum or a room with hard walls, the end of the grid is a physical boundary and Chapters 2 to 6 imposed it. For sound radiating into open space it is not: the grid has to end, but the sound should behave as though it had not. This chapter compares four ways of ending a grid, and it needs a reference that is exact for a problem without any closed form.
A reference from causality#
Take the leapfrog scheme of Chapter 4 on a square region, with a pulse of sound released inside it. The exact solution of the two-dimensional wave equation in free space for this initial condition exists as an integral, but it is not what the grid computes: the grid computes its own free-space solution, dispersion and all, and a boundary treatment should be judged by how well it reproduces that, not by the scheme's interior error, which is the subject of other chapters.
The grid's free-space solution can be computed exactly. An explicit scheme moves information by at most one node per step, so a grid that extends nodes beyond the region on every side, with any condition at all on its far edges, cannot be influenced by those edges anywhere in the region during steps. Inside the region, for those steps, it is the free-space solution of the scheme, to rounding error. The driver runs this larger grid with its own code, and whatever the method's region contains that the reference's does not came back from the method's edge.
Four edges#
The script offers four treatments, all around the same interior scheme.
A rigid wall, , imposed by a mirrored ghost node. It reflects everything, with the same sign, and it is here as a baseline.
Mur's condition (Mur 1981) discretises the one-way wave equation on each edge, which lets a wave arriving square-on leave without reflection. A wave arriving at angle from the normal is reflected with amplitude : 0.17 at and a third at . The corners, where two edges meet, get a cruder average. It costs nothing beyond the region itself.
A damping layer of extra nodes on every side, in which the equation becomes , with rising from zero as the square of the depth into the layer. A wave is damped on its way in, reflected by the zero-displacement edge behind the layer, and damped again on its way out. Its difficulty is that the change of is itself a change of medium and reflects part of the wave before it is damped. A gentle profile reflects less but needs a wide layer to damp enough.
A perfectly matched layer (PML) of nodes (Berenger 1994). The scheme is rewritten in the pressure-velocity form of the introduction, on a staggered grid, which in the region is exactly the same leapfrog scheme; in the layer the pressure is split into the parts driven by the and velocities, and each is damped only in its own direction. In the continuum this layer absorbs waves at every angle and every frequency without reflecting any of them, because it is equivalent to continuing the equation into complex coordinates. On the grid, the steps in its damping profile reflect a little.
The region is a 2 m square with 100 intervals, the pulse is released 0.7 m from its left edge, and the run lasts 8.5 ms, long enough for the pulse to reach every edge and for what comes back to cross most of the region. The number reported is the energy of the difference from the reference over the region and the whole run, relative to the reference's own energy.
The rigid wall returns more energy than the reference keeps, dB, as it should. Mur's condition returns dB, about a two-hundredth of the energy, mostly from the waves that meet the edges obliquely and from the corners; the difference panel shows the reflected fronts, strongest where the pulse arrived at a glancing angle. The damping layer at returns dB, worse than Mur's condition with no layer at all.
Reflection against cost#
| layer width | 5 | 10 | 20 | 40 |
|---|---|---|---|---|
| damping layer | −4.1 dB | −8.8 dB | −14.8 dB | −21.3 dB |
| PML | −62.1 dB | −80.2 dB | −95.2 dB | −107.3 dB |
With no layer, Mur's condition gives dB and the rigid wall dB.
The damping layer improves by about 6 dB for every doubling of its width, and even at 40 nodes, which is 0.8 m and more than doubles the number of nodes in the computation, it does no better than Mur's condition. The reflection from its own gradient is the limit, and a stronger damping profile makes that worse rather than better; the profile used here was the best of the few we tried. The PML at five nodes returns dB, forty decibels better than anything else, and it gains between 12 and 18 dB per doubling after that. At every cost measured it is the best of the four by a wide margin.
The PML is not free. Its layer carries four fields instead of one, and in this implementation it runs at a little under half the speed per node of the plain scheme, so a five-node PML costs about twice as much as Mur's condition on this region, or a little more. On a larger region the layer's share of the work falls, and on a three-dimensional one it is the standard choice for exactly this reason. Mur's condition remains worth knowing: it is simple, it costs nothing, and dB is enough for some purposes.
Hearing the difference#
A longer run makes the reflections audible. The region is now a 3 m square with 60 intervals, the pulse is a low thump, and the microphone is 1.2 m from the source; the run lasts 0.3 s, which is about 34 crossings of the region.
The rigid box rings: the pulse reflects back and forth between parallel walls, and the recording is a dense, pitched flutter that continues for the whole run. Mur's condition removes most of it, leaving a single thump and a faint tail of reflections. The PML leaves the thump alone. Even that is not a single click, and the reason is physical rather than numerical: in two dimensions, a pulse from a point leaves a slowly decaying wake behind its front, because a point in a plane is really an infinite line source in space, and sound from the distant parts of the line keeps arriving after the nearest part has passed. Sound in three dimensions does not do this, which is one reason the two-dimensional computations of this chapter are a model of the method, not of a room.
What this chapter establishes#
A grid's edge can be made to behave like open space, and how well is a matter of method more than of effort. Mur's condition is free and returns about a two-hundredth of the energy; a damping layer, however wide, does little better; a perfectly matched layer of a few nodes returns less than a millionth. The comparison was only possible because the reference was exact by causality, which is a construction worth remembering: whenever a scheme's own free-space solution is what is needed, a larger grid that runs for fewer steps than it is wide provides it exactly.