// update p(x,y)
for all cells (x,y) {
px = vx(x-1,y ) - vx(x+1,y );
py = vy(x ,y-1) - vy(x ,y+1);
p(x,y) = (px+py)*0.5;
}
// update velocities
for all cells (x,y) {
vx(x,y) += ( p(x-1,y ) - p(x+1,y ) )*0.5;
vy(x,y) += ( p(x ,y-1) - p(x ,y+1) )*0.5;
if ( frictionTurnedOn ) {
vx(x,y) *= 0.99;
vy(x,y) *= 0.99;
}
}
More information about the algorithm.
Left-mouse button drag: stir
Right-mouse button drag: change radius of spoon