Simulation of mixing fluids for Physically-based Simulation at ETH Zurich
Name | 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 |
# Build
mkdir build
cd build
cmake ..
make -j8
# Run
cd cocktails
./coktails
We used the dummy project from the lecture as a template.
- Headers: cocktails/include
- Source: cocktails/src
- Main class: main.cpp
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.
You can choose between two different types of simulation:
- SphSimulation - the vanilla SPH simulation
- DCSPHSimulation - the density contrast SPH simulation
A fluid is described by a Fluid instance and defines SPH parameters. Each fluid instance contains a collection of Particles.
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
- GeneratingSource - Continuously releases new particles
- EmittingSource - Emits blocks of particles at some interval
Main reference: Particle-Based Fluid Simulation for Interactive Applications
For better interaction of fluids with different densities. Main reference: Density Contrast SPH Interfaces
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
Main reference: Particle-Based Fluid Simulation for Interactive Applications
- 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