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 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.
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:
- Bartman et al. 2022 (PySDM v1).
- de Jong, Singer et al. 2023 (PySDM v2).
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.
A pdoc-generated documentation of PySDM public API is maintained at: https://open-atmos.github.io/PySDM
Example Jupyter notebooks (reproducing results from literature):
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. Dependencies of PySDM are available at the following conda channels:
- numba: numba
- conda-forge: pyevtk, pint and
- fyplus: ThrustRTC, CURandRTC
- bjodah: chempy
- nvidia: cudatoolkit
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:
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.
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
Built Distribution
File details
Details for the file pysdm-2.82.tar.gz
.
File metadata
- Download URL: pysdm-2.82.tar.gz
- Upload date:
- Size: 4.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6557761434a62a06e94baf903e65926cba57843c9b56a7f9efd4b59e2a5a4abd |
|
MD5 | 06c5aaa0cba982efd70bc91632cf197c |
|
BLAKE2b-256 | 22ecf68fba58976f6061d5206f778b2e92aa6fc2fd0042d5c8a7201ada5fce82 |
File details
Details for the file PySDM-2.82-py3-none-any.whl
.
File metadata
- Download URL: PySDM-2.82-py3-none-any.whl
- Upload date:
- Size: 313.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cf69729c8fce9203997ec0d8d163a5cca507eafef488eacefcbc070e7636600 |
|
MD5 | 4ef4395cbc4be65909982dd275ac2664 |
|
BLAKE2b-256 | 5dadb1ab7918e3466b098a92abd24fcac450cb60ecb74751b8d013ad5c3b8bf1 |