Shenfun

Shenfun: High performance spectral Galerkin computing platform - Published in JOSS (2018)

https://github.com/spectraldns/shenfun

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: arxiv.org, researchgate.net, joss.theoj.org
  • Committers with academic emails
    3 of 9 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

chebyshev curvilinear-coordinates cylindrical-coordinates fenics fourier galerkin hermite hpc laguerre legendre mobius polar-coordinates python spectral spectral-methods spherical-coordinates turbulence ultraspherical

Keywords from Contributors

cryptocurrencies meshes ode graph-generation connectivity parallel geoscience hydrology networkx vrp

Scientific Fields

Mathematics Computer Science - 47% confidence
Last synced: 4 months ago · JSON representation

Repository

High performance computational platform in Python for the spectral Galerkin method

Basic Info
Statistics
  • Stars: 220
  • Watchers: 13
  • Forks: 45
  • Open Issues: 29
  • Releases: 35
Topics
chebyshev curvilinear-coordinates cylindrical-coordinates fenics fourier galerkin hermite hpc laguerre legendre mobius polar-coordinates python spectral spectral-methods spherical-coordinates turbulence ultraspherical
Created almost 9 years ago · Last pushed 5 months ago
Metadata Files
Readme License

README.rst

Shenfun
=======
.. image:: https://app.codacy.com/project/badge/Grade/bd772b3ca7134651a9225d8051db8c41
    :target: https://www.codacy.com/gh/spectralDNS/shenfun/dashboard?utm_source=github.com&utm_medium=referral&utm_content=spectralDNS/shenfun&utm_campaign=Badge_Grade
.. image:: https://dev.azure.com/spectralDNS/shenfun/_apis/build/status/spectralDNS.shenfun?branchName=master
    :target: https://dev.azure.com/spectralDNS/shenfun
.. image:: https://github.com/spectralDNS/shenfun/actions/workflows/main.yml/badge.svg?branch=master
    :target: https://github.com/spectralDNS/shenfun
.. image:: https://codecov.io/gh/spectralDNS/shenfun/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/spectralDNS/shenfun
.. image:: https://anaconda.org/conda-forge/shenfun/badges/platforms.svg
    :target: https://anaconda.org/conda-forge/shenfun

Description
-----------
Shenfun is a high performance computing platform for solving partial differential equations (PDEs) by the spectral Galerkin method. The user interface to shenfun is very similar to `FEniCS `_, but applications are limited to multidimensional tensor product grids, using either Cartesian or curvilinear grids (e.g., but not limited to, polar, cylindrical, spherical or parabolic). The code is parallelized with MPI through the `mpi4py-fft `_ package.

Shenfun enables fast development of efficient and accurate PDE solvers (spectral order and accuracy), in the comfortable high-level Python language. The spectral accuracy is ensured by using high-order *global* orthogonal basis functions (Fourier, Legendre, Chebyshev first and second kind, Ultraspherical, Jacobi, Laguerre and Hermite), as opposed to finite element codes that are using low-order *local* basis functions. Efficiency is ensured through vectorization (`Numpy `_), parallelization (`mpi4py `_) and by moving critical routines to `Cython `_ or `Numba `_. Shenfun has been used to run turbulence simulations (Direct Numerical Simulations) on thousands of processors on high-performance supercomputers, see the `spectralDNS `_ repository.

The demo folder contains several examples for the Poisson, Helmholtz and Biharmonic equations. For extended documentation and installation instructions see `ReadTheDocs `_. For interactive demos, see the `jupyter book `_. Note that shenfun currently comes with the possibility to use two non-periodic directions (see `biharmonic demo `_), and equations may be solved coupled and implicit (see `MixedPoisson.py `_).

Note that shenfun works with curvilinear coordinates. For example, it is possible to solve equations on a `sphere `_ (using spherical coordinates), on the surface of a `torus `_, on a `Möbius strip `_ or along any `curved line in 2D/3D `_. Actually, any new coordinates may be defined by the user as long as the coordinates lead to a system of equations with separable coefficients. After defining new coordinates, operators like div, grad and curl work automatically with the new curvilinear coordinates. See also `this notebook on the sphere `_ or an illustration of the `vector Laplacian `_.

.. image:: https://cdn.jsdelivr.net/gh/spectralDNS/spectralutilities@master/figures/moebius8_trans.png
    :target: https://mikaem.github.io/shenfun-demos/content/moebius.html
    :alt: The eigenvector of the 8'th smallest eigvalue on a Möbius strip
