+ All Categories
Home > Documents > comparison between finite volume and finite differences

comparison between finite volume and finite differences

Date post: 24-Feb-2018
Category:
Upload: ali-al-hamaly
View: 223 times
Download: 0 times
Share this document with a friend

of 21

Transcript
  • 7/25/2019 comparison between finite volume and finite differences

    1/21

    1

    Ali Alhamaly201406980

    ME 505: Assignment 1

    Problem 1:

    Write the generalized transport equation in conservative form and non-conservative form (in

    Vector notation) and show that both forms are equivalent.

    The generalized transport equation for a conserved quantity in conservative form is given by:

    . . () (1)To write Eq.(1) in non-conservative from, we need to expand the derivative in the LHS of Eq.(1):

    . . . ()

    (2)

    By collecting the terms in Eq.(2) we get:

    . . . ( ) (3)The continuity equation (setting 1with 0in Eq.(1))is:

    . 0 (4)Using Eq.(4) in Eq.(3) gives:

    . . ( ) (5)identifying that

    . gives:

  • 7/25/2019 comparison between finite volume and finite differences

    2/21

    2

    . () (6)Equation(6) is the generalized transport equation in non-conservative form.

    Problem 2:

    Fill the table for the generalized conservation equation as discussed in lecture 3.

    Quantity Mass 1 0 0

    x-Momentum

    . y-Momentum .

    z-Momentum .

    Enthalpy / Temperature / /Species mass

    fraction

    Symbol Meaning Dynamic viscosity Volumetric body force Bulk viscosity Thermal conductivity

    Specific heat Density Viscous dissipation

    Volumetric heat generation Mass diffusion coefficient for specie i Rate of generation of specie i

  • 7/25/2019 comparison between finite volume and finite differences

    3/21

    3

    Problem 3:

    We like to solve the 1D heat conduction using 3 methods for the following 2 problems:

    Case 1: A flat plate of thickness L=2cm, k=0.5W/(mK) and heat generation of 1000 kW/m3.

    The plate is maintained between Tleft=100C and Trightof 200C.

    Case 2: A circular fin of constant cross-sectional area A, perimeter P, thermal conductivity k,

    heat transfer coefficient h and length L=1m. The fin base temperature is TB=100C and the othertip is insulated. The ambient temperature is 20C, and hP/(kA)=25m-2.

    Solution Methods:1. Exact

    2. Finite Volume with cell length i) L/5, ii) L/10 and iii) L/503. Finite difference method with node spacing of i) L/5, ii) L/10 and iii) L/50

    For both FV and FD use direct solution method (Matrix inversion) and iterative method (e.g. Gauss

    Sidel)

    Deliverable

    a) Please show your derivation of the discretized equation for Finite volume and finitedifference for a typical finite volume (or typical node) and for boundary nodes if needed.

    b) Compare the temperature results for exact, FV (3 grids, direct, iterative) and FD (3 grids,direct, iterative). Use tables and plots and indicate % difference

    c) Do the same for the heat fluxes.d) Compare the time of execution between 2iii) and 3iii) and the matrix inversion part. (If smalldifference in time, use L/100.)

    e) Discuss your results briefly.

  • 7/25/2019 comparison between finite volume and finite differences

    4/21

    4

    Case 1:

    Part a)

    Derivation of the discretized equation for finite volume:

    The governing equation is:

    (7)

    Typical finite volume discretized equation:

    Integrating Eq.(7) along the volume P (seeFig. 1)and using the divergence theorem to convert

    the volume integral of the LHS of Eq.(7) to surface integral gives:

    | | (8)Where is the average of over the volume, and is the area of the volume cell faces.Approximating the derivatives at faces e and w by central difference approximation gives:

    (9)

    Using and rearranging, Eq.(9)becomes: (10)

    . Eq.(10) can be written as:

    EPW

    Fig. 1schematic of typical cell volume

    ew

  • 7/25/2019 comparison between finite volume and finite differences

    5/21

    5

    (11)

    , Finite volume left boundary discretized equation:

    Integrating Eq.(7) along the volume P (seeFig. 2)and discretizing gives:

    /2 (12)Equation(12) can be written as:

    (13)

    , , , 2 Finite volume right boundary discretized equation:

    The discretized equation are the same as Eq.(13) with the coefficients being:

    , , , 2

    Derivation of the discretized equation for finite differences:

    Typical node discretized equation:

    /2

    EPB

    Fig. 2schematic of left boundary

    eb

  • 7/25/2019 comparison between finite volume and finite differences

    6/21

    6

    Discretizing the second derivative in the LHS of Eq.(7) with central difference approximation

    yields (seeFig. 3)

    2 + 2 +

    (14)

    Left boundary discretized equation:

    Discretizing the second derivative in the LHS of Eq.(7) at the left boundary (seeFig. 4)

    2 3

    (15)Right boundary discretized equation:

    Similar to Eq.(15) we get:

    2 (16)Where is the total number of nodes.

    Part b)

    The exact solution of Eq.(7) is:

    i+1ii-1

    Fig. 3schematic of typical node for finite differences

    321

    Fig. 4schematic of left boundary node for finite differences

  • 7/25/2019 comparison between finite volume and finite differences

    7/21

    7

    2 ( ) 2 (17)Where /.For finite volume method, the temperature was solved at the locations:

    [0 , , 3 , ]for , , and [5,10,50]For finite differences method, the temperature was solved at the locations:

    [0 , ,2 2 , ]for , , and [6,11,51]The error of the solution is given by:

    %| | 100 (18)Figures 5 and Error! Reference source not found.andTable 1 andTable 2 show comparison

    between the finite volume and finite differences solutions with the exact solution. Note that inFig.

    5 and Error! Reference source not found.only direct method solution are shown. This is becausethe difference between the direct method and iterative method

    is extremely small which makes the lines on top of each other.

    Fig. 5Comparison of temperature results for finite volume method using multiple cell sizes. a)Temperature distribution b)error percentage compared with exact solution

    a)

    b)

  • 7/25/2019 comparison between finite volume and finite differences

    8/21

    8

    /5 0.1 146 150 149.9999969 2.7397260 2.7397239

    0.5 250 254 253.9999937 1.6000000 1.5999975

    0.9 226 230 229.9999986 1.7699115 1.7699109 /10 0.05 124 125 124.9999946 0.806451613 0.806447265

    0.45 244 245 244.9999727 0.409836066 0.40982489

    0.85 236 237 236.9999897 0.423728814 0.423724441 /50 0.01 104.96 105.00 104.9999765 0.038109756 0.038087346

    0.35 226.00 226.04 226.0393554 0.017699115 0.017413908

    0.69 254.56 254.60 254.5994214 0.015713388 0.015486107

    Table 1.Comparison between the exact and finite volume method for different cell sizes.

    Fig. 6Comparison of temperature results for finite differences method using multiple nodespacing. a)Temperature distribution b)error percentage compared with exact solution

    a)

    b)

  • 7/25/2019 comparison between finite volume and finite differences

    9/21

    9

    /5 0.2 184 184 183.9999969 0 1.71E-06

    0.6 256 256 255.9999967 1.11E-14 1.30E-06

    0.8 244 244 243.9999983 0 6.84E-07 /10 0.1 146 146 145.9999909 0 6.23E-06

    0.4 236 236 235.9999759 2.41E-14 1.02E-05

    0.9 226 226 225.9999939 0 2.69E-06

    /50

    0.02 109.84 109.84 109.8399535 1.04E-13 4.23E-050.36 228.16 228.16 228.1593524 7.47E-13 0.000283853

    0.98 205.84 205.84 205.8399577 6.90E-14 2.05E-05

    Part c)

    The exact heat flux is given by:

    ( ) 2 (19)For finite volume method, the flux was obtained using central difference approximation to

    approximate the temperature derivative (except at the boundaries in which forward or backwarddifferences is used as appropriate). The locations of the approximate flux is at:

    [0 , ,2 1 , ]for , , and [5,10,50]For finite differences method, the flux was obtained using central difference approximation to

    approximate the temperature derivative (except at the boundaries in which forward or backwarddifferences is used as appropriate). The locations of the approximate flux is at:

    [0 , ,2 2 , ]for , , , and [6,11,51]

    Table 2.Comparison between the exact and finite differences method for different nodespacing.

  • 7/25/2019 comparison between finite volume and finite differences

    10/21

    10

    Figures 7 andTable 3 and 4 show comparison between the finite volume and finite differences

    flux solutions with the exact flux solution.

    /5 0 -12500 -12500 -12499.9992 0 -6.28E-06

    0.4 -4500 -4500 -4500.00000 0 0

    0.8 3500 3500 3499.99965 2.08E-13 9.97E-06 /10 0 -12500 -12500 -12499.9973 0 -2.16E-05

    0.3 -6500 -6500 -6499.99893 -1.12E-13 -1.64E-05

    0.6 -500 -500 -500.000916 0 -0.00018 /50 0 -12500 -12500 -12499.9412 -5.68E-13 -0.00047

    0.34 -5700 -5700 -5699.97417 -5.58E-13 -0.00045

    0.68 1100 1100 1099.969079 6.82E-13 0.002811

    Fig. 7Comparison of flux results for finite volume method using multiple cell sizes. a)fluxdistribution b)error percentage compared with exact solution

    Table 3.Comparison between the exact and finite volume method for different cell sizes.

    a)

    b)

  • 7/25/2019 comparison between finite volume and finite differences

    11/21

    11

    /5 0 -12500 -10500 -10500 -16 -16

    0.4 -4500 -4500 -4500 -4.04E-14 -2.58E-07

    1 7500 5500 5500 26.66667 26.66667 /10 0 -12500 -11500 -11500 -8 -8.00002

    0.3 -6500 -6500 -6500 -1.12E-13 -1.47E-051 7500 6500 6499.998 13.33333 13.33335 /50 0 -12500 -12300 -12299.9 -1.6 -1.60046

    0.34 -5700 -5700 -5699.97 -1.80E-12 -0.00045

    1 7500 7300 7299.947 2.666667 2.667371

    Fig. 8Comparison of flux results for finite differences method using multiple node spacing. a)flux distribution b)error percentage compared with exact solution

    Table 4.Comparison between the exact and finite differences method for different node

    spacing.

  • 7/25/2019 comparison between finite volume and finite differences

    12/21

    12

    Part d)

    Figure9Comparison of time of execution between finite volume and finite differences shows

    comparison between time of execution of finite volume and finite differences using directinversion method.

    Part e)

    Finite volume method gives accurate results for the temperature distribution even with only 5volume cells. As can be seen inFig. 5,the error is less than 3%.Table 1 show that the direct and

    iterative methods of solution given essentially same results. Finite differences is more accurate

    than finite volume for this problem as can be seen by comparingFig. 5 andFig. 6.For heat fluxvalues, both finite volume and finite differences are very accurate. However, the boundary flux for

    the finite differences has substation error probably because of first order derivative approximation

    that is used for calculation. In terms of computational cost,Fig. 9 shows that finite differences is

    little bit more costly compared with finite volume. In general, an order of magnitude increase inthe size of the system gives order of magnitude increase in terms of computation time.

    Fig. 9

    Comparison of time of execution between finite volume and finite differences

  • 7/25/2019 comparison between finite volume and finite differences

    13/21

    13

    Case 2:

    Part a)

    Derivation of the discretized equation for finite volume:

    The governing equation is:

    (20) ,

    Typical finite volume discretized equation:

    Integrating Eq.(20) along the volume P (seeFig. 1)and using the divergence theorem to convertthe volume integral of the LHS of Eq.(20) to surface integral gives:

    | | (21)Where is the average of over the volume, and is the area of the volume cell faces.Approximating the derivatives at faces e and w by central difference approximation gives:

    (22)Using and rearranging, Eq.(22)becomes:

    (23)

    1

    +

    (24)

    Evaluating the integral in Eq.(24) using trapezoidal approximation gives:

    2 (25)+ (by linear interpolation). Hence:

  • 7/25/2019 comparison between finite volume and finite differences

    14/21

    14

    (26)In general, we would like to write . So for typical cell volume, we have:

    , 0. Eq.(23) can be written as: (27)

    , Finite volume left boundary discretized equation:

    Integrating Eq.(20) along the volume P (seeFig. 2)and discretizing gives:

    /2 (28)Equation(12) can be written as:

    (29)

    , , , 2 Finite volume right boundary discretized equation:

    The discretized equation are the same as Eq.(29) with the coefficients being:

    , , 0Note that the right boundary value where N is the last cell volume. This due to the zeroflux boundary condition at the right boundary.

    Derivation of the discretized equation for finite differences:

    Typical node discretized equation:

    Discretizing the second derivative in the LHS of Eq.(20) with central difference approximation

    yields (seeFig. 3)

  • 7/25/2019 comparison between finite volume and finite differences

    15/21

    15

    2 + 0 2 + 0 (30)Left boundary discretized equation:

    Discretizing the second derivative in the LHS of Eq.(20) at the left boundary (seeFig. 4)

    2 3 (31)Right boundary discretized equation:

    the second derivative in the LHS of Eq.(20) is discretized using backward difference as follows:

    |= |=//2 (32) |= 0, |=/

    |= |=//2 2 (33)Using Eq.(33),the discretized from of Eq.(20)becomes:

    2 2 0 (34)Where is the total number of nodes.

    Part b)

    The exact solution of Eq.(20) is:

    cosh1

    cosh() (35)

  • 7/25/2019 comparison between finite volume and finite differences

    16/21

    16

    Where /.For finite volume method, the temperature was solved at the locations:

    [0 ,

    ,3

    , ]for

    ,

    ,

    and

    [5,10,50]

    For finite differences method, the temperature was solved at the locations:

    [0 , ,2 2 , ]for , , and [6,11,51]The error of the solution is given by:

    %| |

    100 (36)

    Figures10 and11 and Tables5 and 6 show comparison between the finite volume and finitedifferences solutions with the exact solution.

    Fig. 10Comparison of temperature results for finite volume method using multiple cell sizes. a)Temperature distribution b)error percentage compared with exact solution

  • 7/25/2019 comparison between finite volume and finite differences

    17/21

    17

    /5

    0.1 48.52624 44.22764 44.22764 8.858291 8.858289

    0.5 6.610747 6.504065 6.504066 1.613758 1.613741

    0.9 1.215606 1.300813 1.300813 7.009404 7.009434 /10 0.05 62.3059 60.5991 60.5991 2.739384 2.739381

    0.45 8.466013 8.404587 8.404595 0.725558 0.725465

    0.85 1.395698 1.417561 1.417566 1.566481 1.566856 /50 0.01 76.09872 76.00535 76.00536 0.122686 0.122679

    0.35 13.92218 13.915 13.91515 0.051608 0.05053

    0.69 2.65394 2.654584 2.654807 0.024294 0.032697

    Table 5.Comparison between the exact and finite volume method for different cell sizes.

    Fig. 11Comparison of temperature results for finite differences method using multiple nodespacing. a)Temperature distribution b)error percentage compared with exact solution

  • 7/25/2019 comparison between finite volume and finite differences

    18/21

    18

    /5 0.2 29.43889 30.56911 30.56911 3.839187 3.8391920.6 4.055732 4.552846 4.552847 12.25706 12.2571

    0.8 1.663476 1.95122 1.951221 17.29774 17.29781 /10 0.1 48.52624 48.77309 48.77309 0.508691 0.508698

    0.4 10.85317 11.07705 11.07706 2.062835 2.06291

    0.9 1.215606 1.275805 1.275812 4.952162 4.952745 /50

    0.02 72.38772 72.39074 72.39075 0.004166 0.0041790.36 13.24528 13.25526 13.25541 0.075368 0.076498

    0.98 1.083417 1.085669 1.085905 0.207881 0.229631

    Part c)

    The exact heat flux is given by:

    1

    sinh1

    cosh()

    (37)

    For finite volume method, the flux was obtained using central difference approximation to

    approximate the temperature derivative (except at the left boundary in which forward differences

    is used). The locations of the approximate flux is at:

    [0 , ,2 1 , ]for , , and [5,10,50]For finite differences method, the flux was obtained using central difference approximation to

    approximate the temperature derivative (except at the left boundary in which forward differences

    is used). The locations of the approximate flux is at:

    [0 , ,2 2 , ]for , , and [6,11,51]Figures12 and 13 and Tables 7 and 8 show comparison between the finite volume and finitedifferences flux solutions with the exact flux solution.

    Table 6.Comparison between the exact and finite differences method for different nodespacing

  • 7/25/2019 comparison between finite volume and finite differences

    19/21

    19

    /5 0 399.9637 357.7236 357.7236 10.56099 10.560990.4 53.99748 52.03252 52.03252 3.638978 3.638976

    0.8 6.334467 6.504065 6.504067 2.677383 2.677412 /10 0 399.9637 388.018 388.018 2.986689 2.986699

    0.3 89.16663 87.82304 87.82303 1.506834 1.506846

    0.6 19.54919 19.53576 19.53577 0.06866 0.06863 /50

    0 399.9637 399.4645 399.464 0.124804 0.12493

    0.34 72.97069 72.93094 72.9306 0.054469 0.054935

    0.68 12.80458 12.80599 12.80589 0.010982 0.010219

    Fig. 12Comparison of flux results for finite volume method using multiple cell sizes. a)fluxdistribution b)error percentage compared with exact solution

    Table 7.Comparison between the exact and finite volume method for different cell sizes.

  • 7/25/2019 comparison between finite volume and finite differences

    20/21

    20

    /5 0 399.9637 247.1545 247.1545 38.20577 38.20577

    0.4 53.99748 65.04065 65.04065 20.45128 20.45128

    0.8 6.334467 8.130081 8.130083 28.34673 28.34676 /10 0 399.9637 312.2691 312.2691 21.92563 21.92564

    0.3 89.16663 93.31197 93.31196 4.648989 4.648974

    0.9 2.808763 3.012317 3.012325 7.247139 7.247402

    /50 0 399.9637 380.4632 380.4627 4.87557 4.87569

    0.34 72.97069 73.11327 73.11293 0.195395 0.194928

    0.98 0.53991 0.541484 0.541537 0.291582 0.301383

    Fig. 13Comparison of flux results for finite differences method using multiple node spacing. a)flux distribution b)error percentage compared with exact solution

    Table 8.Comparison between the exact and finite differences method for different nodespacing.

  • 7/25/2019 comparison between finite volume and finite differences

    21/21

    21

    Part d)

    Figure14 shows comparison between time of execution of finite volume and finite differencesusing direct inversion method.

    Part e)

    Both finite volume and finite differences method give reasonable accurate results for thetemperature distribution. The accuracy increases quickly with the number of cells and with the

    decrease in number of nodes. Generally Case 2 accuracy is less than Case1 for the same cell

    numbers. The same trends goes for heat flux values with the finite volume being more accuratethan finite differences. Errors in heat flux are maximum at the left boundary for both finite volumeand finite differences. In terms of computational cost,Fig. 14 shows that finite differences is an

    order of magnitude slower compared with finite volume. This is in contrast with Case 1 in which

    both finite volume and finite differences have essentially the same time of execution.

    Fig. 14Comparison of time of execution between finite volume and finite differences


Recommended