# Interactive Fluid Simulation and Terrain Erosion

This work has been done as part of a project for the ETH course “Physically Based Simulation”. The program simulates water and erosion to model the impact on terrain during rainfall. The source code is available on Github.

The shallow water equations are based on a simple “pipe-based” model:

- Terrain height and water height are added to “cell height”.
- Each cell has an
**outflow**in 4 directions: $$f^L_{t+\Delta t}(x,y) = \max\left(0, f_t^L(x,y) + \Delta t \cdot A \cdot {g \cdot \Delta h^L (x,y) \over l} \right)$$ - The water height is updated by adding in- and outflux: $$\Delta V(x,y) = \Delta t \cdot \left( \sum f_in - \sum f_out \right)$$
- The sediment is transported with semi-Lagrangian advection.

More information on the computation of the sediment transport, water levels and evaporation can be found in [Mei et al., 2007].

The simulation is based on the following papers:

- Fast Hydraulic Erosion Simulation and Visualization on GPU [Mei et al., 2007]

The project was a collaboration between Adrian Blumer, Sabina Schellenberg and me.

- Programming Language: C++
- Libraries: GLFW, OpenGL
- Source code