FINITE ELEMENT ANALYSIS                                                          SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                                                                              ID: 20ME128
Question: Solve the following differential equation by using the finite difference
                                                       1
method(solution) and the finite element method with∆ x= and compare both results with the
                                                       3
exact solutions.
d2 x               d∅
dx 2
     −∅ ( x ) =0 ,
                   dx     ]   x=0
                                    =28 , ∅ (1 ) =0Exact Solution:
            28
∅ ( x) =    2
                ( e x −e 2−x )
           e +1
Improve the accuracy of the above calculation by changing mesh space or shape function.
Answer:
The given equation is
d2 x
     −∅ ( x ) =0 ( 1 )
d x2
                                                       d∅                                                   1
which satisfies the boundary conditions
                                                       dx   ]   x=0
                                                                      =28 , ∅ ( 1 )=0 A mesh spacing ∆ x=
                                                                                                            3
                                                                                                              is chosen
and the solution may then be found by-
    a) Finite Difference Method
    b) Finite Element Method
a) Finite Difference Method:
  i = -1                               i= 0                             i=1                    i=2                        i=3
                              d2 x
Using Taylor Series Expansion      can be expressed in finite difference form-
                              d x2
d 2 x ∅ ( x +∆ x )−2 ∅ ( x ) + ∅ ( x−∆ x )
     =
d x2                ∆ x2
Substituting this value in equation no 1 we get,
1|Page
FINITE ELEMENT ANALYSIS                                                    SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                                                                        ID: 20ME128
∅ ( x +∆ x )−2 ∅ ( x ) + ∅ ( x−∆ x )
                                     −∅ ( x )=0
              ∆ x2
≫ ∅ ( x +∆ x )−2 ∅ ( x ) −∆ x 2 ∅ ( x )+ ∅ ( x−∆ x ) =0(2)
An equation of this form arises at each of the interior grid points xi on the finite difference
mesh. Using this equation for i = -1 , i = 0, i = 1, i = 2, i = 3 and inserting the known boundary
                   d∅
conditions
                   dx   ]   x=0
                                  =28 , ∅ ( 1 )=0 the governing equations are as below-
∅ −1−2 ∅0 −∆ x 2 ∅0 + ∅1=0(3)
∅ 0−2 ∅1−∆ x2 ∅ 1+ ∅ 2=0(4)
∅ 1−2 ∅ 2−∆ x 2 ∅ 2+ ∅ 3=0(5)
Using a central difference representation of the derivative boundary condition at x = 0,
d∅
dx   ]   x=0
               =28 produces ,
∅ 1−∅−1
        =28 ≫ ∅1 −∅−1=56 × ∆ x
  2∆x
                                                           1
And at x = 1, ∅ ( 1 )=∅ 3=0, and putting ∆ x=                in equations (3), (4) and (5) following equations
                                                           3
are formed-
                  56
−∅−1 + ∅1=
                   3
          19
∅ −1−        ∅ + ∅ =0
          9 0 1
       19
∅ 0−      ∅ + ∅ =0
        9 1 2
       19
∅ 1−      ∅ =0
       9 2
Rearranging these equations in matrix form we get-
2|Page
FINITE ELEMENT ANALYSIS            SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                                ID: 20ME128
−1       0     1     0
|                        || || |
                         ∅−1 56
        −19
    1          1     0
         9                    3
                          ∅
              −19       × 0 = 0
    0    1           1    ∅1
               9              0
                    −19   ∅2  0
    0    0     1
                     9
3|Page
FINITE ELEMENT ANALYSIS                                       SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                                                           ID: 20ME128
Solving the above matrix using OCTAVE Program
Octave Code:
∅−1
{ }{ }
      −31.4802
 ∅0   −20.9813
    =
 ∅1   −12.8136
 ∅2   −6.0696
Using a forward difference representation of the derivative boundary condition at x=0,
d∅
dx   ]   x=0
               =28 produces
∅ 1−∅ 0
        =28 ≫ ∅1−∅ 0=28 × ∆ x
  ∆x
                                                1
And at x = 1, ∅ ( 1 )=∅ 3=0, and putting ∆ x=     following equations are formed-
                                                3
                 28
−∅0 + ∅1=
                  3
       19
∅ 0−      ∅ + ∅ =0
        9 1 2
4|Page
FINITE ELEMENT ANALYSIS                              SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                                                  ID: 20ME128
        19
∅ 1−       ∅ =0
        9 2
Rearranging these equations in matrix form we get-
−1        1        0
|                      |||| |
                              28
         −19           ∅0
    1              1           3
          9          × ∅1 =
                               0
                  −19 ∅2
    0     1                    0
                   9
Solving the above matrix using OCTAVE Program
Octave Code:
∅ 0 −23.9755
{}{ }
∅ 1 = −14.6422
∅2    −6.9358
5|Page
FINITE ELEMENT ANALYSIS      SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                          ID: 20ME128
(b) Finite Element Method:
6|Page
FINITE ELEMENT ANALYSIS                    SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                                        ID: 20ME128
Exact Solution:
            28
∅ ( x) =    2
                ( e x −e 2−x )
           e +1
                 28 0 2−0
∅ 0=∅ ( 0 )=          ( e −e ) =−21.3246
                e2 +1
                            1    1
∅ 1=∅
      1
        ()28
        = 2
      3 e +1
                   2−
                        (
             e 3 −e 3 =−13.0132      )
                            2    2
∅ 2=∅   () 2   28
             = 2
           3 e +1
                        (
                        2−
                  e 3 −e 3 =−6.1611  )
7|Page
FINITE ELEMENT ANALYSIS   SAL SAAD AL DEEN TAHER
ASSIGNMENT NO: 1                       ID: 20ME128
8|Page