Wave simulator


A simple pressure wave simulator which I made to see if my idea for a basic simulation would work in a way that looked realistic. Later comparisons with more "correct" simulations have shown that the simple method performs quite well actually.

The Principal idea was to represent a 2D scene as a grid of point object with a certain mass. Those objects were linked to the neighbours by virtual springs. The pressure at any given point would be represented by the point mass' position along the third dimension. That means, the points could be moved perpendicular to the 2D plane, and their distance from the plane would represent the pressure. If a point was moved out, then it would be pulled back in by its neighbours, while they in return would be pulled out towards it. This would generate a wave like motion as seen in the videos.

It turns out that this is actually one of the ways that the wave equation can be derived using Hooks law as described in Wikipedia. In essense this weight-and-spring model does exactly the same as solving the ordinary differential wave equations - it just calls things by different names.

A continuous wave generator, as seen in the videos, is represented by one or more points moving in and out of the plane in a sinus motion.

A heavy dampening material is represented by a larger mass at the points. It takes more energy to bring them into motion, and afterwards it will take a longer time before they stop moving again. That works like a low pass filter, just like an iron core does in electronics. As one can see in the videos, low frequency waves are better capable of traversing such a dampening material, which makes sense, since it is a low pass.

Example videos

Two wave generators with different frequencies. A dampening material is positioned near the bottom and its apparent how the low frequencies are harder to block. If you have ever heard music played through a wall or a floor (sadly, we probably all have heard that), you know that the bass is all that is left after the sound has passed the obstruction.

Another known "feature" of waves, which can be seen, is that high frequency is more focused, while low frequency tends to spread out in all directions.


A more complex scene is created. There are three continuous wave generators with different frequencies, and one impulse. The scene consists of blocks of dampening material and material which is impenetrable.


A still image from an earlier version of the simulator. A pressure wave was generated near the brown heavy material and propagated out from there before reflecting back from the walls and interfering with its other reflections. Near the top, the wall has a small hole which the waves pass through and spread out from.


The demo program 

The source has been lost, but the exe can be downloaded here. It is using .net 2.0. By clicking the mouse, you can generate an impulse, which will spread out when the simulation is running. Of fun things to try, I can suggest making an impulse inside an object and see how the wave changes its velocity when it reaches the outside. Another thing could be to move the mouse and constantly click just ahead of the wave in some direction. This simulates the shock wave generated by a fast moving object, such as a plane.
Č
ċ
ď
Wave.zip
(6k)
Thomas Grønneløv,
Apr 12, 2011, 11:02 AM