6559148 Fundamentals of CFD

Embed Size (px)

Citation preview

  • 7/30/2019 6559148 Fundamentals of CFD

    1/512

    Fundamentals of Computational FluidDynamicsHarvard Lomax and Thomas H. PulliamNASA Ames Research CenterDavid W. ZinggUniversity of Toronto Institute for Aerospace StudiesAugust 26, 1999Contents1 INTRODUCTION 11.1 Motivation . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . 1

    1.2 Background . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . 2

    1.2.1 Problem Specication and Geometry Preparation . . . . . .. 21.2.2 Selection of Governing Equations and Boundary Conditions . 31.2.3 Selection of Gridding Strategy and Numerical Method . . . .3

    1.2.4 Assessment and Interpretation of Results . . . . . . .. . . . . 4

    1.3 Overview . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . 4

    1.4 Notation . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . 52 CONSERVATION LAWS AND THE MODEL EQUATIONS 72.1 Conservation Laws . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . 72.2 The Navier-Stokes and Euler Equations . . . . . . . .. . . . . . . . . 82.3 The Linear Convection Equation . . . . . . . . . .. . . . . . . . . . 12

    2.3.1 Dierential Form . . . . . . . . . . . . . .. . . . . . . . . . . 122.3.2 Solution in Wave Space . . . . . . . . . . . .. . . . . . . . . . 132.4 The Diusion Equation . . . . . . . . . . . . .

    . . . . . . . . . . . . . 142.4.1 Dierential Form . . . . . . . . . . . . . .. . . . . . . . . . . 142.4.2 Solution in Wave Space . . . . . . . . . . . .. . . . . . . . . . 152.5 Linear Hyperbolic Systems . . . . . . . . . . . .

    . . . . . . . . . . . . 162.6 Problems . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . 173 FINITE-DIFFERENCE APPROXIMATIONS 213.1 Meshes and Finite-Dierence Notation . . . . . . . . .. . . . . . . . 213.2 Space Derivative Approximations . . . . . . . . . .

    . . . . . . . . . . 243.3 Finite-Dierence Operators . . . . . . . . . . . .. . . . . . . . . . . 253.3.1 Point Dierence Operators . . . . . . . . . . .. . . . . . . . . 253.3.2 Matrix Dierence Operators . . . . . . . . . . .. . . . . . . . 253.3.3 Periodic Matrices . . . . . . . . . . . . .. . . . . . . . . . . . 293.3.4 Circulant Matrices . . . . . . . . . . . . .

  • 7/30/2019 6559148 Fundamentals of CFD

    2/512

    . . . . . . . . . . . 30iii3.4 Constructing Dierencing Schemes of Any Order . . . . . . .. . . . . 31

    3.4.1 Taylor Tables . . . . . . . . . . . . . .. . . . . . . . . . . . . 313.4.2 Generalization of Dierence Formulas . . . . . . . . .. . . . . 34

    3.4.3 Lagrange and Hermite Interpolation Polynomials . . . . . .. 35

    3.4.4 Practical Application of Pade Formulas . . . . . . . .. . . . . 373.4.5 Other Higher-Order Schemes . . . . . . . . . . .. . . . . . . . 383.5 Fourier Error Analysis . . . . . . . . . . . .. . . . . . . . . . . . . . 393.5.1 Application to a Spatial Operator . . . . . . . . .. . . . . . . 39

    3.6 Dierence Operators at Boundaries . . . . . . . . . .. . . . . . . . . 43

    3.6.1 The Linear Convection Equation . . . . . . . . .. . . . . . . 443.6.2 The Diusion Equation . . . . . . . . . . . . .. . . . . . . . . 46

    3.7 Problems . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . 474 THE SEMI-DISCRETE APPROACH 514.1 Reduction of PDEs to ODEs . . . . . . . . . . .. . . . . . . . . . . 524.1.1 The Model ODEs . . . . . . . . . . . . . .. . . . . . . . . . 52

    4.1.2 The Generic Matrix Form . . . . . . . . . . .. . . . . . . . . 534.2 Exact Solutions of Linear ODEs . . . . . . . . . .. . . . . . . . . . 544.2.1 Eigensystems of Semi-Discrete Linear Forms . . . . . .. . . . 54

    4.2.2 Single ODEs of First- and Second-Order . . . . . . . .. . . . 554.2.3 Coupled First-Order ODEs . . . . . . . . . . . .

    . . . . . . . 574.2.4 General Solution of Coupled ODEs with Complete Eigensystems 594.3 Real Space and Eigenspace . . . . . . . . . . . .

    . . . . . . . . . . . . 614.3.1 Denition . . . . . . . . . . . . . . . .. . . . . . . . . . . . . 61

    4.3.2 Eigenvalue Spectrums for Model ODEs . . . . . . . . .. . . . 62

    4.3.3 Eigenvectors of the Model Equations . . . . . . . .. . . . . . 63

    4.3.4 Solutions of the Model ODEs . . . . . . . . . .. . . . . . . . 654.4 The Representative Equation . . . . . . . . . . .. . . . . . . . . . . 67

    4.5 Problems . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . 68

    5 FINITE-VOLUME METHODS 715.1 Basic Concepts . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . 725.2 Model Equations in Integral Form . . . . . . . . . .

  • 7/30/2019 6559148 Fundamentals of CFD

    3/512

    . . . . . . . . . . 735.2.1 The Linear Convection Equation . . . . . . . . .. . . . . . . 735.2.2 The Diusion Equation . . . . . . . . . . . . .. . . . . . . . . 745.3 One-Dimensional Examples . . . . . . . . . . . .. . . . . . . . . . . 745.3.1 A Second-Order Approximation to the Convection Equation . 755.3.2 A Fourth-Order Approximation to the Convection Equation . 775.3.3 A Second-Order Approximation to the Diusion Equation . . 785.4 A Two-Dimensional Example . . . . . . . . . . . .

    . . . . . . . . . . 805.5 Problems . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . 836 TIME-MARCHING METHODS FOR ODES 856.1 Notation . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 866.2 Converting Time-Marching Methods to OEs . . . . . . . .. . . . . 876.3 Solution of Linear OEs With Constant Coecients . . . . . .. . . 886.3.1 First- and Second-Order Dierence Equations . . . . . . .

    . . 896.3.2 Special Cases of Coupled First-Order Equations . . . . .

    . . . 906.4 Solution of the Representative OEs . . . . . . . . .. . . . . . . . 916.4.1 The Operational Form and its Solution . . . . . . . .. . . . . 91

    6.4.2 Examples of Solutions to Time-Marching OEs . . . . . . .. 926.5 The Relation . . . . . . . . . . . . . . .. . . . . . . . . . . . . 93

    6.5.1 Establishing the Relation . . . . . . . . . . . .. . . . . . . . . 93

    6.5.2 The Principal

    Root . . . . . . . . . . . . .. . . . . . . . . . 95

    6.5.3 Spurious

    Root

    . . . . . . . . . . . . . .. . . . . . . . . . . 956.5.4 One-Root Time-Marching Methods . . . . . . . . . .. . . . . 96

    6.6 Accuracy Measures of Time-Marching Methods . . . . . . .. . . . . 97

    6.6.1 Local and Global Error Measures . . . . . . . . .. . . . . . . 976.6.2 Local Accuracy of the Transient Solution (er, || , er) . . . . 98

    6.6.3 Local Accuracy of the Particular Solution (er) . . . . . . . . 996.6.4 Time Accuracy For Nonlinear Applications . . . . . . .. . . . 1006.6.5 Global Accuracy . . . . . . . . . . . . . .. . . . . . . . . . . 101

    6.7 Linear Multistep Methods . . . . . . . . . . . .. . . . . . . . . . . . 102

    6.7.1 The General Formulation . . . . . . . . . . . .

  • 7/30/2019 6559148 Fundamentals of CFD

    4/512

    . . . . . . . . . 1026.7.2 Examples . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . 1036.7.3 Two-Step Linear Multistep Methods . . . . . . . . .. . . . . 105

    6.8 Predictor-Corrector Methods . . . . . . . . . . .. . . . . . . . . . . . 1066.9 Runge-Kutta Methods . . . . . . . . . . . . .. . . . . . . . . . . . . 1076.10 Implementation of Implicit Methods . . . . . . . . . .

    . . . . . . . . . 1106.10.1 Application to Systems of Equations . . . . . . . .. . . . . . 110

    6.10.2 Application to Nonlinear Equations . . . . . . . .. . . . . . . 1116.10.3 Local Linearization for Scalar Equations . . . . . . .. . . . . 112

    6.10.4 Local Linearization for Coupled Sets of Nonlinear Equations .1156.11 Problems . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 1177 STABILITY OF LINEAR SYSTEMS 1217.1 Dependence on the Eigensystem . . . . . . . . . .. . . . . . . . . . . 122

    7.2 Inherent Stability of ODEs . . . . . . . . . . .. . . . . . . . . . . . 1237.2.1 The Criterion . . . . . . . . . . . . . .. . . . . . . . . . . . . 1237.2.2 Complete Eigensystems . . . . . . . . . . . . .

    . . . . . . . . . 1237.2.3 Defective Eigensystems . . . . . . . . . . . .. . . . . . . . . . 1237.3 Numerical Stability of OE s . . . . . . . . . . .. . . . . . . . . . . 1247.3.1 The Criterion . . . . . . . . . . . . . .. . . . . . . . . . . . . 1247.3.2 Complete Eigensystems . . . . . . . . . . . . .

    . . . . . . . . . 1257.3.3 Defective Eigensystems . . . . . . . . . . . .. . . . . . . . . . 1257.4 Time-Space Stability and Convergence of OEs . . . . . . .. . . . . 1257.5 Numerical Stability Concepts in the Complex

    P

    ane . . . . .. . . . 1287.5.1

    Root Traces Relative to the Unit Circle . . . . . . .. . . . 1287.5.2 Stability for Small t . . . . . . . . . . . . .. . . . . . . . . . 132

    7.6 Numerical Stability Concepts in the Complex h Plane . . . .. . . . 135

    7.6.1 Stability for Large h. . . . . . . . . . . . .. . . . . . . . . . . 135

    7.6.2 Unconditional Stability, A-Stable Methods . . . . . . .. . . . 1367.6.3 Stability Contours in the Complex h Plane. . . . . . .. . . . 1377.7 Fourier Stability Analysis . . . . . . . . . . . .

    . . . . . . . . . . . . 1417.7.1 The Basic Procedure . . . . . . . . . . . .. . . . . . . . . . . 141

  • 7/30/2019 6559148 Fundamentals of CFD

    5/512

    7.7.2 Some Examples . . . . . . . . . . . . . .. . . . . . . . . . . . 1427.7.3 Relation to Circulant Matrices . . . . . . . . . .. . . . . . . . 1437.8 Consistency . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . 1437.9 Problems . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . 1468 CHOICE OF TIME-MARCHING METHODS 1498.1 Stiness Denition for ODEs . . . . . . . . . . . .. . . . . . . . . . 1498.1.1 Relation to

    Eigenva

    ue

    . . . . . . . . . . . .. . . . . . . . 149

    8.1.2 Driving and Parasitic Eigenvalues . . . . . . . . .. . . . . . . 151

    8.1.3 Stiness Classications . . . . . . . . . . . . .. . . . . . . . . 151

    8.2 Relation of Stiness to Space Mesh Size . . . . . . . .. . . . . . . . 152

    8.3 Practical Considerations for Comparing Methods . . . . . .. . . . . 1538.4 Comparing the Eciency of Explicit Methods . . . . . . .. . . . . . 1548.4.1 Imposed Constraints . . . . . . . . . . . . .

    . . . . . . . . . . 1548.4.2 An Example Involving Diusion . . . . . . . . . .. . . . . . . 1548.4.3 An Example Involving Periodic Convection . . . . . . .. . . . 155

    8.5 Coping With Stiness . . . . . . . . . . . . .. . . . . . . . . . . . . 1588.5.1 Explicit Methods . . . . . . . . . . . . . .

    . . . . . . . . . . . 1588.5.2 Implicit Methods . . . . . . . . . . . . . .

    . . . . . . . . . . . 1598.5.3 A Perspective . . . . . . . . . . . . . .. . . . . . . . . . . . . 160

    8.6 Steady Problems . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 1608.7 Problems . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . 1619 RELAXATION METHODS 1639.1 Formulation of the Model Problem . . . . . . . . .. . . . . . . . . . 1649.1.1 Preconditioning the Basic Matrix . . . . . . . . .. . . . . . . 1649.1.2 The Model Equations . . . . . . . . . . . . .

    . . . . . . . . . . 1669.2 Classical Relaxation . . . . . . . . . . . . .. . . . . . . . . . . . . . 168

    9.2.1 The Delta Form of an Iterative Scheme . . . . . . .. . . . . . 1689.2.2 The Converged Solution, the Residual, and the Error . . . .

    . 1689.2.3 The Classical Methods . . . . . . . . . . . .. . . . . . . . . . 1699.3 The ODE Approach to Classical Relaxation . . . . . . .. . . . . . . 1709.3.1 The Ordinary Dierential Equation Formulation . . . . . .. . 170

  • 7/30/2019 6559148 Fundamentals of CFD

    6/512

    9.3.2 ODE Form of the Classical Methods . . . . . . . . .. . . . . 172

    9.4 Eigensystems of the Classical Methods . . . . . . . .. . . . . . . . . 1739.4.1 The Point-Jacobi System . . . . . . . . . . . .

    . . . . . . . . . 1749.4.2 The Gauss-Seidel System . . . . . . . . . . . .

    . . . . . . . . . 1769.4.3 The SOR System . . . . . . . . . . . . . .. . . . . . . . . . . 180

    9.5 Nonstationary Processes . . . . . . . . . . . .. . . . . . . . . . . . . 1829.6 Problems . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . 18710 MULTIGRID 19110.1 Motivation . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . 19110.1.1 Eigenvector and Eigenvalue Identication with Space Frequencies19110.1.2 Properties of the Iterative Method . . . . . . . .. . . . . . . 192

    10.2 The Basic Process . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 192

    10.3 A Two-Grid Process . . . . . . . . . . . . .. . . . . . . . . . . . . . 200

    10.4 Problems . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 20211 NUMERICAL DISSIPATION 20311.1 One-Sided First-Derivative Space Dierencing . . . . . . .. . . . . . 204

    11.2 The Modied Partial Dierential Equation . . . . . . . .. . . . . . . 20511.3 The Lax-Wendro Method . . . . . . . . . . . . .

    . . . . . . . . . . . 20711.4 Upwind Schemes . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 20911.4.1 Flux-Vector Splitting . . . . . . . . . . . .. . . . . . . . . . . 210

    11.4.2 Flux-Dierence Splitting . . . . . . . . . . . .. . . . . . . . . 21211.5 Articial Dissipation . . . . . . . . . . . . .. . . . . . . . . . . . . . 21311.6 Problems . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 21412 SPLIT AND FACTORED FORMS 21712.1 The Concept . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . 217

    12.2 Factoring Physical Representations Time Splitting . . . . .. . . . 218

    12.3 Factoring Space Matrix Operators in 2D . . . . . . . .. . . . . . . . 220

    12.3.1 Mesh Indexing Convention . . . . . . . . . . .. . . . . . . . . 22012.3.2 Data Bases and Space Vectors . . . . . . . . . .

    . . . . . . . . 22112.3.3 Data Base Permutations . . . . . . . . . . . .

    . . . . . . . . . 22112.3.4 Space Splitting and Factoring . . . . . . . . . .

    . . . . . . . . 22312.4 Second-Order Factored Implicit Methods . . . . . . . .. . . . . . . . 226

  • 7/30/2019 6559148 Fundamentals of CFD

    7/512

    12.5 Importance of Factored Forms in 2 and 3 Dimensions . . .. . . . . . 22612.6 The Delta Form . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . 22812.7 Problems . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 22913 LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS 23313.1 The Representative Equation for Circulant Operators . . . .. . . . . 233

    13.2 Example Analysis of Circulant Systems . . . . . . . .. . . . . . . . . 234

    13.2.1 Stability Comparisons of Time-Split Methods . . . . . .. . . 23413.2.2 Analysis of a Second-Order Time-Split Method . . . . .. . . 23713.3 The Representative Equation for Space-Split Operators . . . .

    . . . . 23813.4 Example Analysis of 2-D Model Equations . . . . . . .. . . . . . . . 24213.4.1 The Unfactored Implicit Euler Method . . . . . . . .

    . . . . . 24213.4.2 The Factored Nondelta Form of the Implicit Euler Method . .24313.4.3 The Factored Delta Form of the Implicit Euler Method . . .

    . 24313.4.4 The Factored Delta Form of the Trapezoidal Method . . . .

    . 24413.5 Example Analysis of the 3-D Model Equation . . . . . .. . . . . . . 24513.6 Problems . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 247A USEFUL RELATIONS AND DEFINITIONS FROM LINEAR AL-GEBRA 249A.1 Notation . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 249A.2 Denitions . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . 250

    A.3 Algebra . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 251A.4 Eigensystems . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . 251A.5 Vector and Matrix Norms . . . . . . . . . . . .

    . . . . . . . . . . . . 254B SOME PROPERTIES OF TRIDIAGONAL MATRICES 257B.1 Standard Eigensystem for Simple Tridiagonals . . . . . .. . . . . . . 257B.2 Generalized Eigensystem for Simple Tridiagonals . . . . . .. . . . . . 258B.3 The Inverse of a Simple Tridiagonal . . . . . . . .. . . . . . . . . . . 259

    B.4 Eigensystems of Circulant Matrices . . . . . . . . .. . . . . . . . . . 260B.4.1 Standard Tridiagonals . . . . . . . . . . . .. . . . . . . . . . 260B.4.2 General Circulant Systems . . . . . . . . . . .. . . . . . . . . 261B.5 Special Cases Found From Symmetries . . . . . . . . .. . . . . . . . 262

    B.6 Special Cases Involving Boundary Conditions . . . . . . .. . . . . . 263

  • 7/30/2019 6559148 Fundamentals of CFD

    8/512

    C THE HOMOGENEOUS PROPERTYOF THE EULER EQUATIONS265Chapter 1INTRODUCTION1.1 MotivationThe material in this book originated from attempts to understand and systemize nu-merical solution techniques for the partial dierential equations governing the physicsof uid ow. As time went on and these attempts began to crystallize,underlying

    constraints on the nature of the material began to form. The principal such constraintwas the demand for unication. Was there one mathematical structure which couldbe used to describe the behavior and results of most numerical methods in commonuse in the eld of uid dynamics? Perhaps the answer is arguable, butthe authorsbelieve the answer is armative and present this book as justication forthat be-

    lief. The mathematical structure is the theory of linear algebra and the attendanteigenanalysis of linear systems.The ultimate goal of the eld of computational uid dynamics (CFD) is to under-

    stand the physical events that occur in the ow of uids around and within designatedobjects. These events are related to the action and interaction ofphenomena suchas dissipation, diusion, convection, shock waves, slip surfaces, boundary layers, andturbulence. In the eld of aerodynamics, all of these phenomena aregoverned by

    the compressible Navier-Stokes equations. Many of the most importantaspects ofthese relations are nonlinear and, as a consequence, often have no analytic solution.This, of course, motivates the numerical solution of the associated partial dier

    entialequations. At the same time it would seem to invalidate the use of linear algebra forthe classication of the numerical methods. Experience has shown that such is notthe case.As we shall see in a later chapter, the use of numerical methods to solve partialdierential equations introduces an approximation that, in eect, canchange theform of the basic partial dierential equations themselves. The new equations, which1

    2 CHAPTER 1. INTRODUCTIONare the ones actually being solved by the numerical process, are often referred to asthe modied partial dierential equations. Since they are not precisely the same asthe original equations, they can, and probably will, simulate the physical phenomenalisted above in ways that are not exactly the same as an exact solution to the basicpartial dierential equation. Mathematically, these dierences are usually referre

  • 7/30/2019 6559148 Fundamentals of CFD

    9/512

    d toas truncation errors. However, the theory associated with the numerical analysis ofuid mechanics was developed predominantly by scientists deeply interestedin the

    physics of uid ow and, as a consequence, these errors are often identied with aparticular physical phenomenon on which they have a strong eect. Thus methods aresaid to have a lot of articial viscosity or said to be highly dispersive.

    This meansthat the errors caused by the numerical approximation result in a modied partialdierential equation having additional terms that can be identied with the physicsof dissipation in the rst case and dispersion in the second. There isnothing wrong,

    of course, with identifying an error with a physical process, norwith deliberately

    directing an error to a specic physical process, as long as the error remains in someengineering sense small. It is safe to say, for example, that most numerical methodsin practical use for solving the nondissipative Euler equations create a modied p

    artialdierential equation that produces some form of dissipation. However,if used andinterpreted properly, these methods give very useful information.Regardless of what the numerical errors are called, if their eectsare not thor-oughly understood and controlled, they can lead to serious diculties,producing

    answers that represent little, if any, physical reality. Thismotivates studying theconcepts of stability, convergence, and consistency. On the other hand, even if theerrors are kept small enough that they can be neglected (for engineer

    ing purposes),the resulting simulation can still be of little practical use if inecient or inappropriatealgorithms are used. This motivates studying the concepts of stiness, factorization,and algorithm development in general. All of these concepts we hopeto clarify in

    this book.1.2 BackgroundThe eld of computational uid dynamics has a broad range of applicability. Indepen-dent of the specic application under study, the following sequence of steps generally

    must be followed in order to obtain a satisfactory solution.1.2.1 Problem Specication and Geometry PreparationThe rst step involves the specication of the problem, including the geometry, owconditions, and the requirements of the simulation. The geometry mayresult from

    1.2. BACKGROUND 3measurements of an existing conguration or may be associated with a design study.Alternatively, in a design context, no geometry need be supplied.

  • 7/30/2019 6559148 Fundamentals of CFD

    10/512

    Instead, a setof objectives and constraints must be specied. Flow conditions mightinclude, forexample, the Reynolds number and Mach number for the ow over an airfoil. Therequirements of the simulation include issues such as the level of accuracy needed, theturnaround time required, and the solution parameters of interest. The rst two ofthese requirements are often in conict and compromise is necessary. As anexampleof solution parameters of interest in computing the oweld about an airfoil, one maybe interested in i) the lift and pitching moment only, ii) the dragas well as the lift

    and pitching moment, or iii) the details of the ow at some specic location.1.2.2 Selection of Governing Equations and Boundary Con-ditionsOnce the problem has been specied, an appropriate set of governing equations andboundary conditions must be selected. It is generally accepted that the phenomena ofimportance to the eld of continuum uid dynamics are governed by the conservation

    of mass, momentum, and energy. The partial dierential equations resulting fromthese conservation laws are referred to as the Navier-Stokes equations.

    However, inthe interest of eciency, it is always prudent to consider solving simplied formsof the Navier-Stokes equations when the simplications retain the physicswhich areessential to the goals of the simulation. Possible simplied governing equationsincludethe potential-ow equations, the Euler equations, and the thin-layer Navier-Stokesequations. These may be steady or unsteady and compressible or inco

    mpressible.Boundary types which may be encountered include solid walls, inow andoutow

    boundaries, periodic boundaries, symmetry boundaries, etc. The boundary conditionswhich must be specied depend upon the governing equations. For example, at a solidwall, the Euler equations require ow tangency to be enforced, while the Navier-Stokesequations require the no-slip condition. If necessary, physical models must be chosenfor processes which cannot be simulated within the specied constraints. Turbulence

    is an example of a physical process which is rarely simulated in a practical context (atthe time of writing) and thus is often modelled. The success of a simulation dependsgreatly on the engineering insight involved in selecting the governingequations andphysical models based on the problem specication.1.2.3 Selection of Gridding Strategy and Numerical MethodNext a numerical method and a strategy for dividing the ow domain into cells, or

  • 7/30/2019 6559148 Fundamentals of CFD

    11/512

    elements, must be selected. We concern ourselves here only with numerical meth-ods requiring such a tessellation of the domain, which is known asa grid, or mesh.4 CHAPTER 1. INTRODUCTIONMany dierent gridding strategies exist, including structured, unstructured, hybrid,composite, and overlapping grids. Furthermore, the grid can be altered based onthe solution in an approach known as solution-adaptive gridding. The

    numericalmethods generally used in CFD can be classied as nite-dierence, nite-volme,nite-element, or spectral methods. The choices of a numerical methodand a grid-ding strategy are strongly interdependent. For example, the use of nite-dierencemethods is typically restricted to structured grids. Here again, thesuccess of a sim-ulation can depend on appropriate choices for the problem or class of

    problems ofinterest.1.2.4 Assessment and Interpretation of ResultsFinally, the results of the simulation must be assessed and interpreted. This

    step canrequire post-processing of the data, for example calculation of forcesand moments,

    and can be aided by sophisticated ow visualization tools and error estimation tech-niques. It is critical that the magnitude of both numerical and physical-model errorsbe well understood.1.3 OverviewIt should be clear that successful simulation of uid ows can involve a wide rangeofissues from grid generation to turbulence modelling to the applicability of various sim-

    plied forms of the Navier-Stokes equations. Many of these issues arenot addressedin this book. Some of them are presented in the books by Anderson,Tannehill, andPletcher [1] and Hirsch [2]. Instead we focus on numerical methods,with emphasis

    on nite-dierence and nite-volume methods for the Euler and Navier-Stokes equa-tions. Rather than presenting the details of the most advanced methods, which arestill evolving, we present a foundation for developing, analyzing, andunderstanding

    such methods.

    Fortunately, to develop, analyze, and understand most numerical methods used tond solutions for the complete compressible Navier-Stokes equations, we can make useof much simpler expressions, the so-called model equations. These model equationsisolate certain aspects of the physics contained in the complete set of equations. Hencetheir numerical solution can illustrate the properties of a givennumerical methodwhen applied to a more complicated system of equations which governs similar phy

  • 7/30/2019 6559148 Fundamentals of CFD

    12/512

    s-ical phenomena. Although the model equations are extremely simple and easy tosolve, they have been carefully selected to be representative, when used intelligently,of diculties and complexities that arise in realistic two- and three-dimensional uidow simulations. We believe that a thorough understanding of what happens when1.4. NOTATION 5numerical approximations are applied to the model equations is a major rststep inmaking condent and competent use of numerical approximations to the Euler andNavier-Stokes equations. As a word of caution, however, it shouldbe noted that,

    although we can learn a great deal by studying numerical methods as applied to themodel equations and can use that information in the design and application of nu-merical methods to practical problems, there are many aspects of practical problemswhich can only be understood in the context of the complete physicalsystems.

    1.4 NotationThe notation is generally explained as it is introduced. Bold type is reserved for realphysical vectors, such as velocity. The vector symbol is used forthe vectors (or

    column matrices) which contain the values of the dependent variableat the nodesof a grid. Otherwise, the use of a vector consisting of a collection of scalars shouldbe apparent from the context and is not identied by any specialnotation. For

    example, the variable u can denote a scalar Cartesian velocity component in theEuler

    and Navier-Stokes equations, a scalar quantity in the linear convectionand diusionequations, and a vector consisting of a collection of scalars inour presentation ofhyperbolic systems. Some of the abbreviations used throughout the text are listedand dened below.PDE Partial dierential equationODE Ordinary dierential equationOE Ordinary dierence equationRHS Right-hand sideP.S. Particular solution of an ODE or system of ODEsS.S. Fixed (time-invariant) steady-state solution

    k-D k-dimensional space

    bc

    Boundary conditions, usually a vectorO() A term of order (i.e., proportional to) 6 CHAPTER 1. INTRODUCTIONChapter 2CONSERVATION LAWS AND

  • 7/30/2019 6559148 Fundamentals of CFD

    13/512

    THE MODEL EQUATIONSWe start out by casting our equations in the most general form, the integral conserva-tion-law form, which is useful in understanding the concepts involved in nite-volumeschemes. The equations are then recast into divergence form, which is natural fornite-dierence schemes. The Euler and Navier-Stokes equations are briey discussedin this Chapter. The main focus, though, will be on representative model equations,in particular, the convection and diusion equations. These equations contain manyof the salient mathematical and physical features of the full Navier-Stokes equations.The concepts of convection and diusion are prevalent in our development of nu-merical methods for computational uid dynamics, and the recurring use of thesemodel equations allows us to develop a consistent framework of analysis for consis-tency, accuracy, stability, and convergence. The model equations we study have twoproperties in common. They are linear partial dierential equations (PDEs) with

    coecients that are constant in both space and time, and they represent phenomenaof importance to the analysis of certain aspects of uid dynamic problems.2.1 Conservation LawsConservation laws, such as the Euler and Navier-Stokes equations and our modelequations, can be written in the following integral form:

    V (t2)QdV

    V (t1)QdV +

    t2t1

    S(t)n.FdSdt =

    t2t1

    V (t)PdV dt (2.1)In this equation, Q is a vector containing the set of variables which are conserved,

  • 7/30/2019 6559148 Fundamentals of CFD

    14/512

    e.g., mass, momentum, and energy, per unit volume. The equation is astatement of

    78 CHAPTER 2. CONSERVATION LAWS AND THE MODEL EQUATIONSthe conservation of these quantities in a nite region of space with volume V (t) andsurface area S(t) over a nite interval of time t2t1. In two dimensions, the regionof space, or cell, is an area A(t) bounded by a closed contour C(t). The vector n isa unit vector normal to the surface pointing outward, F is a set of vectors,or tensor,containing the ux of Q per unit area per unit time, and P is the rateof production

    of Q per unit volume per unit time. If all variables are continuousin time, then Eq.2.1 can be rewritten asddt

    V (t)

    QdV +

    S(t)n.FdS =

    V (t)PdV (2.2)Those methods which make various numerical approximations of the integrals in Eqs.2.1 and 2.2 and nd a solution for Q on that basis are referred toas nite-volumemethods. Many of the advanced codes written for CFD applications are based onthe

    nite-volume concept.On the other hand, a partial derivative form of a conservation lawcan also be

    derived. The divergence form of Eq. 2.2 is obtained by applying Gausss theorem tothe ux integral, leading toQt+.F = P (2.3)

    where . is the well-known divergence operator given, in Cartesian coordinates, by.

    i

    x+j

    y+k

    z

  • 7/30/2019 6559148 Fundamentals of CFD

    15/512

    . (2.4)and i, j, and k are unit vectors in the x, y, and z coordinate directions, respectively.Those methods which make various approximations of the derivatives in Eq. 2.3 andnd a solution for Q on that basis are referred to as nite-dierence methods.2.2 The Navier-Stokes and Euler EquationsThe Navier-Stokes equations form a coupled system of nonlinear PDEs describingthe conservation of mass, momentum and energy for a uid. For a Newtonian uidin one dimension, they can be written asQt+E

    x= 0 (2.5)

    withQ =

    ue

    , E =

    uu2+p

    u(e +p)

  • 7/30/2019 6559148 Fundamentals of CFD

    16/512

    043ux43uux+Tx

    (2.6)2.2. THE NAVIER-STOKES AND EULER EQUATIONS 9where is the uid density, u is the velocity, e is the total energy per unit volume, p isthe pressure, T is the temperature, is the coecient of viscosity, and is the thermalconductivity. The total energy e includes internal energy per unit volume (whereis the internal energy per unit mass) and kinetic energy per unitvolume u

    2/2.These equations must be supplemented by relations between and and the uidstate as well as an equation of state, such as the ideal gas law.Details can be foundin Anderson, Tannehill, and Pletcher [1] and Hirsch [2]. Note that the convectiveuxes lead to rst derivatives in space, while the viscous and heat conduction termsinvolve second derivatives. This form of the equations is called conservation-law orconservative form. Non-conservative forms can be obtained by expanding deriva

    tivesof products using the product rule or by introducing dierent dependentvariables,

    such as u and p. Although non-conservative forms of the equations are analyticallythe same as the above form, they can lead to quite dierent numerical

    solutions interms of shock strength and shock speed, for example. Thus the conservative form isappropriate for solving ows with features such as shock waves.

  • 7/30/2019 6559148 Fundamentals of CFD

    17/512

    Many ows of engineering interest are steady (time-invariant), or at least maybetreated as such. For such ows, we are often interested in the steady-state solution ofthe Navier-Stokes equations, with no interest in the transient portion of the solution.The steady solution to the one-dimensional Navier-Stokes equations must satisfyEx= 0 (2.7)

    If we neglect viscosity and heat conduction, the Euler equations areobtained. Intwo-dimensional Cartesian coordinates, these can be written asQt+E

    x+F

    y= 0 (2.8)

    with

    Q =

    q1q2q3q

    4

    =

    uve, E =

  • 7/30/2019 6559148 Fundamentals of CFD

    18/512

    uu2+ puvu(e +p), F =

    vuvv

    2+pv(e +p)(2.9)

    where u and v are the Cartesian velocity components. Later on we will make use ofthe following form of the Euler equations as well:Q

    t+AQx+B

    Qy= 0 (2.10)

    The matrices A =E

    Qand B =F

    Qare known as the ux Jacobians. The ux vectors

    given above are written in terms of the primitive variables, , u,v, and p. In order10 CHAPTER 2. CONSERVATION LAWS AND THE MODEL EQUATIONSto derive the ux Jacobian matrices, we must rst write the ux vectors Eand F interms of the conservative variables, q1, q

  • 7/30/2019 6559148 Fundamentals of CFD

    19/512

    2, q3, and q4, as follows:E =

    E1E2

    E3E4

    =

    q2

  • 7/30/2019 6559148 Fundamentals of CFD

    20/512

    (1)q4+3

    2q22q1 12q23q1q3q2q1

    q4q2q1 12

    q3

    2q21+q

    23q2q21

  • 7/30/2019 6559148 Fundamentals of CFD

    21/512

    (2.11)F =

    F1

    F2F3F4

    =

    q

  • 7/30/2019 6559148 Fundamentals of CFD

    22/512

    3q3q2q1(1)q4+3

    2q23q1 12q22q

    1q4q3q1 12

    q

    22q3q21+q

    33q2

    1

  • 7/30/2019 6559148 Fundamentals of CFD

    23/512

    (2.12)We have assumed that the pressure satises p = ( 1)[e (u2+ v2)/2] from theideal gas law, where is the ratio of specic heats, cp/cv. From this it follows thatthe ux Jacobian of E can be written in terms of the conservative variables asA =E

    iq

    j=

    0 1 0 0a21(3 )

    q2q1

    (1 )

    q3q1

    1

  • 7/30/2019 6559148 Fundamentals of CFD

    24/512

    q2q1

    q3q1q3q1q2q1

    0a41

    a42a

    43

    q2q1

    (2.13)whe

    e

    21=

    12

    q3

  • 7/30/2019 6559148 Fundamentals of CFD

    25/512

    q1

    23

    2

    q2q1

    22.2. THE NAVIER-STOKES AND EULER EQUATIONS 11a41= (1)

    q2q

    1

    3+

    q3q1

    2

    q

    2q1

    q4q1

    q2q1

    42=

    q

  • 7/30/2019 6559148 Fundamentals of CFD

    26/512

    4q1

    12

    3

    q2q1

    2+

    q3q1

    2

    43= (1)

    q2q1

    q

    3q1

    (2.14)and in terms of the primitive variables asA =

    0 1 0 0a21

  • 7/30/2019 6559148 Fundamentals of CFD

    27/512

    (3 )u (1 )v (1)uv v u 0a41a

    42a

    43 u(2.15)whe

    e

    21=

    12v

    23

    2u

    2a

    41= (1)u(u2+v2)ue

    42=

    e

    12(3u

    2+v2)a43

  • 7/30/2019 6559148 Fundamentals of CFD

    28/512

    = (1 )uv (2.16)Derivation of the two forms of B = F/Q is similar. The eigenvaluesof the uxJacobian matrices are purely real. This is the dening feature of hyperbolic systemsof PDEs, which are further discussed in Section 2.5. The homogeneousproperty ofthe Euler equations is discussed in Appendix C.The Navier-Stokes equations include both convective and diusive uxes. Thismotivates the choice of our two scalar model equations associated with the physicsof convection and diusion. Furthermore, aspects of convective phenomena associ-ated with coupled systems of equations such as the Euler equations are important indeveloping numerical methods and boundary conditions. Thus we also study linearhyperbolic systems of PDEs.12 CHAPTER 2. CONSERVATION LAWS AND THE MODEL EQUATIONS2.3 The Linear Convection Equation2.3.1 Dierential FormThe simplest linear model for convection and wave propagation is the linear convection

    equation given by the following PDE:ut+a

    ux= 0 (2.17)

    Here u(x, t) is a scalar quantity propagating with speed a, a real constant which maybe positive or negative. The manner in which the boundary conditionsare speciedseparates the following two phenomena for which this equation is a model:

    (1) In one type, the scalar quantity u is given on one boundary,correspondingto a wave entering the domain through this inow boundary. No bound-ary condition is specied at the opposite side, the outow boundary. Thiis consistent in terms of the well-posedness of a 1st-order PDE. Hence thewave leaves the domain through the outow boundary without distortion orreection. This type of phenomenon is referred to, simply, as the convectionproblem. It represents most of the usual situations encountered in convect-ing systems. Note that the left-hand boundary is the inow boundary when

    a is positive, while the right-hand boundary is the inow boundary when aisnegative.(2) In the other type, the ow being simulated is periodic. At anygiven time,what enters on one side of the domain must be the same as that

    which isleaving on the other. This is referred to as the biconvection problem. It isthe simplest to study and serves to illustrate many of the basic pro

  • 7/30/2019 6559148 Fundamentals of CFD

    29/512

    perties ofnumerical methods applied to problems involving convection, without specialconsideration of boundaries. Hence, we pay a great deal of attentionto it in

    the initial chapters.Now let us consider a situation in which the initial condition is given by u(x,0) =u0(x), and the domain is innite. It is easy to show by substitutionthat the exactsolution to the linear convection equation is thenu(x, t) = u0(x

    t) (2.18)The initial waveform propagates unaltered with speed |a| to the right if a is positiveand to the left if a is negative. With periodic boundary conditions, the waveformtravels through one boundary and reappears at the other boundary, eventually re-turning to its initial position. In this case, the process continues forever without any

    2.3. THE LINEAR CONVECTION EQUATION 13change in the shape of the solution. Preserving the shape of theinitial conditionu0(x) can be a dicult challenge for a numerical method.2.3.2 Solution in Wave SpaceWe now examine the biconvection problem in more detail. Let the domain be givenby 0 x 2. We restrict our attention to initial conditions in the formu(x, 0) = f(0)eix(2.19)

    whe

    e f(0) is a complex constant, and is the wavenumber. In orderto satisfy theperiodic boundary conditions, must be an integer. It is a measure of the number ofwavelengths within the domain. With such an initial condition, the solution can bewritten asu(x, t) = f(t)eix(2.20)whe

    e the time dependence is contained in the complex function f(t).Substitutingthis solution into the linear convection equation, Eq. 2.17, we nd that

    f(t) satisesthe following ordinary dierential equation (ODE)dfdt= i f (2.21)

    which has the solutionf(t) = f(0)ei

    t(2.22)Substitutin

    f(t) into Eq. 2.20 gives the following solution

  • 7/30/2019 6559148 Fundamentals of CFD

    30/512

    u(x, t) = f(0)ei(x

    t)= f(0)ei(xt)(2.23)

    here the frequency, , the wavenumber, , and the phase speed, a, arerelated by =

    (2.24)The relation between the frequency and the wavenumber is known as the dispersionrelation. The linear relation given by Eq. 2.24 is characteristic ofwave propagation

    in a nondispersive medium. This means that the phase speed is the same for allwavenumbers. As we shall see later, most numerical methods introduce somedisper-sion; that is, in a simulation, waves with dierent wavenumbers travel at dierentspeeds.An arbitrary initial waveform can be produced by summing initial conditions ofthe form of Eq. 2.19. For M modes, one obtainsu(x, 0) =M

    m=1fm(0)eimx(2.25)14 CHAPTER 2. CONSERVATION LAWS AND THE MODEL EQUATIONSwhere the wavenumbers are often ordered such that 1 2 M

    . Since thewave equation is linear, the solution is obtained by summing solutions of theform ofEq. 2.23, givingu(x, t) =Mm=1fm(0)eim(x

    t)(2.26)

    Dispe

    sion and dissipation resulting from a numerical approximation will cause theshape of the solution to change from that of the original waveform.2.4 The Diusion Equation2.4.1 Dierential FormDiusive uxes are associated with molecular motion in a continuum uid. A simplelinear model equation for a diusive process isut=

  • 7/30/2019 6559148 Fundamentals of CFD

    31/512

    2ux2(2.27)

    where is a positive real constant. For example, with u representing the tempera-ture, this parabolic PDE governs the diusion of heat in one dimension. Boundaryconditions can be periodic, Dirichlet (specied u), Neumann (specied u/x)

    ormixed Dirichlet/Neumann.In contrast to the linear convection equation, the diusion equation has a nontrivialsteady-state solution, which is one that satises the governing PDE withthe partial

    derivative in time equal to zero. In the case of Eq. 2.27, thesteady-state solutionmust satisfy2ux

    2 = 0 (2.28)Therefore, u must vary linearly with x at steady state such that the boundary con-ditions are satised. Other steady-state solutions are obtained if a source term g(x)is added to Eq. 2.27, as follows:ut=

    2

    ux2g(x)(2.29)

    giving a steady state-solution which satises2ux2g(x) = 0 (2.30)

    2.4. THE DIFFUSION EQUATION 15In two dimensions, the diusion equation becomesut=

    2ux

  • 7/30/2019 6559148 Fundamentals of CFD

    32/512

    2+

    2uy2g(x, y)(2.31)

    where g(x, y) is again a source term. The corresponding steady equationis

    2ux2+

    2uy2g(x, y) = 0 (2.32)

    While Eq. 2.31 is parabolic, Eq. 2.32 is elliptic. The latter isknown as the Poissonequation for nonzero g, and as Laplaces equation for zero g.2.4.2 Solution in Wave SpaceWe now consider a series solution to Eq. 2.27. Let the domain be given by 0 x with boundary conditions u(0) = ua, u() = ub. It is clear that the steady-statesolution is given by a linear function which satises the boundary conditions, i.e.,h(x) = u

    a+ (ubua)x/. Let the initial condition beu(x, 0) =Mm=1fm(0) sin

    mx +h(x) (2.33)where must be an integer in order to satisfy the boundary conditions. A solutionof the formu(x, t) =Mm=1f

  • 7/30/2019 6559148 Fundamentals of CFD

    33/512

    m(t) sin mx +h(x) (2.34)satises the initial and boundary conditions. Substituting this form into Eq. 2.27gives the following ODE for fm:dfmdt=

    2mfm(2.35)

    and we ndfm(t) = fm(0)e

    2mt(2.36)Substituti

    g fm(t) into equation 2.34, we obtainu(x, t) =Mm=1f

    m(0)e2mtsi

    mx +h(x) (2.37)The steady-state solution (t ) is simply h(x). Eq. 2.37 shows that high wavenum-ber components (large m) of the solution decay more rapidly than low wavenumber

    components, consistent with the physics of diusion.16 CHAPTER 2. CONSERVATION LAWS AND THE MODEL EQUATIONS2.5 Linear Hyperbolic SystemsThe Euler equations, Eq. 2.8, form a hyperbolic system of partialdierential equa-tions. Other systems of equations governing convection and wave propagation phe-nomena, such as the Maxwell equations describing the propagation of electromagneticwaves, are also of hyperbolic type. Many aspects of numerical methods

  • 7/30/2019 6559148 Fundamentals of CFD

    34/512

    for such sys-tems can be understood by studying a one-dimensional constant-coecient

    linearsystem of the formut+A

    ux= 0 (2.38)

    where u = u(x, t) is a vector of length m and A is a realm m matrix. For

    conservation laws, this equation can also be written in the formut+f

    x= 0 (2.39)

    where f is the ux vector and A =f

    uis the ux Jacobian matrix. The entries in the

    ux Jacobian are

    aij=f

    iuj(2.40)The ux Jacobian for the Euler equations is derived in Section 2.2.Such a system is hyperbolic if A is diagonalizable with real eigenvalues.1Thus

    = X1AX (2.41)where is a diagonal matrix containing the eigenvalues of A, and Xis the matrixof right eigenvectors. Premultiplying Eq. 2.38 by X1, postmultiplying A by theproduct XX1, and noting that X and X1are constants, we obtain

    X1ut+

    . .. .X1

  • 7/30/2019 6559148 Fundamentals of CFD

    35/512

    AX X1ux= 0 (2.42)

    With w = X1u, this can be rewritten aswt+

    wx= 0 (2.43)

    When written in this manner, the equations have been decoupled into m scalar equa-tions of the formwit+

    iwi

    x= 0 (2.44)1See Appendix A for a brief review of some basic relations and denitions from linear algebra.2.6. PROBLEMS 17The elements of w are known as characteristic variables. Each characteristicvariablesatises the linear convection equation with the speed given by the correspondingeigenvalue of A.Based on the above, we see that a hyperbolic system in the form of Eq. 2.38 hasa

    solution given by the superposition of waves which can travel in either the positive ornegative directions and at varying speeds. While the scalar linear convectionequationis clearly an excellent model equation for hyperbolic systems, we must ensure thatour numerical methods are appropriate for wave speeds of arbitrary sign and possiblywidely varying magnitudes.The one-dimensional Euler equations can also be diagonalized, leadingto threeequations in the form of the linear convection equation, although they remain non-

    linear, of course. The eigenvalues of the ux Jacobian matrix, orwave speeds, areu, u + c, and u c, where u is the local uid velocity, and c =

    p/ is the localspeed of sound. The speed u is associated with convection of the uid, while u + cand u c are associated with sound waves. Therefore, in a supersonicow, where|u| > c, all of the wave speeds have the same sign. In a subsonic ow

  • 7/30/2019 6559148 Fundamentals of CFD

    36/512

    , where |u| < c,wave speeds of both positive and negative sign are present, corresponding tothe factthat sound waves can travel upstream in a subsonic ow.The signs of the eigenvalues of the matrix A are also important indetermining

    suitable boundary conditions. The characteristic variables each satisfy the linear con-vection equation with the wave speed given by the corresponding eigenvalue. There-fore, the boundary conditions can be specied accordingly. That is, characteristicvariables associated with positive eigenvalues can be specied at the left boundary,which corresponds to inow for these variables. Characteristic variablesassociatedwith negative eigenvalues can be specied at the right boundary, which is the in-ow boundary for these variables. While other boundary condition treatments arepossible, they must be consistent with this approach.2.6 Problems1. Show that the 1-D Euler equations can be written in terms ofthe primitive

    variables R = [, u, p]Tas follows:Rt+M

    Rx= 0

    whereM =

    u 00 u 10 p u18 CHAPTER 2. CONSERVATION LAWS AND THE MODEL EQUATIONSAssume an ideal gas, p = (1)(eu2/2).2. Find the eigenvalues and eigenvectors of the matrix M derived in

    question 1.3. Derive the ux Jacobian matrix A = E/Q for the 1-D Euler equations result-ing from the conservative variable formulation (Eq. 2.5). Find its eigenvaluesand compare with those obtained in question 2.4. Show that the two matrices M and A derived in questions 1 and 3, respectively,are related by a similarity transform. (Hint: make use of thematrix S =Q/R.)

  • 7/30/2019 6559148 Fundamentals of CFD

    37/512

    5. Write the 2-D diusion equation, Eq. 2.31, in the form of Eq. 2.2.6. Given the initial condition u(x, 0) = sinx dened on 0 x 2, write it in theform of Eq. 2.25, that is, nd the necessary values of fm(0). (Hint: use M = 2with 1= 1 and

    2= 1.) Next consider the same initial condition dened

    only at x = 2j/4, j = 0, 1, 2, 3. Find the values of fm(0) required to reproducethe initial condition at these discrete points using M = 4 with m= m1.

    7. Plot the rst three basis functions used in constructing the exactsolution tothe diusion equation in Section 2.4.2. Next consider a solution with boundaryconditions ua= u

    b= 0, and initial conditions from Eq. 2.33 with f

    m(0) = 1for 1 m 3, fm(0) = 0 for m > 3. Plot the initial condition on the domain0 x . Plot the solution at t = 1 with = 1.8. Write the classical wave equation 2u/t2= c2

    2u/x2as a rst-order system,i.e., in the formUt+A

    Ux= 0

    where U = [u/x, u/t]T

    . Find the eigenvalues and eigenvectors of A.9. The Cauchy-Riemann equations are formed from the coupling of the steadycompressible continuity (conservation of mass) equationux+v

    y= 0

  • 7/30/2019 6559148 Fundamentals of CFD

    38/512

    and the vorticity denition = vx+u

    y= 0

    2.6. PROBLEMS 19where = 0 for irrotational ow. For isentropic and homenthalpic ow,thesystem is closed by the relation =

    1 12

    u2+v21

    11Note that the variables have been nondimensionalized. Combining the twoPDEs, we havef(q)x+g(q)

    y= 0

    where

    q =

    uv

    , f =

    uv

    , g =

    v

    u

    One approach to solving these equations is to add a time-dependent term andnd the steady solution of the following equation:qt+f

    x

  • 7/30/2019 6559148 Fundamentals of CFD

    39/512

    +g

    y= 0

    (a) Find the ux Jacobians of f and g with respect to q.(b) Determine the eigenvalues of the ux Jacobians.(c) Determine the conditions (in terms of and u) under which the systemishyperbolic, i.e., has real eigenvalues.(d) Are the above uxes homogeneous? (See Appendix C.)20 CHAPTER 2. CONSERVATION LAWS AND THE MODEL EQUATIONSChapter 3FINITE-DIFFERENCEAPPROXIMATIONSIn common with the equations governing unsteady uid ow, our model equationscontain partial derivatives with respect to both space and time. Onecan approxi-

    mate these simultaneously and then solve the resulting dierence equations. Alterna-tively, one can approximate the spatial derivatives rst, thereby producing a systemof ordinary dierential equations. The time derivatives are approximated next,lead-

    ing to a time-marching method which produces a set of dierence equations. Thisis the approach emphasized here. In this chapter, the concept ofnite-dierence

    approximations to partial derivatives is presented. These can be applied either tospatial derivatives or time derivatives. Our emphasis in this chapter is on spatialderivatives; time derivatives are treated in Chapter 6. Strategies for applying thesenite-dierence approximations will be discussed in Chapter 4.All of the material below is presented in a Cartesian system. We emphasize the

    fact that quite general classes of meshes expressed in general curvilinear coordinatesin physical space can be transformed to a uniform Cartesian mesh with equispacedintervals in a so-called computational space, as shown in Figure 3.1. The computationalspace is uniform; all the geometric variation is absorbed into variable coecientsof thetransformed equations. For this reason, in much of the following accuracy analysis,we use an equispaced Cartesian system without being unduly restrictiveor losing

    practical application.

    3.1 Meshes and Finite-Dierence NotationThe simplest mesh involving both time and space is shown in Figure 3.2.

    Inspectionof this gure permits us to dene the terms and notation needed to describe nite-2122 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONSxyFigure 3.1: Physical and computational spaces.

  • 7/30/2019 6559148 Fundamentals of CFD

    40/512

    dierence approximations. In general, the dependent variables, u, forexample, arefunctions of the independent variables t, and x, y, z. For the rstseveral chapterswe consider primarily the 1-D case u = u(x, t). When only one variable is denoted,dependence on the other is assumed. The mesh index for x is alwaysj, and that fort is always n. Then on an equispaced gridx = xj= jx (3.1)

    t = tn= nt = nh (3.2)

    where x is the spacing in x and t the spacing in t, as shown in Figure 3.2. Notethat h = t throughout. Later k and l are used for y and z in a similar way. Whenn, j, k, l are used for other purposes (which is sometimes necessary), local contextshould make the meaning obvious.The convention for subscript and superscript indexing is as follows:u(t +kh) = u([n +k]h) = u

    n+ku(x +mx) = u([j +m]x) = uj+m(3.3)

    u(x +mx, t +kh) = u(n+k)j+mNotice that when used alone, both the time and space indices appear asa subscript,but when used together, time is always a superscript and is usuallyenclosed withparentheses to distinguish it from an exponent.3.1. MESHES AND FINITE-DIFFERENCE NOTATION 23

    tx j-2 j-1 j j+1 j+2nn-1n+1xtGrid orNodePointsFigure 3.2: Space-time grid arrangement.

    Derivatives are expressed according to the usual conventions. Thusfor partialderivatives in space or time we use interchangeablyxu =u

    x, t

  • 7/30/2019 6559148 Fundamentals of CFD

    41/512

    u =u

    t, xxu =

    2ux2, etc. (3.4)For the ordinary time derivative in the study of ODEs we useu

    =du

    dt(3.5)

    In this text, subscripts on dependent variables are never used to express derivatives.Thus uxwill not be used to represent the rst derivative of u with respect

    to x.The notation for dierence approximations follows the same philosophy, but (withone exception) it is not unique. By this we mean that the symbol is used to representa dierence approximation to a derivative such that, for example,x x, xx xx

    (3.6)but the precise nature (and order) of the approximation is not carriedin the symbol

    . Other ways are used to determine its precise meaning. The one exception is thesymbol , which is dened such thattn= t

    n+1t

    , x

    j= x

    j+1xj, un= u

    n+1u

  • 7/30/2019 6559148 Fundamentals of CFD

    42/512

    , etc. (3.7)When there is no subscript on t or x, the spacing is uniform.24 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONS3.2 Space Derivative ApproximationsA dierence approximation can be generated or evaluated by means of a simple Taylorseries expansion. For example, consider u(x, t) with t xed. Then, following thenotation convention given in Eqs. 3.1 to 3.3, x = jx and u(x + kx)= u(jx +kx) = uj+k. Expanding the latter term about x gives1uj+k= u

    j+ (kx)

    ux

    j+1

    2(kx)2

    2ux2

    j+ +1

    n!(kx)n

    nuxn

    j+ (3.8)Local dierence approximations to a given partial derivative can be formed from linearcombinations of ujand u

    j+kfor k =

    1,

    2, .For example, consider the Taylor series expansion for u

  • 7/30/2019 6559148 Fundamentals of CFD

    43/512

    j+1:uj+1= uj+ (x)

    ux

    j+1

    2(x)2

    2ux2

    j+ +1

    n!(x)n

    nuxn

    j+ (3.9)Now subtract ujand divide by x to obtain

    uj+1ujx=

    u

    x

    j+1

    2(x)

    2

  • 7/30/2019 6559148 Fundamentals of CFD

    44/512

    ux2

    j+ (3.10)Thus the expression (uj+1uj)/x is a reasonable approximation for

    ux

    jas long asx is small relative to some pertinent length scale. Next consider the space dierenceapproximation (uj+1uj1)/(2x). Expand the terms in the numerator about j and

    regroup the result to form the following equationuj+1uj12x

    ux

    j=

    16x2

    3ux3

    j+

    1120x4

    5ux5

  • 7/30/2019 6559148 Fundamentals of CFD

    45/512

    j. . . (3.11)When expressed in this manner, it is clear that the discrete terms on the left side ofthe equation represent a rst derivative with a certain amount of error which appearson the right side of the equal sign. It is also clear that theerror depends on thegrid spacing to a certain order. The error term containing the gridspacing to thelowest power gives the order of the method. From Eq. 3.10, we see that the expression(uj+1uj)/x is a rst-order approximation to

    ux

    j. Similarly, Eq. 3.11 shows that

    (uj+1uj1)/(2x) is a second-order approximation to a rst derivative. The latteris referred to as the three-point centered dierence approximation, and one oftenseesthe summary result presented in the form

    ux

    j

    = uj+1uj12x+O(x

    2) (3.12)1We assume that u(x, t) is continuously dierentiable.3.3. FINITE-DIFFERENCE OPERATORS 253.3 Finite-Dierence Operators

    3.3.1 Point Dierence OperatorsPerhaps the most common examples of nite-dierence formulas are the three-pointcentered-dierence approximations for the rst and second derivatives:2

    ux

    j

  • 7/30/2019 6559148 Fundamentals of CFD

    46/512

    =1

    2x(uj+1uj1) +O(x2) (3.13)

    2ux2

    j=1

    x2(uj+1

    2uj+uj1) +O(x2) (3.14)These are the basis for point dierence operators since they give an approximation toa derivative at one discrete point in a mesh in terms of surrounding points. However,neither of these expressions tells us how other points in the mesh are dierenced or

    how boundary conditions are enforced. Such additional information requires a moresophisticated formulation.3.3.2 Matrix Dierence OperatorsConsider the relation(xxu)j=1

    x2

    (uj+12uj+uj1) (3.15)which is a point dierence approximation to a second derivative. Now let us derive amatrix operator representation for the same approximation. Consider the

  • 7/30/2019 6559148 Fundamentals of CFD

    47/512

    four pointmesh with boundary points at a and b shown below. Notice that whenwe speak ofthe number of points in a mesh, we mean the number of interior pointsexcluding

    the boundaries.a 1 2 3 4 bx = 0 j = 1 MFour point mesh. x = /(M + 1)Now impose Dirichlet boundary conditions, u(0) = ua, u() = uband use the

    centered dierence approximation given by Eq. 3.15 at every point in themesh. We

    2We will derive the second derivative operator shortly.26 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONSarrive at the four equations:(xxu)

    1 =1

    x2(ua2u1+u2)(

    xxu)2=1

    x2(u12u2+u3

    )(xxu)3=1

    x2(u

  • 7/30/2019 6559148 Fundamentals of CFD

    48/512

    22u3+u4)(xxu)4=1

    x2(u32u4+ub) (3.16)Writing these equations in the more suggestive form(xx

    u)1= ( u

    a 2u1+u

    2)/x

    2(xxu)

    2 = ( u1 2u2+u

    3)/x

    2(xxu)3

    = ( u2 2u3+u

    4)/x

    2(xx

  • 7/30/2019 6559148 Fundamentals of CFD

    49/512

    u)4= ( u

    3 2u4+u

    b)/x

    2(3.17)it is clear that we can express them in a vector-matrix form, andfurther, that theresulting matrix has a very special form. Introducingu =

    u1u2

    u3u4,

    bc

    =1

    x2

    ua0

    0ub(3.18)

    and

  • 7/30/2019 6559148 Fundamentals of CFD

    50/512

    A =1

    x2

    2 11 2 11 2 11 2(3.19)

    we can rewrite Eq. 3.17 asxx

    u = Au +

    bc

    (3.20)This example illustrates a matrix dierence operator. Each line of a matrix dier-ence operator is based on a point dierence operator, but the point operators usedfrom line to line are not necessarily the same. For example, boundary conditions maydictate that the lines at or near the bottom or top of the matrix be modied. In theextreme case of the matrix dierence operator representing a spectral me

    thod, none3.3. FINITE-DIFFERENCE OPERATORS 27of the lines is the same. The matrix operators representing the three-point central-dierence approximations for a rst and second derivative with Dirichlet boundaryconditions on a four-point mesh arex=1

    2x

    0 11 0 11 0 11 0

  • 7/30/2019 6559148 Fundamentals of CFD

    51/512

    , xx=1

    x2

    2 11 2 11 2 11 2(3.21)

    As a further example, replace the fourth line in Eq. 3.16 bythe following pointoperator for a Neumann boundary condition (See Section 3.6.):(xxu)4=2

    31x

    ux

    b2

    31x2(u4u

    3) (3.22)where the boundary condition is

    ux

    x==

  • 7/30/2019 6559148 Fundamentals of CFD

    52/512

    ux

    b(3.23)The

    the matrix operator for a three-point central-dierencing schemeat interiorpoints and a second-order approximation for a Neumann condition on the right isgiven byxx=1

    x2

    2 11 2 11 2 1

    2/3 2/3(3.24)

    Each of these matrix dierence operators is a square matrix with elements that areall zeros except for those along bands which are clustered around the central diagonal.We call such a matrix a banded matrix and introduce the notationB(M : a, b, c) =

    b ca b c...

    a b ca b

  • 7/30/2019 6559148 Fundamentals of CFD

    53/512

    1...M(3.25)where the matrix dimensions are M M. Use of M in the argument isoptional,and the illustration is given for a simple tridiagonal matrix althoughany number of28 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONSbands is a possibility. A tridiagonal matrix without constants along the bandscan beexpressed as B(

    a,

    b,

    c). The arguments for a banded matrix are always odd in numberand the central one always refers to the central diagonal.We can now generalize our previous examples. Dening u as3

    u =

    u1u

    2u3...uM

    (3.26)we can approximate the second derivative of u byxx

    u =

  • 7/30/2019 6559148 Fundamentals of CFD

    54/512

    1x2B(1, 2, 1)

    u +

    bc

    (3.27)where

    bc

    stands for the vector holding the Dirichlet boundary conditions on theleft and right sides:

    bc

    =

    1x2[ua, 0, , 0, ub]T(3.28)If we prescribe Neumann boundary conditions on the right side, as inEqs. 3.24 and3.22, we nd

    xx

    u =1

    x2B(

    a,

    b, 1)

    u +

    bc

    (3.29)where

    a = [1, 1, , 2/3]T

  • 7/30/2019 6559148 Fundamentals of CFD

    55/512

    b = [2,2,2, , 2/3]T

    bc

    =1

    x2ua, 0, 0, ,2x3

    ux

    bT

    Notice that the matrix operators given by Eqs. 3.27 and 3.29 carry more informa-tion than the point operator given by Eq. 3.15. In Eqs. 3.27 and 3.29, the boundaryconditions have been uniquely specied and it is clear that the same point operatorhas been applied at every point in the eld except at the boundaries.The ability to

    specify in the matrix derivative operator the exact nature of the approximationat the3Note that u is a function of time only since each element corresponds to one specic spatial

    location.3.3. FINITE-DIFFERENCE OPERATORS 29various points in the eld including the boundaries permits the use ofquite generalconstructions which will be useful later in considerations of stability.Since we make considerable use of both matrix and point operators, it is importantto establish a relation between them. A point operator is generally written for somederivative at the reference point j in terms of neighboring values of the function. Forexample(

    xu)j= a

    2uj2+a1u

  • 7/30/2019 6559148 Fundamentals of CFD

    56/512

    j1+buj+c1uj+1(3.30)

    might be the point operator for a rst derivative. The corresponding matrix operatorhas for its arguments the coecients giving the weights to the values ofthe function

    at the various locations. A j-shift in the point operator correspondsto a diagonal

    shift in the matrix operator. Thus the matrix equivalent of Eq. 3.30isxu = B(a2, a1, b, c1

    , 0)u (3.31)Note the addition of a zero in the fth element which makes it clearthat b is the

    coecient of uj.3.3.3 Periodic MatricesThe above illustrated cases in which the boundary conditions are xed. If the bound-ary conditions are periodic, the form of the matrix operator changes. Consider theeight-point periodic mesh shown below. This can either be presented on a linear mesh

    with repeated entries, or more suggestively on a circular mesh as in Figure 3.3.Whenthe mesh is laid out on the perimeter of a circle, it doesnt reallymatter where the

    numbering starts as long as it ends at the point just preceding its starting location. 7 8 1 2 3 4 5 6 7 8 1 2 x = 0 2 j = 0 1 MEight points on a linear periodic mesh. x = 2/MThe matrix that represents dierencing schemes for scalar equations on a periodicmesh is referred to as a periodic matrix. A typical periodic tridiagonal matrix operator

    30 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONS12345678Figure 3.3: Eight points on a circular mesh.

  • 7/30/2019 6559148 Fundamentals of CFD

    57/512

    with nonuniform entries is given for a 6-point mesh byBp(6 :

    a,

    b,

    c) =

    b1c

    2

    a6a1b

    2c

    3a2b

    3c

    4a3b

    4c

    5a4b

    5c

    6

    c1a

    5b

    6

  • 7/30/2019 6559148 Fundamentals of CFD

    58/512

    (3.32)3.3.4 Circulant MatricesIn general, as shown in the example, the elements along the diagonals of a periodicmatrix are not constant. However, a special subset of a periodic matrix is thecirculantmatrix, formed when the elements along the various bands are constant. Circulantmatrices play a vital role in our analysis. We will have much more to say about themlater. The most general circulant matrix of order 4 is

    b0

    b1b

    2b

    3b3b

    0b

    1b

    2b2b

    3b

    0b

    1b1b

    2

    b3b

    0(3.33)

  • 7/30/2019 6559148 Fundamentals of CFD

    59/512

    Notice that each row of a circulant matrix is shifted (see Figure 3.3) one element tothe right of the one above it. The special case of a tridiagonal

    circulant matrix is3.4. CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER 31given byBp(M : a, b, c) =

    b c aa b c...a b c

    c a b1..

    .M(3.34)When the standard three-point central-dierencing approximations for a rst andsecond derivative, see Eq. 3.21, are used with periodic boundary conditions, they takethe form(x)

    =1

    2x

    0 1 11 0 11 0 11 1 0

  • 7/30/2019 6559148 Fundamentals of CFD

    60/512

    =1

    2xBp(1, 0, 1)and(xx)

    =1

    x2

    2 1 11 2 11 2 11 1 2=1

    x

    2Bp(1, 2, 1) (3.35)Clearly, these special cases of periodic operators are also circulantoperators. Lateron we take advantage of this special property. Notice that there are no boundarycondition vectors since this information is all interior to the matricesthemselves.3.4 Constructing Dierencing Schemes of Any Or-der3.4.1 Taylor Tables

    The Taylor series expansion of functions about a xed point provides a means for con-structing nite-dierence point-operators of any order. A simple and straightforwardway to carry this out is to construct a Taylor table, which makes extensive use ofthe expansion given by Eq. 3.8. As an example, consider Table 3.1, which representsa Taylor table for an approximation of a second derivative using three values of the

  • 7/30/2019 6559148 Fundamentals of CFD

    61/512

    function centered about the point at which the derivative is to be evaluated.32 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONS

    2ux2

    j1

    x2(a uj1+b uj+c uj+1) = ?x x2

    x3 x4uj

    ux

    j

    2ux2

    j

    3ux3

    j

    4ux4

    j

  • 7/30/2019 6559148 Fundamentals of CFD

    62/512

    x2

    2ux2

    j1a uj1 a a (-1) 11 a (-1)21

    2 a (-1)3

    16 a (-1)41

    24b uj bc uj+1

    c c (1) 11 c (1)21

    2 c (1)31

    6

    c (1)41

    24Table 3.1. Taylor table for centered 3-point Lagrangian approximationto a secondderivative.The table is constructed so that some of the algebra is simplied. At the top ofthe

  • 7/30/2019 6559148 Fundamentals of CFD

    63/512

    table we see an expression with a question mark. This represents one of the questionsthat a study of this table can answer; namely, what is the local error caused by theuse of this approximation? Notice that all of the terms in the equation appear ina column at the left of the table (although, in this case, x2has been multipliedinto each term in order to simplify the terms to be put into the table). Then noticethat at the head of each column there appears the common factor that occurs in theexpansion of each term about the point j, that is,xk

    kuxk

    jk = 0, 1, 2, The columns to the right of the leftmost one, under the headings, make up the Taylortable. Each entry is the coecient of the term at the top of the corresponding columnin the Taylor series expansion of the term to the left of the corresponding row. Forexample, the last row in the table corresponds to the Taylorseries expansion ofc uj+1:

    c uj+1= c u

    jc (1) 1

    1x

    ux

    j

    c (1)21

    2x2

  • 7/30/2019 6559148 Fundamentals of CFD

    64/512

    2ux2

    jc (1)31

    6x3

    3ux3

    jc (1)4

    124x4

    4ux4

    j (3.36)A Taylor table is simply a convenient way of forming linear combinations of Taylorseries on a term by term basis.3.4. CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER 33Consider the sum of each of these columns. To maximize the orderof accuracyof the method, we proceed from left to right and force, by the proper choice of a, b,and c, these sums to be zero. One can easily show that the sumsof the rst threecolumns are zero if we satisfy the equation

    1 1 11 0 11 0 1

  • 7/30/2019 6559148 Fundamentals of CFD

    65/512

    abc =

    002The solution is given by [a, b, c] = [1, 2, 1].The columns that do not sum to zero constitute the error.We designate the rst nonvanishing sum to be ert, and refer toit as the Taylor series error.In this case er

    t occurs at the fth column in the table (for this example all evencolumns will vanish by symmetry) and one ndsert=1

    x2a24

    +c24

    x4

    4ux4

    j=x212

    4ux

  • 7/30/2019 6559148 Fundamentals of CFD

    66/512

    4

    j(3.37)Note that x2has been divided through to make the error term consistent. Wehave just derived the familiar 3-point central-dierencing point operator for a secondderivative

    2ux2

    j1

    x2(uj1

    2uj+uj+1) = O(x2) (3.38)The Taylor table for a 3-point backward-dierencing operator representinga rstderivative is shown in Table 3.2.34 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONS

    u

    x

    j1

    x(a2uj2+a1u

    j1+b uj) = ?x x2 x3 x4

  • 7/30/2019 6559148 Fundamentals of CFD

    67/512

    uj

    ux

    j

    2ux2

    j

    3ux3

    j

    4ux4

    jx

    ux

    j1a2 uj2 a2 a2 (-2) 1

    1

    a2 (-2)21

    2 a2 (-2)

  • 7/30/2019 6559148 Fundamentals of CFD

    68/512

    31

    6 a2 (-2)41

    24a1 uj1 a1 a1 (-1) 1

    1 a1

    (-1)21

    2 a1 (-1)31

    6 a

    1 (-1)41

    24b uj bTab

    e 3.2. Taylor table for backward 3-point Lagrangian approximation to a rstderivative.This time the rst three columns sum to zero if

    1 1 12 1 04 1 0

  • 7/30/2019 6559148 Fundamentals of CFD

    69/512

    a2a1b =

    010which gives [a2, a1, b] =

    12[1, 4, 3]. In this case the fourth column provides the leadingtruncation error term:ert=1

    x8a26

    +a16

    x3

    3ux3

    j=x

    23

    3u

  • 7/30/2019 6559148 Fundamentals of CFD

    70/512

    x3

    j(3.39)Thus we have derived a second-order backward-dierence approximation ofa rst

    derivative:

    ux

    j1

    2x(uj24uj1+ 3uj) = O(x2

    ) (3.40)3.4.2 Generalization of Dierence FormulasIn general, a dierence approximation to the mth derivative at grid point j can becast in terms of q +p + 1 neighboring points as

    muxm

    j

    qi=

    aiuj+i= ert(3.41)

    3.4. CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER 35where the a

    iare coecients to be determined through the use of Taylor tables to

    produce approximations of a given order. Clearly this process can beused to nd

    forward, backward, skewed, or central point operators of any order for any derivative.It could be computer automated and extended to higher dimensions. More important,however, is the fact that it can be further generalized. In orderto do this, let us

  • 7/30/2019 6559148 Fundamentals of CFD

    71/512

    approach the subject in a slightly dierent way, that is from thepoint of view ofinterpolation formulas. These formulas are discussed in many textson numericalanalysis.3.4.3 Lagrange and Hermite Interpolation PolynomialsThe Lagrangian interpolation polynomial is given byu(x) =Kk=0ak(x)uk(3.42)

    where ak(x) are polynomials in x of degree K. The construction of the ak(x) can betaken from the simple Lagrangian formula for quadratic interpolation (orextrapola-tion) with non-equispaced points

    u(x) = u0(x1x)(x2x)(x1x0)(x2

    x0)+u

    1(x0x)(x2x)(x0x

    1)(x2x1)+u2(x0

  • 7/30/2019 6559148 Fundamentals of CFD

    72/512

    x)(x1x)(x0x2)(x1x2)(3.43)

    Notice that the coecient of each ukis one when x = x

    k, and zero when x takesany other discrete value in the set. If we take the rst or secondderivative of u(x),impose an equispaced mesh, and evaluate these derivatives at the appropriate dis-crete point, we rederive the nite-dierence approximations just presented.

    Finite-

    dierence schemes that can be derived from Eq. 3.42 are referred to as Lagrangianapproximations.A generalization of the Lagrangian approach is brought about by using Hermitianinterpolation. To construct a polynomial for u(x), Hermite formulas use valuesof thefunction and its derivative(s) at given points in space. Our illustration isfor the casein which discrete values of the function and its rst derivative areused, producingthe expressionu(x) =

    ak(x)uk+bk(x)

    ux

    k(3.44)36 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONSObviously higher-order derivatives could be included as the problems dictate.A com-plete discussion of these polynomials can be found in many referenceson numericalmethods, but here we need only the concept.The previous examples of a Taylor table constructed explicit point dierence op-

  • 7/30/2019 6559148 Fundamentals of CFD

    73/512

    erators from Lagrangian interpolation formulas. Consider next the Taylor table foran implicit space dierencing scheme for a rst derivative arising from the use of aHermite interpolation formula. A generalization of Eq. 3.41 can include derivativesat neighboring points, i.e.,si=rbi

    muxm

    j+i+qi=

    aiuj+i= ert(3.45)

    analogous to Eq. 3.44. An example formula is illustrated at the top of Table 3.3. Herenot only is the derivative at point j represented, but also includedare derivatives atpoints j 1 and j + 1, which also must be expanded using Taylor series about point

    j. This requires the following generalization of the Taylor series expansion given inEq. 3.8:

    muxm

    j+k=

    n=01n!(kx)n

    nx

  • 7/30/2019 6559148 Fundamentals of CFD

    74/512

    nmuxmj(3.46)The derivative terms now have coecients (the coecient on the j pointis taken

    as one to simplify the algebra) which must be determined using the Taylor tableapproach as outlined below.d

    ux

    j1+

    u

    x

    j+e

    ux

    j+11

    x(au

    j1+buj+cuj+1) = ?x x2 x3 x4 x

    5uj

    ux

    j

  • 7/30/2019 6559148 Fundamentals of CFD

    75/512

    2ux2

    j

    3ux3

    j

    4ux4

    j

    5ux5

    jx d

    ux

    j1

    d (-1) 11d (-1)

    21

    2d (-1)

    31

    6

    d (-1)41

    24x

    ux

  • 7/30/2019 6559148 Fundamentals of CFD

    76/512

    j1x e

    ux

    j+1e e (1) 1

    1e (1)

    21

    2e (1)

    31

    6e (1)

    4

    124a uj1 a a (-1) 11 a (-1)21

    2 a (-1)

    31

    6 a (-1)41

    24 a (-1)51

    120b uj bc uj+1 c c (1) 11 c (1)

  • 7/30/2019 6559148 Fundamentals of CFD

    77/512

    21

    2 c (1)31

    6 c (1)41

    24 c (1)51

    120Table 3.3. Taylor table for central 3-point Hermitian approximation to a rst derivative.3.4. CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER 37To maximize the order of accuracy, we must satisfy the relation

    1 1 1 0 01 0 1 1 11 0 1 2 21 0 1 3 31 0 1 4 4

    a

    bcde

  • 7/30/2019 6559148 Fundamentals of CFD

    78/512

    =

    01000havi

    g the solution [a, b, c, d, e] =1

    4

    [3, 0, 3, 1, 1]. Under these conditions the sixthcolumn sums toert=x

    4120

    5ux

    5

    j(3.47)and the method can be expressed as

    ux

    j1+ 4

    u

    x

    j+

    ux

    j+1

  • 7/30/2019 6559148 Fundamentals of CFD

    79/512

    3x(uj1+uj+1) = O(x4) (3.48)This is also referred to as a Pade formula.3.4.4 Practical Application of Pade FormulasIt is one thing to construct methods using the Hermitian concept andquite anotherto implement them in a computer code. In the form of a point operator it is probablynot evident at rst just how Eq. 3.48 can be applied. However, the situation is quiteeasy to comprehend if we express the same method in the form of a matrix operator.A banded matrix notation for Eq. 3.48 is16B(1, 4, 1)x

    u =1

    2xB(1, 0, 1)

    u +

    bc

    (3.49)in which Dirichlet boundary conditions have been imposed.

    4Mathematically this isequivalent tox

    u = 6[B(1, 4, 1)]11

    2xB(1, 0, 1)

    u +

    bc

    (3.50)which can be reexpressed by the predictor-corrector sequence

    u =

  • 7/30/2019 6559148 Fundamentals of CFD

    80/512

    12xB(1, 0, 1)

    u +

    bc

    x

    u = 6 [B(1, 4, 1)]1

    u (3.51)4In this case the vector containing the boundary conditions would include valuesof both u andu/x at both boundaries.38 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONSWith respect to practical implementation, the meaning of the predictor in thissequence should be clear. It simply says take the vector array

    u, dierence it,add the boundary conditions, and store the result in the intermediatearray

    u. Themeaning of the second row is more subtle, since it is demanding the evaluation of aninverse operator, but it still can be given a simple interpretation.An inverse matrixoperator implies the solution of a coupled set of linear equations.These operators

    are very common in nite dierence applications. They appear in the form of banded

    matrices having a small bandwidth, in this case a tridiagonal. The evaluation of[B(1, 4, 1)]1is found by means of a tridiagonal solver, which is simple to code,ecient to run, and widely used. In general, Hermitian or Pade approximations canbe practical when they can be implemented by the use of ecient bandedsolvers.3.4.5 Other Higher-Order SchemesHermitian forms of the second derivative can also be easily derivedby means of aTaylor table. For example

    xx

    u = 12 [B(1, 10, 1)]11

    x2B(1, 2, 1)

  • 7/30/2019 6559148 Fundamentals of CFD

    81/512

    u +

    bc

    (3.52)is O(x4) and makes use of only tridiagonal operations. It should be mentioned thatthe spline approximation is one form of a Pade matrix dierence operator. It is givenbyxx

    u = 6 [B(1, 4, 1)]11

    x2B(1, 2, 1)

    u +

    bc

    (3.53)but its order of accuracy is only O(x2). How much this reduction in accuracy isoset by the increased global continuity built into a spline t is not known.We note

    that the spline t of a rst derivative is identical to any of theexpressions in Eqs.3.48 to 3.51.A nal word on Hermitian approximations. Clearly they have an advantageover

    3-point Lagrangian schemes because of their increased accuracy. However, a moresubtle point is that they get this increase in accuracy using information that is stilllocal to the point where the derivatives are being evaluated. In application, this canbe advantageous at boundaries and in the vicinity of steep gradients. It is obvious, of

    course, that ve point schemes using Lagrangian approximations can be derived thathave the same order of accuracy as the methods given in Eqs. 3.48 and 3.52, buttheywill have a wider spread of space indices. In particular, two Lagrangian schemes withthe same order of accuracy are (here we ignore the problem created by the boundaryconditions, although this is one of the principal issues in applying these schemes):

  • 7/30/2019 6559148 Fundamentals of CFD

    82/512

    ux1

    12xBp(1, 8, 0, 8, 1)

    u = O

    x4

    (3.54)3.5. FOURIER ERROR ANALYSIS 392

    ux2

    112x2Bp(1, 16, 30, 16, 1)

    u = O

    x4

    (3.55)3.5 Fourier Error AnalysisIn order to select a nite-dierence scheme for a given application onemust be ableto assess the accuracy of the candidate schemes. The accuracy of an operator is oftenexpressed in terms of the order of the leading error term determinedfrom a Taylortable. While this is a useful measure, it provides a fairly limited description. Furtherinformation about the error behavior of a nite-dierence scheme can beobtainedusing Fourier error analysis.

    3.5.1 Application to a Spatial OperatorAn arbitrary periodic function can be decomposed into its Fourier components, whichare in the form eix, where is the wavenumber. It is therefore of interest to examinehow well a given nite-dierence operator approximates derivatives of eix. We willconcentrate here on rst derivative approximations, although the analysis

  • 7/30/2019 6559148 Fundamentals of CFD

    83/512

    is equallyapplicable to higher derivatives.The exact rst derivative of eixiseixx= ie

    ix(3.56)If we apply, for example, a second-order centered dierence operatorto uj= e

    ixj,where xj= jx, we get

    (xu)

    j =u

    j+1uj12x=e

    ix(j+1)eix(j1)2x

    = (eixeix)eixj2x=1

    2x[(cos x +i sin x) (cosx i sinx)]e

    ixj= isinxxe

    ixj= i

  • 7/30/2019 6559148 Fundamentals of CFD

    84/512

    eixj(3.57)40 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONS0 0.5 1 1.5 2 2.5 300.511.522.53 x *x 2 Centralnd4 Centralth4 PadethFigure 3.4: Modied wavenumber for various schemes.

    where is the modied wavenumber. The modied wavenumber is so named becauseit appears where the wavenumber, , appears in the exact expression. Thus the degreeto which the modied wavenumber approximates the actual wavenumber is a measureof the accuracy of the approximation.For the second-order centered dierence operator the modied wavenumber is givenby=sinx

    x(3.58)Note that approximates to second-order accuracy, as is to be expected, since

    sinxx=

    3x26

    +. . .Equation 3.58 is plotted in Figure 3.4, along with similar relations for the stan-dard fourth-order centered dierence scheme and the fourth-order Pade scheme. Theexpression for the modied wavenumber provides the accuracy with whicha givenwavenumber component of the solution is resolved for the entire wavenumber rangeavailable in a mesh of a given size, 0 x .

  • 7/30/2019 6559148 Fundamentals of CFD

    85/512

    I

    general, nite-dierence operators can be written in the form(x)j= (

    ax)j+ (sx)j3.5. FOURIER ERROR ANALYSIS 41where (ax)jis an antisymmetric operator and (

    sx

    )jis a symmetric operator.

    5If werestrict our interest to schemes extending from j 3 to j + 3, then(axu)j=1

    x[a1(uj+1uj1) +a2(uj+2uj2

    ) +a3(uj+3uj3)]a

    (s

  • 7/30/2019 6559148 Fundamentals of CFD

    86/512

    xu)j=1

    x[d0uj+d1(uj+1+uj1) +d2(uj+2+uj2) +d3

    (uj+3+uj3)]The corresponding modied wavenumber isi=1

    x[d0

    + 2(d1cos x +d2cos 2x +d3cos 3x)+ 2i(a1sin x +a2sin2x +a3

    sin 3x) (3.59)When the nite-dierence operator is antisymmetric (centered), the modied wavenum-ber is purely real. When the operator includes a symmetric component, the modiedwavenumber is complex, with the imaginary component being entirelyerror. Thefourth-order Pade scheme is given by(xu)

  • 7/30/2019 6559148 Fundamentals of CFD

    87/512

    j1+ 4(xu)j+ (xu)j+1=3

    x(uj+1uj1)The modied wavenumber for this scheme satises6ieix+ 4i

    +ieix=3

    x(eixeix)

    which givesi=3i sinx

    (2 + cos x)xThe modied wavenumber provides a useful tool for assessing dierence approx-imations. In the context of the linear convection equation, the errors can be givena physical interpretation. Consider once again the linear convection equation in theform

    ut+a

    ux= 0

    5In terms of a circulant matrix operator A, the antisymmetric part is obtained from (AAT

  • 7/30/2019 6559148 Fundamentals of CFD

    88/512

    )/2a

    the symmetric part from (A + AT)/2.6Note that terms such as (xu)j1are handled by letting (

    xu)j= ikeijxand evaluating theshift in j.42 CHAPTER 3. FINITE-DIFFERENCE APPROXIMATIONSon a domain extending from to . Recall from Section 2.3.2 that a solutioninitiated by a harmonic function with wavenumber isu(x, t) = f(t)e

    ix(3.60)where f(t) satises the ODEdfdt= iaf

    So

    vi

    g for f(t) and substituting into Eq. 3.60 gives the exact solution asu(x, t) = f(0)ei(xat)If second-order centered dierences are applied to the spatial term, thefollowing

    ODE is obtained for f(t):

    dfdt= ia

    si

    xx

    f = iaf (3.61)Solving this ODE exactly (since we are considering the error from the spatial approx-imation only) and substituting into Eq. 3.60, we obtain

    unumerical(x, t) = f(0)ei(xat)(3.62)where ais the numerical (or modied) phase speed, which is related to the modied

  • 7/30/2019 6559148 Fundamentals of CFD

    89/512

    wavenumber byaa=

    For the above example,aa=sin x

    xThe numerical phase speed is the speed at which a harmonic function is propagatednumerically. Since a/a 1 for this example, the numerical solution propagatestoo slowly. Since ais a function of the wavenumber, the numerical approximation

    introduces dispersion, although the original PDE is nondispersive.

    As a result, awaveform consisting of many dierent wavenumber components eventually loses itsoriginal form.Figure 3.5 shows the numerical phase speed for the schemes considered previously.The number of points per wavelength (PPW) by which a given wave isresolved isgiven by 2/x. The resolving eciency of a scheme can be expressed in ermsof the PPW required to produce errors below a specied level. For example, thesecond-order centered dierence scheme requires 80 PPW to produce an

    error inphase speed of less than 0.1 percent. The 5-point fourth-order centered scheme and3.6. DIFFERENCE OPERATORS AT BOUNDARIES 430 0.5 1 1.5 2 2.5 300.20.40.60.811.2 x

    2 Centralnd4 Centralth4 Padethaa*

    _

  • 7/30/2019 6559148 Fundamentals of CFD

    90/512

    Figure 3.5: Numerical phase speed for various schemes.the fourth-order Pade scheme require 15 and 10 PPW respectively to achieve thesame error level.For our example using second-order centered dierences, the modied wavenumberis purely real, but in the general case it can include an imaginary component as