# Integrating a wavelike equation with absorbing boundary conditions

I am trying to numerically solve the following equation:

$$\frac{\partial^{2} \phi}{\partial t^{2}}-\frac{\partial^{2} \phi}{\partial x^{2}}+V(x) \phi(x, t)=0$$ On some domain, with: $$\phi(x, 0) = I(x)$$

$$\frac{\partial \phi(x, 0)}{\partial t} = 0$$

And with non-reflecting (absorbing) boundary conditions.

I am using finite difference method, so I get the following:

$$\phi_{i}^{j+1}=-\phi_{i}^{j-1}+2 \phi_{i}^{j}+r^2\left(\phi_{i+1}^{j}-2 \phi_{i}^{j}+\phi_{i-1}^{j}\right) - (\Delta t)^2V_{i}\phi_{i}^{j}\,\,\, (1)$$, where $$j$$ is used for time and $$i$$ for position, $$r = \frac{\Delta t}{\Delta x}$$ and $$\Delta t$$, $$\Delta x$$ are the time and space steps.

For $$j = 0$$, I use the $$\frac{\partial \phi(x, 0)}{\partial t} = 0$$ condition and the central difference approximation, $$\left(\frac{\partial \phi}{\partial t}\right)_{j} = \frac{\phi_{j+1}-\phi_{j-1}}{2 \Delta x}$$, to get:

$$\phi_{i}^{1}= \phi_{i}^{0}+\frac{r^2}{2}\left(\phi_{i+1}^{0}-2 \phi_{i}^{0}+\phi_{i-1}^{0}\right) - \frac{(\Delta t)^2}{2}V_{i}\phi_{i}^{0} \,\,\, (1')$$

To accommodate the boundary conditions I use the advection equation $$\frac{\partial \phi}{\partial t}=- \frac{\partial \phi}{\partial x}$$, again I use the central difference approximation, and I substitute into (1) to get:

$$(1+r) \phi_{i, j+1}=2 r^{2} \phi_{i-1, j}+2\left(1-r^{2}\right) \phi_{i, j}-(1-r) \phi_{i, j-1}\,\,\, (2)$$.

For $$j = 0$$ I use the same idea as before and I get:

$$\phi_{i}^{1} = (1 - r^2) \phi_{i}^{0}+r^2\phi_{i-1}^{0}-\frac{(\Delta t)^2}{2}V_{i}\phi_{i}^{0}\,\,\, (2')$$.

Now I am trying to implement this using python, and I use the following logic:

For the interior points I use equations (1), and (1'). For the boundary points I use equations (2), and (2'). But the results that I get are those for reflecting boundary conditions not absorbing ones.

I am using python, and if necessary I can post the code that I have written.

Any help or advice is very much appreciated. I also would appreciate any resources or references. Thanks

• I don’t quite follow why the advection equation appears? Are you solving the wave equation or advection-diffusion? This is for finite volume method, but may provide some insight danieljfarrell.github.io/FVM – boyfarrell Jan 15 at 13:44
• @ boyfarrel I am solving the wave equation, but using the advection equation to account for the non-reflecting boundary conditions. – Joel Jan 15 at 13:51