The Finite Element Method

64
NBCR Summer Institute 2006: Multi-Scale Cardiac Modeling with Continuity 6.3 Wednesday: Finite Element Discretization and Anatomic Mesh Fitting Andrew McCulloch and Fred Lionetti

description

NBCR Summer Institute 2006: Multi-Scale Cardiac Modeling with Continuity 6.3 Wednesday: Finite Element Discretization and Anatomic Mesh Fitting Andrew McCulloch and Fred Lionetti. The Finite Element Method. Evolved first from the matrix methods of structural analysis in the early 1960’s - PowerPoint PPT Presentation

Transcript of The Finite Element Method

Page 1: The Finite Element Method

NBCR Summer Institute 2006:Multi-Scale Cardiac Modeling with

Continuity 6.3

Wednesday:Finite Element Discretization and

Anatomic Mesh Fitting

Andrew McCulloch and Fred Lionetti

Page 2: The Finite Element Method

• Evolved first from the matrix methods of structural

analysis in the early 1960’s• Uses the algorithms of linear algebra• Later found to have a more fundamental foundation• The essential features are in the formulation• There are two alternative formulations that are broadly

equivalent in most circumstances– Variational formulations, e.g. the Rayleigh-Ritz method– Weak or weighted residual formulations, e.g.the

Galerkin method• Both approaches lead to integral equations instead of

differential equations (the strong form)

The Finite Element Method

Page 3: The Finite Element Method

The Finite Element Method• Solution is discretized using a finite number of functions

– Piecewise polynomials (elements)– Continuity across element boundaries ensured by

defining element parameters at nodes with associated basis functions,

12 13

14 15

21 22

23 24

• FE equations are derived from the weak form of the governing equations

R = 0Finite differences:Finite elements:

R = 0

Page 4: The Finite Element Method

The Finite Element Method• Integrate governing equations in each element

• Assemble global system of equations by adding contributions from each element

1 2

5 6

7 8

3 4

Element equationsk k k k k k k k

k k k k k k k k

k k k k k k k k

k k k k k k k k

k k k k k k k k

k k k k k k k k

k k k k k k k k

k k k k k k k k

u

u

u

u

u

u

u

u

11 12 13 14 15 16 17 18

21 22 23 24 25 26 27 28

31 32 33 34 35 36 37 38

41 42 43 44 45 46 47 48

51 52 53 54 55 56 57 58

61 62 63 64 65 66 67 68

71 72 73 74 75 76 77 78

81 82 83 84 85 86 87 88

1

2

3

4

5

6

7

8

L

N

MMMMMMMMMMM

O

Q

PPPPPPPPPPP

L

N

MMMMMMMMMMM

O

Q

PPPPPPPPPPP

L

N

MMMMMMMMMMM

O

Q

PPPPPPPPPPP

f

f

f

f

f

f

f

f

1

2

3

4

5

6

7

8

12 13

14 15

21 22

23 24

Global equations

L

N

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

O

Q

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

L

N

MMMMMMMMMMMM

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

O

Q

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

L

N

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

O

Q

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

PPPP

Page 5: The Finite Element Method

Consider the strong form of a linear partial differential equation, e.g. 3-D Poisson’s equation with zero boundary conditions:

