Skip to content

pushkargodbole/GPUPySPH

Repository files navigation

This is the repository for my High Performance Computing course project titled "GPU Extension for PySPH".

Additional details of the project may be found in report.pdf

PySPH: a Python-based SPH framework

Build Status Build Status

PySPH is an open source framework for Smoothed Particle Hydrodynamics (SPH) simulations. It is implemented in Python and the performance critical parts are implemented in Cython.

This codebase is the new approach for PySPH that is heavily based on code generation. It currently supports Cython and is configured to work in parallel.

The latest documentation for PySPH is available at pysph.readthedocs.org.

Features

  • Solver framework to add arbitrary collection of particles.
  • Flexibility to define arbitrary SPH equations operating on particles in pure Python.
  • Any kind of user-defined multi-step integrator.
  • Seamless parallel integration using Zoltan.
  • High-performance: our performance is comparable to hand-written solvers implemented in FORTRAN.

Solvers

Currently, PySPH is capable and has numerous examples to solve the viscous, incompressible Navier-Stokes equations using the weakly compressible (WCSPH) approach. The features of the implementation are:

Installation

To install PySPH, you need a working Python environment. We recommend Enthought Canopy if you are new to Python. Additional dependencies to compile the code are:

  • Cython (ideally version 0.19 and above)
  • Mako

These can be installed from the command line using easy_install Cython mako

Optional dependencies:

If you want to use PySPH in parallel, you will need mpi4py and the Zoltan data management library.

To use the pysph_viewer you will need to have Mayavi installed.

Building and linking PyZoltan

We've provided a simple Zoltan build script in the repository. This can be used as so:

$ ./build_zoltan.sh  INSTALL_PREFIX

where the INSTALL_PREFIX is where the library and includes will be installed. You may edit and tweak the build to suit your installation. However, this script what we use to build Zoltan on our continuous integration servers on drone and shippable.

Declare the environment variables ZOLTAN_INCLUDE and ZOLTAN_LIBRARY. If you used the above script, this would be:

$ export ZOLTAN_INCLUDE=$INSTALL_PREFIX/include
$ export ZOLTAN_LIBRARY=$INSTALL_PREFIX/lib

Install PySPH. The PyZoltan wrappers will be compiled and available.

If you wish to see a working build/test script please see our shippable.yml. Or you could see the build script hosted at drone.io.

Running the examples

You can verify the installation by exploring some examples. A fairly quick running example (taking about 5-10 minutes) would be the following:

$ cd examples
$ python dam_break.py

The solution can be viewed live by running:

$ pysph_viewer

This requires that Mayavi be installed. The saved output data can be viewed by running:

$ pysph_viewer dam_break_output/*.npz

A 3D version of the dam-break problem is also available, and may be run as:

$ python dam_break3D.py

This runs the 3D dam-break problem which is also a SPHERIC benchmark Test 2

IMAGE

PySPH is more than a tool for wave-body interactions:

$ cd examples/transport_velocity
$ python cavity.py

This runs the driven cavity problem using the transport velocity formulation of Adami et al. You can verify the results for this problem using the helper script examples/transport_velocity/ldcavity_results.py to plot, for example the streamlines:

IMAGE

If you want to use PySPH for elastic dynamics, you can try some of the examples from the directory examples/solid_mech

$ cd examples/solid_mech
$ python rings.py

Which runs the problem of the collision of two elastic rings:

IMAGE

The auto-generated code for the example resides in the directory ~/.pysph/source. A note of caution however, it's not for the faint hearted.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages