Lecture no. 7

Finite Element Method

 Define the approximating functions locally over “finite elements”

Advantages

 It’s much easier to satisfy the b.c.’s with local functions over local parts of the boundary than it is with global functions over the entire boundary.

 Splitting the domain into intervals and using lower order approximations within each element will cause the integral error to assure better accuracy on a pointwise . (Courant, 1920). An integral norm attempts to minimize total error over the entire domain. A low integral norm does not always mean that we have good pointwise error norm.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 1 | 32

General Steps to FEM

 Divide the domain into N sub-intervals or finite elements.

 Develop interpolating functions valid over each element. We will make use of localized coordinate systems to assure functional universality (i.e. they will be applicable to any length element at any location). We will tailor these functions such that the required degree of functional continuity can be readily enforced.

 Enforce functional continuity

 Through definition of Cardinal basis

 Through “global” matrix assembly

 Note that we use these interpolating functions in conjunction with the implementation of the desired weighted residual form (i.e. integrations etc.) as before.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 2 | 32

Lagrange

Lagrange Interpolation : pass an approximating , g(x), exactly through the functional values at a set of interpolation points or nodes.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 3 | 32

 Method 1 to deriving g(x) – Power series:

─ We are given 푓0, 푓1, 푓2 and corresponding points 푥0, 푥1, 푥2 ─ Constraints we can apply

푔(푥0 = 0) = 푓0

푔(푥1 = ℎ) = 푓1

푔(푥2 = 2ℎ) = 푓2 3 Constraints ⇒ 3 d.o.f/3 nodes = 1 d.o.f/node ⇒ form g(x) can have 3 d.o.f ⇒ quadratic ─ General form of g(x) 푔(푥) = 푎 + 푏푥 + 푐푥2 ─ Apply constraints

푔(푥0 = 0) = 푓0 ⇒ 푎 = 푓0 2 푔(푥1 = ℎ) = 푓1 ⇒ 푎 + 푏ℎ + 푐ℎ = 푓1 2 푔(푥2 = 2ℎ) = 푓2 ⇒ 푎 + 2ℎ푏 + 4ℎ 푐 = 푓2

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 4 | 32

 Solve a system of simultaneous equations.

1 0 0 푎 푓0 [1 1 1] [ 푏ℎ ]=[푓1] ⇒ 2 1 2 4 푐ℎ 푓2

푎 1 0 0 푓0 [ 푏ℎ ] = [−1.5 2 −0.5] [푓1] ⇒ 2 푐ℎ 0.5 −1 0.5 푓2

푎 = 푓0

1 3 1 푏 = (− 푓 + 2푓 − 푓 ) ℎ 2 0 1 2 2

1 1 1 푐 = ( 푓 − 푓 + 푓 ) ℎ2 2 0 1 2 2

1 1 ∴ 푔(푥) = 푓 + (−3푓 + 4푓 − 푓 )푥 + (푓 − 2푓 + 푓 )푥2 0 2ℎ 0 1 2 2ℎ2 0 1 2 Interpolating function throughout interval of interest [0,2ℎ]

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 5 | 32

 Let’s rewrite 푔(푥)

Factor out of 푓0, 푓1 and 푓2 3푥 1 4 1 1 1 푔(푥) = 푓 (1 − 푥 + 푥2) + 푓 ( 푥 − 푥2) + 푓 (− 푥 + 푥2) 0 ⏟ 2ℎ 2 ℎ2 1 ⏟2ℎ ℎ2 2 ⏟ 2ℎ 2 ℎ2 ≡휙0(푥) ≡휙1(푥) ≡휙2(푥) ⇒ 2  푔(푥) = ∑푖=0 푓푖 ⏟휙푖 (푥 ) → Interpolating basis functions!! Each is associated with one node. Looks very much like expansions we used for w.r. methods!!!

 Let’s plot these functions

휙0(푥0 = 0) = 1 휙1(푥0 = ∅) = 0 휙2(푥0 = 0)

휙0(푥1 = ℎ) = 0 휙1(푥1 = ℎ) = 1 휙2(푥1 = ℎ) = 0

