Skip to content

Ben-Edwards44/Fluid-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fluid Simulator

A particle based fluid simulator written in python.

Normal fluid

Interacting with fluid

Note: The above videos are a lower quality than the origionals due them being compressed into .gif files

About

This project was heavily inspired by this video by Sebastian Lague. This fluid simulator works in a very similar way, and uses similar techniques to, the one showcased in the video.

This simulator uses smoothed particle hydrodynamics (SPH) technique, which is described very well in this paper.

In an attempt to increase performance and allow the simulation of a larger number of particles (as Python is notoriously slow), I have made use of the Numba Python library and the GPU acceleration it provides.

Requirements

  • A supported GPU (listed here).
  • Python 3.11 (slightly eariler or later versions of Python, such as 3.9 or 3.10 may also work).
  • The Numpy, Numba and Pygame libraries.
  • A library made by me called Pygame UI Toolkit.

Possible improvements

  • Improve performance by implementing a bitonic sort that can run on the GPU.
  • Optimise thread and block sizes.
  • Viscoelasiticty.
  • More accurate surface tension.
  • Interactions with objects.

About

A particle based fluid simulator written in Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages