Water Simulation

Smoothed Particle Hydrodynamics

Adam Alsegård, Benjamin Wiberg, Emil Juopperi, Jonathan Grangien, Simon Hedlund

Navier-Stokes ekvationer

Applying Newton’s second law to fluid dynamics

  • Conservation of mass

    $\frac{\partial {\rho}}{\partial{t}} + \nabla \cdot (\rho \textbf{v}) = 0$

  • Conservation of momentum

    $\rho (\frac{\partial \textbf{v}}{\partial{t}} + \textbf{v} \cdot \nabla \textbf{v} ) = - \nabla p + \mu \nabla^2\textbf{v} + \rho \textbf{g}$

    Pressure-, viscosity- and external forces

Smoothed Particle Hydrodynamics (SPH)

  • Calculation of a property $A$ at position $\textbf{r}$:

    $A_S(\textbf{r}) = \sum_{j}(m_j\frac{A_j}{\rho_j} W(\textbf{r} - \textbf{r}_j, h))$

Boundary conditions

Fluidparametrar

Implementation

  • Matlab
  • C++
  • OpenCL
    • Multi-core computing
    • CL-GL shared memory

Spatial partitioning

  • Uniform grid

Smoothing kernels

Point-splatting

Demo