Lecture # 03 CFD Techniques and Properties of Numerial Solut

download Lecture # 03 CFD Techniques and Properties of Numerial Solut

of 18

Transcript of Lecture # 03 CFD Techniques and Properties of Numerial Solut

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    1/18

    Time-stepping techniques

    Unsteady flows are parabolic in time use time-stepping methods to

    advance transient solutions step-by-step or to compute stationary solutions

    time

    space

    zone of influence

    dependencedomain of

    future

    resent

    past

    Initial-boundary value problem u = u(x, t)

    ut + Lu = f in (0, T) time-dependent PDE

    Bu = 0 on (0, T) boundary conditions

    u = u0 in at t = 0 initial condition

    Time discretization 0 = t0

    < t1

    < t2

    < . . . < tM = T u0

    u0 in

    Consider a short time interval (tn, tn+1) , where tn+1 = tn + t

    Given un u(tn) use it as initial condition to compute un+1 u(tn+1)

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 1

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    2/18

    Space-time discretization

    Space discretization: finite differences / finite volumes / finite elements

    Unknowns: ui(t) time-dependent nodal values / cell mean values

    Time discretization: (i) before or (ii) after the discretization in space

    The space and time variables are essentially decoupled and can be discretized

    independently to obtain a sequence of (nonlinear) algebraic systems

    A(un+1, un)un+1 = b(un) n = 0, 1, . . . , M 1

    Method of lines (MOL) L Lh yields an ODE system for ui(t)

    duhdt + Lhuh = fh on (tn, tn+1) semi-discretized equations

    FEM approximation uh(x, t) =Nj=1

    uj(t)j(x), uni u(xi, t

    n)

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 2

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    3/18

    Properties of time-stepping schemes

    Time discretization tn = nt, t = TM M =Tt

    Accumulation of truncation errors n = 0, . . . , M 1

    loc = O(t)p

    glob = M loc = O(t)

    p1

    Remark. The order of a time-stepping method (i.e., the asymptotic rate at

    which the error is reduced as t 0) is not the sole indicator of accuracy

    The optimal choice of the time-stepping scheme depends on its purpose:

    to obtain a time-accurate discretization of a highly dynamic flow problem

    (evolution details are essential and must be captured) or

    to march the numerical solution to a steady state starting with some

    reasonable initial guess (intermediate results are immaterial)

    The computational cost of explicit and implicit schemes differs considerably

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 3

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    4/18

    Explicit vs. implicit time discretization

    Pros and cons of explicit schemes

    easy to implement and parallelize, low cost per time step

    a good starting point for the development of CFD software

    small time steps are required for stability reasons, especially

    if the velocity and/or mesh size are varying strongly

    extremely inefficient for solution of stationary problems unless

    local time-stepping i. e. t = t(x

    ) is employed

    Pros and cons of implicit schemes

    stable over a wide range of time steps, sometimes unconditionally

    constitute excellent iterative solvers for steady-state problems

    difficult to implement and parallelize, high cost per time step

    insufficiently accurate for truly transient problems at large t

    convergence of linear solvers deteriorates/fails as t increases

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 4

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    5/18

    Predictor-corrector and multipoint methods

    Objective: to combine the simplicity of explicit schemes and robustness of

    implicit ones in the framework of a fractional-step algorithm, e.g.,

    1. Predictor un+1 = un + f(tn, un)t forward Euler

    2. Corrector un+1 = un + 12

    [f(tn, un) + f(tn+1, un+1)]t Crank-Nicolson

    or un+1 = un + f(tn+1, un+1)t backward Euler

    Remark. Stability still leaves a lot to be desired, additional correction steps

    usually do not pay off since iterations may diverge if t is too large

    Order barrier: two-level methods are at most second-order accurate, so

    extra points are needed to construct higher-order integration schemes

    Adams methods tn+1, . . . , tnm, m = 0, 1, . . .

    Runge-Kutta methods tn+ [tn, tn+1], [0, 1]

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 5

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    6/18

    Adams methods

    Derivation: polynomial fitting

    Truncation error: glob = O(t)p

    for polynomials of degree p

    1 whichinterpolate function values at p points

    Adams-Bashforth methods (explicit)

    p = 1 un+1 = un + tf(tn, un) forward Euler

    p = 2 un+1 = un + t2

    [3f(tn, un) f(tn1, un1)]

    p = 3 un+1 = un + t12

    [23f(tn, un) 16f(tn1, un1) + 5f(tn2, un2)]

    Adams-Moulton methods (implicit)

    p = 1 un+1 = un + tf(tn+1, un+1) backward Euler

    p = 2 un+1 = un + t2

    [f(tn+1, un+1) + f(tn, un)] Crank-Nicolson

    p = 3 un+1 = un + t12

    [5f(tn+1, un+1) + 8f(tn, un) f(tn1, un1)]

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 6

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    7/18

    Adams methods

    Predictor-corrector algorithm

    1. Compute un+1 using an Adams-Bashforth method of order p 1

    2. Compute un+1 using an Adams-Moulton method of order p with

    predicted value f(tn+1, un+1) instead of f(tn+1, un+1)

    Pros and cons of Adams methods

    methods of any order are easy to derive and implement

    only one function evaluation per time step is performed

    error estimators for ODEs can be used to adapt the order

    other methods are needed to start/restart the calculation

    time step is difficult to change (coefficients are different)

    tend to be unstable and produce nonphysical oscillations

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 7

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    8/18

    Runge-Kutta methods

    Multipredictor-multicorrector algorithms of order p

    p = 2 un+1/2 = un + t2

    f(tn, un) forward Euler / predictor

    un+1 = un + tf(tn+1/2, un+1/2) midpoint rule / corrector

    p = 4 un+1/2 = un + t2

    f(tn, un) forward Euler / predictor

    un+1/2

    = un

    +t2 f(t

    n+1/2

    , un+1/2

    ) backward Euler / corrector

    un+1 = un + tf(tn+1/2, un+1/2) midpoint rule / predictor

    un+1 = un + t6

    [f(tn, un) + 2f(tn+1/2, un+1/2) Simpson rule

    + 2f(tn+1/2, un+1/2) + f(tn+1, un+1)] corrector

    Remark. There exist embedded Runge-Kutta methods which perform extra

    steps in order to estimate the error and adjust t in an adaptive fashion

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 8

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    9/18

    General comments

    Pros and cons of Runge-Kutta methods

    self-starting, easy to operate with variable time steps

    more stable and accurate than Adams methods of the same order

    high order approximations are rather difficult to derive; p function

    evaluations per time step are required for a pth order method

    more expensive than Adams methods of comparable order

    Adaptive time-stepping strategy t t t t t t t t

    makes it possible to achieve the desired accuracy at a relatively low cost

    Explicit methods: use the largest time step satisfying the stability condition

    Implicit methods: estimate the error and adjust the time step if necessary

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 9

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    10/18

    Lax-Wendroff time-stepping

    Consider a time-dependent PDE ut

    + Lu = 0 in (0, T)

    1. Discretize it in time by means of the Taylor series expansion

    un+1 = un + t

    u

    t

    n+

    (t)2

    2

    2u

    t2

    n+O(t)3

    2. Transform time derivatives into space derivatives using the PDE

    u

    t= Lu,

    2u

    t2=

    t

    u

    t

    =

    t(Lu) = L

    u

    t= L2u

    3. Substitute the resulting expressions into the Taylor series

    un+1 = un tLun + (t)2

    2L2un +O(t)3

    4. Perform space discretization using finite differences/volumes/elements

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 10

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    11/18

    Lax-Wendroff scheme for pure convection

    Example. Pure convection equation ut

    + v ux

    = 0 (1D case)

    Time derivatives L = v x

    u

    t= v u

    x,

    2u

    t2= v2

    2u

    x2

    Semi-discrete scheme un+1 = un vtu

    x

    n+ (vt)

    2

    2

    2u

    x2

    n+O(t)3

    Central difference approximation in space

    ux

    i = u

    i+1ui1

    2x +O(x)2,2

    ux2

    i

    = ui+12ui+ui1(x)2 +O(x)2

    Fully discrete scheme (second order in space and time)

    un+1i

    uni

    t + v

    uni+1 u

    ni1

    2x =

    v2t

    2

    uni+1 2u

    ni

    + uni1

    (x)2 +O

    [(t)

    2

    , (x)

    2

    ]

    Remark. LW/CDS is equivalent to FE/CDS stabilized by numerical dissipation

    due to the second-order term in the Taylor series (no adjustable parameter)

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 11

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    12/18

    Properties of numerical methods

    The following criteria are crucial to the performance of a numerical algorithm:

    1. Consistency The discretization of a PDE should become exact as the

    mesh size tends to zero (truncation error should vanish)

    2. Stability Numerical errors which are generated during the solution

    of discretized equations should not be magnified

    3. Convergence The numerical solution should approach the exact solution ofthe PDE and converge to it as the mesh size tends to zero

    4. Conservation Underlying conservation laws should be respected at the

    discrete level (artificial sources/sinks are to be avoided)

    5. Boundedness Quantities like densities, temperatures, concentrations etc.

    should remain nonnegative and free of spurious wiggles

    These properties must be verified for each (component of the) numerical scheme

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 12

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    13/18

    Consistency

    Relationship: discretized equation differential equation

    Truncation errors should vanish as the mesh size and time step tend to zero

    Example. Pure convection equation ut

    + v ux

    = 0 discretized by

    CDS in space, FE in time:un+1i u

    ni

    t+v

    uni+1 uni1

    2x= O[(t)q, (x)p]

    Taylor series expansions: un+1

    i = un

    i + tutni +

    (t)2

    22ut2

    ni + . . .

    uni1 = uni x

    ux

    ni

    + (x)2

    2

    2ux2

    ni

    (x)3

    6

    3ux3

    ni

    + . . .

    Hence,un+1

    iun

    i

    t + vuni+1u

    n

    i1

    2x ut

    + v ux

    n

    i+ = 0 where

    = t

    2

    2u

    t2

    ni

    v(x)2

    6

    3u

    x3

    ni

    +O[(t)2, (x)4]

    residual of the difference scheme for the exact nodal values umj = u(jx, mt)

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 13

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    14/18

    Stability

    Relationship:numerical solution ofdiscretized equations

    exact solution of

    discretized equations

    Definition 1 Numerical errors (roundoff due to final precision of computers)should not be allowed to grow unboundedly

    Definition 2 The numerical solution itself should remain uniformly bounded

    Stability analysis: can only be performed for a very limited range problems

    Matrix method: Aun+1 = Bun un+1 = Cun, where C = A1B

    is assumed to be a linear operator. In practice un = un + en so that

    un+1 = Cun for the numerical solution un of the discretized equations

    un+1 = Cun for the exact solution un of the discretized equations

    en+1 = Cen for the roundoff error en incurred in the solution process

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 14

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    15/18

    Convergence

    Relationship:numerical solution ofdiscretized equations

    exact solution of thedifferential equation

    Definition: A numerical scheme is said to be convergent if it produces theexact solution of the underlying PDE in the limit h 0 a n d t 0

    Lax equivalence theorem: stability + consistency = convergence

    For practical purposes, convergence can be investigated numerically by

    comparing the results computed on a series of successively refined grids

    The rate of convergence is governed by the leading truncation error of

    the discretization scheme and can also be estimated numerically:

    u = uh + e(u)hp

    + . . . = u2h + e(u)(2h)p

    + . . . = u4h + e(u)(4h)p

    + . . .

    u2h uh e(u)hp(1 2p)

    u4h u2h e(u)hp(1 2p)2p

    p log

    u4hu2hu2huh

    log2

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 15

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    16/18

    Conservation

    Physical principles should apply at the discrete level: if mass, momentum

    and energy are conserved, they can only be distributed improperly

    Integral form of a generic conservation law

    t

    V

    u dV +

    S

    f n dS =

    V

    qdV, f = vu du

    accumulation influx source/sink flux function

    Caution: nonconservative discretizations may produce reasonably looking

    results which are totally wrong (e.g. shocks moving with a wrong speed)

    even nonconservative schemes can be consistent and stable

    correct solutions are recovered in the limit of very fine grids

    Problem: it is usually unclear whether or not the mesh is sufficiently fine

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 16

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    17/18

    Boundedness

    Convection-dominated / hyperbolic PDEs P e 1, Re 1

    spurious undershoots and overshoots occur in the vicinity of steep gradients

    quantities like densities, temperatures and concentrations become negative

    the method may become unstable or converge to a wrong weak solution

    0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

    0

    0.2

    0.4

    0.6

    0.8

    1

    low-order

    high-order

    0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

    0

    0.2

    0.4

    0.6

    0.8

    1

    Idea: make sure that important properties of the exact solution (monotonicity,

    positivity, nonincreasing total variation) are inherited by the numerical one

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 17

  • 8/9/2019 Lecture # 03 CFD Techniques and Properties of Numerial Solut

    18/18

    Analysis of numerical dissipation and dispersion

    Modified equation method: the exact solution of the discretized equations

    satisfies a PDE which is generally different from the one to be solved

    Original PDE Modified equation Aun+1 = Bun

    u

    t+ Lu = 0

    u

    t+ Lu =

    p=1

    2p2pu

    x2p+

    p=1

    2p+12p+1u

    x2p+1

    Motivation: PDEs are difficult or impossible to solve analytically but their

    qualitative behavior is easier to predict than that of discretized equations

    Expand all nodal values in the difference scheme in a double Taylor series

    about a single point (xi, tn

    ) of the space-time mesh to obtain a PDE Express high-order time derivatives as well as mixed derivatives in terms

    of space derivatives using this PDE to transform it into the desired form

    Lecture # 03 CFD Techniques and Properties of Numerical Solution

    JetWings 18