0

),,(2

2

2

2

2

2

u

zyxfz

u

y

u

x

uOn region R

on boundary S

Strong Form Lu = f

Variational Principle, e.g. minimum potential energy

Rv

vfLvu Vd)2(min

Weighted Residual (weak) form, e.g. virtual work

0Vd)( R

wfLu

Integral Formulations

Page 6: The Finite Element Method

0

),(2

2

2

2

u

yxfy

u

x

uOn region S

on boundary C

Weak form

SS

yxwfyxwy

u

x

udddd

2

2

2

2

Integrate by parts

d d d d d dS C C S

u w u w u ux y w x w y f w x y

x x y y y x

Where, u and w vanish at the boundary

0 0

Weak Form for 2-D Poisson’s Equation

Page 7: The Finite Element Method

• Choose a finite set of approximating (trial) functions, i(x,y), i = 1, 2, …, N

• Allow approximations to u in the formU(x,y) = U11 + U22 + U33 + … + UNN

(that can also satisfy the essential boundary conditions)

• Solve N discrete equations for U1, U2, U3, …, UN

ij

jij

si

S

iNN

iNN

FUK

yxf

yxyy

Uy

Uxx

Ux

U

dd

dd...... 11

11

Galerkin’s Method for 2-D Poisson’s Equation

Page 8: The Finite Element Method

yxfF

Kyxyyxx

K

Sii

jiS

jijiij

dd

dd

[K]U = F

[K] is the stiffness matrix and F is the load (RHS) vector

[K] is symmetric and positive definite

Galerkin’s Method for 2-D Poisson’s Equation

Page 9: The Finite Element Method

• Galerkin is more general than Rayleigh-Ritz. If we add u/x, symmetry & the variational principle are lost, but Galerkin still works

• If w is chosen as Dirac delta functions at N points, weighted residuals reduces to the collocation method

• If w is chosen as the residual functions Lu-f, weighted residuals reduces to the least squares method

• By choosing w to be the approximating functions, Galerkin’s method requires the error (residual) in the solution to be orthogonal to the approximating space.

• The integration by parts (Green-Gauss theorem) automatically introduces the Neumann (natural) boundary conditions

• The Dirichlet (essential) boundary conditions must be satisifed explicitly when solving [K]U=F

• Since discretized integrals are sums, contributions from many elements are assembled into the global stiffness matrix by addition.

• The Ritz-Galerkin FEM finds the approximate solution that minimizes the error in the energy

Comments on Galerkin’s Method

Page 10: The Finite Element Method

1. Formulate the weighted residual (weak form)

2. Integrate by parts (or Green-Gauss Theorem) reduces derivative order of differential operator naturally introduces derivative (Neumann) boundary

conditions, e.g. flux or traction. Hence called that

natural boundary condition

3. Discretize the problem discretize domain into subdomains (elements) discretize dependent variables using finite

expansions of piecewise polynomial interpolating

functions (basis functions) weighted by parameters

defined at nodes

Steps in the Finite Element Method

Page 11: The Finite Element Method

4. Derive Galerkin finite element equations substitute dependent variable approximation in

weighted residual integral Choose weight functions to be interpolating

functions — the Galerkin assumption (Galerkin,

1906)

5. Compute element stiffness matrices and RHS integrate Galerkin equations over each element

subdomain integrate right-hand side to obtain element load

vectors which also include any prescribed Neumann

boundary conditions

Steps in the Finite Element Method (…cont’d)

Page 12: The Finite Element Method

6. Assemble global stiffness matrix and load vector Add element matrices and RHS vectors into global

system of equations Structure of global matrix depends on node ordering

7. Apply essential (i.e. Dirichlet) boundary conditions at least one is required (essential) for a solution prescribed values of dependent variables at specified

boundary nodes, e.g. prescribed displacements eliminate corresponding rows and columns from

global stiffness matrix and transfer column effects of

prescribed values to Right Hand Side the constraint reduced system

Steps in the Finite Element Method (…cont’d)

Page 13: The Finite Element Method

8. Solve global equations for unknown nodal dependent variables using algorithms for Ax = b or Ax = x

9. Evaluate element solutions interpolate dependent variables evaluate derivatives, e.g. fluxes derived quantities, e.g. stresses or strain energy graphical visualization; post-processing

10.Test for convergence refine finite element mesh and repeat solution

Steps in the Finite Element Method (…cont’d)

Page 14: The Finite Element Method

2

2

d2

d(1) 0

(4) 9

u

xu

u

solution

u x x( ) ( ) 1 2

1 2 3 4U1=0

2

4

6

8

x

u

U4=9

U3 =?

U2=?

Galerkin FEM: Simple 1-D Example

Page 15: The Finite Element Method

0xd)( R

wfLu

2. Integrate by parts (or Green-Gauss Theorem)

0xd24

12

2

wwdx

ud

0xd24

1

4

1

w

dxdu

wdxdw

dxdu

1. Formulate the weighted residual (weak) form

Page 16: The Finite Element Method

• 4 global nodal parameters U1, U2, U3, U4

• 3 linear elements each with 2 element nodal

parameters u1, u2.

• Adjacent elements share global nodal parameters,

e.g., global parameter U2 is element parameter u2 of

element 1 and u1 of element 2.

• Two (linear) element interpolation functions for each

element, i(x), i = 1, 2

• Allow element approximations to u in the form

u(x) = u1 1 + u2 2 = ui i i=1,2

3. Discretize the problem

Page 17: The Finite Element Method

0 0.5 10

0.5

1

x

21

element basis functions

Element Basis Functions

Page 18: The Finite Element Method

0xd2

xd2xd2

4

1

4

3

3

2

2

1

wdx

duw

dx

dw

dx

du

wdx

dw

dx

duw

dx

dw

dx

du

In each element, let

u(x) u1 1 + u2 2 = ui i (x)

and

w(x) i (x)

4. Derive Galerkin equations for each element

Page 19: The Finite Element Method

i

jjij

2

1

2

1

2

2

1

1

fuk

d2ddd

dd

dd

xx

xxu

xu

i

i

e.g. for Element 1 (no derivative boundary conditions):

[k] = [(kij)] is the element stiffness matrix

f = (fi) is the element load vector

4. Derive Galerkin equations for each element (… cont’d)

Page 20: The Finite Element Method

x

xxxd2f

kd k

ii

jiij

ji

[k]u = f

Element stiffness matrix, [k] and load (RHS) vector, f

1

2

:1 Element

2

1

x

x

11

11

d11

11

)1 ele(

2

1

2

1)1 ele(

[k]

[k]xx

xxx

5. Compute element stiffness matrices

Page 21: The Finite Element Method

xd2f ii

1

2

:1 Element

2

1

x

x

1

1

)21()44(

)14()48(

2

4d

22

24

)1 ele(

2

2 2

1

2

1)1 ele(

f

fxx

xxx

x

x

In this problem, each element is the same size and thus:

[k](ele 1) = [k](ele 2) = [k](ele 3)

and:

f(ele 1) = f(ele 2) = f(ele 3)

5. Compute element RHS matrices

Page 22: The Finite Element Method

1100

1210

0121

0011

11

1111

1111

11

[K]

1

2

2

1

1

11

11

1

F

6. Assemble global stiffness matrix and load vector

Page 23: The Finite Element Method

1

2

2

1

1100

1210

0121

0011

4

3

2

1

U

U

U

U

F[K]U

u U

u U

( )

( )

1 0

4 91

4

That leaves global equations 2 and 3

2 3

2 3

0 2 2

2 9 2

U U

U U

7. Apply essential (i.e. Dirichlet) boundary conditions

Page 24: The Finite Element Method

2 3 2

2 3 3

0 2 2 1

2 9 2 4

U U U

U U UExact!

8. Solve global equations (constraint-reduced)

Page 25: The Finite Element Method

Representing a One-Dimensional Field

• Polynomials are convenient, differentiated and integrated readily• For low degree polynomials this is satisfactory• If the polynomial order is increased further to improve the accuracy,

it oscillates unacceptably• Divide domain into subdomains and use low order piecewise

polynomials over each subdomain – called elements

2 3Use a polynomial expression ( ) ...

and estimate the monomial coefficients a, b, c and d

u x a bx cx dx

Page 26: The Finite Element Method

Making Piecewise Polynomials Continuous

• constrain the parameters to ensure continuity of u across the element boundaries

• or better, replace the parameters a and b in the first

element with parameters u1 and u2, which are the

values of u at the two ends of that element:

where is a normalized measure of distance along the curve

u u u( ) ( ) 1 1 2

( )0 1

Page 27: The Finite Element Method

u = u(x)

++

++

+ ++ + + +

++

+x

u

u = a + bx u = c + dx u = e + fx

++

+++ +

++ + +

++

+

x

u

u1

u2

u3

u4

0

1

u = (1- ) u1 + u2

element 1 element 2 element 3

nodes

Page 28: The Finite Element Method

u

u1

u2

u = (1- ) u1 + u2

0 1

0 1

1

0

1

1

= 1-

=

Linear Lagrange Interpolation

Page 29: The Finite Element Method

Global-Element Mapping

• Associate the nodal quantity un with element node n• Map the value U defined at global node onto local node n of

element e by using a connectivity matrix (n, e),

u Un n e ( , )

Thus, in the first element

u u u( ) ( ) ( ) 1 1 2 2

with u1=U1 and u2=U2..In the second element u is interpolated by

u u u( ) ( ) ( ) 1 1 2 2

With u1=U2 and u2=U3.

Page 30: The Finite Element Method

We have u () but to define u (x) we need x ().Define x as an interpolation of nodal values, e.g.

u u

x x

n nn

n nn

( ) ( )

( ) ( )

Isoparametric Interpolation

u

x

u1

u2

x2

x1

1

1

u1

u2

u

x2x1x

Page 31: The Finite Element Method

Quadratic Lagrange Basis Functions

Use three nodal parameters u1, u2 and u3

are the quadratic Lagrange basis functions.

1 1 2 2 3 3

1

2

3

where

2 1 0.5

4 1

2 0.5

u u u u

0 0.5 1.0

1.0

0 0.5 1.0

1.0

0 0.5 1.0

1.0

12

3

Page 32: The Finite Element Method

Cubic Hermite Basis Functions

1

1

1

1

1

1

0

0

0

0

3211 231

23212

221 1

1222

Page 33: The Finite Element Method

Scaling Factors

=0 =1=0 =0

s1 s2 s3

n e n,e

n en e n,e i

i i i (no sum on i)

U U

U U s

s

Global to local mapping:

Scaling Factors arc lengths

arc length

Page 34: The Finite Element Method

Two-DimensionalTensor-Product Elements

1 1 2 1 1 1 2 1 2

2 1 2 2 1 1 2 1 2

3 1 2 1 1 2 2 2 2

4 1 2 2 1 2 2 1 2

( , ) ( ) ( ) (1 )(1 )

( , ) ( ) ( ) (1 )

( , ) ( ) ( ) (1 )

( , ) ( ) ( )

u( 1 , ) ( , ) ( , ) ( , ) ( , )2 1 1 2 1 2 1 2 2 3 1 2 3 4 1 2 4 u u u u

Bilinear interpolation can be constructed

where

Page 35: The Finite Element Method

1

0 11

2

1

1 1

2

u

y

x

1

x = n xn

u = n un

y = n yn0

Bilinear Tensor-Product Basis Functions

Page 36: The Finite Element Method

A Six-NodedQuadratic-Linear Element

1

3

5

( , ) ( ) ( )

( , ) ( )

( , ) ( )

1 2 1 1 2

1 2 1 1 2

1 2 1 1 2

2 11

21

21

2

1

21

4 1

FH IK

FH IK FH IK

2

4

6

( , ) ( )( )

( , )

( , )

1 2 1 1 2

1 2 1 1 2

1 2 1 1 2

4 1 1

2 11

2

21

2

FH IK FH IK

b g

1

2

1.0

1.000

0.5

Page 37: The Finite Element Method

Three-dimensional Linear Basis Functions

e.g. trilinear element has eight nodes with basis functions:

21 ;1

1

2

3

4

5

6

7

8

1

2

3

.,,

;,,

;,,

;,,

;,,

;,,

;,,

;,,

3222123218

3222113217

3221123216

3321113215

3122123214

3122113213

3121123212

3121113211

8

1321 ,,

iii uu

Page 38: The Finite Element Method

1

2

3

5

6

7

1

2

3

In each node we define:

221

3

32

2

31

2

321

2

21

,,

,,,,,

uuu

uuuuu

Tri-Cubic Basis Functions

Page 39: The Finite Element Method

321

3

3218

32

2

3217

31

2

3216

3321

5

21

2

3214

8

1 2321

3

1321

2321

1321

,,,,

,,,,,,

,,,,,,,,

ii

ii

ii

ii

ii

i

ii

iiii

uu

uuu

uuuu

8,...2,1,;2,1,,,,,

;,, 321321

jirqnmlk

rq

nm

lk

ji

Tri-Cubic Basis Functions (Cont’d)

Page 40: The Finite Element Method

Scaling Factors

=0 =1=0 =0

s1 s2 s3

n e n,e

n en e n,e i

i i i

n e n e n en,e2 i j

i j i j i j

n e n,e3

i j k i j k

(no sum on i)

(no sum on i,j)

U U

U U s

s

U U s s

s s

U U

s s s

n e n e n ei j k

i j k(no sum on i,j,k)

s s s

Global to local mapping:

Scaling Factors arc lengths

arc length

Page 41: The Finite Element Method

Coordinate Systems• Rectangular Cartesian global reference

coordinate system • Orthogonal curvilinear coordinate

system to describe geometry and deformation

• Curvilinear local finite element coordinates

• Locally orthonormal body coordinates define material symmetry and structure, related to the finite element coordinates by a rotation about the -normal axis through the "fiber angle" ,

1 2 3{ }Y ,Y ,Y

1 2 3{ }, ,

1 2 3{ }, ,

1 2 3{ }X ,X ,X

1 2( , ) 1

From Costa et al, J Biomech Eng 1996;118:452-463

Page 42: The Finite Element Method

Curvilinear World

Coordinates

R

Y1

Y2

Y3

A) Rectangular Cartesian Coordinates: {A}=(X,Y,Z)

