Repository navigation
NavierStokes2D solves the incompressible Navier–Stokes equations in two dimensions, in vorticity form, on a doubly periodic square. It is a short MATLAB code written for teaching: derivatives and the velocity are computed in Fourier space and the advection term on the grid (a Fourier pseudo-spectral method, with the upper half of the wavenumbers switched off against aliasing), and the vorticity is advanced in time by the adaptive integrator ode113 at the tolerance 10⁻¹⁰.
∂ω/∂t + u ∂ω/∂x + v ∂ω/∂y = ν Δω, u = ∂ψ/∂y, v = −∂ψ/∂x, −Δψ = ω, ν = 10⁻⁴
No article accompanies the code. If you use it, please cite the software itself; the button "Cite this repository" gives the reference, read from CITATION.cff.
https://github.com/dutykh/NavierStokes2D
The code is that of November 2016, unchanged. This first release documents it: the README now states the equations, the domain, the initial vorticity with its random amplitudes, the numerical method and its parameters, how to run the code and what it needs (MATLAB; GNU Octave lacks RandStream and ode113), and shows the vorticity of the shipped run at four instants, computed in MATLAB at the full resolution of 1024 × 1024 modes by the two scripts of docs/figures. Along this run the energy lost, E(0) − E(5.1) = 8.754264 × 10⁻⁵, matches the dissipation 2ν ∫ Z dt = 8.754262 × 10⁻⁵ to seven digits.