Computing first-order partial derivative in discrete time and space

100 Views Asked by At

I have a 1D wave equation:

$\frac{\partial ^2y}{\partial t^2}(x,t)=v^2\frac{\partial ^2y}{\partial x^2}(x,t)$

and a right-side transparent boundary condition:

$\frac{\partial y}{\partial x}=-\frac{1}{v}\frac{\partial y}{\partial t}$

What is the correct discrete approximation of this boundary equation?

I used a centered difference for both of the derivatives and got:

$\frac{y_{m+1,n}-y_{m-1,n}}{2\Delta x}=-\frac{1}{v}\frac{y_{m,n+1}-y_{m,n-1}}{2\Delta t}$

However, I suspect it to be wrong because I get an error propagating from the right boundary in my 1D wave simulation when using the above approximation in the finite difference method.