Lecture1 Cornell

download Lecture1 Cornell

of 60

Transcript of Lecture1 Cornell

  • 8/13/2019 Lecture1 Cornell

    1/60

    N. Zabaras 1

    INTRODUCTION TO THE FINITE ELEMENT METHOD

    FOR ELLIPTIC PROBLEMS

    Variational weak formulation for a 1D model problem

    FEM for the model problem using piecewise linear functions

    Error estimation for the 1D model problem

    FEM for the 2D Poisson equation

    Introduction to Hilbert spaces L2(),H1() andH10()

    The best error approximation: Geometric interpretation

    The Neumann problem: Natural and essential boundary conditions

    FEM Programming

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    2/60

    N. Zabaras 2

    INTRODUCTION TO FEM FOR ELLIPTIC PROBLEMS

    Variational formulation of a one-dimensional model problem

    u(x) =f(x), 0< x

  • 8/13/2019 Lecture1 Cornell

    3/60

    N. Zabaras 3

    SOME EXAMPLE PROBLEMS

    An elastic bar

    =Eu (Hookes law) =f, (Equilibrium equ.)u(0) =u(1) = 0 (Boundary conds.)

    An elastic cord

    Heat conduction

    q=Ku

    (Fouriers law)q =f, (Conservation of energy)u(0) =u(1) = 0 (Temperature boundary conds.)

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    4/60

    N. Zabaras 4

    THE MINIMIZATION PROBLEM (M)

    Define the linear functionalF :V as:

    F(v) = 12(v, v) (f, v)

    Findu V such thatF(u) F(v) vV

    where:

    V ={v:vis a continuous function on [0, 1],v is piecewise continuous and

    bounded on [0, 1], andv(0) =v(1) = 0}

    (v, w) =10v(x)w(x)dx, for real valued piecewise continuous functions.

    (M) corresponds to thePrinciple of Minimum Potential Energy in Me-

    chanics.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    5/60

    N. Zabaras 5

    THE VARIATIONAL (WEAK) PROBLEM (V)

    FinduV such that (u, v) = (f, v) vV

    where:

    v is the so called test function

    (V) corresponds to the Principle of Virtual Work in Mechanics.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    6/60

    N. Zabaras 6

    The solution of (D) is also a solution of (V)

    We multiply the equation u = f by an arbitraryfunctionvV

    Integrate over (0, 1) which gives:

    (u, v) = (f, v)

    We now integrate the left-hand side by parts using thefact thatv(0) =v(1) = 0 to get:

    (u

    , v) =u

    (1)v(1) +u

    (0)v(0) + (u

    , v

    ) = (u

    , v

    )We conclude that: (u, v) = (f, v) vV, i.e. uis a

    solution of (V).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    7/60

    N. Zabaras 7

    The solution of(V) is also a solution of(M)

    Let u be a solution to (V), let v V and set w = v u so thatv=u+w,wV.

    We can write: F(v) =F(u+w) = 12(u +w, u +w) (f, u+w)

    = 12(u, u) (f, u) + (u, w) (f, w) + 12(w

    , w)

    =F(u) + 0 + 12(w, w)

    F(u)

    Thus,uis the minimizer ofF(v) (uis a solution of (M)).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    8/60

    N. Zabaras 8

    The solution of(M) is also a solution of (V)

    Let u be a solution to (M), then for any real number and anyvVwe have thatu+v V, which implies:

    F(u) F(u+v)

    Thus the differentiable functiong() =F(u+v) has a minimumat= 0 and hence g(0) = 0.

    We have:

    g() =

    1

    2(u

    , u

    ) +(u

    , v

    ) +

    2

    2 (v

    , v

    ) (f, u) (f, v) andg() = (u, v) +(v, v) (f, v).

    Usingg(0) = 0 andg(0) = (u, v) (f, v), results in:

    (u, v) = (f, v), i.e. uis a solution of (V).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    9/60

    N. Zabaras 9

    Problem (V) has a unique solution

    Let (V) admit two solutions u1, u2V.

    (u1, v) = (f, v) vV and

    (u2, v) = (f, v) vV

    Subtracting these equations leads to the following:10 (u

    1 u

    2)v

    dx= 0 vV.

    Choosingv=u1 u2V results to:10 (u1 u2)2dx= 0, which shows that:

    u1(x) u2(x) = 0 x[0, 1].

    It follows thatu1(x) u2(x) =constanton [0, 1], which together

    with the boundary conditionu1(0) =u2(0) = 0 gives that:u1(x) =u2(x) x[0, 1], and the uniqueness is proved.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    10/60

    N. Zabaras 10

    Ifu is a solution of(V) then u also satisfies (D)

    LetuVbe a solution of (V), then:10u

    vdx 10fvdx= 0 vV ()

    We assume thatu exists and is continuous (regularity condition).

    Integration of the first term in Equ. (*), and using v(0) = v(1) = 0,leads to: 1

    0 (u +f)vdx = 0 vV

    By the assumption that (u

    +f) is continuous, the above relation canonly hold if:u(x) +f(x) = 0,x [0, 1]

    Souis a solution of (D).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    11/60

  • 8/13/2019 Lecture1 Cornell

    12/60

    N. Zabaras 12

    Continuous piecewise linear basis functionsj(x),j = 1, 2, . . . , M

    A functionvVh has the representation:

    v(x) =Mi=1 i i(x),x[0, 1], where:

    i=v(xi) and

    j(xi) =ij

    1 if i=j0 if i=j

    i, j = 1, . . . , M .

    The spaceVh is a linear space of dimension Mwith basis{i}Mi=1.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    13/60

    N. Zabaras 13

    Finite dimensional problems (Mh) and (Vh)

    (Mh): FinduhVh such thatF(uh) F(v) vVh.

    (Vh): FinduhVh such that (uh, v

    ) = (f, v) vVh.

    where:uh(x) =M

    j=1 jj(x), with

    j =uh(xj) (nodal values ofuh(x)).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    14/60

    N. Zabaras 14

    Linear system of equations A=b

    (Vh): FinduhVhsuch that (uh,

    i) = (f, i),i= 1, 2, . . . , M .

    We finally obtain the following linear system of equations:M

    j=1 j (j,

    i) = (f, i), i= 1, 2, . . . , M

    where

    A= (aij) is theM Mstiffness matrix withaij = (

    j,

    i)

    b= (bi) is the force vector with: bi= (f, i) and

    = (i) is the solution vector with: i=uh(xi), i= 1, 2, . . . , M .

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    15/60

    N. Zabaras 15

    Properties of the stiffness matrix A

    A is symmetric,Aij =Aji, (j, i) = (i, j), i, j = 1, 2, . . . , M .

    Ais sparse (i.e. only a few elements ofAare nonzero)

    (j, j) =xj

    xj11

    h2jdx+xj+1

    xj1

    h2j+1dx

    = 1hj + 1hj+1, j = 1, 2, . . . , M .

    (j, j1) = (

    j1,,

    j) =xjxj1

    1h2j

    dx

    = 1hj ,j = 2, . . . , M .

    (i, j) = 0 if |i j|>1.

    A is positive definite. Indeed for M we obtain:

    A=Mi=1

    Mj=1 iAijj =

    Mi=1

    Mj=1 i(

    i,

    j)j

    = (M

    i=1 ii,M

    j=1 jj) = (v, v)0, v=M

    i=1 ii(x).

    Also, A= 0 only ifj = 0,j = 1, . . . , M .

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    16/60

    N. Zabaras 16

    Properties of the stiffness matrix A

    SinceAis a positive definite matrix, we conclude thatAis non-singular.

    It follows that the system A=bhas a unique solution.

    For the particular case ofhj =h= 1M+1, the systemA=bbecomes:

    1h

    2 1 0 0 0 01 2 1 0 0 0

    0 1 2 1 0 0 0 0 1 2 1 0 0 0 0 0 1 2 10 0 0 0 1 2

    1

    M

    =

    b1

    bM

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    17/60

    N. Zabaras 17

    An error estimate for FEM for the model problem

    Let uh be the solution of the finite element problem(Vh), i.e. (u

    h, v

    ) = (f, v), v Vh ()

    Letube the solution to problem (D), it then satisfies:

    (u

    , v

    ) = (f, v), v V.SinceVhV, we can also write:

    (u, v) = (f, v), v Vh ()

    Subtracting the equations (*) above results in:

    (u uh, v) = 0, v Vh

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    18/60

  • 8/13/2019 Lecture1 Cornell

    19/60

    N. Zabaras 19

    Theorem: For any vVh we have (u uh) (u v)

    Letv Vh be arbitrary and setw=uh v.

    Thenw Vh and using the error condition

    (u uh, v) = 0, v Vh, forv=w, we obtain:(u uh, w

    ) = 0.

    Using the Cauchy inequality we also have:

    (u uh)

    2

    =(u uh)

    , (u uh)

    +(u uh)

    , w

    =(u uh)

    , (u uh+w)=(u uh)

    , (u v)

    (u uh) (u v)

    Dividing by (u uh) , we obtain the required theorem.

    We conclude that (u uh) is as small as possible.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    20/60

    N. Zabaras 20

    The finite element interpolant

    Based on the previous theorem, (u uh) (u v) , v Vh, we

    can obtain estimates of the error (u uh) .

    We calculate (u uh)

    , where uh is the FEM interpolant ofu, i.e.

    uh(xj) =u(xj),j = 0, 1, 2, . . . , M + 1

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    21/60

    N. Zabaras 21

    Interpolation error and finite element method error

    Interpolation error:

    |u (x) uh (x)| hmax0y1 |u (y)| ,

    |u (x) uh (x)| h2

    8 max0y1 |u

    (y)|

    FEM error:

    (u uh) hmax0y1 |u

    (y)|

    |u (x) uh (x)| hmax0y1 |u (y)| for 0x1

    not the best possible

    error estimate

    The error tends to zero as the max length of the subinterval Ij tendsto zero (assuming that u is bounded on [0, 1]).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    22/60

    N. Zabaras 22

    Proof of |u (x) uh (x)| hmax0y1 |u (y)| , x[0, 1]

    1. Letx Ij+1= [xj, xj+1],j = xj+1x

    hj+1,j+1=

    xxjhj+1

    .

    2.u(xm) =u(x) +u(x) (xmx) +

    12u

    (m)(xmx)2,mIj+1,m=j, j+1.

    3. Multiplication of (2) with m and addition inm=j, j+ 1, results in:j+1m=j mu(xm) =u(x)

    j+1m=jm+u

    (x) j+1m=jm(xm x)+ j+1m=j 12u(m)m(x)(xm x)2

    4. Using mxm=x,m= 1 and the definition of u(x), result in:

    u(x) u(x) =j+1

    m=j

    1

    2u

    (m)m(x)(xm x)2

    5.u(x) u(x) = j+1m=j 12u(m)(m(x)(xm x)2 2m(x)(xm x))6. Using |u(m)| max0y1 |u

    (y)|,mxm = x,m = 1, substitutingm and summing in m,

    |u(x) u(x)| max0y1 |u (y)| 12|xj+1+xj 2x|

    7. But|xj+1+xj

    2 x| hj2 and the theorem is proved.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    23/60

    N. Zabaras 23

    Proof of |u (x) uh (x)| h2

    8 max0y1 |u (y)| , x [0, 1]

    1. Recall from the previous derivation that:u(x) u(x) = j+1m=j 12u(m)m(x)(xm x)2

    2. With simplifications, we can write:u(x) u(x) = j+1m=j 12u(m)(x2m+x2 2xmx)m

    3. Using mxm=xresults in:|u(x) u(x)| 12max0y1 |u

    (y)| (j+1m=jx2mm x2) (*)

    4. Let us defineE(x) =j+1

    m=jx2mm x2 0. It is easy to calculate fromE(x) = 0that E(x) becomes maximum (E(x) = 2 < 0) at x =

    hj2 +xj and that

    E(x) = h2j4.

    5. Using the above result, Equation (*) can be re-written as follows:

    |u(x) u(x)| h2

    8max0y1 |u (y)|

    which completes the proof.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    24/60

    N. Zabaras 24

    Proof of (u uh) hmax0y1 |u

    (y)|

    1. From the main theorem we have that: (u uh) (u uh)

    .

    2. Using the results from the interpolation error calculations gives that:

    (u uh) = (10(u(z) uh(z))2 dz)1/2

    (u uh) = (10(u

    (z) uh(z))2 dz)1/2

    (10h2(max

    0y1|u (y)|)2dz)1/2

    =hmax0y1 |u (y)|

    and the required result was obtained.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

  • 8/13/2019 Lecture1 Cornell

    25/60

  • 8/13/2019 Lecture1 Cornell

    26/60

    N Z b 27

  • 8/13/2019 Lecture1 Cornell

    27/60

    N. Zabaras 27

    THE MINIMIZATION PROBLEM (M)

    Define the linear functionalF :V as:

    F(v) = 12 a(v, v) (f, v)

    Findu V such thatF(u) F(v) vV

    where:

    V ={v:v is a continuous function on , vx1 and vx2

    are piecewise

    continuous on , andv= 0 on }

    a (u, v) =

    u v dx=

    ux1

    vx1

    + ux2v

    x2

    dx

    (f, v) =

    fvdx

    (M) corresponds to thePrinciple of Minimum Potential Energy in Me-chanics.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N Zabaras 28

  • 8/13/2019 Lecture1 Cornell

    28/60

    N. Zabaras 28

    THE VARIATIONAL (WEAK) PROBLEM (V)

    FinduV such thata(u, v) = (f, v) vV

    where:

    V ={v:v is a continuous function on , vx1 and vx2

    are piecewise

    continuous on , andv= 0 on }

    a (u, v) =

    u v dx=

    ux1

    vx1

    + ux2v

    x2

    dx

    (f, v) =

    fvdx

    v is the so called test function

    (V) corresponds to the Principle of Virtual Work in Mechanics.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N Zabaras 29

  • 8/13/2019 Lecture1 Cornell

    29/60

    N. Zabaras 29

    FEM for the model problem with piecewise linear functions

    Construct a finite-dimensional subspaceVh V as follows:

    Approximate with a polygonal curve.

    Make a triangulation of by subdividing into a set

    Th={K1, K2, . . . , K m}of non-overlapping trianglesKi, such that

    no vertex of one triangle lies on the edge of another triangle, =KThK=K1 K2 . . . Km

    We introduce the mesh parameterhas follows: h= maxKThdiam (K),where, diam(K) = diameter ofK= longest side ofK.

    Let us defineVhVto be the set of functions v such that:Vh={v: v is continuous on , v|K is linear forKTh, v= 0 on }

    wherev|Kdenotes the restriction ofv toK(i.e. the function defined onKagreeing withv onK).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 30

  • 8/13/2019 Lecture1 Cornell

    30/60

    N. Zabaras 30

    A finite element triangulation

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 31

  • 8/13/2019 Lecture1 Cornell

    31/60

    Continuous piecewise linear basis functions j,j = 1, 2, . . . , M

    To describe v Vh, we choose the values v(Ni) at the nodes Ni,i= 1, . . . , M , ofTh, but exclude the nodes on the boundary sincev= 0 on . v has then the representation:

    v(x) =Mi=1 i i(x),x , where:

    i=v(Ni) and

    j(Ni) =ij 1 if i=j0 if i=j i, j = 1, . . . , M .

    The spaceVh is a linear space of dimension Mwith basis{i}Mi=1.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 32

  • 8/13/2019 Lecture1 Cornell

    32/60

    The basis function j

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 33

  • 8/13/2019 Lecture1 Cornell

    33/60

    Finite dimensional problems (Mh) and (Vh)

    (Mh): FinduhVh such thatF(uh) F(v) vVh

    (Vh): FinduhVh such thata(uh, v) = (f, v) vVh

    where:

    uh(x) =M

    j=1 jj(x), with

    j =uh(Nj) (nodal values ofuh(x)).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 34

  • 8/13/2019 Lecture1 Cornell

    34/60

    Linear system of equations A=b

    (Vh): FinduhVh such thata(uh, i) = (f, i),i= 1, 2, . . . , M

    We finally obtain the following linear system of equations:

    Mj=1 j a(j, i) = (f, i), i= 1, 2, . . . , M

    where

    A= (aij) is theM Mstiffness matrix withaij =a(j, i)

    b= (bi) is the force vector with: bi= (f, i) and

    = (i) is the solution vector with: i=uh(Ni), i= 1, 2, . . . , M .

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 35

  • 8/13/2019 Lecture1 Cornell

    35/60

    Special case of uniform discretization

    Consider to be a square with side length 1 and let Th be the uniform trian-gulation of with the indicated node enumeration (h= 1N+1).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 36

  • 8/13/2019 Lecture1 Cornell

    36/60

    Special case of uniform discretization

    1h

    4 1 0 1 0 01 4 1 0 1 0

    0 1 4 1 0 1 1 0 1 4 1 0 1 0

    0 0 1 0 1 0 1 0 1 4 10 0 1 0 1 4

    1

    M

    =

    b1

    bM

    Note that the stiffness matrix is the same as that in the 5 point finite differencemethod. However, the force vector contains averages off around each nodeNi.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 37

  • 8/13/2019 Lecture1 Cornell

    37/60

    Interpolation error and finite element method error

    The best approximation theorem: u uh u v, v Vh,

    v=a (v, v)12 =

    |v|2 dx12

    =

    v

    x1

    2+

    vx2

    2 dx12

    , v Vh

    From the above theorem we have the following FEM error estimate:

    u uh u uhwith uhthe FE interpolant, i.e. uhVhand uh (Ni) =u (Ni) , i= 1, . . . , M .

    FEM error: IfK Th are not allowed to become too thin, we can show:u u

    h Ch

    u uh

    (u uh)2 dx12

    Ch2

    whereCish-independent and depends only on the size of the second deriva-

    tives ofuand the smallest angle of the triangles K in Th.The error and the gradient of the error u uhtend to zero in the norm

    ashtends to zero (assuming that the exact solutionuis sufficiently regular).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 38

  • 8/13/2019 Lecture1 Cornell

    38/60

    Some preliminary computational aspects

    To calculate the stiffness matrix A, assemble over element contributions:

    a (i, j) = KTh

    aK(i, j) ,

    where

    aK(i, j) =K

    i jdx

    LetNi,Nj andNkbe the vertices of the triangle K. We define the elementstiffness matrix forKas follows:

    aK(i, i) aK(i, j) aK(i, k)aK(j, j) aK(j, k)

    sym aK(k, k)

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 39

  • 8/13/2019 Lecture1 Cornell

    39/60

    The basis function j associated with K.

    To compute the element stiffness matrix of the triangle K, we work withthe restrictions of the basis functions j on K,j =j|K.

    We calli,j andk the basis functions on the triangle K.

    Ifw Vh, its representation on Kis the following:w(x) = w(Ni)i(x) + w(Nj)j(x) + w(Nk)k(x)

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 40

  • 8/13/2019 Lecture1 Cornell

    40/60

    The Hilbert spaces L2(), H1() and H10()

    While working with variational forms of BVPsfor PDEs, it is natural and useful to work withfunction spaces V that are slightly larger thanthe spaces of continuous functions with piecewisecontinuous derivatives used previously.

    We will endow the spaceVwith the scalar prod-

    uct related to the BVP. The space V will be aHilbert space.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 41

  • 8/13/2019 Lecture1 Cornell

    41/60

    Linear and bi-linear forms

    Lis alinear formonV ifL: V , i. e.,L (v) forv V,andLis linear, i. e., for allv, w V and,

    L (v+w) =L (v) +L (w)

    We say thata (., .) is a bi-linear formonV V ifa:V V ,i. e.,a (v, w) forv, w V, and a is linear in each argument,i. e., for allu, v, w V and, , the following holds:

    a (u,v+w) =a (u, v) +a (u, w)

    a (u+v, w) =a (u, w) +a (v, w)The bilinear forma (., .) onV V is said to be symmetric if:

    a (v, w) =a (w, v) , v, w V

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 42

  • 8/13/2019 Lecture1 Cornell

    42/60

    Inner product and norm related to the BVP

    A symmetric bilinear form a (., .) onV V is said to be a scalarproductonV if:

    a (v, v)>0 v V, v= 0

    Thenorm a associated with a scalar producta (., .) is definedby

    va= (a (v, v))12 , v V energy norm

    Further, if< ., . > is a scalar product with corresponding norm , then we have the Cauchy-Schwarz inequality:

    |< v, w >| v w

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 43

  • 8/13/2019 Lecture1 Cornell

    43/60

    Hilbert spaces

    Let V be a linear space with a scalar product and correspondingnorm .

    A sequencev1,v2,. . ., of elementsviin the spaceVwith norm is said to be a Cauchy sequence if for all > 0 there is a naturalnumberNsuch that

    vi vj< i,j > N

    viconverges tov ifv vi 0 asi

    The space V is said to be a Hilbert space ifV is complete, i. e., ifeveryCauchy sequencewith respect to is convergent.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 44

  • 8/13/2019 Lecture1 Cornell

    44/60

    Hilbert spaces for variational problems

    IfI= (a, b), define the space of square integrable functions onIas:L2(I) =v: vis defined onIand

    Iv2dx

  • 8/13/2019 Lecture1 Cornell

    45/60

    The Sobolev H1(I) space

    We define the space H1(I) as follows:H1 (I) ={v: v andv L2(I)}

    We equipH1(I) with the following scalar product:

    (v, w)H1(I)=I (vw+v

    w) dx

    The corresponding norm is:

    vH1(I)=

    I

    v2 + (v)2

    dx

    12

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 46

  • 8/13/2019 Lecture1 Cornell

    46/60

    The Sobolev H10(I) space

    Recall our model problem: u(x) =f(x),x (0, 1),u(0) =u(1) = 0.

    For this problem, we need to use the spaceH10(I) defined as:H10(I) =v H1 (I) :v (0) =v (1) = 0

    with the same scalar product and norm as forH1(I).

    The weak form for the model problem is then written as follows:Findu(x) H10(I) such that: (u

    , v) = (f, v), v H10(I),

    where (u, v) =I

    u v dx.

    The spaceH10(I) is the largest space for which the variational problemis meaningful.

    The formulation in H10(I) is preferable to that in V in that the basic

    error estimate for the FEM is an estimate in the H1 norm.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 47

  • 8/13/2019 Lecture1 Cornell

    47/60

    The spaces L2(), H1() and H10(),

    d, d= 2, 3

    L2 () =v:vis defined on and

    v2dx

  • 8/13/2019 Lecture1 Cornell

    48/60

    An example problem in d, d= 2, 3

    Let us consider the following BVP:(D) Findu such: u=f in , u= 0 on .

    The variational form is given as follows:

    (V) Findu H1

    0

    () such that a (u, v) = (f, v) v H1

    0

    ()

    or equivalently

    (M) Findu H10() such that F(u) F(v) v H10()

    F(v) = 12a (v, v) (f, v),

    a (u, v) =

    u vdx

    (f, v) =

    fvdx

    It may be difficult to prove the existence of classical solutions of (D).

    However, the existence of solutions of (V) (weak solutions of (D)) maybe easier.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 49

    1

  • 8/13/2019 Lecture1 Cornell

    49/60

    A finite element approximation in VhH10

    u+u=f in ,

    u= 0 on

    Findu H10 such that:

    < u, v >= (f, v) , v H10() ,where:

    < u, v >=

    [u v+uv] dxis the scalar product inH10().

    Finduh VhH1

    0() such that: < uh, v >= (f, v)v Vh

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 50

    A i i i f h FEM i H1

  • 8/13/2019 Lecture1 Cornell

    50/60

    A geometric interpretation of the FEM in H10

    We can obtain: < u uh, v >= 0, v Vh, i.e.the erroru uh is orthogonal toVh with respect to< ., . >.

    The finite element solution uonVh is the projectionwith respectto < ., . >of the exact solutionu in Vh, i.e. uh is the element in

    Vh closest touwith respect to theH10() norm or in other words:

    u uhH1() u vH1() v Vh

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 51

    Th N bl

  • 8/13/2019 Lecture1 Cornell

    51/60

    The Neumann problemNatural and essential boundary conditions

    Consider the following Newmann problem (D):

    u+u=f in u

    n =g on

    The variational formulation (V) becomes:

    Findu H1 () such that,

    a (u, v) = (f, v) +< g, v > v H

    1

    ()wherea (u, v) =

    [u v+uv] dx, (f, v) =

    fvdx, < g,v >=

    gvds

    The Newmann condition un =g does not appear explicitly in (V).

    The solutionu of (V) is only required to belong toH1() and is notexplicitly required to satisfy the Newmann condition.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 52

    The Neumann problem

  • 8/13/2019 Lecture1 Cornell

    52/60

    The Neumann problem

    LetTh be a triangulation of and letVh={v:vis continuous on ,v|Kis linear K Th} H

    1()

    As parameters to describe the functions inVh, we choose the valuesat the nodes including the nodes on the boundary .

    The finite element method becomes: Find uh Vh such thata (uh, v) = (f, v) +< g, v > v Vh

    The problem has a unique solution uh that can be determined by

    solving a symmetric, positive definite linear system of equations.The following error estimate is obtained:u uhH1() u vH1() v Vh

    and hence as shown earlieru uh

    H

    1

    ()

    Ch, (if uis regular enough)

    The solutionuhwill satisfy the Newmann condition approximately.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 53

    Sh th t l ti H1() f (V ) i l l ti f (D)

  • 8/13/2019 Lecture1 Cornell

    53/60

    Show that a solution u H1() of (V) is also a solution of (D)

    Using Greens theorem, we find that ifuis sufficiently regular

    (f, v)+< g, v >=a(u, v) =

    unvds+

    (u+u)vdx

    or rearranging terms:

    (u+u f)vdx+

    (un g)vds= 0,v H1()

    Consider the above equation for the functionsvthat vanish on theboundary. We then conclude that: u+u f= 0, in .

    We thus have that: (

    un g)vds= 0,v H1().

    By varying v over H1() (which means that v will vary freely on), we finally get: un =g, on .

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 54

    Programming remarks

  • 8/13/2019 Lecture1 Cornell

    54/60

    Programming remarks

    Consider the Newmann problem examined earlier:

    u+u=f in u

    n=g on

    LetTh={K}be a triangulation of 2 with boundary and let

    Vhbe the corresponding space of continuous piecewise linear functions.

    Let Ni, i = 1, 2, . . . , M , denote the nodes ofTh and 1, . . . , M the

    natural base forVh withi(Nj) =ij.We want to find the solution M of the linear system: A= b,

    whereA= (aij) , b= (b1, . . . , bM) andaij = KTh

    aKij , bi= KTh

    bKi

    aKij =K {i j+ij} dx, b

    Ki =K f idx+ K gids

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 55

    Main tasks in finite element programming

  • 8/13/2019 Lecture1 Cornell

    55/60

    Main tasks in finite element programming

    Input the dataf,g, and the coefficients of the equation.

    Construct and represent the triangulationTh.

    Compute the element stiffness matricesaK and element loadsbK.

    Assemble the global matrixAand load vectorb.

    Solve the system of equations A=b.

    Present the results (post-processing, visualization, etc.).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 56

    Construction of the triangulation Th

  • 8/13/2019 Lecture1 Cornell

    56/60

    Construction of the triangulation Th

    Successive refinement by connecting the midpoints of each side (thisleads toquasi-uniform mesheswhere the triangles have essentiallythe same size in all parts of ):

    In general, one needs smaller triangles in regions where the exact

    solution varies quickly or where certain derivatives of the exactsolution are large (adaptive methods).

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 57

    Representation of the triangulation Th

  • 8/13/2019 Lecture1 Cornell

    57/60

    Representation of the triangulation Th

    Let Ni, i = 1, 2 . . . , M and Kn, n = 1, . . . , N be enumerations ofthe nodes and triangles ofTh, respectively.

    ThenTh is defined using two arrays:

    Z(j, i),j = 1, 2 are the coordinates of node Ni.T(j, n),j= 1, 2, 3 are the number of the vertices of triangle Kn.

    T =

    1 1 2 3 4 5 3 3 8 7 7

    3 4 4 8 8 8 6 7 7 6 104 2 5 4 5 9 7 8 9 10 9

    When using the Gaussian elimination to solve A = b, the nodesneed to be enumerated such that the bandwidth ofAis minimal.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 58

    Computation of the element stiffness matrices

  • 8/13/2019 Lecture1 Cornell

    58/60

    p

    We know thataKij 0 only if bothNi andNj are nodes ofK.

    LetKnTh.

    T(, n),= 1, 2, 3 are the vertices ofKn, whereasZ(i, T(, n)),= 1, 2, 3,i= 1, 2 are thexi coordinates of these vertices.

    The element stiffness matrix A(n) = (an), , = 1,2,3, for ele-mentKnis given as follows:

    an= Kn

    [ +] dx

    whereis the linear function on Kn that takes the following values:

    NT(,n)=

    1 if=0 if= , = 1, 2, 3

    We also compute:bn= Kn

    fdx+ Kn

    gdx, = 1, 2, 3

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 59

    Assembly of global stiffness matrix

  • 8/13/2019 Lecture1 Cornell

    59/60

    y g

    SetA (i, j) = 0, b (i) = 0, i, j = 1, . . . , M .

    Forn= 1, . . . , N ,fetchA(n) =an

    andb(n) = (bn) from scratchfile and for, = 1, 2, 3 set:

    A (T(, n) , T(, n)) =A (T(, n) , T(, n)) +an,

    b (T(, n)) =b (T(, n)) +bn

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory

    N. Zabaras 60

    Solution of the linear system A=b

  • 8/13/2019 Lecture1 Cornell

    60/60

    y

    If Gaussian elimination is to be used, A is stored as a band ma-trix with an arrangement of the node numbering that leads to aminimum bandwidth.

    If an iterative method is used, only the nonzero elements ofAarestored.

    Once the stiffness matrix A for the Newmann problem has beendetermined, we can easily derive the system A=bcorrespondingto any other type of boundary conditions.

    For example, ifu = uo on 1, we can obtain the correspondingsystem A = b by deleting the rows of A corresponding to thenodes on 1 and by entering the values ofgiven by the Dirichletboundary condition.

    Lecture 1: Introduction to FEM for el liptic problems Materials Process Design and Control Laboratory