Skip to content

Latest commit

 

History

History
118 lines (86 loc) · 3.51 KB

README.md

File metadata and controls

118 lines (86 loc) · 3.51 KB

snek5000

PyPI Tests Status Documentation Status Maintainability Rating Code coverage

Python framework for Nek5000

Warning: This framework is experimental and of beta-quality.

Documentation: https://snek5000.readthedocs.io/

Quick start

Install it as follows:

export NEK_SOURCE_ROOT="/path/to/Nek5000"
export PATH="$PATH:$NEK_SOURCE_ROOT/bin"

pip install snek5000

See here for detailed installation instructions.

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", resources={"nproc": 2})  # 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.