C) Spherical Polar Coordinates: {A}=(R,,)

Y1 = R cos cosY2 = R cos sinY3 = R sin

B) Cylindrical Polar Coordinates: {A}=(R,,Z)

Y1 = R cosY2 = R sinY3 = Z

Y3=ZY2=Y

Y1=X

Y1

R

Y2

Y3=Z

+

Y2

Y1

Y3

d=focus

= d coshcos= d sinhsincos= d sinhsinsin

Y2

Y1

Y3

D) Prolate Spheroidal Coordinates ()

Page 43: The Finite Element Method

Fiber/Sheet Coordinates

Page 44: The Finite Element Method

Coordinate System

Notations

* R e p r e s e n t s a L a g r a n g i a n d e s c r i p t i o n o f t h e d e f o r m a t i o n f r o m B t o B .

S t a t e o f B o d y

I n d i c e s

C o o r d i n a t e s

C o v a r i a n t B a s e V e c t o r s

C o v a r i a n t M e t r i c T e n s o r s

A ) r e c t a n g u l a r C a r t e s i a n r e f e r e n c e c o o r d i n a t e s

B R , S RY Re R , S

B r , s Ry re r , s

B ) c u r v i l i n e a r w o r l d c o o r d i n a t e s

B A , B A R

A RA

