Python package for solving partial differential equations
Project description
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 a numba-compiled implementation of finite differences.
This 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 for speed.
Installation
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 also want to install the following optional packages:
pip install h5py pandas tqdm
Moreover, ffmpeg
needs to be installed and for creating movies.
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
More examples illustrating the capabilities of the package can be found in the
examples
folder of the package or in the examples gallery
A detailed documentation is available on readthedocs
and as a single PDF file.
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.