2011-Lecture-23

download 2011-Lecture-23

of 8

Transcript of 2011-Lecture-23

  • 8/11/2019 2011-Lecture-23

    1/8

    Computational Fluid Dynamics

    Solving the Navier-Stokes Equations-II

    Grtar Tryggvason Spring 2011

    http://www.nd.edu/~gtryggva/CFD-Course/ Computational Fluid Dynamics

    Other Methods for the Navier-Stokes Equations:Articial Compressibility & SIMPLE

    Higher Order Advection QUICK & ENO

    Higher order in space

    Compact schemes

    Conservation of energy

    Higher order in time for

    the " -# formulation

    Outline

    Computational Fluid Dynamics

    Other Methods

    Computational Fluid Dynamics

    The ArticialCompressibility Method(Chorin, 1967, JCP 2,12-26)

    ! u

    ! t = " A (u ) + # $ 2u " $ p

    ! p! t

    =" 1%

    $ & u

    $ is a numerical parameter, in effect an articialvelocity of sound. At steady state ! " u = 0

    ! u

    ! t = " A (u ) + # $ 2u " $ p "

    12

    $ % u( )uSometimes we keep additional terms

    ! u! t

    = " A (u ) + # $ 2u " $ p " 12

    $ % u( )u " 1& $ $ % u( )

    Computational Fluid Dynamics

    The SIMPLE (Semi-Implicit Method for Pressure LinkedEquations) family of methods for the steady state solution

    At steady state we have

    0 = ! A (u ) + " # 2u ! # p# $ u = 0

    a pu p = a l u l neighbours

    ! " # ph# $ u = 0

    After discretization the momentumequation can be written as:

    Where the sum is overnonlinear terms sincethe coefcients dependon the velocity

    Computational Fluid Dynamics

    In SIMPLE based methods we solve the discrete momentumequation

    approximately using an estimation of the pressure and thencorrect it by adding pressure.

    Since the momentum equation is an approximation, this isnot the nal velocity and we therefore continue iterating untilconvergence

    a p u p = a l u l neighbours

    ! " # ph

    p = p*

    + p'

    u = u*

    + u '

    ! 2 p ' = " 1

    # t ! $ u

    p

    *

  • 8/11/2019 2011-Lecture-23

    2/8

    Computational Fluid Dynamics

    The SIMPLE Algorithm:

    1. Guess the pressure eld p*

    2. Solve the momentum equations toget u* and v* (using u to nd a p)

    3. Solve for p &

    4. Compute new pressure

    5. Compute new velocity

    6. Take the corrected pressure as thenew guess p* and go to step 2, usingthe new velocity for the coefcient

    u p

    = u p

    *

    ! " ph

    p = p*

    + p'

    ! 2 p ' = "

    1

    # t ! $ u *

    a p u p*

    = a l u l *

    neighbours

    ! " # ph*

    In the original

    SIMPLE methodwe drop this term

    Computational Fluid Dynamics

    There is no good reason for neglecting theneighboring points in step 2 when updating thevelocities (except that they are not known!) and in theSIMPLEC (SIMPLE Corrected) the neighboringvelocities are estimated using the values from the lastiteration.

    In SIMPLER (SIMPLE Revisited) method pressure isfound from the new velocity.

    The PISO (Pressure Implicit with Splitting ofOperators) the rst estimate for the velocities isfollowed by another one where the preliminaryvelocities are used to get a better estimate.

    Computational Fluid Dynamics

    Advection byHigher Order

    Methods

    Computational Fluid Dynamics

    For the advection terms, the methodsdescribed for hyperbolic equations, includingENO, can all be applied, yielding stable androbust methods that can be forgiving forlow resolution.

    QUICK, where a third order upstreamdifferencing is used is also popular.

    Computational Fluid Dynamics

    s=1 f1

    s=2 f2

    s=3 f3

    s=4 f4

    s=5/2

    At s = 5/2

    ! f 2

    ! x

    " # $

    i

    % 1

    h f i + 1/ 2

    2 & f i&1/ 22{ }

    =1

    64 h3 f i + 1 + 6 f i & f i&1[ ]

    2 & 3 f i + 6 f i&1 & f i&2[ ]2{ }

    f 5/ 2 = 1/ 8( )

    3 f 3 + 6 f 2 ! f 1[ ]

    ! f ! t

    +1

    2

    ! f 2

    ! x= D

    ! 2 f ! x2

    Use to solve:

    Computational Fluid Dynamics

    Centered

    Upwind QUICK

    ! f ! t

    +1

    2

    ! f 2

    ! x= D

    ! 2 f ! x

    2

  • 8/11/2019 2011-Lecture-23

    3/8

    Computational Fluid Dynamics

    0 5 10 15 20 25 30 3 5 4 00

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    0 5 10 15 20 25 30 3 5 4 00

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    Re_cell=20 Re_cell=10

    ! f ! t

    +1

    2

    ! f 2

    ! x=

    D

    ! 2 f ! x2

    Centered

    Upwind QUICK

    Computational Fluid Dynamics

    ! f ! t

    + u ! f ! x

    = 0

    f j *

    = f j n !

    " t h

    u j n f j + 1/2

    n ! f j ! 1/2n( )

    f j n + 1 = f j

    n ! " t h

    1

    2u j

    n f j + 1/2n ! f j ! 1/2

    n( )+ u j * f j + 1/2* ! f j ! 1/2*( )( )

    f j + 1/2 = f j +

    12 amin ! f j

    + , ! f j "( ), if 12 u j + u j + 1( )> 0

    f j " 12 amin ! f j + 1

    + , ! f j + 1"( ), if 12 u j + u j + 1( )< 0

    #$%

    &%

    ! f j +

    = f j + 1 " f j ! f j "

    = f j " f j " 1

    amin a , b( )=a , a < b

    b , b ! a

    "#$

    %$

    Second order ENO scheme for the linear advection equation

    Computational Fluid Dynamics

    Second order ENO

    Re_cell=20

    ! f ! t

    +1

    2

    ! f 2

    ! x= D

    ! 2 f ! x

    2

    0 5 1 0 1 5 2 0 2 5 3 0 35 400

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    Centered

    Upwind QUICK

    Upwind

    ENO

    Computational Fluid Dynamics

    ! f ! t

    + u ! f ! x

    = 0

    Second order ENO scheme for the linear advection equation

    Upwind

    ENO

    Computational Fluid Dynamics

    Higher order

    in space

    Computational Fluid Dynamics

    Higher order nite difference approximations

    The simplest approach is to use more points:

    h h f ( x-2h) f ( x-h) f ( x) f ( x+h ) f ( x+2h )

  • 8/11/2019 2011-Lecture-23

    4/8

    Computational Fluid Dynamics

    ! f ! x

    # $

    j

    = f j %2 %8 f j %1 + 8 f j + 1 % f j + 212 h

    + O(h 4 )

    ! 2 f ! x2

    # $

    j

    =% f j %2 + 16 f j %1 % 30 f j + 16 f j + 1 % f j + 2

    12 h 2+ O(h 4 )

    Centered

    Skewed

    ! f ! x

    # $

    j

    = f j %2 %6 f j %1 + 3 f j + 2 f j + 1

    6h+ O(h 3 )

    Computational Fluid Dynamics

    Compact schemes

    Computational Fluid Dynamics

    The standard way to obtain higher orderapproximations to derivatives is to include morepoints. This can lead to very wide st encils and nearboundaries this requires a large number of ghost points outside the boundary. This can be overcome by

    compact schemes, where we derive expressionsrelating the derivatives at neighboring points to eachother and the function values.

    Compact Schemes Computational Fluid Dynamics

    By a Taylor series expansion the following forth order relationsbetween the values of f and the derivatives of f can be derived

    (1)

    (2)

    (3)

    (4)

    Adding

    f i + 1 = f i +! f i! x

    " x +! 2 f i! x2

    " x2

    2+

    ! 3 f i! x3

    " x3

    6+

    ! 4 f i! x4

    " x4

    24+ O(" x5 )

    f i # 1 = f i #! f i! x

    " x +! 2 f i! x2

    " x2

    2#

    ! 3 f i! x3

    " x3

    6+

    ! 4 f i! x4

    " x4

    24+ O(" x5 )

    !! f i + 1 + !! f i " 1 = 2 !! f i + f i

    iv# x2 + f ivi

    # x4

    12+ O(# x6 )

    f i+ 1 + f i ! 1 = 2 f i + "" f i # x

    2 + f iiv

    # x4

    12+ O(# x6 )

    Taking the second derivative:

    Eliminating the fourth derivative

    !! f i + 1 + 10 !! f i + !! f i " 1 =12

    # x 2 f i + 1 " 2 f i + f i " 1( )+ O # x4( )

    Compact Schemes

    Computational Fluid Dynamics

    By a Taylor series expansion the following forth order relationsbetween the values of f and the derivatives of f can be derived

    (1)

    (2)

    (3)

    (4)

    f i + 1 = f i +! f i! x

    " x +! 2 f i! x2

    " x2

    2+

    ! 3 f i! x3

    " x3

    6+

    ! 4 f i! x4

    " x4

    24+ O( " x5 )

    f i # 1 = f i #! f i! x

    " x +! 2 f i! x2

    " x2

    2#

    ! 3 f i! x3

    " x3

    6+

    ! 4 f i! x4

    " x4

    24+ O( " x5 )

    ! f i+ 1 + ! f i " 1 = 2 ! f i + !!! f i # x

    2 + f iiv

    # x4

    12+ O(# x6 )

    Adding and taking the rst derivative:

    Subtracting 2 from 1

    ! f i+ 1 + 4 ! f i + ! f i" 1 =3

    # x f i + 1 " f i " 1( )+ O # x4( )

    f i + 1 ! f i ! 1 = 2 " f i # x + """ f i

    # x3

    3+ O(# x5 )

    Eliminating the third derivative

    Compact Schemes Computational Fluid Dynamics

    To solve the nonlinear advection-diffusion equation

    ! f i + 1! x

    + 4 ! f i! x

    + ! f i " 1! x

    = 3# x

    f i+ 1 " f i " 1( )+ O # x 4( )

    ! 2 f i+ 1! x2

    + 10! 2 f i! x2

    +! 2 f i" 1

    ! x2 =

    12

    # x 2 f i + 1 " 2 f i + f i " 1( )+ O # x4( )

    ! f i! t

    = " f i! f i! x

    + D! 2 f i! x2

    And use the values to compute the RHS. The time integration isthen done using a high order time integration method.

    we rst solve nd the rst and second derivatives using theexpressions derived above:

    Compact Schemes

  • 8/11/2019 2011-Lecture-23

    5/8

    Computational Fluid Dynamics

    !" ! t

    =!# ! x

    !" ! y

    $ !# ! y

    !" ! x

    + % ! 2"

    ! x 2+

    ! 2" ! x 2

    ' (

    * +

    ! 2" ! x 2

    +! 2" ! x 2

    = #$

    Use compact schemes to nd O(h 4)approximations for the spatial derivatives

    Solution of the vorticity-streamfunction equations

    Computational Fluid Dynamics

    f x( )i + 1, j + 4 f x( )i, j + f x( )i! 1, j =3

    h f i + 1, j ! f i! 1, j ( )

    f y( )i, j + 1 + 4 f y( )i, j + f y( )i, j ! 1 =3

    h f i, j + 1 ! f i, j ! 1( )

    f xx( )i + 1, j + 10 f xx( )i, j + f xx( )i! 1, j =12

    h 2 f i + 1, j ! 2 f i, j + f i! 1, j ( )

    f yy( )i, j + 1 + 10 f yy( )i, j + f yy( )i, j ! 1 =12

    h 2 f i, j + 1 ! 2 f i, j + f i, j ! 1( )

    By a Taylor series expansion the following forth orderrelations between the values of f and the derivatives off can be derived

    (1)

    (2)

    (3)

    (4)

    Computational Fluid Dynamics

    !" ! t

    # $ %

    & ' (

    i, j

    =!) ! x

    # $ %

    & ' (

    i, j

    !" ! y

    $ %

    ' (

    i, j

    * !) ! y

    $ %

    ' (

    i, j

    !" ! x

    # $ %

    & ' (

    i, j

    + + ! 2"

    ! x2# $ %

    & ' (

    i, j

    +! 2" ! x2

    # $ %

    & ' (

    i, j

    #

    $ % %

    &

    ' ( (

    ! 2" ! x2

    $ %

    ' (

    i, j

    +! 2" ! y2

    $ %

    ' (

    i, j

    = )* i, j

    To nd the time derivative, we need

    The vorticity-streamfunction equations at grid point i,j are

    ! x , ! y , ! xx , ! yy , " x , " y , " xx , " yy

    (5)

    (6)

    Computational Fluid Dynamics

    1. Given the vorticity, # , we solve tridiagonalequations (1-4) for ! x , ! y , ! xx , ! yy

    ! xx , ! yy , ! 2. For " use (3) and (4) plus the elliptic equationfor the streamfunction (6) for

    ! x , ! y3. Then use 1 and 2 for (tridiagonal systems)

    !" ! t

    4. Everything on the right hand side of (5) is nowknown to O(h 4) accuracy and

    can be found

    Computational Fluid Dynamics

    The main advantage of compact schemesis that it is somewhat easier to implementboundary conditions than for high orderschemes that use a broad stencil

    Computational Fluid Dynamics

    Conservation ofkinetic energy

  • 8/11/2019 2011-Lecture-23

    6/8

    Computational Fluid Dynamics

    Conservation of kinetic energy on a centered

    regular mesh ! f ! t

    + f ! f ! x

    = 0

    E kin =1

    2 f 2 dx!

    f ! f ! t

    + f 2 ! f ! x

    " # $

    % & '

    ( dx = 0

    d dt

    1

    2 f 2! dx = " 1

    3

    # f 3

    # x! dx = 0

    Dene:

    Multiply by f and integrate

    Therefore: The kineticenergy isconserved

    Consider:

    Computational Fluid Dynamics

    ! f ! t

    = " f ! f ! x

    # " f i f i + 1 " f i" 1( )/2 h

    ! f ! t

    = "1

    2

    ! f 2

    ! x# "

    1

    2 f i + 1

    2" f i" 1

    2( )/2 h

    Consider two different discretizations of the

    nonlinear term

    and

    Both conserve f

    Is f2 conserved?

    Computational Fluid Dynamics

    Check conservation:

    = + f j ! 12 f j ! f j ! 2( )+ f j 2 f j + 1 ! f j ! 1( )+ " 0

    d dt

    1

    2 f 2! dx = " f j h2

    # f 2

    # x

    $ % &

    ' ( )

    * j

    = " 1

    2 f j f j + 1

    2 " f j "12( )+

    , - . / 0 *

    d dt

    1

    2 f 2! dx = " f j h f # f # x

    $ % &

    ' ( )

    * j

    = " f j 2 f j + 1 " f j "1( ){ }*

    = + 1

    2 f j ! 1 f j

    2! f j ! 2

    2( )+1

    2 f j f j + 1

    2! f j ! 1

    2( )+ " 0

    Second scheme:

    First scheme:

    Computational Fluid Dynamics

    Combine both schemes: ! f ! t

    " # 12 h

    $ f i f i + 1 # f i#1( )# 1 # $ ( )

    2 f i+ 1

    2 # f i#12( )

    % & '

    ( ) *

    ! f 2

    ! t dx" # $1

    2% f j

    2 f j + 1 $ f j $1( )$ 1 $ % ( )

    2 f j f j + 1

    2 $ f j $12( )

    & ' (

    ) * +

    ,

    = + ! f j "12 f j " f j " 2( )+

    1 " ! ( )2

    f j "1 f j 2 " f j " 2

    2( )+

    ! f j 2 f j + 1 " f j "1( )" 1 " ! ( )2 f j f j + 1

    2 " f j " 12( )+ = 0

    Write out the terms for the kinetic energy

    Computational Fluid Dynamics

    = + ! f j "12 f j " f j "1

    2 f j " 2( )+1 " ! ( )

    2 f j " 1 f j

    2 " f j "1 f j " 22( )+

    ! f j 2 f j + 1 " f j

    2 f j " 1( )" 1 " ! ( )

    2 f j f j + 1

    2 " f j f j " 12( )+ = 0

    ! " 1 " ! ( )2

    = 0

    3 ! " 12

    = 0

    ! =1

    3

    ! f ! t

    " # 16 h

    f i f i+ 1 # f i#1( )# f i + 12 # f i#1

    2( ){ }

    = # 12 h

    f i + 1 + f i + f i#13

    f i + 1 # f i#1( )$ % &

    ' ( )

    Conserves both f and f 2

    Computational Fluid Dynamics

    The same idea is used in Arakawa s scheme(JCP 119, 1966)

    !"

    ! t + u # $ " = 0

    u ! " # = $%& % y

    %# % x

    +%& % x

    %# % y

    = J & , # ( )

    !" ! t

    + J # ," ( )= 0

    Consider the vorticity advection equation

    Rewrite the nonlinear terms to introduce the Jacobian

    giving

  • 8/11/2019 2011-Lecture-23

    7/8

    Computational Fluid Dynamics

    J ! , " ( ) = #! # x

    #" # y

    $#! # y

    #" # x

    =# # x

    ! #" # y

    % & '

    ( ) *

    $ # # y

    ! #" # x

    % & '

    ( ) *

    =# # y

    " #! # x

    % & '

    ( ) *

    $ # # x

    " #! # y

    % & '

    ( ) *

    ! ! x

    " !# ! y

    % &

    ( )

    =!" ! x

    !# ! y

    *" ! 2#

    ! x! y

    since

    and so on

    The Jacobian can be written in several ways

    Computational Fluid Dynamics

    J ! , " ( ) = # J " , ! ( )

    we also have

    J ! , " ( ) =#! # x

    #" # y

    $ #! # y

    #" # x

    = $ #" # x

    #! # y

    $ #" # y

    #! # x

    & '

    ) *

    since

    Discretization of the different forms ofthe Jacobian give schemes with slightlydifferent conservation properties

    Computational Fluid Dynamics

    J i, j 1

    =1

    4 h 2 ! i + 1, j " ! i"1, j ( )# i, j + 1 " # i, j "1( ){" ! i, j + 1 " ! i, j "1( )# i+ 1, j " # i"1, j ( )}

    Discretization

    J i, j 2

    =1

    4 h 2 ! i + 1, j " i + 1, j + 1 # " i + 1, j #1( ){ # ! i#1, j " i#1, j + 1 # " i#1, j #1( )# ! i, j + 1 " i + 1, j + 1 # " i#1, j + 1( )# ! i, j #1 " i + 1, j #1 # " i#1, j #1( )}

    J i, j 3

    =1

    4 h 2 !" i + 1, j # i + 1, j + 1 ! # i+ 1, j ! 1( ){ + " i! 1, j # i! 1, j + 1 ! # i! 1, j ! 1( )+ " i, j + 1 # i + 1, j + 1 ! # i! 1, j + 1( )! " i, j ! 1 # i+ 1, j ! 1 ! # i! 1, j ! 1( )}

    Computational Fluid Dynamics

    Arakawa showed that

    Conserves both the vorticity and the kinetic energy

    J i, j 1

    =1

    3 J i, j

    1+ J i, j

    2+ J i, j

    3( )

    Arakawa also presented a fourth order scheme withthe same properties

    Computational Fluid Dynamics

    Higher order

    in time for the vorticity-streamfunctionformulation

    Computational Fluid Dynamics

    Due to the relatively straightforward couplingbetween the elliptic equation for thestreamfunction and the vorticity advection-diffusion equation, the algorithms discussedalready can be used with ease.

  • 8/11/2019 2011-Lecture-23

    8/8

    Computational Fluid Dynamics

    ! i, j n+

    1 " ! i, j n"

    1

    2# t = " J i, j

    n + $ %h2

    ! i, j n " 1

    Leapfrog

    ! i, j n + 1 " !

    i, j n

    # t = "

    1

    23 J i, j

    n " J i, j n " 1( )+

    $

    2%

    h2

    ! i, j n + 1 + %

    h2

    ! i, j n( )

    Adams-Bashford/Crank-Nicholson

    Predictor-corrector

    ! i, j n + 1 " ! i, j

    # t = "

    1

    2 J i, j

    n + J i, j ( )+$

    2%

    h2

    ! i, j n + %

    h2 ! i, j ( )

    ! i, j " ! i, j n

    # t = " J i, j

    n + $ %h2

    ! i, j n

    Computational Fluid Dynamics

    2nd order Runge-Kutta

    ! i, j = ! i, j n +

    " t 2

    # J i, j n + $ %

    h2

    ! i, j n( )

    Runge Kutta methods: take intermidiate steps

    !h2" i, j

    n= # $ i, j

    n

    !h2 " i, j = # $ i, j

    ! i, j = ! i, j n + " t # J i, j + $ % h

    2 ! i, j ( )

    Half step

    Final step

    Computational Fluid Dynamics

    4th order Runge-Kutta method

    ! i, j n + 1/ 2 = !

    i, j n +

    " t 2

    # J i, j n + $ %

    h2

    ! i, j n( )

    !h2" i, j

    n= # $ i, j

    n

    !h2 " i, j

    n + 1/ 2 = # $ i, j n + 1/ 2

    ! i, j n+ 1 = !

    i, j n + " t # J i, j

    n + 1/ 2 + $ %h2 ! i, j n

    + 1/ 2( )

    First half step

    Predicted

    nal value

    !h2 " i, j

    n + 1/ 2 = # $ i, j n + 1/ 2

    ! i, j n + 1/ 2 = !

    i, j n +

    " t 2

    # J i, j n + 1/ 2 + $ %

    h2 ! i, j

    n + 1/ 2( )Second half step

    Computational Fluid Dynamics

    4th order Runge-Kutta method (continued)

    ! i, j n + 1 = !

    i, j n +

    " t 6

    # J i, j n # 2 J i, j

    n + 1/ 2 # 2 J i, j n + 1/ 2 # J i, j

    n + 1(+ $ %

    h2

    ! i, j n + 2$ % h

    2 ! i, j n + 1/ 2 + 2$ % h

    2 ! i, j n + 1/ 2 + $ %

    h2 ! i, j

    n + 1)

    correctednal value

    !h2 " i, j

    n + 1 = # $ i, j n + 1

    t

    t + ! t

    t + ! t /2

    Computational Fluid Dynamics

    Generating higher order methods for theNavier-Stokes equations in the vorticity/ streamfunction form is relatively straightforward and any method developed for theadvection diffusion equation can be usedwithout much difculty

    Computational Fluid Dynamics

    Other Methods for the Navier-Stokes Equations:Articial Compressibility & SIMPLE

    Higher Order Advection QUICK & ENO

    Higher order in space

    Compact schemes

    Conservation of energy

    Higher order in time for

    the " -# formulation

    Outline