Debian Codegraph @

demo/undocumented/contact-vi-tao/cpp/Elasticity.ufl

raw
1 # Copyright (c) 2005 Johan Jansson
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 # Modified by Anders Logg 2006-2007
19 # Modified by Garth N. Wells 2008
20 #
21 # First added: 2005
22 # Last changed: 2011-03-09
23 #
24 # The bilinear form for classical linear elasticity (Navier).
25 # Compile this form with FFC: ffc -l dolfin Elasticity.ufl
26
27 from ufl_legacy import (Coefficient, dx, FiniteElement, VectorElement,
28 grad, inner, Identity, tr,
29 triangle, TestFunction, TrialFunction)
30
31 cell = triangle
32 element = VectorElement("Lagrange", cell, 1)
33 R = FiniteElement("Real", cell, 0)
34
35 u = TrialFunction(element)
36 v = TestFunction(element)
37 f = Coefficient(element)
38
39 mu = Coefficient(R)
40 lmbda = Coefficient(R)
41
42 def epsilon(v):
43 return 0.5*(grad(v) + grad(v).T)
44
45 def sigma(v):
46 return 2.0*mu*epsilon(v) + lmbda*tr(epsilon(v))*Identity(v.geometric_dimension())
47
48 a = inner(sigma(u), epsilon(v))*dx
49 L = inner(f, v)*dx
50