Skip to content
/ pysph Public

SPH fluid simulation with advanced screen space fluid rendering, using pyopengl and pyopencl.

Notifications You must be signed in to change notification settings

benma/pysph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

#pysph

pysph is a demo of:

  • sph (smooth particle hydrodynamics) fluid simulation
  • screen space fluid rendering, based on Simon Green's paper Screen Space Fluid Rendering with Curvature Flow
  • how to use Python for these kind of things using the excellent pyopengl and pyopencl libraries.

Also contained are ports of radix sort and bitonic sort to pyopencl. Based on enjalot's work.

Big thanks to Ian Johnson (enjalot) for the radix/bitonic sort and his excellent tutorial: "Adventures in PyOpenCL".

Running:

Run with python main.py.

Dependencies

On Debian Testing (sid): sudo apt-get install python-opengl python-pyside nvidia-cg-toolkit python-numpy python-mako python-pyopencl

And either package providing pyopencl-icd: nvidia-opencl-icd for nvidia users, amd-opencl-icd for ati users.

On Ubuntu: sudo apt-get install python-opengl python-pyside nvidia-cg-toolkit python-numpy python-mako

Unfortunately on Ubuntu (up to 12.04), the package python-pyopencl is outdated and is missing the --cl-enable-gl flag. Using pip also won't work, because it does not configure the package using the --cl-enable-gl flag. You will need to follow the official build instructions here: http://wiki.tiker.net/PyOpenCL/Installation/Linux/Ubuntu.

If you want to isolate the installation of pyopencl, you can still install it in a virtualenv by using:

$ virtualenv --system-site-packages pysph_env

$ wget http://pypi.python.org/packages/source/p/pyopencl/pyopencl-2011.2.tar.gz
$ tar xfz pyopencl-2011.2.tar.gz
$ cd pyopencl-2011.2/
$ python ./configure.py --cl-enable-gl
$ python setup.py build
$ python setup.py install --prefix=/path/to/pysph_env/ --optimize=1 

$ source bin/activate
$ python /path/to/pysph/main.py

About

SPH fluid simulation with advanced screen space fluid rendering, using pyopengl and pyopencl.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published