Skip to main content

Python utilities for snek5000 project

Project description

snek5000

Python framework for Nek5000.

Warning: This framework is experimental and of alpha-quality. The API can also change.

Documentation: https://exabl.github.io/snek5000/

Installation

# Clone
git clone --recursive https://github.com:exabl/snek5000.git

# Activate paths: Start here. Always!
cd snek5000
source activate.sh

Now you should setup a Python environment. There are two ways to do this (and it has to be done only once):

  • Using venv
    python -m venv venv
    source venv/bin/activate
    pip install -e .
    
  • Using conda
    conda env create -n snek5000 -f environment.yml
    conda activate snek5000
    pip install -e .
    

Why and why not use 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

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
  • Modification of the API requires learning how Snakemake functions and how to write Jinja templates (which are not so hard, btw)

Roadmap

Short term

  • Implement post processing API: with matplotlib and Paraview

Long term

  • Interface Nek5000 states and time-integration event loop

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.3.0a0.tar.gz (166.9 kB view details)

Uploaded Source

File details

Details for the file snek5000-0.3.0a0.tar.gz.

File metadata

  • Download URL: snek5000-0.3.0a0.tar.gz
  • Upload date:
  • Size: 166.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for snek5000-0.3.0a0.tar.gz
Algorithm Hash digest
SHA256 be31568df905a333c3e2a7d67d9f74aec55337028a261f2c3e22d9aefed6ede2
MD5 68afd37ef2552e5b577cbab84e4e703a
BLAKE2b-256 d411571c0d95f51c6e361421e5dc26c738ed8d6a1d906fe84772a92f7890eaf3

See more details on using hashes here.

Supported by

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