# Let waves out through a wall Use this when a wave of one frequency should leave the domain through a face without being thrown back: the open end of a duct, a window. ## Steps 1. Write the Helmholtz equation with the wave number $k$ as a number: `pm.laplacian(w) + k**2 * w`. 2. On the open face give the condition $\partial w/\partial n - i k\,w = 0$: `sp.Eq(pm.normal_derivative(w) - sp.I * k * w, 0)`. 3. Give the other faces their conditions and solve. The solution is complex. ## Example A duct with hard walls above and below. A wave is driven at its left end and leaves through its right end: ```python import numpy as np import sympy as sp import pdemagic as pm x, y = sp.symbols("x y", real=True) w = sp.Function("w")(x, y) k = 7 duct = pm.Box({x: (0, 2), y: (0, 1)}) hard = sp.Eq(pm.normal_derivative(w), 0) walls = { (x, 0): sp.Eq(w, 1), # driven (x, 2): sp.Eq(pm.normal_derivative(w) - sp.I * k * w, 0), # open (y, 0): hard, (y, 1): hard, } leaving = pm.solve( pm.Problem(sp.Eq(pm.laplacian(w) + k**2 * w, 0), domain=duct, boundary=walls) ) leaving.plot(part="real") assert leaving[w].dtype == complex # Nothing comes back: the wave is exp(ikx), with the amplitude 1 everywhere. X, Y = leaving.mesh() assert abs(leaving[w] - np.exp(1j * k * X)).max() < 1e-10 ``` ## Notes - The sign belongs to the time dependence $e^{-i\omega t}$, in which $e^{ikx}$ travels towards larger $x$. With $+ik$ in the condition the wave would come in. - The condition is exact for a wave that meets the wall head-on. A wave that arrives at an angle is partly reflected. - The same condition works on a face of a round domain and on a piece of the boundary of a [shape in the plane](../topics/regions.md). - It is for waves of one frequency. A condition cannot hold a derivative in time yet, so a problem in time has no wall that lets waves out. - In free space no wall is needed: pdemagic returns the solution in which the sources send waves out and nothing comes in. - [Waves of one frequency](../topics/helmholtz.md) explains the equation and [Complex unknowns](../topics/complex.md) the result. The gallery has [a room with an open window](../gallery/room-with-an-open-window.md) and [a harbour](../gallery/harbour.md).