Fluid Simulation
A downloadable game
- Purpose: Implements a basic SPH simulation for fluid dynamics using C++ and SFML for rendering.
- Initialization:
- Initializes particles, screen dimensions, and simulation parameters.
- Sets up a spatial hashing system for efficient neighbor searches.
- Positions particles either in a grid pattern or randomly (commented out).
- Simulation Update:
- Assigns particles to grid cells for optimized neighbor search.
- Calculates the density and pressure of each particle based on neighbors.
- Computes the pressure forces acting on particles.
- Updates particle positions, velocities, and accelerations based on forces and constraints.
- Rendering:
- Uses SFML to draw particles on the screen.
- Iterates over particles to set positions and colors, then renders them as points.
- Density and Pressure Calculation:
- Computes particle density using neighbor distances and a smoothing kernel.
- Calculates pressure forces between particles and includes viscosity effects.
- Parallel Processing:
- Utilizes C++17 parallel algorithms to enhance performance.
- Executes particle updates and calculations in parallel for efficiency.
- Boundary Handling:
- Ensures particles remain within screen boundaries by reflecting velocities and adjusting positions if they collide with edges.
- Conclusion:
- Demonstrates fluid simulation through particle interactions and efficient state updates.
- Optimized for real-time applications using spatial hashing and parallel algorithms.
GitHub Link
Status | Released |
Author | Ishant Agarwalla |
Leave a comment
Log in with itch.io to leave a comment.