Skip to main content

Python framework for Nek5000

Project description

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/

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


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.5.0b0.tar.gz (185.2 kB view hashes)

Uploaded Source

Built Distribution

snek5000-0.5.0b0-py3-none-any.whl (35.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page