A Finite-Difference PDE solver.
Project description
PDEPy
A Python 3 library for solving initial and boundary value problems of some linear partial differential equations using finite-difference methods.
- Laplace
- Implicit Central
- Parabolic
- Explicit Central
- Explicit Upwind
- Implicit Central
- Implicit Upwind
- Wave
- Explicit
- Implicit
Usage
Installation
pip install pdepy
Examples
Laplace's Equation
import numpy as np
from pdepy import laplace
xn, xf, yn, yf = 30, 3.0, 40, 4.0
x = np.linspace(0, xf, xn + 1)
y = np.linspace(0, yf, yn + 1)
f = lambda x, y: (x - 1) ** 2 - (y - 2) ** 2
bound_x0 = f(0, y)
bound_xf = f(xf, y)
bound_y0 = f(x, 0)
bound_yf = f(x, yf)
axis = x, y
conds = bound_x0, bound_xf, bound_y0, bound_yf
laplace.solve(axis, conds, method="ic")
Parabolic Equation
import numpy as np
from pdepy import parabolic
xn, xf, yn, yf = 40, 4.0, 50, 0.5
x = np.linspace(0, xf, xn + 1)
y = np.linspace(0, yf, yn + 1)
init = x ** 2 - 4 * x + 5
bound = 5 * np.exp(-y)
p, q, r, s = 1, 1, -3, 3
axis = x, y
conds = init, bound, bound
params = p, q, r, s
parabolic.solve(axis, params, conds, method="iu")
Wave Equation
import numpy as np
from pdepy import wave
xn, xf, yn, yf = 40, 1.0, 40, 1.0
x = np.linspace(0, xf, xn + 1)
y = np.linspace(0, yf, yn + 1)
d_init = 1
init = x * (1 - x)
bound = y * (1 - y)
axis = x, y
conds = d_init, init, bound, bound
wave.solve(axis, conds, method="i")
Development
Create virtual environment and install requirements:
bin/setup_venv
Other commands
Run command in virtual environment:
bin/run <command>
Install requirements:
bin/install_requirements
Format codebase:
bin/format
Lint codebase:
bin/lint
Run unit tests:
bin/test
Publish
Package and distribute:
bin/publish
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdepy-1.0.4.tar.gz.
File metadata
- Download URL: pdepy-1.0.4.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8fe1f6089794e8c7e1df089894b5c7bef954ccd4f15e979e3a41bb12ec7053a
|
|
| MD5 |
67042824b78ce11d904fe8e59ce086a2
|
|
| BLAKE2b-256 |
a2aff05c48054e21aa50953c1cc685780d274abeb3a152b07a45b982b45d48a6
|
File details
Details for the file pdepy-1.0.4-py3-none-any.whl.
File metadata
- Download URL: pdepy-1.0.4-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7414de3288fc9b07c574bab6deb4edd0aac3fe97e8459727e241ab4019e65ff
|
|
| MD5 |
1f391777e541f762c5797f8ce3273812
|
|
| BLAKE2b-256 |
26fc62568f2c7761b5b06435d8b588f2e640d759945e01d580a79e3a80c8dcf8
|