>>> Does anybody know how either of these simulations actually work?
>>
>> I suspect they solve the differential equations in question :-D
>
> No... really? :-P
Really.
The wave tank one is easy, for every "pixel" it simply solves the wave
equation.
http://en.wikipedia.org/wiki/Wave_equation
It may look scary if you don't recognise the symbols, but the maths is
actually quite trivial. All the wave equation says is that the 2nd
derivative wrt to time (ie acceleration) of the value of each pixel is
proportional to the 2nd derivative of the value wrt to distance summed over
every axis.
It's easy to code, you can just take the difference between neighbouring
pixel values twice to work out the 2nd derivative in the x and y direction
and hence the acceleration. Then the acceleration can be used to work out
the velocity and new value using Euler integration.
Post a reply to this message
|