Smoothed Particle Hydrodynamics

Developed by:

Joseph Johnson

CPE471

S19

Description

My project consisted of trying to accurately simulate the motion of water in OpenGl.

Technical Features

Blinn-Phong Shading

The Blinn-Phong Shading Model allowed my program to calculate the amount of reflected light for

each point on each particle from a specified light source.

Multithreading

Simulating the movement of many particles is a very computional heavy task. To decrease the time

spent calculating the position of each particle, I split up the computation among many threads

so that the program would be able to utilyze as much of the CPU as possible to speed up the

calculation. When using threads, you can not guarantee a specific order that the threads will

execute in so I had to figure out a way to synchronize them so that the calculations would be

accurate. To solve this problem, I implemented a semaphor-like class that utilized the atomic

library to make sure each thread was synchronized with all the other threads before moving on

to the next step of the calculation.

Navier–Stokes

To simulate fluid movement of each particle in the system, I used the Navier–Stokes equations.

These equations allow the calculation of forces on each particle from its neighboring particles

that are within a defined radius. With these forces, the position and velocity of each particle

can be determined for each frame to simulate movement of the entire system.

References

Real-Time GPU-based SPH Fluid Simulation Using Vulkan and OpenGL Compute Shaders

Multithreading in C++

Atomic Library C++