.. image:: https://cdn.jsdelivr.net/gh/spectralDNS/spectralutilities@master/figures/smallcoil2.png
    :alt: Solution of Poisson's equation on a Coil
.. image:: https://cdn.jsdelivr.net/gh/spectralDNS/spectralutilities@master/figures/spherewhite4.png
    :target: https://mikaem.github.io/shenfun-demos/content/sphericalhelmholtz.html
    :alt: Solution of Poisson's equation on a spherical shell
.. image:: https://cdn.jsdelivr.net/gh/spectralDNS/spectralutilities@master/figures/torus2.png
    :target: https://github.com/spectralDNS/shenfun/blob/master/docs/notebooks/Torus.ipynb
    :alt: Solution of Poisson's equation on the surface of a torus


For a more psychedelic experience, have a look at the `simulation `_ of the Ginzburg-Landau equation on the sphere (click for Youtube-video):

.. image:: https://cdn.jsdelivr.net/gh/spectralDNS/spectralutilities@master/figures/GLimage.png
    :target: https://youtu.be/odsIoHVcqek
    :alt: Ginzburg-Landau spherical coordinates

Shenfun can also be used to approximate analytical functions with global spectral basis `functions `_, and to integrate over highly complex domains, like the seashell below, see `this demo `_.

.. image:: https://cdn.jsdelivr.net/gh/spectralDNS/spectralutilities@master/figures/seashell3.png
    :alt: The surface of a seashell

Some recent papers using Shenfun
--------------------------------

- `Posterior comparison of model dynamics in several hybrid turbulence model forms `_ Towery, Colin A. Z. and Sáenz, Juan A. and Livescu, Daniel, Physics of Fluids 36, 105148 (2024)
- `Effective control of two-dimensional Rayleigh–Bénard convection: Invariant multi-agent reinforcement learning is all you need `_ C. Vignon, J. Rabault, J. Vasanth, F. Alcántara-Ávila, M. Mortensen, R. Vinuesa, Physics of Fluids 35, 065146 (2023)
- `Solving Partial Differential Equations with Equivariant Extreme Learning Machines `_, H. Harder, J. Rabault, R. Vinuesa, M. Mortensen, S. Peitz. preprint (2024)
- `A global spectral-Galerkin investigation of a Rayleigh–Taylor instability in plasma using an MHD–Boussinesq model `_  A. Piterskaya, Wojciech J. Miloch, M. Mortensen, AIP Advances 13, 105319 (2023)
- `A Generic and Strictly Banded Spectral Petrov–Galerkin Method for Differential Equations with Polynomial Coefficients `_ M. Mortensen, SIAM J. on Scientific Computing, 45, 1, A123-A146, (2023)
- `Variance representations and convergence rates for data-driven approximations of Koopman operators `_ F. M. Philipp, M. Schaller, S. Boshoff, S. Peitz, F. Nüske, K. Worthmann, preprint (2024)
- `Partial observations, coarse graining and equivariance in Koopman operator theory for large-scale dynamical systems `_, S. Peitz, H. Harder, F. Nüske, F. Philipp, M. Schaller, K. Worthmann, preprint (2024)
- `Koopman-Based Surrogate Modelling of Turbulent Rayleigh-Bénard Convection `_ T. Markmann, M. Straat, B. Hammer, preprint (2024)
- `Shenfun: High performance spectral Galerkin computing platform `_, M. Mortensen, Journal of Open Source Software, 3(31), 1071 (2018)


Installation
------------

Shenfun can be installed using either `pip `_ or `conda `_, see `installation chapter on readthedocs `_.

Dependencies
------------

    * `Python `_ 3.7 or above. Test suits are run with Python 3.10, 3.11 and 3.12.
    * A functional MPI 2.x/3.x implementation like `MPICH `_ or `Open MPI `_ built with shared/dynamic libraries.
    * `FFTW `_ version 3, also built with shared/dynamic libraries.
    * Python modules:
        * `Numpy `_
        * `Scipy `_
        * `Sympy `_
        * `Cython `_
        * `mpi4py `_
        * `mpi4py-fft `_


Try it in a codespace
---------------------
The easiest way to try out shenfun is to create your own codespace. Press the green codespace button on this page and wait for a couple of minutes while everything in `environment.yml` gets installed. Then write in the terminal of the codespace editor:: 

     source activate shenfun
     echo -e "PYTHONPATH=/workspaces/shenfun" > .env
     export PYTHONPATH=/workspaces/shenfun

