Skip to main content

Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab

Project description

pysdm logo

Python 3 LLVM CUDA Linux OK macOS OK Windows OK Jupyter Maintenance OpenHub status DOI
EU Funding PL Funding US Funding

License: GPL v3

Github Actions Build Status Coverage Status
PyPI version API docs

PySDM is a package for simulating the dynamics of population of particles. It is intended to serve as a building block for simulation systems modelling fluid flows involving a dispersed phase, with PySDM being responsible for representation of the dispersed phase. Currently, the development is focused on atmospheric cloud physics applications, in particular on modelling the dynamics of particles immersed in moist air using the particle-based (a.k.a. super-droplet) approach to represent aerosol/cloud/rain microphysics. The package features a Pythonic high-performance implementation of the Super-Droplet Method (SDM) Monte-Carlo algorithm for representing collisional growth (Shima et al. 2009), hence the name.

PySDM documentation is maintained at: https://open-atmos.github.io/PySDM

There is a growing set of example Jupyter notebooks exemplifying how to perform various types of calculations and simulations using PySDM. Most of the example notebooks reproduce results and plot from literature, see below for a list of examples and links to the notebooks (which can be either executed or viewed "in the cloud").

There are also a growing set of tutorials, also in the form of Jupyter notebooks. These tutorials are intended for teaching purposes and include short explanations of cloud microphysical concepts paired with widgets for running interactive simulations using PySDM. Each tutorial also comes with a set of questions at the end that can be used as homework problems. Like the examples, these tutorials can be executed or viewed "in the cloud" making it an especially easy way for students to get started.

PySDM has two alternative parallel number-crunching backends available: multi-threaded CPU backend based on Numba and GPU-resident backend built on top of ThrustRTC. The Numba backend (aliased CPU) features multi-threaded parallelism for multi-core CPUs, it uses the just-in-time compilation technique based on the LLVM infrastructure. The ThrustRTC backend (aliased GPU) offers GPU-resident operation of PySDM leveraging the SIMT parallelisation model. Using the GPU backend requires nVidia hardware and CUDA driver.

For an overview of PySDM features (and the preferred way to cite PySDM in papers), please refer to our JOSS papers:

PySDM includes an extension of the SDM scheme to represent collisional breakup described in de Jong, Mackay et al. 2023.
For a list of talks and other materials on PySDM as well as a list of published papers featuring PySDM simulations, see the project wiki.

Dependencies and Installation

PySDM dependencies are: Numpy, Numba, SciPy, Pint, chempy, pyevtk, ThrustRTC and CURandRTC.

To install PySDM using pip, use: pip install PySDM (or pip install git+https://github.com/open-atmos/PySDM.git to get updates beyond the latest release).

Conda users may use pip as well, see the Installing non-conda packages section in the conda docs.

For development purposes, we suggest cloning the repository and installing it using pip -e. Test-time dependencies can be installed with pip -e .[tests].

PySDM examples constitute the PySDM-examples package. The examples have additional dependencies listed in PySDM_examples package setup.py file. Running the example Jupyter notebooks requires the PySDM_examples package to be installed. The suggested install and launch steps are:

git clone https://github.com/open-atmos/PySDM.git
pip install -e PySDM
pip install -e PySDM/examples
jupyter-notebook PySDM/examples/PySDM_examples

Alternatively, one can also install the examples package from pypi.org by using pip install PySDM-examples (note that this does not apply to notebooks itself, only the supporting .py files).

Contributing, reporting issues, seeking support

Our technologicial stack:

Python 3 Numba LLVM CUDA NumPy pytest
Colab Codecov PyPI GithubActions Jupyter PyCharm

Submitting new code to the project, please preferably use GitHub pull requests - it helps to keep record of code authorship, track and archive the code review workflow and allows to benefit from the continuous integration setup which automates execution of tests with the newly added code.

Code contributions are assumed to imply transfer of copyright. Should there be a need to make an exception, please indicate it when creating a pull request or contributing code in any other way. In any case, the license of the contributed code must be compatible with GPL v3.

Developing the code, we follow The Way of Python and the KISS principle. The codebase has greatly benefited from PyCharm code inspections and Pylint, Black and isort code analysis (which are all part of the CI workflows).

We also use pre-commit hooks. In our case, the hooks modify files and re-format them. The pre-commit hooks can be run locally, and then the resultant changes need to be staged before committing. To set up the hooks locally, install pre-commit via pip install pre-commit and set up the git hooks via pre-commit install (this needs to be done every time you clone the project). To run all pre-commit hooks, run pre-commit run --all-files. The .pre-commit-config.yaml file can be modified in case new hooks are to be added or existing ones need to be altered.

Further hints addressed at PySDM developers are maintained in the open-atmos/python-dev-hints Wiki and in PySDM HOWTOs.

Issues regarding any incorrect, unintuitive or undocumented bahaviour of PySDM are best to be reported on the GitHub issue tracker. Feature requests are recorded in the "Ideas..." PySDM wiki page.

We encourage to use the GitHub Discussions feature (rather than the issue tracker) for seeking support in understanding, using and extending PySDM code.

We look forward to your contributions and feedback.

Licensing:

copyright: Jagiellonian University (2019-2023) & AGH University of Krakow (2023-...)
licence: GPL v3

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pysdm-3.0.0rc17.tar.gz (7.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysdm-3.0.0rc17-py3-none-any.whl (347.3 kB view details)

Uploaded Python 3

File details

Details for the file pysdm-3.0.0rc17.tar.gz.

File metadata

  • Download URL: pysdm-3.0.0rc17.tar.gz
  • Upload date:
  • Size: 7.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pysdm-3.0.0rc17.tar.gz
Algorithm Hash digest
SHA256 c04375c84fea9ebb47545d33cebcf94b9051eccf45427bea4bfe1577f0a48e7a
MD5 aa771a9d6ddc3d4a92f6971da5da88ed
BLAKE2b-256 f273abb10315d7f40353c0ada723f3be55106b63cf50adc6e474294c5295a9f0

See more details on using hashes here.

File details

Details for the file pysdm-3.0.0rc17-py3-none-any.whl.

File metadata

  • Download URL: pysdm-3.0.0rc17-py3-none-any.whl
  • Upload date:
  • Size: 347.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pysdm-3.0.0rc17-py3-none-any.whl
Algorithm Hash digest
SHA256 ed01f17bfbfc2b84d9434090a9d6676c3b2aa6e9c78d23fee8abc0a629d6c3d5
MD5 d5dda0a27a9611afdcf5a2f9b010ef78
BLAKE2b-256 aee6e17bcefc993cf696f584dedaadbd9732821ef1cb0cec9d09b825faa4a9d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page