Simulation - Smoothed-Particle Hydrodynamics

Path of the code: [10_sph]
The objective is to model a fluid simulation using SPH model.
So far, only the gravity force is applied on the particles
The blue color around the particle comes from a field function set as \(f(p)=\sum_i exp\left(-\left(\|p-p_i\|/\sigma\right)^2\right)\) and displayed as a colored texture to give the visual impression of continuous fluid material.
> Fill the function "update_density" that set the density at each particle position \(\rho_i\) using a smooth kernel
> Complete the function "update_acceleration" to add the force component related to pressure and check that the solution seems reasonable (before adding viscosity forces).

Example obtained without viscosity using 20 integration steps for each frame
> Add the viscosity component to the acceleration and observe the behavior for various viscosity (you may need to decrease the integration time step for large viscosity value).

Adding viscosity

Example with more samples

Extensions