We now consider an inhomogeneous wave equation,

$\pdd{u}{t}=\vnabla\cdot(f(x,y)\vnabla u),$

with homogeneous Neumann (aka no-flux) boundary conditions. This equation can be solved numerically as long as $f(x,y)>0$ for all $x,y$ in the domain.

• Load the interactive simulation, which uses the example

$f(x,y) = D(1+E\sin(m\pi x/L_x))(1+E\sin(n\pi y/L_y)).$

Importantly, we need $\lvert E\rvert<1$ to ensure the solution makes sense.

• You can change the values of $m$ and $n$ to observe different patterns of regions where waves propagate at different speeds. In particular, using the the function $f(x,y)$ above will lead to corners inside of the domain with very slow wave speeds, and these will become visually apparent quickly.

• Unlike in the homogeneous case, we by default plot $u$ here, but you can change this to $v$ by clicking .

### Damped waves and inhomogeneous boundaries

We next consider the damped wave equation,

$\pdd{u}{t} +d\pd{u}{t}=D\nabla^2 u,$

with inhomogeneous Dirichlet boundary conditions,

$u|_{\partial \Omega} = \cos(m x \pi/100)\cos(m y \pi/100),$

on a square domain. An undamped version of this equation ($d=0$) is given here. You can vary the frequency $m$, or increase the damping $d$ to, for example, $d=0.01$ to observe how this changes the wave propagation into the domain from the boundaries.