Transcript
  • 1

    METU Mechanical Engineering Department ME 582 Finite Element Analysis in Thermofluids

    Spring 2018 (Dr. Sert) Handout 3 – Examples of Chapter 2

    Example 2.1:

    We’ll solve the following advection diffusion equation

    π‘’π‘‘πœ™

    𝑑π‘₯βˆ’ 𝛼

    𝑑2πœ™

    𝑑π‘₯2= 𝑓 over 0 ≀ π‘₯ ≀ 1

    with 𝑒 = 3, 𝛼 = 1, 𝑓 = 1. The DE is supported by the following EBCs

    𝑇(0) = 0 , 𝑇(1) = 0

    Let’s use Galerkin FEM on a mesh of 5 equal-sized elements as shown below

    Elemental stiffness matrices can be evaluated using the following equation as derived previously

    𝐾𝑖𝑗𝑒 = ∫ ( 𝑆𝑖

    𝑒 𝑒 𝑑𝑆𝑗

    𝑒

    π‘‘πœ‰ 1

    𝐽𝑒+ 𝛼

    𝑑𝑆𝑖𝑒

    π‘‘πœ‰ 1

    𝐽𝑒 𝑑𝑆𝑗

    𝑒

    π‘‘πœ‰ 1

    𝐽𝑒) 𝐽𝑒 π‘‘πœ‰

    1

    βˆ’1

    Each element has the length of β„Žπ‘’ = 0.2 and has the same Jacobian 𝐽𝑒 = β„Žπ‘’/2 = 0.1. 𝑒 and 𝛼 are

    given as constants. Therefore [𝐾𝑒] will be the same for all elements. Using previously derived shape

    functions of

    𝑆1𝑒 =

    1

    2(1 βˆ’ πœ‰) , 𝑆2

    𝑒 =1

    2(1 + πœ‰)

    and their derivatives

    𝑑𝑆1𝑒

    π‘‘πœ‰= βˆ’

    1

    2 ,

    𝑑𝑆2𝑒

    π‘‘πœ‰=1

    2

    entries of the 2x2 [𝐾𝑒] matrix can be calculated as follows (no need to use GQ integration here. As an

    exercise you can try to evaluate the integrals using for example 2 point GQ)

    𝐾11𝑒 = ∫ [

    1

    2(1 βˆ’ πœ‰)(3) (βˆ’

    1

    2) (

    1

    0.1) + (1) (βˆ’

    1

    2) (

    1

    0.1) (βˆ’

    1

    2) (

    1

    0.1)] (0.1) π‘‘πœ‰

    1

    βˆ’1

    = 3.5

    e=1

    x

    e=2 e=3 e=4 e=5

    1 2 3 4 5 6

  • 2

    𝐾12𝑒 = ∫ [

    1

    2(1 βˆ’ πœ‰)(3) (

    1

    2) (

    1

    0.1) + (1) (βˆ’

    1

    2) (

    1

    0.1) (1

    2) (

    1

    0.1)] (0.1) π‘‘πœ‰

    1

    βˆ’1

    = βˆ’3.5

    𝐾21𝑒 = ∫ [

    1

    2(1 + πœ‰)(3) (βˆ’

    1

    2) (

    1

    0.1) + (1) (

    1

    2) (

    1

    0.1) (βˆ’

    1

    2) (

    1

    0.1)] (0.1) π‘‘πœ‰

    1

    βˆ’1

    = βˆ’6.5

    𝐾22𝑒 = ∫ [

    1

    2(1 + πœ‰)(3) (

    1

    2) (

    1

    0.1) + (1) (

    1

    2) (

    1

    0.1) (1

    2) (

    1

    0.1)] (0.1) π‘‘πœ‰

    1

    βˆ’1

    = 6.5

    Therefore, for all elements

    𝐾𝑒 = [3.5 βˆ’3.5βˆ’6.5 6.5

    ]

    Entries of the elemental force vector are given by

    𝐹𝑖𝑒 = ∫ 𝑆𝑖

    𝑒 𝑓 𝐽𝑒 π‘‘πœ‰

    1

    βˆ’1

    Function 𝑓 is constant and the same for each element. Therefore, elemental force vectors will also be

    the same for all elements. Their components can be evaluated as

    𝐹1𝑒 = ∫

    1

    2(1 βˆ’ πœ‰) (1) (0.1) π‘‘πœ‰

    1

    βˆ’1

    = 0.1

    𝐹2𝑒 = ∫

    1

    2(1 + πœ‰) (1) (0.1) π‘‘πœ‰

    1

    βˆ’1

    = 0.1

    Combining these two entries we get

    𝐹𝑒 = {0.10.1}

    Local to global mapping of the mesh is given by

    πΏπ‘‘π‘œπΊ =

    [ 1 22 33 44 55 6]

    Using the assembly rule, following 6x6 global system can be assembled

    [ 3.5 βˆ’3.5 0 0 0 0βˆ’6.5 6.5 + 3.5 βˆ’3.5 0 0 00 βˆ’6.5 6.5 + 3.5 βˆ’3.5 0 00 0 βˆ’6.5 6.5 + 3.5 βˆ’3.5 00 0 0 βˆ’6.5 6.5 + 3.5 βˆ’3.50 0 0 0 βˆ’6.5 6.5 ]

    {

    πœ™1πœ™2πœ™3πœ™4πœ™5πœ™6}

    =

    {

    0.10.1 + 0.10.1 + 0.10.1 + 0.10.1 + 0.10.1 }

    +

    {

    𝐡10000𝐡6}

  • 3

    Due to the EBCs provided at π‘₯ = 0 and π‘₯ = 1, πœ™1 and πœ™6 are actually known and we can perform

    reduction as explained in the previous section to remove the first and last equation resulting in the

    following 4x4 system.

    [

    10 βˆ’3.5 0 0βˆ’6.5 10 βˆ’3.5 00 βˆ’6.5 10 βˆ’3.50 0 βˆ’6.5 10

    ]{

    πœ™2πœ™3πœ™4πœ™5

    } = {

    0.20.20.20.2

    }

    Note that the reduction of the system did not result any change in the right hand side vector, because

    of the special zero EBCs. Solving this system, we get the following nodal unknowns as

    {

    πœ™2πœ™3πœ™4πœ™5

    } = {

    0.05310.09460.11460.0945

    }

    Exact solution can be found using MATLAB as follows.

    dsolve('3*Dy-D2y=1', 'y(0)=0', 'y(1)=0')

    which can be simplified using MATLAB’s simplify command to get

    πœ™π‘’π‘₯π‘Žπ‘π‘‘ = βˆ’π‘’3π‘₯ βˆ’ π‘₯𝑒3 + π‘₯ βˆ’ 1

    3(𝑒3 βˆ’ 1)

    Comparison of FEM and exact solutions is given below. Except the boundary nodes, nodal values are

    not exact, but they are close to the exact solution.

  • 4

    Example 2.2:

    Remember that one disadvantage of variational solutions we performed in the previous chapter was

    the dependency of approximation function selection on the boundary conditions. To appreciate that

    this is not the case for FEM, let’s solve the previous problem with the following different EBCs

    πœ™(0) = 1 , πœ™(1) = 10

    Change in BCs will not bring any change to the elemental system calculation or to the assembly process.

    Therefore, the same 6x6 global system, given below, will be obtained.

    [ 3.5 βˆ’3.5 0 0 0 0βˆ’6.5 10 βˆ’3.5 0 0 00 βˆ’6.5 10 βˆ’3.5 0 00 0 βˆ’6.5 10 βˆ’3.5 00 0 0 βˆ’6.5 10 βˆ’3.50 0 0 0 βˆ’6.5 6.5 ]

    {

    πœ™1πœ™2πœ™3πœ™4πœ™5πœ™6}

    =

    {

    0.10.20.20.20.20.1}

    +

    {

    𝐡10000𝐡6}

    πœ™1 and πœ™6 are known. Therefore, let’s reduce the system to a 4x4 system by deleting the first and the

    last rows and columns. In the meantime, the right hand side vector will also change.

    [

    10 βˆ’3.5 0 0βˆ’6.5 10 βˆ’3.5 00 βˆ’6.5 10 βˆ’3.50 0 βˆ’6.5 10

    ]{

    πœ™2πœ™3πœ™4πœ™5

    } = {

    0.2 βˆ’ (βˆ’6.5)(1)0.20.2

    0.2 βˆ’ (βˆ’3.5)(10)

    }

    The solution is

    {

    πœ™2πœ™3πœ™4πœ™5

    } = {

    1.41892.13963.42115.7437

    }

    Comparison of FEM and exact solutions is as follows.

  • 5

    Example 2.3:

    To experiment with NBCs, let’s solve the same problem with the following BCs

    πœ™(0) = 0 , π‘‘πœ™

    𝑑π‘₯|π‘₯=1

    = βˆ’1

    The 6x6 global system is again the same as before. Reduction will be applied for the EBC. After deleting

    the first row and the first column we’ll be left with the following 5x5 system

    [ 10 βˆ’3.5 0 0 0βˆ’6.5 10 βˆ’3.5 0 00 βˆ’6.5 10 βˆ’3.5 00 0 βˆ’6.5 10 βˆ’3.50 0 0 βˆ’6.5 6.5 ]

    {

    πœ™2πœ™3πœ™4πœ™5πœ™6}

    =

    {

    0.20.20.20.20.1}

    +

    {

    0000𝐡6}

    First derivative is given at π‘₯ = 1. This is related to 𝐡6 of the last equation.

    𝐡6 = (𝑆𝑉)π‘₯=1 = (π›Όπ‘‘πœ™

    𝑑π‘₯𝑛π‘₯)

    π‘₯=1= βˆ’1

    Warning: Do not include the effect of 𝛼 and 𝑛π‘₯ . In this case they are both equal to one, but in general

    this is not the case.

    Use this 𝐡6 value in the reduced global system and solve it to get

    Now this is a solvable system with 5 equations and 5 unknowns. The solution gives the following nodal

    values

    {

    πœ™2πœ™3πœ™4πœ™5πœ™6}

    =

    {

    0.04940.08410.09130.0475βˆ’0.0910}

    FEM solution is very close to the exact one. At the right boundary, where NBC is specified, the value of

    πœ™6 is not exact, athough it looks so on the graph. The exact value at the right boundary is -0.089, but

    we calculated it to be -0.091. As a general rule, unknown nodal values at the NBC boundaries cannot

    be calculated as exact.

  • 6

    Example 2.4:

    To experiment with MBCs, let’s solve the same problem with the following BCs

    (πœ™ + 2π‘‘πœ™

    𝑑π‘₯)|π‘₯=0

    = 5 , πœ™(1) = βˆ’10

    The 6x6 global system is the same as before. We apply reduction for the EBC given at π‘₯ = 1 to get the

    following 5x5 reduced system.

    [ 3.5 βˆ’3.5 0 0 0βˆ’6.5 10 βˆ’3.5 0 00 βˆ’6.5 10 βˆ’3.5 00 0 βˆ’6.5 10 βˆ’3.50 0 0 βˆ’6.5 10 ]

    {

    πœ™1πœ™2πœ™3πœ™4πœ™5}

    =

    {

    0.10.20.20.2

    0.2 βˆ’ (βˆ’3.5)(βˆ’10)}

    +

    {

    𝐡10000 }

    SV at the first node is

    𝐡1 = (𝑆𝑉)1 = (π›Όπ‘‘πœ™

    𝑑π‘₯𝑛π‘₯)

    π‘₯=0= (βˆ’

    π‘‘πœ™

    𝑑π‘₯)π‘₯=0

    Let’s write the given MBC in the standard 𝑆𝑉 = 𝛽 𝑃𝑉 + 𝛾 form

    𝐡1 = 0.5πœ™1 βˆ’ 2.5

    And use it in the right hand side of the global system

    [ 3.5 βˆ’3.5 0 0 0βˆ’6.5 10 βˆ’3.5 0 00 βˆ’6.5 10 βˆ’3.5 00 0 βˆ’6.5 10 βˆ’3.50 0 0 βˆ’6.5 10 ]

    {

    πœ™1πœ™2πœ™3πœ™4πœ™5}

    =

    {

    0.10.20.20.2βˆ’34.8}

    +

    {

    0.5πœ™1 βˆ’ 2.5

    0000 }

    Transfer 0.5πœ™1 from the right hand side to the left hand side

    [ 3.5 βˆ’ 0.5 βˆ’3.5 0 0 0βˆ’6.5 10 βˆ’3.5 0 00 βˆ’6.5 10 βˆ’3.5 00 0 βˆ’6.5 10 βˆ’3.50 0 0 βˆ’6.5 10 ]

    {

    πœ™1πœ™2πœ™3πœ™4πœ™5}

    =

    {

    βˆ’2.40.20.20.2βˆ’34.8}

    And solve this system to get

    {

    πœ™2πœ™3πœ™4πœ™5πœ™6}

    =

    {

    10.16449.39817.91775.1113βˆ’0.1576}

    Comparison of exact and approximate solutions is given below. As seen clearly, at the MBC boundary

    FEM solution deviates from the exact solution. More elements are required for a better solution.

  • 7

    Example 2.5:

    Let’s solve Example 2.3 again using the following mesh of 2 equi-sized quadratic elements.

    Elemental stiffness matrices can be evaluated using the same equation that we used previously for

    linear elements

    𝐾𝑖𝑗𝑒 = ∫ ( 𝑆𝑖

    𝑒 𝑒 𝑑𝑆𝑗

    𝑒

    π‘‘πœ‰ 1

    𝐽𝑒+ 𝛼

    𝑑𝑆𝑖𝑒

    π‘‘πœ‰ 1

    𝐽𝑒 𝑑𝑆𝑗

    𝑒

    π‘‘πœ‰ 1

    𝐽𝑒) 𝐽𝑒 π‘‘πœ‰

    1

    βˆ’1

    Both elements has a length of β„Žπ‘’ = 0.5 and a Jacobian of 𝐽𝑒 = β„Žπ‘’/2 = 1/4. Similar to the previous

    solution [𝐾𝑒] will be the same for both elements. Using the shape functions of quadratic elements,

    entries of the 3x3 [𝐾𝑒] can be calculated as

    𝐾11𝑒 = ∫ (

    1

    2πœ‰(πœ‰ βˆ’ 1)(3) (

    1

    2(2πœ‰ βˆ’ 1)) (4) + (1) (

    1

    2(2πœ‰ βˆ’ 1)) (4) (

    1

    2(2πœ‰ βˆ’ 1)) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    =19

    6

    𝐾12𝑒 = ∫ (

    1

    2πœ‰(πœ‰ βˆ’ 1)(3)(βˆ’2πœ‰) (4) + (1) (

    1

    2(2πœ‰ βˆ’ 1)) (4)(βˆ’2πœ‰) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    = βˆ’10

    3

    𝐾13𝑒 = ∫ (

    1

    2πœ‰(πœ‰ βˆ’ 1)(3) (

    1

    2(2πœ‰ + 1)) (4) + (1) (

    1

    2(2πœ‰ βˆ’ 1)) (4) (

    1

    2(2πœ‰ + 1)) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    =1

    6

    e=1

    π‘₯

    e=2

    1 2 3 4 5

  • 8

    𝐾21𝑒 = ∫ ((1 βˆ’ πœ‰2)(3) (

    1

    2(2πœ‰ βˆ’ 1)) (4) + (1) (βˆ’2πœ‰) (4) (

    1

    2(2πœ‰ βˆ’ 1)) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    = βˆ’22

    3

    𝐾22𝑒 = ∫((1 βˆ’ πœ‰2)(3)(βˆ’2πœ‰) (4) + (1) (βˆ’2πœ‰) (4)(βˆ’2πœ‰) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    =32

    3

    𝐾23𝑒 = ∫ ((1 βˆ’ πœ‰2)(3) (

    1

    2(2πœ‰ + 1)) (4) + (1) (βˆ’2πœ‰) (4) (

    1

    2(2πœ‰ + 1)) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    = βˆ’10

    3

    𝐾31𝑒 = ∫ (

    1

    2πœ‰(πœ‰ + 1)(3) (

    1

    2(2πœ‰ βˆ’ 1)) (4) + (1) (

    1

    2(2πœ‰ + 1)) (4) (

    1

    2(2πœ‰ βˆ’ 1)) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    =7

    6

    𝐾32𝑒 = ∫ (

    1

    2πœ‰(πœ‰ + 1)(3)(βˆ’2πœ‰) (4) + (1) (

    1

    2(2πœ‰ + 1)) (4)(βˆ’2πœ‰) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    = βˆ’22

    3

    𝐾33𝑒 = ∫ (

    1

    2πœ‰(πœ‰ + 1)(3) (

    1

    2(2πœ‰ + 1)) (4) + (1) (

    1

    2(2πœ‰ + 1)) (4) (

    1

    2(2πœ‰ + 1)) (4)) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    =37

    6

    Therefore, for both elements

    𝐾𝑒 = [

    19/6 βˆ’10/3 1/6βˆ’22/3 32/3 βˆ’10/37/6 βˆ’22/3 37/6

    ]

    Remembering the following general form of the elemental force vector

    𝐹𝑖𝑒 = ∫ 𝑆𝑖

    𝑒 𝑓 𝐽𝑒 π‘‘πœ‰

    1

    βˆ’1

    and noticing that the source function 𝑓 is constant and the same for each element, elemental force

    vectors will also be the same for both elements. Its entries can be evaluated as

    𝐹1𝑒 = ∫

    1

    2πœ‰(πœ‰ βˆ’ 1) (1) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    = 1

    12

    𝐹2𝑒 = ∫(1 βˆ’ πœ‰2) (1) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    = 1

    3

    𝐹3𝑒 = ∫

    1

    2πœ‰(πœ‰ + 1) (1) (

    1

    4) π‘‘πœ‰

    1

    βˆ’1

    = 1

    12

    Combining these three entries we get

    𝐹𝑒 = {

    1/121/31/12

    }

  • 9

    Local to global mapping of the mesh is πΏπ‘‘π‘œπΊ = [1 2 33 4 5

    ]

    Using the assembly rule, global system can be obtained as

    [ 19

    6 βˆ’

    10

    3

    1

    6 0 0

    βˆ’22

    3

    32

    3 βˆ’

    10

    3 0 0

    7

    6 βˆ’

    22

    3 37

    6+19

    6 βˆ’

    10

    3

    1

    6

    0 0 βˆ’22

    3

    32

    3 βˆ’

    10

    3

    0 0 7

    6 βˆ’

    22

    3

    37

    6 ]

    {

    𝑇1 𝑇2 𝑇3 𝑇4 𝑇5}

    =

    {

    1

    121

    31

    12+1

    121

    31

    12 }

    +

    {

    𝐡1 0 0 0 𝐡5}

    πœ™1 = 0 is given as an EBC. Applying reduction for the first equation and using 𝐡5 = βˆ’1 we are left with

    the following 4x4 system

    [ 32

    3 βˆ’

    10

    3 0 0

    βˆ’22

    3

    56

    6 βˆ’

    10

    3

    1

    6

    0 βˆ’22

    3

    32

    3 βˆ’

    10

    3

    0 7

    6 βˆ’

    22

    3

    37

    6 ]

    {

    πœ™2 πœ™3 πœ™4 πœ™5}

    =

    {

    13⁄

    16⁄

    13⁄

    112⁄ }

    +

    {

    0 0 0 βˆ’1}

    Solving this system we get {

    πœ™2πœ™3πœ™4πœ™5

    } = {

    0.05910.08900.0648βˆ’0.0884

    }

    The following figure compares the GFEM solution with the approximate solution. The solution

    obtained in Example 2.3 with 5 linear elements is also given. As seen, the linear solution with 5

    elements and the quadratic solution with 2 elements provide a comparable performance.

    0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-0.1

    -0.05

    0

    0.05

    0.1

    x

    T

    Comparison of Linear and Quadratic GFEM Solutions

    Exact

    Linear GFEM

    Quadratic GFEM

  • 10

    Example 2.6:

    Let’s work on a different, more physical problem, which has a different DE. Consider the following steady, heat transfer problem in a 1D fin with constant circular cross-section. π‘‡βˆž = 25 ℃ , β„Ž = 100 W/m

    2K π‘˜ = 140 W/mK 𝐷 = 0.1 m (fin diameter) 𝐿 = 1 m (fin length) At π‘₯ = 0 𝑇 = 100 ℃

    At π‘₯ = 𝐿 π‘˜π΄π‘ (𝑑𝑇

    𝑑π‘₯) + β„Žπ΄π‘(𝑇 βˆ’ π‘‡βˆž) = 0

    The governing DE is

    βˆ’π‘‘

    𝑑π‘₯(π‘˜π΄π‘

    𝑑𝑇

    𝑑π‘₯) + β„Žπ‘ƒ(𝑇 βˆ’ π‘‡βˆž) = 0

    where 𝐴𝑐 = πœ‹π·

    2/4 is the cross-sectional area and 𝑃 = πœ‹π· is the perimeter of the fin. Warning: π‘˜π΄π‘ is constant. We can divide the whole equation by π‘˜π΄π‘, but we prefer not to this because if we keep the equation in the given form, the secondary variable will have a more physical meaning, i.e. amount of heat passing through the boundary. Also studying the ODE in this form is better because it can be extended to cases where π‘˜ and/or 𝐴𝑐 is not constant, as we’ll see in the next example. Note that the minus sign in front of the first term is there for a purpose. It’ll disappear after integration by parts. Let’s obtain the temperature distribution 𝑇(π‘₯) on the fin using GFEM using a mesh of 4 linear elements of the same length. Compared to the previous examples, now the DE is not the advection-diffusion equation. We need to obtain its weak form.

    Residual: 𝑅(π‘₯) = βˆ’π‘‘

    𝑑π‘₯(π‘˜π΄π‘

    𝑑𝑇

    𝑑π‘₯) + β„Žπ‘ƒ(𝑇 βˆ’ π‘‡βˆž)

    Weighted integral statement: βˆ«π‘€π‘… 𝑑π‘₯

    Ξ©

    = ∫ [βˆ’π‘€π‘‘

    𝑑π‘₯(π‘˜π΄π‘

    𝑑𝑇

    𝑑π‘₯) + π‘€β„Žπ‘ƒ(𝑇 βˆ’ π‘‡βˆž)] 𝑑π‘₯

    Ξ©

    = 0

    Apply int. by parts: ∫ [π‘˜π΄π‘π‘‘π‘€

    𝑑π‘₯

    𝑑𝑇

    𝑑π‘₯+ β„Žπ‘ƒπ‘€π‘‡] 𝑑π‘₯

    Ξ©

    = βˆ«π‘€β„Žπ‘ƒπ‘‡βˆž 𝑑π‘₯

    Ξ©

    + (𝑀 𝑆𝑉)0 + (𝑀 𝑆𝑉)𝐿

    where the secondary variable is the following term, which is conductive heat transfer rate in Watts.

    𝑆𝑉 = π‘˜π΄π‘π‘‘π‘‡

    𝑑π‘₯𝑛π‘₯

    Primary variable of the problem is the temperature, 𝑇. We wrote the π‘‡βˆž term on the right hand side because it is known. We can get 𝐾𝑖𝑗

    𝑒 and 𝐹𝑖𝑒 entries of the elemental system by replacing the unknown

    𝑇 with 𝑆𝑗 and the weight function 𝑀 with 𝑆𝑖.

    𝐾𝑖𝑗𝑒 = ∫ [π‘˜π΄π‘

    𝑑𝑆𝑖𝑑π‘₯

    𝑑𝑆𝑗

    𝑑π‘₯+ β„Žπ‘ƒπ‘†π‘–π‘†π‘—] 𝑑π‘₯

    Ξ©e

    , 𝐹𝑖𝑒 = ∫ π‘†π‘–β„Žπ‘ƒπ‘‡βˆž 𝑑π‘₯

    Ξ©e

    π‘₯

  • 11

    To be able to use the master element and the shape functions defined using the πœ‰ coordinate, let’s change the variable of integration from π‘₯ to πœ‰.

    𝐾𝑖𝑗𝑒 = ∫ (π‘˜π΄π‘

    𝑑𝑆𝑖𝑒

    π‘‘πœ‰

    1

    𝐽𝑒 𝑑𝑆𝑗

    𝑒

    π‘‘πœ‰

    1

    𝐽𝑒+ β„Žπ‘ƒπ‘†π‘–

    𝑒𝑆𝑗𝑒) π½π‘’π‘‘πœ‰

    1

    βˆ’1

    , 𝐹𝑖𝑒 = ∫ π‘†π‘–β„Žπ‘ƒπ‘‡βˆž 𝐽

    π‘’π‘‘πœ‰1

    βˆ’1

    where the shape functions are now functions of πœ‰ and 𝐽𝑒 = β„Žπ‘’/2 is the Jacobian of element 𝑒. To get

    this form,

    we converted each 𝑑𝑆𝑒

    𝑑π‘₯ to

    𝑑𝑆𝑒

    π‘‘πœ‰

    1

    𝐽𝑒, i.e. we included an extra

    1

    𝐽𝑒,

    we changed the integral limits to [-1,1],

    we changed the last 𝑑π‘₯ to π½π‘’π‘‘πœ‰.

    π‘˜, β„Ž, 𝐴𝑐 and 𝑃 are the same for all elements. Also element lengths and therefore 𝐽𝑒’s are the same for

    all elements. It means that [𝐾𝑒]’s and {𝐹𝑒}’s are the same for all elements. Substituting the shape function details and other numerical values, we can calculate (using GQ integration or not) the following

    [𝐾𝑒] = [7.0162 βˆ’3.0892βˆ’3.0892 7.0162

    ] , {𝐹𝑒} = {98.174898.1748

    }

    Important: As seen, [𝐾𝑒] is symmetric. Actually it can be seen from the 𝐾𝑖𝑗

    𝑒 equation. As we

    interchange the indices 𝑖 and 𝑗, nothing changes in the integrand. In earlier examples, there was no such symmetry because of the existence of the first derivative term in the DE. Assembled 5x5 system is

    [ 7.0162 βˆ’3.0892 0 0 0βˆ’3.0892 14.0324 βˆ’3.0892 0 0

    0 βˆ’3.0892 14.0324 βˆ’3.0892 00 0 βˆ’3.0892 14.0324 βˆ’3.08920 0 0 βˆ’3.0892 7.0162 ]

    {

    𝑇1𝑇2𝑇3𝑇4𝑇5}

    =

    {

    98.1748196.3495196.3495196.349598.1748 }

    +

    {

    𝐡1000𝐡5}

    𝑇1 is given as 100

    oC. Apply reduction for this and get rid of the first equation.

    [

    14.0324 βˆ’3.0892 0 0βˆ’3.0892 14.0324 βˆ’3.0892 0

    0 βˆ’3.0892 14.0324 βˆ’3.08920 0 βˆ’3.0892 7.0162

    ]{

    𝑇2𝑇3𝑇4𝑇5

    } = {

    196.3495196.3495196.349598.1748

    } + {

    0 βˆ’ (βˆ’3.0892)(100)00𝐡5

    }

    MBC is provided at the last node as

    𝐡5 = (π‘˜π΄π‘π‘‘π‘‡

    𝑑π‘₯𝑛π‘₯)

    𝐿= π‘˜π΄π‘

    𝑑𝑇

    𝑑π‘₯|𝐿= βˆ’β„Žπ΄π‘(𝑇5 βˆ’ π‘‡βˆž)

    Put this in the standard form of

    𝐡5 = (𝑆𝑉)5 = 𝛽𝑇5 + 𝛾 where 𝛽 = βˆ’β„Žπ΄π‘ = βˆ’0.7854 and 𝛾 = β„Žπ΄π‘π‘‡βˆž = 19.6350. Use these in the reduced system

  • 12

    [

    14.0324 βˆ’3.0892 0 0βˆ’3.0892 14.0324 βˆ’3.0892 0

    0 βˆ’3.0892 14.0324 βˆ’3.08920 0 βˆ’3.0892 7.0162 + 0.7854

    ]{

    𝑇2𝑇3𝑇4𝑇5

    } = {

    196.3495196.3495196.349598.1748

    } + {

    308.9200

    19.6350

    }

    Solving this system, we get

    {

    𝑇2𝑇3𝑇4𝑇5

    } = {

    42.401929.045825.975725.3864

    } ℃

    Comparison of the known exact solution and the FEM solution is as follows.

    As a post processing calculation the amount of heat that goes through the fin base (π‘₯ = 0), which is

    important in evaluating the fin’s performance, can be calculated. The value we want is given by

    π‘„π‘π‘Žπ‘ π‘’ = (π‘˜π΄π‘π‘‘πœƒ

    𝑑π‘₯𝑛π‘₯)

    π‘₯=0

    where 𝑛π‘₯ = βˆ’1 at the left boundary of the domain. π‘„π‘π‘Žπ‘ π‘’ is nothing but the SV at node 1, i.e. 𝐡1. It

    can be calculated in two different ways. First one is to use the first equation of the original 5x5 system

    that we had before reduction. Substituting the already calculated temperature values we can obtain

    𝐡1.

    π‘„π‘π‘Žπ‘ π‘’ = 𝐡1 = (7.0162)(100) + (βˆ’3.0892)(42.4019) = 570.6 W

    In an alternative way we can use the calculated nodal temperatures to determine the slope of

    temperature at the fin base and use it to calculate π‘„π‘π‘Žπ‘ π‘’. Over the first element the temperature varies

    linearly as seen above and the slope of this linear variation is

    𝑑𝑇

    𝑑π‘₯|π‘₯=0

    = 𝑇2 βˆ’ 𝑇1β„Žπ‘’

    =42.4019 βˆ’ 100

    0.25= βˆ’230.4 K/m

    Multiplying this slope with π‘˜π΄π‘π‘›π‘₯ will give the required π‘„π‘π‘Žπ‘ π‘’

    π‘„π‘π‘Žπ‘ π‘’ = (π‘˜π΄π‘π‘‘π‘‡

    𝑑π‘₯𝑛π‘₯)

    π‘₯=0= (140) (

    πœ‹ 0.12

    4)(βˆ’230.4)(βˆ’1) = 253.3 W

  • 13

    Important: The two values calculated are quite different. The reason of this is the extra derivative

    approximation involved in the second approach. Differentiation is always a risky operation that

    amplifies the already existing errors. Here, the calculated temperature values already have some error

    in them, and these errors amplify when we approximate the first derivative at the fin base. Although

    the first approach gives a better estimate (exact value of π‘„π‘π‘Žπ‘ π‘’ is 440.8 W), the second approach is

    usually used in an FEM code due to practical reasons. As expected, as the mesh is refined, the values

    estimated by the two approaches converge to the same value, which is the exact value. This can be

    seen below

    𝑡𝑬 𝑸𝒃𝒂𝒔𝒆 calculated with the second approach (W)

    4 253.3

    10 344.6

    100 429.3

    1000 439.6

    π‘„π‘π‘Žπ‘ π‘’ is positive, meaning that heat is coming into the domain at the base of the fin. Because we

    included 𝑛π‘₯ in the SV definition, regardless of which boundary we calculate 𝑄 at (fin base or fin tip), a

    positive value means β€œheat is coming in”, and a negative value means β€œheat is going out”.

    Example 2.7:

    Let’s modify the previous fin problem a bit, by making the diameter of the fin variable. It is larger at the base and decreases linearly towards the tip. 𝐿 = 1 m

    π·π‘π‘Žπ‘ π‘’ = 0.1 m , 𝐷𝑑𝑖𝑝 = 0.05 m

    𝐷(π‘₯) = βˆ’0.05π‘₯ + 0.1 Governing DE is the same as before, but now the cross sectional area and the perimeter of the fin are not constant. They are functions of π‘₯. 𝐾𝑖𝑗

    𝑒 and 𝐹𝑖𝑒 integrals are expressed same as before, also given

    below.

    𝐾𝑖𝑗𝑒 = ∫ (π‘˜π΄π‘

    𝑑𝑆𝑖𝑒

    π‘‘πœ‰

    1

    𝐽𝑒 𝑑𝑆𝑗

    𝑒

    π‘‘πœ‰

    1

    𝐽𝑒+ β„Žπ‘ƒπ‘†π‘–

    𝑒𝑆𝑗𝑒) π½π‘’π‘‘πœ‰

    1

    βˆ’1

    , 𝐹𝑖𝑒 = ∫ π‘†π‘–β„Žπ‘ƒπ‘‡βˆž 𝐽

    π‘’π‘‘πœ‰1

    βˆ’1

    Important: Now [𝐾𝑒] and {𝐹𝑒} of each element is different because 𝐴𝑐 and 𝑃 changes from element

    to element. To evaluate the above integrals we need to write 𝐴𝑐 and 𝑃 as functions of πœ‰.

    𝐴𝑐 =πœ‹π·2

    4=πœ‹

    4(βˆ’0.05π‘₯ + 0.1)2, 𝑃 = πœ‹π· = πœ‹(βˆ’0.05π‘₯ + 0.1)

    For element β€œe”, π‘₯ βˆ’ πœ‰ relation is given by

    π‘₯ =β„Žπ‘’

    2πœ‰ +

    π‘₯1𝑒 + π‘₯2

    𝑒

    2

    π‘₯

  • 14

    which needs to be substituted in the 𝐴𝑐 and 𝑃 expressions to get

    𝐴𝑐 =πœ‹π·2

    4=πœ‹

    4[βˆ’0.05(

    β„Žπ‘’

    2πœ‰ +

    π‘₯1𝑒 + π‘₯2

    𝑒

    2) + 0.1]

    2

    , 𝑃 = πœ‹π· = πœ‹ [βˆ’0.05(β„Žπ‘’

    2πœ‰ +

    π‘₯1𝑒 + π‘₯2

    𝑒

    2) + 0.1]

    As you see, things can get pretty involved and it becomes very difficult to perform a hand solution. But

    this will not create any difficulty in a FEM code that makes use of GQ integration, as we’ll see later.

    Example 2.8:

    Let’s solve Example 2.1, DE of which is given below, using the Finite Difference Method (FDM) and

    compare the solution with the FEM solution.

    3π‘‘πœ™

    𝑑π‘₯βˆ’π‘‘2πœ™

    𝑑π‘₯2= 1 𝑇(0) = 0 , 𝑇(1) = 0

    FDM has no concept of elements, but it has nodes. We’ll perform a 6 node solution using a node

    spacing of Ξ”π‘₯ = 1/5 = 0.2.

    Let’s write the ODE for an inner node 𝑖, with neighbors 𝑖 βˆ’ 1 and 𝑖 + 1.

    Node 𝑖: 3π‘‘πœ™

    𝑑π‘₯|π‘–βˆ’π‘‘2πœ™

    𝑑π‘₯2|𝑖

    = 1

    The first and the second derivatives can be approximated in many different ways, such as backward,

    central and forward. Also approximations of various orders, such as first-order or second-order can be

    used. We’ll use the following second-order central approximations

    π‘‘πœ™

    𝑑π‘₯|π‘–β‰…πœ™π‘–+1 βˆ’ πœ™π‘–βˆ’1

    2Ξ”π‘₯ ,

    𝑑2πœ™

    𝑑π‘₯2|𝑖

    β‰…πœ™π‘–+1 βˆ’ 2πœ™π‘– + πœ™π‘–βˆ’1

    (Ξ”π‘₯)2

    Substitute these into the ODE to get

    Node 𝑖: 3 (πœ™π‘–+1 βˆ’ πœ™π‘–βˆ’1

    2Ξ”π‘₯) βˆ’ (

    πœ™π‘–+1 βˆ’ 2πœ™π‘– + πœ™π‘–βˆ’1(Ξ”π‘₯)2

    ) = 1

    Use Ξ”π‘₯ = 0.2 and arrange into

    Node 𝑖: 32.5πœ™π‘–βˆ’1 + 50πœ™π‘– + 17.5πœ™π‘–+1 = 1

    To see the similarity of this equation with that obtained earlier by FEM, multiply the equation by

    Ξ”π‘₯ = 0.2

    Node 𝑖: 6.5πœ™π‘–βˆ’1 + 10πœ™π‘– + 3.5πœ™π‘–+1 = 0.2

    This is exactly the same equation as those obtained for the inner nodes of the FE solution. Look at the

    global system obtained in Example 2.1 to see it.

    x

    1 2 3 4 5 6

    Ξ”π‘₯

  • 15

    Important: Therefore, our FEM solution is practically the same as using FDM with second-order central

    derivative approximations. But FDM seems to be much simpler than FEM. So why should anyone prefer

    FEM? For this 1D problem, FEM has no advantage over FDM. FDM is just OK here. But FDM cannot be

    extended to 2D and 3D problems over complicated geometries, where unstructured grids are required.

    On the other hand, FEM is naturally suitable for those problems.

    Important: Here we worked only on the inner nodes. For the boundary nodes, derivatives need to be

    approximated not as central, but as a one-sided, such as forward differencing for node 1, and backward

    differencing for node 6.

    Example 2.9:

    Let’s solve Example 2.6, DE of which is given below, using the Finite Volume Method (FVM) and

    compare the solution with the FEM solution.

    βˆ’π‘‘

    𝑑π‘₯(π‘˜π‘‘π‘‡

    𝑑π‘₯) +

    β„Žπ‘ƒ

    𝐴𝑐(𝑇 βˆ’ π‘‡βˆž) = 0 , 0 < π‘₯ < 𝐿

    Note that both terms are divided by 𝐴𝑐, because this form is more suitable to FVM. A FVM mesh has

    cells and nodes. Cells are similar to the elements of FEM. Nodes are where we store the discrete

    unknown values, and typically they are at the midpoints of the cells. Following mesh has 4 cells and 4

    nodes. Different than FEM or FDM, there are no nodes at the boundaries. In FVM one can use other

    storage schemes too.

    Consider each cell to have a length of Ξ”π‘₯ = 𝐿/4.

    FVM uses integral form of the given DE. We integrate the DE over cell 𝑖.

    Cell 𝑖 ∢ βˆ’βˆ«π‘‘

    𝑑π‘₯(π‘˜π‘‘π‘‡

    𝑑π‘₯) π‘‘βˆ€

    Ω𝑖

    +βˆ«β„Žπ‘ƒ

    𝐴𝑐(𝑇 βˆ’ π‘‡βˆž) π‘‘βˆ€

    Ω𝑖

    = 0

    where Ω𝑖 denotes the domain (line segment in 1D) of cell 𝑖 and π‘‘βˆ€ is used for volume integration (line

    integral in 1D). FVM is based on the accounting of incoming and outgoing amounts of the conserved

    quantity at the faces of a cell. To see it this way we apply Gauss divergence theorem to the first integral

    and convert it from a volume integral to an area integral

    Cell 𝑖 ∢ βˆ’βˆ« π‘˜π‘‘π‘‡

    𝑑π‘₯ 𝑛π‘₯ 𝑑𝐴

    𝐴𝑖

    +βˆ«β„Žπ‘ƒ

    𝐴𝑐(𝑇 βˆ’ π‘‡βˆž) π‘‘βˆ€

    Ω𝑖

    = 0

    where 𝐴𝑖 is the boundary (faces) of cell 𝑖 , which are just the two end points in 1D. 𝑛π‘₯ is the π‘₯

    component of the unit outward normal at the boundaries, same as the one we used in the SV

    expression in FEM. In 1D, area integral is not really an integral, but the sum of the integrand evaluated

    at the two end points of cell 𝑖.

    Cell 1 Cell 2 Cell 3 Cell 4

    x

    1 2 3 4

  • 16

    Cell 𝑖 ∢ βˆ’ [(π‘˜π‘‘π‘‡

    𝑑π‘₯𝑛π‘₯𝐴𝑐)

    𝑙𝑒𝑓𝑑+ (π‘˜π΄π‘

    𝑑𝑇

    𝑑π‘₯𝑛π‘₯𝐴𝑐)

    π‘Ÿπ‘–π‘”β„Žπ‘‘] + ∫

    β„Žπ‘ƒ

    𝐴𝑐(𝑇 βˆ’ π‘‡βˆž) π‘‘βˆ€

    Ω𝑖

    = 0

    where β€œleft” and β€œright” are the left and right end points (faces) of cell 𝑖. The volume integral over cell

    𝑖 can be approximated as

    βˆ«β„Žπ‘ƒ

    𝐴𝑐(𝑇 βˆ’ π‘‡βˆž) π‘‘βˆ€

    Ω𝑖

    β‰…β„Žπ‘ƒ

    𝐴𝑐(𝑇𝑖 βˆ’ π‘‡βˆž)𝐴𝑐Δπ‘₯ = β„Žπ‘ƒ(𝑇𝑖 βˆ’ π‘‡βˆž)Ξ”π‘₯

    which is obtained by considering the nodal value 𝑇𝑖 (stored at the center of cell 𝑖) to be constant over

    cell 𝑖 , which has a volume of 𝐴𝑐Δπ‘₯ . Also using 𝑛π‘₯𝑙𝑒𝑓𝑑 = βˆ’1 and 𝑛π‘₯π‘Ÿπ‘–π‘”β„Žπ‘‘ = 1 , equation of cell 𝑖

    becomes

    Cell 𝑖 ∢ βˆ’ [(βˆ’π‘˜π‘‘π‘‡

    𝑑π‘₯𝐴𝑐)

    𝑙𝑒𝑓𝑑+ (π‘˜

    𝑑𝑇

    𝑑π‘₯𝐴𝑐)

    π‘Ÿπ‘–π‘”β„Žπ‘‘] + β„Žπ‘ƒ(𝑇𝑖 βˆ’ π‘‡βˆž)Ξ”π‘₯ = 0

    This is an energy balance equation. It considers the balance of heat coming into the cell from its left

    face, the heat going out of the cell from its right face and the convective heat going out of the cell to

    the surroundings. This β€œphysical accounting” character of FVM is what makes it natural and easy to

    understand for engineers.

    The main approximation in FVM is to approximate 𝑑𝑇

    𝑑π‘₯ at the right and left faces of the cell. For an inner

    cell (not located at a boundary), they can be approximated using the nodal values of 𝑇𝑖, 𝑇𝑖+1 and π‘‡π‘–βˆ’1

    as follows

    𝑑𝑇

    𝑑π‘₯|𝑙𝑒𝑓𝑑

    ≅𝑇𝑖 βˆ’ π‘‡π‘–βˆ’1Ξ”π‘₯

    , 𝑑𝑇

    𝑑π‘₯|π‘Ÿπ‘–π‘”β„Žπ‘‘

    ≅𝑇𝑖+1 βˆ’ 𝑇𝑖Δπ‘₯

    which are second-order central approximations around the faces. Substitute these into the equation

    of cell 𝑖.

    Cell 𝑖 ∢ βˆ’ [βˆ’π‘˜π‘‡π‘– βˆ’ π‘‡π‘–βˆ’1Ξ”π‘₯

    𝐴𝑐 + π‘˜π‘‡π‘–+1 βˆ’ 𝑇𝑖Δπ‘₯

    𝐴𝑐] + β„Žπ‘ƒ(𝑇𝑖 βˆ’ π‘‡βˆž)Ξ”π‘₯ = 0

    By putting the known values in and arranging we get

    βˆ’4.3982π‘‡π‘–βˆ’1 + 16.6504𝑇𝑖 βˆ’ 4.3982𝑇𝑖+1 = 196.3495

    Compared with the inner node equations obtained in Example 2.6, the right hand side value is the

    same, but the coefficients of the unknowns are different. FVM and FEM discretizations are not identical

    for this problem. The difference seems to be due to the discretization of the convective cooling term.

    Note that FDM will give the same result as FVM, when the second derivative of the DE is approximated

    in a second-order central way.

    To complete the FVM discretization and obtain a solution, we need to work on the boundary cells,

    which will not be done here.

    Cell i

    i-1 i i+1

    Left Right

  • 17

    Example 2.10:

    (Reference: Reddy’s book) We’ll perform an β„Ž -convergence study by solving the following pure

    diffusion problem (Poisson equation)

    βˆ’π‘‘2πœ™

    𝑑π‘₯2= 2 , 0 < π‘₯ < 1 with πœ™(0) = πœ™(1) = 0

    The exact solution is πœ™π‘’π‘₯ = π‘₯(1 βˆ’ π‘₯).

    Solutions with 2, 3 and 4 linear elements with constant element size for each case are shown below.

    Nodal values are exact, even for the 2 element mesh. But inside the elements there are deviations

    from the exact solution. To calculate how much these deviations contribute to the 𝐿2 and energy norm

    errors, let’s express the FE solutions as follows

    For 2 elements ∢ πœ™π‘Žπ‘π‘ = {β„Ž2(π‘₯/β„Ž)

    β„Ž2(2 βˆ’ π‘₯/β„Ž) for 0 ≀ π‘₯ ≀ β„Ž for β„Ž ≀ π‘₯ ≀ 2β„Ž

    For 3 elements ∢ πœ™π‘Žπ‘π‘ = {

    2β„Ž2(π‘₯/β„Ž)

    2β„Ž2(2 βˆ’ π‘₯/β„Ž) + 2β„Ž2(π‘₯/β„Ž βˆ’ 1)

    2β„Ž2(3 βˆ’ π‘₯/β„Ž)

    for 0 ≀ π‘₯ ≀ β„Ž for β„Ž ≀ π‘₯ ≀ 2β„Ž for 2β„Ž ≀ π‘₯ ≀ 3β„Ž

  • 18

    For 4 elements ∢ πœ™π‘Žπ‘π‘ =

    {

    3β„Ž

    2(π‘₯/β„Ž)

    3β„Ž2(2 βˆ’ π‘₯/β„Ž) + 4β„Ž2(π‘₯/β„Ž βˆ’ 1)

    4β„Ž2(3 βˆ’ π‘₯/β„Ž) + 3β„Ž2(π‘₯/β„Ž βˆ’ 2)

    3β„Ž2(4 βˆ’ π‘₯/β„Ž)

    for 0 ≀ π‘₯ ≀ β„Ž for β„Ž ≀ π‘₯ ≀ 2β„Ž for 2β„Ž ≀ π‘₯ ≀ 3β„Žfor 3β„Ž ≀ π‘₯ ≀ 4β„Ž

    where β„Ž = 1/2, 1/3 and 1/4 for 2, 3, and 4 element solutions, respectively. Knowing the exact

    solution, we can calculate the integrals of the error norms and obtain the following results

    β„Ž 𝐿2 norm error Energy norm error

    1/2 0.04564 0.2887

    1/3 0.02028 0.1925

    1/4 0.01141 0.1443

    Following is the log-log plot of these values. Although not easy to see on the graph, slopes of the 𝐿2

    and energy norm error lines are 2 and 1, as discussed before.

    Exercise: Repeat the above β„Ž-convergence study using quadratic elements and see if you can get the

    rate of convergences predicted by the theory.

    Slope of 1

    Slope of 2


Recommended