Finite volume method for boundary value praveen/notes/cm2013/bvp_disc... Finite volume method for...

Click here to load reader

  • date post

    21-May-2020
  • Category

    Documents

  • view

    4
  • download

    1

Embed Size (px)

Transcript of Finite volume method for boundary value praveen/notes/cm2013/bvp_disc... Finite volume method for...

  • Finite volume method for boundary value problem Discontinuous coefficients and high Peclet number

    Praveen. C praveen@math.tifrbng.res.in

    Tata Institute of Fundamental Research Center for Applicable Mathematics

    Bangalore 560065 http://math.tifrbng.res.in/~praveen

    January 21, 2013

    1 / 38

    http://math.tifrbng.res.in/~praveen

  • Discontinuous coefficients

    − d dx a(x)

    du

    dx = q, x ∈ Ω = (0, 1)

    Finite difference scheme

    −1 2

    [D+x (aD − x ) +D

    − x (aD

    + x )]uj = qj , j = 1, 2, . . . , n− 1

    or, for j = 1, 2, . . . , n− 1 1

    2h2 [−(aj−1 + aj)uj−1 + (aj−1 + 2aj + aj+1)uj − (aj + aj+1)uj+1] = qj

    Boundary condition u(0) = 0, u(1) = 1

    Discontinuous coefficient

    a(x) =

    { � 0 ≤ x ≤ x∗ 1 x∗ < x ≤ 1

    2 / 38

  • Discontinuous coefficients

    Jump condition: au′ is continuous across the discontinuity

    � lim x↑x∗

    u′(x) = lim x↓x∗

    u′(x)

    Exact solution (q = 0)

    u(x) =

    { αx 0 ≤ x < x∗ �αx+ 1− �α x∗ ≤ x ≤ 1

    where

    α = 1

    (1− �)x∗ + �

    3 / 38

  • Discontinuous coefficients

    Finite difference solution: Consider the uniform grid xj = jh, j = 0, 1, . . . , n with h = 1n . Assume xk < x

    ∗ ≤ xk+1. Postulate FD solution as (u0 = 0 and un = 1 is satisfied)

    uj =

    { αhj 0 ≤ j ≤ k βhj − βhn+ 1 k + 1 ≤ j ≤ n

    where (apply FD equation at j = k and j = k + 1)

    αh =

    [ � 1− � 1 + �

    + �(n− k) + k ]−1

    , βh = �αh

    At x = xk = hk, FD solution is

    uk = xk

    �h1−�1+� + (1− �)xk + �

    4 / 38

  • Discontinuous coefficients Case x∗ = xk+1: Exact solution is

    u(xk) = xk

    (1− �)xk+1 + � and error in FD solution

    uk − u(xk) = O ( � 1− � 1 + �

    h

    )

    Case x∗ = xk + h/2: Exact solution is

    u(xk) = xk

    (1− �)xk + �+ 12h(1− �)

    and error in FD solution

    uk − u(xk) = O (

    (1− �)2 �(1 + �)

    h

    ) 5 / 38

  • Discontinuous coefficients

    a(x) error

    constant 0 continuous O

    ( h2 )

    discontinuous O (h)

    FD scheme loses its optimal accuracy when coefficients are discontinuous.

    6 / 38

  • Finite volume scheme

    Non-overlapping finite volumes (vertex-based or vertex-centered)

    Ωj = (xj − h

    2 , xj +

    h

    2 ), j = 1, 2, . . . , n− 1

    0 1 n− 1 njj − 1 j + 1

    j − 1/2 j + 1/2

    Ωj

    x = 0 x = 1

    Integrate over each cell Ωj

    − ∫

    Ωj

    (au′)′dx =

    ∫ Ωj

    qdx

    −[(au′)j+ 1 2 − (au′)j− 1

    2 ] ≈ hqj

    7 / 38

  • Finite volume scheme

    uj+1 − uj = ∫ xj+1 xj

    u′dx

    =

    ∫ xj+1 xj

    1

    a (au′)dx

    ≈ (au′)j+ 1 2

    ∫ xj+1 xj

    1

    a dx

    ≈ (au′)j+ 1 2

    h

    aj+ 1 2

    where 1

    aj+ 1 2

    = 1

    2

    ( 1

    aj +

    1

    aj+1

    ) ≈ 1 h

    ∫ xj+1 xj

    1

    a dx

    Flux at x = xj+ 1 2

    (au′)j+ 1 2

    = aj+ 1 2

    uj+1 − uj h

    8 / 38

  • Finite volume scheme Finite volume scheme

    − [ aj+ 1

    2

    uj+1 − uj h

    − aj− 1 2

    uj − uj−1 h

    ] = hqj , j = 1, 2, . . . , n− 1

    with u0 = 0, un = 1

    Discontinuous coefficient, x∗ = xk + h/2: Discontinuity coinciding with cell face xk+ 1

    2

    aj+ 1 2

    =

     �, 1 ≤ j < k 2�

    1+� , j = k

    1, k < j ≤ n− 1 Postulating FVM solution as before, we get

    αh = h

    (1− �)x∗ + � , βh = �αh 9 / 38

  • Finite volume scheme

    The FVM solution is exact !!! In general, the error of FV solution is O ( h2 ) .

    Discontinuous coefficient, x∗ = xk: Discontinuity inside a cell

    aj+ 1 2

    is again given as in previous case and the error in uk is O ( h2 )

    (show this).

    When dealing with problems with discontinuous coefficients and/or solutions, finite volume methods are more accurate than finite difference methods. FVM has better mathematical basis since it is based on weak formulation.

    10 / 38

  • If mesh Peclet number is large

    µ > 0 and U > 0 are constants

    −µu′′ + Uu′ = 0, x ∈ (0, L)

    Non-dimensionalize: x→ x/L

    − 1 Pe u′′ + u′ = 0, x ∈ (0, 1)

    Peclet number:

    Pe = UL

    µ =

    convection

    diffusion

    General solution

    u(x) = A+BexPe

    Boundary conditions

    u(0) = a, u(1) = b

    11 / 38

  • If mesh Peclet number is large Solution

    u(x) = a+ (b− a)e (x−1)Pe − e−Pe

    1− e−Pe Example

    a = 0, b = 1, u(x) = e(x−1)Pe − e−Pe

    1− e−Pe

    0.0 0.2 0.4 0.6 0.8 1.0

    0.0

    0.2

    0.4

    0.6

    0.8

    1.0 Pe=1

    0.0 0.2 0.4 0.6 0.8 1.0

    0.0

    0.2

    0.4

    0.6

    0.8

    1.0 Pe=50

    Boundary layer is present near x = 1 for large value of Pe Boundary layer thickness = O

    ( 1

    Pe

    ) for Pe� 1

    12 / 38

  • If mesh Peclet number is large Finite volume scheme (cell-centered)

    1 njj − 1 j + 1

    j − 1/2 j + 1/2

    Ωjx = 0 x = 1

    Integrating over finite volume Ωj

    − 1 Pe

    [u′ j+ 1

    2

    − u′ j− 1

    2

    ] + uj+ 1 2 − uj− 1

    2 = 0

    Fluxes: for j = 1, 2, . . . , n− 1

    uj+ 1 2

    = 1

    2 (uj + uj+1), u

    ′ j+ 1

    2

    = uj+1 − uj

    h

    Boundary fluxes

    u 1 2

    = a, un+ 1 2

    = b, u′1 2

    = u1 − a h/2

    , u′ n+ 1

    2

    = b− un h/2

    13 / 38

  • If mesh Peclet number is large

    System of finite volume equations

    (1 + 6

    P )u1 + (1−

    2

    P )u2 = (2 +

    4

    P )a

    −(1 + 2 P

    )uj−1 + 4

    P uj + (1−

    2

    P )uj+1 = 0, j = 2, 3, . . . , n− 1

    −(1 + 2 P

    )un−1 + (−1 + 6

    P )un = (−2 +

    4

    P )b

    with the mesh Peclet number P = hPe .

    Case P = 0: No convection, only diffusion

    uj = A+Bj

    Determine A,B from first and last equations.

    14 / 38

  • If mesh Peclet number is large Case P = 2:

    uj = a, j = 1, 2, . . . , n

    Case P 6= 0, 2: Postulate solution of the form

    uj = A+Bz j =⇒ z = 2 + P

    2− P Determine A,B from first and last equations.

    uj = a+ b− a zn − 1

    ( −1 + 2− P

    2 zj )

    P z Solution

    0 < P < 2 z > 0 monotonic P > 2 z < 0 oscillatory

    15 / 38

  • If mesh Peclet number is large

    Non-oscillatory solution is guaranteed provided h < 2Pe . If Pe� 1, then we need a very fine mesh, h� 1.

    æ æ æ æ æ æ æ

    æ

    æ

    æ

    0.2 0.4 0.6 0.8 1.0

    0.2

    0.4

    0.6

    0.8

    1.0 Pe=10, n=10, P=1

    æ æ æ æ æ æ æ

    æ

    æ

    æ

    0.2 0.4 0.6 0.8 1.0

    -1.0

    -0.5

    0.5

    1.0 Pe=40, n=10, P=4

    Solution is oscillatory at higher Pe numbers; does not satisfy maximum principle

    Matlab code: convdiff central ccfvm.m

    16 / 38

  • If mesh Peclet number is large

    Adaptive grid: Boundary layer thickness

    ∆ = 4

    Pe

    Put 1/3 of total cells in the boundary layer.

    Grid refined in the boundary layer

    17 / 38

  • If mesh Peclet number is large

    18 / 38

  • Oscillation 6= instability • Stability refers to influence of perturbations in data (initial and

    boundary conditions) on the solution

    • Consider a perturbation ∆a of the boundary value a. Then

    ∆uj = zn − zj + zj P2

    zn − 1 ∆a

    • Solution is stable in norm ‖·‖ if there is a constant C independent of h such that

    ‖∆u‖ ≤ C|∆a|

    • Case z < −1:

    ‖∆u‖∞ ≤ C|∆a|, C = 2 (

    2 + |P | 2

    ) 19 / 38

  • Oscillation 6= instability

    • Case −1 ≤ z < 0 and perturbations in b are left as an exercise. • As h→ 0, the condition h < 2/Pe will be satisfied; the numerical

    solution converges to the exact solution.

    • In practical computations, we use a finite grid h. It is desirable to have a scheme free of oscillations for all values of h.

    20 / 38

  • Upwind scheme

    d

    dx (Uu)− d

    dx D

    du

    dx = q

    Finite volume scheme

    (Uu)j+ 1 2 − (Uu)j− 1

    2 − [(Du′)j+ 1

    2 − (Du′)j− 1

    2 ] = qjh

    Central scheme for convection term

    (Uu)j+ 1 2

    = 1

    2 Uj+ 1

    2 (uj + uj+1)

    Upwind scheme for convection term

    (Uu)j+ 1 2

    =

    { Uj+ 1

    2 uj , Uj+ 1

    2 ≥ 0

    Uj+ 1 2 uj+1, Uj+ 1

    2 < 0