Entries for April 2018
-
Lumped L2 Projection
$ \newcommand{\rowsum}{\mathop{\rm rowsum}\nolimits} \newcommand{\nnode}{n} \newcommand{\suml}[2]{\sum\limits_{#1}^{#2}} $When utilizing Galerkin-type solutions for IBVPs, we often have to compute integrals using numerical methods such as Gauss quadrature. In such a solution, we solve for the values of a function at mesh nodes, whereas the integration takes place at the quadrature points. Depending on the case, we may need to compute the values of a function at mesh nodes, given their values at quadrature points, e.g. stress recovery for mechanical problems.
There are many ways of achieving this, such as superconvergent patch recovery. In this post, I wanted to document a widely used solution which is easy to implement, and which is used in research oriented codebases such as FEAP.
L2 Projection
Given a function u∈L2(Ω), its projection into a finite element space Vh⊂L2(Ω) is defined through the following optimization problem:
Find uh∈Vh such that
Π(uh):=21∥uh−u∥L2(Ω)2→min(1)There is a unique solution to the problem since Π(⋅) is convex. Taking its variation, we have $DΠ(uh)⋅vh=⟨uh−u,vh⟩=0(2)$
for all vh∈Vh. Thus we have the following variational formulation
Find uh∈Vh such that
⟨uh,vh⟩=⟨u,vh⟩(3)for all vh∈Vh.
Here,
m(uh,vh)b(vh)=⟨uh,vh⟩=⟨u,vh⟩=∫Ωuhvhdxand=∫Ωuvhdx(4)are our bilinear and linear forms respectively. Substituting FE discretizations uh=∑J=1nuJNJ and vh=∑I=1nvINI, we have
J=1∑nMIJuJ=bI(5)for I=1,…,n, where the FE matrix and vector are defined as
MIJbI=m(NJ,NI)=b(NI)=∫ΩNJNIdxand=∫ΩuNIdx(6)Thus L2 projection requires the solution of a linear system
Mu=bwhich depending on the algorithm used, can have a complexity of at least O(n2) and at most O(n3).
Lumped L2 Projection
The L2 projection requires the solution of a system which can be computationally expensive. It is possible to convert the matrix—called the mass matrix in literature—to a diagonal form through a procedure called lumping.
The operator for row summation is defined as
rowsum(⋅)i:=j=1∑n(⋅)ij(7)For the mass matrix, we have
rowsumMI=J=1∑n∫ΩNJNIdx=∫ΩNIdx=:mI(8)since ∑J=1nNJ=1. Substituting the lumped mass matrix allows us to decouple the linear system of equations in (5) and instead write
mIuI=bI(9)for I=1,…,n. The lumped L2 projection is then as simple as
uI=mIbI=∫ΩNIdx∫ΩuNIdx(10)This results in a very efficient algorithm with O(n) complexity.
Conclusion
Lumped L2 projection is a faster working approximation to L2 projection that is easy to implement for quick results. You can use it when developing a solution for an IBVP, and don’t want to wait too long when debugging, while not forgetting that it introduces some error.
-
Disadvantages of Engineering Notation in Finite Elements
Suppose we have the following stiffness matrix of linear elasticity:
AijIJ=∫ΩBkICikjlBlJdv(1)where BI=∇NI are the gradients of the shape functions NI and C is the linear elasticity tensor (you see the contraction of their components in the equation).
Despite being of the most explicit form, these types of indicial expressions are avoided in most texts on finite elements. There are two reasons for this:
- Engineers are not taught the Einstein summation convention.
- The presence of indices result in a seemingly cluttered expression.
They avoid the indicial expression by reshaping it into matrix multiplications. In engineering notation, the left- and right-hand sides are reshaped as
Aαβ=∫ΩBγαCγδBδβdv(2)which allows us to write
A=∫ΩB~TC~B~dv(3)The matrices B~ and C~ are set on with tildes in order to differentiate them from the boldface symbols used in the previous sections. Here,
- C~ is a matrix containing the unique components of the elasticity tensor C, according to the Voigt notation. In this reshaping, only the minor symmetries are taken into account. If the dimension of the vectorial problem is d, then C~ is of the size d(d+1)/2×d(d+1)/2. For example, if the problem is 3 dimensional, C~ is of the size 6×6:
- B~ is a nd×d(d+1)/2 matrix whose components are adjusted so that (2) is equivalent to (1). It has the components of BI for I=1,…,n where n is the number of basis functions. Since B~ is adjusted to account for the reshaping of C, it has many zero components. A 3d example:
Although (3) looks nice on paper, it is much less optimal for implementation. Implementing it requires the implementation of (5), which adds another layer of complexity to the algorithm. The same cannot be said for (4), because using Voigt notation might be more efficient in inelastic problems. In the most complex problems, the most efficient method is to implement (1) in conjunction with Voigt notation.
To prove the inefficiency of (3) we can readily compare it with (1) in terms of required number of iterations. Indices in (1) have the following ranges:
I,J=1,…,nandi,j,k,l=1,…,d(6)so n2d4 iterations are required. Indices in (2) have the following ranges:
α,β=1,…,ndandγ,δ=1,…,d(d+1)/2(7)so
(nd)2(2d(d+1))2=n2d44(d+1)2(8)iterations are required. So engineering notation requires (d+1)2/4 times more equations than index notation. For d=2, engineering notation is 2.25 times slower and for d=3 it is 4 times slower. For example, calculation of a stiffness matrix for n=8 and d=3 requires 20736 iterations for engineering notation, whereas it only requires 5184 iterations for index notation.
Although (3) seems less cluttered, what actually happens is that one trades off complexity in one expression for a much increased complexity in another one, in this case (5). And to make it worse, it results in a slower algorithm.
The only obstacle to the widespread adoption of index notation seems to be its lack in undergraduate engineering curricula. If engineers were taught the index notation and summation convention as well as the formal notation, such expressions would not be as confusing at first sight. A good place would be in elementary calculus and physics courses, where one heavily uses vector calculus.
-
Variational Formulation of Elasticity
$ \newcommand{\argmin}{\mathop{\rm argmin}\nolimits} \newcommand{\cof}{\mathop{\rm cof}\nolimits} \newcommand{\sym}{\mathop{\rm sym}\nolimits} \newcommand{\invtra}{^{-T}} \newcommand{\eps}{\epsilon} \newcommand{\var}{\Delta} \newcommand{\Vvphi}{\Delta\Bvarphi} \newcommand{\vvphi}{\delta\Bvarphi} \newcommand{\BFC}{\boldsymbol{\mathsf{C}}} \newcommand{\BFc}{\boldsymbol{\mathsf{c}}} \newcommand{\push}{\Bvarphi_\ast} \newcommand{\pull}{\Bvarphi^\ast} $There are many books that give an outline of hyperelasticity, but there are few that try to help the reader implement solutions, and even fewer that manage to do it in a concise manner. Peter Wriggers’ Nonlinear Finite Element Methods is a great reference for those who like to roll up their sleeves and get lost in theory. It helped me understand a lot about how solutions to hyperelastic and inelastic problems are implemented.
One thing did not quite fit my taste though—it was very formal in the way that it didn’t give out indicial expressions. And if it wasn’t clear up until this point, I love indicial expressions, because they pack enough information to implement a solution in a single line. Almost all books skip these because they seem cluttered and the professors who wrote them think they’re trivial to derive. In fact, they are not. So below, I’ll try to derive indicial expressions for the update equations of hyperelasticity.
In the case of a hyperelastic material, there exists a strain energy function
Ψ:F↦Ψ(F)(1)which describes the elastic energy stored in the solid, i.e. energy density per unit mass of the reference configuration. The total energy stored in B is described by the the stored energy functional
E(φ):=∫BΨ(F)dm=∫Bρ0Ψ(F)dV(2)The loads acting on the body also form a potential:
L(φ):=∫Bρ0Γˉ⋅φdV+∫∂BtTˉ⋅φdA(3)where Γˉ and Tˉ are the prescribed body forces per unit mass and surface tractions respectively, where T=PN with Cauchy’s stress theorem.
The potential energy of B for deformation φ is defined as
Π(φ):=E(φ)−L(φ)(4)Thus the variational formulation reads
Find φ∈V such that the functional
Π(φ)=∫Bρ0Ψ(F)dV−∫Bρ0Γˉ⋅φdV−∫∂BtTˉ⋅φdA(5)is minimized for φ=φˉ on ∂Bu.
The solution is one that minimizes the potential energy:
φ∗=argminφ∈VΠ(φ)(6)A stationary point for Π means that its first variation vanishes: ΔΠ=0.
ΔΠ=DφΠ⋅δφ=:G(φ,δφ)=∫Bρ0∂F∂Ψ:∇(δφ)dV−∫Bρ0Γˉ⋅δφdV−∫∂BTˉ⋅δφdA(7)Using P=FS and P=ρ0∂Ψ/∂F,
ρ0∂F∂Ψ:∇(δφ)=FS:∇(δφ)=S:FT∇(δφ)(8)The symmetric part of the term on the right hand side of the contraction is equal to the variation of the Green-Lagrange strain tensor:
ΔE=DφE⋅δφ=dϵd21[∇(φ+ϵδφ)T∇(φ+ϵδφ)−I]ϵ=0=21[∇(δφ)TF+FT∇(δφ)](9)Substituting, we obtain the semilinear form G in terms of the second Piola-Kirchhoff stress tensor:
G(φ,δφ)=∫BS:ΔEdV−∫Bρ0Γˉ⋅δφdV−∫∂BTˉ⋅δφdA=0(10)We can write a Eulerian version of this form by pushing-forward the stresses and strains. The Almansi strain e is the pull-back of the Green-Lagrange strain E and vice versa:
e=φ∗(E)=F−TEF−1andE=φ∗(e)=FTEF(11)Commutative diagram for the pull-back and push-forward relationships of the Green-Lagrange and Almansi strain tensors.
Thus we can deduce the variation of the Almansi strain
Δe=F−TΔEF−1=21[∇(δφ)F−1+F−T∇(δφ)T]=21[∇x(δφ)+∇x(δφ)T](12)where we have used the identity
∇X(⋅)F−1=∇x(⋅).(13)The second Piola-Kirchhoff stress is the pull-back of the Kirchhoff stress τ:
S=φ∗(τ)=F−1τF−T(14)Then it is evident that
S:ΔE=(F−1τF−T):(FTΔeF)=τ:Δe(15)We can thus write the Eulerian version of (10):
G(φ,δφ)=∫Bτ:ΔedV−∫Bρ0Γˉ⋅δφdV−∫∂BTˉ⋅δφdA=0(16)Introducing the Cauchy stresses σ=τ/J, we can also transport the integrals to the current configuration
G(φ,δφ)=∫Sσ:Δedv−∫Sργˉ⋅δφdv−∫∂Sttˉ⋅δφda=0(17)Here, we substituted the following differential identities:
ρ0ΓdV=ργdv(18)for the body forces, and
TdA=PNdA=σJF−TNdA=σnda=tda(19)for the surface tractions, where we used the Piola identity.
Linearization of the Variational Formulation
We linearize G:
LinGφˉ=G(φˉ,δφ)+ΔGφˉ=0(20)Then we have the variational setting
a(Δφ,δφ)=b(δφ)(21)where
a(Δφ,δφ)=ΔGφˉandb(δφ)=−G(φˉ,δφ)(22)Commutative diagram of the linearized solution procedure. Each iteration brings the current iterate φˉ closer to the optimum value φ∗.
Mappings between line elements belonging to the tangent spaces of the linearization.
The variation ΔG is calculated as
ΔG=DφG⋅Δφ=∫B[ΔS:ΔE+S:Δ(ΔE)]dV(23)Consecutive variations of the Green-Lagrange strain tensor is calculated as
Δ(ΔE)=DφΔE⋅Δφ=21[∇(δφ)T∇(Δφ)+∇(Δφ)T∇(δφ)](24)The term on the left is calculated as
ΔS=DφS⋅Δφ=∂C∂S:ΔC=2∂C∂S:ΔE(25)where we substitute the Lagrangian elasticity tensor
C:=2∂C∂S=4ρ0∂C∂C∂2Ψ(26)and ΔE is calculated in the same manner as ΔE:
ΔE=21[∇(Δφ)TF+FT∇(Δφ)](27)Then the variational forms of the linearized setting are
a(Δφ,δφ)b(δφ)=∫BΔEˉ:Cˉ:ΔEˉ+Sˉ:[∇(δφ)T∇(Δφ)]dV=−∫BSˉ:ΔEˉdV+∫Bρ0Γˉ⋅δφdV+∫∂BTˉ⋅δφdA(28)where the bars denote evaluation φ=φˉ of dependent variables.
Eulerian Version of the Linearization
We also have the following relationship between the Lagrangian and Eulerian elasticity tensors
cabcd=FaAFbBFcCFdDCABCD(29)Substituting Eulerian expansions, we obtain the following identity:
ΔE:C:ΔE=(FTΔeF):C:(FTΔeF)=FaAΔeabFbBCABCDFcCΔecdFdD=ΔeabcabcdΔecd=Δe:c:Δe(30)Thus we have
S:[∇(δφ)T∇(Δφ)]=[F−1τF−T]:[∇(δφ)T∇(Δφ)]=τ:[(∇(δφ)F−1)T∇(Δφ)F−1]=τ:[∇x(δφ)T∇x(Δφ)](31)With these results at hand, we can write the Eulerian version of our variational formulation:
a(Δφ,δφ)b(δφ)=∫BΔeˉ:cˉ:Δeˉ+τˉ:[∇xˉ(δφ)T∇xˉ(Δφ)]dV=−∫Bτˉ:ΔeˉdV+∫Bρ0Γˉ⋅δφdV+∫∂BTˉ⋅δφdA(32)If we introduce the Cauchy stress tensor σ and corresponding elasticity tensor cσ=c/J, our variational formulation can be expressed completely in terms of Eulerian quantities:
a(Δφ,δφ)b(δφ)=∫SˉΔeˉ:cˉσ:Δeˉ+σˉ:[∇xˉ(δφ)T∇xˉ(Δφ)]dvˉ=−∫Sˉσˉ:Δeˉdvˉ+∫Sˉργˉ⋅δφdvˉ+∫∂Sˉttˉ⋅δφdaˉ(33)We have the following relationships of the differential forms:
dvˉ=Jˉdvandnˉdaˉ=cofFˉNdA(34)where Fˉ=∇Xφˉ and Jˉ=detFˉ.
Discretization of the Lagrangian Form
We use the following FE discretization:
φh=γ=1∑nnφγNγ=γ=1∑nna=1∑ndφaγeaNγ(35)where nn is the number of element nodes and nd is the number of spatial dimensions.
We use the same discretization for δφ and Δφ. Then the linear system at hand becomes
δ=1∑nnb=1∑ndAabγδΔφbδ=baγ(36)for a=1,…,nd and γ=1,…,nn where the A and b are calculated from the variational forms as
Aabγδbaγ=a(ebNδ,eaNγ)=b(eaNγ)(37)For detailed derivation, see the post Vectorial Finite Elements.
For discretized gradients, we have the following relationship
∇X(eaNγ)=(ea⊗Bγ)(38)where Bγ:=∇XNγ. For the first term in a, we can get rid of the symmetries:
sym(FˉT∇(eaNγ)):Cˉ:sym(FˉT∇(ebNδ))=(FˉT(ea⊗Bγ)):Cˉ:(FˉT(eb⊗Bδ))=FˉaABBγCˉABCDFˉbCBDδ(39)and for the second term, we have
Sˉ:[∇(eaNγ)T∇(ebNδ)]=Sˉ:[(ea⊗Bγ)T(eb⊗Bδ)]=Sˉ:[Bγ⊗Bδ]gab=BAγSˉABBBδgab(40)where gab are the components of the Eulerian metric tensor.
For the first term in b, we have
Sˉ:sym(FˉT∇(eaNγ))=Sˉ:(FˉT(ea⊗Bγ))=SˉABFˉaABBγ(41)Remaining terms can be calculated in a straightforward manner. We then have for A and b:
Aabγδbaγ=∫BFˉaABBγCˉABCDFˉbCBDδ+BAγSˉABBBδgabdV=−∫BSˉABFˉaABBγdV+∫Bρ0ΓˉaNγdV+∫∂BtTˉaNγdA(42)The lowercase indices in γˉ and Tˉ might be confusing, but in fact
Γa(X,t)Ta(X,t)=γa(x,t)∘φ(X,t)=ta(x,t)∘φ(X,t)(43)The system is solved for Δφ at each Newton iteration with the following update equation:
φ←φˉ+Δφ(44)Discretization of the Eulerian Form
Discretization of the Eulerian formulation parallels that of Lagrangian.
Aabγδbaγ=∫BBˉcγcˉacbdBˉdδ+BˉeγτˉefBˉfδgabdV=−∫BτˉabBˉbγdV+∫Bρ0ΓˉaNγdV+∫∂BtTˉaNγdAorAabγδbaγ=∫SˉBˉcγcˉacbdσBˉdδ+BˉeγσˉefBˉfδgabdvˉ=−∫SˉσˉabBˉbγdvˉ+∫SˉργˉaNγdvˉ+∫∂SˉttˉaNγdaˉ(45)(46)Here, Bˉγ=∇xˉNγ denote the spatial gradients of the shape functions. One way of calculating is Bˉγ=Fˉ−TBγ, similar to (13).
The update equation (44) holds for the Eulerian version.
Conclusion
The equations above in boxes contain all the information needed to implement the nonlinear solution scheme of hyperelasticity.