Y

G e

R R

A B A B

Y YG

B , r

ry

g e

r ry yg

C ) n o r m a l i z e d f i n i t e e l e m e n t c o o r d i n a t e s ( L a g r a n g i a n )

B K , L K K AK

G G A B

K L A BK LG G

B * K K

g g * K L K L

g g

D ) l o c a l l y o r t h o n o r m a l b o d y / f i b e r c o o r d i n a t e s

B I , J IX K

xI KIX

G G

K L

xI J K L I JI J

G GX X

B i , j ix K

xi Kix

g g

K Lx

i j K L i ji jg g

x x

B * K

xI KI

x

X

g g * K L

xI J K LI J

x xg g

X X

Page 45: The Finite Element Method

Fitting with Linear Lagrange 1-D Elements

Two linear Lagrange elements fit the data with a root-mean-squared-error (RMSE) of 0.614892.

Result of twice refining the mesh (yielding 8

elements) and re-fitting: RMSE = 0.0930764

Page 46: The Finite Element Method

2

1,

2 2

1 21 2

2 2 22 2 2

3 4 52 21 2 1 2

d

d d dd D

d d d d

d d d d d d

F

d

X X X

X X X X

X X X X X X

The least squares fit minimizes the objective function:

dX dX

i

ξd

where is measured coordinate or field variable;

