What boundary conditions in a wave simulation would avoid reflections?

In simulating an elastic medium as a series of mobile points connected by ideal springs, it's straightforward to model conditions corresponding to a fixed endpoint, which results in an incoming wave reflecting back inverted, or a free endpoint, so that the wave stays the same way up after it reflects.

I'm doing this with crude 1D difference equations - see my implementation in action here, if you're interested.

I feel like avoiding reflections without actually simulating an infinite chain should be a tractable problem, but the only papers I'm finding on it are behind a paywall and/or highly complex. There's an 83-page dissertation on it here, for example, which feels like overkill - but maybe this is just one of those problems that looks like it should be fairly easy, but really really isn't?

Edited to add: I'm looking at the Perfectly Matched Layer technique, and also this book chapter, and starting to worry that some aspects of my physics might be a bit rusty to make sense of this stuff, sixteen years after my degree...

• Are you asking about open boundary conditions in simulations? – honeste_vivere Nov 6 '15 at 22:19
• Absorbing boundary conditions do sound like something that should be easy to implement but they are in fact a tricky business. There's no universal recipe and you need to take them case by case. (Some methods, for example, can be very effective but they are very resonantly tuned to a specific range in frequency.) Things like complex potentials (/refraction indices) or sending your coordinates into the complex plane at an angle ('exterior complex scaling') can work, but they're not necessarily easy to implement. – Emilio Pisanty Nov 6 '15 at 22:34
• If you don't find a good response here, consider cross-posting this at Computational Science. – Emilio Pisanty Nov 6 '15 at 22:35
• – Emilio Pisanty Nov 6 '15 at 23:32

This is, unfortunately, not a simple task in general. My experience on non-reflecting boundary conditions is for the Navier-Stokes equations, but you should be able to do a similar approach for your system. As you noted, a fixed boundary ($u=0$) will lead to one type of wave while a free boundary ($\partial u/\partial x = 0$) leads to another wave. What you need to do is prescribe a $\partial u /\partial x$ so that it negates the wave. In effect, you are applying a damper to the system to absorb the wave.

For the Navier-Stokes equations, this is done by taking the 1D form of the governing equation (normal to the boundary). The system of variables is then recast into the symmeterizing variables (ie. variables are chosen such that the transformed system is symmetric). This gives a decoupled set of equations for the characteristic waves in the system. From this set of equations for the waves, you compute the variable you must impose at the boundary such that you maintain the target value. It is basically using the method of characteristics to decouple the equations.

For example, let's say that I want $u = 10$ on my boundary. A wave is coming towards the boundary and the value of $u$ next to the boundary is $u = 20$. Based on my boundary condition formulation, I compute the $u$ that I must set in my ghost cell (the "fake" cell outside my boundary that is used to enforce boundary conditions).

Okay, so what does this have to do with your problem? Well, you need to take your system of equations (sounds like right now, it's 1D so there is only a x-displacement but later it may be 2D or 3D and form a system) and recast it using a symmeterizing set of variables so that you now have your equations in characteristic space. This will give you equations for the characteristic waves and you use those to compute the target value you must impose to let the wave leave the domain without any reflections.

It looks and sounds scary but it is relatively straight forward math. It is, however, very tedious. You need to know the variable transformation you must use (which is known for the Navier-Stokes, but your system may be different -- could be easier, could be harder). You then do the transformation into characteristic space, find your Jacobians (which should now be diagonal), compute the eigenvalues (wave speeds) and eigenvectors and you're off running.

An alternative approach could be to use a sponge layer type approach. It's really only good for "outflows". But what you do is apply a damper to your solution so it kills the wave. This is what I did for my spring-lattice code I wrote for my masters thesis. A few springs away from the boundaries, add dampers in parallel to your springs. You'll have to hand-tune the damping coefficients (or non-dimensionalize it so you can just use the non-dimensional critical damping coefficient). Depending on the physics of the problem, this might be okay, but you'll wan to apply these conditions away from anywhere that you want something interesting to happen so it doesn't pollute the solution.

• Thanks @tgp2114! I may not have time to really get my head round this for a while yet, but I feel like I'm closer now than I was before, at least. :) For what it's worth, my motivation here is simply to demonstrate some of the characteristic properties of waves - showing how two identical waves travelling in opposite directions produce the appearance of a standing waves, for example - so it really shouldn't matter too much if my approximation throws up some odd behaviour, unless it specifically negates what I'm trying to get at! – Oolong Nov 7 '15 at 17:21

I asked a similar question here and with help of Alex Trounev I got the following answer which I leave here for easy access.

To achieve a non-reflective boundary, we must set the wave propagating from the right wall towards the left to zero. To do so, we can define a new variable that represents the leftward traveling wave (everywhere, not just at the boundary). The usual wave equation is $$u_{tt} = u_{xx}$$ and this new variable can be defined as such:

$$v \equiv u_t + u_x$$ Then the wave equation becomes: $$v_t = v_x$$

Hence, we must set $$v = 0$$ at the right boundary. Replacing $$v$$ with the usual variables, we get:

$$u_t = u_x \;\;\; \text{at the right boundary}$$

I realize this is a late response, but here's an answer anyway:

Since you're working in 1D, there is a very simple absorbing boundary condition that's based on one-way wave equations, not perfectly matched layers.

If you have any wave $u\left(x,t\right)$ moving left with a velocity $v$, then we can write $u\left(x,t\right) = G \left(x + vt\right)$. (See the Wikipedia page for waves.) That satisfies the one-way wave equation $\left(\frac{d}{dx} - \frac{1}{v} \frac{d}{dt} \right)u=0$. A similar equation holds for waves traveling to the right (just flip the sign). So, in a computer simulation, you can enforce the one-way wave equations at the edges of your computational domain to let waves with velocity $v$ leave the computational domain without reflecting. (You'll probably want to use forward or backward -- not centered -- finite differences.)

If you're dealing with a basic elastic material, then $v$ is constant, and the above approach works well. However, when you discretize your wave equation, the dispersion relation is no longer linear, different frequency waves have different group velocities, and the method doesn't work quite as well. That said, the dispersion relation should be approximately linear for a wide range of frequencies (if not, your simulation is doing a poor job simulating an elastic material), and the method should work well.

(tpg2114 may be advocating for something similar. However, the above is not particularly "tedious", so maybe we're talking about different approaches.)