Python framework for Nek5000
Project description
Warning: This framework is experimental and of beta-quality.
Documentation: https://snek5000.readthedocs.io/
Installation
Install it as follows:
export NEK_SOURCE_ROOT="/path/to/Nek5000"
export PATH="$PATH:$NEK_SOURCE_ROOT/bin"
pip install snek5000
Why snek5000?
The snek5000
Python
API is based on
fluidsim, which allows you to launch a
simulation using scripts. For example the periodic hill
example can be launched as.
from phill.solver import Simul
params = Simul.create_default_params()
# modify parameters as needed
sim = Simul(params)
sim.make.exec() # by default starts a run
sim.make.exec(["mesh", "compile"]) # run rules in order
sim.make.exec(["run"], dryrun=True) # simulate simulation
sim.make.exec(["run"]) # actual simulation
Check out the
tutorials to learn
how to use snek5000
.
Need more reasons to use snek5000?
Advantages
- Saves you from the trouble in setting up multiple source files (
.box
,.par
,SIZE
) - Checks for consistency of parameters
- Out of source builds and runs, which can be inspected or executed using the conventional
makenek
for debugging - Avoid typos and human errors
- Better than bash scripting like:
# Build case cd src/phill/ CASE="phill" echo "$CASE.box" | genbox mv -f box.re2 phill.re2 echo "$CASE\n0.01" | genmap FFLAGS="-mcmodel=medium -march=native" CFLAGS="-mcmodel=medium -march=native" makenek cd - # Run case cd src/phill/ nekmpi $CASE <nb_procs> # foreground nekbmpi $CASE <nb_procs> # background cd - # Clean makenek clean
- Use of Snakemake which is similar to GNU Make, but allows one to blend bash and python scripting and uses simple YAML files for managing custom configurations of compilers and flags for different computers.
Disadvantages
- In development
- Requires some basic knowledge of Python to use (not really a big issue, to be honest).
- Modification of the API requires learning how Snakemake functions and how to write Jinja templates (which are not so hard, btw)
Contributing
Contributions are welcome! You can help by testing out the code, filing issues and submitting patches. See contributing guidelines.
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
snek5000-0.6.1b0.tar.gz
(194.7 kB
view hashes)
Built Distribution
snek5000-0.6.1b0-py3-none-any.whl
(42.2 kB
view hashes)
Close
Hashes for snek5000-0.6.1b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21872fd1711f3ff8766751856deb7912f585b88961858b1062d3bc520dca86ac |
|
MD5 | a89fa0b8920da9c8161efbff4fee7777 |
|
BLAKE2b-256 | 65eb90fd7cebab78980ac44fd5be65403a632c175e0c5bb7ead1c783d43bcd42 |