are smoothing weights

is the interpolated value at

Least Squares Fitting

d are weights applied to the data points

i id d

Nd j j N

NjN

j

0 a linear system of equations for nodal parameters

X X

FX

X

X

Page 47: The Finite Element Method

Fitting a Coronary Vascular Tree with Quadratic Lagrange 1-D Elements

Page 48: The Finite Element Method

• anesthetized & ventilated New Zealand White rabbit

• heart arrested in diastole, excised

• pulmonary vessels removed, aorta cannulated

• heart suspended in Ringers lactate, perfused in unloaded state with buffered formalin at 80 mm Hg for 4 minutes

• heart cast in polyvinylsiloxane

plunger

tube

knife

heart cast in rubber

Rabbit Ventricular Anatomy

Page 49: The Finite Element Method

plunger

knife

Rabbit Ventricular Anatomy

BASE

APEX

Page 50: The Finite Element Method
Page 51: The Finite Element Method

data point projects onto

surface at

ddd

Bicubic Hermiteisoparametric interpolation

(1, 2) {ii1

i

4

(1, 2)

i

1

i2(1, 2)

i

2

i3(1, 2)

2i

12

i4(1, 2)}

1

x = d cosh cos y = d sinh sin cos z = d sinh sin sin

Page 52: The Finite Element Method
Page 53: The Finite Element Method
Page 54: The Finite Element Method
Page 55: The Finite Element Method

