Skip to main content

Python package for solving partial differential equations

Project description

py-pde

PyPI version Conda Version Documentation Status DOI Binder

Build Status codecov Language grade: Python Code style: black License: MIT

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.

Try it out online!

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 for creating movies.

As an alternative, you can install py-pde through conda using conda-forge channel:

conda install -c conda-forge py-pde

Installation with conda includes all required dependencies to have all features of py-pde.

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

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

py-pde-0.16.2.tar.gz (252.1 kB view details)

Uploaded Source

Built Distribution

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

py_pde-0.16.2-py3-none-any.whl (316.7 kB view details)

Uploaded Python 3

File details

Details for the file py-pde-0.16.2.tar.gz.

File metadata

  • Download URL: py-pde-0.16.2.tar.gz
  • Upload date:
  • Size: 252.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.7.0 requests/2.26.0 setuptools/57.1.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.11

File hashes

Hashes for py-pde-0.16.2.tar.gz
Algorithm Hash digest
SHA256 349f915c43e693b9c1a9ca5a0977363122ad074752b2a065055d23ca8ff8f529
MD5 82d1980c85c92bb80703b56b8f3a9e1e
BLAKE2b-256 597e97416ed98dc4bf8a4b79f794601df37fd199e003fa15bcab37b817f412c6

See more details on using hashes here.

File details

Details for the file py_pde-0.16.2-py3-none-any.whl.

File metadata

  • Download URL: py_pde-0.16.2-py3-none-any.whl
  • Upload date:
  • Size: 316.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.7.0 requests/2.26.0 setuptools/57.1.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.11

File hashes

Hashes for py_pde-0.16.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f529779e0b2656b0803cb9f1144f0c46de7e0613ff8a0aa3d16fb5db7cc31ef
MD5 b111546829c57085ac83c9d4ce14cd0a
BLAKE2b-256 d4bf7a4ce07d600a7b0a29ce5a9a9c606add241073556718fc2961936e261be3

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