py-pde
py-pde is a Python package for solving partial differential equations (PDEs).
The package provides classes for grids on which scalar and tensor fields can be
defined. The associated differential operators are computed using finite differences,
which allows defining, inspecting, and solving typical PDEs that appear for instance in
the study of dynamical systems in physics. The focus of the package lies on easy usage
to explore the behavior of PDEs. However, core computations can be compiled
transparently using numba, jax, or torch for speed.
Installation
PyPI / pip
py-pde is available on pypi, so you should be able to install it through pip:
pip install py-pde
In order to have all features of the package available, you might want to install the following optional packages manually (all or a subset of these):
pip install h5py pandas mpi4py numba-mpi py-modelrunner napari ffmpeg-python
or using the py-pde package variants mpi, io and/or interactive (any combination):
pip install py-pde[mpi]
pip install py-pde[io]
pip install py-pde[interactive]
pip install py-pde[mpi,io,interactive]
Moreover, ffmpeg needs to be installed for creating movies.
conda
As an alternative, you can install py-pde through conda
using the conda-forge channel:
conda install -c conda-forge py-pde
Installation with conda includes the optional dependencies of py-pde.
Arch Linux package
py-pde is also available as an Arch package.
Usage
A simple example showing the evolution of the diffusion equation in 2d:
import pde
grid = pde.UnitGrid([64, 64]) # generate grid
state = pde.ScalarField.random_uniform(grid) # generate initial condition
eq = pde.DiffusionPDE(diffusivity=0.1) # define the pde
result = eq.solve(state, t_range=10) # solve the pde
result.plot() # plot the resulting field
PDEs can also be specified by simply writing expressions of the evolution rate. For instance, the Cahn-Hilliard equation can be implemented as
eq = pde.PDE({'c': 'laplace(c**3 - c - laplace(c))'})
which can be used in place of the DiffusionPDE in the example above.
More information
- Tutorial notebooks in the tutorials folder
- Examples gallery with an overview of the capabilities of the package
- The Discussions on GitHub
- Full documentation on readthedocs or as a single PDF file.
- The paper published in the Journal of Open Source Software
- Practical tutorial on pattern formation in biological cells
Release files for py-pde 0.58.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_pde-0.58.0.tar.gz | 2.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_pde-0.58.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:2.9 MB
Release files / py_pde-0.58.0.tar.gz
| Download URL | py_pde-0.58.0.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0706e05d8cf1cd9aeb75c72a8599464c32d8ff2a1828620b5048eb9458b5332
|
|
BLAKE2b-256 checksum How to use checksums |
4b8a6b9e99bfd63e1fb5df0f4db60394a7fdd9a6c280b93e87ab5f14a2b960bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / py_pde-0.58.0-py3-none-any.whl
| Download URL | py_pde-0.58.0-py3-none-any.whl |
|---|---|
| Size | 464.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
480c46df3358aa401a1864a0a16800470b0c23a4565a89c285da02e500908a3a
|
|
BLAKE2b-256 checksum How to use checksums |
f1f6f27dd639ce667adb57822c9831e3c4cff4c1c4c0ba00164c20c30f506d94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|