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 is implemented in a way that allows a user to specify the entire SPH
simulation in pure Python. High-performance code is generated from this
high-level Python code, compiled on the fly and executed. PySPH can use OpenMP
to utilize multi-core CPUs effectively. PySPH also features optional automatic
parallelization (multi-CPU) using mpi4py and Zoltan. If you wish to use the
parallel capabilities you will need to have these installed.
Here are videos of simulations made with PySPH.
PySPH is hosted on bitbucket. Please see
the bitbucket site for development
details.
Currently, PySPH has numerous examples to solve the viscous, incompressible
Navier-Stokes equations using the weakly compressible (WCSPH) approach. The
following formulations are currently implemented:
PySPH is primarily developed at the Department of Aerospace
Engineering, IIT Bombay. We are grateful
to IIT Bombay for the 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.
We are in the process of writing up an article on the new PySPH
framework as it stands today. In the meanwhile, if you use PySPH and
wish to cite it you may use this:
Prabhu Ramachandran and Kunal Puri, PySPH: A framework for parallel
particle simulations, In proceedings of the 3rd International
Conference on Particle-Based Methods (Particles 2013), Stuttgart,
Germany, 18th September 2013.
2009: PySPH started with a simple Cython based 1D implementation written by
Prabhu.
2009-2010: Chandrashekhar Kaushik worked on a full 3D SPH implementation with
a more general purpose design. The implementation was in a mix of Cython and
Python.
2010-2012: The previous implementation was a little too complex and was
largely overhauled by Kunal and Pankaj. This became the PySPH 0.9beta
release. The difficulty with this version was that it was almost entirely
written in Cython, making it hard to extend or add new formulations without
writing more Cython code. Doing this was difficult and not too pleasant. In
addition it was not as fast as we would have liked it. It ended up feeling
like we might as well have implemented it all in C++ and exposed a Python
interface to that.
2011-2012: Kunal also implemented SPH2D and another internal version called
ZSPH in Cython which included Zoltan based parallelization using PyZoltan.
This was specific to his PhD research and again required writing Cython
making it difficult for the average user to extend.
2013-present In early 2013, Prabhu reimplemented the core of PySPH to be
almost entirely auto-generated from pure Python. The resulting code was
faster than previous implementations and very easy to extend entirely from
pure Python. Kunal and Prabhu integrated PyZoltan into PySPH and the current
version of PySPH was born. Subsequently, OpenMP support was also added in
2015.
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:
https://groups.google.com/d/forum/pysph-users
Fixed major bug with TVF implementation and add support for 3D simulations
with the TVF.
Improve many examples to make it easier to make comparisons.
Many equation parameters no longer have defaults to prevent accidental
errors from not specifying important parameters.
Added support for Scheme classes that manage the generation of equations
and solvers. A user simply needs to create the particles and setup a scheme
with the appropriate parameters to simulate a problem.
Add support to easily handle multiple rigid bodies.
Add support to dump HDF5 files if h5py is installed.
Add support to directly dump VTK files using either Mayavi or PyVisfile.
Improved the nearest neighbor code, which gives about 30% increase in
performance in 3D.
Remove the need for the windows_env.bat script on Windows. This is
automatically setup internally.
Add test that checks if all examples run.
Remove unused command line options and add a --max-steps option to allow
a user to run a specified number of iterations.
Added Ghia et al.’s results for lid-driven-cavity flow for easy comparison.
Added some experimental results for the dam break problem.
Use argparse instead of optparse as it is deprecated in Python 3.x.
Add pysph.tools.automation to facilitate easier automation and
reproducibility of PySPH simulations.
Fix bug with uploaded tarballs that breaks pipinstallpysph on Windows.
Fix the viewer UI to continue playing files when refresh is pushed.
Fix bugs with the timestep values dumped in the outputs.
Fix floating point issues with timesteps, where examples would run a final
extremely tiny timestep in order to exactly hit the final time.
Fix bug with output_at_times specification for solver.
Put generated sources and extensions into a platform specific directory in
~/.pysph/sources/<platform-specific-dir> to avoid problems with multiple
Python versions, operating systems etc.
Use locking while creating extension modules to prevent problems when
multiple processes generate the same extesion.
Improve the Application class so users can subclass it to create
examples. The users can also add their own command line arguments and add
pre/post step/stage callbacks by creating appropriate methods.
Moved examples into the pysph.examples. This makes the examples
reusable and easier to run as installation of pysph will also make the
examples available. The examples also perform the post-processing to make
them completely self-contained.
Add support to write compressed output.
Add support to set the kernel from the command line.
Add a new pysph script that supports view, run, and test
sub-commands. The pysph_viewer is now removed, use pysphview
instead.
Add a simple remeshing tool in pysph.solver.tools.SimpleRemesher.
Cleanup the symmetric eigenvalue computing routines used for solid
mechanics problems and allow them to be used with OpenMP.
The viewer can now view the velocity magnitude (vmag) even if it
is not present in the data.
Port all examples to use new Application API.
Do not display unnecessary compiler warnings when there are no errors but
display verbose details when there is an error.