Debian Codegraph @

bench/HyperElasticity.ufl

raw
1 # Copyright (C) 2009 Harish Narayanan
2 #
3 # This file is part of FFC.
4 #
5 # FFC 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 # FFC 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 FFC. If not, see <http://www.gnu.org/licenses/>.
17 #
18 # First added: 2009-09-29
19 # Last changed: 2011-07-01
20 #
21 # The bilinear form a(u, v) and linear form L(v) for
22 # a hyperelastic model. (Copied from dolfin/demo/pde/hyperelasticity/cpp)
23 #
24 # Compile this form with FFC: ffc HyperElasticity.ufl.
25
26 # Coefficient spaces
27 element = VectorElement("Lagrange", tetrahedron, 1)
28
29 # Coefficients
30 v = TestFunction(element) # Test function
31 du = TrialFunction(element) # Incremental displacement
32 u = Coefficient(element) # Displacement from previous iteration
33
34 B = Coefficient(element) # Body force per unit mass
35 T = Coefficient(element) # Traction force on the boundary
36
37 # Kinematics
38 d = len(u)
39 I = Identity(d) # Identity tensor
40 F = I + grad(u) # Deformation gradient
41 C = F.T*F # Right Cauchy-Green tensor
42 E = (C - I)/2 # Euler-Lagrange strain tensor
43 E = variable(E)
44
45 # Material constants
46 mu = Constant(tetrahedron) # Lame's constants
47 lmbda = Constant(tetrahedron)
48
49 # Strain energy function (material model)
50 psi = lmbda/2*(tr(E)**2) + mu*tr(E*E)
51
52 S = diff(psi, E) # Second Piola-Kirchhoff stress tensor
53 P = F*S # First Piola-Kirchoff stress tensor
54
55 # The variational problem corresponding to hyperelasticity
56 L = inner(P, grad(v))*dx - inner(B, v)*dx - inner(T, v)*ds
57 a = derivative(L, u, du)