Entries for November 14, 2017
-
Linear Finite Elements
Beginning with this post, I’ll be publishing about the basics of finite element formulations, from personal notes that accumulated over the years. This one is about linear and scalar problems which came to be the “Hello World” for FE. Details regarding spaces and discretization are omitted for the sake of brevity. For those who want to delve into theory, I recommend “The Finite Element Method: Theory, Implementation, and Applications” by Larson and Bengzon.
The weak formulation of a canonical linear problem reads
Find u∈V such that
a(u,v)=b(v)(1)for all v∈V where a(⋅,⋅) is a bilinear form and b(⋅) is a linear form.
We define the discretization of u as
uh:=J=1∑nnuJNJ,uh∈VhwhereVh⊂V(2)The discretization uh is a linear combination of basis functions NJ and corresponding scalars uJ, J=1,…,nn so that Vh is a subset of V. The discretization of (1) then reads
a(uh,vh)=b(vh)∀vh∈Vh.(3)We then have
a(J=1∑nnuJNJ,I=1∑nnvINI)=b(I=1∑nnvINI)(4)Using the linearity properties,
a(αu,βv)=αβa(u,v)andb(αv)=αb(v)(5)we obtain
I=1∑nnJ=1∑nnuJvIa(NJ,NI)=I=1∑nnvIb(NI).(6)For arbitrary test function values vI, we can express (6) as a system of nn equations
J=1∑nnuJa(NJ,NI)=b(NI)(7)for I=1,2,…,nn. If we expand the summations as
a(N1,N1)u1a(N1,N2)u1⋮a(N1,Nnn)u1+a(N2,N1)u2+a(N2,N2)u2⋮+a(N2,Nnn)u2+⋯+⋯⋮+⋯+a(Nnn,N1)unn+a(Nnn,N2)unn⋮+a(Nnn,Nnn)unn=b(N1)=b(N2)⋮=b(Nnn)we can see that the terms with a constitute a matrix A and the terms with b constitute a vector b, allowing us to write
Au=b(8)where we chose to express the unknown coefficients uI as a vector u=[u1,u2,…,unn]T.
\It can be seen that the components of the A and b are defined as
AIJ=a(NJ,NI)andbI=b(NI),(9)we can express the linear system as
A11u1A21u1⋮Ann1u1+A12u2+A22u2⋮+Ann2u2+⋯+⋯⋮+⋯+A1nnunn+A2nnunn⋮+Annnnunn=b1=b2⋮=bnnNote that with the given definitions, (7) becomes
J=1∑nnAIJuJ=bIforI=1,2,…nn.(10)Example: Poisson’s Equation
In the weak form of Poisson’s equation
−Δuu=f=0inonΩ∂Ω(11)The weak formulation reads
Find u∈V such that
−∫ΩΔ(u)vdv=∫Ωfvdv(12)for all v∈V where V=H01(Ω).
Applying integration by parts and divergence theorem on the left-hand side
∫ΩΔ(u)vdv=∫Ω∇⋅(∇(u)v)dv−∫Ω∇u⋅∇vdv=v=0 on ∂Ω∫∂Ωv(∇u⋅n)da−∫Ω∇u⋅∇vdv(13)We have the following variational forms:
a(u,v)b(v)=∫Ω∇u⋅∇vdv=∫Ωfvdv(14)Following (7), we can calculate the stiffness matrix A as
AIJ=a(NJ,NI)=∫Ω∇NJ⋅∇NIdv=∫ΩBJ⋅BIdv(15)where we have defined the gradient of the basis functions as
BI:=∇NI.(16)Similarly, we integrate the force term into a vector b as
bI=∫ΩfNIdv(17)