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\left[1+E\sin\left(\frac{m\pi x}{L_x}\right)\right]\left[1+E\sin\left(\frac{n\pi y}{L_y}\right)\right].$

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\left(\frac{m \pi x}{100}\right)\cos\left(\frac{m \pi y}{100}\right),$

on a square domain.

• Load this damped simulation, where initially $d=0$.
• Try increasing the damping $d$ to, for example, $d=0.01$ to observe how this changes the wave propagation into the domain from the boundaries.
• What happens when you play with the frequency, $m$?