Commit beec6d3e authored by Martin Bauer's avatar Martin Bauer
Browse files

Adapted README

parent bc82de86
[![pipeline status](](
[![coverage report](](
[coverage report](
Run blazingly fast stencil codes on numpy arrays.
![alt text](doc/img/logo.png)
*pystencils* uses sympy to define stencil operations, that can be executed on numpy array.
It runs faster than normal numpy code and even as Cython and numba.
Here is a code snippet that computes the average of neighboring cells:
import pystencils as ps
import numpy as np
f, g = ps.fields("f, g : [2D]")
stencil = ps.Assignment(g[0, 0],
(f[1, 0] + f[-1, 0] + f[0, 1] + f[0, -1]) / 4)
kernel = ps.create_kernel(stencil).compile()
f_arr = np.random.rand(1000, 1000)
g_arr = np.empty_like(f_arr)
kernel(f=f_arr, g=g_arr)
*pystencils* is mostly used for numerical simulations using finite difference or finite volume methods.
It comes with automatic finite difference discretization for PDEs:
c, v = ps.fields("c, v(2): [2D]")
adv_diff_pde = ps.fd.transient(c) - ps.fd.diffusion(c, sp.symbols("D")) + ps.fd.advection(c, v)
discretize = ps.fd.Discretization2ndOrder(dx=1, dt=0.01)
discretization = discretize(adv_diff_pde)
Look at the [documentation]( to learn more.
pip install pystencils[interactive]
......@@ -32,4 +63,5 @@ pip install pystencils[interactive,gpu,doc]
Read the docs [here](
\ No newline at end of file
Read the docs [here]( and
check out the Jupyter notebooks in `doc/notebooks`.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment