stokes_2d_exact, a FORTRAN90 code which evaluates exact solutions to the incompressible steady Stokes equations in 2D.

The incompressible steady 2D Stokes equations seek functions u(x,y), v(x,y), (the velocity vector) and p(x,y) (the pressure) such that

        - uxx - uyy + dpdx = f
        - vxx - vyy + dpdy = g
          ux  + vy         = h
while satisfying boundary conditions for u and v, and a normalization condition for p, such as specifying its value at one point, or requiring that the integral of p over the region be 0.

Three exact solution fields are provided here.


The computer code and data files made available on this web page are distributed under the MIT license


stokes_2d_exact is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

gnuplot_test, FORTRAN90 codes which write data and command files so that gnuplot() can create plots.

NAVIER_STOKES_2D_EXACT, a FORTRAN90 code which evaluates an exact solution to the incompressible time-dependent Navier-Stokes equations over an arbitrary domain in 2D.



  1. Junping Wang, Yanqiu Wang, Xiu Ye,
    A robust numerical method for Stokes equations based on divergence-free H(div) finite element methods,
    SIAM Journal on Scientific Computing,
    Volume 31, Number 4, 2009, pages 2784-2802.
  2. Howard Elman, Alison Ramage, David Silvester,
    Finite Elements and Fast Iterative Solvers with Applications in Incompressible Fluid Dynamics,
    Oxford, 2005,
    ISBN: 978-0198528678,
    LC: QA911.E39.

Source Code:

Last revised on 30 August 2020.