휙0(푥1 = 2ℎ) = 0 휙1(푥2 = 2ℎ) = 0 휙2(푥2 = 2ℎ) = 1

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 6 | 32

1 푖 = 푗  Thus 휙 (푥 ) = 훿 = ⇒ We can in fact use the constraints to derive 휙 , 휙 1 푗 푖푗 0 푖 ≠ 푗 0 1

and 휙2

 Thus interpolating functions are 1 at nodes they are associated with and zero at all other

nodes. At x values other than nodal values these functions vary and do not equal zero.

 A very important consequence of using Lagrange interpolation is that

푔(푥푖) = 푓푖 This property and the fact that we define nodes on inter-element boundaries will enable us to easily enforce functional continuity on inter-element boundaries

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 7 | 32

Applying Lagrange Interpolation to develop 풖풂풑풑 Option 1 – Develop a higher order approximation which is global and based on Lagrange basis function defined over the entire domain. 푁

푢푎푝푝 = ∑ 푢푖휙푖 푖=1 where

휙푖 = globally defined Lagrange basis functions valid over the entire domain

푢푖 = the expansion coefficients and by definition these equal the function values at the nodes!! 푖 = 1, 푁 are the N “nodes” defined throughout the global domain These nodes can be equispaced or nonequispaced

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 8 | 32

 Boundary conditions can be readily incorporated into the expansion if they are function specified (essential type boundary conditions)

─ For example 푢(푥퐿) = 푢퐿

푢(푥푅) = 푢푅 ─ The expansion can now be written as 푁−1

푢푎푝푝 = 푢퐿휙1 + 푢푅휙푁 + ∑ 푢푖휙푖 푖=2

(since 푢1 = 푢퐿 and 푢푁 = 푢푅)

─ Thus

푢퐵 = 푢퐿휙1 + 푢푅휙푁

─ We note that 푢퐵 satisfies admissibility conditions

푢퐵(푥퐿) = 푢퐿 ⏟휙 1 (푥 퐿 ) + 푢푅 ⏟휙 푁 (푥 퐿 ) = 푢퐿 =1 =0

푢퐵(푢푅) = 푢퐿 ⏟휙 1 (푥 푅 ) + 푢푅 ⏟휙 푁 (푥 푅 ) = 푢푅 =0 =1

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 9 | 32

─ Also we note that the remaining 휙푖 푖 = 2, 푁 − 1 satisfy

휙푖(푥퐿) = 0 → 푖 = 2, 푁 − 1 휙푖(푥푅) = 0

 Thus satisfying function specified b.c.’s (essential) for 1-D is very easy!! For natural b.c.’s it is much more difficult.

 The sequence of functions 휙푖 are linearly independent  The coefficients in the expansion are now actually equal to the values of the function at the nodes!!

 The drawback of option 1 is that you obtain poor pointwise convergence as N becomes large for most problems.

 Another drawback is that the matrix will also be almost fully populated

 Typically the technique does work well for slowly varying smooth solutions.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 10 | 32

Example

Solve 퐿(푢) = 푝(푥) 푥 ∈ [푥퐿, 푥푅]

b.c.’s 푢(푥퐿) = 푢퐿

푢(푥푅) = 푢푅

Assume that we will apply a six term expansion

5

푢푎푝푝 = 푢퐿휙1 + 푢푅휙6 + ∑ 푢푖휙푖 푖=2

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 11 | 32

 Note that 푢퐵 = 푢퐿휙1 + 푢푅휙6

 푢퐵 satisfies b.c.’s as specified

 Note that 휙2, 휙3, 휙4 and 휙5 all satisfy the homogeneous form of the essential function specified b.c.’s

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 12 | 32

Option 2 – Develop an approximation 푢푎푝푝 which is the sum of localized approximations

푀 푁푗 푗 푗 푢푎푝푝 = ∑ ∑ 푢푖 휙푖 푗=1 푖=1 푗 Where 푢푖 = expansion coefficient for element j and node i within element j 푗 휙푖 = Lagrange basis function for element j and node i

