numerical methods for pdes fem – implementation: ?· fem – implementation: element stiffness...

Download Numerical methods for PDEs FEM – implementation: ?· FEM – implementation: element stiffness matrix,…

Post on 07-Sep-2018

212 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Platzhalter fr Bild, Bild auf Titelfolie hinter das Logo einsetzen

    Dr. Noemi Friedman

    Numerical methods for PDEs FEM implementation: element stiffness matrix, isoparametric mapping, assembling global stiffness matrix

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 2

    Contents of the course

    Fundamentals of functional analysis Abstract formulation FEM Application to conrete formulations Convergence, regularity Variational crimes Implementation Mixed formulations (e.g. Stokes) Stabilisation for flow problems Error indicators/estimation Adaptivity

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 3

    Implementation

    Piecewise polynomials and the FEM Sparsity of the stiffness matrix Calculating the stiffnes matrix elementwisely Isoparametric mapping Condition number of the stiffness matrix Sparsity of the stiffness matrix Numerical integration

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 4

    1D Example with linear nodal basis

    4

    =1

    ()

    =

    Strong form:

    ()

    /5 /5 /5 0 = = 0

    Weak form:

    0=

    0

    Discretisation of the weak form:

    4

    =1

    ()

    ()

    = ()()

    /5 /5

    Not efficient to calculate all the elements of the stiffness matrix one by one!

    Calculate element stiffness matrices and assemble

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 5

    1D Example with linear nodal basis

    ()

    /5 /5 /5 /5 /5

    instead: Compute stiffness matrix elementwisely and then assemble

    Global stiffness matrix

    1 2 3 4 5 6

    4 =

    1 2 3 4 5 6

    1 2 3 4 5 6

    1 2

    3

    4

    5

    6

    0 2

    3

    4

    5

    0

    =

    4 5 4 5

    4 1,1 = 4()

    4()

    4

    4(1,1) 4(1,2)

    4(2,1) 4(2,2)

    4 5 3 2

    4 1,2 = 4()

    5()

    4

    4 2,1 = 5()

    4()

    4

    4 2,2 = 5()

    5()

    4

    4(1,2) 4(1,1)

    4(2,1) 4(2,2) 5(1,1)

    3(2,2)

    3 1,1 2(2,2)

    2 1,1 1(2,2)

    1

    1

    3(1,2)

    2(1,2)

    3(2,1)

    2(2,1)

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 6

    1D Example with linear nodal basis

    ()

    /5 /5 /5 /5 /5

    instead: Compute stiffness matrix elementwisely and then assemble

    1 2 3 4 5 6

    4 =

    1 2 3 4 5 6

    1 2 3 4 5 6

    1 2

    3

    4

    5

    6

    0 0

    =

    4 5

    4 1 = ()4()

    4

    4 1

    4 2

    4 5 3 2

    4 2 = ()5()

    4

    4(1,2) 4(1,1)

    4(2,1) 4(2,2) 5(1,1)

    3(2,2)

    3 1,1 2(2,2)

    2 1,1 1(2,2)

    1

    1

    3(1,2)

    2(1,2)

    3(2,1)

    2(2,1)

    4 1

    4 2

    2 1

    1 2

    3 1

    2 2

    3 2

    5 1

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 7

    Local/global coordinate system 1D

    4 , = ()

    ()

    4=

    4 2

    ()

    ()

    4

    = [0,1]

    1

    1

    4 , = 2

    ()

    ()

    ()

    1

    0=

    ()

    ()

    1

    0

    Idea: coordinate transformation to have unit length elements element stiffnes matrix is the same for each element

    = 1

    4 , = 4()

    5()

    4

    , [1,2] , [4,5]

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 8

    Local/global coordinate system 1D

    4 =

    ()4()

    4

    ()5()

    4

    = ()()()

    1

    0=

    1 ()()

    1

    0

    [1,2]

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 9

    Local/ coordinate system, isoparametric mapping 1D

    coordinate transformation using the ansatzfunctions isoparametric mapping

    functions of lower order: subparametric functions of higher order: superparametric

    = 1 + +12 = 1 2 +1

    local coordinate

    global coordinate

    = 0 = 1

    2

    Shape functions:

    Transformation from local to global coordinates:

    Stiffness matrix with isoparametric elements:

    = [0,1]

    1 = 1

    2 =

    4 , = ()

    ()

    = ()

    ()

    4

    4

    , [1,2] , [4,5]

    4 , = ()

    1 ()

    1 ()

    1

    0

    =

    1 + +1

    2

    =

    1

    2

    +1

    1

    1

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 10

    Isoparametric linear mapping 2D triangular elements

    Basis functions:

    Transformation from local to global coordinates:

    Stiffness matrix:

    1

    , [1,2,3]

    , ,

    = 1 , 2 , 1 , 3 ,

    2 , 3 ,

    112233

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 11

    Isoparametric linear mapping 2D triangular elements

    Stiffness matrix:

    Stiffness matrix with local coordinates:

    where:

    substitution rule determinant should not be negative or zero!

    =

    ,

    3

    =1

    ,

    3

    =1

    ,

    3

    =1

    ,

    3

    =1

    , [1,2,3]

    , [1,2,3] =

    1

    0

    1

    0

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 12

    Isoparametric linear mapping 2D triangular elements, example

    , , =

    1 1

    237197

    Transformation from local to global coordinates (isoparametric mapping):

    , ,

    = 1 , 2 , 1 , 3 ,

    2 , 3 ,

    112233

    1 2

    3

    4

    5 6

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 13

    Local/ coordinate system, isoparametric mapping 2D triangular elements, example

    Stiffness matrix with local coordinates:

    , [1,2,3] =

    1

    0

    1

    0

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 14

    Local/ coordinate system, isoparametric mapping 2D triangular elements, example

    = = = 34 =

    =

    =

    134

    4 27 5

    1

    0

    1

    0

    134

    4 27 5

    34

    21 = 134

    4 27 5

    11

    10

    10

    134

    4 27 5

    10 34 ==

    134

    62

    11

    10

    47

    21 ==1.118 10

    10 = 1.118

    12

    = 0.559

    =

    1

    0

    1

    0

    11 12 13

    21 22 23 13 23 33

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 15

    Local/ coordinate system, isoparametric mapping 2D triangular elements, example

    = = 34 11 12 13

    21 22 23 13 23 33

    =

    ()1(,)

    ()2(, )

    ()3(, )

    =

    ()1(, ) 1

    0

    1

    0

    ()2(, ) 1

    0

    1

    0

    ()3(, ) 1

    0

    1

    0

    1

    2

    3

    1

    2

    3

    =

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 16

    Local/ coordinate system, isoparametric mapping 2D triangular elements, example

    11 12 13

    21 22 23 31 32 33

    1

    2

    3

    1

    2

    3

    =

    1 2

    3

    4

    5

    local 1 2 3 global 4 3 6

    6

    22 21 23

    12 11 13

    32 31 33

    1

    2

    3

    4

    5

    6

    2

    1

    3

    4 3 6

    1

    2

    3

    4

    5

    6

    1

    2

    3

    1 2 3 4 5 6 =

    4

    3

    6

  • Implementation | Dr. Noemi Friedman | PDE2 tutorial | Seite 17

    Condition number of the stiffness matrix [Chapter 4.4.1]

    Condition number

    What happens with the roundoff errors in = = +

    = + = +

    = ()

    Condition number of with nodal bases with 2D triangular mesh: For the Poisson equation

    =1

    ()

    =

    turns il-conditioned for refined mesh!!!

    Numerical methods for PDEsFEM implementation: element stiffness matrix, isoparametric mapping, assembling global stiffness matrixContents of the courseImplementation1D Example with linear nodal basis1D Example with linear nodal basis1D Example with linear nodal basisLocal/global coordinate system 1DLocal/global coordinate system 1DLocal/ coordinate system, isoparametric mapping 1DIsoparametric linear mapping 2Dtriangular elementsIsoparametric linear mapping 2Dtriangular elementsIsoparametric linear mapping 2Dtriangular elements, exampleLocal/ coordinate system, isoparametric mapping 2Dtriangular elements, exampleLocal/ coordinate system, isoparametric mapping 2Dtriangular elements, exampleLocal/ coordinate system, isoparametric mapping 2Dtriangular elements, exampleLocal/ coordinate system, isoparametric mapping 2Dtriangular elements, exampleCondition number of the stiffness matrix