I wrote a simple 2D wave simulation using the following equations:$$\frac{\partial^2 u}{\partial t^2}=c^2\nabla^2u$$Where $\nabla^2$ is the discrete laplace operator using a Von Neumann neighborhood lattice.$$\mathbf {D}^2_{xy} = \begin{bmatrix}    0       & 1 & 0 \\    1       & -4 & 1 \\    0       & 1 & 0 \end{bmatrix}$$This gives the discrete formula:$$\Delta{}^t_{t+1}u_{x,y} - \Delta^{t}_{t-1}u_{x,y} = c^2(u_{x+1,y,t}+u_{x-1,y,t}+u_{x,y+1,t}+u_{x,y-1,t}-4u_{x,y,t})$$Rearranging the terms gives the solution for the next timestep:$$u_{x,y,t+1} = c^2(u_{x+1,y,t}+u_{x-1,y,t}+u_{x,y+1,t}+u_{x,y-1,t}-4u_{x,y,t}) + \Delta^{t}_{t-1}u_{x,y} + u_{x,y,t}$$This seems to work well, but I am currently taking $u=0$ when out of boundary. (which is apparently called the Dirichlet condition)  $$A_{m\times n}\\     \begin{cases}      0, & \text{if}\ (i<0) \lor (j<0) \lor (i\geq m) \lor (j\geq n) \\      A_{ij}, & \text{otherwise}    \end{cases}$$But according to the wave equation, that will make the boundaries act like walls, which waves can bounce on, like this:  Animated ExampleBut I cannot figure out how to make the boundaries pass through as if the grid were infinite. Other simulators do it, but I could not figure out the equations for it.Example of a simulation that has absorbing boundaries, the waves do not reflect on the borders.Is there a simple method that I can apply to my currently used equation? I don't need anything fancy, only something simple to apply and fast to compute.
Discrete wave simulation - absorbing boundaries?
boundary conditions;discretization;numerical modelling;wave propagation