푗 Note that 휙푖 = 0 outside of element j

푗 = 1, 푀 = total number of localized domains or “finite elements”

푖 = 1, 푁푗 = total number of nodes within element j

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 13 | 32

Local unknowns at nodes 1 1 1 3 3 3 3 3 3 푢1 푢3 푢3 푢1 푢2 푢3 푢4 푢5 푢6

← 푒푙푒푚푒푛푡 푖푛푑푒푥 푢2 푢2 푢2 푢4 푢4 푢4 1 2 3 1 2 3 ← 푙표푐푎푙 푛표푑푒 푖푛푑푒푥

 The boundary conditions can again be readily built into 1-D type problems for function specified conditions (essential). Even in multiple dimensions, function specified b.c.’s (essential) can be incorporated in a straight forward manner

 The sequence of all functions will be linearly independent.

 Again note that those coeficients of expansion are equal to the actual function values at the nodes

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 14 | 32

 To ensure 퐶0 inter-element functional continuity we must have at all inter-element boundaries:

푢푎푝푝(left of an inter-element boundary) = 푢푎푝푝 (right of an inter-element boundary) Thus in the example given Anywhere in element 1 1 1 1 1 1 1 1 푢 (휉) = 푢1휙1(휉) + 푢2휙2(휉) + 푢3휙3(휉) Note that all other Lagrange basis function from other elements are defined as zero.

Anywhere in element 2

2 2 2 2 2 1 2 푢 (휉) = 푢1휙1 (휉) + 푢2휙2(휉) + 푢3휙3(휉) Element 1 evaluated at r.h.s.

1 1 1 푢 (휉3 ) = 푢3 Element 2 evaluated at l.h.s.

2 2 2 푢 (휉1 ) = 푢1

In order to enforce 푐0 functional continuity we must have 1 1 2 2 푢 (휉3 ) = 푢 (휉1 )

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 15 | 32

1 2 ∴ 푢3 = 푢1

 In general we must have the expansion coefficients equal at inter-element boundaries in

order to satisfy 푐0 functional continuity requirements  In our example, the expansion coef.’s are related as

1 2 푢3 = 푢1 2 3 푢3 = 푢1 3 4 푢6 = 푢1 ∴ We must have expansion coef.’s at inter-element boundaries be equal

 There are several approaches to implement the inter-element functional continuity (i.e. setting equal the adjacent inter-element expansion coef.’s) ─ Develop “Cardinal” basis functions which are formed by patching together the localized Lagrange functions and defining them globally. This also implies that you redefine the expansion coef.’s globally (so that there will now be only one coef. per global node) ─ Actually implement all expansions locally. Then take care of inter-element functional continuity by assembling the “global” matrix correctly

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 16 | 32

Notes

 Boundary condition implementation/satisfaction as well as inter-element functional continuity enforcement are made simple and possible by the use of Lagrange basis functions. However we must place nodes at the ends of the domain as well as at the ends of each element for this to work.

 The advantages of defining local functions are: ─ Essential function specified b.c.’s are very easy to implement in 2-D and 3-D as well as 1-D ─ Excellent pointwise as well as integral norm convergence ─ Matrices are sparse with a limited number of non-zero entries per row

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 17 | 32

 Solve 퐿(푢) = 푝(푥) [푥퐿, 푥푅]

푢(푥퐿) = 푢퐿

푢(푥푅) = 푢푅  Consider the following 6 global nodes defined over 4 elements

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 18 | 32

 We will have the following elemental based expansion

part of uB ↓ ↓ elemental index 1 1 1 푢푎푝푝 = 푢퐿휙1 + 푢2휙2 Element 1 ↑ ↑ local node index

2 2 2 2 2 2 + 푢1휙1 + 푢2휙2 + 푢3휙3 Element 2 3 3 3 3 + 푢1휙1 + 푢2휙2 Element 3 4 4 4 + 푢1휙1 + 푢푅휙2 ← part of 푢퐵 Element 4

 This is a local expansion!!

 It has 7 elemental unknowns

 However 3 functional continuity constraints will be applied

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 19 | 32

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 20 | 32

 We can also patch together functions and form truly “global” functions. These are called “Cardinal” bases

