
Sample Applications 411
the image domain. Thus, enforcing the boundary conditions is a postprocess-
ing task. Multiple shaders are used for this task and use ping-pong buffers.
The shaders are executed in pairs.
The boundary condition n(x) · u(x,t) = 0 may be applied on the grid
solely by setting the appropriate velocity components to zero at the boundary
cells. However, this introduces some discontinuity in the velocity near the
boundary. To counteract this, a zero-derivative condition is also applied. The
grid cells adjacent to the boundary are copied to the boundary first, then the
appropriate components are set to zero.
One shader of the pair is resp ...