and you are set to run any of the demo programs, or for example try to follow the detailed instructions in the `documentation `_. We assume that you know how to run a Python program. Please note that if you want to use for example IPython or Jupyter in the codespace, then these need to be installed into the shenfun environment.

Contact
-------
For comments, issues, bug-reports and requests, please use the issue tracker of the current repository, or see `How to contribute? `_ at readthedocs. Otherwise the principal author can be reached at::

    Mikael Mortensen
    mikaem at math.uio.no
    https://mikaem.github.io/
    Department of Mathematics
    University of Oslo
    Norway

Owner

  • Name: spectralDNS
  • Login: spectralDNS
  • Kind: organization

JOSS Publication

Shenfun: High performance spectral Galerkin computing platform
Published
November 19, 2018
Volume 3, Issue 31, Page 1071
Authors
Mikael Mortensen ORCID
University of Oslo, Department of Mathematics
Editor
Kathryn Huff ORCID
Tags
Spectral Galerkin Fourier Chebyshev Legendre MPI

GitHub Events

Total
  • Create event: 2
  • Issues event: 2
  • Release event: 1
  • Watch event: 19
  • Delete event: 2
  • Issue comment event: 8
  • Push event: 8
  • Pull request event: 4
  • Fork event: 3
Last Year
  • Create event: 2
  • Issues event: 2
  • Release event: 1
  • Watch event: 19
  • Delete event: 2
  • Issue comment event: 8
  • Push event: 8
  • Pull request event: 4
  • Fork event: 3

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 1,311
  • Total Committers: 9
  • Avg Commits per committer: 145.667
  • Development Distribution Score (DDS): 0.018
Past Year
  • Commits: 17
  • Committers: 2
  • Avg Commits per committer: 8.5
  • Development Distribution Score (DDS): 0.059
Top Committers
Name Email Commits
Mikael Mortensen m****m@m****o 1,288
sebglane 7
thoeschler t****r@g****e 5
Shashank Jaiswal j****7@g****m 4
sebglane g****e@t****e 3
liu-ziyuan-math 7****h 1
dependabot[bot] 4****] 1
The Codacy Badger b****r@c****m 1
Aurelien @LPO a****k@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 73
  • Total pull requests: 33
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 16 days
  • Total issue authors: 33
  • Total pull request authors: 8
  • Average comments per issue: 5.77
  • Average comments per pull request: 1.06
  • Merged pull requests: 30
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 3
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 13 hours
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 2.67
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • francispoulin (15)
  • thoeschler (8)
  • apatlpo (7)
  • yesint (6)
  • sebglane (3)
  • loiseaujc (3)
  • liqihao2000 (3)
  • ShengChenBNU (2)
  • fnauman (2)
  • hjlFrist (1)
  • maniset (1)
  • mikaem (1)
  • atif4321 (1)
  • MiroK (1)
  • CharlesJQuarra (1)
Pull Request Authors
  • mikaem (20)
  • sebglane (4)
  • thoeschler (4)
  • dependabot[bot] (3)
  • apatlpo (2)
  • jaisw7 (1)
  • codacy-badger (1)
  • liu-ziyuan-math (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (3) github_actions (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 109 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 4
    (may contain duplicates)
  • Total versions: 83
  • Total maintainers: 1
pypi.org: shenfun

Shenfun -- Automated Spectral-Galerkin framework

  • Versions: 49
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 109 Last month
Rankings
Stargazers count: 5.4%
Forks count: 6.3%
Dependent packages count: 10.0%
Average: 10.4%
Dependent repos count: 11.6%
Downloads: 18.4%
Maintainers (1)
Last synced: 4 months ago
conda-forge.org: shenfun

Shenfun is a high performance computing platform for solving partial differential equations (PDEs) by the spectral Galerkin method. The platform can be used for any PDE, but applications are limited to multidimensional tensor product grids. The code is parallelized with MPI through the mpi4py-fft package.

  • Versions: 34
  • Dependent Packages: 0
  • Dependent Repositories: 2
Rankings
Dependent repos count: 20.2%
Forks count: 27.8%
Stargazers count: 28.2%
Average: 32.0%
Dependent packages count: 51.6%
Last synced: 4 months ago

Dependencies

binder/environment.yml conda
  • matplotlib
  • shenfun
conf/conda/component-requirements.txt pypi
  • quadpy *
docs/environment.yml pypi
  • sphinxcontrib-bibtex *
requirements.txt pypi
  • cython *
  • mpi4py *
  • mpi4py-fft *
  • numpy >=1.15
  • pyyaml *
  • scipy >=1.0.0
  • sympy *
setup.py pypi
  • mpi4py-fft *