Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Hammer
pystencils
Commits
beec6d3e
Commit
beec6d3e
authored
6 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Adapted README
parent
bc82de86
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+35
-3
35 additions, 3 deletions
README.md
doc/img/logo_no_text.png
+0
-0
0 additions, 0 deletions
doc/img/logo_no_text.png
with
35 additions
and
3 deletions
README.md
+
35
−
3
View file @
beec6d3e
pystencils
pystencils
==========
==========
[

](https://i10git.cs.fau.de/pycodegen/pystencils/commits/master)
[

](https://i10git.cs.fau.de/pycodegen/pystencils/commits/master)
[
coverage report
](
http://pycodegen.pages.walberla.net/pystencils/coverage_report
)
Run blazingly fast stencil codes on numpy arrays.
Run blazingly fast stencil codes on numpy arrays.

*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:
```
python
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:
```
python
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
](
http://pycodegen.pages.walberla.net/pystencils
)
to learn more.
Installation
Installation
------------
------------
```
bash
```
bash
export
PIP_EXTRA_INDEX_URL
=
https://www.walberla.net/pip
pip
install
pystencils[interactive]
pip
install
pystencils[interactive]
```
```
...
@@ -32,4 +63,5 @@ pip install pystencils[interactive,gpu,doc]
...
@@ -32,4 +63,5 @@ pip install pystencils[interactive,gpu,doc]
Documentation
Documentation
-------------
-------------
Read the docs
[
here
](
http://software.pages.walberla.net/pystencils/pystencils
)
Read the docs
[
here
](
http://pycodegen.pages.walberla.net/pystencils
)
and
\ No newline at end of file
check out the Jupyter notebooks in
`doc/notebooks`
.
This diff is collapsed.
Click to expand it.
doc/img/logo_no_text.png
0 → 100644
+
0
−
0
View file @
beec6d3e
5.42 KiB
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment