2D Stokes problem#
We consider the problem of a flow entrained in a cavity, say
with
This problem has the following variational formulation: find
The following XLiFE++ implementation of this problem solves the 2D Stokes problem using different couples of approximation for the velocity
Using Paraview with the Glyph filter that represents 2D vectors with arrows, we get the following pictures:

Fig. 11 Solution of the 2D Stokes problem using different approximations#
Note that to approximate the space p
has been used. Such a condition is quite costly because it interacts with all the pressure dofs. If we remove it, the matrix becomes singular (the pressure being defined to within a constant) and direct solvers fail. But iterative solvers do converge to the right velocity, and pressure to the right constant, determined by the initial guess of the iterative solver !
Note also that, when using Crouzeix-Raviart element, in order to visualize the velocity, it is required to project the CR solution in a standard Lagrange finite element space (here