We present an efficient method that uses particles to solve the 2D shallow water equations. These equations describe the dynamics of a body of water represented by a height field. Instead of storing the surface heights using uniform grid cells, we discretize the fluid with 2D SPH particles, as shown in Figure 1, and compute the height according to the density at each particle location. The particle discretization offers the benefits that it simplifies the use of sparsely filled domains and arbitrary boundary geometry. Our solver can handle terrain slopes and supports two-way coupling of the particle-based height field with rigid objects. An improved surface definition is presented that reduces visible bumps related to the underlying particle representation. It furthermore smoothes areas with separating particles to achieve better rendering results. Both the physics and the rendering are implemented on modern GPUs resulting in interactive performances in all our presented examples.
We implement our method in CUDA and run the simulations on a 2.66 GHz Core i7 and NVIDIA GTX 460. We used NVIDIA's PhysX SDK for the rigid body dynamics. The results show that we can simulate and render 128k particles at an interactive rate of 20fps. With the same number of particles but adding 196 objects, the frame rate decreases to 7fps. We note that the particle-based SWE formulation does not reach the same performance as the grid-based SWE models. However, the particle-based approach offers many benefits over grid-based solvers like the simple handling of complex and sparsely filled domains. The choice of a particular solver should therefore depend on the designated simulation scene and application. The benefits of the particle representation is demonstrated in the examples shown in Figure 1 and 2.