| 1 |
This demo solves the incompressible Navier-Stokes equations. It |
| 2 |
illustrates how to: |
| 3 |
|
| 4 |
* Implement a splitting method where different fields are coupled |
| 5 |
via a set of partial differential equations |
| 6 |
* Use different iterative solvers and different preconditioners for |
| 7 |
different steps of the solution process |
| 8 |
* Use time-dependent Expressions |
| 9 |
* Set boundary conditions based on geometric constraints |
| 10 |
* Perform time-stepping |
| 11 |
|
| 12 |
Equation and solution method |
| 13 |
---------------------------- |
| 14 |
|
| 15 |
We consider the incompressible Navier-Stokes equations on a domain |
| 16 |
:math:`\Omega \subset \mathbb{R}^2`, consisting of a pair of momentum |
| 17 |
and continuity equations: |
| 18 |
|
| 19 |
.. math:: |
| 20 |
|
| 21 |
\dot{u} + \nabla u \cdot u - \nu \Delta u + \nabla p &= f, \\ |
| 22 |
\nabla \cdot u = 0. |
| 23 |
|
| 24 |
Here, :math:`u` is the unknown velocity, :math:`p` is the unknown |
| 25 |
pressure, :math:`\nu` is the kinematic viscosity, and :math:`f` is a |
| 26 |
given source. There exist many solution strategies for the |
| 27 |
incompressible Navier-Stokes equations. One of the oldest is the |
| 28 |
splitting method proposed by Chorin (1968) and Temam (1969), often |
| 29 |
refered to as Chorin's method. |
| 30 |
|
| 31 |
In Chorin's method, one first ignores the pressure in the momentum |
| 32 |
equation and computes the *tentative velocity* :math:`u_h^{\star}` |
| 33 |
according to: |
| 34 |
|
| 35 |
.. math:: |
| 36 |
|
| 37 |
\langle (u_h^{\star} - u_h^{n-1}) / \Delta t_n, v \rangle + |
| 38 |
\langle \nabla u_h^{n-1} \cdot u_h^{n-1}, v \rangle + |
| 39 |
\langle \nu \nabla u_h^{\star}, \nabla v \rangle = |
| 40 |
\langle f, v \rangle . |
| 41 |
|
| 42 |
Here, :math:`\langle \cdot, \cdot \rangle` denotes the |
| 43 |
:math:`L^2(\Omega)` inner product. Subsequently, the velocity is |
| 44 |
projected to the space of divergence free fields. This step may be |
| 45 |
obtained by subtracting the variational problem for the tentative |
| 46 |
velocity :math:`u_h^{\star}` from the incompressible Navier-Stokes |
| 47 |
equations and using the continuity equation. One obtains the following |
| 48 |
pair of equations for computing the velocity :math:`u_h^n` and |
| 49 |
pressure :math:`p_h^n` at time :math:`t = t_n` based on the tentative |
| 50 |
velocity :math:`u_h^{\star}`: |
| 51 |
|
| 52 |
.. math:: |
| 53 |
|
| 54 |
\langle \nabla p^n, \nabla q \rangle &= |
| 55 |
- \langle \nabla \cdot u_h^{\star}, q \rangle / \Delta t_n, \\ |
| 56 |
\langle u_h^n, v \rangle &= |
| 57 |
\langle u_h^{\star}, v \rangle - \Delta t_n \langle \nabla p^n, v \rangle. |
| 58 |
|
| 59 |
Problem definition |
| 60 |
------------------ |
| 61 |
|
| 62 |
In this demo, we solve the incompressible Navier-Stokes equations on |
| 63 |
an L-shaped domain. The L-shape is the subset of the unit square |
| 64 |
obtained by removing the upper right quadrant. |
| 65 |
|
| 66 |
The flow is driven by an oscillating pressure |
| 67 |
:math:`p_{\mathrm{in}}(t) = \sin 3t` at the inflow :math:`y = 1` while |
| 68 |
the pressure is kept constant :math:`p_{\mathrm{out}} = 0` at the |
| 69 |
outflow :math:`x = 1`. |
| 70 |
|
| 71 |
At the inflow and outflow, we impose free flow ("do nothing") boundary |
| 72 |
conditions for the velocity and no-slip boundary conditions on the |
| 73 |
remaining boundary. |
| 74 |
|
| 75 |
The (kinematic) viscosity is set to :math:`\nu = 0.01`, the time step |
| 76 |
is :math:`\Delta t = 0.01` and the length of the time interval is |
| 77 |
:math:`T = 3`. The solution is computed using continuous vector-valued |
| 78 |
piecewise quadratics for the velocity, and continuous scalar piecewise |
| 79 |
linears for the pressure (the Taylor-Hood elements). |
| 80 |
|
| 81 |
With the above input the solution for the velocity :math:`u` and pressure |
| 82 |
:math:`p` will look as follows: |
| 83 |
|
| 84 |
.. image:: ../navier-stokes_u.png |
| 85 |
:scale: 75 |
| 86 |
:align: center |
| 87 |
|
| 88 |
.. image:: ../navier-stokes_p.png |
| 89 |
:scale: 75 |
| 90 |
:align: center |
| 91 |
|