# Complex boundary conditions for a wave equation

Assume I have a wave equation: $$\frac{d^2u}{dt^2}=c^2 \nabla^2 u$$

This equation is defined on an arbitrary spatial domain $$\Omega$$. In order to solve it, I use a regular grid discretization of $$u$$, then each time step I advance this equation in time using FFT->advance->IFFT (ignoring boundary conditions), then I correct for boundary conditions in the space-time domain, then I proceed to the next time step, etc. Basically it's a predictor-corrector scheme.

So my question is about the "correcting for boundary conditions" part. By experimentation I found that if I negate the real part of $$u$$ for each point outside of the computational domain at each step, it acts exactly like enforcing fixed boundary condition $$u(\delta \Omega)=0$$. So this is my first question: I don't even understand exactly why it works, I just randomly found it by fiddling with the solver.

However, rather than fixed boundary, I need (some approximation of) absorbing boundary condition on $$\delta \Omega$$. But I could not find anybody even using this predictor-corrector approach, let alone describing absorbing boundary conditions. Most of the literature where spectral domain solution is described, only use box boundaries where everything is simpler. However, my $$\Omega$$ is definitely not a box and since enforcing fixed boundary using predictor-corrector works well enough, I hoped I could also somehow enforce some sort of absorbing boundary.

So yeah, I'd like to know where this method of calculating boundaries is described, why it works and how to apply it for absorbing boundaries of some sort.

So I found a solution for absorbing boundary that works, at least sort of. There's this Sommerfield Radiation Condition: $$\frac{du}{dt}= \tilde c \vec n \nabla u\ (1)$$. This equation describes simple advection with speed $$\tilde c \vec n$$. Now, let's see how it relates to the wave equation: $$\frac{d^2u}{dt^2}=c^2 \nabla^2 u\ (2)$$
Any solution to this wave equation (2) is represented in 1d by two arbitrary functions (defined by boundary conditions) scrolling past each other with velocities -c and +c, and the solution of Sommerfield Radiation Condition (1) is a single function that scrolls only in the direction of a normal vector $$\vec n$$ with velocity $$\tilde c$$. So if I want some volume to absorb waves, I use this equation with inwards normal and now waves can't escape it. As for velocity $$\tilde c$$, for normal waves it's obviously $$c$$, but for waves at an angle there's some shenanigans that need to be done, but just using $$c$$ is a good starting point.
At first I tried solving (1) with a dummy explicit integrator like this: $$u(t+\Delta t)=u(t)+c\vec n\nabla u \Delta t\ (3)$$ Of course this scheme is notoriously unstable and needs a careful numerical way of calculating $$\nabla u$$: for example, central difference is completely unstable: $$\nabla u \approx \frac{u(x+1)-u(x-1)}{2h}$$ Now, left/right differences: $$\nabla u_- \approx \frac{u(x+1)-u(x)}{h}$$ $$\nabla u_+ \approx \frac{u(x)-u(x-1)}{h}$$ These do work, but with a big caveat: $$u_-$$ is only stable for transporting to the left and $$u_+$$ is only stable when transporting to the right. However, it was still enough for me to try and to make sure that it's going in the right direction. But my FFT solver is unconditionally stable and I also wanted to find hopefully an unconditionally stable solution for the boundaries, and then I remembered: advection in hydrodynamics is classically solved using interpolation.
So in the end I completely dropped $$(3)$$ and just solved (1) directly with an interpolation approach: $$u(x, t+\Delta t)\approx I_u(x+\tilde c\vec n\Delta t)$$ where $$I_u$$ is some interpolation operator (I just used a linear interpolation because it's the easiest to implement). And sure enough, this approach seems to work pretty well. There's obviously some improvements needed to process waves that come at an angle, they need to be decomposed into 2 waves (normal and tangential ones), then $$\tilde c$$ will need to use only the normal component of speed, but I'll leave that for another day.