| 1 |
|
| 2 |
This demo illustrates how to: |
| 3 |
|
| 4 |
* Maintain symmetry when assembling a system of symmetric equations |
| 5 |
with essential (Dirichlet) boundary conditions |
| 6 |
* Use a iterative solver explicitly for solving a linear system of equations |
| 7 |
* Define a preconditioner explicitly using a form |
| 8 |
|
| 9 |
|
| 10 |
Strong form of the Stokes equations |
| 11 |
----------------------------------- |
| 12 |
|
| 13 |
The incompressible Stokes equations in strong form read: for a domain |
| 14 |
:math:`\Omega \subset \mathbb{R}^n`, find the velocity :math:`u` and |
| 15 |
the pressure :math:`p` satisfying |
| 16 |
|
| 17 |
.. math:: |
| 18 |
- \nabla \cdot (\nabla u + p I) &= f \quad {\rm in} \ \Omega, \\ |
| 19 |
\nabla \cdot u &= 0 \quad {\rm in} \ \Omega. \\ |
| 20 |
|
| 21 |
|
| 22 |
.. note:: |
| 23 |
|
| 24 |
The sign of the pressure has been flipped from the classical |
| 25 |
definition. This is done in order to have a symmetric (but not |
| 26 |
positive-definite) system of equations rather than a non-symmetric |
| 27 |
(but positive-definite) system of equations. |
| 28 |
|
| 29 |
A typical set of boundary conditions on the boundary :math:`\partial |
| 30 |
\Omega = \Gamma_{D} \cup \Gamma_{N}` can be: |
| 31 |
|
| 32 |
.. math:: |
| 33 |
u &= u_0 \quad {\rm on} \ \Gamma_{D}, \\ |
| 34 |
\nabla u \cdot n + p n &= g \quad {\rm on} \ \Gamma_{N}. \\ |
| 35 |
|
| 36 |
|
| 37 |
Weak form of the Stokes equations |
| 38 |
--------------------------------- |
| 39 |
|
| 40 |
The Stokes equations can easily formulated in a mixed variational |
| 41 |
form; that is, a form where the two variables, the velocity and the |
| 42 |
pressure, are approximated simultaneously. Using the abstract |
| 43 |
framework, we have the problem: find :math:`(u, p) \in W` such that |
| 44 |
|
| 45 |
.. math:: |
| 46 |
a((u, p), (v, q)) = L((v, q)) |
| 47 |
|
| 48 |
for all :math:`(v, q) \in W` where |
| 49 |
|
| 50 |
.. math:: |
| 51 |
a((u, p), (v, q)) |
| 52 |
&= \int_{\Omega} \nabla u \cdot \nabla v |
| 53 |
+ \nabla \cdot v \ p |
| 54 |
+ \nabla \cdot u \ q \, {\rm d} x, \\ |
| 55 |
L((v, q)) |
| 56 |
&= \int_{\Omega} f \cdot v \, {\rm d} x |
| 57 |
+ \int_{\partial \Omega_N} g \cdot v \, {\rm d} s. \\ |
| 58 |
|
| 59 |
The space `W` should be a mixed (product) function space: :math:`W = V |
| 60 |
\times Q` such that :math:`u \in V` and :math:`q \in Q`. |
| 61 |
|
| 62 |
Preconditioning of the linear system of equations |
| 63 |
-------------------------------------------------- |
| 64 |
|
| 65 |
For the resulting linear system of equations, the following form |
| 66 |
defines a suitable preconditioner: |
| 67 |
|
| 68 |
.. math:: |
| 69 |
|
| 70 |
b((u, p), (v, q)) = \int_{\Omega} \nabla u \cdot \nabla v + p \, q \, {\rm d} x |
| 71 |
|
| 72 |
|
| 73 |
Domain and boundary conditions |
| 74 |
------------------------------ |
| 75 |
|
| 76 |
In this demo, we shall consider the following definitions of the input |
| 77 |
functions, the domain, and the boundaries: |
| 78 |
|
| 79 |
* :math:`\Omega = [0,1]^3` (a unit cube) |
| 80 |
* :math:`\Omega_D = \{(x_0, x_1, x_2) \, | \, x_0 = 0 \, \text{or} \, |
| 81 |
x_0 = 1 \, \text{or} \, x_1 = 0 \, \text{or} \, x_1 = 1 \}` |
| 82 |
* :math:`u_0 = (- \sin(\pi x_1), 0.0, 0.0)` for :math:`x_0 = 1` and |
| 83 |
:math:`u_0 = (0.0, 0.0, 0.0)` otherwise |
| 84 |
* :math:`f = (0.0, 0.0, 0.0)` |
| 85 |
* :math:`g = (0.0, 0.0, 0.0)` |