Wave simulation without reflection on the boundaries I would like to numerically simulate a wave (let's say in a string) with different boundary conditions:


*

*Fixed endpoints

*Periodic 

*Boundless


$\varphi(x, t)$ is the value of the wave (vertical position of the string) at pixel $x$ captured by a 1-D array phi. For fixed endpoints, I simply pad my array with a zero on the left and one on the right (for numerical differentiation purposes). For the periodic boundary, I pad the left side with the last element (phi[-1] in Python syntax) and I pad the right side with the first element (phi[+1]).
How do I handle the boundless case so a pulse would just travel without reflection similar to the figure below? What is the common term for this type of boundary? (I do not want to sufficiently increase the number of pixels to solve this problem).

 A: One picture is worth 1000 words. Consider a simple example. For the wave equation $u_{tt}=u_{xx}$, initial and boundary conditions are given:
$u(0,x)=0,u_t(0,x)=0,u(t,0)=f(t),u_t(t,2)+u_x(t,2)=0$
$f(t)=0,t\le 0.01$ or $t\ge1.01$, $f(t)=\sin {t}, 0.01<t<1.01$
To solve this problem we use Method Of Lines. The solution on a coarse grid is shown in the animation.

We give an explanation.
We write the wave equation in the form
$v=u_t+u_x, v_t-v_x=0$
The general solution of the first equation for $v=0$ is $u=f(x-t)$ - wave moving to the right.The general solution of the second equation is $v=g(x+t)$ -wave moving to the left. So that the wave does not reflect from the right border, the condition should be set on the right border $v=u_t+u_x=0$.
How to implement this conditions in the numerical method? The answer depends on the method.
A: You are looking for outflow boundary conditions. The constraint in this case is that the derivative is constant:
$$
\frac {\partial u}{\partial n}=0
$$
where $n$ is the normal direction of the surface (e.g., $x$). This is also probably more commonly known as the Neumann boundary condition.
In numerical language, this would be akin to using phi[N]=phi[N-1].
