Fem Matrix Algebra

Embed Size (px)

Citation preview

  • 8/3/2019 Fem Matrix Algebra

    1/41

    The Finite Element Method

    Matrix algebra

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    2/41

    Matrix Algebra

    A matrix is an m x n array of numbers

    arranged in mrows and ncolumns. m = n A square matrix.

    m = 1 A row matrix. n = 1 A column matrix.

    aij Element of matrix a row i, column j

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    3/41

    Matrix Operations

    Multiplication of a matrix by a scalar.

    [a] = k [c] aij = kcij

    Addition of matrices.

    Matrices must be of same order (m x n) Add them term by term

    [c] = [a] +[b] cij

    = aij

    + bij

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    4/41

    Matrix Operation

    Multiplication of two matrices

    If [a] is m x n then [b] must have nrows [c] = [a] [b]

    n

    ij ie ej

    e 1

    c a b

    ==

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    5/41

    Matrix Operations

    Transpose of a matrix:

    Interchange of rows and columns

    If [a] is m x nthen [a]T is n x m

    If [a] = [a]T then [a] is symmetric.

    [a] must be a square matrix

    T

    ij jia a

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    6/41

    Matrix Operations

    The identity matrix (or unit matrix) is

    denoted by the symbol [I]: [a][I] = [I][a] = [a]

    [ ] 1 0 0I 0 1 00 0 1

    =

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    7/41

    Matrix Operations

    The inverse of a matrix is such that:

    [ ][ ] 1a a [I ]=Matrix algebra

    Computational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    8/41

    Matrix Operations

    Differentiating a matrix:

    [ ] ijdad adx dx

    = Matrix algebra

    Computational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    9/41

    Matrix Operations

    Differentiating a matrix:

    11 12

    21 22

    11 12

    21 22

    a a x1U [x y]

    a a2 y

    U

    a a xx

    U a a y

    y

    =

    = Matrix algebra

    Computational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    10/41

    Matrix Operations

    Integrating a matrix:

    ij[a]dx a dx Matrix algebra

    Computational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    11/41

    The Inverse of a Matrix

    Need to find the determinant

    Need to find the co-factors of [a]

    determinant of matrixa [a]

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    12/41

    Cofactors

    Cofactors of [aij] are given by:

    Then :

    [ ]ijwhere matrix d is the first minor

    of a and is matrix a

    with row i and column j deleted.

    i j

    ijC ( 1) d=

    [ ]T1

    ijC[a ]a

    =Matrix algebra

    Computational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    13/41

    Cramers Rule

    [ ]o r i n i n d e x n o t a t i o n :

    L e t m a t r i x b e m a t r i x

    w i t h c o l u m n i r e p a c e d b y .

    T h e n :

    n

    i j j i

    j 1

    ( i )

    ( i )

    i

    a { x } { c }

    a x c

    [ d ] [ a ]

    { c }

    dx

    a

    =

    =

    =

    =

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    14/41

    Example:

    Consider the following equations:

    1 2 3

    1 2 3

    2 3

    x 3x 2x 2

    2x 4x 2x 14x x 3

    + = + =+ =

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    15/41

    Example:

    =

    3

    1

    2

    x

    x

    x

    140

    242

    231

    3

    2

    1

    :ormmatrixIn

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    16/41

    Solving:

    1410

    41

    140

    242

    231

    143

    241

    232

    a

    d

    x

    1

    1 .

    )(

    =

    =

    =

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    17/41

    Solving:

    1.1

    140

    242

    231

    130212

    221

    a

    dx

    )2(

    2 =

    =

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    18/41

    Solving:

    4.1

    140

    242

    231

    340

    142

    231

    a

    d

    x

    )3(

    3

    =

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    19/41

    Inversion

    [ ]{ } { }[ ] [ ]{ } [ ] { }[ ]{ } [ ] { }{ } [ ] { }

    1 1

    1

    1

    a x c

    a a x a c

    I x a c

    x a c

    ==

    ==

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    20/41

    Example

    =

    3

    1

    2

    x

    x

    x

    140

    242

    231

    3

    2

    1

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    21/41

    Example

    =

    =

    41

    11

    14

    3

    1

    2

    204080

    201020

    201121

    x

    x

    x

    3

    2

    1

    .

    .

    .

    ...

    ...

    ...

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    22/41

    Solving:

    41

    140

    242

    231

    340

    142

    231

    a

    d

    x

    3

    3 .

    )(

    =

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    23/41

    Gaussian Elimination

    General System of n equations with n unknowns:

    =

    n

    2

    1

    n

    2

    1

    nn2n1n

    n22221

    n11211

    c

    c

    c

    x

    x

    x

    aaa

    aaa

    aaa

    MM

    K

    MMM

    K

    K

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    24/41

    Steps in Gaussian Elimination

    Eliminate the coefficient of x1 in every

    equation except the first one. Select a11 asthe pivot element. Add the multiple -a21/a11 of the first row to

    the second row. Add the multiple -a31/a11 of the first row to

    the third row.

    Continue this procedure through the nth row

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    25/41

    After this Step:

    =

    n

    2

    1

    n

    2

    1

    nn2n

    n222

    n11211

    c

    c

    c

    x

    x

    x

    aa0

    aa0

    aaa

    MM

    K

    MMM

    K

    K

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    26/41

    Steps in Gaussian Elimination

    Eliminate the coefficient of x2 in every

    equation below the second one. Select a22

    as the pivot element.

    Add the multiple -a 32/

    a 22

    of the second rowto the third row.

    Add the multiple -a 42/a 22 of the second row

    to the fourth row. Continue this procedure through the nth row

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    27/41

    After This Step:

    =

    n

    2

    1

    n

    2

    1

    nn3n

    n333

    n22322

    n1131211

    c

    c

    c

    x

    x

    x

    aa00

    aa00

    aaa0

    aaaa

    MM

    K

    MMMM

    K

    L

    K

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    28/41

    Steps in Gaussian Elimination

    Repeat the process for the remaining

    rows until we have a triangularized systemof equation.

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

    =

    1nn

    4

    3

    2

    1

    n

    4

    3

    2

    1

    1nnn

    n444

    n33433

    n2242322

    n114131211

    c

    c

    c

    cc

    x

    x

    x

    xx

    a0000

    aa000

    aaa00

    aaaa0aaaaa

    MM

    L

    MMMMM

    L

    L

    LL

  • 8/3/2019 Fem Matrix Algebra

    29/41

    Solve Using Back-substitution

    =

    +

    n

    1irrir1n,1

    ii

    i

    1nnn

    1nn

    n

    xaaa

    1x

    a

    cx

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    30/41

    Example

    =

    6

    4

    9

    x

    x

    x

    111

    012

    122

    3

    2

    1

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    31/41

    Solving:

    Eliminate the coefficient of x1 in every

    equation except the first one. Select a11 =2 as the pivot element.

    Add the multiple -a21/a11 = -2/2 = -1 of the firstrow to the second row.

    Add the multiple -a31/a11 = -1/2=-0.5 of the

    first row to the third row.

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    32/41

    Step 1

    5.1

    5

    9

    x

    x

    x

    5.000

    110

    122

    3

    2

    1

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    33/41

    Steps in Gaussian Elimination

    Eliminate the coefficient of x2 in every

    equation below the second one. Select a22

    as the pivot element. (Already done in thisexample.)

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    34/41

    Step 2

    5.1

    5

    9

    x

    x

    x

    5.000

    110

    122

    3

    2

    1

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    35/41

    Solve Using Back-substitution( )( )

    ( )

    ( )1

    2

    3)2(29x

    21

    35x

    3

    21

    23

    a

    cx

    2

    2

    33

    33

    ==

    =+=

    ==

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    36/41

    Gauss-Seidel Iteration

    ( )( )

    ( )1n1n.n22n11nnnn

    n

    nn2323121222

    2

    nn1313212111

    1

    xaxaxaca

    1x

    xaxaxaca

    1

    x

    xaxaxaca

    1

    x

    :forminequationsWrite

    L

    M

    L

    L

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    37/41

    Gauss-Seidel Iteration

    Assume a set of initial values for unknowns.Substitute into RHS of first equation. Solve fornew value of x1

    Use new value of x1and assumed values of

    other xs to solve for x2 in second equation. Continue till new values of all variables are

    obtained.

    Iterate until convergence.

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    38/41

    Example

    1x1x1x2

    1x

    6x2x6xx4x

    5xx4x

    2xx4

    4321

    43

    432

    321

    21

    ====

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

    E l

  • 8/3/2019 Fem Matrix Algebra

    39/41

    Example

    ( ) ( )( ) ( )( ) ( ))( ) ( ) 16.067.1221x221x

    672.1168.164

    1xx64

    1x

    68.114

    354

    1xx54

    1x

    43

    1241

    x241

    x

    34

    423

    312

    21

    =

    ==

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

    E l

  • 8/3/2019 Fem Matrix Algebra

    40/41

    Example

    ( ) ( )( ) ( )( ) ( ))( ) ( ) 28.0.0944.12

    21x2

    21x

    944.116.0899.1641xx641x

    899.1672.1922.054

    1xx54

    1x

    922.068.124

    1x24

    1x

    34

    423

    312

    21

    =

    ==

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method

  • 8/3/2019 Fem Matrix Algebra

    41/41

    Iteration x1 x2 x3 x4

    0 0.5 1.0 1.0 -1.01 0.75 1.68 1.672 -0.16

    2 0.922 1.899 1.944 -0.028

    3 0.975 1.979 1.988 -0.0064 0.988 1.9945 1.9983 -0.0008

    Exact 1.0 2.0 2.0 0.04

    Matrix algebraComputational Mechanics, AAU, EsbjergThe Finite Element Method