part of 푢퐵 ⏞ 푢푎푝푝 = 푢퐿훷푛1 + 푢푛2훷푛2 + 푢푛3훷푛3 + 푢푛4훷푛4

+푢푛5훷푛5 + 푢푅훷푛6 ← part of 푢퐵

1 1 훷푛1 = 휙1 푢푛1 = 푢1 = 푢퐿 essential b.c 1 2 1 2 훷푛2 = 휙2 + 휙1 푢푛2 = 푢2 = 푢1 unknown 2 2 훷푛3 = 휙2 푢푛3 = 푢2 unknown 2 3 2 3 훷푛4 = 휙3 + 휙1 푢푛4 = 푢3 = 푢1 unknown 3 4 3 4 훷푛5 = 휙2 + 휙1 푢푛5 = 푢2 = 푢1 unknown 4 4 훷푛6 = ⏟휙2 푢푛6 = ⏟푢2 = 푢 푅 essential b.c. local functions local coef.’s or unknown functions ↑ Cardinal or global functions ↑ Global coef.’s or unknown functions

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 21 | 32

Notes • The global or Cardinal basis functions and approximation automatically satisfy functional continuity. This is not true for local expansions for which we must still enforce the functional continuity constraints.

• However it will be very easy to handle the functional continuity constraints and it is much easier to work with the local functions in a finite element grid.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 22 | 32

• Global basis functions

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 23 | 32

Local Lagrange basis functions

 Define a “unit” element with a local coordinate system −1 ≤ 휉 ≤ +1

 Map the element j which lies in the interval 푥푗 ≤ 푥 ≤ 푥푗+1 to the unit element. The transformation and its inverse are:

휉 = −1 + 2(푥 − 푥푗)/(푥푗+1 − 푥푗) and

푥 = 푥푗 + (푥푗+1 − 푥푗)(휉 + 1)/2

 Define the function associated with each node in a local coordinate system:

휙1(휉) = 푎1 + 푏1휉

휙2(휉) = 푎2 + 푏2휉

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 24 | 32

 Apply constraints to solve for the coefficients

휙1(휉1) = 1 휙1(휉2) = 0

휙2(휉1) = 0 휙2(휉2) = 1  This leads to: 1 휙 (휉) = (1 − 휉) 1 2 1 휙 (휉) = (1 + 휉) 2 2

 These functions represent the linear Lagrange interpolation functions. These allow

푪풐 functional continuity and each local basis function equals unity at the associated node and zero elsewhere.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 25 | 32

 These local basis functions on the unit element are related to those defined over the 푗푡ℎ element by

휙1(휉) = 휙2푗−1(푥(휉)) = 휙2푗−1(푥)

휙2(휉) = 휙2푗(푥(휉)) = 휙2푗(푥)

where 휙2푗−1(푥) and 휙2푗(푥) are defined as nonzero for 푥푗 ≤ 푥 ≤ 푥푗+1 and zero everywhere else.

 We note that

푢̂푒 = α1휙1(휉) + α2휙2(휉) Therefore:

푢̂푒(휉1) = α1 푢̂푒(휉2) = α2 Therefore the coefficients of the elemental expansion equals the actual value of the function at the nodes!

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 26 | 32

 Derivatives of 휙2푗−1(푥) w.r.t. x

푑휙2푗−1 푑휙 푑휙 푑휉 2 푑휙 = 1 = 1 = 1 푑푥 푑푥 푑휉 푑푥 (푥푗+1 − 푥푗) 푑휉 and

푑휙2푗 2 푑휙 = 2 푑푥 (푥푗+1 − 푥푗) 푑휉 Note that these formula are valid whether or not elements of equal length are used. If

(푥푗+1 − 푥푗) = ∆푥 is constant, then derivatives of the basis functions w.r.t., 푑휙푗/푑푥, are related by the constant 2/∆푥 to the derivatives w.r.t. 휉 of these functions.

