| 1 |
from ufl_legacy import (Coefficient, dx, FiniteElement, VectorElement, |
| 2 |
div, dot, inner, grad, |
| 3 |
tetrahedron, TestFunction, TrialFunction) |
| 4 |
|
| 5 |
element = VectorElement("Lagrange", tetrahedron, 1) |
| 6 |
|
| 7 |
v = TestFunction(element) |
| 8 |
u = TrialFunction(element) |
| 9 |
|
| 10 |
constant_scalar = FiniteElement("Discontinuous Lagrange", tetrahedron, 0) |
| 11 |
constant_vector = VectorElement("Discontinuous Lagrange", tetrahedron, 0) |
| 12 |
|
| 13 |
w = Coefficient(constant_vector) |
| 14 |
d1 = Coefficient(constant_scalar) |
| 15 |
d2 = Coefficient(constant_scalar) |
| 16 |
k = Coefficient(constant_scalar) |
| 17 |
nu = Coefficient(constant_scalar) |
| 18 |
|
| 19 |
G_a = inner(v, u)*dx + 0.5*k*nu*inner(grad(v), grad(u))*dx + 0.5*k*inner(v, dot(w, grad(u)))*dx |
| 20 |
SD_a = d1*0.5*k*dot(dot(w, grad(v)), dot(w, grad(u)))*dx + d2*0.5*k*div(v)*div(u)*dx |
| 21 |
|
| 22 |
a = G_a + SD_a |