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 can work with OpenCL and use your GPGPUs. 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 github. Please see the site for development details.
- User scripts and equations are written in pure Python.
- Flexibility to define arbitrary SPH equations operating on particles.
- Ability to 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 GPU support with PyOpenCL.
- Seamless parallel integration using Zoltan.
- BSD license.
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:
- 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)
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.
To see the list of contributors the see github contributors page
Some earlier developers not listed on the above are:
- Pankaj Pandey (stress solver and improved load balancing, 2011)
- Chandrashekhar Kaushik (original parallel and serial implementation in 2009)
You may use one of the following articles to formally refer to PySPH:
- Prabhu Ramachandran, PySPH: a reproducible and high-performance framework for smoothed particle hydrodynamics, In Proceedings of the 15th Python in Science Conference, pages 127–135, July 11th to 17th, 2016. Link to paper.
The following is an older presentation:
- 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
Please also take a look at the PySPH issue tracker.
- Release date: Still under development.
- Remove pyzoltan, cyarray into their own packages on pypi.
90 pull requests were merged for this release. Thanks to the following who contributed to this release (in alphabetical order): A Dinesh, Abhinav Muta, Aditya Bhosale, Ananyo Sen, Deep Tavker, Prabhu Ramachandran, Vikas Kurapati, nilsmeyerkit, Rahul Govind, Sanka Suraj.
- Release date: 26th November, 2018.
- Initial support for transparently running PySPH on a GPU via OpenCL.
- Changed the API for how adaptive DT is computed, this is now to be set in
the particle array properties called
dt_cfl, dt_force, dt_visc.
- Support for non-pairwise particle interactions via the
loop_allmethod. This is useful for MD simulations.
- Add support for
py_stage1, py_stage2 ..., methods in the integrator.
- Add support for
- Support for using different sets of equations for different stages of the integration.
- Support to call arbitrary Python code from a
t, dtto the reduce method.
- Allow particle array properties to have strides, this allows us to define properties with multiple components. For example if you need 3 values per particle, you can set the stride to 3.
- Mayavi viewer can now show non-real particles also if saved in the output.
- Some improvements to the simple remesher of particles.
- Add simple STL importer to import geometries.
- Allow user to specify openmp schedule.
- Better documentation on equations and using a different compiler.
- Print convenient warning when particles are diverging or if
h, mare zero.
- Abstract the code generation into a common core which supports Cython, OpenCL and CUDA. This will be pulled into a separate package in the next release.
- New GPU NNPS algorithms including a very fast oct-tree.
- Added several sphysics test cases to the examples.
- Add a working Implicit Incompressible SPH scheme (of Ihmsen et al., 2014)
- Add GSPH scheme from SPH2D and all the approximate Riemann solvers from there.
- Add code for Shepard and MLS-based density corrections.
- Add kernel corrections proposed by Bonet and Lok (1999)
- Add corrections from the CRKSPH paper (2017).
- Add basic equations of Parshikov (2002) and Zhang, Hu, Adams (2017)
- Bug fixes:
- Ensure that the order of equations is preserved.
- Fix bug with dumping VTK files.
- Fix bug in Adami, Hu, Adams scheme in the continuity equation.
- Fix mistake in WCSPH scheme for solid bodies.
- Fix bug with periodicity along the z-axis.
- Release date: 17th September, 2017
- Mayavi viewer now supports empty particle arrays.
- Fix error in scheme chooser which caused problems with default scheme property values.
- Add starcluster support/documentation so PySPH can be easily used on EC2.
- Improve the particle array so it automatically ravel’s the passed arrays and also accepts constant values without needing an array each time.
- Add a few new examples.
- Added 2D and 3D viewers for Jupyter notebooks.
- Add several new Wendland Quintic kernels.
- Add option to measure coverage of Cython code.
- Add EDAC scheme.
- Move project to github.
- Improve documentation and reference section.
- Fix various bugs.
- Switch to using pytest instead of nosetests.
- Add a convenient geometry creation module in
- Add support to script the viewer with a Python file, see
pysph view -h.
- Add several new NNPS schemes like extended spatial hashing, SFC, oct-trees etc.
- Improve Mayavi viewer so one can view the velocity vectors and any other vectors.
- Viewer now has a button to edit the visualization properties easily.
- Add simple tests for all available kernels. Add
- Add a basic dockerfile for pysph to help with the CI testing.
- Update build so pysph can be built with a system zoltan installation that is
part of trilinos using the
- Wrapping the
- Release date: 14th July, 2016.
- 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
Schemeclasses 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.batscript on Windows. This is automatically setup internally.
- Add test that checks if all examples run.
- Remove unused command line options and add a
--max-stepsoption 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.
pysph.tools.automationto facilitate easier automation and reproducibility of PySPH simulations.
- Add spatial hash and extended spatial hash NNPS algorithms for comparison.
- Refactor and cleanup the NNPS related code.
- Add several gas-dynamics examples and the
- Work with mpi4py version 2.0.0 and older versions.
- Fixed major bug with TVF implementation and add support for 3D simulations with the TVF.
- Fix bug with uploaded tarballs that breaks
pip install pysphon 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.
- Release date: 18th August, 2015.
- Fix bug with
output_at_timesspecification 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
Applicationclass 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
pysphscript that supports
pysph_vieweris now removed, use
- Add a simple remeshing tool in
- 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
- Do not display unnecessary compiler warnings when there are no errors but display verbose details when there is an error.
- Release date: 12th June, 2015
- Support for tox, this makes it trivial to test PySPH on py26, py27 and py34 (and potentially more if needed).
- Fix bug in code generator where it is unable to import pysph before it is installed.
- Support installation via
egg_infoto be run without cython or numpy.
- Added Codeship CI build using tox for py27 and py34.
- CI builds for Python 2.7.x and 3.4.x.
- Support for Python-3.4.x.
- Support for Python-2.6.x.
- Release date: 3rd June, 2015.
- First public release of the new PySPH code which uses code-generation and is hosted on bitbucket.
- OpenMP support.
- MPI support using Zoltan.
- Automatic code generation from high-level Python code.
- Support for various multi-step integrators.
- Added an interpolator utility module that interpolates the particle data onto a desired set of points (or grids).
- Support for inlets and outlets.
- Support for basic Gmsh input/output.
- Plenty of examples for various SPH formulations.
- Improved documentation.
- Continuous integration builds on Shippable, Drone.io, and AppVeyor.