
This demo illustrates how to:

* Solve the Stokes problem using a stabilized method

The velocity :math:`u` and :math:`p` will look as follows:

.. image:: ../plot_u.png

.. image:: ../plot_p.png

Equation and problem definition
-------------------------------

Strong formulation of the problem:

.. math::
	- \nabla \cdot (\nabla u + p I) &= f \quad {\rm in} \ \Omega, \\
                	\nabla \cdot u &= 0 \quad {\rm in} \ \Omega. \\

.. note::
	The sign of the pressure has been flipped from the classical
	definition. This is done in order to have a symmetric (but not
	positive-definite) system of equations rather than a
	non-symmetric (but positive-definite) system of equations.

A typical set of boundary conditions on the boundary :math:`\partial
\Omega = \Gamma_{D} \cup \Gamma_{N}` can be:

.. math::
	u &= u_0 \quad {\rm on} \ \Gamma_{D}, \\
	\nabla u \cdot n + p n &= g   \quad {\rm on} \ \Gamma_{N}. \\

The Stokes equations can easily be formulated in a mixed variational
form; that is, a form where the two variables, the velocity and the
pressure, are approximated simultaneously. Using the abstract
framework, we have the problem: find :math:`(u, p) \in W` such that

.. math::
	a((u, p), (v, q)) = L((v, q))

for all :math:`(v, q) \in W`, where

.. math::
	a((u, p), (v, q))
				&= \int_{\Omega} \nabla u \cdot \nabla v
                 - \nabla \cdot v \ p
                 + \nabla \cdot u \ q \, {\rm d} x, \\
	L((v, q))
				&= \int_{\Omega} f \cdot v \, {\rm d} x \, {\rm d} s. \\

The space :math:`W` should be a mixed (product) function space:
:math:`W = V \times Q` such that :math:`u \in V` and :math:`q \in
Q`. In this demo we will use first order elements in both velocity and
pressure, which will lead to stability problems. Therefore we use a
stabilized variational formulation. It reads as follows: find
:math:`(u, p) \in W` such that

.. math::
	a((u, p), (v, q)) = L((v, q))

for all :math:`(v, q) \in W`, where

.. math::
	a((u, p), (v, q))
				&= \int_{\Omega} \nabla u \cdot \nabla v
                 - \nabla \cdot v \ p
                 + \nabla \cdot u \ q
                 + \delta \nabla q \cdot \nabla p \, {\rm d} x, \\
	L((v, q))
				&= \int_{\Omega} f \cdot v \, {\rm d} x
    			+ \delta \nabla q \cdot f \, {\rm d} s.

where :math:`\delta = \beta h^2` and :math:`\beta` is some number and :math:`h` is the mesh cell size.

In this demo, we shall consider the following definitions of the input
functions, the domain, and the boundaries:

* :math:`(\Omega = [0,1]\times[0, 1]) \backslash {\rm dolphin}`
* :math:`\Gamma_D =`
* :math:`\Gamma_N =`
* :math:`u_0 = (- \sin(\pi x_1), 0.0) \, {\rm for} \, x_0 = 1 \, {\rm and} \, u_0 = (0.0, 0.0)` otherwise
* :math:`f = (0.0, 0.0)`
* :math:`g = (0.0, 0.0)`