endo

epi

RIGHT VENTRICLE

LEFT VENTRICLE

Page 56: The Finite Element Method

• 8,351 geometric points

• 14,368 fiber angles• 36 elements• 552 geometric DOF

RMSE = ±0.55 mm• 184 Fiber angle DOF

RMSE = ±19°

Anatomic Model

Vetter & McCulloch Prog Biophys & Mol Biol 69(2/3):157 (1998)

Page 57: The Finite Element Method

Strain Analysis

X2, longitudinal

X1, circumferential

X 3, radial

Xc , crossfiber

X f , fiber

X r , radial

T12

2 2 12

=

d d

i i kij i j i j i j

j k j

ij i j

x xF

X X

s S E dX dX

F e e e e e e

E F F I

Page 58: The Finite Element Method

A/P View Lateral View

Reconstructed3D Coordinates

Transform

Page 59: The Finite Element Method

Baseline 2 minutes ischemia

End-Systolic Circumferential Strain

0.04

0.00

-0.04

-0.07

Page 60: The Finite Element Method

x

x x

x x xx

2

1,

2 2

1 2

2 2 22 2 22

2 21 2 1 2

d

d d dd D

d d d d

d d d d d d

F

dx

X X X

X X X X

X X X X X X

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7R

MS

Fit

tin

g E

rro

r (m

m)

10-7 10-6 10-5 10-4 10-3 10-2 10-1 100

Smoothing Weight

Page 61: The Finite Element Method

0.018

0.02

0.022

0.0240.026

0.030.028

10-6

10-5 10-4 10-3 10-2

10-6

10-5

10-4

10-3

10-20.032

Page 62: The Finite Element Method

Fiber Strain Cross-fiber StrainMyocardial Blood Flow

Co

ntr

ol

LA

D O

cclu

sio

n

-0.05 0.00 0.050.0 1.5 3.0mL/min/g

Page 63: The Finite Element Method
Page 64: The Finite Element Method

SE

PT

AL

LA

TE

RA

L

3months post-surgeryPre-surgery