Coder Social home page Coder Social logo

korzen / pysph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from benma/pysph

0.0 2.0 0.0 980 KB

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

Makefile 0.01% Python 93.67% Shell 0.04% C 6.29%

pysph's Introduction

#pysph

pysph screenshot

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.
  • how to make and use bindings to the Cg runtime libraries in Python.

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 [number of particles]. Start with python main.py 8000 and slowly scale the number of particles up.

You can disable the advanced rendering by using python main.py --disable-advanced-rendering [number of particles]. For more options, run python main.py --help.

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
$ source pysph_env/bin/activate
$ git clone http://git.tiker.net/trees/pyopencl.git
$ cd pyopencl/
$ python ./configure.py --cl-enable-gl
$ python setup.py build
$ python setup.py install --prefix=/path/to/pysph_env/ --optimize=1 

$ python /path/to/pysph/main.py

On Windows

Limitations

Screen space rendering is not complete. It is not optimized for speed. Also, the rendering at the boundaries is not properly dealt with yet, you can see the artefacts in the screenshots.

The program crashes when using an AMD card. I welcome pull requests from AMD users.

pysph's People

Contributors

benma avatar

Watchers

James Cloos avatar Przemyslaw Korzeniowski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.