A delay fps
Use your fingers or mouse to control the model (hold shift key or use mouse wheel to zoom it). Canvas is matched to your browser window.

Stream. Boundary conditions

The shallow water equations on 2×1 rectangle (1024×512 points) with periodic boundaries, wavy bottom
    H(x,y) = h0 sin(4πx) cos(2πy)
and nonzero initial massflow Jx(x,y) = J0. To vivify the scene Jx is modulated at the left border line as
    Jx(0,y) = Jx(0,y) [1 + A sin(t/to)]     (*)
(for A = 0 the flow goes to a steady state with time). The (*) condition generates two opposite waves at the border. 16×16 markers show the water flow (the stream without markers).

Rendering boundary lines

To make calculations we render into FBO the "unit" square with coordinates (texture coordinates are added too)
  var x0 = -1 + 1/nx, t0 = (x0 + 1)/2;
  var data = new Float32Array([-1,-1, 0,0,  -1,1, 0,1,  1,-1, 1,0,  1,1, 1,1,
    x0,-1, t0,0, x0,1, t0,1]);
At first I used the first 2 points to draw the left border line. Chrome team explained me that only half of this (1 pixel width) line lies at the viewport left border. So to render the border line accurately we need to displace it on 1/2 of the pixel size. I.e. we shall use 5 and 6 points.

The only pity - I can't see any waves in Chrome with NVidia OpenGL drivers :(

The stream seams wavy but not as turbulent as Energy2D Java based simulations. I'll try them further.

Simulations on GPU
updated 10 June 2011