Author: Laura Wang Qiu
Enjoy this 2D particles simulation made in C++ with CUDA. You can change parameters to visualize the behavior of the particles depending on the applied forces:
- Gravity
- Collision restitution
- Smoothed-Particle Hydrodynamics
Preview:
Fluid systems are widely used in games, industrial simulations, and scientific research in astrophysics, among other fields. These systems can be modeled using two main approaches:
-
Eulerian: This approach focuses on fixed points in space and observes how the fluid flows through these points. It is commonly used for grid-based simulations, where the fluid's properties (e.g., velocity, pressure) are calculated at discrete points in a fixed grid.
-
Lagrangian: This approach tracks individual particles as they move through space, making it ideal for particle-based simulations. It provides a more intuitive representation of fluid dynamics by following the motion of the particles themselves.
This project adopts the Lagrangian approach, using Smoothed-Particle Hydrodynamics (SPH) to simulate the behavior of fluids. SPH is a particle-based method that calculates fluid properties by averaging over neighboring particles, ensuring smooth and realistic simulations.
- SDL2: window and graphics
- ImGui: interface
- CUDA Toolkit: as the GPU programming language used
- Intel oneAPI Base Toolkit: used SYCLomatic to migrate CUDA code to SYCL
