NaokiHori / SpectralNSSolver1

Fourier-Galerkin-based massively-parallelised Navier-Stokes solver

Home Page:https://naokihori.github.io/SpectralNSSolver1/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spectral NS Solver 1

License CI DOCS LastCommit

https://github.com/NaokiHori/SpectralNSSolver1/blob/main/docs/source/thumbnail.jpg https://github.com/NaokiHori/SpectralNSSolver1/blob/main/docs/source/thumbnail2.jpg

https://github.com/NaokiHori/SpectralNSSolver1/blob/main/docs/source/thumbnail3.jpg

This library numerically solves the incompressible Navier-Stokes equations with a scalar field in two- and three-dimensional Cartesian domains using the spectral method. This is developed for a self-study purpose to experience by myself the difference between the finite-difference methods and the spectral methods.

Please refer to the documentation for details (under construction).

To initialise the flow field easily, I recommend

  1. Prepare workplace

    mkdir -p /path/to/your/directory
    cd       /path/to/your/directory
  2. Get source

    git clone --recurse-submodules https://github.com/NaokiHori/SpectralNSSolver1
    cd SpectralNSSolver1
  3. Set initial condition

    Although the scalar field can be arbitrary, the velocity field should be solenoidal. main.py offers several examples.

    cd initial_condition
    python3 main.py 0
    cd ..
  4. Build

    make clean
    make output
    make all
  5. Execute

    Parameters are defined in exec.sh.

    bash exec.sh

    This may take a few minutes, depending on your machine spec.

The flow fields are saved under output/save/ in NPY format. Note that these velocities are in the spectral domain; you need to perform the inverse Fourier transform (and the normalisation) to recover the velocities in the physical domain.

If proper Python libraries are installed, you can visualise the flow fields by

python3 visualise/2d.py

Please checkout 3d branch and re-compile the whole source files. You also need to re-generate the initial flow field.

  • Canuto et al., Spectral Methods - Fundamentals in Single Domains, Springer
  • Canuto et al., Spectral Methods - Evolution to Complex Geometries and Applications to Fluid Dynamics, Springer

I would like to thank Dr. Chris Howland for fruitful discussions.

About

Fourier-Galerkin-based massively-parallelised Navier-Stokes solver

https://naokihori.github.io/SpectralNSSolver1/

License:MIT License


Languages

Language:C 84.0%Language:Python 13.8%Language:Makefile 1.5%Language:Shell 0.7%