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