/cocktail-mixing

A SPH based simulation for cocktail mixing. Final project of the ETH course Physically-based Simulation (2020).

Primary LanguageC++

Fluid Simulation Project for PBS

Simulation of mixing fluids for Physically-based Simulation at ETH Zurich

Group members

Name E-Mail Legi No.
Viviane Yang vyang@ethz.ch 16-944-530
Daniel Sparber dsparber@ethz.ch 17-948-191
Jela Kovacevic jelak@ethz.ch 15-923-428

Install & Run

# Build
mkdir build
cd build
cmake ..
make -j8

# Run
cd cocktails
./coktails

Code Structure

We used the dummy project from the lecture as a template.

The main class handles the initialization of the simulation and starts a simple GUI that visualizes the simulation and can be used to tweak various parameters.

Simulations

You can choose between two different types of simulation:

Fluids

A fluid is described by a Fluid instance and defines SPH parameters. Each fluid instance contains a collection of Particles.

Sources

A Source generates particles. Sources that create particles at initialization are:

  • BlockSource - generates a block of particles
  • CustomSource - generates particles based on a .xyz file
  • StateSource - generates particles from a saved state (i.e. restores particles)

Additionally, there are two sources that continuously generate particles

Features

Basic SPH Simulation

Main reference: Particle-Based Fluid Simulation for Interactive Applications

Density Contrast SPH

For better interaction of fluids with different densities. Main reference: Density Contrast SPH Interfaces

Boundary Handling

Boundaries are modeled as particles. This allows us to use arbitrary shapes. Given a Mesh, we use Possion-Disk-Sampling to generate particles.

For better boundary handling, we implemented a radial repulsion. Our main reference: SPH particle boundary forces for arbitrary boundaries

Surface tension

Main reference: Particle-Based Fluid Simulation for Interactive Applications

Performance

  • Multithreading: Run calculations for a simulation step on all available CPU cores.
  • Optimized kernels: Precompute all constant parameters
  • Uniform grid neighbor search
  • Skip unnecessary computations for boundary particles

Additional References