| 1 |
This demo illustrates how to: |
| 2 |
|
| 3 |
* Read mesh and subdomains from file |
| 4 |
* Use mixed function spaces |
| 5 |
|
| 6 |
The mesh and subdomains look as follows: |
| 7 |
|
| 8 |
.. image:: ../plot_mesh.png |
| 9 |
|
| 10 |
.. image:: ../plot_mesh_boundaries.png |
| 11 |
|
| 12 |
and the solution of u and p, respectively: |
| 13 |
|
| 14 |
.. image:: ../plot_u.png |
| 15 |
|
| 16 |
.. image:: ../plot_p.png |
| 17 |
|
| 18 |
Equation and problem definition |
| 19 |
------------------------------- |
| 20 |
|
| 21 |
Strong formulation |
| 22 |
^^^^^^^^^^^^^^^^^^ |
| 23 |
|
| 24 |
.. math:: |
| 25 |
- \nabla \cdot (\nabla u + p I) &= f \quad {\rm in} \ \Omega, \\ |
| 26 |
\nabla \cdot u &= 0 \quad {\rm in} \ \Omega. \\ |
| 27 |
|
| 28 |
|
| 29 |
.. note:: |
| 30 |
The sign of the pressure has been flipped from the classical |
| 31 |
definition. This is done in order to have a symmetric (but not |
| 32 |
positive-definite) system of equations rather than a |
| 33 |
non-symmetric (but positive-definite) system of equations. |
| 34 |
|
| 35 |
A typical set of boundary conditions on the boundary :math:`\partial |
| 36 |
\Omega = \Gamma_{D} \cup \Gamma_{N}` can be: |
| 37 |
|
| 38 |
.. math:: |
| 39 |
u &= u_0 \quad {\rm on} \ \Gamma_{D}, \\ |
| 40 |
\nabla u \cdot n + p n &= g \, \quad\;\; {\rm on} \ \Gamma_{N}. \\ |
| 41 |
|
| 42 |
|
| 43 |
Weak formulation |
| 44 |
^^^^^^^^^^^^^^^^ |
| 45 |
|
| 46 |
The Stokes equations can easily be formulated in a mixed variational |
| 47 |
form; that is, a form where the two variables, the velocity and the |
| 48 |
pressure, are approximated simultaneously. Using the abstract |
| 49 |
framework, we have the problem: find :math:`(u, p) \in W` such that |
| 50 |
|
| 51 |
.. math:: |
| 52 |
a((u, p), (v, q)) = L((v, q)) |
| 53 |
|
| 54 |
for all :math:`(v, q) \in W`, where |
| 55 |
|
| 56 |
.. math:: |
| 57 |
|
| 58 |
a((u, p), (v, q)) |
| 59 |
&= \int_{\Omega} \nabla u \cdot \nabla v |
| 60 |
- \nabla \cdot v \ p |
| 61 |
+ \nabla \cdot u \ q \, {\rm d} x, \\ |
| 62 |
L((v, q)) |
| 63 |
&= \int_{\Omega} f \cdot v \, {\rm d} x |
| 64 |
+ \int_{\partial \Omega_N} g \cdot v \, {\rm d} s. \\ |
| 65 |
|
| 66 |
The space :math:`W` should be a mixed (product) function space |
| 67 |
:math:`W = V \times Q`, such that :math:`u \in V` and :math:`q \in Q`. |
| 68 |
|
| 69 |
Domain and boundary conditions |
| 70 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 71 |
|
| 72 |
In this demo, we shall consider the following definitions of the input functions, the domain, and the boundaries: |
| 73 |
|
| 74 |
* :math:`\Omega = [0,1]\times[0,1] \backslash {\rm dolphin}` (a unit cube) |
| 75 |
* :math:`\Gamma_D =` |
| 76 |
* :math:`\Gamma_N =` |
| 77 |
* :math:`u_0 = (- \sin(\pi x_1), 0.0)` for :math:`x_0 = 1` and :math:`u_0 = (0.0, 0.0)` otherwise |
| 78 |
* :math:`f = (0.0, 0.0)` |
| 79 |
* :math:`g = (0.0, 0.0)` |