Skip to content

Incompressible Navier-Stokes equations

The incompressible Navier-Stokes equations describe conservation of mass and conservation of momentum, which can be written as a divergence-free constraint and an evolution equation:

u=0,ut+(uuT)=p+ν2u+f,

where ΩRd is the domain, d{2,3} is the spatial dimension, u=(u1,,ud) is the velocity field, p is the pressure, ν is the kinematic viscosity, and f=(f1,,fd) is the body force per unit of volume. The velocity, pressure, and body force are functions of the spatial coordinate x=(x1,,xd) and time t. We assume that Ω is a rectangular domain.

The equations are stated here in dimensionless form with a reference length and velocity of unity, in which case the viscosity is the inverse of the Reynolds number: ν=1/Re. In the code, the viscosity is passed directly, e.g. params = (; viscosity = 1e-3).

Integral form

The integral form of the Navier-Stokes equations is used as starting point to develop a spatial discretization:

1|O|OundΓ=0,ddt1|O|OudΩ=1|O|O(uuTpI+νu)ndΓ+1|O|OfdΩ,

where OΩ is an arbitrary control volume with boundary O, normal n, surface element dΓ, and volume size |O|. We have divided by the control volume sizes in the integral form, so that all terms have the same units as their differential counterparts.

Boundary conditions

The boundary conditions on a part of the boundary ΓΩ are one or more of the following:

  • Dirichlet: u=uBC on Γ for some uBC;

  • Neumann: un=0 on Γ;

  • Periodic: u(x)=u(x+τ) and p(x)=p(x+τ) for xΓ, where Γ+τΩ is another part of the boundary and τ is a translation vector;

  • Stress free: σn=0 on Γ, where σ=(pI+2νS).

See Problem setup for how to prescribe boundary conditions in the code.

Pressure equation

Taking the divergence of the momentum equations yields a Poisson equation for the pressure:

2p=((uuT))f

Note the absence of time derivatives in the pressure equation. While the velocity field evolves in time, the pressure only changes such that the velocity stays divergence free.

If there are no pressure boundary conditions, the pressure is only unique up to a constant. Since only the gradient of the pressure appears in the equations, this constant can be set to zero without affecting the velocity field.

Other quantities of interest

Kinetic energy

The local and total kinetic energy are defined by k=12u22 and K=12uL2(Ω)2=ΩkdΩ. In the absence of viscosity, boundaries, and body forces, the total kinetic energy is conserved. The discretization used in this package preserves this property (see Spatial and temporal discretization).

Vorticity

The vorticity is defined as ω=×u.

In 2D, it is a scalar field given by

ω=u1x2+u2x1.

In 3D, it is a vector field given by

ω=(u2x3+u3x2u3x1+u1x3u1x2+u2x1).

Note that the 2D vorticity is equal to the x3-component of the 3D vorticity.