Geilo Winter School 2012
Lecture 7: Dynamic hyperelasticity in FEniCS
Anders Logg
1 / 10
Course outline
Sunday
L1 Introduction to FEM
Monday
L2 Fundamentals of continuum mechanics (I)
L3 Fundamentals of continuum mechanics (II)
L4 Introduction to FEniCS
Tuesday
L5 Solid mechanics
L6 Static hyperelasticity in FEniCS
L7 Dynamic hyperelasticity in FEniCS
Wednesday
L8 Fluid mechanics
L9 Navier–Stokes in FEniCS
2 / 10
Dynamic hyperelasticity
ρü − div P = B in Ω × (0, T ]
u=g on ΓD × (0, T ]
P ·n=T on ΓN × (0, T ]
u(·, 0) = u0 in Ω
u̇(·, 0) = u1 in Ω
• u is the displacement
• ρ is the (reference) density
• P = P (u) is the first Piola–Kirchoff stress tensor
• B is a given body force per unit volume
• g is a given boundary displacement
• T is a given boundary traction
• u0 and u1 are given initial displacement and velocity
3 / 10
Variational problem
Rewrite as a first-order system by introducing p = u̇:
ρṗ − div P = B
u̇ − p = 0
Multiply by test functions v and q and sum up:
Z tn Z Z tn Z Z tn Z
(ρṗ−div P )·v dx dt+ (u̇−p)·q dx dt = B·v dx
tn−1 Ω tn−1 Ω tn−1 Ω
Integrate by parts and use v = 0 on ΓD and P · n = T on ΓN :
Z tn Z Z tn Z
ρṗ · v dx dt + P : grad v dx dt
tn−1 Ω tn−1 Ω
Z tn Z Z tn Z
+ u̇ · q dx dt − p · q dx dt
tn−1 Ω tn−1 Ω
Z tn Z Z tn Z
= B · v dx dt + T · v ds dt
tn−1 Ω tn−1 ΓN
4 / 10
Time discretization
Let the trial functions u, p be continuous and piecewise linear
in time, and let the test functions v, q be piecewise constant:
Z tn Z Z
ρṗ · v dx dt = ρ(p(·, tn ) − p(·, tn−1 )) · v dx
tn−1 Ω Ω
Z tn Z Z
u̇ · q dx dt = (u(·, tn ) − u(·, tn−1 )) · q dx
tn−1 Ω Ω
Z tn Z Z
p · q dx dt = kn p(·, tn−1/2 ) · q dx
tn−1 Ω Ω
where kn = tn − tn−1 and p(·, tn−1/2 ) = p(·, tn − kn /2)
Approximate other integrals by midpoint quadrature:
Z tn Z Z
P : grad v dx dt ≈ kn P (u(·, tn−1/2 ) : grad v dx
tn−1 Ω Ω
This is cG(1) or Crank–Nicolson method
5 / 10
Discrete problem
Find (un , pn ) ∈ Vh such that
Z Z
ρ(pn − pn−1 ) · v dx + kn P (un−1/2 ) : grad v dx
Ω Z Ω Z
n n−1
+ (u − u ) · q dx − kn pn−1/2 · q dx
Ω Z Ω Z
n−1/2
= kn B · v dx + kn T n−1/2 · v ds
Ω ΓN
for all (v, q) ∈ V̂h
6 / 10
Stress–strain relations
• F = I + grad u is the deformation gradient
• C = F > F is the right Cauchy–Green tensor
• E = 21 (C − I) is the Green–Lagrange strain tensor
• W = W (E) is the strain energy density
∂W
• Sij = ∂E
ij
is the second Piola–Kirchoff stress tensor
• P = F S is the first Piola–Kirchoff stress tensor
St. Venant–Kirchoff strain energy function:
λ
W (E) = (tr(E))2 + µ tr(E 2 )
2
7 / 10
Useful FEniCS tools (I)
Defining mixed function spaces:
V = V e ct o r Fu n c tionSpace ( mesh , " CG " , 1 )
VV = V * V
Defining subfunctions:
up = Function ( VV )
u , p = split ( up )
Shortcut:
u , p = Functions ( VV )
8 / 10
Useful FEniCS tools (II)
Time-stepping
t = dt
while t < T + DOLFIN_EPS :
# Solve variational problem
solve (...)
# Move to next interval
t + = dt
u0 . assign ( u1 )
# use up0 . assign ( up1 ) for a mixed system
9 / 10
The FEniCS challenge!
Compute the deflection of a regular 10 × 2 LEGO brick as
function of time. Use the St. Venant–Kirchhoff model and
assume that the LEGO brick is made of PVC plastic. The
LEGO brick is subject to gravity of size g = −9.81 m/s2 and a
downward traction of size 5000 N/m2 at its end point. At time
t = 0, the brick is at rest in its undeformed state.
g = −9.81m/s2
T = 5000 N/m2
To check your solution, compute the average value of the
displacement in the z-direction at time T = 0.05. Use a time
step of size k = 0.002.
The student(s) who first produce the right anwswer will be
rewarded with an exclusive FEniCS coffee mug! 10 / 10