| 1 |
# Copyright (c) 2005-2007 Anders Logg |
| 2 |
# |
| 3 |
# This file is part of DOLFIN. |
| 4 |
# |
| 5 |
# DOLFIN is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU Lesser General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# DOLFIN is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU Lesser General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU Lesser General Public License |
| 16 |
# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
# |
| 18 |
# The bilinear form a(u, v) and Linear form L(v) for the Stokes |
| 19 |
# equations using a mixed formulation (Taylor-Hood elements). |
| 20 |
# |
| 21 |
# Compile this form with FFC: ffc -l dolfin -f split Stokes.ufl |
| 22 |
|
| 23 |
from ufl_legacy import (Coefficient, dx, FiniteElement, VectorElement, |
| 24 |
div, dot, inner, grad, |
| 25 |
tetrahedron, TestFunction, TrialFunction) |
| 26 |
|
| 27 |
P2 = VectorElement("Lagrange", tetrahedron, 2) |
| 28 |
P1 = FiniteElement("Lagrange", tetrahedron, 1) |
| 29 |
|
| 30 |
u = TrialFunction(P2) |
| 31 |
p = TrialFunction(P1) |
| 32 |
v = TestFunction(P2) |
| 33 |
q = TestFunction(P1) |
| 34 |
|
| 35 |
f = Coefficient(P2) |
| 36 |
g = Coefficient(P1) |
| 37 |
c = Coefficient(P1) |
| 38 |
|
| 39 |
a00 = inner(grad(u), grad(v))*dx |
| 40 |
a01 = -div(v)*p*dx |
| 41 |
a10 = -div(u)*q*dx |
| 42 |
a11 = c*p*q*dx |
| 43 |
|
| 44 |
L0 = dot(f, v)*dx |
| 45 |
L1 = dot(g, q)*dx |
| 46 |
|
| 47 |
forms = [a00, a01, a10, a11, L0, L1] |