Finite Element Method for Soft Deformable Object Simulation

Introduction

This note is based on SIGGRAPH course of 2012, which introduced basic techniques to simulate elastic material using FEM.


Elastisity in 3D

Deformation and deformation gradient

$X \in \Omega$ is the location of material in undeformed position, and the deformation function $\phi: R^3 \to R^3$ transfer material to its current position.

define deformation gradient $F$ as:

e.x. when the material is on its rest position, $F = I$

Strain energy and hyperelasticity

the deformation energy is defined as

since the local property is fully defined by deformation gradient

thus we can write $\Psi[\phi; X] = \Psi[F]$, there are many energy models such as

Force and traction

Since $f = -\frac{\partial E}{\partial x}$, the force inner and on boundaries are defined:

  • for the volume force, $f_{aggreagte}(A) = \int_A f(X) dX, A \subset \Omega$
  • for the surface force, $f_{aggreagte}(B) = \int_B \tau(X) dS, B \subset \partial \Omega$

First Piola-Kirchhoff stress tensor

$P$ is a $3\times3$ tensor, defined as

  • $\tau = - P \cdot N \iff \tau_j = - P_{ij} N_i$
  • $f = \nabla_X \cdot P \iff f_i = \frac{\partial P_{ij}}{\partial X_j}$

the formula can be derived by calculus of variations


Constitutive Models of Material

Strain Measures

Think of $\Psi(F) = ||F-I||^2_F$, this form of deform energy is not zero when $F$ is just a rigid rotation, so there is another measure to describe the deformation, named Green strain tensor

the Green strain tensor can handle both rest and rigid rotation situation.

Linear Elasticity Model

When $F$ is a small disturb,

then the terms of the strain energy density is

St. Vernan-Kickoff Model

When the deformation is large and $F$ can no longer be represented by $\epsilon$, then the energy density is

There is a vital problem of StVK model, that when the material is compressed, the resistant force may decrease when deformation exceeds a threshold. This may results in the fail of the model.

e.x. For a tetrahedron defined by $O(0, 0, 0), A(1, 0, 0), B(0,1,0), C(0,0,1)$, when $C$ is compressed along z-axis by ratio $l$, the energy on it becomes $\Psi = (\mu + \frac{\lambda}{2} )(\frac{l^2}{2} - 1)^2$, and the force becomes $f= - (\mu + \frac{\lambda}{2} )(l^2 - 2)l$

Corotation Model

Another way to handle rotation is to polar decompose $F = RS$ and compute $\Psi(F) = \Psi(S)$. However, since the decomposition is costly, corotation model is not used widely.

Isotropic Model

An ideal energy function $\Psi(F)$ should remain const when a rigid rotation applied to $F$, namely $\Psi(RF) = \Psi(F)$. An isotropic model has another property that when the material coordinate rotate, the energy density remains const (isotropic), namely $\Psi(FQ) = \Psi(F)$. $F$ can be SVD decomposite to $U^T \Sigma V$, then $\Psi(F) = \Psi(\Sigma) = \Psi(\lambda_1, \lambda_2, \lambda_3)$

there is another way to represent $\Psi$ by invariant

Neo-hookean Model

In order to get over compress problems of StVK model, we can introduce $\log |F|$ into energy density to punish its compression. Neo-hookean model is a specific type of isotropic model.


Dynamics and Simulation

When we want to simulate the interaction of objects in computer, we get tetrahedron mesh representation of objects. Thus we model the whole continue material as piece-wise linear.
For each tetrahedron we can compute a const $F$ and then using

Algorithms for Elastic Force

Deformation gradient $F$ in each tetrahedron is uniform

there is a small tip for force computing:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def precompute():
for each tetrahedron t:
Dm = [X1 - X4, X2 - X4, X3 - X4]
t.Bm = inverse(Dm)
t.V = determinant(Dm)

def computeForce():
for each tetrahedron t:
Ds = [x1 - x4, x2 - x4, x3 - x4]
F = Ds * t.Bm
H = P(F) * t.Bm.transpose()
f1 += H[:,0], f2 += H[:,1], f3 += H[:,2]
f4 -= H[:,0] + H[:,1] + H[:,2]

Algorithms for Stiffness Differential

The influence of $\delta x$ on $f$ for a single tetrahedron can be $12 \times 12$ matrix, since the 3-dim force on 4 vertices can be influenced by 3-dim position of 4 vertices. There is a way to compute this matrix column by column:

since $\delta P (F, \delta F)$ is linear for $\delta F$, namely $\delta P (F, \lambda \delta F) =\lambda \delta P (F, \delta F)$, we can feed different $\frac{\partial F}{\partial x_{ij}}$ into it. Where $x_{ij}$ is the $i$ th element of $j$ th vertex

1
2
3
4
5
6
7
8
9
10
def computeGradient():
for each tetrahedron t:
Ds = [x1 - x4, x2 - x4, x3 - x4]
F = Ds * t.Bm
for dF in F_ij:
dH = dP(F, dF) * t.Bm.transpose()
K(f1, x_ij) += dH[:,0]
K(f2, x_ij) += dH[:,1]
K(f3, x_ij) += dH[:,2]
K(f4, x_ij) -= dH[:,0] + dH[:,1] + dH[:,2]

the method used in FEM simulation of 3D deformable solids: a practitioner’s guide to theory [1] is implicit, namely they only computing $\delta f(x, \delta x)$, and then using iterative methods like conjugate gradient.

However, I introduce a method to compute stiffness matrix explicitly, for the reason that iterative methods are too sloooooow. According to my experiment in practice, implemented in Eigen, CG method is slower than simple Newton Method in a magnitude of $10^2$ (3600 seconds vs 20 seconds )! So, I strongly recommend you to construct stiffness explicitly and use standard sparse linear algebra tools.

Dynamic Equation

The movement of objects obey Newton’s law

using backward Euler method

for each time step $\Delta t$, we need to try the solutions $(x_{t+1}, v_{t+1})$ for backward Euler equation iteratively until converge, denoted as $\{ x_{t+1}^{(0)}, x_{t+1}^{(1)}, …, x_{t+1}^{(k)}, …\}$. Each iteration, we estimate $ f_{sum}(x_{t+1}^{(k+1)}, v_{t+1}^{(k+1)})$ by Taylor series approximation on $(x_{t+1}^{(k)}, v_{t+1}^{(k)})$

define $\Delta x = x_{t+1}^{(k+1)} - x_{t+1}^{(k)}, \Delta v = v_{t+1}^{(k+1)} - v_{t+1}^{(k)}$, then we can get:

where $K = -\frac{\partial f_{elas}}{\partial x}\bigg|_{x = x_{t+1}^{(k)}}, K_{damp} = \frac{\partial f_{elas}}{\partial v}\bigg|_{x = x_{t+1}^{(k)}} =-\gamma K$

since $v_{t+1}^{(k+1)} = v_{t+1}^{(k)} + \Delta v = v_{t+1}^{(k)} + \frac{\Delta x}{\Delta t}$

then we can get the linear equation of $\Delta x = x_{t+1}^{(k+1)} - x_{t+1}^{(k)}$. Solve it, update, and enter next iteration, until converge.


Reference

[1] Sifakis E, Barbic J. FEM simulation of 3D deformable solids: a practitioner’s guide to theory, discretization and model reduction[C]//ACM SIGGRAPH 2012 Courses. ACM, 2012: 20.