This project implements a numerical simulation of the 2D Navier-Stokes equations in the
Fr En
- 2D simulation of Navier-Stokes equations in the
$\omega-\psi$ formulation - Use of the pseudo-spectral method (Fourier Transforms with FFTW)
- GTK graphical interface for parameter control
- Parallelization with OpenMP for better performance
- Real-time visualization of results
- Export of results to video via ffmpeg
A detailed demonstration of the
The pseudo-spectral method combines the advantages of spectral methods and physical space methods:
- Fourier Transforms: Spatial derivatives are computed in spectral space, where they become simple multiplications.
- Non-linear terms: Computed in physical space to avoid costly convolutions.
For more details on the implementation, see docs/English/Pseudo_Spectral_method.md.
navier-stokes-spectral/
├── app/ # Main Fortran code
├── src/ # Fortran source code
├── docs/ # Documentation
│ ├── French/ # Documentation in French
│ └── English/ # Documentation in English
├── data/ # Folder for results
└── fpm.toml # Project configuration
The program allows simulation of three classic flow types in fluid mechanics:
This simulation shows the interaction of several vortices that can rotate in the same direction (co-rotating) or in opposite directions (counter-rotating). This phenomenon is particularly interesting in aerodynamics and meteorology.
This instability occurs at the interface between two fluids moving at different speeds. It manifests as the formation of characteristic vortices.
This classic test case in fluid mechanics allows the study of the transition to turbulence.
The following dependencies are required:
- Fortran Compiler (gfortran recommended)
- GTK (version 4.x)
- fpm (version 0.9.0 or higher)
- FFTW (version 3.x)
- ffmpeg (for video export)
- OpenMP (for parallelization)
# Install system dependencies
sudo apt-get update
sudo apt-get install gfortran libgtk-3-dev libfftw3-dev ffmpeg libomp-dev
# Install fpm
curl -Lo fpm https://github.com/fortran-lang/fpm/releases/download/v0.11.0/fpm-0.11.0-linux-x86_64-gcc-12
chmod +x fpm
sudo mv fpm /usr/local/bin# Install dependencies
pacman -Syu
pacman -S mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-gtk3 mingw-w64-x86_64-fftw mingw-w64-x86_64-ffmpeg
# Install fpm
pacman -S git mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-fpm# Install dependencies
brew install gcc gtk+3 fftw ffmpeg libomp
# Install fpm
brew tap fortran-lang/homebrew-fortran
brew install fpm# Clone the repository
git clone https://github.com/Minard-Jules/navier-stokes-spectral
cd navier-stokes-spectral
# Compile and run
fpm run- Open the graphical interface
- Set the parameters :
- Spatial resolution (Nx, Ny)
- Reynolds number
- Time step
- Simulation duration
- Select the type of flow
- Start the simulation
- Velocity fields
- Vorticity
- Stream function
vorticity_mag.mp4
vorticity_mag_jet.mp4
Results are automatically saved in the data/ folder in the following formats :
- Data files (.vtk)
- Videos (.mp4)
This project is licensed under the MIT License - see the LICENSE file for details.
- Minard Jules: Creator and main maintainer of the project