Cardinal Basis Functions:

 If we piece together the elemental functions such that we eliminate or satisfy the functional continuity requirements we form the cardinal basis functions: 훷푖(푥) = chapeau functions (also called rooftop or tophat functions)

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 27 | 32

 Previously we had: 푒푙 푒푙 푒푙 푒푙 ∑푁 푗 푗 푗 푗 with 2N unknowns when N=the no. of elements 푢푎푝푝 = 푒푙푗=1 푢1 휙1 + 푢2 휙2

 Now we’ve enforced functional continuity by

푒푙1 푒푙2 global i. requiring 푢2 = 푢1 = 푢2 etc.

푒푙1 푒푙2 ii. defining 훷2 = 휙2 + 휙1 etc. Thus we have N-1 constraints and we can now write 푁+1 global 푢푎푝푝(푥) = ∑ (푢푖 훷푖) 푖=1

We now have N+1 unknowns which equals the total number of nodes.

 Therefore the rooftop functions are the same as the first order defined over each element except that now the functional continuity requirement is automatically satisfied.

 In FE practice we don’t really use Cardinal basis functions. We use the local elemental functions and account for functional continuity as matrix assembly proceeds.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 28 | 32

Development of Lagrange Quadratic Basis

 퐶표 functional continuity using quadratic interpolation over an element (instead of the required minimum linear), requires 3 nodes per element.

 Consider the unit element and let the 3 nodes be defined such that 휉1 = −1,

휉2 = 0, and 휉3 = +1.  The general form of the Lagrange quadratic basis function is: 2 휙푖(휉) = 푎푖 + 푏푖휉 + 푐푖휉 , 푖 = 1,3 and the elemental expansion is 3

푢̂푒 = ∑ 푢푖휙푖 푖=1

 We now require that 휙푖(휉푗) = 훿푖푗, 푖 = 1,3; 푗 = 1,3 (this defines 9 constraints to solve for the 9 unknowns).

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 29 | 32

 Thus: 1 휙1(−1) = 푎1 − 푏1 + 푐1 = 1 1 휙1(0) = 푎1 = 0 1 휙1(+1) = 푎1 + 푏1 + 푐1 = 0 Hence: 1 1 푎 = 0, 푏 = − , 푐 = 1 1 2 1 2 which leads to: 휉(휉 − 1) 휙 (휉) = 1 2

Similarly for 휙2(휉) and 휙3(휉) and we have: 2 휙2(휉) = 1 − 휉 휉(1 + 휉) 휙 (휉) = 3 2

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 30 | 32

Notes

 Again we note that the generic expansion is written over each element as

푒푙 푒푙 푒푙 푢̂푒푙 = 푢1 휙1(휉) + 푢2 휙2(휉) + 푢3 휙3(휉)

Thus the coefficients in the expansion for 푢̂푒 equal the value of the function at the node 휉푖. This is only possible sue to the form of the basis/expansion functions!

nd  We still only have 퐶표 functional continuity between elements. We do have non-trivial 2 derivatives within the element. However the 2nd derivatives are not defined at inter-element boundaries!

 Cardinal Basis # of elemental unknowns 3푁 # of functional continuity constraints 푁 − 1 Total number of global unknowns 2푁 + 1

We have N+1 vertex nodes N mid-side nodes 2N+1 total number of globally defined basis functions Note that 2N + 1 also equals the total number of nodes for N elements.

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 31 | 32

 Piecing together the element functions we arrive at the following set of 2N + 1 Cardinal basis functions:

 Each function is associated with 1 global node and is defined such that inter-element continuity is assured. 2푁+1

푢푎푝푝(푥) = ∑ 푢푖훷푖(푥) 푖=1

Higher Order Lagrange Interpolation can be treated in similar ways 1. Add more nodes which allows us to define more interpolating functions of higher order. 2. Require each interpolating function to be equal to unity at the node it is associated with and zero at all other nodes 3. The unknown coefficients will equal the functional value at the nodes!

CE 60130 FINITE ELEMENT M ETHODS - L E C T U R E 7 P a g e 32 | 32