Skip to main content

A general purpose Smoothed Particle Hydrodynamics framework

Project description

PySPH: a Python-based SPH framework

|Travis Status| |Shippable Status| |Appveyor Status| |Codeship Status|

**PySPH has moved here:**

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 <>`_.

PySPH allows users to write their high-level code in pure Python. This
Python code is automatically converted to high-performance Cython which
is compiled and executed. PySPH can also be configured to work
seamlessly with OpenMP and MPI.

The latest documentation for PySPH is available at
` <>`_.

.. |Travis Status| image::
.. |Shippable Status| image::
.. |Codeship Status| image::
.. |Appveyor Status| image::
Here are `videos
of some example problems solved using PySPH.


- Flexibility to define arbitrary SPH equations operating on particles
in pure Python.
- Define your own multi-step integrators in pure Python.
- High-performance: our performance is comparable to hand-written
solvers implemented in FORTRAN.
- Seamless multi-core support with OpenMP.
- Seamless parallel support using
`Zoltan <>`_.

SPH formulations

PySPH ships with a variety of standard SPH formulations along with
basic examples. Some of the formulations available are:

- `Weakly Compressible SPH
(WCSPH) <>`_
for free-surface flows (Gesteira et al. 2010, Journal of Hydraulic
Research, 48, pp. 6--27)
- `Transport Velocity
Formulation <>`_ for
incompressilbe fluids (Adami et al. 2013, JCP, 241, pp. 292--307)
- `SPH for elastic
dynamics <>`_ (Gray
et al. 2001, CMAME, Vol. 190, pp 6641--6662)
- `Compressible SPH <>`_
(Puri et al. 2014, JCP, Vol. 256, pp 308--333)


Up-to-date details on how to install PySPH on Linux/OS X and Windows are
available from
`here <>`_.

If you wish to see a working build/test script please see our `shippable.yml
<>`_. For
Windows platforms see the `appveyor.yml

Running the examples

You can verify the installation by exploring some examples. A fairly
quick running example (taking about 20 seconds) would be the

$ pysph run elliptical_drop

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

$ pysph view elliptical_drop_output/

A more interesting example would be a 2D dam-break example (this takes about 30
minutes in total to run)::

$ pysph run dam_break_2d

The solution can be viewed live by running (on another shell)::

$ pysph view

The generated output can also be viewed and the newly generated output files
can be refreshed on the viewer UI.

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

$ pysph run dam_break_3d

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

.. figure::
:width: 550px
:alt: Three-dimensional dam-break example

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

$ pysph run cavity

This runs the driven cavity problem using the transport velocity formulation of
Adami et al. The output directory ``cavity_output`` will also contain
streamlines and other post-processed results after the simulation completes.
For example the streamlines look like the following image:

.. figure::
:width: 550px
:alt: Lid-driven-cavity example

If you want to use PySPH for elastic dynamics, you can try some of the
examples from the ``pysph.examples.solid_mech`` package::

$ pysph run solid_mech.rings

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

.. figure::
:width: 550px
:alt: Collision of two steel rings

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

There are many more examples, they can be listed by simply running::

$ pysph run


PySPH is primarily developed at the `Department of Aerospace
Engineering, IIT Bombay <>`_. We are grateful
to IIT Bombay for their support. Our primary goal is to build a
powerful SPH based tool for both application and research. We hope that
this makes it easy to perform reproducible computational research.

Lead developers:

- `Prabhu Ramachandran <>`_
- Kunal Puri

Earlier developers:

- Pankaj Pandey (stress solver and improved load balancing, 2011)
- Chandrashekhar Kaushik (original parallel and serial implementation in 2009)


If you have any questions or are running into any difficulties with PySPH,
please email or post your questions on the pysph-users mailing list here:

Please also take a look at the `PySPH issue tracker

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
PySPH-1.0a5.tar.gz (2.4 MB) Copy SHA256 hash SHA256 Source None Sep 16, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page