hydrodynamics - cfd

276

Upload: manuel-luxardo-collantes-diaz

Post on 28-Apr-2015

115 views

Category:

Documents


11 download

TRANSCRIPT

Page 1: Hydrodynamics - CFD

Fundamentals of Computational Fluid

Dynamics

Harvard Lomax and Thomas H� PulliamNASA Ames Research Center

David W� ZinggUniversity of Toronto Institute for Aerospace Studies

August ��� ����

Page 2: Hydrodynamics - CFD
Page 3: Hydrodynamics - CFD

Contents

� INTRODUCTION �

��� Motivation � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Background � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

����� Problem Speci�cation and Geometry Preparation � � � � � � � ������ Selection of Governing Equations and Boundary Conditions � ������ Selection of Gridding Strategy and Numerical Method � � � � ������ Assessment and Interpretation of Results � � � � � � � � � � � � �

��� Overview � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Notation � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

� CONSERVATION LAWS AND THE MODEL EQUATIONS �

��� Conservation Laws � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� The NavierStokes and Euler Equations � � � � � � � � � � � � � � � � � ��� The Linear Convection Equation � � � � � � � � � � � � � � � � � � � � ��

����� Di�erential Form � � � � � � � � � � � � � � � � � � � � � � � � � ������� Solution in Wave Space � � � � � � � � � � � � � � � � � � � � � � ��

��� The Di�usion Equation � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Di�erential Form � � � � � � � � � � � � � � � � � � � � � � � � � ������� Solution in Wave Space � � � � � � � � � � � � � � � � � � � � � � ��

��� Linear Hyperbolic Systems � � � � � � � � � � � � � � � � � � � � � � � � ����� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

� FINITE�DIFFERENCE APPROXIMATIONS ��

��� Meshes and FiniteDi�erence Notation � � � � � � � � � � � � � � � � � ����� Space Derivative Approximations � � � � � � � � � � � � � � � � � � � � ����� FiniteDi�erence Operators � � � � � � � � � � � � � � � � � � � � � � � ��

����� Point Di�erence Operators � � � � � � � � � � � � � � � � � � � � ������� Matrix Di�erence Operators � � � � � � � � � � � � � � � � � � � ������� Periodic Matrices � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Circulant Matrices � � � � � � � � � � � � � � � � � � � � � � � � ��

iii

Page 4: Hydrodynamics - CFD

��� Constructing Di�erencing Schemes of Any Order � � � � � � � � � � � � ������� Taylor Tables � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Generalization of Di�erence Formulas � � � � � � � � � � � � � � ������� Lagrange and Hermite Interpolation Polynomials � � � � � � � ������� Practical Application of Pad�e Formulas � � � � � � � � � � � � � ������� Other HigherOrder Schemes � � � � � � � � � � � � � � � � � � � �

��� Fourier Error Analysis � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Application to a Spatial Operator � � � � � � � � � � � � � � � � �

��� Di�erence Operators at Boundaries � � � � � � � � � � � � � � � � � � � ������� The Linear Convection Equation � � � � � � � � � � � � � � � � ������� The Di�usion Equation � � � � � � � � � � � � � � � � � � � � � � ��

��� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

� THE SEMI�DISCRETE APPROACH ��

��� Reduction of PDE�s to ODE�s � � � � � � � � � � � � � � � � � � � � � � ������� The Model ODE�s � � � � � � � � � � � � � � � � � � � � � � � � ������� The Generic Matrix Form � � � � � � � � � � � � � � � � � � � � ��

��� Exact Solutions of Linear ODE�s � � � � � � � � � � � � � � � � � � � � ������� Eigensystems of SemiDiscrete Linear Forms � � � � � � � � � � ������� Single ODE�s of First and SecondOrder � � � � � � � � � � � � ������� Coupled FirstOrder ODE�s � � � � � � � � � � � � � � � � � � � ������� General Solution of Coupled ODE�s with Complete Eigensystems �

��� Real Space and Eigenspace � � � � � � � � � � � � � � � � � � � � � � � � ������� De�nition � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Eigenvalue Spectrums for Model ODE�s � � � � � � � � � � � � � ������� Eigenvectors of the Model Equations � � � � � � � � � � � � � � ������� Solutions of the Model ODE�s � � � � � � � � � � � � � � � � � � ��

��� The Representative Equation � � � � � � � � � � � � � � � � � � � � � � ����� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

� FINITE�VOLUME METHODS ��

��� Basic Concepts � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Model Equations in Integral Form � � � � � � � � � � � � � � � � � � � � ��

����� The Linear Convection Equation � � � � � � � � � � � � � � � � ������� The Di�usion Equation � � � � � � � � � � � � � � � � � � � � � � ��

��� OneDimensional Examples � � � � � � � � � � � � � � � � � � � � � � � ������� A SecondOrder Approximation to the Convection Equation � ������� A FourthOrder Approximation to the Convection Equation � ������� A SecondOrder Approximation to the Di�usion Equation � � �

��� A TwoDimensional Example � � � � � � � � � � � � � � � � � � � � � � �

Page 5: Hydrodynamics - CFD

��� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

� TIME�MARCHING METHODS FOR ODES �

��� Notation � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Converting TimeMarching Methods to O�E�s � � � � � � � � � � � � � ���� Solution of Linear O�E�s With Constant Coe�cients � � � � � � � � �

����� First and SecondOrder Di�erence Equations � � � � � � � � � ����� Special Cases of Coupled FirstOrder Equations � � � � � � � � �

��� Solution of the Representative O�E�s � � � � � � � � � � � � � � � � � ������ The Operational Form and its Solution � � � � � � � � � � � � � ������ Examples of Solutions to TimeMarching O�E�s � � � � � � � � �

��� The �� � Relation � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Establishing the Relation � � � � � � � � � � � � � � � � � � � � � ������ The Principal �Root � � � � � � � � � � � � � � � � � � � � � � � ������ Spurious �Roots � � � � � � � � � � � � � � � � � � � � � � � � � ������ OneRoot TimeMarching Methods � � � � � � � � � � � � � � � �

��� Accuracy Measures of TimeMarching Methods � � � � � � � � � � � � ������ Local and Global Error Measures � � � � � � � � � � � � � � � � ������ Local Accuracy of the Transient Solution �er�� j�j � er�� � � � � ����� Local Accuracy of the Particular Solution �er�� � � � � � � � � ����� Time Accuracy For Nonlinear Applications � � � � � � � � � � � �������� Global Accuracy � � � � � � � � � � � � � � � � � � � � � � � � � ���

��� Linear Multistep Methods � � � � � � � � � � � � � � � � � � � � � � � � �������� The General Formulation � � � � � � � � � � � � � � � � � � � � � �������� Examples � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �������� TwoStep Linear Multistep Methods � � � � � � � � � � � � � � ���

�� PredictorCorrector Methods � � � � � � � � � � � � � � � � � � � � � � � ����� RungeKutta Methods � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Implementation of Implicit Methods � � � � � � � � � � � � � � � � � � � ���

������ Application to Systems of Equations � � � � � � � � � � � � � � ��������� Application to Nonlinear Equations � � � � � � � � � � � � � � � ��������� Local Linearization for Scalar Equations � � � � � � � � � � � � ��������� Local Linearization for Coupled Sets of Nonlinear Equations � ���

���� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

� STABILITY OF LINEAR SYSTEMS ���

��� Dependence on the Eigensystem � � � � � � � � � � � � � � � � � � � � � ������ Inherent Stability of ODE�s � � � � � � � � � � � � � � � � � � � � � � � ���

����� The Criterion � � � � � � � � � � � � � � � � � � � � � � � � � � � �������� Complete Eigensystems � � � � � � � � � � � � � � � � � � � � � � ���

Page 6: Hydrodynamics - CFD

����� Defective Eigensystems � � � � � � � � � � � � � � � � � � � � � � ���

��� Numerical Stability of O�E �s � � � � � � � � � � � � � � � � � � � � � � ���

����� The Criterion � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

����� Complete Eigensystems � � � � � � � � � � � � � � � � � � � � � � ���

����� Defective Eigensystems � � � � � � � � � � � � � � � � � � � � � � ���

��� TimeSpace Stability and Convergence of O�E�s � � � � � � � � � � � � ���

��� Numerical Stability Concepts in the Complex �Plane � � � � � � � � � ��

����� �Root Traces Relative to the Unit Circle � � � � � � � � � � � ��

����� Stability for Small �t � � � � � � � � � � � � � � � � � � � � � � � ���

��� Numerical Stability Concepts in the Complex �h Plane � � � � � � � � ���

����� Stability for Large h� � � � � � � � � � � � � � � � � � � � � � � � ���

����� Unconditional Stability� AStable Methods � � � � � � � � � � � ���

����� Stability Contours in the Complex �h Plane� � � � � � � � � � � ���

��� Fourier Stability Analysis � � � � � � � � � � � � � � � � � � � � � � � � ���

����� The Basic Procedure � � � � � � � � � � � � � � � � � � � � � � � ���

����� Some Examples � � � � � � � � � � � � � � � � � � � � � � � � � � ���

����� Relation to Circulant Matrices � � � � � � � � � � � � � � � � � � ���

�� Consistency � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

�� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

CHOICE OF TIME�MARCHING METHODS ���

�� Sti�ness De�nition for ODE�s � � � � � � � � � � � � � � � � � � � � � � ��

���� Relation to �Eigenvalues � � � � � � � � � � � � � � � � � � � � ��

���� Driving and Parasitic Eigenvalues � � � � � � � � � � � � � � � � ���

���� Sti�ness Classi�cations � � � � � � � � � � � � � � � � � � � � � � ���

�� Relation of Sti�ness to Space Mesh Size � � � � � � � � � � � � � � � � ���

�� Practical Considerations for Comparing Methods � � � � � � � � � � � ���

�� Comparing the E�ciency of Explicit Methods � � � � � � � � � � � � � ���

���� Imposed Constraints � � � � � � � � � � � � � � � � � � � � � � � ���

���� An Example Involving Di�usion � � � � � � � � � � � � � � � � � ���

���� An Example Involving Periodic Convection � � � � � � � � � � � ���

�� Coping With Sti�ness � � � � � � � � � � � � � � � � � � � � � � � � � � ��

���� Explicit Methods � � � � � � � � � � � � � � � � � � � � � � � � � ��

���� Implicit Methods � � � � � � � � � � � � � � � � � � � � � � � � � ��

���� A Perspective � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

�� Steady Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

�� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

Page 7: Hydrodynamics - CFD

� RELAXATION METHODS ���

�� Formulation of the Model Problem � � � � � � � � � � � � � � � � � � � ��� ���� Preconditioning the Basic Matrix � � � � � � � � � � � � � � � � ��� ���� The Model Equations � � � � � � � � � � � � � � � � � � � � � � � ���

�� Classical Relaxation � � � � � � � � � � � � � � � � � � � � � � � � � � � �� ���� The Delta Form of an Iterative Scheme � � � � � � � � � � � � � �� ���� The Converged Solution� the Residual� and the Error � � � � � �� ���� The Classical Methods � � � � � � � � � � � � � � � � � � � � � � ��

�� The ODE Approach to Classical Relaxation � � � � � � � � � � � � � � ��� ���� The Ordinary Di�erential Equation Formulation � � � � � � � � ��� ���� ODE Form of the Classical Methods � � � � � � � � � � � � � � ���

�� Eigensystems of the Classical Methods � � � � � � � � � � � � � � � � � ��� ���� The PointJacobi System � � � � � � � � � � � � � � � � � � � � � ��� ���� The GaussSeidel System � � � � � � � � � � � � � � � � � � � � � ��� ���� The SOR System � � � � � � � � � � � � � � � � � � � � � � � � � ��

�� Nonstationary Processes � � � � � � � � � � � � � � � � � � � � � � � � � �� �� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

�� MULTIGRID ���

���� Motivation � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Eigenvector and Eigenvalue Identi�cation with Space Frequencies� ������� Properties of the Iterative Method � � � � � � � � � � � � � � � � �

���� The Basic Process � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� A TwoGrid Process � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

�� NUMERICAL DISSIPATION ���

���� OneSided FirstDerivative Space Di�erencing � � � � � � � � � � � � � ������� The Modi�ed Partial Di�erential Equation � � � � � � � � � � � � � � � ������� The LaxWendro� Method � � � � � � � � � � � � � � � � � � � � � � � � ������� Upwind Schemes � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

������ FluxVector Splitting � � � � � � � � � � � � � � � � � � � � � � � ��������� FluxDi�erence Splitting � � � � � � � � � � � � � � � � � � � � � ���

���� Arti�cial Dissipation � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

�� SPLIT AND FACTORED FORMS ���

���� The Concept � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Factoring Physical Representations � Time Splitting � � � � � � � � � ������ Factoring Space Matrix Operators in ��D � � � � � � � � � � � � � � � � ���

Page 8: Hydrodynamics - CFD

������ Mesh Indexing Convention � � � � � � � � � � � � � � � � � � � � ��������� Data Bases and Space Vectors � � � � � � � � � � � � � � � � � � ��������� Data Base Permutations � � � � � � � � � � � � � � � � � � � � � ��������� Space Splitting and Factoring � � � � � � � � � � � � � � � � � � ���

���� SecondOrder Factored Implicit Methods � � � � � � � � � � � � � � � � ������� Importance of Factored Forms in � and � Dimensions � � � � � � � � � ������� The Delta Form � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

�� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS ���

���� The Representative Equation for Circulant Operators � � � � � � � � � ������� Example Analysis of Circulant Systems � � � � � � � � � � � � � � � � � ���

������ Stability Comparisons of TimeSplit Methods � � � � � � � � � ��������� Analysis of a SecondOrder TimeSplit Method � � � � � � � � ���

���� The Representative Equation for SpaceSplit Operators � � � � � � � � ������ Example Analysis of �D Model Equations � � � � � � � � � � � � � � � ���

������ The Unfactored Implicit Euler Method � � � � � � � � � � � � � ��������� The Factored Nondelta Form of the Implicit Euler Method � � ��������� The Factored Delta Form of the Implicit Euler Method � � � � ��������� The Factored Delta Form of the Trapezoidal Method � � � � � ���

���� Example Analysis of the �D Model Equation � � � � � � � � � � � � � ������� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

A USEFUL RELATIONS AND DEFINITIONS FROM LINEAR AL�

GEBRA ���

A�� Notation � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� A�� De�nitions � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���A�� Algebra � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���A�� Eigensystems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���A�� Vector and Matrix Norms � � � � � � � � � � � � � � � � � � � � � � � � ���

B SOME PROPERTIES OF TRIDIAGONAL MATRICES ���

B�� Standard Eigensystem for Simple Tridiagonals � � � � � � � � � � � � � ���B�� Generalized Eigensystem for Simple Tridiagonals � � � � � � � � � � � � ��B�� The Inverse of a Simple Tridiagonal � � � � � � � � � � � � � � � � � � � �� B�� Eigensystems of Circulant Matrices � � � � � � � � � � � � � � � � � � � ���

B���� Standard Tridiagonals � � � � � � � � � � � � � � � � � � � � � � ���B���� General Circulant Systems � � � � � � � � � � � � � � � � � � � � ���

B�� Special Cases Found From Symmetries � � � � � � � � � � � � � � � � � ���B�� Special Cases Involving Boundary Conditions � � � � � � � � � � � � � ���

Page 9: Hydrodynamics - CFD

C THEHOMOGENEOUS PROPERTYOF THE EULER EQUATIONS���

Page 10: Hydrodynamics - CFD

Chapter �

INTRODUCTION

��� Motivation

The material in this book originated from attempts to understand and systemize numerical solution techniques for the partial di�erential equations governing the physicsof �uid �ow� As time went on and these attempts began to crystallize� underlyingconstraints on the nature of the material began to form� The principal such constraintwas the demand for uni�cation� 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� but the authorsbelieve the answer is a�rmative and present this book as justi�cation for that belief� 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 understand the physical events that occur in the �ow of �uids around and within designatedobjects� These events are related to the action and interaction of phenomena suchas dissipation� di�usion� convection� shock waves� slip surfaces� boundary layers� andturbulence� In the �eld of aerodynamics� all of these phenomena are governed bythe compressible NavierStokes equations� Many of the most important aspects ofthese relations are nonlinear and� as a consequence� often have no analytic solution�This� of course� motivates the numerical solution of the associated partial di�erentialequations� At the same time it would seem to invalidate the use of linear algebra forthe classi�cation 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 partialdi�erential equations introduces an approximation that� in e�ect� can change theform of the basic partial di�erential equations themselves� The new equations� which

Page 11: Hydrodynamics - CFD

� CHAPTER �� INTRODUCTION

are the ones actually being solved by the numerical process� are often referred to asthe modi�ed partial di�erential 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 di�erential equation� Mathematically� these di�erences are usually referred toas truncation errors� However� the theory associated with the numerical analysis of�uid mechanics was developed predominantly by scientists deeply interested in thephysics of �uid �ow and� as a consequence� these errors are often identi�ed with aparticular physical phenomenon on which they have a strong e�ect� Thus methods aresaid to have a lot of �arti�cial viscosity� or said to be highly dispersive� This meansthat the errors caused by the numerical approximation result in a modi�ed partialdi�erential equation having additional terms that can be identi�ed with the physicsof dissipation in the �rst case and dispersion in the second� There is nothing wrong�of course� with identifying an error with a physical process� nor with deliberatelydirecting an error to a speci�c 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 modi�ed partialdi�erential 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 e�ects are not thor

oughly understood and controlled� they can lead to serious di�culties� producinganswers that represent little� if any� physical reality� This motivates studying theconcepts of stability� convergence� and consistency� On the other hand� even if theerrors are kept small enough that they can be neglected �for engineering purposes��the resulting simulation can still be of little practical use if ine�cient or inappropriatealgorithms are used� This motivates studying the concepts of sti�ness� factorization�and algorithm development in general� All of these concepts we hope to clarify inthis book�

��� Background

The �eld of computational �uid dynamics has a broad range of applicability� Independent of the speci�c application under study� the following sequence of steps generallymust be followed in order to obtain a satisfactory solution�

����� Problem Speci�cation and Geometry Preparation

The �rst step involves the speci�cation of the problem� including the geometry� �owconditions� and the requirements of the simulation� The geometry may result from

Page 12: Hydrodynamics - CFD

���� BACKGROUND �

measurements of an existing con�guration or may be associated with a design study�Alternatively� in a design context� no geometry need be supplied� Instead� a setof objectives and constraints must be speci�ed� Flow conditions might include� 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 con�ict and compromise is necessary� As an exampleof solution parameters of interest in computing the �ow�eld about an airfoil� one maybe interested in i� the lift and pitching moment only� ii� the drag as well as the liftand pitching moment� or iii� the details of the �ow at some speci�c location�

����� Selection of Governing Equations and Boundary Con�

ditions

Once the problem has been speci�ed� 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 conservationof mass� momentum� and energy� The partial di�erential equations resulting fromthese conservation laws are referred to as the NavierStokes equations� However� inthe interest of e�ciency� it is always prudent to consider solving simpli�ed formsof the NavierStokes equations when the simpli�cations retain the physics which areessential to the goals of the simulation� Possible simpli�ed governing equations includethe potential�ow equations� the Euler equations� and the thinlayer NavierStokesequations� These may be steady or unsteady and compressible or incompressible�Boundary types which may be encountered include solid walls� in�ow and out�owboundaries� periodic boundaries� symmetry boundaries� etc� The boundary conditionswhich must be speci�ed depend upon the governing equations� For example� at a solidwall� the Euler equations require �ow tangency to be enforced� while the NavierStokesequations require the noslip condition� If necessary� physical models must be chosenfor processes which cannot be simulated within the speci�ed constraints� Turbulenceis 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 governing equations andphysical models based on the problem speci�cation�

����� Selection of Gridding Strategy and Numerical Method

Next a numerical method and a strategy for dividing the �ow domain into cells� orelements� must be selected� We concern ourselves here only with numerical methods requiring such a tessellation of the domain� which is known as a grid� or mesh�

Page 13: Hydrodynamics - CFD

� CHAPTER �� INTRODUCTION

Many di�erent 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 solutionadaptive gridding� The numericalmethods generally used in CFD can be classi�ed as �nitedi�erence� �nitevolume��niteelement� or spectral methods� The choices of a numerical method and a gridding strategy are strongly interdependent� For example� the use of �nitedi�erencemethods is typically restricted to structured grids� Here again� the success of a simulation can depend on appropriate choices for the problem or class of problems ofinterest�

����� Assessment and Interpretation of Results

Finally� the results of the simulation must be assessed and interpreted� This step canrequire postprocessing of the data� for example calculation of forces and moments�and can be aided by sophisticated �ow visualization tools and error estimation techniques� It is critical that the magnitude of both numerical and physicalmodel errorsbe well understood�

��� Overview

It should be clear that successful simulation of �uid �ows can involve a wide range ofissues from grid generation to turbulence modelling to the applicability of various simpli�ed forms of the NavierStokes equations� Many of these issues are not addressedin this book� Some of them are presented in the books by Anderson� Tannehill� andPletcher ��� and Hirsch ���� Instead we focus on numerical methods� with emphasison �nitedi�erence and �nitevolume methods for the Euler and NavierStokes equations� Rather than presenting the details of the most advanced methods� which arestill evolving� we present a foundation for developing� analyzing� and understandingsuch methods�Fortunately� to develop� analyze� and understand most numerical methods used to

�nd solutions for the complete compressible NavierStokes equations� we can make useof much simpler expressions� the socalled �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 given numerical methodwhen applied to a more complicated system of equations which governs similar physical phenomena� Although the model equations are extremely simple and easy tosolve� they have been carefully selected to be representative� when used intelligently�of di�culties and complexities that arise in realistic two and threedimensional �uid�ow simulations� We believe that a thorough understanding of what happens when

Page 14: Hydrodynamics - CFD

���� NOTATION �

numerical approximations are applied to the model equations is a major �rst step inmaking con�dent and competent use of numerical approximations to the Euler andNavierStokes equations� As a word of caution� however� it should be 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 numerical methods to practical problems� there are many aspects of practical problemswhich can only be understood in the context of the complete physical systems�

��� Notation

The notation is generally explained as it is introduced� Bold type is reserved for realphysical vectors� such as velocity� The vector symbol� is used for the vectors �orcolumn matrices� which contain the values of the dependent variable at the nodesof a grid� Otherwise� the use of a vector consisting of a collection of scalars shouldbe apparent from the context and is not identi�ed by any special notation� Forexample� the variable u can denote a scalar Cartesian velocity component in the Eulerand NavierStokes equations� a scalar quantity in the linear convection and di�usionequations� and a vector consisting of a collection of scalars in our presentation ofhyperbolic systems� Some of the abbreviations used throughout the text are listedand de�ned below�

PDE Partial di�erential equation

ODE Ordinary di�erential equation

O�E Ordinary di�erence equation

RHS Righthand side

P�S� Particular solution of an ODE or system of ODE�s

S�S� Fixed �timeinvariant� steadystate solution

kD kdimensional space��bc�

Boundary conditions� usually a vector

O��� A term of order �i�e�� proportional to� �

Page 15: Hydrodynamics - CFD

� CHAPTER �� INTRODUCTION

Page 16: Hydrodynamics - CFD

Chapter �

CONSERVATION LAWS AND

THE MODEL EQUATIONS

We start out by casting our equations in the most general form� the integral conservationlaw form� which is useful in understanding the concepts involved in �nitevolumeschemes� The equations are then recast into divergence form� which is natural for�nitedi�erence schemes� The Euler and NavierStokes equations are brie�y discussedin this Chapter� The main focus� though� will be on representative model equations�in particular� the convection and di�usion equations� These equations contain manyof the salient mathematical and physical features of the full NavierStokes equations�The concepts of convection and di�usion are prevalent in our development of numerical methods for computational �uid dynamics� and the recurring use of thesemodel equations allows us to develop a consistent framework of analysis for consistency� accuracy� stability� and convergence� The model equations we study have twoproperties in common� They are linear partial di�erential equations �PDE�s� withcoe�cients that are constant in both space and time� and they represent phenomenaof importance to the analysis of certain aspects of �uid dynamic problems�

��� Conservation Laws

Conservation laws� such as the Euler and NavierStokes equations and our modelequations� can be written in the following integral form�Z

V �t��QdV �

ZV �t��

QdV �Z t�

t�

IS�t�

n�FdSdt Z t�

t�

ZV �t�

PdV dt �����

In this equation� Q is a vector containing the set of variables which are conserved�e�g�� mass� momentum� and energy� per unit volume� The equation is a statement of

Page 17: Hydrodynamics - CFD

CHAPTER �� CONSERVATION LAWS AND THE MODEL EQUATIONS

the conservation of these quantities in a �nite region of space with volume V �t� andsurface area S�t� over a �nite interval of time t� � t�� 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 rate of productionof Q per unit volume per unit time� If all variables are continuous in time� then Eq���� can be rewritten as

d

dt

ZV �t�

QdV �IS�t�

n�FdS ZV �t�

PdV �����

Those methods which make various numerical approximations of the integrals in Eqs���� and ��� and �nd a solution for Q on that basis are referred to as �nite�volumemethods� Many of the advanced codes written for CFD applications are based on the�nitevolume concept�On the other hand� a partial derivative form of a conservation law can also be

derived� The divergence form of Eq� ��� is obtained by applying Gauss�s theorem tothe �ux integral� leading to

�Q

�t�r�F P �����

where r� is the wellknown divergence operator given� in Cartesian coordinates� by

r� ��i�

�x� j

�y� k

�z

�� �����

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� ��� and�nd a solution for Q on that basis are referred to as �nite�di�erence methods�

��� The Navier�Stokes and Euler Equations

The NavierStokes equations form a coupled system of nonlinear PDE�s describingthe conservation of mass� momentum and energy for a �uid� For a Newtonian �uidin one dimension� they can be written as

�Q

�t��E

�x � �����

with

Q

��������

�u

e

� � E

��������u

�u� � p

u�e� p�

���������

���u�x

��u�u

�x� �T

�x

� �����

Page 18: Hydrodynamics - CFD

���� THE NAVIER�STOKES AND EULER EQUATIONS

where � 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 coe�cient of viscosity� and is the thermalconductivity� The total energy e includes internal energy per unit volume �� �where� is the internal energy per unit mass� and kinetic energy per unit volume �u����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 ��� and Hirsch ���� Note that the convective�uxes 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� Nonconservative forms can be obtained by expanding derivativesof products using the product rule or by introducing di�erent dependent variables�such as u and p� Although nonconservative forms of the equations are analyticallythe same as the above form� they can lead to quite di�erent 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�Many �ows of engineering interest are steady �timeinvariant�� or at least may be

treated as such� For such �ows� we are often interested in the steadystate solution ofthe NavierStokes equations� with no interest in the transient portion of the solution�The steady solution to the onedimensional NavierStokes equations must satisfy

�E

�x � �����

If we neglect viscosity and heat conduction� the Euler equations are obtained� Intwodimensional Cartesian coordinates� these can be written as

�Q

�t��E

�x��F

�y � ����

with

Q

�����q�q�q�q�

� �������u�ve

� � E

������u

�u� � p�uv

u�e� p�

� � F

������v�uv

�v� � pv�e� p�

� ��� �

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� A

�Q

�x�B

�Q

�y � ������

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 order

Page 19: Hydrodynamics - CFD

�� CHAPTER �� CONSERVATION LAWS AND THE MODEL EQUATIONS

to derive the �ux Jacobian matrices� we must �rst write the �ux vectors E and F interms of the conservative variables� q�� q�� q�� and q�� as follows�

E

�������������

E�

E�

E�

E�

����������������

q�

� � ��q� � ����

q��

q�� ���

q��

q�

q�q�q�

q�q�q�� ���

�q��

q��

�q��q�q��

�������

F

�������������

F�

F�

F�

F�

���������������

q�

q�q�q�

� � ��q� � ����

q��

q�� ���

q��

q�

q�q�q�� ���

�q��q�q��

�q��

q��

�������

We have assumed that the pressure satis�es p � � ���e � ��u� � v����� from theideal gas law� where is the ratio of speci�c heats� cp�cv� From this it follows thatthe �ux Jacobian of E can be written in terms of the conservative variables as

A �Ei

�qj

���������������

� � � �

a�� ��� ��q�q�

���� �

�q�q�

� � �

��q�q�

��q�q�

� �q�q�

� �q�q�

��

a�� a�� a�� �q�q�

�������

where

a�� � ��

�q�q�

��

� ��

�q�q�

��

Page 20: Hydrodynamics - CFD

���� THE NAVIER�STOKES AND EULER EQUATIONS ��

a�� � � �����q�

q�

��

�q�q�

���q�q�

���

�q�q�

��q�q�

a��

�q�q�

�� � �

����q�q�

��

�q�q�

���

a�� �� � ���q�q�

��q�q�

�������

and in terms of the primitive variables as

A

�������������

� � � �

a�� ��� �u ��� �v � � ��

�uv v u �

a�� a�� a�� u

�������

where

a�� � ��

v� � ��

�u�

a�� � � ��u�u� � v��� ue

a�� e

�� � �

���u� � v��

a�� ��� �uv ������

Derivation of the two forms of B �F��Q is similar� The eigenvalues of the �uxJacobian matrices are purely real� This is the de�ning feature of hyperbolic systemsof PDE�s� which are further discussed in Section ���� The homogeneous property ofthe Euler equations is discussed in Appendix C�The NavierStokes equations include both convective and di�usive �uxes� This

motivates the choice of our two scalar model equations associated with the physicsof convection and di�usion� Furthermore� aspects of convective phenomena associated 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 PDE�s�

Page 21: Hydrodynamics - CFD

�� CHAPTER �� CONSERVATION LAWS AND THE MODEL EQUATIONS

��� The Linear Convection Equation

����� Di�erential Form

The simplest linear model for convection and wave propagation is the linear convectionequation given by the following PDE�

�u

�t� a

�u

�x � ������

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 conditions are speci�edseparates the following two phenomena for which this equation is a model�

��� In one type� the scalar quantity u is given on one boundary� correspondingto a wave entering the domain through this �in�ow� boundary� No boundary condition is speci�ed at the opposite side� the �out�ow� boundary� Thisis consistent in terms of the wellposedness of a �storder PDE� Hence thewave leaves the domain through the out�ow boundary without distortion orre�ection� This type of phenomenon is referred to� simply� as the convectionproblem� It represents most of the �usual� situations encountered in convecting systems� Note that the lefthand boundary is the in�ow boundary whena is positive� while the righthand boundary is the in�ow boundary when a isnegative�

��� In the other type� the �ow being simulated is periodic� At any given 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 properties ofnumerical methods applied to problems involving convection� without specialconsideration of boundaries� Hence� we pay a great deal of attention to it inthe initial chapters�

Now let us consider a situation in which the initial condition is given by u�x� �� u��x�� and the domain is in�nite� It is easy to show by substitution that the exactsolution to the linear convection equation is then

u�x� t� u��x� at� �����

The initial waveform propagates unaltered with speed jaj 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 returning to its initial position� In this case� the process continues forever without any

Page 22: Hydrodynamics - CFD

���� THE LINEAR CONVECTION EQUATION ��

change in the shape of the solution� Preserving the shape of the initial conditionu��x� can be a di�cult challenge for a numerical method�

����� Solution in Wave Space

We now examine the biconvection problem in more detail� Let the domain be givenby � � x � ��� We restrict our attention to initial conditions in the form

u�x� �� f���ei�x ���� �

where f��� is a complex constant� and is the wavenumber� In order to 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 as

u�x� t� f�t�ei�x ������

where the time dependence is contained in the complex function f�t�� Substitutingthis solution into the linear convection equation� Eq� ����� we �nd that f�t� satis�esthe following ordinary di�erential equation �ODE�

df

dt �iaf ������

which has the solutionf�t� f���e�ia�t ������

Substituting f�t� into Eq� ���� gives the following solution

u�x� t� f���ei��x�at� f���ei��x��t� ������

where the frequency� �� the wavenumber� � and the phase speed� a� are related by

� a ������

The relation between the frequency and the wavenumber is known as the dispersionrelation� The linear relation given by Eq� ���� is characteristic of wave propagationin a nondispersive medium� This means that the phase speed is the same for allwavenumbers� As we shall see later� most numerical methods introduce some dispersion! that is� in a simulation� waves with di�erent wavenumbers travel at di�erentspeeds�An arbitrary initial waveform can be produced by summing initial conditions of

the form of Eq� ��� � For M modes� one obtains

u�x� �� MXm��

fm���ei�mx ������

Page 23: Hydrodynamics - CFD

�� CHAPTER �� CONSERVATION LAWS AND THE MODEL EQUATIONS

where the wavenumbers are often ordered such that � � � � � � � � M � Since thewave equation is linear� the solution is obtained by summing solutions of the form ofEq� ����� giving

u�x� t� MXm��

fm���ei�m�x�at� ������

Dispersion and dissipation resulting from a numerical approximation will cause theshape of the solution to change from that of the original waveform�

��� The Di�usion Equation

����� Di�erential Form

Di�usive �uxes are associated with molecular motion in a continuum �uid� A simplelinear model equation for a di�usive process is

�u

�t �

��u

�x�������

where � is a positive real constant� For example� with u representing the temperature� this parabolic PDE governs the di�usion of heat in one dimension� Boundaryconditions can be periodic� Dirichlet �speci�ed u�� Neumann �speci�ed �u��x�� ormixed Dirichlet"Neumann�

In contrast to the linear convection equation� the di�usion equation has a nontrivialsteady�state solution� which is one that satis�es the governing PDE with the partialderivative in time equal to zero� In the case of Eq� ����� the steadystate solutionmust satisfy

��u

�x� � �����

Therefore� u must vary linearly with x at steady state such that the boundary conditions are satis�ed� Other steadystate solutions are obtained if a source term g�x�is added to Eq� ����� as follows�

�u

�t �

���u

�x�� g�x�

����� �

giving a steady statesolution which satis�es

��u

�x�� g�x� � ������

Page 24: Hydrodynamics - CFD

���� THE DIFFUSION EQUATION ��

In two dimensions� the di�usion equation becomes

�u

�t �

���u

�x����u

�y�� g�x� y�

�������

where g�x� y� is again a source term� The corresponding steady equation is

��u

�x����u

�y�� g�x� y� � ������

While Eq� ���� is parabolic� Eq� ���� is elliptic� The latter is known as the Poissonequation for nonzero g� and as Laplace�s equation for zero g�

����� Solution in Wave Space

We now consider a series solution to Eq� ����� Let the domain be given by � � x � �with boundary conditions u��� ua� u��� ub� It is clear that the steadystatesolution is given by a linear function which satis�es the boundary conditions� i�e��h�x� ua � �ub � ua�x��� Let the initial condition be

u�x� �� MXm��

fm��� sinmx� h�x� ������

where must be an integer in order to satisfy the boundary conditions� A solutionof the form

u�x� t� MXm��

fm�t� sin mx � h�x� ������

satis�es the initial and boundary conditions� Substituting this form into Eq� ����gives the following ODE for fm�

dfmdt

��m�fm ������

and we �ndfm�t� fm���e

���m�t ������

Substituting fm�t� into equation ����� we obtain

u�x� t� MXm��

fm���e���m�t sinmx � h�x� ������

The steadystate solution �t��� is simply h�x�� Eq� ���� shows that high wavenumber components �large m� of the solution decay more rapidly than low wavenumbercomponents� consistent with the physics of di�usion�

Page 25: Hydrodynamics - CFD

�� CHAPTER �� CONSERVATION LAWS AND THE MODEL EQUATIONS

��� Linear Hyperbolic Systems

The Euler equations� Eq� ��� form a hyperbolic system of partial di�erential equations� Other systems of equations governing convection and wave propagation phenomena� such as the Maxwell equations describing the propagation of electromagneticwaves� are also of hyperbolic type� Many aspects of numerical methods for such systems can be understood by studying a onedimensional constantcoe�cient linearsystem of the form

�u

�t� A

�u

�x � �����

where u u�x� t� is a vector of length m and A is a real m � m matrix� Forconservation laws� this equation can also be written in the form

�u

�t��f

�x � ���� �

where f is the �ux vector and A �f�uis the �ux Jacobian matrix� The entries in the

�ux Jacobian are

aij �fi�uj

������

The �ux Jacobian for the Euler equations is derived in Section ����Such a system is hyperbolic if A is diagonalizable with real eigenvalues�� Thus

# X��AX ������

where # is a diagonal matrix containing the eigenvalues of A� and X is the matrixof right eigenvectors� Premultiplying Eq� ��� by X��� postmultiplying A by theproduct XX��� and noting that X and X�� are constants� we obtain

�X��u

�t��

z � �X��AX X��u

�x � ������

With w X��u� this can be rewritten as

�w

�t� #

�w

�x � ������

When written in this manner� the equations have been decoupled into m scalar equations of the form

�wi

�t� �i

�wi

�x � ������

�See Appendix A for a brief review of some basic relations and de�nitions from linear algebra�

Page 26: Hydrodynamics - CFD

���� PROBLEMS ��

The elements of w are known as characteristic variables� Each characteristic variablesatis�es 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� ��� has a

solution given by the superposition of waves which can travel in either the positive ornegative directions and at varying speeds� While the scalar linear convection equationis 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 onedimensional Euler equations can also be diagonalized� leading to three

equations in the form of the linear convection equation� although they remain nonlinear� of course� The eigenvalues of the �ux Jacobian matrix� or wave speeds� are

u� u � c� and u � c� where u is the local �uid velocity� and c q p�� is the local

speed 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 supersonic �ow� wherejuj � c� all of the wave speeds have the same sign� In a subsonic �ow� where juj � c�wave speeds of both positive and negative sign are present� corresponding to the factthat sound waves can travel upstream in a subsonic �ow�The signs of the eigenvalues of the matrix A are also important in determining

suitable boundary conditions� The characteristic variables each satisfy the linear convection equation with the wave speed given by the corresponding eigenvalue� Therefore� the boundary conditions can be speci�ed accordingly� That is� characteristicvariables associated with positive eigenvalues can be speci�ed at the left boundary�which corresponds to in�ow for these variables� Characteristic variables associatedwith negative eigenvalues can be speci�ed 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�

�� Problems

�� Show that the �D Euler equations can be written in terms of the primitivevariables R ��� u� p�T as follows�

�R

�t�M

�R

�x �

where

M

��� u � �� u ���

� p u

Page 27: Hydrodynamics - CFD

� CHAPTER �� CONSERVATION LAWS AND THE MODEL EQUATIONS

Assume an ideal gas� p � � ���e� �u�����

�� Find the eigenvalues and eigenvectors of the matrix M derived in question ��

�� Derive the �ux Jacobian matrix A �E��Q for the �D Euler equations resulting from the conservative variable formulation �Eq� ����� Find its eigenvaluesand compare with those obtained in question ��

�� Show that the two matricesM and A derived in questions � and �� respectively�are related by a similarity transform� �Hint� make use of the matrix S �Q��R��

�� Write the �D di�usion equation� Eq� ����� in the form of Eq� ����

�� Given the initial condition u�x� �� sinx de�ned on � � x � ��� write it in theform of Eq� ����� that is� �nd the necessary values of fm���� �Hint� use M �with � � and � ���� Next consider the same initial condition de�nedonly at x ��j��� j �� �� �� �� Find the values of fm��� required to reproducethe initial condition at these discrete points using M � with m m� ��

�� Plot the �rst three basis functions used in constructing the exact solution tothe di�usion equation in Section ������ Next consider a solution with boundaryconditions ua ub �� and initial conditions from Eq� ���� with fm��� �for � � m � �� fm��� � for m � �� Plot the initial condition on the domain� � x � �� Plot the solution at t � with � ��

� Write the classical wave equation ��u��t� c���u��x� as a �rstorder system�i�e�� in the form

�U

�t� A

�U

�x �

where U ��u��x� �u��t�T � Find the eigenvalues and eigenvectors of A�

� The CauchyRiemann equations are formed from the coupling of the steadycompressible continuity �conservation of mass� equation

��u

�x���v

�y �

and the vorticity de�nition

� ��v

�x��u

�y �

Page 28: Hydrodynamics - CFD

���� PROBLEMS �

where � � for irrotational �ow� For isentropic and homenthalpic �ow� thesystem is closed by the relation

� ��� � �

�u� � v� � �

�� �

���

Note that the variables have been nondimensionalized� Combining the twoPDE�s� we have

�f�q�

�x��g�q�

�y �

where

q �uv

�� f

���uv

�� g

���v�u

�One approach to solving these equations is to add a timedependent term and�nd the steady solution of the following equation�

�q

�t��f

�x��g

�y �

�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 system ishyperbolic� i�e�� has real eigenvalues�

�d� Are the above �uxes homogeneous� �See Appendix C��

Page 29: Hydrodynamics - CFD

�� CHAPTER �� CONSERVATION LAWS AND THE MODEL EQUATIONS

Page 30: Hydrodynamics - CFD

Chapter �

FINITE�DIFFERENCE

APPROXIMATIONS

In common with the equations governing unsteady �uid �ow� our model equationscontain partial derivatives with respect to both space and time� One can approximate these simultaneously and then solve the resulting di�erence equations� Alternatively� one can approximate the spatial derivatives �rst� thereby producing a systemof ordinary di�erential equations� The time derivatives are approximated next� leading to a time�marching method which produces a set of di�erence equations� Thisis the approach emphasized here� In this chapter� the concept of �nitedi�erenceapproximations 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 �� Strategies for applying these�nitedi�erence approximations will be discussed in Chapter ��

All of the material below is presented in a Cartesian system� We emphasize thefact 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 socalled computational space� as shown in Figure ���� The computationalspace is uniform! all the geometric variation is absorbed into variable coe�cients of thetransformed equations� For this reason� in much of the following accuracy analysis�we use an equispaced Cartesian system without being unduly restrictive or losingpractical application�

��� Meshes and Finite�Di�erence Notation

The simplest mesh involving both time and space is shown in Figure ���� Inspectionof this �gure permits us to de�ne the terms and notation needed to describe �nite

��

Page 31: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

x

y

Figure ���� Physical and computational spaces�

di�erence approximations� In general� the dependent variables� u� for example� arefunctions of the independent variables t� and x� y� z� For the �rst several chapterswe consider primarily the �D case u u�x� t�� When only one variable is denoted�dependence on the other is assumed� The mesh index for x is always j� and that fort is always n� Then on an equispaced grid

x xj j�x �����

t tn n�t nh �����

where �x is the spacing in x and �t the spacing in t� as shown in Figure ���� 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� unk

u�x�m�x� u��j �m��x� ujm �����

u�x�m�x� t � kh� u�nk�jm

Notice that when used alone� both the time and space indices appear as a subscript�but when used together� time is always a superscript and is usually enclosed withparentheses to distinguish it from an exponent�

Page 32: Hydrodynamics - CFD

���� MESHES AND FINITE�DIFFERENCE NOTATION ��

t

xj-2 j-1 j j+1 j+2

n

n-1

n+1x

t

Grid orNodePoints

Figure ���� Spacetime grid arrangement�

Derivatives are expressed according to the usual conventions� Thus for partialderivatives in space or time we use interchangeably

�xu �u

�x� �tu

�u

�t� �xxu

��u

�x�� etc� �����

For the ordinary time derivative in the study of ODE�s we use

u� du

dt�����

In this text� subscripts on dependent variables are never used to express derivatives�Thus ux will not be used to represent the �rst derivative of u with respect to x�

The notation for di�erence approximations follows the same philosophy� but �withone exception� it is not unique� By this we mean that the symbol � is used to representa di�erence approximation to a derivative such that� for example�

�x � �x� �xx � �xx �����

but the precise nature �and order� of the approximation is not carried in the symbol�� Other ways are used to determine its precise meaning� The one exception is thesymbol �� which is de�ned such that

�tn tn� � tn� �xj xj� � xj� �un un� � un� etc� �����

When there is no subscript on �t or �x� the spacing is uniform�

Page 33: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

��� Space Derivative Approximations

A di�erence 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� ��� to ���� x j�x and u�x � k�x� u�j�x �k�x� ujk� Expanding the latter term about x gives

ujk uj � �k�x�

��u

�x

�j

��

��k�x��

���u

�x�

�j

� � � �� �

n$�k�x�n

��nu

�xn

�j

� � � � ����

Local di�erence approximations to a given partial derivative can be formed from linearcombinations of uj and ujk for k ���� � � ��For example� consider the Taylor series expansion for uj��

uj� uj � ��x�

��u

�x

�j

��

���x��

���u

�x�

�j

� � � �� �

n$��x�n

��nu

�xn

�j

� � � � ��� �

Now subtract uj and divide by �x to obtain

uj� � uj�x

��u

�x

�j

��

���x�

���u

�x�

�j

� � � � ������

Thus the expression �uj��uj���x is a reasonable approximation for��u�x

�jas long as

�x is small relative to some pertinent length scale� Next consider the space di�erenceapproximation �uj��uj�������x�� Expand the terms in the numerator about j andregroup the result to form the following equation

uj� � uj����x

���u

�x

�j

��x�

���u

�x�

�j

��

����x�

���u

�x�

�j

� � � ������

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 the error depends on thegrid spacing to a certain order� The error term containing the grid spacing to thelowest power gives the order of the method� From Eq� ����� we see that the expression�uj��uj���x is a �rstorder approximation to

��u�x

�j� Similarly� Eq� ���� shows that

�uj�� uj�������x� is a secondorder approximation to a �rst derivative� The latteris referred to as the threepoint centered di�erence approximation� and one often seesthe summary result presented in the form�

�u

�x

�j

uj� � uj����x

�O��x�� ������

�We assume that u�x� t� is continuously di�erentiable�

Page 34: Hydrodynamics - CFD

���� FINITE�DIFFERENCE OPERATORS ��

��� Finite�Di�erence Operators

����� Point Di�erence Operators

Perhaps the most common examples of �nitedi�erence formulas are the threepointcentereddi�erence approximations for the �rst and second derivatives���

�u

�x

�j

��x�uj� � uj��� �O��x�� �������

��u

�x�

�j

�x��uj� � �uj � uj��� �O��x�� ������

These are the basis for point di�erence 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 di�erenced orhow boundary conditions are enforced� Such additional information requires a moresophisticated formulation�

����� Matrix Di�erence Operators

Consider the relation

��xxu�j �

�x��uj� � �uj � uj��� ������

which is a point di�erence approximation to a second derivative� Now let us derive amatrix operator representation for the same approximation� Consider the four pointmesh with boundary points at a and b shown below� Notice that when we speak of�the number of points in a mesh�� we mean the number of interior points excludingthe boundaries�

a � � � � bx � � � � � �j � � � M

Four point mesh� �x ���M � ��

Now impose Dirichlet boundary conditions� u��� ua� u��� ub and use thecentered di�erence approximation given by Eq� ���� at every point in the mesh� We

�We will derive the second derivative operator shortly�

Page 35: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

arrive at the four equations�

��xxu�� �

�x��ua � �u� � u��

��xxu�� �

�x��u� � �u� � u��

��xxu�� �

�x��u� � �u� � u��

��xxu�� �

�x��u� � �u� � ub� ������

Writing these equations in the more suggestive form

��xxu�� � ua ��u� �u� ���x�

��xxu�� � u� ��u� �u� ���x�

��xxu�� � u� ��u� �u� ���x�

��xxu�� � u� ��u� �ub ���x�

������

it is clear that we can express them in a vectormatrix form� and further� that theresulting matrix has a very special form� Introducing

�u

�����u�u�u�u�

� � ��bc�

�x�

�����ua��ub

� �����

and

A �

�x�

������� �� �� �

� �� �� ��

� ���� �

we can rewrite Eq� ���� as

�xx�u A�u���bc�

������

This example illustrates a matrix di�erence operator� Each line of a matrix di�erence operator is based on a point di�erence 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 modi�ed� In theextreme case of the matrix di�erence operator representing a spectral method� none

Page 36: Hydrodynamics - CFD

���� FINITE�DIFFERENCE OPERATORS ��

of the lines is the same� The matrix operators representing the threepoint centraldi�erence approximations for a �rst and second derivative with Dirichlet boundaryconditions on a fourpoint mesh are

�x �

��x

������ �

�� � ��� � �

�� �

� � �xx �

�x�

������� �� �� �

� �� �� ��

� ������

As a further example� replace the fourth line in Eq� ���� by the following pointoperator for a Neumann boundary condition �See Section ������

��xxu�� �

�x

��u

�x

�b

� ��

�x��u� � u�� ������

where the boundary condition is��u

�x

�x��

��u

�x

�b

������

Then the matrix operator for a threepoint centraldi�erencing scheme at interiorpoints and a second�order approximation for a Neumann condition on the right isgiven by

�xx �

�x�

������� �� �� �

� �� ���� ����

� ������

Each of these matrix di�erence 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 notation

B�M � a� b� c�

���������

b ca b c

� � �

a b ca b

���

M

������

where the matrix dimensions are M �M � Use of M in the argument is optional�and the illustration is given for a simple tridiagonal matrix although any number of

Page 37: Hydrodynamics - CFD

� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

bands is a possibility� A tridiagonal matrix without constants along the bands can 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� De�ning �u as�

�u

���������

u�u�u����uM

� ������

we can approximate the second derivative of �u by

�xx�u �

�x�B������ ���u�

��bc�

������

where��bc�stands for the vector holding the Dirichlet boundary conditions on the

left and right sides�

��bc�

�x��ua� �� � � � � �� ub�T �����

If we prescribe Neumann boundary conditions on the right side� as in Eqs� ���� and����� we �nd

�xx�u �

�x�B��a��b� ���u�

��bc�

���� �

where

�a ��� �� � � � � ����T�b ���������� � � � ������T�

�bc�

�x�

�ua� �� �� � � � � ��x

��u

�x

�b

�T

Notice that the matrix operators given by Eqs� ���� and ��� carry more information than the point operator given by Eq� ����� In Eqs� ���� and ��� � the boundaryconditions have been uniquely speci�ed and it is clear that the same point operatorhas been applied at every point in the �eld except at the boundaries� The ability tospecify in the matrix derivative operator the exact nature of the approximation at the

�Note that �u is a function of time only since each element corresponds to one speci�c spatiallocation�

Page 38: Hydrodynamics - CFD

���� FINITE�DIFFERENCE OPERATORS �

various points in the �eld including the boundaries permits the use of quite 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�uj�� � a�uj�� � buj � c�uj� ������

might be the point operator for a �rst derivative� The corresponding matrix operatorhas for its arguments the coe�cients giving the weights to the values of the functionat the various locations� A jshift in the point operator corresponds to a diagonalshift in the matrix operator� Thus the matrix equivalent of Eq� ���� is

�x�u B�a�� a�� b� c�� ���u ������

Note the addition of a zero in the �fth element which makes it clear that b is thecoe�cient of uj�

����� Periodic Matrices

The above illustrated cases in which the boundary conditions are �xed� If the boundary conditions are periodic� the form of the matrix operator changes� Consider theeightpoint periodic mesh shown below� This can either be presented on a linear meshwith repeated entries� or more suggestively on a circular mesh as in Figure ���� Whenthe mesh is laid out on the perimeter of a circle� it doesn�t really matter where thenumbering starts as long as it �ends� at the point just preceding its starting location�

� � � � � � � � � � � � � � � �x � � � � � � � � � � �� �j � � � � � � � � M

Eight points on a linear periodic mesh� �x ���M

The matrix that represents di�erencing schemes for scalar equations on a periodicmesh is referred to as a periodicmatrix� A typical periodic tridiagonal matrix operator

Page 39: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

1

2

3

4

5

6

7

8

Figure ���� Eight points on a circular mesh�

with nonuniform entries is given for a �point mesh by

Bp�� � �a��b��c�

����������

b� c� a�a� b� c�

a� b� c�a� b� c�

a� b� c�c� a� b�

�������

����� Circulant Matrices

In 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 the circulantmatrix� 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 � is�����

b� b� b� b�b� b� b� b�b� b� b� b�b� b� b� b�

� ������

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

Page 40: Hydrodynamics - CFD

���� CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER ��

given by

Bp�M � a� b� c�

���������

b c aa b c

� � �

a b cc a b

���

M

������

When the standard threepoint centraldi�erencing approximations for a �rst andsecond derivative� see Eq� ����� are used with periodic boundary conditions� they takethe form

��x�p �

��x

������ � ��

�� � ��� � �

� �� �

� �

��xBp���� �� ��

and

��xx�p �

�x�

������� � �� �� �

� �� �� � ��

� �

�x�Bp������ �� ������

Clearly� these special cases of periodic operators are also circulant operators� Lateron we take advantage of this special property� Notice that there are no boundarycondition vectors since this information is all interior to the matrices themselves�

��� Constructing Di�erencing Schemes of Any Or�

der

����� Taylor Tables

The Taylor series expansion of functions about a �xed point provides a means for constructing �nitedi�erence pointoperators 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� ��� As an example� consider Table ���� which representsa Taylor table for an approximation of a second derivative using three values of thefunction centered about the point at which the derivative is to be evaluated�

Page 41: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

���u

�x�

�j

� �

�x��a uj�� � b uj � c uj�� �

�x� �x�� �x�� �x��uj

��u�x

�j

���u�x�

�j

���u�x�

�j

���u�x�

�j

�x� ����u�x�

�j

�a � uj�� �a �a � ��� � �� �a � ���� � �� �a � ���� � �� �a � ���� � ����b � uj �b�c � uj� �c �c � ��� � �� �c � ���� � �� �c � ���� � �� �c � ���� � ���

Table ���� Taylor table for centered �point Lagrangian approximation to a secondderivative�

The table is constructed so that some of the algebra is simpli�ed� At the top of thetable 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� �x� has 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 ���ku

�xk

�j

k �� �� �� � � �

The columns to the right of the leftmost one� under the headings� make up the Taylortable� Each entry is the coe�cient 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 Taylor series expansion of�c uj��

�c uj� �c uj � c � ��� � ���x �

��u

�x

�j

� c � ���� � ���x� �

���u

�x�

�j

�c � ���� � ���x� �

���u

�x�

�j

� c � ���� � ����x� �

���u

�x�

�j

� � � � ������

A Taylor table is simply a convenient way of forming linear combinations of Taylorseries on a term by term basis�

Page 42: Hydrodynamics - CFD

���� CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER ��

Consider the sum of each of these columns� To maximize the order of 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 sums of the �rst threecolumns are zero if we satisfy the equation

����� �� ��� � ��

�� � ��

���� abc

� ��� ��

��

The solution is given by �a� b� c� ������ ���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 ert occurs at the �fth column in the table �for this example all evencolumns will vanish by symmetry� and one �nds

ert �

�x�

��a����c��

��x�

���u

�x�

�j

��x���

���u

�x�

�j

������

Note that �x� has been divided through to make the error term consistent� Wehave just derived the familiar �point centraldi�erencing point operator for a secondderivative

���u

�x�

�j

� �

�x��uj�� � �uj � uj�� O��x�� �����

The Taylor table for a �point backwarddi�erencing operator representing a �rstderivative is shown in Table ����

Page 43: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

��u

�x

�j

� �

�x�a�uj�� � a�uj�� � b uj� �

�x� �x�� �x�� �x��uj

��u�x

�j

���u�x�

�j

���u�x�

�j

���u�x�

�j

�x ���u�x

�j

�a� � uj�� �a� �a� � ��� � �� �a� � ���� � �� �a� � ���� � �� �a� � ���� � ����a� � uj�� �a� �a� � ��� � �� �a� � ���� � �� �a� � ���� � �� �a� � ���� � ����b � uj �b

Table ���� Taylor table for backward �point Lagrangian approximation to a �rstderivative�

This time the �rst three columns sum to zero if����� �� ��� � ��� �� �

���� a�a�b

� ��� ����

�which gives �a�� a�� b�

�������� ��� In this case the fourth column provides the leading

truncation error term�

ert �

�x

�a���a��

��x�

���u

�x�

�j

�x�

���u

�x�

�j

���� �

Thus we have derived a secondorder backwarddi�erence approximation of a �rstderivative� �

�u

�x

�j

� �

��x�uj�� � �uj�� � �uj� O��x�� ������

����� Generalization of Di�erence Formulas

In general� a di�erence approximation to the mth derivative at grid point j can becast in terms of q � p � � neighboring points as�

�mu

�xm

�j

�qX

i��p

aiuji ert ������

Page 44: Hydrodynamics - CFD

���� CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER ��

where the ai are coe�cients to be determined through the use of Taylor tables toproduce approximations of a given order� Clearly this process can be used to �ndforward� 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 order to do this� let usapproach the subject in a slightly di�erent way� that is from the point of view ofinterpolation formulas� These formulas are discussed in many texts on numericalanalysis�

����� Lagrange and Hermite Interpolation Polynomials

The Lagrangian interpolation polynomial is given by

u�x� KXk��

ak�x�uk ������

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 �or extrapolation� with nonequispaced points

u�x� u��x� � x��x� � x�

�x� � x���x� � x��� u�

�x� � x��x� � x�

�x� � x���x� � x��

�u��x� � x��x� � x�

�x� � x���x� � x��������

Notice that the coe�cient of each uk is one when x xk� and zero when x takesany other discrete value in the set� If we take the �rst or second derivative of u�x��impose an equispaced mesh� and evaluate these derivatives at the appropriate discrete point� we rederive the �nitedi�erence approximations just presented� Finitedi�erence schemes that can be derived from Eq� ���� are referred to as Lagrangianapproximations�A generalization of the Lagrangian approach is brought about by using Hermitian

interpolation� To construct a polynomial for u�x�� Hermite formulas use values of thefunction and its derivative�s� at given points in space� Our illustration is for the casein which discrete values of the function and its �rst derivative are used� producingthe expression

u�x� X

ak�x�uk �X

bk�x�

��u

�x

�k

������

Page 45: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

Obviously higherorder derivatives could be included as the problems dictate� A complete discussion of these polynomials can be found in many references on numericalmethods� but here we need only the concept�The previous examples of a Taylor table constructed explicit point di�erence op

erators from Lagrangian interpolation formulas� Consider next the Taylor table foran implicit space di�erencing scheme for a �rst derivative arising from the use of aHermite interpolation formula� A generalization of Eq� ���� can include derivativesat neighboring points� i�e��

sXi��r

bi

��mu

�xm

�ji

�qX

i��p

aiuji ert ������

analogous to Eq� ����� An example formula is illustrated at the top of Table ���� Herenot only is the derivative at point j represented� but also included are derivatives atpoints j � � and j � �� which also must be expanded using Taylor series about pointj� This requires the following generalization of the Taylor series expansion given inEq� ��� �

�mu

�xm

�jk

���Xn��

n$�k�x�n

�n

�xn

���mu

�xm

��j

������

The derivative terms now have coe�cients �the coe�cient on the j point is takenas one to simplify the algebra� which must be determined using the Taylor tableapproach as outlined below�

d

��u

�x

�j��

��u

�x

�j

� e

��u

�x

�j�

� �

�x�auj�� � buj � cuj�� �

�x� �x�� �x�� �x�� �x��uj

��u�x

�j

���u�x�

�j

���u�x�

�j

���u�x�

�j

���u�x�

�j

�x � d��u�x

�j��

d d � ��� � �� d � ���� � �� d � ���� � �� d � ���� � ����x �

��u�x

�j

�x � e��u�x

�j�

e e � ��� � �� e � ���� � �� e � ���� � �� e � ���� � ����a � uj�� �a �a � ��� � �� �a � ���� � �� �a � ���� � �� �a � ���� � ��� �a � ���� � �����b � uj �b�c � uj� �c �c � ��� � �� �c � ���� � �� �c � ���� � �� �c � ���� � ��� �c � ���� � ����

Table ���� Taylor table for central �point Hermitian approximation to a �rst derivative�

Page 46: Hydrodynamics - CFD

���� CONSTRUCTING DIFFERENCING SCHEMES OF ANY ORDER ��

To maximize the order of accuracy� we must satisfy the relation��������� �� �� � �� � �� � ��� � �� �� �� � �� � ��� � �� �� �

�������abcde

� �������������

�having the solution �a� b� c� d� e� �

����� �� �� �� ��� Under these conditions the sixthcolumn sums to

ert �x�

���

���u

�x�

�j

������

and the method can be expressed as��u

�x

�j��

� �

��u

�x

�j

��u

�x

�j�

� �

�x��uj�� � uj�� O��x�� �����

This is also referred to as a Pad�e formula�

����� Practical Application of Pade Formulas

It is one thing to construct methods using the Hermitian concept and quite anotherto implement them in a computer code� In the form of a point operator it is probablynot evident at �rst just how Eq� ��� 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� ��� is

�B��� �� ���x�u

��xB���� �� ���u�

��bc�

���� �

in which Dirichlet boundary conditions have been imposed�� Mathematically this isequivalent to

�x�u ��B��� �� �������

��xB���� �� ���u�

��bc��

������

which can be reexpressed by the �predictorcorrector� sequence

�%u �

��xB���� �� ���u�

��bc�

�x�u � �B��� �� ������%u ������

�In this case the vector containing the boundary conditions would include values of both u and�u��x at both boundaries�

Page 47: Hydrodynamics - CFD

� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

With respect to practical implementation� the meaning of the predictor in thissequence should be clear� It simply says � take the vector array �u� di�erence it�add the boundary conditions� and store the result in the intermediate array �%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 operatorsare very common in �nite di�erence applications� They appear in the form of bandedmatrices having a small bandwidth� in this case a tridiagonal� The evaluation of�B��� �� ����� is found by means of a tridiagonal �solver�� which is simple to code�e�cient to run� and widely used� In general� Hermitian or Pad�e approximations canbe practical when they can be implemented by the use of e�cient banded solvers�

���� Other Higher�Order Schemes

Hermitian forms of the second derivative can also be easily derived by means of aTaylor table� For example

�xx�u �� �B��� ��� �������

�x�B������ ���u�

��bc��

������

is O��x�� and makes use of only tridiagonal operations� It should be mentioned thatthe spline approximation is one form of a Pad�e matrix di�erence operator� It is givenby

�xx�u � �B��� �� �������

�x�B������ ���u�

��bc��

������

but its order of accuracy is only O��x��� How much this reduction in accuracy iso�set by the increased global continuity built into a spline �t is not known� We notethat the spline �t of a �rst derivative is identical to any of the expressions in Eqs���� to �����A �nal word on Hermitian approximations� Clearly they have an advantage over

�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� ofcourse� that �ve point schemes using Lagrangian approximations can be derived thathave the same order of accuracy as the methods given in Eqs� ��� and ����� but theywill 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��

��u

�x� �

���xBp����� �� �����u O

��x�

�������

Page 48: Hydrodynamics - CFD

���� FOURIER ERROR ANALYSIS �

���u

�x�� �

���x�Bp���� ������� �������u O

��x�

�������

��� Fourier Error Analysis

In order to select a �nitedi�erence scheme for a given application one must 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 determined from a Taylortable� While this is a useful measure� it provides a fairly limited description� Furtherinformation about the error behavior of a �nitedi�erence scheme can be obtainedusing Fourier error analysis�

���� Application to a Spatial Operator

An arbitrary periodic function can be decomposed into its Fourier components� whichare in the form ei�x� where is the wavenumber� It is therefore of interest to examinehow well a given �nitedi�erence operator approximates derivatives of ei�x� We willconcentrate here on �rst derivative approximations� although the analysis is equallyapplicable to higher derivatives�The exact �rst derivative of ei�x is

�ei�x

�x iei�x ������

If we apply� for example� a secondorder centered di�erence operator to uj ei�xj �where xj j�x� we get

��xu�j uj� � uj����x

ei� x�j�� � ei� x�j���

��x

�ei� x � e�i� x�ei�xj

��x

��x��cos �x � i sin �x�� �cos �x� i sin�x��ei�xj

isin�x

�xei�xj

i�ei�xj ������

Page 49: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

0 0.5 1 1.5 2 2.5 30

0.5

1

1.5

2

2.5

3

κ x∆

κ* x∆

2 Centralnd

4 Centralth

4 Padeth

Figure ���� Modi�ed wavenumber for various schemes�

where � is the modi�ed wavenumber� The modi�ed wavenumber is so named becauseit appears where the wavenumber� � appears in the exact expression� Thus the degreeto which the modi�ed wavenumber approximates the actual wavenumber is a measureof the accuracy of the approximation�For the secondorder centered di�erence operator the modi�ed wavenumber is given

by

� sin�x

�x�����

Note that � approximates to secondorder accuracy� as is to be expected� since

sin�x

�x � ��x�

�� � � �

Equation ��� is plotted in Figure ���� along with similar relations for the standard fourthorder centered di�erence scheme and the fourthorder Pad�e scheme� Theexpression for the modi�ed wavenumber provides the accuracy with which a givenwavenumber component of the solution is resolved for the entire wavenumber rangeavailable in a mesh of a given size� � � �x � ��In general� �nitedi�erence operators can be written in the form

��x�j ��ax�j � ��

sx�j

Page 50: Hydrodynamics - CFD

���� FOURIER ERROR ANALYSIS ��

where ��ax�j is an antisymmetric operator and ��sx�j is a symmetric operator�

� If werestrict our interest to schemes extending from j � � to j � �� then

��axu�j �

�x�a��uj� � uj��� � a��uj� � uj��� � a��uj� � uj����

and

��sxu�j �

�x�d�uj � d��uj� � uj��� � d��uj� � uj��� � d��uj� � uj����

The corresponding modi�ed wavenumber is

i� �

�x�d� � ��d� cos �x � d� cos ��x� d� cos ��x�

� �i�a� sin �x � a� sin ��x � a� sin ��x� ���� �

When the �nitedi�erence operator is antisymmetric �centered�� the modi�ed wavenumber is purely real� When the operator includes a symmetric component� the modi�edwavenumber is complex� with the imaginary component being entirely error� Thefourthorder Pad�e scheme is given by

��xu�j�� � ���xu�j � ��xu�j� �

�x�uj� � uj���

The modi�ed wavenumber for this scheme satis�es�

i�e�i� x � �i� � i�ei� x �

�x�ei� x � e�i� x�

which gives

i� �i sin�x

�� � cos �x��x

The modi�ed wavenumber provides a useful tool for assessing di�erence approximations� In the context of the linear convection equation� the errors can be givena physical interpretation� Consider once again the linear convection equation in theform

�u

�t� a

�u

�x �

�In terms of a circulant matrix operator A� the antisymmetric part is obtained from �A�AT ���and the symmetric part from �A�AT ����

�Note that terms such as ��xu�j�� are handled by letting ��xu�j ik�ei�j�x and evaluating theshift in j�

Page 51: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

on a domain extending from �� to �� Recall from Section ����� that a solutioninitiated by a harmonic function with wavenumber is

u�x� t� f�t�ei�x ������

where f�t� satis�es the ODEdf

dt �iaf

Solving for f�t� and substituting into Eq� ���� gives the exact solution as

u�x� t� f���ei��x�at�

If secondorder centered di�erences are applied to the spatial term� the followingODE is obtained for f�t��

df

dt �ia

�sin�x

�x

�f �ia�f ������

Solving this ODE exactly �since we are considering the error from the spatial approximation only� and substituting into Eq� ����� we obtain

unumerical�x� t� f���ei��x�a�t� ������

where a� is the numerical �or modi�ed� phase speed� which is related to the modi�edwavenumber by

a�

a �

For the above example�a�

a sin �x

�x

The numerical phase speed is the speed at which a harmonic function is propagatednumerically� Since a��a � � for this example� the numerical solution propagatestoo slowly� Since a� is a function of the wavenumber� the numerical approximationintroduces dispersion� although the original PDE is nondispersive� As a result� awaveform consisting of many di�erent wavenumber components eventually loses itsoriginal form�Figure ��� shows the numerical phase speed for the schemes considered previously�

The number of points per wavelength �PPW � by which a given wave is resolved isgiven by ����x� The resolving e�ciency of a scheme can be expressed in termsof the PPW required to produce errors below a speci�ed level� For example� thesecondorder centered di�erence scheme requires � PPW to produce an error inphase speed of less than ��� percent� The �point fourthorder centered scheme and

Page 52: Hydrodynamics - CFD

���� DIFFERENCE OPERATORS AT BOUNDARIES ��

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

1.2

κ x∆

2 Centralnd

4 Centralth

4 Padeth

aa

*_

Figure ���� Numerical phase speed for various schemes�

the fourthorder Pad�e scheme require �� and �� PPW respectively to achieve thesame error level�

For our example using secondorder centered di�erences� the modi�ed wavenumberis purely real� but in the general case it can include an imaginary component as well�as shown in Eq� ��� � In that case� the error in the phase speed is determined fromthe real part of the modi�ed wavenumber� while the imaginary part leads to an errorin the amplitude of the solution� as can be seen by inspecting Eq� ����� Thus theantisymmetric portion of the spatial di�erence operator determines the error in speedand the symmetric portion the error in amplitude� This will be further discussed inSection �����

�� Di�erence Operators at Boundaries

As discussed in Section ������ a matrix di�erence operator incorporates both thedi�erence approximation in the interior of the domain and that at the boundaries�In this section� we consider the boundary operators needed for our model equationsfor convection and di�usion� In the case of periodic boundary conditions� no specialboundary operators are required�

Page 53: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

����� The Linear Convection Equation

Referring to Section ���� the boundary conditions for the linear convection equationcan be either periodic or of in�owout�ow type� In the latter case� a Dirichlet boundary condition is given at the in�ow boundary� while no condition is speci�ed at theout�ow boundary� Here we assume that the wave speed a is positive! thus the lefthand boundary is the in�ow boundary� and the righthand boundary is the out�owboundary� Thus the vector of unknowns is

�u �u�� u�� � � � � uM �T ������

and u� is speci�ed�Consider �rst the in�ow boundary� It is clear that as long as the interior di�erence

approximation does not extend beyond uj��� then no special treatment is requiredfor this boundary� For example� with secondorder centered di�erences we obtain

�x�u A�u���bc�

������

with

A �

��x

������� �

�� � ��� � �

� � �

� ���bc�

��x

�������u������

� ������

However� if we use the fourthorder interior operator given in Eq� ����� then theapproximation at j � requires a value of uj��� which is outside the domain� Hence�a di�erent operator is required at j � which extends only to j � �� while havingthe appropriate order of accuracy� Such an operator� known as a numerical boundaryscheme� can have an order of accuracy which is one order lower than that of theinterior scheme� and the global accuracy will equal that of the interior scheme�� Forexample� with fourthorder centered di�erences� we can use the following thirdorderoperator at j ��

��xu�� �

��x���u� � �u� � �u� � u�� ������

which is easily derived using a Taylor table� The resulting di�erence operator has theform of Eq� ���� with

A �

���x

�������� �� ��� � ��� � � ��

� � �

� ���bc�

���x

��������u�u�����

� ������

�Proof of this theorem is beyond the scope of this book the interested reader should consult theliterature for further details�

Page 54: Hydrodynamics - CFD

���� DIFFERENCE OPERATORS AT BOUNDARIES ��

This approximation is globally fourthorder accurate�At the out�ow boundary� no boundary condition is speci�ed� We must approx

imate �u��x at node M with no information about uM�� Thus the secondordercentereddi�erence operator� which requires uj�� cannot be used at j M � Abackwarddi�erence formula must be used� With a secondorder interior operator�the following �rstorder backward formula can be used�

��xu�M �

�x�uM � uM��� �����

This produces a di�erence operator with

A �

��x

�����������

� ��� � �

�� � �� � �

�� � ��� �

��

��bc�

��x

���������

�u�������

� ���� �

In the case of a fourthorder centered interior operator the last two rows of A requiremodi�cation�Another approach to the development of boundary schemes is in terms of space

extrapolation� The following formula allows uM� to be extrapolated from the interiordata to arbitrary order on an equispaced grid�

��� E���puM� � ������

where E is the shift operator de�ned by Euj uj� and the order of the approximation is p� �� For example� with p � we obtain

��� �E�� � E���uM� uM� � �uM � uM�� � ������

which gives the following �rstorder approximation to uM��

uM� �uM � uM�� ������

Substituting this into the secondorder centereddi�erence operator applied at nodeM gives

��xu�M �

��x�uM� � uM���

��x��uM � uM�� � uM���

�x�uM � uM��� ������

which is identical to Eq� ����

Page 55: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

����� The Di�usion Equation

In solving the di�usion equation� we must consider Dirichlet and Neumann boundaryconditions� The treatment of a Dirichlet boundary condition proceeds along the samelines as the in�ow boundary for the convection equation discussed above� With thesecondorder centered interior operator

��xxu�j �

�x��uj� � �uj � uj��� ������

no modi�cations are required near boundaries� leading to the di�erence operator givenin Eq� �����For a Neumann boundary condition� we assume that �u��x is speci�ed at j

M � �� that is ��u

�x

�M�

��u

�x

�b

������

Thus we design an operator at node M which is in the following form�

��xxu�M �

�x��auM�� � buM� �

c

�x

��u

�x

�M�

������

where a� b� and c are constants which can easily be determined using a Taylor table�as shown in Table ����

���u

�x�

�j

��� �

�x��auj�� � buj� �

c

�x

��u

�x

�j�

� ��x� �x�� �x�� �x��

uj��u�x

�j

���u�x�

�j

���u�x�

�j

���u�x�

�j

�x� ����u�x�

�j

�a � uj�� �a �a � ��� � �� �a � ���� � �� �a � ���� � �� �a � ���� � ����b � uj �b��x � c �

��u�x

�j�

�c �c � ��� � �� �c � ���� � �� �c � ���� � ��

Table ���� Taylor table for Neumann boundary condition�

Solving for a� b� and c� we obtain the following operator�

��xxu�M �

��x���uM�� � �uM� � �

��x

��u

�x

�M�

������

Page 56: Hydrodynamics - CFD

��� PROBLEMS ��

which produces the di�erence operator given in Eq� ��� � Notice that this operatoris secondorder accurate� In the case of a numerical approximation to a Neumannboundary condition� this is necessary to obtain a globally secondorder accurate formulation� This contrasts with the numerical boundary schemes described previouslywhich can be one order lower than the interior scheme�We can also obtain the operator in Eq� ���� using the space extrapolation idea�

Consider a secondorder backwarddi�erence approximation applied at node M � ����u

�x

�M�

��x�uM�� � �uM � �uM�� �O��x�� �����

Solving for uM� gives

uM� �

��uM � uM�� � ��x

��u

�x

�M�

��O��x�� ���� �

Substituting this into the secondorder centered di�erence operator for a secondderivative applied at node M gives

��xxu�M �

�x��uM� � �uM � uM��� �����

��x�

��uM�� � �uM � �uM � uM�� � ��x

��u

�x

�M�

��x���uM�� � �uM� � �

��x

��u

�x

�M�

�����

which is identical to Eq� �����

�� Problems

�� Derive a thirdorder �nitedi�erence approximation to a �rst derivative in theform

��xu�j �

�x�auj�� � buj�� � cuj � duj��

Find the leading error term�

�� Derive a �nitedi�erence approximation to a �rst derivative in the form

a��xu�j�� � ��xu�j �

�x�buj�� � cuj � duj��

Find the leading error term�

Page 57: Hydrodynamics - CFD

� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

�� Using a � �interior� point mesh� write out the ��� matrices and the boundarycondition vector formed by using the scheme derived in question � when bothu and �u��x are given at j � and u is given at j ��

�� Repeat question � with d ��

�� Derive a �nitedi�erence approximation to a third derivative in the form

��xxxu�j �

�x��auj�� � buj�� � cuj � duj� � euj��

Find the leading error term�

�� Derive a compact �or Pad�e� �nitedi�erence approximation to a second derivative in the form

d��xxu�j�� � ��xxu�j � e��xxu�j� �

�x��auj�� � buj � cuj��

Find the leading error term�

�� Find the modi�ed wavenumber for the operator derived in question �� Plot thereal and imaginary parts of ��x vs� �x for � � �x � �� Compare the realpart with that obtained from the fourthorder centered operator �Eq� ������

� Application of the secondderivative operator to the function ei�x gives

��ei�x

�x� ��ei�x

Application of a di�erence operator for the second derivative gives

��xxei�j x�j ���ei�x

thus de�ning the modi�ed wavenumber � for a second derivative approximation� Find the modi�ed wavenumber for the secondorder centered di�erence operator for a second derivative� the noncompact fourthorder operator �Eq� ������and the compact fourthorder operator derived in question �� Plot ���x�� vs���x�� for � � �x � ��

� Find the gridpointsperwavelength �PPW � requirement to achieve a phasespeed error less than ��� percent for sixthorder noncompact and compact centered approximations to a �rst derivative�

Page 58: Hydrodynamics - CFD

��� PROBLEMS �

��� Consider the following onesided di�erencing schemes� which are �rst� second�and thirdorder� respectively�

��xu�j �uj � uj��� ��x

��xu�j ��uj � �uj�� � uj��� ����x�

��xu�j ���uj � �uj�� � uj�� � �uj��� ����x�

Find the modi�ed wavenumber for each of these schemes� Plot the real andimaginary parts of ��x vs� �x for � � �x � �� Derive the two leadingterms in the truncation error for each scheme�

Page 59: Hydrodynamics - CFD

�� CHAPTER �� FINITE�DIFFERENCE APPROXIMATIONS

Page 60: Hydrodynamics - CFD

Chapter �

THE SEMI�DISCRETE

APPROACH

One strategy for obtaining �nitedi�erence approximations to a PDE is to start bydi�erencing the space derivatives only� without approximating the time derivative�In the following chapters� we proceed with an analysis making considerable use ofthis concept� which we refer to as the semi�discrete approach� Di�erencing the spacederivatives converts the basic PDE into a set of coupled ODE�s� In the most generalnotation� these ODE�s would be expressed in the form

d�u

dt �F ��u� t� �����

which includes all manner of nonlinear and timedependent possibilities� On occasion�we use this form� but the rest of this chapter is devoted to a more specialized matrixnotation described below�Another strategy for constructing a �nitedi�erence approximation to a PDE is

to approximate all the partial derivatives at once� This generally leads to a pointdi�erence operator �see Section ������ which� in turn� can be used for the time advanceof the solution at any given point in the mesh� As an example let us consider themodel equation for di�usion

�u

�t �

��u

�x�

Using threepoint centraldi�erencing schemes for both the time and space derivatives�we �nd

u�n��j � u

�n���j

�h �

��u�n�j� � �u�n�j � u�n�j��

�x�

�or

u�n��j u

�n���j �

�h�

�x�

hu�n�j� � �u�n�j � u

�n�j��

i�����

��

Page 61: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

Clearly Eq� ��� is a di�erence equation which can be used at the space point j toadvance the value of u from the previous time levels n and n � � to the level n � ��It is a full discretization of the PDE� Note� however� that the spatial and temporaldiscretizations are separable� Thus� this method has an intermediate semidiscreteform and can be analyzed by the methods discussed in the next few chapters�

Another possibility is to replace the value of u�n�j in the right hand side of Eq� ���

with the time average of u at that point� namely �u�n��j � u

�n���j ���� This results in

the formula

u�n��j u

�n���j �

�h�

�x�

��u�n�j� � ���u�n��

j � u�n���j

�A� u�n�j��

� �����

which can be solved for u�n�� and time advanced at the point j� In this case� thespatial and temporal discretizations are not separable� and no semidiscrete formexists�

Equation ��� is sometimes called Richardson�s method of overlapping steps andEq� ��� is referred to as the DuFortFrankel method� As we shall see later on� thereare subtle points to be made about using these methods to �nd a numerical solutionto the di�usion equation� There are a number of issues concerning the accuracy�stability� and convergence of Eqs� ��� and ��� which we cannot comment on until wedevelop a framework for such investigations� We introduce these methods here only todistinguish between methods in which the temporal and spatial terms are discretizedseparately and those for which no such separation is possible� For the time being� weshall separate the space di�erence approximations from the time di�erencing� In thisapproach� we reduce the governing PDE�s to ODE�s by discretizing the spatial termsand use the welldeveloped theory of ODE solutions to aid us in the development ofan analysis of accuracy and stability�

��� Reduction of PDE�s to ODE�s

����� The Model ODE�s

First let us consider the model PDE�s for di�usion and biconvection described inChapter �� In these simple cases� we can approximate the space derivatives withdi�erence operators and express the resulting ODE�s with a matrix formulation� Thisis a simple and natural formulation when the ODE�s are linear�

Page 62: Hydrodynamics - CFD

���� REDUCTION OF PDES TO ODES ��

Model ODE for Di usion

For example� using the �point centraldi�erencing scheme to represent the secondderivative in the scalar PDE governing di�usion leads to the following ODE di�usionmodel

d�u

dt

�x�B������ ���u� ��bc� �����

with Dirichlet boundary conditions folded into the ��bc� vector�

Model ODE for Biconvection

The term biconvection was introduced in Section ���� It is used for the scalar convection model when the boundary conditions are periodic� In this case� the �pointcentraldi�erencing approximation produces the ODE model given by

d�u

dt � a

��xBp���� �� ���u �����

where the boundary condition vector is absent because the �ow is periodic�Eqs� ��� and ��� are the model ODE�s for di�usion and biconvection of a scalar in

one dimension� They are linear with coe�cient matrices which are independent of xand t�

����� The Generic Matrix Form

The generic matrix form of a semidiscrete approximation is expressed by the equation

d�u

dt A�u� �f�t� �����

Note that the elements in the matrix A depend upon both the PDE and the type ofdi�erencing scheme chosen for the space terms� The vector �f�t� is usually determinedby the boundary conditions and possibly source terms� In general� even the Eulerand NavierStokes equations can be expressed in the form of Eq� ���� In such casesthe equations are nonlinear� that is� the elements of A depend on the solution �u andare usually derived by �nding the Jacobian of a �ux vector� Although the equationsare nonlinear� the linear analysis presented in this book leads to diagnostics that aresurprisingly accurate when used to evaluate many aspects of numerical methods asthey apply to the Euler and NavierStokes equations�

Page 63: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

��� Exact Solutions of Linear ODE�s

In order to advance Eq� ��� in time� the system of ODE�s must be integrated using atimemarching method� In order to analyze timemarching methods� we will make useof exact solutions of coupled systems of ODE�s� which exist under certain conditions�The ODE�s represented by Eq� ��� are said to be linear if F is linearly dependent onu �i�e�� if �F��u A where A is independent of u�� As we have already pointed out�when the ODE�s are linear they can be expressed in a matrix notation as Eq� ��� inwhich the coe�cient matrix� A� is independent of u� If A does depend explicitly ont� the general solution cannot be written! whereas� if A does not depend explicitly ont� the general solution to Eq� ��� can be written� This holds regardless of whether ornot the forcing function� �f � depends explicitly on t�As we shall soon see� the exact solution of Eq� ��� can be written in terms of

the eigenvalues and eigenvectors of A� This will lead us to a representative scalarequation for use in analyzing timemarching methods� These ideas are developed inthe following sections�

����� Eigensystems of Semi�Discrete Linear Forms

Complete Systems

An M �M matrix is represented by a complete eigensystem if it has a complete setof linearly independent eigenvectors �see Appendix A� � An eigenvector� �xm� and itscorresponding eigenvalue� �m� have the property that

A�xm �m�xm or

�A� �mI��xm � �����

The eigenvalues are the roots of the equation

det�A� �I� �

We form the righthand eigenvector matrix of a complete system by �lling its columnswith the eigenvectors �xm�

X h�x� � �x� � � � � �xM

iThe inverse is the lefthand eigenvector matrix� and together they have the propertythat

X��AX # ����

where # is a diagonal matrix whose elements are the eigenvalues of A�

Page 64: Hydrodynamics - CFD

���� EXACT SOLUTIONS OF LINEAR ODES ��

Defective Systems

If anM�M matrix does not have a complete set of linearly independent eigenvectors�it cannot be transformed to a diagonal matrix of scalars� and it is said to be defective�It can� however� be transformed to a diagonal set of blocks� some of which may bescalars �see Appendix A�� In general� there exists some S which transforms anymatrix A such that

S��AS J

where

J

��������

J�J�

� � �

Jm� � �

�and

J �n�m

�������m �

�m� � �� � � �

�m

��������n

The matrix J is said to be in Jordan canonical form� and an eigenvalue with multiplicity n within a Jordan block is said to be a defective eigenvalue� Defective systemsplay a role in numerical stability analysis�

����� Single ODE�s of First� and Second�Order

First�Order Equations

The simplest nonhomogeneous ODE of interest is given by the single� �rstorderequation

du

dt �u� ae�t ��� �

where �� a� and are scalars� all of which can be complex numbers� The equationis linear because � does not depend on u� and has a general solution because � doesnot depend on t� It has a steadystate solution if the righthand side is independentof t� i�e�� if �� and is homogeneous if the forcing function is zero� i�e�� if a ��Although it is quite simple� the numerical analysis of Eq� �� displays many of thefundamental properties and issues involved in the construction and study of mostpopular timemarching methods� This theme will be developed as we proceed�

Page 65: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

The exact solution of Eq� �� is� for ��

u�t� c�e�t �

ae�t

� �

where c� is a constant determined by the initial conditions� In terms of the initialvalue of u� it can be written

u�t� u���e�t � ae�t � e�t

� �

The interesting question can arise� What happens to the solution of Eq� �� when �� This is easily found by setting � � �� solving� and then taking the limitas �� �� Using this limiting device� we �nd that the solution to

du

dt �u� ae�t ������

is given by

u�t� �u��� � at�e�t

As we shall soon see� this solution is required for the analysis of defective systems�

Second�Order Equations

The homogeneous form of a secondorder equation is given by

d�u

dt�� a�

du

dt� a�u � ������

where a� and a� are complex constants� Now we introduce the di�erential operatorD such that

D � d

dt

and factor u�t� out of Eq� ����� giving

�D� � a�D � a�� u�t� �

The polynomial in D is referred to as a characteristic polynomial and designatedP �D�� Characteristic polynomials are fundamental to the analysis of both ODE�s andO�E�s� since the roots of these polynomials determine the solutions of the equations�For ODE�s� we often label these roots in order of increasing modulus as ��� ��� � � �� �m�

Page 66: Hydrodynamics - CFD

���� EXACT SOLUTIONS OF LINEAR ODES ��

� � �� �M � They are found by solving the equation P ��� �� In our simple example�there would be two roots� �� and ��� determined from

P ��� �� � a��� a� � ������

and the solution to Eq� ���� is given by

u�t� c�e��t � c�e

��t ������

where c� and c� are constants determined from initial conditions� The proof of thisis simple and is found by substituting Eq� ���� into Eq� ����� One �nds the result

c�e��t���� � a��� � a�� � c�e

��t���� � a��� � a��

which is identically zero for all c�� c�� and t if and only if the ��s satisfy Eq� �����

����� Coupled First�Order ODE�s

A Complete System

A set of coupled� �rstorder� homogeneous equations is given by

u�� a�� u� � a�� u�

u�� a�� u� � a�� u� ������

which can be written

�u� A�u � �u �u�� u��

T � A �aij�

�a�� a��a�� a��

�Consider the possibility that a solution is represented by

u� c� x��e��t � c� x��e

��t

u� c� x��e��t � c� x��e

��t ������

By substitution� these are indeed solutions to Eq� ���� if and only if�a�� a��a�� a��

� �x��x��

� ��

�x��x��

��

�a�� a��a�� a��

� �x��x��

� ��

�x��x��

�������

Notice that a higherorder equation can be reduced to a coupled set of �rstorderequations by introducing a new set of dependent variables� Thus� by setting

u� u� � u� u �

we �nd Eq� ���� can be written

u�� �a�u� � a�u�

u�� u� ������

which is a subset of Eq� �����

Page 67: Hydrodynamics - CFD

� CHAPTER �� THE SEMI�DISCRETE APPROACH

A Derogatory System

Eq� ���� is still a solution to Eq� ���� if �� �� �� provided two linearly independentvectors exist to satisfy Eq� ���� with A #� In this case

�� �� �

� ���

� �

���

�and

�� �� �

� ���

� �

���

provide such a solution� This is the case where A has a complete set of eigenvectorsand is not defective�

A Defective System

If A is defective� then it can be represented by the Jordan canonical form�u��u��

�� �� �

� �u�u�

������

whose solution is not obvious� However� in this case� one can solve the top equation�rst� giving u��t� u����e

�t� Then� substituting this result into the second equation�one �nds

du�dt

�u� � u����e�t

which is identical in form to Eq� ���� and has the solution

u��t� �u���� � u����t�e�t

From this the reader should be able to verify that

u��t� �a � bt� ct�

�e�t

is a solution to ��� u��

u��u��

� ����� �

� �

���� u�u�u�

�if

a u���� � b u���� � c �

�u���� ���� �

The general solution to such defective systems is left as an exercise�

Page 68: Hydrodynamics - CFD

���� EXACT SOLUTIONS OF LINEAR ODES �

����� General Solution of Coupled ODE�s with Complete Eigen�

systems

Let us consider a set of coupled� nonhomogeneous� linear� �rstorder ODE�s withconstant coe�cients which might have been derived by space di�erencing a set ofPDE�s� Represent them by the equation

d�u

dt A�u� �f�t� ������

Our assumption is that the M �M matrix A has a complete eigensystem� and canbe transformed by the left and right eigenvector matrices� X�� and X� to a diagonalmatrix # having diagonal elements which are the eigenvalues of A� see Section ������Now let us multiply Eq� ���� from the left by X�� and insert the identity combinationXX�� I between A and �u� There results

X��d�u

dt X��AX �X���u�X���f�t� ������

Since A is independent of both �u and t� the elements in X�� and X are also independent of both �u and t� and Eq� ���� can be modi�ed to

d

dtX���u #X���u�X���f�t�

Finally� by introducing the new variables �w and �g such that

�w X���u � �g�t� X���f�t� ������

we reduce Eq� ���� to a new algebraic form

d�w

dt #�w � �g�t� ������

It is important at this point to review the results of the previous paragraph� Noticethat Eqs� ���� and ���� are expressing exactly the same equality� The only di�erencebetween them was brought about by algebraic manipulations which regrouped thevariables� However� this regrouping is crucial for the solution process because Eqs�

�In the following� we exclude defective systems� not because they cannot be analyzed �the exampleat the conclusion of the previous section proves otherwise�� but because they are only of limitedinterest in the general development of our theory�

Page 69: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

���� are no longer coupled� They can be written line by line as a set of independent�single� �rstorder equations� thus

w�� ��w� � g��t����

w�m �mwm � gm�t�

���

w�M �MwM � gM�t� ������

For any given set of gm�t� each of these equations can be solved separately and thenrecoupled� using the inverse of the relations given in Eqs� �����

�u�t� X�w�t�

MXm��

wm�t��xm ������

where �xm is the m�th column of X� i�e�� the eigenvector corresponding to �m�We next focus on the very important subset of Eq� ���� when neither A nor �f has

any explicit dependence on t� In such a case� the gm in Eqs� ���� and ���� are alsotime invariant and the solution to any line in Eq� ���� is

wm�t� cme�mt �

�mgm

where the cm are constants that depend on the initial conditions� Transforming backto the usystem gives

�u�t� X�w�t�

MXm��

wm�t��xm

MXm��

cme�mt �xm �

MXm��

�mgm�xm

MXm��

cme�mt �xm �X#��X���f

MXm��

cme�mt �xm � A���f

� �z Transient

� �z Steadystate

������

Page 70: Hydrodynamics - CFD

���� REAL SPACE AND EIGENSPACE ��

Note that the steadystate solution is A���f � as might be expected�The �rst group of terms on the right side of this equation is referred to classically

as the complementary solution or the solution of the homogeneous equations� Thesecond group is referred to classically as the particular solution or the particularintegral� In our application to �uid dynamics� it is more instructive to refer to thesegroups as the transient and steady�state solutions� respectively� An alternative� butentirely equivalent� form of the solution is

�u�t� c�e��t �x� � � � �� cme

�mt �xm � � � �� cMe�M t �xM � A���f ������

��� Real Space and Eigenspace

����� De�nition

Following the semidiscrete approach discussed in Section ���� we reduce the partialdi�erential equations to a set of ordinary di�erential equations represented by thegeneric form

d�u

dt A�u� �f �����

The dependent variable �u represents some physical quantity or quantities which relateto the problem of interest� For the model problems on which we are focusing mostof our attention� the elements of A are independent of both u and t� This permitsus to say a great deal about such problems and serves as the basis for this section�In particular� we can develop some very important and fundamental concepts thatunderly the global properties of the numerical solutions to the model problems� Howthese relate to the numerical solutions of more practical problems depends upon theproblem and� to a much greater extent� on the cleverness of the relator�We begin by developing the concept of �spaces�� That is� we identify di�erent

mathematical reference frames �spaces� and view our solutions from within each�In this way� we get di�erent perspectives of the same solution� and this can addsigni�cantly to our understanding�The most natural reference frame is the physical one� We say

If a solution is expressed in terms of �u� it is saidto be in real space�

There is� however� another very useful frame� We saw in Sections ����� and ��� thatpre and postmultiplication of A by the appropriate similarity matrices transforms Ainto a diagonal matrix� composed� in the most general case� of Jordan blocks or� in the

Page 71: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

simplest nondefective case� of scalars� Following Section ��� and� for simplicity� usingonly complete systems for our examples� we found that Eq� ��� had the alternativeform

d�w

dt #�w � �g

which is an uncoupled set of �rstorder ODE�s that can be solved independently forthe dependent variable vector �w� We say

If a solution is expressed in terms of �w� it is said tobe in eigenspace �often referred to as wave space��

The relations that transfer from one space to the other are�

�w X���u�g X���f

�u X�w�f X�g

The elements of �u relate directly to the local physics of the problem� However� theelements of �w are linear combinations of all of the elements of �u� and individuallythey have no direct local physical interpretation�When the forcing function �f is independent of t� the solutions in the two spaces

are represented by�u�t�

Xcme

�mt �xm �X#��X���f

and

wm�t� cme�mt �

�mgm ! m �� �� � � � �M

for real space and eigenspace� respectively� At this point we make two observations�

�� the transient portion of the solution in real space consists of a linear combinationof contributions from each eigenvector� and

�� the transient portion of the solution in eigenspace provides the weighting ofeach eigenvector component of the transient solution in real space�

����� Eigenvalue Spectrums for Model ODE�s

It is instructive to consider the eigenvalue spectrums of the ODE�s formulated bycentral di�erencing the model equations for di�usion and biconvection� These modelODE�s are presented in Section ���� Equations for the eigenvalues of the simple

Page 72: Hydrodynamics - CFD

���� REAL SPACE AND EIGENSPACE ��

tridiagonals�B�M � a� b� c� and Bp�M � a� b� c�� are given in Appendix B� From SectionB��� we �nd for the model di�usion equation with Dirichlet boundary conditions

�m �

�x�

��� � � cos

�m�

M � �

��

����x�

sin��

m�

��M � ��

�! m �� �� � � � �M ���� �

and� from Section B��� for the model biconvection equation

�m �ia�x

sin��m�

M

�m �� �� � � � �M � �

�i�ma m �� �� � � � �M � � ������

where

�m sinm�x

�xm �� �� � � � �M � � ������

is the modi�ed wavenumber from Section ���� m m� and �x ���M � Noticethat the di�usion eigenvalues are real and negative while those representing periodicconvection are all pure imaginary� The interpretation of this result plays a veryimportant role later in our stability analysis�

����� Eigenvectors of the Model Equations

Next we consider the eigenvectors of the two model equations� These follow as specialcases from the results given in Appendix B�

The Di usion Model

Consider Eq� ���� the model ODE�s for di�usion� First� to help visualize the matrixstructure� we present results for a simple �point mesh and then we give the generalcase� The righthand eigenvector matrix X is given by�����

sin �x�� sin ��x�� sin ��x�� sin ��x��sin �x�� sin ��x�� sin ��x�� sin ��x��sin �x�� sin ��x�� sin ��x�� sin ��x��sin �x�� sin ��x�� sin ��x�� sin ��x��

�The columns of the matrix are proportional to the eigenvectors� Recall that xj j�x j���M � ��� so in general the relation �u X �w can be written as

uj MXm��

wm sinmxj ! j �� �� � � � �M ������

Page 73: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

For the inverse� or lefthand eigenvector matrix X��� we �nd

�����sin �x�� sin �x�� sin �x�� sin �x��sin ��x�� sin ��x�� sin ��x�� sin ��x��sin ��x�� sin ��x�� sin ��x�� sin ��x��sin ��x�� sin ��x�� sin ��x�� sin ��x��

�The rows of the matrix are proportional to the eigenvectors� In general �w X���ugives

wm MXj��

uj sinmxj ! m �� �� � � � �M ������

In the �eld of harmonic analysis� Eq� ���� represents a sine transform of the function u�x� for an M point sample between the boundaries x � and x � with thecondition u��� u��� �� Similarly� Eq� ���� represents the sine synthesis thatcompanions the sine transform given by Eq� ����� In summary�

For the model di�usion equation�

�w X���u is a sine transform from real space to �sine� wavespace�

�u X�w is a sine synthesis from wave space back to realspace�

The Biconvection Model

Next consider the model ODE�s for periodic convection� Eq� ���� The coe�cientmatrices for these ODE�s are always circulant� For our model ODE� the righthandeigenvectors are given by

�xm ei j ���mM��j �� �� � � � �M � �m �� �� � � � �M � �

With xj j ��x j � ���M � we can write �u X �w as

uj M��Xm��

wmeimxj ! j �� �� � � � �M � � ������

Page 74: Hydrodynamics - CFD

���� REAL SPACE AND EIGENSPACE ��

For a �point periodic mesh� we �nd the following lefthand eigenvector matrixfrom Appendix B��������

w�

w�

w�

w�

� �������� � � �� e��i�� e��i�� e��i��

� e��i�� e��i�� e���i��

� e��i�� e���i�� e���i��

������u�u�u�u�

� X���u

In general

wm �

M

M��Xj��

uje�imxj ! m �� �� � � � �M � �

This equation is identical to a discrete Fourier transform of the periodic dependentvariable �u using an M point sample between and including x � and x �� ��x�For circulant matrices� it is straightforward to establish the fact that the relation

�u X�w represents the Fourier synthesis of the variable �w back to �u� In summary�

For any circulant system�

�w X���u is a complex Fourier transform from real space towave space�

�u X�w is a complex Fourier synthesis from wave spaceback to real space�

����� Solutions of the Model ODE�s

We can now combine the results of the previous sections to write the solutions of ourmodel ODE�s�

The Di usion Equation

For the di�usion equation� Eq� ���� becomes

uj�t� MXm��

cme�mt sinmxj � �A

��f�j� j �� �� � � � �M ������

where

�m ����x�

sin��

m�

��M � ��

�������

Page 75: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

With the modi�ed wavenumber de�ned as

�m �

�xsin�m�x

�������

and using m m� we can write the ODE solution as

uj�t� MXm��

cme����m

�t sinmxj � �A��f�j� j �� �� � � � �M �����

This can be compared with the exact solution to the PDE� Eq� ����� evaluated at thenodes of the grid�

uj�t� MXm��

cme���m�t sinmxj � h�xj�� j �� �� � � � �M ���� �

We see that the solutions are identical except for the steady solution and themodi�ed wavenumber in the transient term� The modi�ed wavenumber is an approximation to the actual wavenumber� The di�erence between the modi�ed wavenumberand the actual wavenumber depends on the di�erencing scheme and the grid resolution� This di�erence causes the various modes �or eigenvector components� to decayat rates which di�er from the exact solution� With conventional di�erencing schemes�low wavenumber modes are accurately represented� while high wavenumber modes �ifthey have signi�cant amplitudes� can have large errors�

The Convection Equation

For the biconvection equation� we obtain

uj�t� M��Xm��

cme�mtei�mxj � j �� �� � � � �M � � ������

where

�m �i�ma ������

with the modi�ed wavenumber de�ned in Eq� ����� We can write this ODE solutionas

uj�t� M��Xm��

cme�i��matei�mxj � j �� �� � � � �M � � ������

Page 76: Hydrodynamics - CFD

���� THE REPRESENTATIVE EQUATION ��

and compare it to the exact solution of the PDE� Eq� ����� evaluated at the nodes ofthe grid�

uj�t� M��Xm��

fm���e�i�matei�mxj � j �� �� � � � �M � � ������

Once again the di�erence appears through the modi�ed wavenumber contained in�m� As discussed in Section ���� this leads to an error in the speed with which variousmodes are convected� since � is real� Since the error in the phase speed depends onthe wavenumber� while the actual phase speed is independent of the wavenumber�the result is erroneous numerical dispersion� In the case of noncentered di�erencing�discussed in Chapter ��� the modi�ed wavenumber is complex� The form of Eq� ����shows that the imaginary portion of the modi�ed wavenumber produces nonphysicaldecay or growth in the numerical solution�

��� The Representative Equation

In Section ���� we pointed out that Eqs� ���� and ���� express identical results but interms of di�erent groupings of the dependent variables� which are related by algebraicmanipulation� This leads to the following important concept�

The numerical solution to a set of linear ODE�s �in which A isnot a function of t� is entirely equivalent to the solution obtainedif the equations are transformed to eigenspace� solved there intheir uncoupled form� and then returned as a coupled set to realspace�

The importance of this concept resides in its message that we can analyze timemarching methods by applying them to a single� uncoupled equation and our conclusions will apply in general� This is helpful both in analyzing the accuracy oftimemarching methods and in studying their stability� topics which are covered inChapters � and ��Our next objective is to �nd a �typical� single ODE to analyze� We found the

uncoupled solution to a set of ODE�s in Section ���� A typical member of the familyis

dwm

dt �mwm � gm�t� ������

The goal in our analysis is to study typical behavior of general situations� not particular problems� For such a purpose Eq� ���� is not quite satisfactory� The role of �m isclear! it stands for some representative eigenvalue in the original A matrix� However�

Page 77: Hydrodynamics - CFD

� CHAPTER �� THE SEMI�DISCRETE APPROACH

the question is� What should we use for gm�t� when the time dependence cannot beignored� To answer this question� we note that� in principle� one can express any oneof the forcing terms gm�t� as a �nite Fourier series� For example

�g�t� Xk

akeikt

for which Eq� ���� has the exact solution�

w�t� ce�t �Xk

akeikt

ik � �

From this we can extract the k�th term and replace ik with � This leads to

The Representative ODE

dw

dt �w � ae�t

������

which can be used to evaluate all manner of timemarching methods� In such evaluations the parameters � and must be allowed to take the worst possible combinationof values that might occur in the ODE eigensystem� The exact solution of the representative ODE is �for ���

w�t� ce�t �ae�t

� �������

��� Problems

�� Consider the �nitedi�erence operator derived in question � of Chapter �� Usingthis operator to approximate the spatial derivative in the linear convection equation� write the semidiscrete form obtained with periodic boundary conditionson a �point grid �M ���

�� Consider the application of the operator given in Eq� ���� to the �D di�usionequation with Dirichlet boundary conditions� Write the resulting semidiscreteODE form� Find the entries in the boundarycondition vector�

�� Write the semidiscrete form resulting from the application of secondorder centered di�erences to the following equation on the domain � � x � � withboundary conditions u��� �� u��� ��

�u

�t

��u

�x�� �x

Page 78: Hydrodynamics - CFD

���� PROBLEMS �

�� Consider a grid with �� interior points spanning the domain � � x � �� Forinitial conditions u�x� �� sin�mx� and boundary conditions u��� t� u��� t� �� plot the exact solution of the di�usion equation with � � at t � withm � and m �� �Plot the solution at the grid nodes only�� Calculate thecorresponding modi�ed wavenumbers for the secondorder centered operatorfrom Eq� ����� Calculate and plot the corresponding ODE solutions�

�� Consider the matrix

A �Bp������� �� ������x�

corresponding to the ODE form of the biconvection equation resulting from theapplication of secondorder central di�erencing on a ��point grid� Note thatthe domain is � � x � �� and �x ������ The grid nodes are given byxj j�x� j �� �� � � � � The eigenvalues of the above matrix A� as well as thematrices X and X��� can be found from Appendix B��� Using these� computeand plot the ODE solution at t �� for the initial condition u�x� �� sinx�Compare with the exact solution of the PDE� Calculate the numerical phasespeed from the modi�ed wavenumber corresponding to this initial conditionand show that it is consistent with the ODE solution� Repeat for the initialcondition u�x� �� sin �x�

Page 79: Hydrodynamics - CFD

�� CHAPTER �� THE SEMI�DISCRETE APPROACH

Page 80: Hydrodynamics - CFD

Chapter �

FINITE�VOLUME METHODS

In Chapter �� we saw how to derive �nitedi�erence approximations to arbitraryderivatives� In Chapter �� we saw that the application of a �nitedi�erence approximation to the spatial derivatives in our model PDE�s produces a coupled set of ODE�s�In this Chapter� we will show how similar semidiscrete forms can be derived using�nitevolume approximations in space� Finitevolume methods have become popular in CFD as a result� primarily� of two advantages� First� they ensure that thediscretization is conservative� i�e�� mass� momentum� and energy are conserved in adiscrete sense� While this property can usually be obtained using a �nitedi�erenceformulation� it is obtained naturally from a �nitevolume formulation� Second� �nitevolume methods do not require a coordinate transformation in order to be applied onirregular meshes� As a result� they can be applied on unstructured meshes consistingof arbitrary polyhedra in three dimensions or arbitrary polygons in two dimensions�This increased �exibility can be used to great advantage in generating grids aboutarbitrary geometries�

Finitevolume methods are applied to the integral form of the governing equations�either in the form of Eq� ��� or Eq� ���� Consistent with our emphasis on semidiscretemethods� we will study the latter form� which is

d

dt

ZV �t�

QdV �IS�t�

n�FdS ZV �t�

PdV �����

We will begin by presenting the basic concepts which apply to �nitevolume strategies�Next we will give our model equations in the form of Eq� ���� This will be followedby several examples which hopefully make these concepts clear�

��

Page 81: Hydrodynamics - CFD

�� CHAPTER �� FINITE�VOLUME METHODS

��� Basic Concepts

The basic idea of a �nitevolume method is to satisfy the integral form of the conservation law to some degree of approximation for each of many contiguous controlvolumes which cover the domain of interest� Thus the volume V in Eq� ��� is that of acontrol volume whose shape is dependent on the nature of the grid� In our examples�we will consider only control volumes which do not vary with time� Examining Eq����� we see that several approximations must be made� The �ux is required at theboundary of the control volume� which is a closed surface in three dimensions and aclosed contour in two dimensions� This �ux must then be integrated to �nd the net�ux through the boundary� Similarly� the source term P must be integrated over thecontrol volume� Next a timemarching method� can be applied to �nd the value ofZ

VQdV �����

at the next time step�

Let us consider these approximations in more detail� First� we note that theaverage value of Q in a cell with volume V is

&Q � �

V

ZVQdV �����

and Eq� ��� can be written as

Vd

dt&Q �

ISn�FdS

ZVPdV �����

for a control volume which does not vary with time� Thus after applying a timemarching method� we have updated values of the cellaveraged quantities &Q� In orderto evaluate the �uxes� which are a function of Q� at the controlvolume boundary� Qcan be represented within the cell by some piecewise approximation which producesthe correct value of &Q� This is a form of interpolation often referred to as recon�struction� As we shall see in our examples� each cell will have a di�erent piecewiseapproximation to Q� When these are used to calculate F�Q�� they will generallyproduce di�erent approximations to the �ux at the boundary between two controlvolumes� that is� the �ux will be discontinuous� A nondissipative scheme analogousto centered di�erencing is obtained by taking the average of these two �uxes� Anotherapproach known as �uxdi�erence splitting is described in Chapter ���

The basic elements of a �nitevolume method are thus the following�

�Time�marching methods will be discussed in the next chapter�

Page 82: Hydrodynamics - CFD

���� MODEL EQUATIONS IN INTEGRAL FORM ��

�� Given the value of &Q for each control volume� construct an approximation toQ�x� y� z� in each control volume� Using this approximation� �nd Q at thecontrolvolume boundary� Evaluate F�Q� at the boundary� Since there is adistinct approximation to Q�x� y� z� in each control volume� two distinct valuesof the �ux will generally be obtained at any point on the boundary between twocontrol volumes�

�� Apply some strategy for resolving the discontinuity in the �ux at the controlvolume boundary to produce a single value of F�Q� at any point on the boundary� This issue is discussed in Section �������

�� Integrate the �ux to �nd the net �ux through the controlvolume boundaryusing some sort of quadrature�

�� Advance the solution in time to obtain new values of &Q�

The order of accuracy of the method is dependent on each of the approximations�These ideas should be clari�ed by the examples in the remainder of this chapter�

In order to include di�usive �uxes� the following relation between rQ and Q issometimes used� Z

VrQdV

ISnQdS �����

or� in two dimensions� ZArQdA

ICnQdl �����

where the unit vector n points outward from the surface or contour�

��� Model Equations in Integral Form

���� The Linear Convection Equation

A twodimensional form of the linear convection equation can be written as

�u

�t� a cos �

�u

�x� a sin �

�u

�y � �����

This PDE governs a simple plane wave convecting the scalar quantity� u�x� y� t� withspeed a along a straight line making an angle � with respect to the xaxis� Theonedimensional form is recovered with � ��

Page 83: Hydrodynamics - CFD

�� CHAPTER �� FINITE�VOLUME METHODS

For unit speed a� the twodimensional linear convection equation is obtained fromthe general divergence form� Eq� ���� with

Q u ����

F iu cos � � ju sin � ��� �

P � ������

Since Q is a scalar� F is simply a vector� Substituting these expressions into a twodimensional form of Eq� ��� gives the following integral form

d

dt

ZAudA�

ICn��iu cos � � ju sin ��ds � ������

where A is the area of the cell which is bounded by the closed contour C�

���� The Di�usion Equation

The integral form of the twodimensional di�usion equation with no source term andunit di�usion coe�cient � is obtained from the general divergence form� Eq� ���� with

Q u ������

F �ru ������

��i�u

�x� j

�u

�y

�������

P � ������

Using these� we �ndd

dt

ZAudA

ICn�

�i�u

�x� j

�u

�y

�ds ������

to be the integral form of the twodimensional di�usion equation�

��� One�Dimensional Examples

We restrict our attention to a scalar dependent variable u and a scalar �ux f � as inthe model equations� We consider an equispaced grid with spacing �x� The nodes ofthe grid are located at xj j�x as usual� Control volume j extends from xj ��x��to xj ��x��� as shown in Fig� ���� We will use the following notation�

xj��� xj ��x��� xj�� xj ��x�� ������

Page 84: Hydrodynamics - CFD

���� ONE�DIMENSIONAL EXAMPLES ��

j j+1j-1 j+2j-2

j-1/2 j+1/2

∆ x

L RL R

Figure ���� Control volume in one dimension�

uj��� u�xj����� fj��� f�uj���� �����

With these de�nitions� the cellaverage value becomes

&uj�t� � �

�x

Z xj����

xj����

u�x� t�dx ���� �

and the integral form becomes

d

dt��x&uj� � fj�� � fj���

Z xj����

xj����

Pdx ������

Now with � x� xj� we can expand u�x� in Eq� ��� in a Taylor series about xj�with t �xed� to get

&uj � �

�x

Z x�

� x�

��uj � �

��u

�x

�j

���

���u

�x�

�j

���

���u

�x�

�j

� � � �

� d� uj �

�x�

��

���u

�x�

�j

��x�

� ��

���u

�x�

�j

�O��x�� ������

or

&uj uj �O��x�� ������

where uj is the value at the center of the cell� Hence the cellaverage value and thevalue at the center of the cell di�er by a term of second order�

���� A Second�Order Approximation to the Convection Equa�

tion

In one dimension� the integral form of the linear convection equation� Eq� ����� becomes

�xd&ujdt� fj�� � fj��� � ������

Page 85: Hydrodynamics - CFD

�� CHAPTER �� FINITE�VOLUME METHODS

with f u� We choose a piecewise constant approximation to u�x� in each cell suchthat

u�x� &uj xj��� � x � xj�� ������

Evaluating this at j � ��� gives

fLj�� f�uLj��� uLj�� &uj ������

where the L indicates that this approximation to fj�� is obtained from the approximation to u�x� in the cell to the left of xj��� as shown in Fig� ���� The cell to theright of xj��� which is cell j � �� gives

fRj�� &uj� ������

Similarly� cell j is the cell to the right of xj���� giving

fRj��� &uj ������

and cell j � � is the cell to the left of xj���� givingfLj��� &uj�� �����

We have now accomplished the �rst step from the list in Section ���! we have de�nedthe �uxes at the cell boundaries in terms of the cellaverage data� In this example�the discontinuity in the �ux at the cell boundary is resolved by taking the average ofthe �uxes on either side of the boundary� Thus

'fj�� �

��fLj�� � fRj���

��&uj � &uj�� ���� �

and

'fj��� �

��fLj��� � fRj����

��&uj�� � &uj� ������

where 'f denotes a numerical �ux which is an approximation to the exact �ux�Substituting Eqs� ��� and ���� into the integral form� Eq� ����� we obtain

�xd&ujdt��

��&uj � &uj��� �

��&uj�� � &uj� �x

d&ujdt��

��&uj� � &uj��� � ������

With periodic boundary conditions� this point operator produces the following semidiscrete form�

d�&u

dt � �

��xBp���� �� ���&u ������

Page 86: Hydrodynamics - CFD

���� ONE�DIMENSIONAL EXAMPLES ��

This is identical to the expression obtained using secondorder centered di�erences�except it is written in terms of the cell average �&u� rather than the nodal values� �u�Hence our analysis and understanding of the eigensystem of the matrix Bp���� �� ��is relevant to �nitevolume methods as well as �nitedi�erence methods� Since theeigenvalues of Bp���� �� �� are pure imaginary� we can conclude that the use of theaverage of the �uxes on either side of the cell boundary� as in Eqs� ��� and ����� canlead to a nondissipative �nitevolume method�

���� A Fourth�Order Approximation to the Convection Equa�

tion

Let us replace the piecewise constant approximation in Section ����� with a piecewisequadratic approximation as follows

u��� a�� � b� � c ������

where � is again equal to x � xj� The three parameters a� b� and c are chosen tosatisfy the following constraints�

�x

Z � x�

�� x�u���d� &uj��

�x

Z x�

� x�u���d� &uj ������

�x

Z � x�

x�u���d� &uj�

These constraints lead to

a &uj� � �&uj � &uj��

��x�

b &uj� � &uj����x

������

c �&uj�� � ��&uj � &uj�

��

With these values of a� b� and c� the piecewise quadratic approximation producesthe following values at the cell boundaries�

uLj�� �

���&uj� � �&uj � &uj��� ������

Page 87: Hydrodynamics - CFD

� CHAPTER �� FINITE�VOLUME METHODS

uRj��� �

���&uj� � �&uj � �&uj��� ������

uRj�� �

���&uj� � �&uj� � �&uj� �����

uLj��� �

���&uj � �&uj�� � &uj��� ���� �

using the notation de�ned in Section ������ Recalling that f u� we again use theaverage of the �uxes on either side of the boundary to obtain

'fj�� �

��f�uLj��� � f�uRj����

����&uj� � �&uj� � �&uj � &uj��� ������

and

'fj��� �

��f�uLj���� � f�uRj�����

����&uj� � �&uj � �&uj�� � &uj��� ������

Substituting these expressions into the integral form� Eq� ����� gives

�xd&ujdt��

����&uj� � &uj� � &uj�� � &uj��� � ������

This is a fourthorder approximation to the integral form of the equation� as can beveri�ed using Taylor series expansions �see question � at the end of this chapter��With periodic boundary conditions� the following semidiscrete form is obtained�

d�&u

dt � �

���xBp����� �� �����&u ������

This is a system of ODE�s governing the evolution of the cellaverage data�

���� A Second�Order Approximation to the Di�usion Equa�

tion

In this section� we describe two approaches to deriving a �nitevolume approximationto the di�usion equation� The �rst approach is simpler to extend to multidimensions�while the second approach is more suited to extension to higher order accuracy�

Page 88: Hydrodynamics - CFD

���� ONE�DIMENSIONAL EXAMPLES �

In one dimension� the integral form of the di�usion equation� Eq� ����� becomes

�xd&ujdt� fj�� � fj��� � ������

with f �ru ��u��x� Also� Eq� ��� becomesZ b

a

�u

�xdx u�b�� u�a� ������

We can thus write the following expression for the average value of the gradient of uover the interval xj � x � xj��

�x

Z xj��

xj

�u

�xdx

�x�uj� � uj� ������

From Eq� ����� we know that the value of a continuous function at the center of a giveninterval is equal to the average value of the function over the interval to secondorderaccuracy� Hence� to secondorder� we can write

'fj�� ���u

�x

�j��

� �

�x�&uj� � &uj� ������

Similarly�

'fj��� � �

�x�&uj � &uj��� �����

Substituting these into the integral form� Eq� ����� we obtain

�xd&ujdt

�x�&uj�� � �&uj � &uj�� ���� �

or� with Dirichlet boundary conditions�

d�&u

dt

�x�B������ ���&u�

��bc�

������

This provides a semidiscrete �nitevolume approximation to the di�usion equation�and we see that the properties of the matrix B������ �� are relevant to the study of�nitevolume methods as well as �nitedi�erence methods�For our second approach� we use a piecewise quadratic approximation as in Section

������ From Eq� ���� we have

�u

�x �u

�� �a� � b ������

Page 89: Hydrodynamics - CFD

� CHAPTER �� FINITE�VOLUME METHODS

with a and b given in Eq� ����� With f ��u��x� this gives

fRj�� fLj�� ��

�x�&uj� � &uj� ������

fRj��� fLj��� ��

�x�&uj � &uj��� ������

Notice that there is no discontinuity in the �ux at the cell boundary� This produces

d&ujdt

�x��&uj�� � �&uj � &uj�� ������

which is identical to Eq� ��� � The resulting semidiscrete form with periodic boundary conditions is

d�&u

dt

�x�Bp������ ���&u ������

which is written entirely in terms of cellaverage data�

��� A Two�Dimensional Example

The above onedimensional examples of �nitevolume approximations obscure someof the practical aspects of such methods� Thus our �nal example is a �nitevolumeapproximation to the twodimensional linear convection equation on a grid consistingof regular triangles� as shown in Figure ���� As in Section ������ we use a piecewiseconstant approximation in each control volume and the �ux at the control volumeboundary is the average of the �uxes obtained on either side of the boundary� Thenodal data are stored at the vertices of the triangles formed by the grid� The controlvolumes are regular hexagons with area A� � is the length of the sides of the triangles�and � is the length of the sides of the hexagons� The following relations hold between�� �� and A�

� �p��

A �p�

���

A

��������

The twodimensional form of the conservation law is

d

dt

ZAQdA�

ICn�Fdl � ������

Page 90: Hydrodynamics - CFD

���� A TWO�DIMENSIONAL EXAMPLE �

05

4

3

2

1

a

bc

d

e f

lp

Figure ���� Triangular grid�

where we have ignored the source term� The contour in the line integral is composedof the sides of the hexagon� Since these sides are all straight� the unit normals canbe taken outside the integral and the �ux balance is given by

d

dt

ZAQ dA�

�X���

n� �Z�Fdl �

where � indexes a side of the hexagon� as shown in Figure ���� A list of the normalsfor the mesh orientation shown is given in Table ����

Side� � Outward Normal�n

� �i�p� j���� i

� �i�p� j���

� ��i�p� j���� �i� ��i�p� j���

Table ���� Outward normals� see Fig� ����i and j are unit normals along x and y� respectively�

Page 91: Hydrodynamics - CFD

� CHAPTER �� FINITE�VOLUME METHODS

For Eq� ����� the twodimensional linear convection equation� we have for side �

n� �Z�Fdl n� � �i cos � � j sin ��

Z �

��u����d� �����

where � is a length measured from the middle of a side �� Making the change ofvariable z ���� one has the expressionZ �

��u���d� �

Z ��

���u�z�dz ���� �

Then� in terms of u and the hexagon area A� we have

d

dt

ZAu dA�

�X���

n� � �i cos � � j sin ����Z ��

���u�z�dz

��

� ������

The values of n� � �i cos � � j sin �� are given by the expressions in Table ���� Thereare no numerical approximations in Eq� ����� That is� if the integrals in the equationare evaluated exactly� the integrated time rate of change of the integral of u over thearea of the hexagon is known exactly�

Side� � n� � �i cos � � j sin ��

� �cos � �p� sin ����� cos �� �cos � �

p� sin ����

� �� cos � �p� sin ����� � cos �� �� cos � �p� sin ����

Table ���� Weights of �ux integrals� see Eq� �����

Introducing the cell average� ZAu dA A&up ������

and the piecewiseconstant approximation u &up over the entire hexagon� the approximation to the �ux integral becomes trivial� Taking the average of the �ux oneither side of each edge of the hexagon gives for edge ��Z

�u�z�dz

&up � &ua�

Z ��

���dz

&up � &ua�

������

Page 92: Hydrodynamics - CFD

���� PROBLEMS �

Similarly� we have for the other �ve edges�Z�u�z�dz

&up � &ub�

������

Z�u�z�dz

&up � &uc�

������

Z�u�z�dz

&up � &ud�

������

Z�u�z�dz

&up � &ue�

������

Z�u�z�dz

&up � &uf�

������

Substituting these into Eq� ����� along with the expressions in Table ���� we obtain

Ad&updt��

���� cos ���&ua � &ud� � �cos � �

p� sin ���&ub � &ue�

��� cos � �p� sin ���&uc � &uf�� � �����

or

d&updt

��

����� cos ���&ua � &ud� � �cos � �

p� sin ���&ub � &ue�

��� cos � �p� sin ���&uc � &uf�� � ���� �

The reader can verify� using Taylor series expansions� that this is a secondorderapproximation to the integral form of the twodimensional linear convection equation�

��� Problems

�� Use Taylor series to verify that Eq� ���� is a fourthorder approximation to Eq������

�� Find the semidiscrete ODE form governing the cellaverage data resulting fromthe use of a linear approximation in developing a �nitevolume method for thelinear convection equation� Use the following linear approximation�

u��� a� � b

Page 93: Hydrodynamics - CFD

� CHAPTER �� FINITE�VOLUME METHODS

where b &uj and

a &uj� � &uj����x

and use the average �ux at the cell interface�

�� Using the �rst approach given in Section ������ derive a �nitevolume approximation to the spatial terms in the twodimensional di�usion equation on asquare grid�

�� Repeat question � for a grid consisting of equilateral triangles�

Page 94: Hydrodynamics - CFD

Chapter �

TIME�MARCHING METHODS

FOR ODE�S

After discretizing the spatial derivatives in the governing PDE�s �such as the NavierStokes equations�� we obtain a coupled system of nonlinear ODE�s in the form

d�u

dt �F ��u� t� �����

These can be integrated in time using a timemarching method to obtain a timeaccurate solution to an unsteady �ow problem� For a steady �ow problem� spatialdiscretization leads to a coupled system of nonlinear algebraic equations in the form

�F ��u� � �����

As a result of the nonlinearity of these equations� some sort of iterative method isrequired to obtain a solution� For example� one can consider the use of Newton�smethod� which is widely used for nonlinear algebraic equations �See Section ���������This produces an iterative method in which a coupled system of linear algebraicequations must be solved at each iteration� These can be solved iteratively usingrelaxation methods� which will be discussed in Chapter � or directly using Gaussianelimination or some variation thereof�Alternatively� one can consider a timedependent path to the steady state and use

a timemarching method to integrate the unsteady form of the equations until thesolution is su�ciently close to the steady solution� The subject of the present chapter�timemarching methods for ODE�s� is thus relevant to both steady and unsteady �owproblems� When using a timemarching method to compute steady �ows� the goal issimply to remove the transient portion of the solution as quickly as possible! timeaccuracy is not required� This motivates the study of stability and sti�ness� topicswhich are covered in the next two chapters�

Page 95: Hydrodynamics - CFD

� CHAPTER �� TIME�MARCHING METHODS FOR ODES

Application of a spatial discretization to a PDE produces a coupled system ofODE�s� Application of a timemarching method to an ODE produces an ordinarydi�erence equation �O�E �� In earlier chapters� we developed exact solutions to ourmodel PDE�s and ODE�s� In this chapter we will present some basic theory of linearO�E�s which closely parallels that for linear ODE�s� and� using this theory� we willdevelop exact solutions for the model O�E�s arising from the application of timemarching methods to the model ODE�s�

�� Notation

Using the semidiscrete approach� we reduce our PDE to a set of coupled ODE�srepresented in general by Eq� ���� However� for the purpose of this chapter� we needonly consider the scalar case

du

dt u� F �u� t� �����

Although we use u to represent the dependent variable� rather than w� the readershould recall the arguments made in Chapter � to justify the study of a scalar ODE�Our �rst task is to �nd numerical approximations that can be used to carry out thetime integration of Eq� ��� to some given accuracy� where accuracy can be measuredeither in a local or a global sense� We then face a further task concerning the numericalstability of the resulting methods� but we postpone such considerations to the nextchapter�In Chapter �� we introduced the convention that the n subscript� or the �n� su

perscript� always points to a discrete time value� and h represents the time interval�t� Combining this notation with Eq� ��� gives

u�n Fn F �un� tn� ! tn nh

Often we need a more sophisticated notation for intermediate time steps involvingtemporary calculations denoted by %u� &u� etc� For these we use the notation

%u�n� %Fn� F �%un�� tn � �h�

The choice of u� or F to express the derivative in a scheme is arbitrary� They areboth commonly used in the literature on ODE�s�The methods we study are to be applied to linear or nonlinear ODE�s� but the

methods themselves are formed by linear combinations of the dependent variable andits derivative at various time intervals� They are represented conceptually by

un� f���u

�n�� ��u

�n� ���u

�n��� � � � � ��un� ���un��� � � �

������

Page 96: Hydrodynamics - CFD

���� CONVERTING TIME�MARCHING METHODS TO O�ES �

With an appropriate choice of the ��s and � �s� these methods can be constructedto give a local Taylor series accuracy of any order� The methods are said to beexplicit if �� � and implicit otherwise� An explicit method is one in which the newpredicted solution is only a function of known data� for example� u�n� u

�n��� un� and

un�� for a method using two previous time levels� and therefore the time advance issimple� For an implicit method� the new predicted solution is also a function of thetime derivative at the new time level� that is� u�n�� As we shall see� for systems ofODE�s and nonlinear problems� implicit methods require more complicated strategiesto solve for un� than explicit methods�

�� Converting Time�Marching Methods to O�E�s

Examples of some very common forms of methods used for timemarching generalODE�s are�

un� un � hu�n �����

un� un � hu�n� �����

and

%un� un � hu�n

un� �

��un � %un� � h%u�n�� �����

According to the conditions presented under Eq� ���� the �rst and third of these areexamples of explicit methods� We refer to them as the explicit Euler method and theMacCormack predictorcorrector method�� respectively� The second is implicit andreferred to as the implicit �or backward� Euler method�These methods are simple recipes for the time advance of a function in terms of its

value and the value of its derivative� at given time intervals� The material presentedin Chapter � develops a basis for evaluating such methods by introducing the conceptof the representative equation

du

dt u� �u� ae�t ����

written here in terms of the dependent variable� u� The value of this equation arisesfrom the fact that� by applying a timemarching method� we can analytically convert

�Here we give only MacCormack�s time�marching method� The method commonly referred to asMacCormack�s method� which is a fully�discrete method� will be presented in Section ��

Page 97: Hydrodynamics - CFD

CHAPTER �� TIME�MARCHING METHODS FOR ODES

such a linear ODE into a linear O�E � The latter are subject to a whole body ofanalysis that is similar in many respects to� and just as powerful as� the theory ofODE�s� We next consider examples of this conversion process and then go into thegeneral theory on solving O�E�s�Apply the simple explicit Euler scheme� Eq� ���� to Eq� ��� There results

un� un � h��un � ae�hn�

or

un� � �� � �h�un hae�hn ��� �

Eq� �� is a linear O�E � with constant coe�cients� expressed in terms of the dependent variable un and the independent variable n� As another example� applying theimplicit Euler method� Eq� ���� to Eq� ��� we �nd

un� un � h��un� � ae�h�n��

�or

��� �h�un� � un he�h � ae�hn ������

As a �nal example� the predictorcorrector sequence� Eq� ���� gives

%un� � �� � �h�un ahe�hn

����� � �h�%un� � un� � �

�un

�ahe�h�n�� ������

which is a coupled set of linear O�E�s with constant coe�cients� Note that the �rstline in Eq� ���� is identical to Eq� �� � since the predictor step in Eq� ��� is simplythe explicit Euler method� The second line in Eq� ���� is obtained by noting that

%u�n� F �%un�� tn � h�

�%un� � ae�h�n�� ������

Now we need to develop techniques for analyzing these di�erence equations so thatwe can compare the merits of the timemarching methods that generated them�

�� Solution of Linear O�E�s With Constant Co�

e�cients

The techniques for solving linear di�erence equations with constant coe�cients is aswell developed as that for ODE�s and the theory follows a remarkably parallel path�This is demonstrated by repeating some of the developments in Section ���� but fordi�erence rather than di�erential equations�

Page 98: Hydrodynamics - CFD

���� SOLUTION OF LINEAR O�ES WITH CONSTANT COEFFICIENTS

����� First� and Second�Order Di�erence Equations

First�Order Equations

The simplest nonhomogeneous O�E of interest is given by the single �rstorder equation

un� �un � abn ������

where �� a� and b are� in general� complex parameters� The independent variable isnow n rather than t� and since the equations are linear and have constant coe�cients�� is not a function of either n or u� The exact solution of Eq� ���� is

un c��n �

abn

b� �

where c� is a constant determined by the initial conditions� In terms of the initialvalue of u it can be written

un u��n � a

bn � �n

b� �

Just as in the development of Eq� ����� one can readily show that the solution of thedefective case� �b ���

un� �un � a�n

isun

hu� � an���

i�n

This can all be easily veri�ed by substitution�

Second�Order Equations

The homogeneous form of a secondorder di�erence equation is given by

un� � a�un� � a�un � ������

Instead of the di�erential operator D � ddtused for ODE�s� we use for O�E�s the

di�erence operator E �commonly referred to as the displacement or shift operator�and de�ned formally by the relations

un� Eun � unk Ekun

Further notice that the displacement operator also applies to exponents� thus

b� � bn bn� E� � bn

Page 99: Hydrodynamics - CFD

� CHAPTER �� TIME�MARCHING METHODS FOR ODES

where � can be any fraction or irrational number�The roles of D and E are the same insofar as once they have been introduced to

the basic equations the value of u�t� or un can be factored out� Thus Eq� ���� cannow be reexpressed in an operational notion as

�E� � a�E � a��un � ������

which must be zero for all un� Eq� ���� is known as the operational form of Eq� �����The operational form contains a characteristic polynomial P �E� which plays the samerole for di�erence equations that P �D� played for di�erential equations! that is� itsroots determine the solution to the O�E� In the analysis of O�E�s� we label theseroots ��� ��� � � �� etc� and refer to them as the ��roots� They are found by solving theequation P ��� �� In the simple example given above� there are just two � rootsand in terms of them the solution can be written

un c�����n � c�����

n ������

where c� and c� depend upon the initial conditions� The fact that Eq� ���� is asolution to Eq� ���� for all c� � c� and n should be veri�ed by substitution�

����� Special Cases of Coupled First�Order Equations

A Complete System

Coupled� �rstorder� linear homogeneous di�erence equations have the form

u�n��� c��u

�n�� � c��u

�n��

u�n��� c��u

�n�� � c��u

�n�� ������

which can also be written

�un� C�un � �un hu�n�� � u

�n��

iT� C

�c�� c��c�� c��

�The operational form of Eq� ���� can be written�

�c�� � E� c��c�� �c�� � E�

� �u�u�

��n� �C � E I ��un �

which must be zero for all u� and u�� Again we are led to a characteristic polynomial�this time having the form P �E� det �C � E I �� The �roots are found from

P ��� det��c�� � �� c��

c�� �c�� � ��

� �

Page 100: Hydrodynamics - CFD

���� SOLUTION OF THE REPRESENTATIVE O�ES �

Obviously the �k are the eigenvalues of C and� following the logic of Section ����if �x are its eigenvectors� the solution of Eq� ���� is

�un �X

k��

ck��k�n�xk

where ck are constants determined by the initial conditions�

A Defective System

The solution of O�E�s with defective eigensystems follows closely the logic in Section����� for defective ODE�s� For example� one can show that the solution to��� &un�

'un�

un�

� ��� �� �

� �

���� &un'unun

�is

&un &u��n

'un h'u� � &u�n�

��i�n

un

�u� � 'u�n�

�� � &u�n�n� ��

����

��n �����

�� Solution of the Representative O�E�s

����� The Operational Form and its Solution

Examples of the nonhomogeneous� linear� �rstorder ordinary di�erence equations�produced by applying a timemarching method to the representative equation� aregiven by Eqs� �� to ����� Using the displacement operator� E� these equations canbe written

�E � �� � �h��un h � ae�hn ���� �

���� �h�E � ��un h � E � ae�hn ������

�E ��� � �h�

����� � �h�E E � ��

� �%uu

�n

h �����E

�� ae�hn ������

Page 101: Hydrodynamics - CFD

� CHAPTER �� TIME�MARCHING METHODS FOR ODES

All three of these equations are subsets of the operational form of the representativeO�E

P �E�un Q�E� � ae�hn ������

which is produced by applying timemarching methods to the representative ODE� Eq������ We can express in terms of Eq� ���� all manner of standard timemarching methods having multiple time steps and various types of intermediate predictorcorrectorfamilies� The terms P �E� and Q�E� are polynomials in E referred to as the charac�teristic polynomial and the particular polynomial� respectively�The general solution of Eq� ���� can be expressed as

un KXk��

ck��k�n � ae�hn � Q�e

�h�

P �e�h�������

where �k are the K roots of the characteristic polynomial� P ��� �� When determinants are involved in the construction of P �E� and Q�E�� as would be the case forEq� ����� the ratio Q�E��P �E� can be found by Kramer�s rule� Keep in mind thatfor methods such as in Eq� ���� there are multiple �two in this case� solutions� onefor un and %un and we are usually only interested in the �nal solution un� Notice also�the important subset of this solution which occurs when �� representing a timeinvariant particular solution� or a steady state� In such a case

un KXk��

ck��k�n � a � Q���

P ���

����� Examples of Solutions to Time�Marching O�E�s

As examples of the use of Eqs� ���� and ����� we derive the solutions of Eqs� ��� to����� For the explicit Euler method� Eq� ��� � we have

P �E� E � �� �h

Q�E� h ������

and the solution of its representative O�E follows immediately from Eq� �����

un c��� � �h�n � ae�hn � h

e�h � �� �h

For the implicit Euler method� Eq� ����� we have

P �E� ��� �h�E � �Q�E� hE ������

Page 102: Hydrodynamics - CFD

���� THE �� � RELATION �

so

un c�

��

�� �h

�n� ae�hn � he�h

��� �h�e�h � �In the case of the coupled predictorcorrector equations� Eq� ����� one solves for the�nal family un �one can also �nd a solution for the intermediate family %u�� and thereresults

P �E� det

�E ��� � �h�

����� � �h�E E � ��

� E

�E � �� �h� �

���h�

Q�E� det�

E h����� � �h�E �

�hE

� �

�hE�E � � � �h�

The �root is found from

P ��� ��� � �� �h� �

���h�

� �

which has only one nontrivial root �� � is simply a shift in the reference index��The complete solution can therefore be written

un c�

�� � �h�

���h�

�n� ae�hn �

�h�e�h � � � �h

�e�h � �� �h� �

���h�

������

�� The �� � Relation

���� Establishing the Relation

We have now been introduced to two basic kinds of roots� the �roots and the �roots�The former are the eigenvalues of the A matrix in the ODE�s found by space di�erencing the original PDE� and the latter are the roots of the characteristic polynomialin a representative O�E found by applying a timemarching method to the representative ODE� There is a fundamental relation between the two which can be usedto identify many of the essential properties of a timemarch method� This relation is�rst demonstrated by developing it for the explicit Euler method�First we make use of the semidiscrete approach to �nd a system of ODE�s and

then express its solution in the form of Eq� ����� Remembering that t nh� one canwrite

u�t� c��e��h

�n �x� � � � �� cm�e�mh

�n �xm � � � �� cM�e�Mh

�n �xM � P�S� ������

Page 103: Hydrodynamics - CFD

� CHAPTER �� TIME�MARCHING METHODS FOR ODES

where for the present we are not interested in the form of the particular solution�P�S��� Now the explicit Euler method produces for each �root� one �root� whichis given by � � � �h� So if we use the Euler method for the time advance of theODE�s� the solution� of the resulting O�E is

un c�����n �x� � � � �� cm��m�

n �xm � � � �� cM��M�n �xM � P�S� �����

where the cm and the �xm in the two equations are identical and �m �� � �mh��Comparing Eq� ���� and Eq� ���� we see a correspondence between �m and e�mh�Since the value of e�h can be expressed in terms of the series

e�h � � �h ��

���h� �

���h� � � � �� �

n$�nhn � � � �

the truncated expansion � �� �h is a reasonable� approximation for small enough�h�

Suppose� instead of the Euler method� we use the leapfrog method for the timeadvance� which is de�ned by

un� un�� � �hu�n ���� �

Applying Eq� �� to Eq� ��� � we have the characteristic polynomial P �E� E� ���hE � �� so that for every � the � must satisfy the relation

��m � ��mh�m � � � ������

Now we notice that each � produces two �roots� For one of these we �nd

�m �mh �q� � ��mh

� ������

� � �mh ��

���mh

� � ���mh

� � � � � ������

This is an approximation to e�mh with an error O���h��� The other root� �mh �q� � ��mh

�� will be discussed in Section ������

�Based on Section �����The error is O���h���

Page 104: Hydrodynamics - CFD

���� THE �� � RELATION �

���� The Principal ��Root

Based on the above we make the following observation�

Application of the same timemarching method to all of the equations ina coupled system linear ODE�s in the form of Eq� ���� always producesone �root for every �root that satis�es the relation

� � � �h��

���h� � � � �� �

k$�khk �O

�hk�

�where k is the order of the timemarching method�

������

We refer to the root that has the above property as the principal �root� and designateit ��m��� The above property can be stated regardless of the details of the time

marching method� knowing only that its leading error is O�hk�

�� Thus the principal

root is an approximation to e�h up to O�hk��

Note that a secondorder approximation to a derivative written in the form

��tu�n �

�h�un� � un��� ������

has a leading truncation error which is O�h��� while the secondorder timemarchingmethod which results from this approximation� which is the leapfrog method�

un� un�� � �hu�n ������

has a leading truncation error O�h��� This arises simply because of our notationfor the timemarching method in which we have multiplied through by h to get anapproximation for the function un� rather than the derivative as in Eq� ����� Thefollowing example makes this clear� Consider a solution obtained at a given time Tusing a secondorder timemarching method with a time step h� Now consider thesolution obtained using the same method with a time step h��� Since the error pertime step is O�h��� this is reduced by a factor of eight �considering the leading termonly�� However� twice as many time steps are required to reach the time T � Thereforethe error at the end of the simulation is reduced by a factor of four� consistent witha secondorder approximation�

���� Spurious ��Roots

We saw from Eq� ���� that the �� � relation for the leapfrog method produces two�roots for each �� One of these we identi�ed as the principal root which always

Page 105: Hydrodynamics - CFD

� CHAPTER �� TIME�MARCHING METHODS FOR ODES

has the property given in ����� The other is referred to as a spurious �root anddesignated ��m��� In general� the ��� relation produced by a timemarching schemecan result in multiple �roots all of which� except for the principal one� are spurious�All spurious roots are designated ��m�k where k �� �� � � �� No matter whether a�root is principal or spurious� it is always some algebraic function of the product �h�To express this fact we use the notation � ���h��If a timemarching method produces spurious �roots� the solution for the O�E in

the form shown in Eq� ��� must be modi�ed� Following again the message of Section���� we have

un c������n��x� � � � �� cm���m�

n��xm � � � �� cM���M�

n��xM � P�S�

�c������n��x� � � � �� cm���m�

n��xm � � � �� cM���M�

n��xM

�c������n��x� � � � �� cm���m�

n��xm � � � �� cM���M�

n��xM

�etc�� if there are more spurious roots ������

Spurious roots arise if a method uses data from time level n � � or earlier toadvance the solution from time level n to n � �� Such roots originate entirely fromthe numerical approximation of the timemarching method and have nothing to dowith the ODE being solved� However� generation of spurious roots does not� in itself�make a method inferior� In fact� many very accurate methods in practical use forintegrating some forms of ODE�s have spurious roots�It should be mentioned that methods with spurious roots are not self starting�

For example� if there is one spurious root to a method� all of the coe�cients �cm��in Eq� ���� must be initialized by some starting procedure� The initial vector �u�does not provide enough data to initialize all of the coe�cients� This results becausemethods which produce spurious roots require data from time level n � � or earlier�For example� the leapfrog method requires �un�� and thus cannot be started usingonly �un�Presumably �i�e�� if one starts the method properly� the spurious coe�cients are

all initialized with very small magnitudes� and presumably the magnitudes of thespurious roots themselves are all less than one �see Chapter ��� Then the presence ofspurious roots does not contaminate the answer� That is� after some �nite time theamplitude of the error associated with the spurious roots is even smaller then whenit was initialized� Thus while spurious roots must be considered in stability analysis�they play virtually no role in accuracy analysis�

���� One�Root Time�Marching Methods

There are a number of timemarching methods that produce only one �root for each�root� We refer to them as one�rootmethods� They are also called onestep methods�

Page 106: Hydrodynamics - CFD

���� ACCURACY MEASURES OF TIME�MARCHING METHODS �

They have the signi�cant advantage of being selfstarting which carries with it thevery useful property that the timestep interval can be changed at will throughoutthe marching process� Three oneroot methods were analyzed in Section ������ Apopular method having this property� the socalled �method� is given by the formula

un� un � hh��� ��u�n � �u�n�

iThe �method represents the explicit Euler �� ��� the trapezoidal �� �

��� and the

implicit Euler methods �� ��� respectively� Its �� � relation is

� � � ��� ���h

�� ��h

It is instructive to compare the exact solution to a set of ODE�s �with a completeeigensystem� having timeinvariant forcing terms with the exact solution to the O�E�sfor oneroot methods� These are

�u�t� c��e��h

�n �x� � � � �� cm�e�mh

�n �xm � � � �� cM�e�Mh

�n �xM � A���f

�un c�����n �x� � � � �� cm��m�

n �xm � � � �� cM��M �n �xM � A���f ������

respectively� Notice that when t and n �� these equations are identical� so that allthe constants� vectors� and matrices are identical except the �u and the terms insidethe parentheses on the right hand sides� The only error made by introducing the timemarching is the error that � makes in approximating e�h�

� Accuracy Measures of Time�Marching Meth�

ods

����� Local and Global Error Measures

There are two broad categories of errors that can be used to derive and evaluate timemarching methods� One is the error made in each time step� This is a local error suchas that found from a Taylor table analysis� see Section ���� It is usually used as thebasis for establishing the order of a method� The other is the error determined at theend of a given event which has covered a speci�c interval of time composed of manytime steps� This is a global error� It is useful for comparing methods� as we shall seein Chapter �It is quite common to judge a timemarching method on the basis of results found

from a Taylor table� However� a Taylor series analysis is a very limited tool for �ndingthe more subtle properties of a numerical timemarching method� For example� it isof no use in�

Page 107: Hydrodynamics - CFD

CHAPTER �� TIME�MARCHING METHODS FOR ODES

� �nding spurious roots�

� evaluating numerical stability and separating the errors in phase and amplitude�

� analyzing the particular solution of predictorcorrector combinations�

� �nding the global error�

The latter three of these are of concern to us here� and to study them we make use ofthe material developed in the previous sections of this chapter� Our error measuresare based on the di�erence between the exact solution to the representative ODE�given by

u�t� ce�t �ae�t

� ������

and the solution to the representative O�E�s� including only the contribution fromthe principal root� which can be written as

un c�����n � ae�hn � Q�e

�h�

P �e�h����� �

����� Local Accuracy of the Transient Solution �er�� j�j � er�

Transient error

The particular choice of an error measure� either local or global� is to some extentarbitrary� However� a necessary condition for the choice should be that the measurecan be used consistently for all methods� In the discussion of the �� relation wesaw that all timemarching methods produce a principal �root for every �root thatexists in a set of linear ODE�s� Therefore� a very natural local error measure for thetransient solution is the value of the di�erence between solutions based on these tworoots� We designate this by er� and make the following de�nition

er� � e�h � ��

The leading error term can be found by expanding in a Taylor series and choosingthe �rst nonvanishing term� This is similar to the error found from a Taylor table�The order of the method is the last power of �h matched exactly�

Page 108: Hydrodynamics - CFD

���� ACCURACY MEASURES OF TIME�MARCHING METHODS

Amplitude and Phase Error

Suppose a � eigenvalue is imaginary� Such can indeed be the case when we study theequations governing periodic convection which produces harmonic motion� For suchcases it is more meaningful to express the error in terms of amplitude and phase�Let � i� where � is a real number representing a frequency� Then the numericalmethod must produce a principal �root that is complex and expressible in the form

�� �r � i�i � ei�h ������

From this it follows that the local error in amplitude is measured by the deviation ofj��j from unity� that is

era �� j��j ��q�����r � ����

�i

and the local error in phase can be de�ned as

er� � �h� tan�� �����i�����r�� ������

Amplitude and phase errors are important measures of the suitability of timemarchingmethods for convection and wave propagation phenomena�The approach to error analysis described in Section ��� can be extended to the

combination of a spatial discretization and a timemarching method applied to thelinear convection equation� The principal root� ����h�� is found using � �ia��where � is the modi�ed wavenumber of the spatial discretization� Introducing theCourant number� Cn ah��x� we have �h �iCn

��x� Thus one can obtainvalues of the principal root over the range � � �x � � for a given value of theCourant number� The above expression for er� can be normalized to give the errorin the phase speed� as follows

erp er��h

� �tan�� �����i�����r��

Cn�x������

where � �a� A positive value of erp corresponds to phase lag �the numerical phasespeed is too small�� while a negative value corresponds to phase lead �the numericalphase speed is too large��

����� Local Accuracy of the Particular Solution �er�

The numerical error in the particular solution is found by comparing the particularsolution of the ODE with that for the O�E� We have found these to be given by

P�S��ODE� ae�t � �

�� ��

Page 109: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

and

P�S��O E� ae�t � Q�e�h�

P �e�h�

respectively� For a measure of the local error in the particular solution we introducethe de�nition

er� � h

�P�S��O E�

P�S��ODE�

� ��

������

The multiplication by h converts the error from a global measure to a local one� sothat the order of er� and er� are consistent� In order to determine the leading errorterm� Eq� ���� can be written in terms of the characteristic and particular polynomialsas

er� co

� ��n�� ��Q

�e�h�� P

�e�h�o

������

where

co limh��

h�� ��

P�e�h�

The value of co is a methoddependent constant that is often equal to one� If theforcing function is independent of time� is equal to zero� and for this case� manynumerical methods generate an er� that is also zero�The algebra involved in �nding the order of er� can be quite tedious� However�

this order is quite important in determining the true order of a timemarching methodby the process that has been outlined� An illustration of this is given in the sectionon RungeKutta methods�

����� Time Accuracy For Nonlinear Applications

In practice� timemarching methods are usually applied to nonlinear ODE�s� and itis necessary that the advertised order of accuracy be valid for the nonlinear cases aswell as for the linear ones� A necessary condition for this to occur is that the localaccuracies of both the transient and the particular solutions be of the same order�More precisely� a timemarching method is said to be of order k if

er� c� � ��h�k�� ������

er� c� � ��h�k�� ������

where k smallest of�k�� k�� ������

Page 110: Hydrodynamics - CFD

���� ACCURACY MEASURES OF TIME�MARCHING METHODS ���

The reader should be aware that this is not su�cient� For example� to derive all ofthe necessary conditions for the fourthorder RungeKutta method presented laterin this chapter the derivation must be performed for a nonlinear ODE� However� theanalysis based on a linear nonhomogeneous ODE produces the appropriate conditionsfor the majority of timemarching methods used in CFD�

���� Global Accuracy

In contrast to the local error measures which have just been discussed� we can alsode�ne global error measures� These are useful when we come to the evaluation oftimemarching methods for speci�c purposes� This subject is covered in Chapter after our introduction to stability in Chapter ��

Suppose we wish to compute some timeaccurate phenomenon over a �xed intervalof time using a constant time step� We refer to such a computation as an �event��Let T be the �xed time of the event and h be the chosen step size� Then the requirednumber of time steps� is N� given by the relation

T Nh

Global error in the transient

A natural extension of er� to cover the error in an entire event is given by

Er� � e�T � �����h��N �����

Global error in amplitude and phase

If the event is periodic� we are more concerned with the global error in amplitude andphase� These are given by

Era ���q�����r � ����

�i

�N���� �

and

Er� � N

��h� tan��

�����i����r

�� �T �N tan�� �����i�����r� ������

Page 111: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

Global error in the particular solution

Finally� the global error in the particular solution follows naturally by comparing thesolutions to the ODE and the O�E� It can be measured by

Er� � �� ��Q�e�h�

P�e�h� � �

� Linear Multistep Methods

In the previous sections� we have developed the framework of error analysis for timeadvance methods and have randomly introduced a few methods without addressingmotivational� developmental or design issues� In the subsequent sections� we introduceclasses of methods along with their associated error analysis� We shall not spend muchtime on development or design of these methods� since most of them have historicorigins from a wide variety of disciplines and applications� The Linear MultistepMethods �LMM�s� are probably the most natural extension to time marching of thespace di�erencing schemes introduced in Chapter � and can be analyzed for accuracyor designed using the Taylor table approach of Section ����

�� �� The General Formulation

When applied to the nonlinear ODE

du

dt u� F�u� t�

all linear multistep methods can be expressed in the general form

�Xk���K

�kunk h�X

k���K

�kFnk ������

where the notation for F is de�ned in Section ���� The methods are said to be linearbecause the ��s and ��s are independent of u and n� and they are said to be Kstepbecause K timelevels of data are required to marching the solution one timestep� h�They are explicit if �� � and implicit otherwise�When Eq� ���� is applied to the representative equation� Eq� ��� and the result is

expressed in operational form� one �nds�� �Xk���K

�kEk

�Aun h

�� �Xk���K

�kEk

�A��un � ae�hn� ������

Page 112: Hydrodynamics - CFD

��� LINEAR MULTISTEP METHODS ���

We recall from Section ����� that a timemarching method when applied to the representative equation must provide a �root� labeled ��� that approximates e

�h throughthe order of the method� The condition referred to as consistency simply means that� � � as h � �� and it is certainly a necessary condition for the accuracy of anytime marching method� We can also agree that� to be of any value in time accuracy�a method should at least be �rstorder accurate� that is � � �� ��h� as h� �� Onecan show that these conditions are met by any method represented by Eq� ���� ifX

k

�k � andXk

�k Xk

�K � k � ���k

Since both sides of Eq� ���� can be multiplied by an arbitrary constant� these methodsare often �normalized� by requiring X

k

�k �

Under this condition co � in Eq� �����

�� �� Examples

There are many special explicit and implicit forms of linear multistep methods� Twowellknown families of them� referred to as AdamsBashforth �explicit� and AdamsMoulton �implicit�� can be designed using the Taylor table approach of Section ����The AdamsMoulton family is obtained from Eq� ���� with

�� �� �� ��� �k �� k ������ � � � ������

The AdamsBashforth family has the same ��s with the additional constraint that�� �� The threestep AdamsMoulton method can be written in the following form

un� un � h���u�n� � ��u

�n � ���u

�n�� � ���u

�n��� ������

A Taylor table for Eq� ���� can be generated as

un h � u�n h� � u��n h� � u���n h� � u����nun� � � �

���

���

�un ���h��u�n� ��� ��� ��� �� ��� ���h��u�n ����h���u�n�� ���� ��� ���� �� ���

��

�h���u�n�� ��������� ��������� ����������� ��������� ��

Table ���� Taylor table for the AdamsMoulton threestep linear multistep method�

Page 113: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

This leads to the linear system������ � � �� � �� ��� � � ��� � �� ���

����������������

� ���������

� ������

to solve for the ��s� resulting in

�� ���� �� � ���� ��� ������ ��� ���� ������

which produces a method which is fourthorder accurate�� With �� � one obtains��� � � �� �� ��� � ��

���� ��������

� ��� ���

� ������

giving

�� ������ ��� ������� ��� ���� �����

This is the thirdorder AdamsBashforth method�A list of simple methods� some of which are very common in CFD applications�

is given below together with identifying names that are sometimes associated withthem� In the following material AB�n� and AM�n� are used as abbreviations for the�n�th order AdamsBashforth and �n�th order AdamsMoulton methods� One canverify that the Adams type schemes given below satisfy Eqs� ���� and ���� up to theorder of the method�

Explicit Methods

un� un � hu�n Eulerun� un�� � �hu

�n Leapfrog

un� un ���hh�u�n � u�n��

iAB�

un� un �h��

h��u�n � ��u�n�� � �u�n��

iAB�

Implicit Methods

un� un � hu�n� Implicit Euler

un� un ���hhu�n � u�n�

iTrapezoidal �AM��

un� ��

h�un � un�� � �hu

�n�

i�ndorder Backward

un� un �h��

h�u�n� � u

�n � u�n��

iAM�

�Recall from Section ����� that a kth�order time�marching method has a leading truncation errorterm which is O�hk���

Page 114: Hydrodynamics - CFD

��� LINEAR MULTISTEP METHODS ���

�� �� Two�Step Linear Multistep Methods

High resolution CFD problems usually require very large data sets to store the spatialinformation from which the time derivative is calculated� This limits the interestin multistep methods to about two time levels� The most general twostep linearmultistep method �i�e�� K � in Eq� ������ that is at least �rstorder accurate� can bewritten as

�� � ��un� ��� � ���un � �un��� � hh�u�n� � ��� � � ��u�n � �u�n��

i���� �

Clearly the methods are explicit if � � and implicit otherwise� A list of methodscontained in Eq� ��� is given in Table ���� Notice that the Adams methods have� �� which corresponds to ��� � in Eq� ����� Methods with � ����� whichcorresponds to �� � in Eq� ����� are known as Milne methods�

� � � Method Order

� � � Euler �� � � Implicit Euler ���� � � Trapezoidal or AM� �� ��� � �nd Order Backward ���� � ���� Adams type ���� ���� ���� Lees Type ���� ���� ���� Two�step trapezoidal ��� ���� ��� A�contractive �� ���� � Leapfrog �� � ��� AB� �� ���� ���� Most accurate explicit ���� ���� � Third�order implicit ����� � ���� AM� ���� ���� ���� Milne �

Table ���� Some linear one and twostep methods� see Eq� ��� �

One can show after a little algebra that both er� and er� are reduced to ��h��

�i�e�� the methods are �ndorder accurate� if

� � � � ��

The class of all �rdorder methods is determined by imposing the additional constraint

� �� � ��

Finally a unique fourthorder method is found by setting � �� ���� ���

Page 115: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

� Predictor�Corrector Methods

There are a wide variety of predictorcorrector schemes created and used for a varietyof purposes� Their use in solving ODE�s is relatively easy to illustrate and understand�Their use in solving PDE�s can be much more subtle and demands concepts� whichhave no counterpart in the analysis of ODE�s�Predictorcorrector methods constructed to timemarch linear or nonlinear ODE�s

are composed of sequences of linear multistep methods� each of which is referred toas a family in the solution process� There may be many families in the sequence� andusually the �nal family has a higher Taylorseries order of accuracy than the intermediate ones� Their use is motivated by ease of application and increased e�ciency�where measures of e�ciency are discussed in the next two chapters�A simple onepredictor� onecorrector example is given by

%un� un � �hu�n

un� un � hh�%u�n� � u�n

i������

where the parameters �� � and are arbitrary parameters to be determined� Onecan analyze this sequence by applying it to the representative equation and usingthe operational techniques outlined in Section ���� It is easy to show� following theexample leading to Eq� ����� that

P �E� E� �hE � �� � � ���h� ����h�

i������

Q�E� E� � h � ��E� � � ���h� ������

Considering only local accuracy� one is led� by following the discussion in Section ����to the following observations� For the method to be secondorder accurate both er�and er� must be O�h

��� For this to hold for er�� it is obvious from Eq� ���� that

� � � ! �� �

which provides two equations for three unknowns� The situation for er� requires somealgebra� but it is not di�cult to show using Eq� ���� that the same conditions alsomake it O�h��� One concludes� therefore� that the predictorcorrector sequence

%un� un � �hu�n

un� un ��

�h���

�%u�n� �

���� ��

�u�n

�������

is a secondorder accurate method for any ��

�Such as alternating direction� fractional�step� and hybrid methods�

Page 116: Hydrodynamics - CFD

���� RUNGE�KUTTA METHODS ���

A classical predictorcorrector sequence is formed by following an AdamsBashforthpredictor of any order with an AdamsMoulton corrector having an order one higher�The order of the combination is then equal to the order of the corrector� If the orderof the corrector is �k�� we refer to these as ABM�k� methods� The AdamsBashforthMoulton sequence for k � is

%un� un ��

�hh�u�n � u�n��

iun� un �

h

��

h�%u�n� � u

�n � u�n��

i������

Some simple� speci�c� secondorder accurate methods are given below� The Gazdagmethod� which we discuss in Chapter � is

%un� un ��

�hh�%u�n � %u�n��

iun� un �

�hh%u�n � %u

�n�

i������

The Burstein method� obtained from Eq� ���� with � ��� is

%un�� un ��

�hu�n

un� un � h%u�n�� ������

and� �nally� MacCormack�s method� presented earlier in this chapter� is

%un� un � hu�n

un� �

��un � %un� � h%u�n�� ������

Note that MacCormack�s method can also be written as

%un� un � hu�n

un� un ��

�h�u�n � %u

�n�� �����

from which it is clear that it is obtained from Eq� ���� with � ��

�� Runge�Kutta Methods

There is a special subset of predictorcorrector methods� referred to as RungeKuttamethods�� that produce just one �root for each �root such that ���h� corresponds

�Although implicit and multi�step Runge�Kutta methods exist� we will consider only single�step�explicit Runge�Kutta methods here�

Page 117: Hydrodynamics - CFD

�� CHAPTER �� TIME�MARCHING METHODS FOR ODES

to the Taylor series expansion of e�h out through the order of the method and thentruncates� Thus for a RungeKutta method of order k �up to �th order�� the principal�and only� �root is given by

� � � �h ��

���h� � � � �� �

k$�khk ���� �

It is not particularly di�cult to build this property into a method� but� as we pointedout in Section ������ it is not su�cient to guarantee k�th order accuracy for the solutionof u� F �u� t� or for the representative equation� To ensure k�th order accuracy� themethod must further satisfy the constraint that

er� O�hk�� ������

and this is much more di�cult�The most widely publicized RungeKutta process is the one that leads to the

fourthorder method� We present it below in some detail� It is usually introduced inthe form

k� hF �un� tn�

k� hF �un � �k�� tn � �h�

k� hF �un � ��k� � �k�� tn � ��h�

k� hF �un � ��k� � �k� � ��k�� tn � ��h�

followed by

u�tn � h�� u�tn� �k� � �k� � �k� � �k� ������

However� we prefer to present it using predictorcorrector notation� Thus� a schemeentirely equivalent to ���� is

bun� un � �hu�n%un�� un � ��hu

�n � �hbu�n�

un�� un � ��hu�n � �hbu�n� � ��h%u

�n��

un� un � �hu�n � �hbu�n� � �h%u

�n��

� �hu�n��

������

Appearing in Eqs� ���� and ���� are a total of �� parameters which are to bedetermined such that the method is fourthorder according to the requirements inEqs� ��� and ����� First of all� the choices for the time samplings� �� ��� and ��� arenot arbitrary� They must satisfy the relations

� �

�� �� � �

�� �� � � � �� ������

Page 118: Hydrodynamics - CFD

���� RUNGE�KUTTA METHODS ��

The algebra involved in �nding algebraic equations for the remaining �� parametersis not trivial� but the equations follow directly from �nding P �E� and Q�E� and thensatisfying the conditions in Eqs� ��� and ����� Using Eq� ���� to eliminate the ��swe �nd from Eq� ��� the four conditions

� � � � � � � � ����� � ��� � ��� ��� ���

�� � � ��� � � ����� ��� ����� ��� ���� ���

������

These four relations guarantee that the �ve terms in � exactly match the �rst � termsin the expansion of e�h� To satisfy the condition that er� O�k��� we have to ful�llfour more conditions

��� � ��

�� � ��

�� ��� ���

��� � ��

�� � ��

�� ��� ���

��� � � ���

� � � ������ ���� ���

���� � � ����� � � ����� �� ���

������

The number in parentheses at the end of each equation indicates the order thatis the basis for the equation� Thus if the �rst � equations in ���� and the �rstequation in ���� are all satis�ed� the resulting method would be thirdorder accurate�As discussed in Section ������ the fourth condition in Eq� ���� cannot be derivedusing the methodology presented here� which is based on a linear nonhomogenousrepresentative ODE� A more general derivation based on a nonlinear ODE can befound in several books��

There are eight equations in ���� and ���� which must be satis�ed by the ��unknowns� Since the equations are overdetermined� two parameters can be set arbitrarily� Several choices for the parameters have been proposed� but the most popularone is due to Runge� It results in the �standard� fourthorder RungeKutta methodexpressed in predictorcorrector form as

bun�� un ��

�hu�n

%un�� un ��

�hbu�n��

un� un � h%u�n��

un� un ��

�hhu�n � �

�bu�n�� � %u�n��

�� u�n�

i������

�The present approach based on a linear inhomogeneous equation provides all of the necessaryconditions for Runge�Kutta methods of up to third order�

Page 119: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

Notice that this represents the simple sequence of conventional linear multistep methods referred to� respectively� as

Euler PredictorEuler CorrectorLeapfrog PredictorMilne Corrector

��������� � RK�

One can easily show that both the Burstein and the MacCormack methods given byEqs� ���� and ���� are secondorder RungeKutta methods� and thirdorder methodscan be derived from Eqs� ���� by setting � � and satisfying only Eqs� ���� and the�rst equation in ����� It is clear that for orders one through four� RK methods of orderk require k evaluations of the derivative function to advance the solution one timestep� We shall discuss the consequences of this in Chapter � Higherorder RungeKutta methods can be developed� but they require more derivative evaluations thantheir order� For example� a �fthorder method requires six evaluations to advancethe solution one step� In any event� storage requirements reduce the usefulness ofRungeKutta methods of order higher than four for CFD applications�

��� Implementation of Implicit Methods

We have presented a wide variety of timemarching methods and shown how to derivetheir � � � relations� In the next chapter� we will see that these methods can havewidely di�erent properties with respect to stability� This leads to various tradeo�s which must be considered in selecting a method for a speci�c application� Ourpresentation of the timemarching methods in the context of a linear scalar equationobscures some of the issues involved in implementing an implicit method for systemsof equations and nonlinear equations� These are covered in this Section�

������ Application to Systems of Equations

Consider �rst the numerical solution of our representative ODE

u� �u� ae�t ������

using the implicit Euler method� Following the steps outlined in Section ���� weobtained

��� �h�un� � un he�h � ae�hn �����

Page 120: Hydrodynamics - CFD

����� IMPLEMENTATION OF IMPLICIT METHODS ���

Solving for un� gives

un� �

�� �h�un � he�h � ae�hn� ���� �

This calculation does not seem particularly onerous in comparison with the application of an explicit method to this ODE� requiring only an additional division�Now let us apply the implicit Euler method to our generic system of equations

given by

�u� A�u� �f�t� �����

where �u and �f are vectors and we still assume that A is not a function of �u or t� Nowthe equivalent to Eq� ��� is

�I � hA��un� � �un �h�f�t � h� �����

or

�un� �I � hA�����un � h�f�t� h�� �����

The inverse is not actually performed� but rather we solve Eq� ��� as a linear systemof equations� For our onedimensional examples� the system of equations which mustbe solved is tridiagonal �e�g�� for biconvection� A �aBp���� �� �����x�� and henceits solution is inexpensive� but in multidimensions the bandwidth can be very large� Ingeneral� the cost per time step of an implicit method is larger than that of an explicitmethod� The primary area of application of implicit methods is in the solution ofsti� ODE�s� as we shall see in Chapter �

������ Application to Nonlinear Equations

Now consider the general nonlinear scalar ODE given by

du

dt F �u� t� �����

Application of the implicit Euler method gives

un� un � hF �un�� tn�� �����

This is a nonlinear di�erence equation� As an example� consider the nonlinear ODE

du

dt��

�u� � �����

Page 121: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

solved using implicit Euler time marching� which gives

un� � h�

�u�n� un �����

which requires a nontrivial method to solve for un�� There are several di�erentapproaches one can take to solving this nonlinear di�erence equation� An iterativemethod� such as Newton�s method �see below�� can be used� In practice� the �initialguess� for this nonlinear problem can be quite close to the solution� since the �initialguess� is simply the solution at the previous time step� which implies that a linearization approach may be quite successful� Such an approach is described in the nextSection�

������ Local Linearization for Scalar Equations

General Development

Let us start the process of local linearization by considering Eq� ���� In order toimplement the linearization� we expand F �u� t� about some reference point in time�Designate the reference value by tn and the corresponding value of the dependentvariable by un� A Taylor series expansion about these reference quantities gives

F �u� t� F �un� tn� �

��F

�u

�n

�u� un� �

��F

�t

�n

�t� tn�

��

���F

�u�

�n

�u� un�� �

���F

�u�t

�n

�u� un��t� tn�

��

���F

�t�

�n

�t� tn�� � � � � �����

On the other hand� the expansion of u�t� in terms of the independent variable t is

u�t� un � �t� tn�

��u

�t

�n

��

��t� tn�

���u

�t�

�n

� � � � ����

If t is within h of tn� both �t � tn�k and �u � un�

k are O�hk�� and Eq� ��� can bewritten

F �u� t� Fn �

��F

�u

�n

�u� un� �

��F

�t

�n

�t� tn� �O�h�� ��� �

Page 122: Hydrodynamics - CFD

����� IMPLEMENTATION OF IMPLICIT METHODS ���

Notice that this is an expansion of the derivative of the function� Thus� relative to theorder of expansion of the function� it represents a secondorderaccurate� locallylinearapproximation to F �u� t� that is valid in the vicinity of the reference station tn andthe corresponding un u�tn�� With this we obtain the locally �in the neighborhoodof tn� timelinear representation of Eq� ���� namely

du

dt

��F

�u

�n

u�

�Fn �

��F

�u

�n

un

��

��F

�t

�n

�t� tn� �O�h�� ��� ��

Implementation of the Trapezoidal Method

As an example of how such an expansion can be used� consider the mechanics ofapplying the trapezoidal method for the time integration of Eq� ���� The trapezoidalmethod is given by

un� un ��

�h�Fn� � Fn� � hO�h�� ��� ��

where we write hO�h�� to emphasize that the method is second order accurate� UsingEq� �� to evaluate Fn� F �un�� tn��� one �nds

un� un ��

�h

�Fn �

��F

�u

�n

�un� � un� � h

��F

�t

�n

�O�h�� � Fn

��hO�h�� ��� ��

Note that the O�h�� term within the brackets �which is due to the local linearization�is multiplied by h and therefore is the same order as the hO�h�� error from theTrapezoidal Method� The use of local time linearization updated at the end of eachtime step� and the trapezoidal time march� combine to make a second�order�accuratenumerical integration process� There are� of course� other secondorder implicit timemarching methods that can be used� The important point to be made here is thatlocal linearization updated at each time step has not reduced the order of accuracy ofa secondorder timemarching process�A very useful reordering of the terms in Eq� �� � results in the expression

��� �

�h

��F

�u

�n

��un hFn �

�h���F

�t

�n

��� ��

which is now in the delta form which will be formally introduced in Section ����� Inmany �uid mechanic applications the nonlinear function F is not an explicit function

Page 123: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

of t� In such cases the partial derivative of F �u� with respect to t is zero and Eq� �� �simpli�es to the secondorder accurate expression

��� �

�h

��F

�u

�n

��un hFn ��� ��

Notice that the RHS is extremely simple� It is the product of h and the RHS ofthe basic equation evaluated at the previous time step� In this example� the basicequation was the simple scalar equation ���� but for our applications� it is generallythe spacedi�erenced form of the steadystate equation of some �uid �ow problem�A numerical timemarching procedure using Eq� �� � is usually implemented as

follows�

�� Solve for the elements of h�Fn� store them in an array say �R� and save �un�

�� Solve for the elements of the matrix multiplying ��un and store in some appropriate manner making use of sparseness or bandedness of the matrix if possible�Let this storage area be referred to as B�

�� Solve the coupled set of linear equations

B��un �R

for ��un� �Very seldom does one �nd B�� in carrying out this step��

�� Find �un� by adding ��un to �un� thus

�un� ��un � �un

The solution for �un� is generally stored such that it overwrites the value of �unand the process is repeated�

Implementation of the Implicit Euler Method

We have seen that the �rstorder implicit Euler method can be written

un� un � hFn� ��� ��

if we introduce Eq� �� � into this method� rearrange terms� and remove the explicitdependence on time� we arrive at the form�

�� h

��F

�u

�n

��un hFn ��� ��

Page 124: Hydrodynamics - CFD

����� IMPLEMENTATION OF IMPLICIT METHODS ���

We see that the only di�erence between the implementation of the trapezoidal method

and the implicit Euler method is the factor of �� in the brackets of the left side ofEqs� �� � and �� �� Omission of this factor degrades the method in time accuracy byone order of h� We shall see later that this method is an excellent choice for steadyproblems�

Newtons Method

Consider the limit h � � of Eq� �� � obtained by dividing both sides by h andsetting ��h �� There results

���F

�u

�n

�un Fn ��� ��

or

un� un ���

�F

�u

�n

���Fn ��� �

This is the wellknown Newton method for �nding the roots of a nonlinear equationF �u� �� The fact that it has quadratic convergence is veri�ed by a glance at Eqs���� and �� �remember the dependence on t has been eliminated for this case�� Byquadratic convergence� we mean that the error after a given iteration is proportionalto the square of the error at the previous iteration� where the error is the di�erencebetween the current solution and the converged solution� Quadratic convergence isthus a very powerful property� Use of a �nite value of h in Eq� �� � leads to linearconvergence� i�e�� the error at a given iteration is some multiple of the error at theprevious iteration� The reader should ponder the meaning of letting h � � for thetrapezoidal method� given by Eq� �� ��

������ Local Linearization for Coupled Sets of Nonlinear Equa�

tions

In order to present this concept� let us consider an example involving some simple boundarylayer equations� We choose the FalknerSkan equations from classicalboundarylayer theory� Our task is to apply the implicit trapezoidal method to theequations

d�f

dt�� f

d�f

dt�� �

���� �dfdt

���A � ��� �

Here f represents a dimensionless stream function� and � is a scaling factor�

Page 125: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

First of all we reduce Eq� �� to a set of �rstorder nonlinear equations by thetransformations

u� d�f

dt�� u�

df

dt� u� f �������

This gives the coupled set of three nonlinear equations

u�� F� �u� u� � ���� u��

�u�� F� u�

u�� F� u� �������

and these can be represented in vector notation as

d�u

dt �F ��u� �������

Now we seek to make the same local expansion that derived Eq� �� �� except thatthis time we are faced with a nonlinear vector function� rather than a simple nonlinearscalar function� The required extension requires the evaluation of a matrix� calledthe Jacobian matrix�� Let us refer to this matrix as A� It is derived from Eq� �����by the following process

A �aij� �Fi ��uj �������

For the general case involving a third order matrix this is

A

�����������

�F��u�

�F��u�

�F��u�

�F��u�

�F��u�

�F��u�

�F��u�

�F��u�

�F��u�

��������

The expansion of �F ��u� about some reference state �un can be expressed in a waysimilar to the scalar expansion given by eq ���� Omitting the explicit dependency

on the independent variable t� and de�ning �F n as�F ��un�� one has

Recall that we derived the Jacobian matrices for the two�dimensional Euler equations in Section���

�The Taylor series expansion of a vector contains a vector for the �rst term� a matrix times avector for the second term� and tensor products for the terms of higher order�

Page 126: Hydrodynamics - CFD

����� PROBLEMS ���

�F ��u� �F n � An

��u� �un

��O�h�� �������

where t� tn and the argument for O�h�� is the same as in the derivation of Eq� ���

Using this we can write the local linearization of Eq� ����� as

d�u

dt An

�u���F n � An

�un

�� �z �constant�

�O�h�� �������

which is a locallylinear� secondorderaccurate approximation to a set of couplednonlinear ordinary di�erential equations that is valid for t � tn � h� Any �rst orsecondorder timemarching method� explicit or implicit� could be used to integratethe equations without loss in accuracy with respect to order� The number of times�and the manner in which� the terms in the Jacobian matrix are updated as the solutionproceeds depends� of course� on the nature of the problem�Returning to our simple boundarylayer example� which is given by Eq� ������ we

�nd the Jacobian matrix to be

A

��� � u� ��u� �u�� � �� � �

� �������

The student should be able to derive results for this example that are equivalent tothose given for the scalar case in Eq� �� �� Thus for the FalknerSkan equations thetrapezoidal method results in������ � h

��u��n ��h�u��n h� �u��n

� h� � �

� �h� �

���� ��u��n��u��n��u��n

� h��� � �u�u��n � ���� u���n

�u��n�u��n

�We �nd �un� from ��un��un� and the solution is now advanced one step� Reevaluatethe elements using �un� and continue� Without any iterating within a step advance�the solution will be secondorderaccurate in time�

��� Problems

�� Find an expression for the nth term in the Fibonacci series� which is givenby �� �� �� �� �� � � � � Note that the series can be expressed as the solution to adi�erence equation of the form un� un � un��� What is u��� �Let the �rstterm given above be u���

Page 127: Hydrodynamics - CFD

�� CHAPTER �� TIME�MARCHING METHODS FOR ODES

�� The trapezoidal method un� un ���h�u�n� � u�n� is used to solve the repre

sentative ODE�

�a� What is the resulting O�E�

�b� What is its exact solution�

�c� How does the exact steadystate solution of the O�E compare with theexact steadystate solution of the ODE if ��

�� The �ndorder backward method is given by

un� �

h�un � un�� � �hu

�n�

i�a� Write the O�E for the representative equation� Identify the polynomials

P �E� and Q�E��

�b� Derive the �� relation� Solve for the �roots and identify them as principalor spurious�

�c� Find er� and the �rst two nonvanishing terms in a Taylor series expansionof the spurious root�

�d� Perform a �root trace relative to the unit circle for both di�usion andconvection�

�� Consider the timemarching scheme given by

un� un�� ��h

��u�n� � u�n � u�n���

�a� Write the O�E for the representative equation� Identify the polynomialsP �E� and Q�E��

�b� Derive the �� � relation�

�c� Find er��

�� Find the di�erence equation which results from applying the Gazdag predictorcorrector method �Eq� ����� to the representative equation� Find the �� relation�

�� Consider the following timemarching method�

%un�� un � hu�n��

&un�� un � h%u�n����

un� un � h&u�n��

Page 128: Hydrodynamics - CFD

����� PROBLEMS ��

Find the di�erence equation which results from applying this method to therepresentative equation� Find the �� relation� Find the solution to the di�erence equation� including the homogeneous and particular solutions� Find er�and er�� What order is the homogeneous solution� What order is the particularsolution� Find the particular solution if the forcing term is �xed�

�� Write a computer program to solve the onedimensional linear convection equation with periodic boundary conditions and a � on the domain � � x � ��Use �ndorder centered di�erences in space and a grid of �� points� For theinitial condition� use

u�x� �� e������x����� ��

with � ���� Use the explicit Euler� �ndorder AdamsBashforth �AB��� implicit Euler� trapezoidal� and �thorder RungeKutta methods� For the explicitEuler and AB� methods� use a Courant number� ah��x� of ���! for the othermethods� use a Courant number of unity� Plot the solutions obtained at t �compared to the exact solution �which is identical to the initial condition��

� Repeat problem � using �thorder �noncompact� di�erences in space� Use only�thorder RungeKutta time marching at a Courant number of unity� Showsolutions at t � and t �� compared to the exact solution�

� Using the computer program written for problem �� compute the solution att � using �ndorder centered di�erences in space coupled with the �thorderRungeKutta method for grids of ���� ���� and ��� nodes� On a loglog scale�plot the error given by vuuut MX

j��

�uj � uexactj ��

M

where M is the number of grid nodes and uexact is the exact solution� Find theglobal order of accuracy from the plot�

��� Using the computer program written for problem � repeat problem using�thorder �noncompact� di�erences in space�

��� Write a computer program to solve the onedimensional linear convection equation with in�owout�ow boundary conditions and a � on the domain � �x � �� Let u��� t� sin�t with � ���� Run until a periodic steady stateis reached which is independent of the initial condition and plot your solution

Page 129: Hydrodynamics - CFD

��� CHAPTER �� TIME�MARCHING METHODS FOR ODES

compared with the exact solution� Use �ndorder centered di�erences in spacewith a �storder backward di�erence at the out�ow boundary �as in Eq� ��� �together with �thorder RungeKutta time marching� Use grids with ���� ����and ��� nodes and plot the error vs� the number of grid nodes� as described inproblem � Find the global order of accuracy�

��� Repeat problem �� using �thorder �noncompact� centered di�erences� Use athirdorder forwardbiased operator at the in�ow boundary �as in Eq� ������ Atthe last grid node� derive and use a �rdorder backward operator �using nodesj��� j��� j��� and j� and at the second last node� use a �rdorder backwardbiased operator �using nodes j��� j��� j� and j��! see problem � in Chapter���

��� Using the approach described in Section ������ �nd the phase speed error� erp�and the amplitude error� era� for the combination of secondorder centered differences and �st� �nd� �rd� and �thorder RungeKutta timemarching at aCourant number of unity� Also plot the phase speed error obtained using exactintegration in time� i�e�� that obtained using the spatial discretization alone�Note that the required �roots for the various RungeKutta methods can bededuced from Eq� ��� � without actually deriving the methods� Explain yourresults�

Page 130: Hydrodynamics - CFD

Chapter

STABILITY OF LINEAR

SYSTEMS

A general de�nition of stability is neither simple nor universal and depends on theparticular phenomenon being considered� In the case of the nonlinear ODE�s ofinterest in �uid dynamics� stability is often discussed in terms of �xed points andattractors� In these terms a system is said to be stable in a certain domain if� fromwithin that domain� some norm of its solution is always attracted to the same �xedpoint� These are important and interesting concepts� but we do not dwell on them inthis work� Our basic concern is with timedependent ODE�s and O�E �s in which thecoe�cient matrices are independent of both u and t! see Section ���� We will referto such matrices as stationary� Chapters � and � developed the representative formsof ODE�s generated from the basic PDE�s by the semidiscrete approach� and thenthe O�E�s generated from the representative ODE�s by application of timemarchingmethods� These equations are represented by

d�u

dt A�u� �f�t� �����

and

�un� C�un � �gn �����

respectively� For a onestep method� the latter form is obtained by applying a timemarching method to the generic ODE form in a fairly straightforward manner� Forexample� the explicit Euler method leads to C I � hA� and �gn �f�nh�� Methodsinvolving two or more steps can always be written in the form of Eq� ��� by introducingnew dependent variables� Note also that only methods in which the time and spacediscretizations are treated separately can be written in an intermediate semidiscreteform such as Eq� ���� The fullydiscrete form� Eq� ��� and the associated stabilityde�nitions and analysis are applicable to all methods�

���

Page 131: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

�� Dependence on the Eigensystem

Our de�nitions of stability are based entirely on the behavior of the homogeneousparts of Eqs� ��� and ���� The stability of Eq� ��� depends entirely on the eigensystem� of A� The stability of Eq� ��� can often also be related to the eigensystem ofits matrix� However� in this case the situation is not quite so simple since� in ourapplications to partial di�erential equations �especially hyperbolic ones�� a stabilityde�nition can depend on both the time and space di�erencing� This is discussed inSection ���� Analysis of these eigensystems has the important added advantage thatit gives an estimate of the rate at which a solution approaches a steadystate if asystem is stable� Consideration will be given to matrices that have both completeand defective eigensystems� see Section ������ with a reminder that a complete systemcan be arbitrarily close to a defective one� in which case practical applications canmake the properties of the latter appear to dominate�

If A and C are stationary� we can� in theory at least� estimate their fundamentalproperties� For example� in Section ������ we found from our model ODE�s for diffusion and periodic convection what could be expected for the eigenvalue spectrumsof practical physical problems containing these phenomena� These expectations arereferred to many times in the following analysis of stability properties� They areimportant enough to be summarized by the following�

� For di�usion dominated �ows the �eigenvalues tend to lie along the negativereal axis�

� For periodic convectiondominated �ows the �eigenvalues tend to lie along theimaginary axis�

In many interesting cases� the eigenvalues of the matrices in Eqs� ��� and ���are su�cient to determine the stability� In previous chapters� we designated theseeigenvalues as �m and �m for Eqs� ��� and ���� respectively� and we will �nd itconvenient to examine the stability of various methods in both the complex � andcomplex � planes�

�This is not the case if the coe�cient matrix depends on t even if it is linear�

Page 132: Hydrodynamics - CFD

��� INHERENT STABILITY OF ODES ���

�� Inherent Stability of ODE�s

���� The Criterion

Here we state the standard stability criterion used for ordinary di�erential equations�

For a stationary matrix A� Eq� ��� is inherently stable if� when �f isconstant� �u remains bounded as t���

�����

Note that inherent stability depends only on the transient solution of the ODE�s�

���� Complete Eigensystems

If a matrix has a complete eigensystem� all of its eigenvectors are linearly independent�and the matrix can be diagonalized by a similarity transformation� In such a case itfollows at once from Eq� ����� for example� that the ODE�s are inherently stable ifand only if

���m� � � for all m �����

This states that� for inherent stability� all of the � eigenvalues must lie on� or to theleft of� the imaginary axis in the complex � plane� This criterion is satis�ed for themodel ODE�s representing both di�usion and biconvection� It should be emphasized�as it is an important practical consideration in convectiondominated systems� thatthe special case for which � i is included in the domain of stability� In this caseit is true that �u does not decay as t � �� but neither does it grow� so the abovecondition is met� Finally we note that for ODE�s with complete eigensystems theeigenvectors play no role in the inherent stability criterion�

���� Defective Eigensystems

In order to understand the stability of ODE�s that have defective eigensystems� weinspect the nature of their solutions in eigenspace� For this we draw on the results inSections ����� and especially on Eqs� ��� to ��� in that section� In an eigenspacerelated to defective systems the form of the representative equation changes from asingle equation to a Jordan block� For example� instead of Eq� ���� a typical form ofthe homogeneous part might be��� u

��

u��u��

� ����� �

� �

���� u�u�u�

Page 133: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

for which one �nds the solution

u��t� u����e�t

u��t� �u���� � u����t�e�t

u��t� �u���� � u����t�

�u����t

��e�t �����

Inspecting this solution� we see that for such cases condition ��� must be modi�edto the form

���m� � � for all m �����

since for pure imaginary �� u� and u� would grow without bound �linearly or quadratically� if u���� � or u���� �� Theoretically this condition is su�cient for stabilityin the sense of Statement ��� since tke�j�jt � � as t�� for all nonzero �� However�in practical applications the criterion may be worthless since there may be a verylarge growth of the polynomial before the exponential �takes over� and brings aboutthe decay� Furthermore� on a computer such a growth might destroy the solutionprocess before it could be terminated�Note that the stability condition ��� excludes the imaginary axis which tends to be

occupied by the eigenvalues related to biconvection problems� However� condition ���is of little or no practical importance if signi�cant amounts of dissipation are present�

�� Numerical Stability of O�E �s

���� The Criterion

The O�E companion to Statement ��� is

For a stationary matrix C� Eq� ��� is numerically stable if� when �g isconstant� �un remains bounded as n���

�����

We see that numerical stability depends only on the transient solution of the O�E �s�This de�nition of stability is sometimes referred to as asymptotic or time stability�As we stated at the beginning of this chapter� stability de�nitions are not unique� A

de�nition often used in CFD literature stems from the development of PDE solutionsthat do not necessarily follow the semidiscrete route� In such cases it is appropriateto consider simultaneously the e�ects of both the time and space approximations� Atimespace domain is �xed and stability is de�ned in terms of what happens to somenorm of the solution within this domain as the mesh intervals go to zero at someconstant ratio� We discuss this point of view in Section ����

Page 134: Hydrodynamics - CFD

��� TIME�SPACE STABILITY AND CONVERGENCE OF O�ES ���

���� Complete Eigensystems

Consider a set of O�E �s governed by a complete eigensystem� The stability criterion�according to the condition set in Eq� ���� follows at once from a study of Eq� ���and its companion for multiple �roots� Eq� ����� Clearly� for such systems a timemarching method is numerically stable if and only if

j��m�kj � � for all m and k ����

This condition states that� for numerical stability� all of the � eigenvalues �bothprincipal and spurious� if there are any� must lie on or inside the unit circle in thecomplex �plane�This de�nition of stability for O�E �s is consistent with the stability de�nition for

ODE�s� Again the sensitive case occurs for the periodicconvection model which placesthe �correct� location of the principal ��root precisely on the unit circle where thesolution is only neutrally stable� Further� for a complete eigensystem� the eigenvectorsplay no role in the numerical stability assessment�

���� Defective Eigensystems

The discussion for these systems parallels the discussion for defective ODE�s� ExamineEq� ��� and note its similarity with Eq� ���� We see that for defective O�E�s therequired modi�cation to �� is

j��m�kj � � for all m and k ��� �

since defective systems do not guarantee boundedness for j�j �� for example in Eq���� if j�j � and either u���� or u���� � we get linear or quadratic growth�

�� Time�Space Stability and Convergence of O�E�s

Let us now examine the concept of stability in a di�erent way� In the previousdiscussion we considered in some detail the following approach�

�� The PDE�s are converted to ODE�s by approximating the space derivatives ona �nite mesh�

�� Inherent stability of the ODE�s is established by guaranteeing that ���� � ���� Timemarch methods are developed which guarantee that j���h�j � � and thisis taken to be the condition for numerical stability�

Page 135: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

This does guarantee that a stationary system� generated from a PDE on some �xedspace mesh� will have a numerical solution that is bounded as t nh � �� Thisdoes not guarantee that desirable solutions are generated in the time march processas both the time and space mesh intervals approach zero�Now let us de�ne stability in the timespace sense� First construct a �nite time

space domain lying within � � x � L and � � t � T � Cover this domain with a gridthat is equispaced in both time and space and �x the mesh ratio by the equation�

cn �t

�x

Next reduce our O�E approximation of the PDE to a twolevel �i�e�� two timeplanes�formula in the form of Eq� ���� The homogeneous part of this formula is

�un� C�un ������

Eq� ���� is said to be stable if any bounded initial vector� �u�� produces a boundedsolution vector� �un� as the mesh shrinks to zero for a �xed cn� This is the classicalde�nition of stability� It is often referred to as Lax or LaxRichtmyer stability� Clearlyas the mesh intervals go to zero� the number of time steps� N � must go to in�nity inorder to cover the entire �xed domain� so the criterion in ��� is a necessary conditionfor this stability criterion�The signi�cance of this de�nition of stability arises through Lax�s Theorem� which

states that� if a numerical method is stable �in the sense of Lax� and consistent thenit is convergent� A method is consistent if it produces no error �in the Taylor seriessense� in the limit as the mesh spacing and the time step go to zero �with cn �xed� inthe hyperbolic case�� This is further discussed in Section ��� A method is convergentif it converges to the exact solution as the mesh spacing and time step go to zero inthis manner�� Clearly� this is an important property�Applying simple recursion to Eq� ����� we �nd

�un Cn�u�

and using vector and matrix pnorms �see Appendix A� and their inequality relations�we have

jj�unjj jjCn�u�jj � jjCnjj � jj�u�jj � jjCjjn � jj�u�jj ������

�This ratio is appropriate for hyperbolic problems a di�erent ratio may be needed for parabolicproblems such as the model di�usion equation�

�In the CFD literature� the word converge is used with two entirely di�erent meanings� Here werefer to a numerical solution converging to the exact solution of the PDE� Later we will refer to thenumerical solution converging to a steady state solution�

Page 136: Hydrodynamics - CFD

��� TIME�SPACE STABILITY AND CONVERGENCE OF O�ES ���

Since the initial data vector is bounded� the solution vector is bounded if

jjCjj � � ������

where jjCjj represents any pnorm of C� This is often used as a su�cient conditionfor stability�

Now we need to relate the stability de�nitions given in Eqs� �� and �� with thatgiven in Eq� ����� In Eqs� �� and �� � stability is related to the spectral radius ofC� i�e�� its eigenvalue of maximum magnitude� In Eq� ����� stability is related to apnorm of C� It is clear that the criteria are the same when the spectral radius is atrue p�norm

Two facts about the relation between spectral radii and matrix norms are wellknown�

�� The spectral radius of a matrix is its L� norm when the matrix is normal� i�e��it commutes with its transpose�

�� The spectral radius is the lower bound of all norms�

Furthermore� when C is normal� the second inequality in Eq� ���� becomes an equality� In this case� Eq� ���� becomes both necessary and su�cient for stability� Fromthese relations we draw two important conclusions about the numerical stability ofmethods used to solve PDE�s�

� The stability criteria in Eqs� �� and ���� are identical for stationary systemswhen the governing matrix is normal� This includes symmetric� asymmetric�and circulant matrices� These criteria are both necessary and su�cient formethods that generate such matrices and depend solely upon the eigenvalues ofthe matrices�

� If the spectral radius of any governing matrix is greater than one� the methodis unstable by any criterion� Thus for general matrices� the spectral radiuscondition is necessary� but not su�cient for stability�

�Actually the necessary condition is that the spectral radius of C be less than or equal to �O��t�� but this distinction is not critical for our purposes here�

Page 137: Hydrodynamics - CFD

�� CHAPTER � STABILITY OF LINEAR SYSTEMS

�� Numerical Stability Concepts in the Complex

��Plane

��� ��Root Traces Relative to the Unit Circle

Whether or not the semidiscrete approach was taken to �nd the di�erencing approximation of a set of PDE�s� the �nal di�erence equations can be represented by

�un� C�un � �gn

Furthermore if C has a complete� eigensystem� the solution to the homogeneous partcan always be expressed as

�un c��n� �x� � � � �� cm�

nm�xm � � � �� cM�

nM�xM

where the �m are the eigenvalues of C� If the semidiscrete approach is used� we can�nd a relation between the � and the � eigenvalues� This serves as a very convenientguide as to where we might expect the �roots to lie relative to the unit circle in thecomplex �plane� For this reason we will proceed to trace the locus of the �rootsas a function of the parameter �h for the equations modeling di�usion and periodicconvection��

Locus of the exact trace

Figure ��� shows the exact trace of the �root if it is generated by e�h representingeither di�usion or biconvection� In both cases the � represents the starting valuewhere h � and � �� For the di�usion model� �h is real and negative� As themagnitude of �h increases� the trace representing the dissipation model heads towardsthe origin as �h � ��� On the other hand� for the biconvection model� �h i�his always imaginary� As the magnitude of �h increases� the trace representing thebiconvection model travels around the circumference of the unit circle� which it neverleaves� We must be careful in interpreting � when it is representing ei�h� The factthat it lies on the unit circle means only that the amplitude of the representation iscorrect� it tells us nothing of the phase error �see Eq� ������ The phase error relatesto the position on the unit circle�

�The subject of defective eigensystems has been addressed� From now on we will omit furtherdiscussion of this special case�

�Or� if you like� the parameter h for �xed values of � equal to � and i for the di�usion andbiconvection cases� respectively�

Page 138: Hydrodynamics - CFD

��� NUMERICAL STABILITY CONCEPTS IN THE COMPLEX ��PLANE ��

Examples of some methods

Now let us compare the exact �root traces with some that are produced by actualtimemarching methods� Table ��� shows the �� relations for a variety of methods�Figures ��� and ��� illustrate the results produced by various methods when they areapplied to the model ODE�s for di�usion and periodicconvection� Eqs� ��� and ����It is implied that the behavior shown is typical of what will happen if the methodsare applied to di�usion �or dissipation� dominated or periodic convectiondominatedproblems as well as what does happen in the model cases� Most of the importantpossibilities are covered by the illustrations�

� � � �� �h � Explicit Euler� �� � ��h� � � � Leapfrog

� �� � �� � ���h�� � ���h � AB�

� �� � �� � �����h��� � �����h� � ����h � AB�

� ���� �h�� � � Implicit Euler

� ���� ���h�� �� � ���h� � Trapezoidal

� ����� ���h�� ��� � �� � �nd O Backward

����� ����h�� �� �

���h�� �����h � AM�

�� � �� � �����h � ������h��� � ����h�� �

���h� � ABM�

�� �� � �� � ��h��� � ���h� � ���h � Gazdag

�� � � �� �h � ����h� � RK�

�� � � �� �h � ����h� � ����h� � ����

�h� � RK�

�� ����� ���h�� ���h� � �� � ���h� � Milne �th

Table ���� Some �� � Relations

a� Explicit Euler Method

Figure ��� shows results for the explicit Euler method� When used for dissipationdominated cases it is stable for the range �� �h ��� �Usually the magnitude of � hasto be estimated and often it is found by trial and error�� When used for biconvectionthe � trace falls outside the unit circle for all �nite h� and the method has no rangeof stability in this case�

Page 139: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

h= οο

- oo,σ = e σ = ei h

oo,

a) Dissipation b) Convection

λ

ωhωhλ hλ

Ι(σ) Ι(σ)

(σ) (σ)RR

h= 0λ h= 0ω

Figure ���� Exact traces of �roots for model equations�

b� Leapfrog Method

This is a tworoot method� since there are two ��s produced by every �� Whenapplied to dissipation dominated problems we see from Fig� ��� that the principalroot is stable for a range of �h� but the spurious root is not� In fact� the spuriousroot starts on the unit circle and falls outside of it for all ���h� � �� However� forbiconvection cases� when � is pure imaginary� the method is not only stable� but italso produces a � that falls precisely on the unit circle in the range � � �h � ��As was pointed out above� this does not mean� that the method is without error�Although the �gure shows that there is a range of �h in which the leapfrog methodproduces no error in amplitude� it says nothing about the error in phase� More is saidabout this in Chapter �

c� Second�Order Adams�Bashforth Method

This is also a tworoot method but� unlike the leapfrog scheme� the spurious rootstarts at the origin� rather than on the unit circle� see Fig� ���� Therefore� there isa range of real negative �h for which the method will be stable� The �gure showsthat the range ends when �h � ���� since at that point the spurious root leaves thecircle and j��j becomes greater than one� The situation is quite di�erent when the

Page 140: Hydrodynamics - CFD

��� NUMERICAL STABILITY CONCEPTS IN THE COMPLEX ��PLANE ���

σ1

σ1

λ h=-2

σ1

σ1

σ2

σ2

λ h=-1

σ1σ2

σ2 σ1

a) Euler Explicit

b) Leapfrog

c) AB2

h = 1ω

ConvectionDiffusion

Figure ���� Traces of �roots for various methods�

�root is pure imaginary� In that case as �h increases away from zero the spuriousroot remains inside the circle and remains stable for a range of �h� However� theprincipal root falls outside the unit circle for all �h � �� and for the biconvectionmodel equation the method is unstable for all h�

d� Trapezoidal Method

The trapezoidal method is a very popular one for reasons that are partially illustratedin Fig� ���� Its �roots fall on or inside the unit circle for both the dissipating andthe periodic convecting case and� in fact� it is stable for all values of �h for which� itself is inherently stable� Just like the leapfrog method it has the capability of

Page 141: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

producing only phase error for the periodic convecting case� but there is a majordi�erence between the two since the trapezoidal method produces no amplitude errorfor any �h � not just a limited range between � � �h � ��

e� Gazdag Method

The Gazdag method was designed to produce low phase error� Since its characteristicpolynomial for � is a cubic �Table ���� no� ���� it must have two spurious roots inaddition to the principal one� These are shown in Fig� ���� In both the dissipationand biconvection cases� a spurious root limits the stability� For the dissipating case�

a spurious root leaves the unit circle when �h � ���� and for the biconvecting case�when �h � �

�� Note that both spurious roots are located at the origin when � ��

f�g� Second� and Fourth�Order Runge�Kutta Methods� RK� and RK�

Traces of the �roots for the second and fourthorder RungeKutta methods areshown in Fig� ���� The �gures show that both methods are stable for a range of�h when �h is real and negative� but that the range of stability for RK� is greater�going almost all the way to ��� whereas RK� is limited to �� On the other hand forbiconvection RK� is unstable for all �h� whereas RK� remains inside the unit circlefor � � �h � �p�� One can show that the RK� stability limit is about j�hj � �� forall complex �h for which ���� � ��

��� Stability for Small �t

It is interesting to pursue the question of stability when the time step size� h� is smallso that accuracy of all the �roots is of importance� Situations for which this is notthe case are considered in Chapter �

Mild instability

All conventional timemarching methods produce a principal root that is very closeto e�h for small values of �h� Therefore� on the basis of the principal root� thestability of a method that is required to resolve a transient solution over a relativelyshort time span may be a moot issue� Such cases are typi�ed by the AB� and RK�methods when they are applied to a biconvection problem� Figs� ���c and ���f showthat for both methods the principal root falls outside the unit circle and is unstablefor all �h� However� if the transient solution of interest can be resolved in a limitednumber of time steps that are small in the sense of the �gure� the error caused by thisinstability may be relatively unimportant� If the root had fallen inside the circle the

Page 142: Hydrodynamics - CFD

��� NUMERICAL STABILITY CONCEPTS IN THE COMPLEX ��PLANE ���

σ1σ1

σ1

σ1

σ2

σ3

σ1σ1

σ1

σ1

σ2

σ3

d) Trapezoidal

e) Gazdag

f) RK2

g) RK4

λ h=- οο h = 2/3ω

λ h=-2

λ h=-2.8 h = 2 2ω

Diffusion Convection

Figure ���� Traces of �roots for various methods �cont�d��

Page 143: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

method would have been declared stable but an error of the same magnitude wouldhave been committed� just in the opposite direction� For this reason the AB� and theRK� methods have both been used in serious quantitative studies involving periodicconvection� This kind of instability is referred to as mild instability and is not aserious problem under the circumstances discussed�

Catastrophic instability

There is a much more serious stability problem for small h that can be brought aboutby the existence of certain types of spurious roots� One of the best illustrations of thiskind of problem stems from a critical study of the most accurate� explicit� twostep�linear multistep method �see Table �����

un� ��un � �un�� � �h��u�n � u�n��

�������

One can show� using the methods given in Section ���� that this method is thirdorder accurate both in terms of er� and er�� so from an accuracy point of view it isattractive� However� let us inspect its stability even for very small values of �h� Thiscan easily be accomplished by studying its characteristic polynomial when �h � ��From Eq� ���� it follows that for �h �� P �E� E� � �E � �� Factoring P ��� �we �nd P ��� �� � ���� � �� �� There are two �roots! ��� the principal one�equal to �� and ��� a spurious one� equal to �$$In order to evaluate the consequences of this result� one must understand how

methods with spurious roots work in practice� We know that they are not self starting� and the special procedures chosen to start them initialize the coe�cients of thespurious roots� the cmk for k � � in Eq� ����� If the starting process is well designedthese coe�cients are forced to be very small� and if the method is stable� they getsmaller with increasing n� However� if the magnitude of one of the spurious � isequal to �� one can see disaster is imminent because ����� � ���� Even a very smallinitial value of cmk is quickly overwhelmed� Such methods are called catastrophicallyunstable and are worthless for most� if not all� computations�

Milne and Adams type methods

If we inspect the �root traces of the multiple root methods in Figs� ��� and ���� we�nd them to be of two types� One type is typi�ed by the leapfrog method� In thiscase a spurious root falls on the unit circle when h� �� The other type is exempli�edby the �ndorder AdamsBashforth and Gazdag methods� In this case all spuriousroots fall on the origin when h� ��The former type is referred to as a Milne Method� Since at least one spurious root

for a Milne method always starts on the unit circle� the method is likely to become

Page 144: Hydrodynamics - CFD

��� NUMERICAL STABILITY CONCEPTS IN THE COMPLEX �H PLANE���

unstable for some complex � as h proceeds away from zero� On the basis of a Taylorseries expansion� however� these methods are generally the most accurate insofar asthey minimize the coe�cient in the leading term for ert�The latter type is referred to as an Adams Method� Since for these methods

all spurious methods start at the origin for h �� they have a guaranteed range ofstability for small enough h� However� on the basis of the magnitude of the coe�cientin the leading Taylor series error term� they su�er� relatively speaking� from accuracy�For a given amount of computational work� the order of accuracy of the two

types is generally equivalent� and stability requirements in CFD applications generallyoverride the �usually small� increase in accuracy provided by a coe�cient with lowermagnitude�

� Numerical Stability Concepts in the Complex

�h Plane

���� Stability for Large h�

The reason to study stability for small values of h is fairly easy to comprehend�Presumably we are seeking to resolve some transient and� since the accuracy of thetransient solution for all of our methods depends on the smallness of the timestep�we seek to make the size of this step as small as possible� On the other hand� thecost of the computation generally depends on the number of steps taken to computea solution� and to minimize this we wish to make the step size as large as possible�In the compromise� stability can play a part� Aside from ruling out catastrophicallyunstable methods� however� the situation in which all of the transient terms areresolved constitutes a rather minor role in stability considerations�By far the most important aspect of numerical stability occurs under conditions

when�

� One has inherently stable� coupled systems with ��eigenvalues having widelyseparated magnitudes�

or

� We seek only to �nd a steadystate solution using a path that includes theunwanted transient�

In both of these cases there exist in the eigensystems relatively large values ofj�hj associated with eigenvectors that we wish to drive through the solution processwithout any regard for their individual accuracy in eigenspace� This situation is

Page 145: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

the major motivation for the study of numerical stability� It leads to the subject ofsti�ness discussed in the next chapter�

���� Unconditional Stability� A�Stable Methods

Inherent stability of a set of ODE�s was de�ned in Section ��� and� for coupled setswith a complete eigensystem� it amounted to the requirement that the real parts of all� eigenvalues must lie on� or to the left of� the imaginary axis in the complex � plane�This serves as an excellent reference frame to discuss and de�ne the general stabilityfeatures of timemarching methods� For example� we start with the de�nition�

A numerical method is unconditionally stable if it is stable for all ODE�sthat are inherently stable�

A method with this property is said to be A�stable� A method is Ao�stable if theregion of stability contains the negative real axis in the complex �h plane� and I�stableif it contains the entire imaginary axis� By applying a fairly simple test for Astabilityin terms of positive real functions to the class of twostep LMM�s given in Section������ one �nds these methods to be Astable if and only if

� ���

�������

� ���

������

� � � � �� ��

������

A set of Astable implicit methods is shown in Table ����

� � � Method Order

� � � Implicit Euler ���� � � Trapezoidal �� ��� � �nd O Backward ���� � ���� Adams type ���� ���� ���� Lees ���� ���� ���� Twostep trapezoidal ��� ���� ��� Acontractive �

Table ���� Some unconditionally stable �Astable� implicit methods�

Notice that none of these methods has an accuracy higher than secondorder� It canbe proved that the order of an Astable LMM cannot exceed two� and� furthermore

Page 146: Hydrodynamics - CFD

��� NUMERICAL STABILITY CONCEPTS IN THE COMPLEX �H PLANE���

that of all �ndorder Astable methods� the trapezoidal method has the smallesttruncation error�Returning to the stability test using positive real functions one can show that a

twostep LMM is Aostable if and only if

� ���

�������

� ���

�����

� � � � � ���� �

For �rstorder accuracy� the inequalities ���� to ��� are less stringent than ���� to����� For secondorder accuracy� however� the parameters ��� �� �� are related by thecondition

� � � � ��

and the two sets of inequalities reduce to the same set which is

� � �� � � ������

� ���

������

Hence� twostep� secondorder accurate LMM�s that are Astable and Aostable sharethe same ��� �� �� parameter space� Although the order of accuracy of an Astablemethod cannot exceed two� Aostable LMM methods exist which have an accuracy ofarbitrarily high order�It has been shown that for a method to be Istable it must also be Astable�

Therefore� no further discussion is necessary for the special case of Istability�It is not di�cult to prove that methods having a characteristic polynomial for

which the coe�cient of the highest order term in E is unity� can never be unconditionally stable� This includes all explicit methods and predictorcorrector methodsmade up of explicit sequences� Such methods are referred to� therefore� as condition�ally stable methods�

���� Stability Contours in the Complex �h Plane�

A very convenient way to present the stability properties of a timemarching methodis to plot the locus of the complex �h for which j�j �� such that the resulting

�Or can be made equal to unity by a trivial normalization �division by a constant independent of�h�� The proof follows from the fact that the coe�cients of such a polynomial are sums of variouscombinations of products of all its roots�

Page 147: Hydrodynamics - CFD

�� CHAPTER � STABILITY OF LINEAR SYSTEMS

λ h)

λ h)

c) Euler Implicit

1

Stable

Unstable

b) Trapezoid Implicit

λ h)

λ h)

Stable Unstable

λ h)

λ h)

1

a) Euler Explicit

Stable

Unstable

θ = 0 θ = 1/2 θ = 1

I

R

I

R R

I(((

( ( (

Figure ���� Stability contours for the �method�

contour goes through the point �h �� Here j�j refers to the maximum absolutevalue of any �� principal or spurious� that is a root to the characteristic polynomial fora given �h� It follows from Section ��� that on one side of this contour the numericalmethod is stable while on the other� it is unstable� We refer to it� therefore� as astability contour�Typical stability contours for both explicit and implicit methods are illustrated in

Fig� ���� which is derived from the oneroot �method given in Section ������

Contours for explicit methods

Fig� ���a shows the stability contour for the explicit Euler method� In the followingtwo ways it is typical of all stability contours for explicit methods�

�� The contour encloses a �nite portion of the lefthalf complex �hplane�

�� The region of stability is inside the boundary� and therefore� it is conditional�

However� this method includes no part of the imaginary axis �except for the origin�and so it is unstable for the model biconvection problem� Although several explicitmethods share this de�ciency �e�g�� AB�� RK��� several others do not �e�g�� leapfrog�Gazdag� RK�� RK��� see Figs� ��� and ���� Notice in particular that the third andfourthorder RungeKutta methods� Fig� ���� include a portion of the imaginary axisout to �� i and �p�i� respectively�

Contours for unconditionally stable implicit methods

Fig� ���c shows the stability contour for the implicit Euler method� It is typical ofmany stability contours for unconditionally stable implicit methods� Notice that the

Page 148: Hydrodynamics - CFD

��� NUMERICAL STABILITY CONCEPTS IN THE COMPLEX �H PLANE��

Figure ���� Stability contours for some explicit methods�

StableRegions

RK1

RK2

RK3

RK4

1.0

2.0

3.0

-1.0-2.0-3.0

R( h)

I( h)

λ

λ

Figure ���� Stability contours for RungeKutta methods�

Page 149: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

1.0

2.0

Unstable

a) 2nd Order Backward Implicit

Stable Outside

Unstable

b) Adams Type

Stable Outside

I( h)

R( h)

I( h)

R( h)

λ

λ

λ

λ1.0

1.0

1.02.0 2.0

2.0

3.0 4.0

Figure ���� Stability contours for the � unconditionally stable implicit methods�

method is stable for the entire range of complex �h that fall outside the boundary�This means that the method is numerically stable even when the ODE�s that it isbeing used to integrate are inherently unstable� Some other implicit unconditionallystable methods with the same property are shown in Fig� ���� In all of these casesthe imaginary axis is part of the stable region�Not all unconditionally stable methods are stable in some regions where the ODE�s

they are integrating are inherently unstable� The classic example of a method thatis stable only when the generating ODE�s are themselves inherently stable is the

trapezoidal method� i�e�� the special case of the �method for which � ��� The

stability boundary for this case is shown in Fig� ���b� The boundary is the imaginaryaxis and the numerical method is stable for �h lying on or to the left of this axis�Two other methods that have this property are the twostep trapezoidal method

un� un�� � h�u�n� � u�n��

�and a method due to Lees

un� un�� ��

�h�u�n� � u�n � u�n��

�Notice that both of these methods are of the Milne type�

Contours for conditionally stable implicit methods

Just because a method is implicit does not mean that it is unconditionally stable�Two illustrations of this are shown in Fig� ��� One of these is the AdamsMoulton�rdorder method �no� � Table ����� Another is the �thorder Milne method givenby the point operator

un� un�� ��

�h�u�n� � �u

�n � u�n��

�and shown in Table ��� as no� ��� It is stable only for � i� when � � � � p

��Its stability boundary is very similar to that for the leapfrog method �see Fig� ���b��

Page 150: Hydrodynamics - CFD

�� FOURIER STABILITY ANALYSIS ���

Stable

I( h)

-1.0-2.0-3.0

1.0

2.0

3.0

λ

a) AM3

I( h)

1.0

2.0

3.0

λ

R( h)λ R( h)λ

Stableonly onImag Axis

b) Milne 4th Order

Figure ��� Stability contours for the � conditionally stable implicit methods�

� Fourier Stability Analysis

By far the most popular form of stability analysis for numerical schemes is the Fourieror von Neumann approach� This analysis is usually carried out on point operators andit does not depend on an intermediate stage of ODE�s� Strictly speaking it appliesonly to di�erence approximations of PDE�s that produce O�E�s which are linearhave no space or time varying coe�cients and have periodic boundary conditions��

In practical application it is often used as a guide for estimating the worthiness ofa method for more general problems� It serves as a fairly reliable necessary stabilitycondition� but it is by no means a su�cient one�

� �� The Basic Procedure

One takes data from a �typical� point in the �ow �eld and uses this as constantthroughout time and space according to the assumptions given above� Then oneimposes a spatial harmonic as an initial value on the mesh and asks the question�Will its amplitude grow or decay in time� The answer is determined by �nding theconditions under which

u�x� t� e�t � ei�x ������

is a solution to the di�erence equation� where is real and �x lies in the range� � �x � �� Since� for the general term�

u�n�jm e��t t� � ei��xm x� e� t � ei�m x � u�n�j

Another way of viewing this is to consider it as an initial value problem on an in�nite spacedomain�

Page 151: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

the quantity u�n�j is common to every term and can be factored out� In the remaining

expressions� we �nd the term e� t which we represent by �� thus�

� � e� t

Then� since e�t �e� t

�n �n� it is clear that

For numerical stability j�j � � ������

and the problem is to solve for the ��s produced by any given method and� as anecessary condition for stability� make sure that� in the worst possible combinationof parameters� condition ���� is satis�ed��

� �� Some Examples

The procedure can best be explained by examples� Consider as a �rst example the�nite di�erence approximation to the model di�usion equation known as Richardson�smethod of overlapping steps� This was mentioned in Section ��� and given as Eq�����

u�n��j u

�n���j � �

��t

�x�

�u�n�j� � �u�n�j � u

�n�j��

�������

Substitution of Eq� ���� into Eq� ���� gives the relation

� ��� � ���t

�x�

�ei� x � � � e�i� x

�or

�� �����t

�x���� cos �x�

�� �z

�b

� � � � ������

Thus Eq� ���� is a solution of Eq� ���� if � is a root of Eq� ����� The two roots of���� are

���� �bpb� � �

from which it is clear that one j�j is always � �� We �nd� therefore� that by theFourier stability test� Richardson�s method of overlapping steps is unstable for all �� and �t�

�If boundedness is required in a �nite time domain� the condition is often presented as jj � �O��t��

Page 152: Hydrodynamics - CFD

� � CONSISTENCY ���

As another example consider the �nitedi�erence approximation for the modelbiconvection equation

u�n��j u

�n�j � a�t

��x

�u�n�j� � u

�n�j��

�������

In this case

� �� a�t

�x� i � sin �x

from which it is clear that j�j � � for all nonzero a and � Thus we have another�nitedi�erence approximation that� by the Fourier stability test� is unstable for anychoice of the free parameters�

� �� Relation to Circulant Matrices

The underlying assumption in a Fourier stability analysis is that the C matrix� determined when the di�erencing scheme is put in the form of Eq� ���� is circulant� Suchbeing the case� the ei�x in Eq� ���� represents an eigenvector of the system� and thetwo examples just presented outline a simple procedure for �nding the eigenvalues ofthe circulant matrices formed by application of the two methods to the model problems� The choice of � for the stability parameter in the Fourier analysis� therefore�is not an accident� It is exactly the same � we have been using in all of our previousdiscussions� but arrived at from a di�erent perspective�If we examine the preceding examples from the viewpoint of circulant matrices

and the semidiscrete approach� the results present rather obvious conclusions� Thespace di�erencing in Richardson�s method produces the matrix s �Bp������ �� wheres is a positive scalar coe�cient� From Appendix B we �nd that the eigenvalues of thismatrix are real negative numbers� Clearly� the timemarching is being carried out bythe leapfrog method and� from Fig� ���� this method is unstable for all eigenvalues withnegative real parts� On the other hand� the space matrix in Eq� ���� is Bp���� �� ���and according to Appendix B� this matrix has pure imaginary eigenvalues� However�in this case the explicit Euler method is being used for the timemarch and� accordingto Fig� ���� this method is always unstable for such conditions�

� Consistency

Consider the model equation for di�usion analysis

�u

�t �

��u

�x�������

Page 153: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

Many years before computers became available �� ��� in fact�� Lewis F� Richardsonproposed a method for integrating equations of this type� We presented his methodin Eq� ��� and analyzed its stability by the Fourier method in Section ����In Richardson�s time� the concept of numerical instability was not known� How

ever� the concept is quite clear today and we now know immediately that his approachwould be unstable� As a semidiscrete method it can be expressed in matrix notationas the system of ODE�s�

d�u

dt

�x�B������ ���u� ��bc� �����

with the leapfrog method used for the time march� Our analysis in this Chapterrevealed that this is numerically unstable since the �roots of B������� are all realand negative and the spurious �root in the leapfrog method is unstable for all suchcases� see Fig� ���b�The method was used by Richardson for weather prediction� and this fact can now

be a source of some levity� In all probability� however� the hand calculations �theonly approach available at the time� were not carried far enough to exhibit strangephenomena� We could� of course� use the �ndorder RungeKutta method to integrateEq� ��� since it is stable for real negative ��s� It is� however� conditionally stableand for this case we are rather severely limited in time step size by the requirement�t � �x�������There are many ways to manipulate the numerical stability of algorithms� One of

them is to introduce mixed time and space di�erencing� a possibility we have not yetconsidered� For example� we introduced the DuFortFrankel method in Chapter ��

u�n��j u

�n���j �

���t

�x�

��u�n�j�� � ���u�n��

j � u�n���j

�A� u�n�j�

� ���� �

in which the central term in the space derivative in Eq� ��� has been replaced by itsaverage value at two di�erent time levels� Now let

� � ���t

�x�

and rearrange terms

�� � ��u�n��j ��� ��u

�n���j � �

hu�n�j�� � u

�n�j�

iThere is no obvious ODE between the basic PDE and this �nal O�E� Hence� thereis no intermediate �root structure to inspect� Instead one proceeds immediately tothe �roots�

Page 154: Hydrodynamics - CFD

� � CONSISTENCY ���

The simplest way to carry this out is by means of the Fourier stability analysisintroduced in Section ���� This leads at once to

�� � ��� ��� ����� � ��ei� x � e�i� x

�or

�� � ���� � ��� cos�k�x�� ��� �� �

The solution of the quadratic is

� � cos �x

q�� �� sin� �x

� � �

There are �M �roots all of which are � � for any real � in the range � � � � ��This means that the method is unconditionally stable$The above result seems too good to be true� since we have found an unconditionally

stable method using an explicit combination of Lagrangian interpolation polynomials�

The price we have paid for this is the loss of con�sistency with the original PDE�

To prove this� we expand the terms in Eq� ���� in a Taylor series and reconstructthe partial di�erential equation we are actually solving as the mesh size becomes verysmall� For the time derivative we have

��t

hu�n��j � u

�n���j

i ��tu�

�n�j �

��t���tttu�

�n�j � � � �

and for the mixed time and space di�erences

u�n�j�� � u

�n��j � u

�n���j � u

�n�j�

�x� ��xxu�

�n�j �

��t

�x

����ttu�

�n�j �

���x���xxxxu�

�n�j �

���t�

��t

�x

����ttttu�

�n�j � � � � ������

Replace the terms in Eq� ���� with the above expansions and take the limit as�t � �x� �� We �nd

�u

�t �

��u

�x�� �r�

��u

�t�������

where

r � �t

�x

Page 155: Hydrodynamics - CFD

��� CHAPTER � STABILITY OF LINEAR SYSTEMS

Eq� ���� is parabolic� Eq� ���� is hyperbolic� Thus if �t� � and �x� � in such

a way that �t�x remains constant� the equation we actually solve by the method inEq� ���� is a wave equation� not a di�usion equation� In such a case Eq �� is notuniformly consistent with the equation we set out to solve even for vanishingly smallstep sizes� The situation is summarized in Table ���� If �t� � and �x� � in such

a way that �t�x�

remains constant� then r� is O��t�� and the method is consistent�

However� this leads to a constraint on the time step which is just as severe as thatimposed by the stability condition of the secondorder RungeKutta method shownin the table�

�ndorder RungeKutta DuFort�FrankelFor Stability

�t � �x��� �t � �

Conditionally Stable Unconditionally StableFor Consistency

Uniformly Consistent Conditionally Consistent�

with Approximates �u�t � �

�u�x�

�u�t � �

�u�x�

only if

���t�x

��� �

Therefore�t � �x

q��

Table ���� Summary of accuracy and consistency conditions for RK� andDu FortFrankel methods� � an arbitrary error bound�

�� Problems

�� Consider the ODE

u� du

dt Au� f

with

A

��� ��� ���� ����� �� ��� � ��

� � f

��� ����

Page 156: Hydrodynamics - CFD

��� PROBLEMS ���

�a� Find the eigenvalues of A using a numerical package� What is the steadystate solution� How does the ODE solution behave in time�

�b� Write a code to integrate from the initial condition u��� ��� �� ��T fromtime t � using the explicit Euler� implicit Euler� and MacCormack methods� In all three cases� use h ��� for ���� time steps� h ��� for ���time steps� h ��� for ��� time steps and h ��� for ��� time steps�Compare the computed solution with the exact steady solution�

�c� Using the �� relations for these three methods� what are the expectedbounds on h for stability� Are your results consistent with these bounds�

�� �a� Compute a table of the numerical values of the �roots of the �ndorderAdamsBashforth method when � i� Take h in intervals of ���� from �to ��� and compute the absolute values of the roots to at least � places�

�b� Plot the trace of the roots in the complex �plane and draw the unit circleon the same plot�

�c� Repeat the above for the RK� method�

�� When applied to the linear convection equation� the widely known Lax�Wendro�method gives�

un�j unj �

�Cn�u

nj� � unj��� �

�C�n�u

nj� � �unj � unj���

where Cn� known as the Courant �or CFL� number� is ah��x� Using Fourierstability analysis� �nd the range of Cn for which the method is stable�

�� Determine and plot the stability contours for the AdamsBashforth methods oforder � through �� Compare with the RungeKutta methods of order � through��

�� Recall the compact centered �point approximation for a �rst derivative�

��xu�j�� � ���xu�j � ��xu�j� �

�x�uj� � uj���

By replacing the spatial index j by the temporal index n� obtain a timemarchingmethod using this formula� What order is the method� Is it explicit or implicit�Is it a twostep LMM� If so� to what values of �� �� and � �in Eq� ��� � does itcorrespond� Derive the �� relation for the method� Is it Astable� Aostable�or Istable�

Page 157: Hydrodynamics - CFD

�� CHAPTER � STABILITY OF LINEAR SYSTEMS

�� Write the ODE system obtained by applying the �ndorder centered di�erenceapproximation to the spatial derivative in the model di�usion equation withperiodic boundary conditions� Using Appendix B��� �nd the eigenvalues of thespatial operator matrix� Given that the �� relation for the �ndorder AdamsBashforth method is

�� � �� � ��h���� � �h�� �

show that the maximum stable value of j�hj for real negative �� i�e�� the pointwhere the stability contour intersects the negative real axis� is obtained with�h ��� Using the eigenvalues of the spatial operator matrix� �nd the maximum stable time step for the combination of �ndorder centered di�erences andthe �ndorder AdamsBashforth method applied to the model di�usion equation� Repeat using Fourier analysis�

�� Consider the following PDE�

�u

�t i

��u

�x�

where i p��� Which explicit timemarching methods would be suitable for

integrating this PDE� if �ndorder centered di�erencing is used for the spatial di�erences and the boundary conditions are periodic� Find the stabilitycondition for one of these methods�

� Using Fourier analysis� analyze the stability of �rstorder backward di�erencing coupled with explicit Euler time marching applied to the linear convectionequation with positive a� Find the maximum Courant number for stability�

� Consider the linear convection with a positive wave speed as in problem � Applya Dirichlet boundary condition at the left boundary� No boundary condition ispermitted at the right boundary� Write the system of ODE�s which results from�rstorder backward spatial di�erencing in matrixvector form� Using AppendixB��� �nd the �eigenvalues� Write the O�E which results from the applicationof explicit Euler time marching in matrixvector form� i�e��

�un� C�un � �gn

Write C in banded matrix notation and give the entries of �g� Using the �� relation for the explicit Euler method� �nd the �eigenvalues� Based onthese� what is the maximum Courant number allowed for asymptotic stability�Explain why this di�ers from the answer to problem � Hint� is C normal�

Page 158: Hydrodynamics - CFD

Chapter

CHOICE OF TIME�MARCHING

METHODS

In this chapter we discuss considerations involved in selecting a timemarching methodfor a speci�c application� Examples are given showing how timemarching methodscan be compared in a given context� An important concept underlying much of thisdiscussion is sti�ness� which is de�ned in the next section�

�� Sti�ness De�nition for ODE�s

����� Relation to ��Eigenvalues

The introduction of the concept referred to as �sti�ness� comes about from the numerical analysis of mathematical models constructed to simulate dynamic phenomena containing widely di�erent time scales� De�nitions given in the literature arenot unique� but fortunately we now have the background material to construct ade�nition which is entirely su�cient for our purposes�

We start with the assumption that our CFD problem is modeled with su�cientaccuracy by a coupled set of ODE�s producing an A matrix typi�ed by Eq� ����Any de�nition of sti�ness requires a coupled system with at least two eigenvalues�and the decision to use some numerical timemarching or iterative method to solveit� The di�erence between the dynamic scales in physical space is represented bythe di�erence in the magnitude of the eigenvalues in eigenspace� In the followingdiscussion we concentrate on the transient part of the solution� The forcing functionmay also be time varying in which case it would also have a time scale� However�we assume that this scale would be adequately resolved by the chosen timemarchingmethod� and� since this part of the ODE has no e�ect on the numerical stability of

��

Page 159: Hydrodynamics - CFD

��� CHAPTER � CHOICE OF TIME�MARCHING METHODS

StableRegion

AccurateRegion

1

I( h)

R( h)

λ

λ

λh

Figure ��� Stable and accurate regions for the explicit Euler method�

the homogeneous part� we exclude the forcing function from further discussion in thissection�

Consider now the form of the exact solution of a system of ODE�s with a complete eigensystem� This is given by Eq� ���� and its solution using a oneroot� timemarching method is represented by Eq� ���� For a given time step� the time integration is an approximation in eigenspace that is di�erent for every eigenvector �xm� Inmany numerical applications the eigenvectors associated with the small j�mj are wellresolved and those associated with the large j�mj are resolved much less accurately�if at all� The situation is represented in the complex �h plane in Fig� ��� In this�gure the time step has been chosen so that time accuracy is given to the eigenvectorsassociated with the eigenvalues lying in the small circle and stability without timeaccuracy is given to those associated with the eigenvalues lying outside of the smallcircle but still inside the large circle�

The whole concept of sti�ness in CFD arises from the fact that we often donot need the time resolution of eigenvectors associated with the large j�mj inthe transient solution� although these eigenvectors must remain coupled intothe system to maintain a high accuracy of the spatial resolution�

Page 160: Hydrodynamics - CFD

��� STIFFNESS DEFINITION FOR ODES ���

����� Driving and Parasitic Eigenvalues

For the above reason it is convenient to subdivide the transient solution into twoparts� First we order the eigenvalues by their magnitudes� thus

j��j � j��j � � � � � j�M j ����

Then we write

TransientSolution

pX

m��

cme�mt �xm� �z

Driving

�MX

m�p�

cme�mt �xm� �z

Parasitic

����

This concept is crucial to our discussion� Rephrased� it states that we can separateour eigenvalue spectrum into two groups! one ��� � �p� called the driving eigenvalues�our choice of a timestep and marching method must accurately approximate the timevariation of the eigenvectors associated with these�� and the other� ��p� � �M �� calledthe parasitic eigenvalues �no time accuracy whatsoever is required for the eigenvectorsassociated with these� but their presence must not contaminate the accuracy of thecomplete solution�� Unfortunately� we �nd that� although time accuracy requirementsare dictated by the driving eigenvalues� numerical stability requirements are dictatedby the parasitic ones�

����� Sti�ness Classi�cations

The following de�nitions are somewhat useful� An inherently stable set of ODE�s issti� if

j�pj � j�M jIn particular we de�ne the ratio

Cr j�M j � j�pjand form the categories

Mildlysti� Cr � ���

Stronglysti� ��� � Cr � ���

Extremelysti� ��� � Cr � ���

Pathologicallysti� ��� � Cr

It should be mentioned that the gaps in the sti� category de�nitions are intentionalbecause the bounds are arbitrary� It is important to notice that these de�nitionsmake no distinction between real� complex� and imaginary eigenvalues�

Page 161: Hydrodynamics - CFD

��� CHAPTER � CHOICE OF TIME�MARCHING METHODS

�� Relation of Sti�ness to Space Mesh Size

Many �ow �elds are characterized by a few regions having high spatial gradients ofthe dependent variables and other domains having relatively low gradient phenomena�As a result it is quite common to cluster mesh points in certain regions of space andspread them out otherwise� Examples of where this clustering might occur are at ashock wave� near an airfoil leading or trailing edge� and in a boundary layer�One quickly �nds that this grid clustering can strongly a�ect the eigensystem of

the resulting A matrix� In order to demonstrate this� let us examine the eigensystemsof the model problems given in Section ������ The simplest example to discuss relatesto the model di�usion equation� In this case the eigenvalues are all real� negativenumbers that automatically obey the ordering given in Eq� ��� Consider the casewhen all of the eigenvalues are parasitic� i�e�� we are interested only in the convergedsteadystate solution� Under these conditions� the sti�ness is determined by the ratio�M���� A simple calculation shows that

�� � ��

�x�sin�

��

��M � ��

�� �

���

�x�

���x

�� ��

�M � � ��

�x�sin�

��

� � ��

�x�

and the ratio is

�M��� � �

�x� �

�M � �

��The most important information found from this example is the fact that the

sti�ness of the transient solution is directly related to the grid spacing� Furthermore�in di�usion problems this sti�ness is proportional to the reciprocal of the space meshsize squared� For a mesh size M ��� this ratio is about ��� Even for a mesh ofthis moderate size the problem is already approaching the category of strongly sti��For the biconvection model a similar analysis shows that

j�M j � j��j � �

�x

Here the sti�ness parameter is still spacemesh dependent� but much less so than fordi�usiondominated problems�We see that in both cases we are faced with the rather annoying fact that the more

we try to increase the resolution of our spatial gradients� the sti�er our equations tendto become� Typical CFD problems without chemistry vary between the mildly andstrongly sti� categories� and are greatly a�ected by the resolution of a boundary layersince it is a di�usion process� Our brief analysis has been limited to equispaced

Page 162: Hydrodynamics - CFD

��� PRACTICAL CONSIDERATIONS FOR COMPARING METHODS ���

problems� but in general the sti�ness of CFD problems is proportional to the meshintervals in the manner shown above where the critical interval is the smallest one inthe physical domain�

�� Practical Considerations for Comparing Meth�

ods

We have presented relatively simple and reliable measures of stability and both thelocal and global accuracy of timemarching methods� Since there are an endlessnumber of these methods to choose from� one can wonder how this information isto be used to pick a �best� choice for a particular problem� There is no uniqueanswer to such a question� For example� it is� among other things� highly dependentupon the speed� capacity� and architecture of the available computer� and technologyin�uencing this is undergoing rapid and dramatic changes as this is being written�Nevertheless� if certain ground rules are agreed upon� relevant conclusions can bereached� Let us now examine some ground rules that might be appropriate� It shouldthen be clear how the analysis can be extended to other cases�

Let us consider the problem of measuring the e�ciency of a time�marching methodfor computing� over a �xed interval of time� an accurate transient solution of a coupledset of ODE�s� The length of the time interval� T � and the accuracy required of thesolution are dictated by the physics of the particular problem involved� For example�in calculating the amount of turbulence in a homogeneous �ow� the time intervalwould be that required to extract a reliable statistical sample� and the accuracywould be related to how much the energy of certain harmonics would be permittedto distort from a given level� Such a computation we refer to as an event�

The appropriate error measures to be used in comparing methods for calculatingan event are the global ones� Era� Er� and Er�� discussed in Section ������ ratherthan the local ones er�� era� and erp discussed earlier�

The actual form of the coupled ODE�s that are produced by the semidiscreteapproach is

d�u

dt �F ��u� t�

At every time step we must evaluate the function �F ��u� t� at least once� This functionis usually nonlinear� and its computation usually consumes the major portion of thecomputer time required to make the simulation� We refer to a single calculation of thevector �F ��u� t� as a function evaluation and denote the total number of such evaluationsby Fev�

Page 163: Hydrodynamics - CFD

��� CHAPTER � CHOICE OF TIME�MARCHING METHODS

�� Comparing the E�ciency of Explicit Methods

����� Imposed Constraints

As mentioned above� the e�ciency of methods can be compared only if one accepts aset of limiting constraints within which the comparisons are carried out� The followassumptions bound the considerations made in this Section�

�� The timemarch method is explicit�

�� Implications of computer storage capacity and access time are ignored� In somecontexts� this can be an important consideration�

�� The calculation is to be timeaccurate� must simulate an entire event whichtakes a total time T � and must use a constant time step size� h� so that

T Nh

where N is the total number of time steps�

����� An Example Involving Di�usion

Let the event be the numerical solution of

du

dt �u ����

from t � to T � ln������ with u��� �� Eq� �� is obtained from our representative ODE with � ��� a �� Since the exact solution is u�t� u���e�t� this makesthe exact value of u at the end of the event equal to ����� i�e�� u�T � ����� To theconstraints imposed above� let us set the additional requirement

� The error in u at the end of the event� i�e�� the global error� must be � ���(�

We judge the most e�cient method as the one that satis�es these conditions andhas the fewest number of evaluations� Fev� Three methods are compared � explicitEuler� AB�� and RK��First of all� the allowable error constraint means that the global error in the am

plitude� see Eq� ���� must have the property�����Er�e�T

���� � �����

Page 164: Hydrodynamics - CFD

��� COMPARING THE EFFICIENCY OF EXPLICIT METHODS ���

Then� since h T�N � ln�������N � it follows that����� ����ln������N��N������� � �����where �� is found from the characteristic polynomials given in Table ���� The resultsshown in Table �� were computed using a simple iterative procedure�

Method N h �� Fev Er�Euler � � ����� � �� � � ������ worstAB� �� ���� � ��� �� �������RK� � �� �� ����� ����� � best

Table ��� Comparison of timemarching methods for a simple dissipation problem�

In this example we see that� for a given global accuracy� the method with thehighest local accuracy is the most e�cient on the basis of the expense in evaluatingFev� Thus the secondorder AdamsBashforth method is much better than the �rstorder Euler method� and the fourthorder RungeKutta method is the best of all� Themain purpose of this exercise is to show the �usually� great superiority of secondorderover �rstorder timemarching methods�

����� An Example Involving Periodic Convection

Let us use as a basis for this example the study of homogeneous turbulence simulatedby the numerical solution of the incompressible NavierStokes equations inside a cubewith periodic boundary conditions on all sides� In this numerical experiment thefunction evaluations contribute overwhelmingly to the CPU time� and the number ofthese evaluations must be kept to an absolute minimum because of the magnitude ofthe problem� On the other hand� a complete event must be established in order toobtain meaningful statistical samples which are the essence of the solution� In thiscase� in addition to the constraints given in Section ����� we add the following�

� The number of evaluations of �F ��u� t� is �xed�Under these conditions a method is judged as best when it has the highest globalaccuracy for resolving eigenvectors with imaginary eigenvalues� The above constrainthas led to the invention of schemes that omit the function evaluation in the corrector step of a predictorcorrector combination� leading to the socalled incomplete

Page 165: Hydrodynamics - CFD

��� CHAPTER � CHOICE OF TIME�MARCHING METHODS

predictorcorrector methods� The presumption is� of course� that more e�cient methods will result from the omission of the second function evaluation� An example isthe method of Gazdag� given in Section ��� Basically this is composed of an AB�predictor and a trapezoidal corrector� However� the derivative of the fundamentalfamily is never found so there is only one evaluation required to complete each cycle�The �� relation for the method is shown as entry �� in Table ����In order to discuss our comparisions we introduce the following de�nitions�

� Let a kevaluation method be de�ned as one that requires k evaluations of�F ��u� t� to advance one step using that method�s time interval� h�

� Let K represent the total number of allowable Fev�

� Let h� be the time interval advanced in one step of a oneevaluation method�The Gazdag� leapfrog� and AB� schemes are all �evaluation methods� The secondand fourth order RK methods are � and �evaluation methods� respectively� For a �evaluation method the total number of time steps� N � and the number of evaluations�K� are the same� one evaluation being used for each step� so that for these methodsh h�� For a �evaluation method N K�� since two evaluations are used foreach step� However� in this case� in order to arrive at the same time T after Kevaluations� the time step must be twice that of a one�evaluation method so h �h��For a �evaluation method the time interval must be h �h�� etc� Notice thatas k increases� the time span required for one application of the method increases�However notice also that as k increases the power to which �� is raised to arriveat the �nal destination decreases� see the Figure below� This is the key to the truecomparison of timemarch methods for this type of problem�

� T uNk � j � � � � � � � j ����h���

k � j �h� � � � j �����h����

k � j �h� � j �����h����

Step sizes and powers of � for kevaluation methods used to get to the same valueof T if evaluations are allowed�

In general� after K evaluations� the global amplitude and phase error for kevaluation methods applied to systems with pure imaginary �roots can be written�

Era �� j���ik�h��jKk ����

�See Eqs� ���� and �����

Page 166: Hydrodynamics - CFD

��� COMPARING THE EFFICIENCY OF EXPLICIT METHODS ���

Er� �T � K

ktan��

�����ik�h���imaginary

����ik�h���real

�����

Consider a convectiondominated event for which the function evaluation is verytime consuming� We idealize to the case where � i� and set � equal to one� Theevent must proceed to the time t T ��� We consider two maximum evaluationlimits K �� and K ��� and choose from four possible methods� leapfrog� AB��Gazdag� and RK�� The �rst three of these are oneevaluation methods and the lastone is a fourevaluation method� It is not di�cult to show that on the basis of localerror �made in a single step� the Gazdag method is superior to the RK� method inboth amplitude and phase� For example� for �h ��� the Gazdag method producesa j��j �� ���� whereas for �h �� �which must be used to keep the number ofevaluations the same� the RK� method produces a j��j �� ���� However� we aremaking our comparisons on the basis of global error for a �xed number of evaluations�First of all we see that for a oneevaluation method h� T�K� Using this� and the

fact that � �� we �nd� by some rather simple calculations� made using Eqs� �� and��� the results shown in Table ��� Notice that to �nd global error the Gazdag rootmust be raised to the power of �� while the RK� root is raised only to the power of��"�� On the basis of global error the Gazdag method is not superior to RK� in eitheramplitude or phase� although� in terms of phase error �for which it was designed� itis superior to the other two methods shown�

K leapfrog AB� Gazdag RK��h� �� ��� ��� ����� � � � �h� �� �� ��� ����� � �� � �

a� Amplitude� exact ����

K leapfrog AB� Gazdag RK��h� �� ��� �� � ���� ��� ����h� �� �� ��� � � ��� ���

b� Phase error in degrees�

Table ��� Comparison of global amplitude and phase errors for four methods�

�The � root for the Gazdag method can be found using a numerical root �nding routine to tracethe three roots in the �plane� see Fig� ���e�

Page 167: Hydrodynamics - CFD

�� CHAPTER � CHOICE OF TIME�MARCHING METHODS

Using analysis such as this �and also considering the stability boundaries� theRK� method is recommended as a basic �rst choice for any explicit timeaccuratecalculation of a convectiondominated problem�

�� Coping With Sti�ness

���� Explicit Methods

The ability of a numerical method to cope with sti�ness can be illustrated quite nicelyin the complex �h plane� A good example of the concept is produced by studyingthe Euler method applied to the representative equation� The transient solution isun �� � �h�n and the trace of the complex value of �h which makes j� � �hj �gives the whole story� In this case the trace forms a circle of unit radius centered at���� �� as shown in Fig� ��� If h is chosen so that all �h in the ODE eigensystemfall inside this circle the integration will be numerically stable� Also shown by thesmall circle centered at the origin is the region of Taylor series accuracy� If some �hfall outside the small circle but stay within the stable region� these �h are sti�� butstable� We have de�ned these �h as parasitic eigenvalues� Stability boundaries forsome explicit methods are shown in Figs� ��� and ����For a speci�c example� consider the mildly sti� system composed of a coupled

twoequation set having the two eigenvalues �� ���� and �� ��� If uncoupledand evaluated in wave space� the time histories of the two solutions would appear as arapidly decaying function in one case� and a relatively slowly decaying function in theother� Analytical evaluation of the time histories poses no problem since e����t quicklybecomes very small and can be neglected in the expressions when time becomes large�Numerical evaluation is altogether di�erent� Numerical solutions� of course� dependupon ����mh��

n and no j�mj can exceed one for any �m in the coupled system or elsethe process is numerically unstable�Let us choose the simple explicit Euler method for the time march� The coupled

equations in real space are represented by

u��n� c���� ���h�nx�� � c���� h�nx�� � �PS��

u��n� c���� ���h�nx�� � c���� h�nx�� � �PS�� ����

We will assume that our accuracy requirements are such that su�cient accuracy isobtained as long as j�hj � ���� This de�nes a time step limit based on accuracyconsiderations of h ����� for �� and h ��� for ��� The time step limit basedon stability� which is determined from ��� is h ����� We will also assume thatc� c� � and that an amplitude less than ����� is negligible� We �rst run ��time steps with h ����� in order to resolve the �� term� With this time step the

Page 168: Hydrodynamics - CFD

��� COPING WITH STIFFNESS ��

�� term is resolved exceedingly well� After �� steps� the amplitude of the �� term�i�e�� ��� ���h�n� is less than ����� and that of the �� term �i�e�� ��� h�n� is �� ����Hence the �� term can now be considered negligible� To drive the �� � h�n term tozero �i�e�� below ������� we would like to change the step size to h ��� and continue�We would then have a well resolved answer to the problem throughout the entirerelevant time interval� However� this is not possible because of the coupled presenceof ��� ���h�n� which in just �� steps at h ��� ampli�es those terms by � ���� faroutweighing the initial decrease obtained with the smaller time step� In fact� withh ����� the maximum step size that can be taken in order to maintain stability�about �� time steps have to be computed in order to drive e�t to below ������ Thusthe total simulation requires ��� time steps�

���� Implicit Methods

Now let us reexamine the problem that produced Eq� �� but this time using anunconditionally stable implicit method for the time march� We choose the trapezoidalmethod� Its behavior in the �h plane is shown in Fig� ���b� Since this is also a oneroot method� we simply replace the Euler � with the trapezoidal one and analyze theresult� It follows that the �nal numerical solution to the ODE is now represented inreal space by

u��n� c�

��� ��h� � ��h

�nx�� � c�

��� ���h� � ���h

�nx�� � �PS��

u��n� c�

��� ��h� � ��h

�nx�� � c�

��� ���h� � ���h

�nx�� � �PS�� ����

In order to resolve the initial transient of the term e����t� we need to use a step sizeof about h ������ This is the same step size used in applying the explicit Eulermethod because here accuracy is the only consideration and a very small step sizemust be chosen to get the desired resolution� �It is true that for the same accuracywe could in this case use a larger step size because this is a secondorder method�but that is not the point of this exercise�� After �� time steps the �� term hasamplitude less than ����� and can be neglected� Now with the implicit method wecan proceed to calculate the remaining part of the event using our desired step sizeh ��� without any problem of instability� with � steps required to reduce theamplitude of the second term to below ������ In both intervals the desired solutionis secondorder accurate and well resolved� It is true that in the �nal � steps one�root is �� � ����������� � �������� ����� � � �� and this has no physical meaningwhatsoever� However� its in�uence on the coupled solution is negligible at the endof the �rst �� steps� and� since ������ � � ��n � �� its in�uence in the remaining ��

Page 169: Hydrodynamics - CFD

��� CHAPTER � CHOICE OF TIME�MARCHING METHODS

steps is even less� Actually� although this root is one of the principal roots in thesystem� its behavior for t � ���� is identical to that of a stable spurious root� Thetotal simulation requires �� time steps�

���� A Perspective

It is important to retain a proper perspective on a problem represented by the aboveexample� It is clear that an unconditionally stable method can always be called uponto solve sti� problems with a minimum number of time steps� In the example� theconditionally stable Euler method required ��� time steps� as compared to about�� for the trapezoidal method� about three times as many� However� the Eulermethod is extremely easy to program and requires very little arithmetic per step� Forpreliminary investigations it is often the best method to use for mildlysti� di�usiondominated problems� For re�ned investigations of such problems an explicit methodof second order or higher� such as AdamsBashforth or RungeKutta methods� isrecommended� These explicit methods can be considered as e�ective mildly sti�stable methods� However� it should be clear that as the degree of sti�ness of theproblem increases� the advantage begins to tilt towards implicit methods� as thereduced number of time steps begins to outweigh the increased cost per time step�The reader can repeat the above example with �� ���� ���� �� ��� which is inthe stronglysti� category�There is yet another technique for coping with certain sti� systems in �uid dynamic

applications� This is known as the multigrid method� It has enjoyed remarkablesuccess in many practical problems! however� we need an introduction to the theoryof relaxation before it can be presented�

� Steady Problems

In Chapter � we wrote the O�E solution in terms of the principal and spurious rootsas follows�

un c������n��x� � � � �� cm���m�

n��xm � � � �� cM���M�

n��xM � P�S�

�c������n��x� � � � �� cm���m�

n��xm � � � �� cM���M�

n��xM

�c������n��x� � � � �� cm���m�

n��xm � � � �� cM���M�

n��xM

�etc�� if there are more spurious roots ���

When solving a steady problem� we have no interest whatsoever in the transient portion of the solution� Our sole goal is to eliminate it as quickly as possible� Therefore�

Page 170: Hydrodynamics - CFD

�� PROBLEMS ���

the choice of a timemarching method for a steady problem is similar to that for asti� problem� the di�erence being that the order of accuracy is irrelevant� Hence theexplicit Euler method is a candidate for steady di�usion dominated problems� andthe fourthorder RungeKutta method is a candidate for steady convection dominatedproblems� because of their stability properties� Among implicit methods� the implicitEuler method is the obvious choice for steady problems�When we seek only the steady solution� all of the eigenvalues can be considered to

be parasitic� Referring to Fig� ��� none of the eigenvalues are required to fall in theaccurate region of the timemarching method� Therefore the time step can be chosento eliminate the transient as quickly as possible with no regard for time accuracy�For example� when using the implicit Euler method with local time linearization� Eq��� �� one would like to take the limit h ��� which leads to Newton�s method� Eq��� � However� a �nite time step may be required until the solution is somewhat closeto the steady solution�

� Problems

�� Repeat the timemarch comparisons for di�usion �Section ����� and periodicconvection �Section ����� using �nd and �rdorder RungeKutta methods�

�� Repeat the timemarch comparisons for di�usion �Section ����� and periodicconvection �Section ����� using the �rd and �thorder AdamsBashforth methods� Considering the stability bounds for these methods �see problem � inChapter �� as well as their memory requirements� compare and contrast themwith the �rd and �thorder RungeKutta methods�

�� Consider the di�usion equation �with � �� discretized using �ndorder centraldi�erences on a grid with �� �interior� points� Find and plot the eigenvaluesand the corresponding modi�ed wavenumbers� If we use the explicit Euler timemarching method what is the maximum allowable time step if all but the �rsttwo eigenvectors are considered parasitic� Assume that su�cient accuracy isobtained as long as j�hj � ���� What is the maximum allowable time step if allbut the �rst eigenvector are considered parasitic�

Page 171: Hydrodynamics - CFD

��� CHAPTER � CHOICE OF TIME�MARCHING METHODS

Page 172: Hydrodynamics - CFD

Chapter �

RELAXATION METHODS

In the past three chapters� we developed a methodology for designing� analyzing�and choosing timemarching methods� These methods can be used to compute thetimeaccurate solution to linear and nonlinear systems of ODE�s in the general form

d�u

dt �F ��u� t� � ���

which arise after spatial discretization of a PDE� Alternatively� they can be used tosolve for the steady solution of Eq� ��� which satis�es the following coupled systemof nonlinear algebraic equations�

�F ��u� � � ���

In the latter case� the unsteady equations are integrated until the solution convergesto a steady solution� The same approach permits a timemarching method to be usedto solve a linear system of algebraic equations in the form

A�x �b � ���

To solve this system using a timemarching method� a time derivative is introducedas follows

d�x

dt A�x��b � ���

and the system is integrated in time until the transient has decayed to a su�cientlylow level� Following a timedependent path to steady state is possible only if all ofthe eigenvalues of the matrix A �or �A� have real parts lying in the left halfplane�Although the solution �x A���b exists as long as A is nonsingular� the ODE given byEq� �� has a stable steady solution only if A meets the above condition�

���

Page 173: Hydrodynamics - CFD

��� CHAPTER �� RELAXATION METHODS

The common feature of all timemarching methods is that they are at least �rstorder accurate� In this chapter� we consider iterative methods which are not timeaccurate at all� Such methods are known as relaxation methods� While they areapplicable to coupled systems of nonlinear algebraic equations in the form of Eq� ���our analysis will focus on their application to large sparse linear systems of equationsin the form

Ab�u� �f b � � ���

where Ab is nonsingular� and the use of the subscript b will become clear shortly� Suchsystems of equations arise� for example� at each time step of an implicit timemarchingmethod or at each iteration of Newton�s method� Using an iterative method� we seekto obtain rapidly a solution which is arbitrarily close to the exact solution of Eq� ���which is given by

�u� A��b�f b � ���

��� Formulation of the Model Problem

����� Preconditioning the Basic Matrix

It is standard practice in applying relaxation procedures to precondition the basicequation� This preconditioning has the e�ect of multiplying Eq� �� from the leftby some nonsingular matrix� In the simplest possible case the conditioning matrixis a diagonal matrix composed of a constant D�b�� If we designate the conditioning

matrix by C� the problem becomes one of solving for �u in

CAb�u� C�f b � � ���

Notice that the solution of Eq� �� is

�u �CAb���C�f b A��

b C��C�f b A��b�f b � ��

which is identical to the solution of Eq� ��� provided C�� exists�In the following we will see that our approach to the iterative solution of Eq� ��

depends crucially on the eigenvalue and eigenvector structure of the matrix CAb� and�equally important� does not depend at all on the eigensystem of the basic matrix Ab�For example� there are wellknown techniques for accelerating relaxation schemes ifthe eigenvalues of CAb are all real and of the same sign� To use these schemes� the

Page 174: Hydrodynamics - CFD

���� FORMULATION OF THE MODEL PROBLEM ���

conditioning matrix C must be chosen such that this requirement is satis�ed� Achoice of C which ensures this condition is the negative transpose of Ab�For example� consider a spatial discretization of the linear convection equation

using centered di�erences with a Dirichlet condition on the left side and no constrainton the right side� Using a �rstorder backward di�erence on the right side �as inSection ����� this leads to the approximation

�x�u �

��x

��������������

��������� �

�� � ��� � �

�� � ��� �

��u����������ua����

���������������� � �

The matrix in Eq� � has eigenvalues whose imaginary parts are much larger thantheir real parts� It can �rst be conditioned so that the modulus of each element is ��This is accomplished using a diagonal preconditioning matrix

D ��x

��������� � � � �� � � � �� � � � �� � � � �� � � � �

� � ����

which scales each row� We then further condition with multiplication by the negativetranspose� The result is

A� �AT�A�

��������� �

�� � ��� � �

�� � ��� ��

��������� �

�� � ��� � �

�� � ��� �

���������� � �� �� � �� � �� � �

� � �� �� � ��

� � ����

Page 175: Hydrodynamics - CFD

��� CHAPTER �� RELAXATION METHODS

If we de�ne a permutation matrix P � and carry out the process P T ��AT�A��P �which

just reorders the elements of A� and doesn�t change the eigenvalues� we �nd

��������� � � � �� � � � �� � � � �� � � � �� � � � �

���������� � �� �� � �� � �� � �

� � �� �� � ��

��������� � � � �� � � � �� � � � �� � � � �� � � � �

���������� �� �� �

� �� �� �� �

� ��

� � ����

which has all negative real eigenvalues� as given in Appendix B� Thus even whenthe basic matrix Ab has nearly imaginary eigenvalues� the conditioned matrix �AT

b Ab

is nevertheless symmetric negative de�nite �i�e�� symmetric with negative real eigenvalues�� and the classical relaxation methods can be applied� We do not necessarilyrecommend the use of �AT

b as a preconditioner! we simply wish to show that a broadrange of matrices can be preconditioned into a form suitable for our analysis�

����� The Model Equations

Preconditioning processes such as those described in the last section allow us toprepare our algebraic equations in advance so that certain eigenstructures are guaranteed� In the remainder of this chapter� we will thoroughly investigate some simpleequations which model these structures� We will consider the preconditioned systemof equations having the form

A��� �f � � ����

where A is symmetric negative de�nite�� The symbol for the dependent variable hasbeen changed to � as a reminder that the physics being modeled is no longer time

�A permutation matrix �de�ned as a matrix with exactly one in each row and column and hasthe property that P T P��� just rearranges the rows and columns of a matrix�

�We use a symmetric negative de�nite matrix to simplify certain aspects of our analysis� Relax�ation methods are applicable to more general matrices� The classical methods will usually convergeif Ab is diagonally dominant� as de�ned in Appendix A�

Page 176: Hydrodynamics - CFD

���� FORMULATION OF THE MODEL PROBLEM ���

accurate when we later deal with ODE formulations� Note that the solution of Eq� ���� �� A���f � is guaranteed to exist because A is nonsingular� In the notation ofEqs� �� and ���

A CAb and �f C�f b � ����

The above was written to treat the general case� It is instructive in formulating theconcepts to consider the special case given by the di�usion equation in one dimensionwith unit di�usion coe�cient ��

�u

�t ��u

�x�� g�x� � ����

This has the steadystate solution

��u

�x� g�x� � ����

which is the onedimensional form of the Poisson equation� Introducing the threepoint central di�erencing scheme for the second derivative with Dirichlet boundaryconditions� we �nd

d�u

dt

�x�B������ ���u� ��bc�� �g � ����

where ��bc� contains the boundary conditions and �g contains the values of the sourceterm at the grid nodes� In this case

Ab �

�x�B������ ��

�fb �g � ��bc� � ���

Choosing C �x�I� we obtain

B������ ���� �f � �� �

where �f �x��fb� If we consider a Dirichlet boundary condition on the left side andeither a Dirichlet or a Neumann condition on the right side� then A has the form

A B����b� �

Page 177: Hydrodynamics - CFD

�� CHAPTER �� RELAXATION METHODS

�b ������� � � � ����� s�T

s �� or � � � ����

Note that s �� is easily obtained from the matrix resulting from the Neumannboundary condition given in Eq� ���� using a diagonal conditioning matrix� A tremendous amount of insight to the basic features of relaxation is gained by an appropriatestudy of the onedimensional case� and much of the remaining material is devoted tothis case� We attempt to do this in such a way� however� that it is directly applicableto two and threedimensional problems�

��� Classical Relaxation

����� The Delta Form of an Iterative Scheme

We will consider relaxation methods which can be expressed in the following deltaform�

Hh��n� � ��n

i A��n � �f � ����

where H is some nonsingular matrix which depends upon the iterative method� Thematrix H is independent of n for stationary methods and is a function of n fornonstationary ones� The iteration count is designated by the subscript n or thesuperscript �n�� The converged solution is designated ��� so that

��� A���f � ����

����� The Converged Solution� the Residual� and the Error

Solving Eq� ��� for ��n� gives

��n� �I �H��A���n �H���f G��n �H���f � ����

where

G � I �H��A � ����

Hence it is clear that H should lead to a system of equations which is easy to solve�or at least easier to solve than the original system� The error at the nth iteration isde�ned as

�en � ��n � ��� ��n � A���f � ����

Page 178: Hydrodynamics - CFD

���� CLASSICAL RELAXATION ��

where ��� was de�ned in Eq� ���� The residual at the nth iteration is de�ned as

�rn � A��n � �f � ����

Multiply Eq� ��� by A from the left� and use the de�nition in Eq� ���� There resultsthe relation between the error and the residual

A�en ��rn � � ����

Finally� it is not di�cult to show that

�en� G�en � ���

Consequently� G is referred to as the basic iteration matrix� and its eigenvalues� whichwe designate as �m� determine the convergence rate of a method�In all of the above� we have considered only what are usually referred to as sta

tionary processes in which H is constant throughout the iterations� Nonstationaryprocesses in which H �and possibly C� is varied at each iteration are discussed inSection ���

����� The Classical Methods

Point Operator Schemes in One Dimension

Let us consider three classical relaxation procedures for our model equation

B������ ���� �f � �� �

as given in Section ����� The PointJacobi method is expressed in point operatorform for the onedimensional case as

��n��j

h��n�j�� � ��n�j� � fj

i� ����

This operator comes about by choosing the value of ��n��j such that together with

the old values of �j�� and �j�� the jth row of Eq� �� is satis�ed� The GaussSeidelmethod is

��n��j

h��n��j�� � �

�n�j� � fj

i� ����

This operator is a simple extension of the pointJacobi method which uses the mostrecent update of �j��� Hence the jth row of Eq� �� is satis�ed using the new values of�j and �j�� and the old value of �j�� The method of successive overrelaxation �SOR�

Page 179: Hydrodynamics - CFD

��� CHAPTER �� RELAXATION METHODS

is based on the idea that if the correction produced by the GaussSeidel method tendsto move the solution toward ���� then perhaps it would be better to move further inthis direction� It is usually expressed in two steps as

%�j �

h��n��j�� � �

�n�j� � fj

i��n��j �

�n�j � �

h%�j � �

�n�j

i� ����

where � generally lies between � and �� but it can also be written in the single line

��n��j

���n��j�� � ��� ���

�n�j �

���n�j� �

�fj � ����

The General Form

The general form of the classical methods is obtained by splitting the matrix A inEq� ��� into its diagonal� D� the portion of the matrix below the diagonal� L� andthe portion above the diagonal� U � such that

A L�D � U � ����

Then the pointJacobi method is obtained with H �D� which certainly meetsthe criterion that it is easy to solve� The GaussSeidel method is obtained withH ��L �D�� which is also easy to solve� being lower triangular�

��� The ODE Approach to Classical Relaxation

����� The Ordinary Di�erential Equation Formulation

The particular type of delta form given by Eq� ��� leads to an interpretation ofrelaxation methods in terms of solution techniques for coupled �rstorder ODE�s�about which we have already learned a great deal� One can easily see that Eq� ���results from the application of the explicit Euler timemarching method �with h ��to the following system of ODE�s�

Hd��

dt A��� �f � ����

This is equivalent to

d��

dt H��C

�Ab��� �f b

� H���A��� �f � � ����

Page 180: Hydrodynamics - CFD

���� THE ODE APPROACH TO CLASSICAL RELAXATION ���

In the special case where H��A depends on neither �u nor t� H���f is also independentof t� and the eigenvectors of H��A are linearly independent� the solution can bewritten as

�� c�e��t�x� � � � �� cMe

�M t�xM� �z error

���� � ����

where what is referred to in timeaccurate analysis as the transient solution� is nowreferred to in relaxation analysis as the error� It is clear that� if all of the eigenvaluesof H��A have negative real parts �which implies that H��A is nonsingular�� then thesystem of ODE�s has a steady�state solution which is approached as t��� given by

��� A���f � ���

which is the solution of Eq� ���� We see that the goal of a relaxation method is toremove the transient solution from the general solution in the most e�cient way possible� The � eigenvalues are �xed by the basic matrix in Eq� ���� the preconditioningmatrix in ��� and the secondary conditioning matrix in ���� The � eigenvalues are�xed for a given �h by the choice of timemarching method� Throughout the remaining discussion we will refer to the independent variable t as �time�� even though notrue time accuracy is involved�

In a stationary method� H and C in Eq� ��� are independent of t� that is� theyare not changed throughout the iteration process� The generalization of this in ourapproach is to make h� the �time� step� a constant for the entire iteration�

Suppose the explicit Euler method is used for the time integration� For this method�m � � �mh� Hence the numerical solution after n steps of a stationary relaxationmethod can be expressed as �see Eq� ����

��n c��x��� � ��h�n � � � �� cm�xm�� � �mh�

n � � � �� cM�xM�� � �Mh�n� �z

error

���� � �� �

The initial amplitudes of the eigenvectors are given by the magnitudes of the cm�These are �xed by the initial guess� In general it is assumed that any or all of theeigenvectors could have been given an equally �bad� excitation by the initial guess�so that we must devise a way to remove them all from the general solution on anequal basis� Assuming that H��A has been chosen �that is� an iteration process hasbeen decided upon�� the only free choice remaining to accelerate the removal of theerror terms is the choice of h� As we shall see� the three classical methods have allbeen conditioned by the choice of H to have an optimum h equal to � for a stationaryiteration process�

Page 181: Hydrodynamics - CFD

��� CHAPTER �� RELAXATION METHODS

����� ODE Form of the Classical Methods

The three iterative procedures de�ned by Eqs� ���� ��� and ��� obey no apparentpattern except that they are easy to implement in a computer code since all of thedata required to update the value of one point are explicitly available at the timeof the update� Now let us study these methods as subsets of ODE as formulated inSection ����� Insert the model equation �� into the ODE form ���� Then

Hd��

dt B������ ����� �f � ����

As a start� let us use for the numerical integration the explicit Euler method

�n� �n � h��n � ����

with a step size� h� equal to �� We arrive at

H���n� � ��n� B������ ����n � �f � ����

It is clear that the best choice of H from the point of view of matrix algebra is�B������ �� since then multiplication from the left by �B�������� �� gives the correct answer in one step� However� this is not in the spirit of our study� since multiplication by the inverse amounts to solving the problem by a direct method withoutiteration� The constraint on H that is in keeping with the formulation of the threemethods described in Section ���� is that all the elements above the diagonal �orbelow the diagonal if the sweeps are from right to left� are zero� If we impose thisconstraint and further restrict ourselves to banded tridiagonals with a single constantin each band� we are led to

B���� ��� �����n� � ��n� B������ ����n � �f � ����

where � and � are arbitrary� With this choice of notation the three methods presentedin Section ���� can be identi�ed using the entries in Table ���

TABLE ��� VALUES OF � and � IN EQ� ��� THAT

LEAD TO CLASSICAL RELAXATION METHODS

� � Method Equation

� � PointJacobi ������ � GaussSeidel ������ ��

h� � sin

��

M � �

�iOptimum SOR �����

Page 182: Hydrodynamics - CFD

���� EIGENSYSTEMS OF THE CLASSICAL METHODS ���

The fact that the values in the tables lead to the methods indicated can be veri�edby simple algebraic manipulation� However� our purpose is to examine the wholeprocedure as a special subset of the theory of ordinary di�erential equations� In thislight� the three methods are all contained in the following set of ODE�s

d��

dt B������ �

�� ���B������ ����� �f

�� ����

and appear from it in the special case when the explicit Euler method is used for itsnumerical integration� The point operator that results from the use of the explicitEuler scheme is

��n��j

���

���n��j�� �

��h� ���

�n�j��

�����h� ����n�j

��

��h

���n�j�

�� �h

�fj� ����

This represents a generalization of the classical relaxation techniques�

��� Eigensystems of the Classical Methods

The ODE approach to relaxation can be summarized as follows� The basic equationto be solved came from some timeaccurate derivation

Ab�u� �f b � � ����

This equation is preconditioned in some manner which has the e�ect of multiplicationby a conditioning matrix C giving

A��� �f � � ����

An iterative scheme is developed to �nd the converged� or steadystate� solution ofthe set of ODE�s

Hd��

dt A��� �f � ���

This solution has the analytical form

��n �en � ��� � �� �

where �en is the transient� or error� and ��� � A���f is the steadystate solution� Thethree classical methods� PointJacobi� GaussSeidel� and SOR� are identi�ed for theonedimensional case by Eq� ��� and Table ���

Page 183: Hydrodynamics - CFD

��� CHAPTER �� RELAXATION METHODS

Given our assumption that the component of the error associated with each eigenvector is equally likely to be excited� the asymptotic convergence rate is determinedby the eigenvalue �m of G �� I �H��A� having maximum absolute value� Thus

Convergence rate � j�mjmax � m �� �� � � � �M � ����

In this section� we use the ODE analysis to �nd the convergence rates of the threeclassical methods represented by Eqs� ���� ���� and ���� It is also instructive toinspect the eigenvectors and eigenvalues in the H��A matrix for the three methods�This amounts to solving the generalized eigenvalue problem

A�xm �mH�xm � ����

for the special case

B������ ���xm �mB���� ��� ���xm � ����

The generalized eigensystem for simple tridigonals is given in Appendix B��� Thethree special cases considered below are obtained with a �� b ��� c �� d ���e ���� and f �� To illustrate the behavior� we take M � for the matrix order�This special case makes the general result quite clear�

����� The Point�Jacobi System

If � � and � � in Eq� ���� the ODE matrixH��A reduces to simply B��� ���� ����The eigensystem can be determined from Appendix B�� since both d and f are zero�The eigenvalues are given by the equation

�m �� � cos�

m�

M � �

�� m �� �� � � � �M � ����

The �� relation for the explicit Euler method is �m � � �mh� This relation canbe plotted for any h� The plot for h �� the optimum stationary case� is shown inFig� ��� For h � �� the maximum j�mj is obtained with m �� Fig� �� and forh � �� the maximum j�mj is obtained with m M � Fig� ��� Note that for h � ����depending on M� there is the possibility of instability� i�e� j�mj � ���� To obtain theoptimal scheme we wish to minimize the maximum j�mj which occurs when h ��j��j j�M j and the best possible convergence rate is achieved�

j�mjmax cos�

M � �

�� ����

Page 184: Hydrodynamics - CFD

���� EIGENSYSTEMS OF THE CLASSICAL METHODS ���

For M ��� we obtain j�mjmax �� ��� Thus after ��� iterations the error contentassociated with each eigenvector is reduced to no more than ���� times its initial level�Again from Appendix B��� the eigenvectors of H��A are given by

�xj �xj�m sin�j�

m�

M � �

��� j �� �� � � � �M � ����

This is a very �wellbehaved� eigensystem with linearly independent eigenvectors anddistinct eigenvalues� The �rst � eigenvectors are simple sine waves� For M �� theeigenvectors can be written as

�x�

�����������p����p������

� � �x� ��������

p���p����

�p����p���

� � �x� ��������������

� �

�x�

��������

p���

�p����p���

�p���

� � �x� ��������

���

�p����

�p������

� � ����

The corresponding eigenvalues are� from Eq� ���

�� �� �p�� ������ � � �

�� �� � �� ����

�� �� ����

�� ��� �� ����

�� ���p�� ����� � � �

� ����

From Eq� �� � the numerical solution written in full is

��n � ��� c���� ���p�

��h�n�x�

� c���� ��� ���h�n�x�

Page 185: Hydrodynamics - CFD

��� CHAPTER �� RELAXATION METHODS

σm

1.0

0.0

-2.0 -1.0 0.0

h = 1.0

Μ = 5

Values are equal

m=1

m=2

m=3

m=4

m=5

Figure ��� The �� � relation for PointJacobi� h ��M ��

� c���� �� �h�n�x�

� c���� �� � ���h�n�x�

� c���� �� �p�

��h�n�x� � ���

����� The Gauss�Seidel System

If � and � are equal to � in Eq� ���� the matrix eigensystem evolves from the relation

B������ ���xm �mB���� �� ���xm � �� �

which can be studied using the results in Appendix B��� One can show that the H��Amatrix for the GaussSeidel method� AGS � is

AGS � B������ �� ��B������ ��

Page 186: Hydrodynamics - CFD

���� EIGENSYSTEMS OF THE CLASSICAL METHODS ���

σm

λ mh

1.0

0.0

-2.0 -1.0 0.0

h < 1.0

Decreasing h

Approaches 1.0

Decreasing h

Figure ��� The �� � relation for PointJacobi� h �� �M ��

σm

Exceeds 1.0 at h 1.072 / Ustable h > 1.072∼∼

1.0

0.0

-2.0 -1.0 0.0

h > 1.0

Increasing h

λ mh

M = 5

Increasing h

Figure ��� The �� � relation for PointJacobi� h ����M ��

Page 187: Hydrodynamics - CFD

�� CHAPTER �� RELAXATION METHODS

�������������

�� ���� ���� ���� �� ���� ���� ���� �� ���� ���� ���� ���� �� ���� ������

���� � � � � � � � � � � � � � �

� ���M � � �

��������M

� ����

The eigenvector structure of the GaussSeidel ODE matrix is quite interesting� If Mis odd there are �M � ���� distinct eigenvalues with corresponding linearly independent eigenvectors� and there are �M � ���� defective eigenvalues with correspondingprincipal vectors� The equation for the nondefective eigenvalues in the ODE matrixis �for odd M�

�m �� � cos�� m�

M � �� � m �� �� � � � �

M � �

�� ����

and the corresponding eigenvectors are given by

�xm �cos�

m�

M � �

��j��sin�j�

m�

M � �

��� m �� �� � � � �

M � �

�� ����

The �� relation for h �� the optimum stationary case� is shown in Fig� ��� The�m with the largest amplitude is obtained with m �� Hence the convergence rate is

j�mjmax �cos�

M � �

���� ����

Since this is the square of that obtained for the PointJacobi method� the error associated with the �worst� eigenvector is removed in half as many iterations� ForM ���j�mjmax �� ��� ��� iterations are required to reduce the error component of theworst eigenvector by a factor of roughly �����The eigenvectors are quite unlike the PointJacobi set� They are no longer sym

metrical� producing waves that are higher in amplitude on one side �the updated side�than they are on the other� Furthermore� they do not represent a common family fordi�erent values of M �The Jordan canonical form for M � is

X��AGSX JGS

����������

h���i h

���i ����

��� ���� �

���

�� ����

Page 188: Hydrodynamics - CFD

���� EIGENSYSTEMS OF THE CLASSICAL METHODS ��

σm

λ m

λ m

1.0

0.0

-2.0 -1.0 0.0

h = 1.0

Μ = 5

-1.0-1.0

2 defective

h

Figure ��� The �� � relation for GaussSeidel� h ����M ��

The eigenvectors and principal vectors are all real� For M � they can be written

�x�

����������������� ��� ���

� � �x� ��������

p���p����

�p�����p����

� � �x� �������������

� � �x� ��������������

� � �x� ��������������

� � ����

The corresponding eigenvalues are

�� ������ ������ ��

������

�Defective� linked to�� Jordan block

� ����

The numerical solution written in full is thus

��n � ��� c���� h

��n�x�

� c���� �h��n�x�

Page 189: Hydrodynamics - CFD

�� CHAPTER �� RELAXATION METHODS

�c���� h�n � c�h

n

�$��� h�n�� � c�h

�n�n� ���$

��� h�n����x�

��c���� h�n � c�h

n

�$��� h�n��

��x�

� c���� h�n�x� � ����

����� The SOR System

If � � and ��� x in Eq� ���� the ODE matrix is B������ x� ��B������ ���One can show that this can be written in the form given below for M �� Thegeneralization to any M is fairly clear� The H��A matrix for the SOR method�ASOR � B������ x� ��B������ ��� is

x�

����������x� x� � � �

��x� � x� x� � �x� x� � ���x� � x� x� � �x� � x� x� � �x� x� ���x � x� x� �x� � x� x� � �x� � x� x� � �x� x�

�� � x �� �x � x� x� �x� � x� x� � �x� � x� x� � �x�

� � ���

Eigenvalues of the system are given by

�m �� ���pm � zm

��� m �� �� � � �M � �� �

where

zm ����� �� � ��p�m���

pm cos�m���M � ���

If � �� the system is GaussSeidel� If ���������pm � �� zm and �m are complex�If � is chosen such that ��� � �� � ��p�� �� � is optimum for the stationary case�and the following conditions hold�

�� Two eigenvalues are real� equal and defective�

�� If M is even� the remaining eigenvalues are complex and occur in conjugatepairs�

�� IfM is odd� one of the remaining eigenvalues is real and the others are complexoccurring in conjugate pairs�

Page 190: Hydrodynamics - CFD

���� EIGENSYSTEMS OF THE CLASSICAL METHODS ��

One can easily show that the optimum � for the stationary case is

�opt ���� � sin

��

M � �

��� ����

and for � �opt

�m ��m � ��xm �j��m sin

�j�

m�

M � �

��� ����

where

�m �opt�

�pm � i

qp�� � p�m

�Using the explicit Euler method to integrate the ODE�s� �m � � h � h��m� and ifh �� the optimum value for the stationary case� the �� relation reduces to thatshown in Fig� ��� This illustrates the fact that for optimum stationary SOR all thej�mj are identical and equal to �opt � �� Hence the convergence rate is

j�mjmax �opt � � � ����

�opt ���� � sin

��

M � �

��For M ��� j�mjmax ����� Hence the worst error component is reduced to lessthan ���� times its initial value in only �� iterations� much faster than both GaussSeidel and PointJacobi� In practical applications� the optimum value of � may haveto be determined by trial and error� and the bene�t may not be as great�For odd M � there are two real eigenvectors and one real principal vector� The

remaining linearly independent eigenvectors are all complex� For M � they can bewritten

�x�

�����������������������

� � �x� ���������� �����

� � �x��� ��������

p��� ���p��� i

p����

�p��� i

p�����p

��� �ip������

� � �x� ����������������

� � ����

The corresponding eigenvalues are

�� ������� Defective linked to ��

�� ����� �p�i��

�� ���� � �p�i��

�� ���� � ����

Page 191: Hydrodynamics - CFD

�� CHAPTER �� RELAXATION METHODS

σm

λ m

λ m

λ m

1.0

0.0

-2.0 -1.0 0.0

h = 1.0

Μ = 5

-1.0-1.0

2 real defective

1 real

2 complex

hλ m

Figure ��� The �� � relation for optimum stationary SOR� M �� h ��

The numerical solution written in full is

��n � ��� �c���� �h���n � c�nh��� �h���n����x�� c���� �h���n�x�� c���� ���� �

p�i�h� �n�x�

� c���� ��� � �p�i�h� �n�x�

� c���� �h���n�x� � ����

��� Nonstationary Processes

In classical terminology a method is said to be nonstationary if the conditioningmatrices� H and C� are varied at each time step� This does not change the steady

state solution A��b�f b� but it can greatly a�ect the convergence rate� In our ODE

approach this could also be considered and would lead to a study of equations withnonconstant coe�cients� It is much simpler� however� to study the case of �xedH and C but variable step size� h� This process changes the PointJacobi methodto Richardson�s method in standard terminology� For the GaussSeidel and SORmethods it leads to processes that can be superior to the stationary methods�

The nonstationary form of Eq� �� is

Page 192: Hydrodynamics - CFD

���� NONSTATIONARY PROCESSES ��

��N c��x�NYn��

�� � ��hn� � � � �� cm�xmNYn��

�� � �mhn�

� � � �� cM�xMNYn��

�� � �Mhn� � ��� � ����

where the symbol ) stands for product� Since hn can now be changed at each step�the error term can theoretically be completely eliminated in M steps by taking hm ����m� form �� �� � � � �M � However� the eigenvalues �m are generally unknown andcostly to compute� It is therefore unnecessary and impractical to set hm ����mfor m �� �� � � � �M � We will see that a few well chosen h�s can reduce whole clustersof eigenvectors associated with nearby ��s in the �m spectrum� This leads to theconcept of selectively annihilating clusters of eigenvectors from the error terms aspart of a total iteration process� This is the basis for the multigrid methods discussedin Chapter ���Let us consider the very important case when all of the �m are real and nega�

tive �remember that they arise from a conditioned matrix so this constraint is notunrealistic for quite practical cases�� Consider one of the error terms taken from

�eN � ��N � ��� MXm��

cm�xmNYn��

�� � �mhn� � ����

and write it in the form

cm�xmPe��m� � cm�xmNYn��

�� � �mhn� � ���

where Pe signi�es an �Euler� polynomial� Now focus attention on the polynomial

�Pe�N��� �� � h����� � h��� � � � �� � hN�� � �� �

treating it as a continuous function of the independent variable �� In the annihilationprocess mentioned after Eq� ���� we considered making the error exactly zero bytaking advantage of some knowledge about the discrete values of �m for a particularcase� Now we pose a less demanding problem� Let us choose the hn so that themaximum value of �Pe�N��� is as small as possible for all � lying between �a and �bsuch that �b � � � �a � �� Mathematically stated� we seek

max�b����a

j�Pe�N���j minimum � with�Pe�N��� � � ���

Page 193: Hydrodynamics - CFD

�� CHAPTER �� RELAXATION METHODS

This problem has a well known solution due to Markov� It is

�Pe�N���

TN

���� �a � �b

�a � �b

TN

���a � �b�a � �b

� � ���

where

TN�y� cos�N arccos y� � ���

are the Chebyshev polynomials along the interval �� � y � � and

TN�y� �

�y �

qy� � �

�N��

�y �

qy� � �

�N� ���

are the Chebyshev polynomials for jyj � �� In relaxation terminology this is generallyreferred to as Richardson�s method� and it leads to the nonstationary step size choicegiven by

hn �

���b � �a � ��b � �a� cos

���n� ����N

��� n �� �� � � �N � ���

Remember that all � are negative real numbers representing the magnitudes of �m inan eigenvalue spectrum�The error in the relaxation process represented by Eq� ��� is expressed in terms

of a set of eigenvectors� �xm� ampli�ed by the coe�cients cmQ�� � �mhn�� With each

eigenvector there is a corresponding eigenvalue� Eq� �� gives us the best choice of aseries of hn that will minimize the amplitude of the error carried in the eigenvectorsassociated with the eigenvalues between �b and �a�As an example for the use of Eq� ��� let us consider the following problem�

Minimize the maximum error associated with the � eigenvalues in theinterval �� � � � �� using only �iterations�

� ���

The three values of h which satisfy this problem are

hn ��

��� cos

���n� ���

��� ���

Page 194: Hydrodynamics - CFD

���� NONSTATIONARY PROCESSES ��

and the amplitude of the eigenvector is reduced to

�Pe����� T����� ���T���� � ���

where

T���� n�� �

p�� � ���

p��o�� � � ��

A plot of Eq� �� is given in Fig� �� and we see that the amplitudes of all theeigenvectors associated with the eigenvalues in the range �� � � � �� have beenreduced to less than about �( of their initial values� The values of h used in Fig� ��are

h� �����p��

h� ����� ��h� ���� �

p��

Return now to Eq� ���� This was derived from Eq� ��� on the condition that theexplicit Euler method� Eq� ���� was used to integrate the basic ODE�s� If insteadthe implicit trapezoidal rule

�n� �n ��

�h���n� � ��n� � � �

is used� the nonstationary formula

��N MXm��

cm�xmNYn��

�BB�� ��

�hn�m

�� ��hn�m

�CCA� ��� � � ��

would result� This calls for a study of the rational �trapezoidal� polynomial� Pt�

�Pt�N��� NYn��

�BB�� ��

�hn�

�� ��hn�

�CCA � � ��

under the same constraints as before� namely that

max�b����a

j�Pt�N���j minimum � � � ��

with �Pt�N��� �

Page 195: Hydrodynamics - CFD

�� CHAPTER �� RELAXATION METHODS

−2 −1.8 −1.6 −1.4 −1.2 −1 −0.8 −0.6 −0.4 −0.2 0

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

λ

(Pe )

3 (λ)

−2 −1.8 −1.6 −1.4 −1.2 −1 −0.8 −0.6 −0.4 −0.2 0−0.02

−0.015

−0.01

−0.005

0

0.005

0.01

0.015

0.02

λ

(Pe )

3 (λ)

Figure ��� Richardson�s method for � steps� minimization over �� � � � ���

Page 196: Hydrodynamics - CFD

���� PROBLEMS ��

The optimum values of h can also be found for this problem� but we settle here forthe approximation suggested by Wachspress

hn ��b

��a�b

��n����N���

� n �� �� � � � � N � � ��

This process is also applied to problem ��� The results for �Pt����� are shown inFig� ��� The error amplitude is about �"� of that found for �Pe����� in the sameinterval of �� The values of h used in Fig� �� are

h� �

h� p�

h� �

�� Problems

�� Given a relaxation method in the form

H���n A��n � �f

show that

��n Gn��� � �I �Gn�A�� �f

where G I �H��A�

�� For a linear system of the form �A� � A��x b� consider the iterative method

�I � A��%x �I � A��xn � b

�I � A��xn� �I � A��%x� b

where is a parameter� Show that this iterative method can be written in theform

H�xk� � xk� �A� � A��xk � b

Determine the iteration matrix G if ������� Using Appendix B��� �nd the eigenvalues of H��A for the SOR method with

A B�� � ����� �� and � �opt� �You do not have to �nd H��� Recall thatthe eigenvalues of H��A satisfy A�xm �mH�xm�� Find the numerical values�not just the expressions� Then �nd the corresponding j�mj values�

Page 197: Hydrodynamics - CFD

� CHAPTER �� RELAXATION METHODS

−2 −1.8 −1.6 −1.4 −1.2 −1 −0.8 −0.6 −0.4 −0.2 0

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

λ

(P

t )3 (

λ)

−2 −1.8 −1.6 −1.4 −1.2 −1 −0.8 −0.6 −0.4 −0.2 0−2

−1.5

−1

−0.5

0

0.5

1

1.5

2x 10

−3

λ

(P

t )3 (

λ)

Figure ��� Wachspress method for � steps� minimization over �� � � � ���

Page 198: Hydrodynamics - CFD

���� PROBLEMS �

�� Solve the following equation on the domain � � x � � with boundary conditionsu��� �� u��� ��

��u

�x�� �x �

For the initial condition� use u�x� �� Use secondorder centered di�erenceson a grid with �� cells �M � �� Iterate to steady state using

�a� the pointJacobi method�

�b� the GaussSeidel method�

�c� the SOR method with the optimum value of �� and

�d� the �step Richardson method derived in Section ���

Plot the solution after the residual is reduced by �� �� and � orders of magnitude� Plot the logarithm of the L�norm of the residual vs� the number ofiterations� Determine the asymptotic convergence rate� Compare with the theoretical asymptotic convergence rate�

Page 199: Hydrodynamics - CFD

� � CHAPTER �� RELAXATION METHODS

Page 200: Hydrodynamics - CFD

Chapter ��

MULTIGRID

The idea of systematically using sets of coarser grids to accelerate the convergence ofiterative schemes that arise from the numerical solution to partial di�erential equations was made popular by the work of Brandt� There are many variations of theprocess and many viewpoints of the underlying theory� The viewpoint presented hereis a natural extension of the concepts discussed in Chapter �

���� Motivation

������ Eigenvector and Eigenvalue Identi�cation with Space

Frequencies

Consider the eigensystem of the model matrix B������ ��� The eigenvalues andeigenvectors are given in Sections ����� and ������ respectively� Notice that as themagnitudes of the eigenvalues increase� the spacefrequency �or wavenumber� of thecorresponding eigenvectors also increase� That is� if the eigenvalues are ordered suchthat

j��j � j��j � � � � � j�M j ������

then the corresponding eigenvectors are ordered from low to high space frequencies�This has a rational explanation from the origin of the banded matrix� Note that

��

�x�sin�mx� �m� sin�mx� ������

and recall that

�xx�� �

�x�B������ ���� X

��

�x�D����

�X���� ������

� �

Page 201: Hydrodynamics - CFD

� � CHAPTER ��� MULTIGRID

where D���� is a diagonal matrix containing the eigenvalues� We have seen that

X���� represents a sine transform� and X��� a sine synthesis� Therefore� the opera

tion ��x�

D���� represents the numerical approximation of the multiplication of the

appropriate sine wave by the negative square of its wavenumber� �m�� One �ndsthat

�x��m

�M � �

����� � � cos

�m�

M � �

��� �m� � m �� M ������

Hence� the correlation of large magnitudes of �m with high spacefrequencies is to beexpected for these particular matrix operators� This is consistent with the physics ofdi�usion as well� However� this correlation is not necessary in general� In fact� thecomplete counterexample of the above association is contained in the eigensystem

for B��� � ������ For this matrix one �nds� from Appendix B� exactly the opposite

behavior�

������ Properties of the Iterative Method

The second key motivation for multigrid is the following�

� Many iterative methods reduce error components corresponding to eigenvaluesof large amplitude more e�ectively than those corresponding to eigenvalues ofsmall amplitude�

This is to be expected of an iterative method which is time accurate� It is alsotrue� for example� of the GaussSeidel method and� by design� of the Richardsonmethod described in Section ��� The classical pointJacobi method does not sharethis property� As we saw in Section ����� this method produces the same value of j�jfor �min and �max� However� the property can be restored by using h � �� as shownin Fig� ���When an iterative method with this property is applied to a matrix with the

above correlation between the modulus of the eigenvalues and the space frequency ofthe eigenvectors� error components corresponding to high space frequencies will bereduced more quickly than those corresponding to low space frequencies� This is thekey concept underlying the multigrid process�

���� The Basic Process

First of all we assume that the di�erence equations representing the basic partialdi�erential equations are in a form that can be related to a matrix which has certain

Page 202: Hydrodynamics - CFD

����� THE BASIC PROCESS � �

basic properties� This form can be arrived at �naturally� by simply replacing thederivatives in the PDE with di�erence schemes� as in the example given by Eq� �����or it can be �contrived� by further conditioning� as in the examples given by Eq� ����The basic assumptions required for our description of the multigrid process are�

�� The problem is linear�

�� The eigenvalues� �m� of the matrix are all real and negative�

�� The �m are fairly evenly distributed between their maximum and minimumvalues�

�� The eigenvectors associated with the eigenvalues having largest magnitudes canbe correlated with high frequencies on the di�erencing mesh�

�� The iterative procedure used greatly reduces the amplitudes of the eigenvectors

associated with eigenvalues in the range between �� j�jmax and j�jmax�

These conditions are su�cient to ensure the validity of the process described next�Having preconditioned �if necessary� the basic �nite di�erencing scheme by a pro

cedure equivalent to the multiplication by a matrix C� we are led to the startingformulation

C�Ab��� � �f b� � ������

where the matrix formed by the product CAb has the properties given above� In Eq�

����� the vector �f b represents the boundary conditions and the forcing function� if

any� and ��� is a vector representing the desired exact solution� We start with some

initial guess for ��� and proceed through n iterations making use of some iterativeprocess that satis�es property � above� We do not attempt to develop an optimumprocedure here� but for clarity we suppose that the threestep Richardson methodillustrated in Fig� �� is used� At the end of the three steps we �nd �r� the residual�where

�r C�Ab��� �f b� ������

Recall that the �� used to compute �r is composed of the exact solution ��� and theerror �e in such a way that

A�e��r � ������

where

A � CAb �����

Page 203: Hydrodynamics - CFD

� � CHAPTER ��� MULTIGRID

If one could solve Eq� ���� for �e then

��� ����e ���� �

Thus our goal now is to solve for �e� We can write the exact solution for �e in terms ofthe eigenvectors of A� and the � eigenvalues of the Richardson process in the form�

�e M�Xm��

cm�xm�Y

n��

����mhn�� �MX

m�M��

cm�xm�Y

n��

����mhn��� �z very low amplitude

�������

Combining our basic assumptions� we can be sure that the high frequency content of�e has been greatly reduced �about �( or less of its original value in the initial guess��In addition� assumption � ensures that the error has been smoothed�Next we construct a permutation matrix which separates a vector into two parts�

one containing the odd entries� and the other the even entries of the original vector�or any other appropriate sorting which is consistent with the interpolation approximation to be discussed below�� For a �point example�������������

e�e�e�e�e�e�e�

�������������

� � � � � � �� � � � � � �� � � � � � �� � � � � � �� � � � � � �� � � � � � �� � � � � � �

�������������

e�e�e�e�e�e�e�

�!

��ee�eo

� P�e �������

Multiply Eq� ���� from the left by P and� since a permutation matrix has an inversewhich is its transpose� we can write

PA�P��P ��e P�r �������

The operation PAP�� partitions the A matrix to form��� A� A�

A� A�

� � �ee�eo�

��re�ro

��������

Notice that

A��ee � A�

�eo �re �������

Page 204: Hydrodynamics - CFD

����� THE BASIC PROCESS � �

is an exact expression�At this point we make our one crucial assumption� It is that there is some connec

tion between �ee and �eo brought about by the smoothing property of the Richardsonrelaxation procedure� Since the top half of the frequency spectrum has been removed�it is reasonable to suppose that the odd points are the average of the even points�For example

e� � �

��ea � e��

e� � �

��e� � e��

e� � �

��e� � e�� or �eo A�

��ee �������

e� � �

��e� � eb�

It is important to notice that ea and eb represent errors on the boundaries where theerror is zero if the boundary conditions are given� It is also important to notice that weare dealing with the relation between �e and �r so the original boundary conditions andforcing function �which are contained in �f in the basic formulation� no longer appearin the problem� Hence� no aliasing of these functions can occur in subsequent steps�Finally� notice that� in this formulation� the averaging of �e is our only approximation�no operations on �r are required or justi�ed�If the boundary conditions are Dirichlet� ea and eb are zero� and one can write for

the example case

A��

������ � �� � �� � �� � �

� �������

With this approximation Eq� ����� reduces to

A��ee � A�A

���ee �re �������

or

Ac�ee ��re � ������

where

Ac �A� � A�A��� ����� �

Page 205: Hydrodynamics - CFD

� � CHAPTER ��� MULTIGRID

The form of Ac� the matrix on the coarse mesh� is completely determined by thechoice of the permutation matrix and the interpolation approximation� If the originalA had been B�� � ����� ��� our �point example would produce

PAP��

���������������

�� � ��� � �

�� � �

� ��� � ��

� � ��� ��

��� A� A�

A� A�

� �������

and Eq� ���� gives

A�z � ���� �� ����

��A�z � ���� � �� �� �

� ���

A�

�z � �������� �� ��

� Acz � ���� �� ���

��� �� ������ ��

� �������

If the boundary conditions are mixed DirichletNeumann� A in the �D modelequation is B����b� �� where �b ������� ����������T � The eigensystem is given byEq� B�� � It is easy to show that the high spacefrequencies still correspond to theeigenvalues with high magnitudes� and� in fact� all of the properties given in Section���� are met� However� the eigenvector structure is di�erent from that given inEq� ��� for Dirichlet conditions� In the present case they are given by

xjm sin

�j

���m� ����M � �

��! m �� �� � � � �M �������

and are illustrated in Fig� ����� All of them go through zero on the left �Dirichlet�side� and all of them re�ect on the right �Neumann� side�For Neumann conditions� the interpolation formula in Eq� ����� must be changed�

In the particular case illustrated in Fig� ����� eb is equal to eM � If Neumann conditionsare on the left� ea e�� When eb eM � the example in Eq� ����� changes to

A��

������ � �� � �� � �� � �

� �������

Page 206: Hydrodynamics - CFD

����� THE BASIC PROCESS � �

X

Figure ����� Eigenvectors for the mixed Dirichlet�Neumann case�

The permutation matrix remains the same and both A� and A� in the partitionedmatrix PAP�� are unchanged �only A� is modi�ed by putting �� in the lower rightelement�� Therefore� we can construct the coarse matrix from

A�z � ���� �� ����

��A�z � ���� � �� �� �

� ���

A�

�z � �������� �� ��

� Acz � ���� �� ���

��� �� ������ ����

� �������which gives us what we might have �expected��We will continue with Dirichlet boundary conditions for the remainder of this

Section� At this stage� we have reduced the problem from B������ ���e �r on the

�ne mesh to ��B������ ���ee �re on the next coarser mesh� Recall that our goal is

to solve for �e� which will provide us with the solution ��� using Eq� ��� � Given �eecomputed on the coarse grid �possibly using even coarser grids�� we can compute �eousing Eq� ������ and thus �e� In order to complete the process� we must now determinethe relationship between �ee and �e�In order to examine this relationship� we need to consider the eigensystems of A

and Ac�

A X#X��� Ac Xc#cX��c �������

For A B�M � ����� �� the eigenvalues and eigenvectors are

�m ����� cos

�m�

M � �

��� �xm sin

�j�

m�

M � �

���

j �� �� � � � �Mm �� �� � � � �M �������

Page 207: Hydrodynamics - CFD

� CHAPTER ��� MULTIGRID

Based on our assumptions� the most di�cult error mode to eliminate is that withm �� corresponding to

�� ����� cos

��

M � �

��� �x� sin

�j�

M � �

��� j �� �� � � � �M �������

For example� with M ��� �� �������� � If we restrict our attention to odd M �then Mc �M ����� is the size of Ac� The eigenvalue and eigenvector corresponding

to m � for the matrix Ac ��B�Mc� ����� �� are

��c�� ���� cos

���

M � �

��� ��xc�� sin

�j�

��

M � �

��� j �� �� � � � �Mc ������

For M �� �Mc ���� we obtain ��c�� ������� � �� ��� As M increases�

��c�� approaches ���� In addition� one can easily see that ��xc�� coincides with �x� at

every second point of the latter vector� that is� it contains the even elements of �x��Now let us consider the case in which all of the error consists of the eigenvector

component �x�� i�e�� �e �x�� Then the residual is

�r A�x� ���x� ����� �

and the residual on the coarse grid is

�re ����xc�� �������

since ��xc�� contains the even elements of �x�� The exact solution on the coarse gridsatis�es

�ee A��c�re Xc#

��c X��

c ����xc��

�������

��Xc#��c

������������

��������

��Xc

����������c�������

��������

Page 208: Hydrodynamics - CFD

����� THE BASIC PROCESS �

����c��

��xc��

�������

� �

���xc�� �������

Since our goal is to compute �e �x�� in addition to interpolating �ee to the �ne grid�using Eq� ������� we must multiply the result by �� This is equivalent to solving

�Ac�ee �re �������

or

�B�Mc � ����� ���ee �re �������

In our case� the matrix A B�M � ����� �� comes from a discretization of thedi�usion equation� which gives

Ab �

�x�B�M � ����� �� ������

and the preconditioning matrix C is simply

C �x�

�I ����� �

Applying the discretization on the coarse grid with the same preconditioning matrixas used on the �ne grid gives� since �xc ��x�

C�

�x�cB�Mc � ����� �� �x

�x�cB�Mc � ����� �� �

�B�Mc � ����� �� �������

which is precisely the matrix appearing in Eq� ������ Thus we see that the process isrecursive� The problem to be solved on the coarse grid is the same as that solved onthe �ne grid�The remaining steps required to complete an entire multigrid process are relatively

straightforward� but they vary depending on the problem and the user� The reductioncan be� and usually is� carried to even coarser grids before returning to the �nest level�However� in each case the appropriate permutation matrix and the interpolationapproximation de�ne both the down and upgoing paths� The details of �ndingoptimum techniques are� obviously� quite important but they are not discussed here�

Page 209: Hydrodynamics - CFD

��� CHAPTER ��� MULTIGRID

���� A Two�Grid Process

We now describe a twogrid process for the linear problem A�� �f � which can be easilygeneralized to a process with an arbitrary number of grids due to the recursive natureof multigrid� Extension to nonlinear problems requires that both the solution and theresidual be transferred to the coarse grid in a process known as full approximationstorage multigrid�

�� Perform n� iterations of the selected relaxation method on the �ne grid� startingwith �� ��n� Call the result ��

���� This gives�

����� Gn����n � �I �Gn�

� �A�� �f �������

where

G� I �H��� A� �������

and H� is de�ned as in Chapter �e�g�� Eq� ����� Next compute the residual based

on ������

�r��� A����� � �f AGn����n � A �I �Gn�

� �A�� �f � �f

AGn����n � AGn�

� A�� �f �������

�� Transfer �or restrict� �r��� to the coarse grid�

�r��� R���r

��� �������

In our example in the preceding section� the restriction matrix is

R��

��� � � � � � � �� � � � � � �� � � � � � �

� �������

that is� the �rst three rows of the permutation matrix P in Eq� ������ This type ofrestriction is known as �simple injection�� Some form of weighted restriction can alsobe used�

�� Solve the problem A��e��� �r��� on the coarse grid exactly��

�e��� A��� �r��� �������

�See problem of Chapter ���Note that the coarse grid matrix denoted A� here was denoted Ac in the preceding section�

Page 210: Hydrodynamics - CFD

����� A TWO�GRID PROCESS ���

Here A� can be formed by applying the discretization on the coarse grid� In the

preceding example �eq� ������� A� ��B�Mc � ����� ��� It is at this stage that the

generalization to a multigrid procedure with more than two grids occurs� If this is thecoarsest grid in the sequence� solve exactly� Otherwise� apply the twogrid processrecursively�

�� Transfer �or prolong� the error back to the �ne grid and update the solution�

��n� ����� � I���e��� �������

In our example� the prolongation matrix is

I��

�������������

��� � �� � ���� ��� �� � �� ��� ���� � �� � ���

�������

which follows from Eq� ������

Combining these steps� one obtains

��n� �I � I��A��� R�

�A�Gn����n � �I � I��A

��� R�

�A�Gn�� A�� �f � A�� �f ����� �

Thus the basic iteration matrix is

�I � I��A��� R�

�A�Gn�� �������

The eigenvalues of this matrix determine the convergence rate of the twogrid process�

The basic iteration matrix for a threegrid process is found from Eq� ����� byreplacing A��

� with �I �G���A

��� � where

G�� �I � I��A

��� R�

�A��Gn�� �������

In this expression n� is the number of relaxation steps on grid �� I�� and R�

� are thetransfer operators between grids � and �� and A� is obtained by discretizing on grid�� Extension to four or more grids proceeds in similar fashion�

Page 211: Hydrodynamics - CFD

��� CHAPTER ��� MULTIGRID

���� Problems

�� Derive Eq� ������

�� Repeat problem � of Chapter using a fourgrid multigrid method togetherwith

�a� the GaussSeidel method�

�b� the �step Richardson method derived in Section ���

Solve exactly on the coarsest grid� Plot the solution after the residual is reducedby �� �� and � orders of magnitude� Plot the logarithm of the L�norm of theresidual vs� the number of iterations� Determine the asymptotic convergencerate� Calculate the theoretical asymptotic convergence rate and compare�

Page 212: Hydrodynamics - CFD

Chapter ��

NUMERICAL DISSIPATION

Up to this point� we have emphasized the secondorder centereddi�erence approximations to the spatial derivatives in our model equations� We have seen that a centeredapproximation to a �rst derivative is nondissipative� i�e�� the eigenvalues of the associated circulant matrix �with periodic boundary conditions� are pure imaginary�In processes governed by nonlinear equations� such as the Euler and NavierStokesequations� there can be a continual production of highfrequency components of thesolution� leading� for example� to the production of shock waves� In a real physical problem� the production of high frequencies is eventually limited by viscosity�However� when we solve the Euler equations numerically� we have neglected viscouse�ects� Thus the numerical approximation must contain some inherent dissipation tolimit the production of highfrequency modes� Although numerical approximationsto the NavierStokes equations contain dissipation through the viscous terms� thiscan be insu�cient� especially at high Reynolds numbers� due to the limited grid resolution which is practical� Therefore� unless the relevant length scales are resolved�some form of added numerical dissipation is required in the numerical solution ofthe NavierStokes equations as well� Since the addition of numerical dissipation istantamount to intentionally introducing nonphysical behavior� it must be carefullycontrolled such that the error introduced is not excessive� In this Chapter� we discusssome di�erent ways of adding numerical dissipation to the spatial derivatives in thelinear convection equation and hyperbolic systems of PDE�s�

���

Page 213: Hydrodynamics - CFD

��� CHAPTER ��� NUMERICAL DISSIPATION

���� One�Sided First�Derivative Space Di�erenc�

ing

We investigate the properties of onesided spatial di�erence operators in the contextof the biconvection model equation given by

�u

�t �a�u

�x������

with periodic boundary conditions� Consider the following point operator for thespatial derivative term

�a��xu�j �a��x

���� � ��uj�� � ��uj � ��� ��uj��

�a��x

���uj�� � uj�� � ���uj�� � �uj � uj��� ������

The second form shown divides the operator into an antisymmetric component ��uj���uj�����x and a symmetric component ���uj�� � �uj � uj�����x� The antisymmetric component is the secondorder centered di�erence operator� With � �� theoperator is only �rstorder accurate� A backward di�erence operator is given by � �and a forward di�erence operator is given by � ���For periodic boundary conditions the corresponding matrix operator is

�a�x �a��x

Bp���� �� ��� �� ��

The eigenvalues of this matrix are

�m �a�x

!���� cos

���m

M

��� i sin

���m

M

�"for m �� �� � � � �M� �

If a is positive� the forward di�erence operator �� ��� produces Re��m� � ��the centered di�erence operator �� �� produces Re��m� �� and the backwarddi�erence operator produces Re��m� � �� Hence the forward di�erence operator isinherently unstable while the centered and backward operators are inherently stable�If a is negative� the roles are reversed� When Re��m� �� the solution will eithergrow or decay with time� In either case� our choice of di�erencing scheme producesnonphysical behavior� We proceed next to show why this occurs�

Page 214: Hydrodynamics - CFD

����� THE MODIFIED PARTIAL DIFFERENTIAL EQUATION ���

���� The Modi�ed Partial Di�erential Equation

First carry out a Taylor series expansion of the terms in Eq� ����� We are lead to theexpression

��xu�j �

��x

����x��u�x

�j

� ��x����u

�x�

�j

��x�

���u

�x�

�j

� ��x�

��

���u

�x�

�j

� � � �

�We see that the antisymmetric portion of the operator introduces odd derivativeterms in the truncation error while the symmetric portion introduces even derivatives�Substituting this into Eq� ���� gives

�u

�t �a�u

�x�a��x

��u

�x�� a�x�

��u

�x��a��x�

��

��u

�x�� � � � ������

This is the partial di�erential equation we are really solving when we apply theapproximation given by Eq� ���� to Eq� ����� Notice that Eq� ���� is consistent withEq� ����� since the two equations are identical when �x� �� However� when we usea computer to �nd a numerical solution of the problem� �x can be small but it isnot zero� This means that each term in the expansion given by Eq� ���� is excited tosome degree� We refer to Eq� ���� as the modi�ed partial di�erential equation� Weproceed next to investigate the implications of this concept�Consider the simple linear partial di�erential equation

�u

�t �a�u

�x� �

��u

�x��

��u

�x�� �

��u

�x�������

Choose periodic boundary conditions and impose an initial condition u ei�x� Underthese conditions there is a wavelike solution to Eq� ���� of the form

u�x� t� ei�xe�ris�t

provided r and s satisfy the condition

r � is �ia� �� � i � � ��

orr ���� � ���� s ��a � ��

The solution is composed of both amplitude and phase terms� Thus

u e����������� �z

amplitude

ei��x��a����t�� �z

phase

������

Page 215: Hydrodynamics - CFD

��� CHAPTER ��� NUMERICAL DISSIPATION

It is important to notice that the amplitude of the solution depends only upon � and� � the coe�cients of the even derivatives in Eq� ����� and the phase depends only ona and � the coe�cients of the odd derivatives�

If the wave speed a is positive� the choice of a backward di�erence scheme �� ��produces a modi�ed PDE with � � �� � � and hence the amplitude of the solutiondecays� This is tantamount to deliberately adding dissipation to the PDE� Under thesame condition� the choice of a forward di�erence scheme �� ��� is equivalent todeliberately adding a destabilizing term to the PDE�

By examining the term governing the phase of the solution in Eq� ����� we seethat the speed of propagation is a � �� Referring to the modi�ed PDE� Eq� ����we have �a�x���� Therefore� the phase speed of the numerical solution is lessthan the actual phase speed� Furthermore� the numerical phase speed is dependentupon the wavenumber � This we refer to as dispersion�

Our purpose here is to investigate the properties of onesided spatial di�erencingoperators relative to centered di�erence operators� We have seen that the threepoint centered di�erence approximation of the spatial derivative produces a modi�edPDE that has no dissipation �or ampli�cation�� One can easily show� by using theantisymmetry of the matrix di�erence operators� that the same is true for any centered di�erence approximation of a �rst derivative� As a corollary� any departurefrom antisymmetry in the matrix di�erence operator must introduce dissipation �orampli�cation� into the modi�ed PDE�

Note that the use of onesided di�erencing schemes is not the only way to introduce dissipation� Any symmetric component in the spatial operator introducesdissipation �or ampli�cation�� Therefore� one could choose � ��� in Eq� ����� Theresulting spatial operator is not onesided but it is dissipative� Biased schemes usemore information on one side of the node than the other� For example� a thirdorderbackwardbiased scheme is given by

��xu�j �

��x�uj�� � �uj�� � �uj � �uj��

���x��uj�� � uj�� � uj� � uj��

� �uj�� � �uj�� � �uj � �uj� � uj��� ������

The antisymmetric component of this operator is the fourthorder centered di�erenceoperator� The symmetric component approximates �x�uxxxx���� Therefore� thisoperator produces fourthorder accuracy in phase with a thirdorder dissipative term�

Page 216: Hydrodynamics - CFD

����� THE LAX�WENDROFF METHOD ���

���� The Lax�Wendro� Method

In order to introduce numerical dissipation using onesided di�erencing� backwarddi�erencing must be used if the wave speed is positive� and forward di�erencing mustbe used if the wave speed is negative� Next we consider a method which introducesdissipation independent of the sign of the wave speed� known as the LaxWendro�method� This explicit method di�ers conceptually from the methods considered previously in which spatial di�erencing and timemarching are treated separately�Consider the following Taylorseries expansion in time�

u�x� t� h� u� h�u

�t��

�h���u

�t��O�h�� ������

First replace the time derivatives with space derivatives according to the PDE �inthis case� the linear convection equation �u

�t� a�u

�x ��� Thus

�u

�t �a�u

�x�

��u

�t� a�

��u

�x������

Now replace the space derivatives with threepoint centered di�erence operators� giving

u�n��j u

�n�j � �

ah

�x�u

�n�j� � u

�n�j��� �

�ah

�x

��

�u�n�j� � �u�n�j � u

�n�j��� ���� �

This is the LaxWendro� method applied to the linear convection equation� It is afullydiscrete �nitedi�erence scheme� There is no intermediate semidiscrete stage�For periodic boundary conditions� the corresponding fullydiscrete matrix operator

is

�un� Bp

����

�� ah�x

�ah

�x

��� � �� � ah

�x

��

��

��� ah

�x�

�ah

�x

����A �un

The eigenvalues of this matrix are

�m ���ah

�x

�� ��� cos

���m

M

��� i

ah

�xsin���m

M

�for m �� �� � � � �M � �

For j ah xj � � all of the eigenvalues have modulus less than or equal to unity and hence

the method is stable independent of the sign of a� The quantity j ah xj is known as the

Courant �or CFL� number� It is equal to the ratio of the distance travelled by a wavein one time step to the mesh spacing�

Page 217: Hydrodynamics - CFD

�� CHAPTER ��� NUMERICAL DISSIPATION

The nature of the dissipative properties of the LaxWendro� scheme can be seenby examining the modi�ed partial di�erential equation� which is given by

�u

�t� a

�u

�x �a

���x� � a�h��

��u

�x�� a�h

��x� � a�h��

��u

�x�� � � �

This is derived by substituting Taylor series expansions for all terms in Eq� ��� andconverting the time derivatives to space derivatives using Eq� ���� The two leadingerror terms appear on the right side of the equation� Recall that the odd derivatives onthe right side lead to unwanted dispersion and the even derivatives lead to dissipation�or ampli�cation� depending on the sign�� Therefore� the leading error term in theLaxWendro� method is dispersive and proportional to

�a���x� � a�h��

��u

�x� �a�x

���� C�

n���u

�x�

The dissipative term is proportional to

�a�h

��x� � a�h��

��u

�x� �a

�h�x�

��� C�

n���u

�x�

This term has the appropriate sign and hence the scheme is truly dissipative as longas Cn � ��A closely related method is that of MacCormack� Recall MacCormack�s time

marching method� presented in Chapter ��

%un� un � hu�n

un� �

��un � %un� � h%u�n�� �������

If we use �rstorder backward di�erencing in the �rst stage and �rstorder forwarddi�erencing in the second stage�� a dissipative secondorder method is obtained� Forthe linear convection equation� this approach leads to

%u�n��j u

�n�j � ah

�x�u

�n�j � u

�n�j���

u�n��j

��u

�n�j � %u

�n��j � ah

�x�%u

�n��j� � %u�n��

j �� �������

which can be shown to be identical to the LaxWendro� method� Hence MacCormack�s method has the same dissipative and dispersive properties as the LaxWendro�method� The two methods di�er when applied to nonlinear hyperbolic systems� however�

�Or vice�versa for nonlinear problems� these should be applied alternately�

Page 218: Hydrodynamics - CFD

����� UPWIND SCHEMES ��

���� Upwind Schemes

In Section ����� we saw that numerical dissipation can be introduced in the spatialdi�erence operator using onesided di�erence schemes or� more generally� by addinga symmetric component to the spatial operator� With this approach� the directionof the onesided operator �i�e�� whether it is a forward or a backward di�erence�or the sign of the symmetric component depends on the sign of the wave speed�When a hyperbolic system of equations is being solved� the wave speeds can be bothpositive and negative� For example� the eigenvalues of the �ux Jacobian for the onedimensional Euler equations are u� u� a� u� a� When the �ow is subsonic� these areof mixed sign� In order to apply onesided di�erencing schemes to such systems� someform of splitting is required� This is avoided in the LaxWendro� scheme� However�as a result of their superior �exibility� schemes in which the numerical dissipationis introduced in the spatial operator are generally preferred over the LaxWendro�approach�Consider again the linear convection equation�

�u

�t� a

�u

�x � �������

where we do not make any assumptions as to the sign of a� We can rewrite Eq� �����as

�u

�t� �a � a��

�u

�x � ! a�

a jaj�

If a �� then a a � and a� �� Alternatively� if a � �� then a � anda� a � �� Now for the a � �� term we can safely backward di�erence and for thea� �� �� term forward di�erence� This is the basic concept behind upwind methods�that is� some decomposition or splitting of the �uxes into terms which have positiveand negative characteristic speeds so that appropriate di�erencing schemes can bechosen� In the next two sections� we present two splitting techniques commonly usedwith upwind methods� These are by no means unique�The above approach to obtaining a stable discretization independent of the sign

of a can be written in a di�erent� but entirely equivalent� manner� From Eq� ����� wesee that a stable discretization is obtained with � � if a � and with � �� ifa � �� This is achieved by the following point operator�

�a��xu�j ����x

�a��uj�� � uj�� � jaj��uj�� � �uj � uj��� �������

This approach is extended to systems of equations in Section �����In this section� we present the basic ideas of �uxvector and �uxdi�erence splitting�

For more subtle aspects of implementation and application of such techniques to

Page 219: Hydrodynamics - CFD

��� CHAPTER ��� NUMERICAL DISSIPATION

nonlinear hyperbolic systems such as the Euler equations� the reader is referred tothe literature on this subject�

������ Flux�Vector Splitting

Recall from Section ��� that a linear� constantcoe�cient� hyperbolic system of partialdi�erential equations given by

�u

�t��f

�x

�u

�t� A

�u

�x � �������

can be decoupled into characteristic equations of the form

�wi

�t� �i

�wi

�x � �������

where the wave speeds� �i� are the eigenvalues of the Jacobian matrix� A� and thewi�s are the characteristic variables� In order to apply a onesided �or biased� spatialdi�erencing scheme� we need to apply a backward di�erence if the wave speed� �i� ispositive� and a forward di�erence if the wave speed is negative� To accomplish this�let us split the matrix of eigenvalues� #� into two components such that

# # � #� �������

where

# #� j#j�

� #� #� j#j�

�������

With these de�nitions� # contains the positive eigenvalues and #� contains the negative eigenvalues� We can now rewrite the system in terms of characteristic variablesas

�w

�t� #

�w

�x

�w

�t� #�w

�x� #�

�w

�x � ������

The spatial terms have been split into two components according to the sign of thewave speeds� We can use backward di�erencing for the # �w

�xterm and forward

di�erencing for the #� �w�xterm� Premultiplying by X and inserting the product

X��X in the spatial terms gives

�Xw

�t��X#X��Xw

�x��X#�X��Xw

�x � ����� �

Page 220: Hydrodynamics - CFD

����� UPWIND SCHEMES ���

With the de�nitions�

A X#X��� A� X#�X�� �������

and recalling that u Xw� we obtain

�u

�t��Au

�x��A�u

�x � �������

Finally the split �ux vectors are de�ned as

f Au� f� A�u �������

and we can write

�u

�t��f

�x��f�

�x � �������

In the linear case� the de�nition of the split �uxes follows directly from the de�nition of the �ux� f Au� For the Euler equations� f is also equal to Au as a result oftheir homogeneous property� as discussed in Appendix C� Note that

f f � f� �������

Thus by applying backward di�erences to the f term and forward di�erences to thef� term� we are in e�ect solving the characteristic equations in the desired manner�This approach is known as �uxvector splitting�

When an implicit timemarching method is used� the Jacobians of the split �uxvectors are required� In the nonlinear case�

�f

�u A�

�f�

�u A� �������

Therefore� one must �nd and use the new Jacobians given by

A �f

�u� A��

�f�

�u�������

For the Euler equations� A has eigenvalues which are all positive� and A�� has allnegative eigenvalues�

�With these de�nitions A has all positive eigenvalues� and A� has all negative eigenvalues�

Page 221: Hydrodynamics - CFD

��� CHAPTER ��� NUMERICAL DISSIPATION

������ Flux�Di�erence Splitting

Another approach� more suited to �nitevolume methods� is known as �uxdi�erencesplitting� In a �nitevolume method� the �uxes must be evaluated at cell boundaries� We again begin with the diagonalized form of the linear� constantcoe�cient�hyperbolic system of equations

�w

�t� #

�w

�x � �������

The �ux vector associated with this form is g #w� Now� as in Chapter �� weconsider the numerical �ux at the interface between nodes j and j � �� 'gj��� as afunction of the states to the left and right of the interface� wL and wR� respectively�The centered approximation to gj��� which is nondissipative� is given by

'gj�� �

��g�wL� � g�wR�� ������

In order to obtain a onesided upwind approximation� we require

�'gi�j��

��i�wi�L if �i � ��i�wi�R if �i � �

����� �

where the subscript i indicates individual components of w and g� This is achievedwith

�'gi�j�� �

��i ��wi�L � �wi�R� �

�j�ij ��wi�L � �wi�R� �������

or

'gj�� �

�# �wL � wR� �

�j#j �wL � wR� �������

Now� as in Eq� ���� � we premultiply by X to return to the original variables andinsert the product X��X after # and j#j to obtain

X'gj�� �

�X#X��X �wL � wR� �

�Xj#jX��X �wL � wR� �������

and thus

'fj�� �

��fL � fR� �

�jAj �uL � uR� �������

where

jAj Xj#jX�� �������

Page 222: Hydrodynamics - CFD

����� ARTIFICIAL DISSIPATION ���

and we have also used the relations f Xg� u Xw� and A X#X���In the linear� constantcoe�cient case� this leads to an upwind operator which is

identical to that obtained using �uxvector splitting� However� in the nonlinear case�there is some ambiguity regarding the de�nition of jAj at the cell interface j � ����In order to resolve this� consider a situation in which the eigenvalues of A are all ofthe same sign� In this case� we would like our de�nition of 'fj�� to satisfy

'fj��

�fL if all �i

�s � �fR if all �i

�s � ��������

giving pure upwinding� If the eigenvalues of A are all positive� jAj A! if they areall negative� jAj �A� Hence satisfaction of Eq� ����� is obtained by the de�nition

'fj�� �

��fL � fR� �

�jAj��j �uL � uR� �������

if Aj�� satis�es

fL � fR Aj�� �uL � uR� �������

For the Euler equations for a perfect gas� Eq� ����� is satis�ed by the �ux Jacobianevaluated at the Roeaverage state given by

uj��

p�LuL �

p�RuRp

�L �p�R

������

Hj��

p�LHL �

p�RHRp

�L �p�R

����� �

where u and H �e � p��� are the velocity and the total enthalpy per unit mass�respectively��

���� Arti�cial Dissipation

We have seen that numerical dissipation can be introduced by using onesided differencing schemes together with some form of �ux splitting� We have also seen thatsuch dissipation can be introduced by adding a symmetric component to an antisymmetric �dissipationfree� operator� Thus we can generalize the concept of upwindingto include any scheme in which the symmetric portion of the operator is treated insuch a manner as to be truly dissipative�

�Note that the �ux Jacobian can be written in terms of u and H only see problem � at the endof this chapter�

Page 223: Hydrodynamics - CFD

��� CHAPTER ��� NUMERICAL DISSIPATION

For example� let

��axu�j uj� � uj����x

� ��sxu�j �uj� � �uj � uj��

��x�������

Applying �x �ax � �sx to the spatial derivative in Eq� ����� is stable if �i � andunstable if �i � �� Similarly� applying �x �ax � �sx is stable if �i � � and unstable if�i � �� The appropriate implementation is thus

�i�x �i�ax � j�ij�sx �������

Extension to a hyperbolic system by applying the above approach to the characteristicvariables� as in the previous two sections� gives

�x�Au� �ax�Au� � �sx�jAju� �������

or

�xf �axf � �sx�jAju� �������

where jAj is de�ned in Eq� ������ The second spatial term is known as arti�cialdissipation� It is also sometimes referred to as arti�cial di�usion or arti�cial viscosity�With appropriate choices of �ax and �sx� this approach can be related to the upwindapproach� This is particularly evident from a comparison of Eqs� ����� and ������It is common to use the following operator for �sx

��sxu�j �

�x�uj�� � �uj�� � �uj � �uj� � uj�� �������

where � is a problemdependent coe�cient� This symmetric operator approximates��x�uxxxx and thus introduces a thirdorder dissipative term� With an appropriatevalue of �� this often provides su�cient damping of high frequency modes withoutgreatly a�ecting the low frequency modes� For details of how this can be implementedfor nonlinear hyperbolic systems� the reader should consult the literature� A morecomplicated treatment of the numerical dissipation is also required near shock wavesand other discontinuities� but is beyond the scope of this book�

��� Problems

�� A secondorder backward di�erence approximation to a �st derivative is givenas a point operator by

��xu�j �

��x�uj�� � �uj�� � �uj�

Page 224: Hydrodynamics - CFD

����� PROBLEMS ���

�a� Express this operator in banded matrix form �for periodic boundary conditions�� then derive the symmetric and skewsymmetric matrices that havethe matrix operator as their sum� �See Appendix A�� to see how to construct the symmetric and skewsymmetric components of a matrix��

�b� Using a Taylor table� �nd the derivative which is approximated by thecorresponding symmetric and skewsymmetric operators and the leadingerror term for each�

�� Find the modi�ed wavenumber for the �rstorder backward di�erence operator�Plot the real and imaginary parts of ��x vs� �x for � � �x � �� UsingFourier analysis as in Section ������ �nd j�j for the combination of this spatialoperator with �thorder RungeKutta time marching at a Courant number ofunity and plot vs� �x for � � �x � ��

�� Find the modi�ed wavenumber for the operator given in Eq� ����� Plot the realand imaginary parts of ��x vs� �x for � � �x � �� Using Fourier analysisas in Section ������ �nd j�j for the combination of this spatial operator with�thorder RungeKutta time marching at a Courant number of unity and plotvs� �x for � � �x � ��

�� Consider the spatial operator obtained by combining secondorder centered differences with the symmetric operator given in Eq� ������ Find the modi�edwavenumber for this operator with � �� ����� ����� and ���� Plot the realand imaginary parts of ��x vs� �x for � � �x � �� Using Fourier analysisas in Section ������ �nd j�j for the combination of this spatial operator with�thorder RungeKutta time marching at a Courant number of unity and plotvs� �x for � � �x � ��

�� Consider the hyperbolic system derived in problem of Chapter �� Find thematrix jAj� Form the plusminus split �ux vectors as in Section �������

�� Show that the �ux Jacobian for the �D Euler equations can be written in termsof u and H� Show that the use of the Roe average state given in Eqs� ���� and���� leads to satisfaction of Eq� ������

Page 225: Hydrodynamics - CFD

��� CHAPTER ��� NUMERICAL DISSIPATION

Page 226: Hydrodynamics - CFD

Chapter ��

SPLIT AND FACTORED FORMS

In the next two chapters� we present and analyze split and factored algorithms� Thisgives the reader a feel for some of the modi�cations which can be made to the basicalgorithms in order to obtain e�cient solvers for practical multidimensional applications� and a means for analyzing such modi�ed forms�

���� The Concept

Factored forms of numerical operators are used extensively in constructing and applying numerical methods to problems in �uid mechanics� They are the basis for awide variety of methods variously known by the labels �hybrid�� �time split�� and�fractional step�� Factored forms are especially useful for the derivation of practicalalgorithms that use implicit methods� When we approach numerical analysis in thelight of matrix derivative operators� the concept of factoring is quite simple to presentand grasp� Let us start with the following observations�

�� Matrices can be split in quite arbitrary ways�

�� Advancing to the next time level always requires some reference to a previousone�

�� Time marching methods are valid only to some order of accuracy in the stepsize� h�

Now recall the generic ODE�s produced by the semidiscrete approach

d�u

dt A�u� �f ������

���

Page 227: Hydrodynamics - CFD

�� CHAPTER ��� SPLIT AND FACTORED FORMS

and consider the above observations� From observation � �arbitrary splitting of A� �

d�u

dt �A� �A���u� �f ������

where A �A� �A�� but A� and A� are not unique� For the time march let us choosethe simple� �rstorder�� explicit Euler method� Then� from observation � �new data�un� in terms of old �un��

�un� � I � hA� � hA���un � h�f �O�h�� ������

or its equivalent

�un� h� I � hA��� I � hA��� h�A�A�

i�un � h�f �O�h��

Finally� from observation � �allowing us to drop higher order terms �h�A�A��un��

�un� � I � hA��� I � hA���un � h�f �O�h�� ������

Notice that Eqs� ���� and ���� have the same formal order of accuracy and� inthis sense� neither one is to be preferred over the other� However� their numericalstability can be quite di�erent� and techniques to carry out their numerical evaluationcan have arithmetic operation counts that vary by orders of magnitude� Both of theseconsiderations are investigated later� Here we seek only to apply to some simple casesthe concept of factoring�

���� Factoring Physical Representations � Time

Splitting

Suppose we have a PDE that represents both the processes of convection and dissipation� The semidiscrete approach to its solution might be put in the form

d�u

dt Ac

�u�Ad�u� ��bc� ������

where Ac and Ad are matrices representing the convection and dissipation terms�respectively! and their sum forms the A matrix we have considered in the previoussections� Choose again the explicit Euler time march so that

�un� � I � hAd � hAc��un � h ��bc� �O�h�� ������

�Second�order time�marching methods are considered later�

Page 228: Hydrodynamics - CFD

����� FACTORING PHYSICAL REPRESENTATIONS � TIME SPLITTING ��

Now consider the factored form

�un� � I � hAd��� I � hAc��un � h ��bc�

� � I � hAd � hAc��un � h ��bc�� �z

Original Unfactored Terms

� h�Ad

�Ac�un � ��bc�

�� �z Higher Order Terms

�O�h�� ������

and we see that Eq� ���� and the original unfactored form Eq� ���� have identicalorders of accuracy in the time approximation� Therefore� on this basis� their selectionis arbitrary� In practical applications� equations such as ���� are often applied in apredictorcorrector sequence� In this case one could write

%un� � I � hAc��un � h ��bc�

�un� � I � hAd�%un� �����

Factoring can also be useful to form split combinations of implicit and explicittechniques� For example� another way to approximate Eq� ���� with the same orderof accuracy is given by the expression

�un� � I � hAd����� I � hAc��un � h ��bc�

� � I � hAd � hAc��un � h ��bc�� �z

Original Unfactored Terms

�O�h�� ���� �

where in this approximation we have used the fact that

� I � hAd��� I � hAd � h�A�

d � � � �

if h � jjAdjj � �� where jjAdjj is some norm of �Ad�� This time a predictorcorrectorinterpretation leads to the sequence

%un� � I � hAc��un � h ��bc�

� I � hAd��un� %un� �������

The convection operator is applied explicitly� as before� but the di�usion operator isnow implicit� requiring a tridiagonal solver if the di�usion term is central di�erenced�Since numerical sti�ness is generally much more severe for the di�usion process� thisfactored form would appear to be superior to that provided by Eq� ���� However�the important aspect of stability has yet to be discussed�

�We do not suggest that this particular method is suitable for use� We have yet to determine itsstability� and a �rst�order time�march method is usually unsatisfactory�

Page 229: Hydrodynamics - CFD

��� CHAPTER ��� SPLIT AND FACTORED FORMS

We should mention here that Eq� ��� can be derived for a di�erent point of viewby writing Eq� ���� in the form

un� � unh

Acun �Adun� � ��bc� �O�h��

Then� I � hAd�un� � I � hAc�un � h ��bc�

which is identical to Eq� ������

���� Factoring Space Matrix Operators in ��D

������ Mesh Indexing Convention

Factoring is widely used in codes designed for the numerical solution of equationsgoverning unsteady two and threedimensional �ows� Let us study the basic conceptof factoring by inspecting its use on the linear �D scalar PDE that models di�usion�

�u

�t

��u

�x����u

�y��������

We begin by reducing this PDE to a coupled set of ODE�s by di�erencing the spacederivatives and inspecting the resulting matrix operator�A clear description of a matrix �nitedi�erence operator in � and �D requires some

reference to a mesh� We choose the � � � point mesh� shown in the Sketch ������In this example Mx� the number of �interior� x points� is � and My� the number of�interior� y points is �� The numbers �� � �� � � � � � �� represent the location in themesh of the dependent variable bearing that index� Thus u�� represents the value ofu at j � and k ��

� � � �My � �� �� �� �� �k � �� �� �� �� �� � �� �� �� �� �

� � � �� j � � � Mx

Mesh indexing in �D�

�������

�This could also be called a � � � point mesh if the boundary points �labeled � in the sketch�were included� but in these notes we describe the size of a mesh by the number of interior points�

Page 230: Hydrodynamics - CFD

����� FACTORING SPACE MATRIX OPERATORS IN ��D ���

������ Data Bases and Space Vectors

The dimensioned array in a computer code that allots the storage locations of thedependent variable�s� is referred to as a data�base� There are many ways to lay outa database� Of these� we consider only two� ���� consecutively along rows that arethemselves consecutive from k � to My� and ���� consecutively along columns thatare consecutive from j � to Mx� We refer to each row or column group as aspace vector �they represent data along lines that are continuous in space� and labeltheir sum with the symbol U � In particular� ��� and ��� above are referred to as xvectors and yvectors� respectively� The symbol U by itself is not enough to identifythe structure of the database and is used only when the structure is immaterial orunderstood�To be speci�c about the structure� we label a data�base composed of xvectors with

U �x� � and one composed of yvectors with U �y�� Examples of the order of indexingfor these space vectors are given in Eq� ����� part a and b�

������ Data Base Permutations

The two vectors �arrays� are related by a permutation matrix P such that

U �x� PxyU�y� and U �y� PyxU

�x� �������

wherePyx PTxy P��xy

Now consider the structure of a matrix �nitedi�erence operator representing �point centraldi�erencing schemes for both space derivatives in two dimensions� Whenthe matrix is multiplying a space vector U � the usual �but ambiguous� representationis given by Axy� In this notation the ODE form of Eq� ����� can be written

dU

dt AxyU � ��bc� �������

If it is important to be speci�c about the database structure� we use the notationA�x�xy or A

�y�xy� depending on the data�base chosen for the U it multiplies� Examples

are in Eq� ����� part a and b� Notice that the matrices are not the same althoughthey represent the same derivative operation� Their structures are similar� however�and they are related by the same permutation matrix that relates U �x� to U �y�� Thus

A�x�xy Pxy � A�y�

xy � Pyx �������

�Notice that Axy and U � which are notations used in the special case of space vectors� are

subsets of A and �u� used in the previous sections�

Page 231: Hydrodynamics - CFD

��� CHAPTER ��� SPLIT AND FACTORED FORMS

A�x�xy � U �x�

�����������������������������

� x j o jx � x j o j

x � x j o jx � j o j

o j � x j oo j x � x j o

o j x � x j oo j x � j o

j o j � xj o j x � xj o j x � xj o j x �

����������������������������

a�Elements in �dimensional� centraldi�erence� matrixoperator� Axy� for ��� mesh shown in Sketch ������Data base composed of My x�vectors stored in U

�x��Entries for x� x� for y � o� for both � ��

A�y�xy � U �y�

�������������������������������

� o j x j jo � o j x j j

o � j x j j

x j � o j x jx j o � o j x j

x j o � j x j

j x j � o j xj x j o � o j xj x j o � j x

j j x j � oj j x j o � oj j x j o �

������������������������������

b� Elements in �dimensional� centraldi�erence� matrixoperator� Axy� for ��� mesh shown in Sketch ������Data base composed of Mx y�vectors stored in U

�y��Entries for x� x� for y � o� for both � ��

�������

Page 232: Hydrodynamics - CFD

����� FACTORING SPACE MATRIX OPERATORS IN ��D ���

������ Space Splitting and Factoring

We are now prepared to discuss splitting in two dimensions� It should be clear thatthe matrix A

�x�xy can be split into two matrices such that

A�x�xy A�x�

x � A�x�y �������

where A�x�x and A�x�

y are shown in Eq� ������ Similarily

A�y�xy A�y�

x � A�y�y ������

where the split matrices are shown in Eq� ������

The permutation relation also holds for the split matrices so

A�x�y PxyA

�y�y Pyx

and

A�x�x PxyA

�y�x Pyx

The splittings in Eqs� ����� and ���� can be combined with factoring in themanner described in Section ����� As an example ��rstorder in time�� applying theimplicit Euler method to Eq� ����� gives

U�x�n� U �x�

n � hhA�x�x � A�x�

y

iU

�x�n� � h ��bc�

or hI � hA�x�

x � hA�x�y

iU

�x�n� U �x�

n � h ��bc� �O�h�� ����� �

As in Section ����� we retain the same �rst order accuracy with the alternative

hI � hA�x�

x

ihI � hA�x�

y

iU

�x�n� U �x�

n � h ��bc� �O�h�� �������

Write this in predictorcorrector form and permute the data base of the second row�There results

hI � hA�x�

x

i%U �x� U �x�

n � h ��bc�hI � hA�y�

y

iU

�y�n� %U �y� �������

Page 233: Hydrodynamics - CFD

��� CHAPTER ��� SPLIT AND FACTORED FORMS

A�x�x � U �x�

�����������������������������

x x j jx x x j j

x x x j jx x j j

j x x jj x x x jj x x x jj x x j

j j x xj j x x xj j x x xj j x x

� U �x�

A�x�y � U �x�

�����������������������������

o j o jo j o j

o j o jo j o j

o j o j oo j o j o

o j o j oo j o j o

j o j oj o j oj o j oj o j o

� U �x�

The splitting of A�x�xy�

�������

Page 234: Hydrodynamics - CFD

����� FACTORING SPACE MATRIX OPERATORS IN ��D ���

A�y�x � U �y�

�������������������������������

x j x j jx j x j j

x j x j j

x j x j x jx j x j x j

x j x j x j

j x j x j xj x j x j xj x j x j x

j j x j xj j x j xj j x j x

� U �y�

A�y�y � U �y�

�������������������������������

o o j j jo o o j j j

o o j j j

j o o j jj o o o j jj o o j j

j j o o jj j o o o jj j o o j

j j j o oj j j o o oj j j o o

� U �y�

The splitting of A�y�xy�

�������

Page 235: Hydrodynamics - CFD

��� CHAPTER ��� SPLIT AND FACTORED FORMS

���� Second�Order Factored Implicit Methods

Secondorder accuracy in time can be maintained in a certain factored implicit methods� For example� apply the trapezoidal method to Eq� ����� where the derivativeoperators have been split as in Eq� ����� or ����� Let the data base be immaterial

and the ��bc� be time invariant� There results�I � �

�hAx � �

�hAy

�Un�

�I �

�hAx �

�hAy

�Un � h ��bc� �O�h�� �������

Factor both sides giving� �I � �

�hAx

��I � �

�hAy

�� ��h�AxAy

�Un�

� �

I ��

�hAx

��I �

�hAy

�� ��h�AxAy

�Un � h ��bc� �O�h�� �������

Then notice that the combination ��h��AxAy��Un� � Un� is proportional to h

� sincethe leading term in the expansion of �Un� � Un� is proportional to h� Therefore� wecan write�

I � ��hAx

��I � �

�hAy

�Un�

�I �

�hAx

��I �

�hAy

�Un � h ��bc� �O�h���������

and both the factored and unfactored form of the trapezoidal method are secondorderaccurate in the time march�An alternative form of this kind of factorization is the classical ADI �alternating

direction implicit� method� usually written�I � �

�hAx

�%U

�I �

�hAy

�Un �

�hFn�

I � ��hAy

�Un�

�I �

�hAx

�%U �

�hFn� �O�h�� �������

For idealized commuting systems the methods given by Eqs� ����� and ����� di�eronly in their evaluation of a timedependent forcing term�

���� Importance of Factored Forms in � and � Di�

mensions

When the timemarch equations are sti� and implicit methods are required to permitreasonably large time steps� the use of factored forms becomes a very valuable tool

�A form of the Douglas or Peaceman�Rachford methods�

Page 236: Hydrodynamics - CFD

����� IMPORTANCE OF FACTORED FORMS IN � AND � DIMENSIONS ���

for realistic problems� Consider� for example� the problem of computing the timeadvance in the unfactored form of the trapezoidal method given by Eq� ������

I � ��hAxy

�Un�

�I �

�hAxy

�Un � h ��bc�

Forming the right hand side poses no problem� but �nding Un� requires the solutionof a sparse� but very large� set of coupled simultaneous equations having the matrixform shown in Eq� ����� part a and b� Furthermore� in real cases involving the Euleror NavierStokes equations� each symbol �o� x� �� represents a � � � block matrix withentries that depend on the pressure� density and velocity �eld� Suppose we were tosolve the equations directly� The forward sweep of a simple Gaussian elimination �lls�

all of the � � � blocks between the main and outermost diagonal� �e�g� between �and o in Eq� ����� part b��� This must be stored in computer memory to be used to�nd the �nal solution in the backward sweep� If Ne represents the order of the smallblock matrix �� in the �D Euler case�� the approximate memory requirement is

�Ne �My� � �Ne �My� �Mx

�oating point words� Here it is assumed that My � Mx� If My � Mx� My and Mx

would be interchanged� A moderate mesh of �� � ��� points would require over ��million words to �nd the solution� Actually current computer power is able to coperather easily with storage requirements of this order of magnitude� With computingspeeds of over one giga�op�� direct solvers may become useful for �nding steadystatesolutions of practical problems in two dimensions� However� a threedimensionalsolver would require a memory of approximatly

N�e �M�

y �M�z �Mx

words and� for well resolved �ow �elds� this probably exceeds memory availability forsome time to come�On the other hand� consider computing a solution using the factored implicit equa

tion ������ Again computing the right hand side poses no problem� Accumulate theresult of such a computation in the array �RHS�� One can then write the remainingterms in the twostep predictorcorrector form�

I � ��hA�x�

x

�%U �x� �RHS��x��

I � ��hA�y�

y

�U

�y�n� %U �y� ������

�For matrices as small as those shown there are many gaps in this ��ll�� but for meshes ofpractical size the �ll is mostly dense�

�The lower band is also computed but does not have to be saved unless the solution is to berepeated for another vector�

One billion �oating�point operations per second�

Page 237: Hydrodynamics - CFD

�� CHAPTER ��� SPLIT AND FACTORED FORMS

which has the same appearance as Eq� ����� but is secondorder time accurate� The�rst step would be solved using My uncoupled block tridiagonal solvers

�� Inspectingthe top of Eq� ������ we see that this is equivalent to solving My one�dimensionalproblems� each with Mx blocks of order Ne� The temporary solution %U

�x� would thenbe permuted to %U �y� and an inspection of the bottom of Eq� ����� shows that the �nalstep consists of solving Mx one�dimensional implicit problems each with dimensionMy�

��� The Delta Form

Clearly many ways can be devised to split the matrices and generate factored forms�One way that is especially useful� for ensuring a correct steadystate solution in aconverged timemarch� is referred to as the �delta form� and we develop it next�Consider the unfactored form of the trapezoidal method given by Eq� ������ and

let the ��bc� be time invariant��I � �

�hAx � �

�hAy

�Un�

�I �

�hAx �

�hAy

�Un � h ��bc� �O�h��

From both sides subtract �I � �

�hAx � �

�hAy

�Un

leaving the equality unchanged� Then� using the standard de�nition of the di�erenceoperator ��

�Un Un� � Un

one �nds �I � �

�hAx � �

�hAy

��Un h

hAxyUn � ��bc�

i�O�h�� ����� �

Notice that the right side of this equation is the product of h and a term that isidentical to the right side of Eq� ������ our original ODE� Thus� if Eq� ���� converges�it is guaranteed to converge to the correct steadystate solution of the ODE� Now wecan factor Eq� ���� and maintain O�h�� accuracy� We arrive at the expression�

I � ��hAx

��I � �

�hAy

��Un h

hAxyUn � ��bc�

i�O�h�� �������

This is the delta form of a factored� �ndorder� �D equation�

�A block tridiagonal solver is similar to a scalar solver except that small block matrix operationsreplace the scalar ones� and matrix multiplications do not commute�

Page 238: Hydrodynamics - CFD

���� PROBLEMS ��

The point at which the factoring is made may not a�ect the order of timeaccuracy�but it can have a profound e�ect on the stability and convergence properties of amethod� For example� the unfactored form of a �rstorder method derived from theimplicit Euler time march is given by Eq� ���� � and if it is immediately factored�the factored form is presented in Eq� ������ On the other hand� the delta form of theunfactored Eq� ���� is

�I � hAx � hAy��Un hhAxyUn � ��bc�

iand its factored form becomes��

�I � hAx��I � hAy��Un hhAxyUn � ��bc�

i�������

In spite of the similarities in derivation� we will see in the next chapter that theconvergence properties of Eq� ����� and Eq� ����� are vastly di�erent�

��� Problems

�� Consider the �D heat equation�

�u

�t �

��u

�x�� � x �

Let u��� t� � and u� � t� �� so that we can simplify the boundary conditions�Assume that second order central di�erencing is used� i�e��

��xxu�j �

�x��uj�� � �uj � uj��

The uniform grid has �x � and interior points�

�a� Space vector de�nition

i� What is the space vector for the natural ordering �monotonically increasing in index�� u��� � Only include the interior points�

ii� If we reorder the points with the odd points �rst and then the evenpoints� write the space vector� u��� �

iii� Write down the permutation matrices��P���P����

��Notice that the only di�erence between the O�h�� method given by Eq� ���� and the O�h�

method given by Eq� ��� is the appearance of the factor � on the left side of the O�h�� method�

Page 239: Hydrodynamics - CFD

��� CHAPTER ��� SPLIT AND FACTORED FORMS

iv� The generic ODE representing the discrete form of the heat equationis

du���

dt A�u

��� � f

Write down the matrix A�� �Note f �� due to the boundary conditions� Next �nd the matrix A� such that

du���

dt A�u

���

Note that A� can be written as

A�

���D UT

U D

�De�ne D and U �

v� Applying implicit Euler time marching� write the delta form of theimplicit algorithm� Comment on the form of the resulting implicitmatrix operator�

�b� System de�nition

In problem �a� we de�ned u���� u���� A�� A�� P��� and P�� which partitionthe odd points from the even points� We can put such a partitioning touse� First de�ne extraction operators

I�o�

��������������

� � � �� � � �� � � �� � � �

� � � �� � � �� � � �� � � �

� � � �� � � �� � � �� � � �

� � � �� � � �� � � �� � � �

��� I� ��

�� ��

I�e�

��������������

� � � �� � � �� � � �� � � �

� � � �� � � �� � � �� � � �

� � � �� � � �� � � �� � � �

� � � �� � � �� � � �� � � �

��� �� ��

�� I�

Page 240: Hydrodynamics - CFD

���� PROBLEMS ���

which extract the odd even points from u��� as follows� u�o� I�o�u��� andu�e� I�e�u����

i� Beginning with the ODE written in terms of u���� de�ne a splittingA� Ao � Ae� such that Ao operates only on the odd terms� and Ae

operates only on the even terms� Write out the matrices Ao and Ae�Also� write them in terms of D and U de�ned above�

ii� Apply implicit Euler time marching to the split ODE� Write down thedelta form of the algorithm and the factored delta form� Comment onthe order of the error terms�

iii� Examine the implicit operators for the factored delta form� Commenton their form� You should be able to argue that these are now trangular matrices �a lower and an upper�� Comment on the solution processthis gives us relative to the direct inversion of the original system�

Page 241: Hydrodynamics - CFD

��� CHAPTER ��� SPLIT AND FACTORED FORMS

Page 242: Hydrodynamics - CFD

Chapter ��

LINEAR ANALYSIS OF SPLIT

AND FACTORED FORMS

In Section ��� we introduced the concept of the representative equation� and usedit in Chapter � to study the stability� accuracy� and convergence properties of timemarching schemes� The question is� Can we �nd a similar equation that will allowus to evaluate the stability and convergence properties of split and factored schemes�The answer is yes � for certain forms of linear model equations�

The analysis in this chapter is useful for estimating the stability and steadystateproperties of a wide variety of timemarching schemes that are variously referredto as timesplit� fractionalstep� hybrid� and �approximately� factored� When thesemethods are applied to practical problems� the results found from this analysis areneither necessary nor su�cient to guarantee stability� However� if the results indicatethat a method has an instability� the method is probably not suitable for practicaluse�

���� The Representative Equation for Circulant

Operators

Consider linear PDE�s with coe�cients that are �xed in both space and time and withboundary conditions that are periodic� We have seen that under these conditionsa semidiscrete approach can lead to circulant matrix di�erence operators� and wediscussed circulant eigensystems� in Section ���� In this and the following sectionwe assume circulant systems and our analysis depends critically on the fact that allcirculant matrices commute and have a common set of eigenvectors�

�See also the discussion on Fourier stability analysis in Section ����

���

Page 243: Hydrodynamics - CFD

��� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

Suppose� as a result of space di�erencing the PDE� we arrive at a set of ODE�sthat can be written

d�u

dt Aap

�u�Abp�u� �f�t� ������

where the subscript p denotes a circulant matrix� Since both matrices have the sameset of eigenvectors� we can use the arguments made in Section ����� to uncouple theset and form the M set of independent equations

w�� ��a � �b��w� � g��t����

w�m ��a � �b�mwm � gm�t�

���

w�M ��a � �b�MwM � gM�t� ������

The analytic solution of the m�th line is

wm�t� cme��a�b�mt � P�S�

Note that each �a pairs with one� and only one�� �b since they must share a common

eigenvector� This suggests �see Section ����

The representative equation for split� circulant systems is

du

dt ��a � �b � �c � � � ��u� ae�t ������

where �a � �b � �c � � � � are the sum of the eigenvalues in Aa � Ab � Ac � � � � thatshare the same eigenvector�

���� Example Analysis of Circulant Systems

������ Stability Comparisons of Time�Split Methods

Consider as an example the linear convectiondi�usion equation�

�u

�t� a

�u

�x �

��u

�x�������

�This is to be contrasted to the developments found later in the analysis of ��D equations�

Page 244: Hydrodynamics - CFD

����� EXAMPLE ANALYSIS OF CIRCULANT SYSTEMS ���

If the space di�erencing takes the form

d�u

dt � a

��xBp���� �� ���u� �

�x�Bp������ ���u ������

the convection matrix operator and the di�usion matrix operator� can be representedby the eigenvalues �c and �d� respectively� where �see Section �������

��c�m ia

�xsin �m

��d�m � ��

�x�sin�

�m�

������

In these equations �m �m��M � m � � � � � � � � M � � � so that � � �m � ���Using these values and the representative equation ����� we can analyze the stabilityof the two forms of simple timesplitting discussed in Section ����� In this section werefer to these as

�� the explicitimplicit Euler method� Eq� ������

�� the explicitexplicit Euler method� Eq� ����

�� The Explicit�Implicit Method

When applied to Eq� ����� the characteristic polynomial of this method is

P �E� ��� h�d�E � �� � h�c�

This leads to the principal � root

� � � i

ah

�xsin �m

� � �h�

�x�sin�

�m�

where we have made use of Eq� ���� to quantify the eigenvalues� Now introduce thedimensionless numbers

Cn ah

�x� Courant number

R a�x

�� mesh Reynolds number

and we can write for the absolute value of �

j�j q� � C�

n sin� �m

� � �Cn

R sin�

�m�

� � � �m � �� ������

Page 245: Hydrodynamics - CFD

��� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

0 4 8

R∆

C n

0

0.4

0.8

1.2

C n R∆= 2/

Explicit-Implicit

0 4 8

R∆

C n

0

0.4

0.8

1.2

Explicit-Explicit

C n

R∆= 2/C n

R∆= /2

Figure ����� *Stability regions for two simple timesplit methods�

A simple numerical parametric study of Eq� ���� shows that the critical range of�m for any combination of Cn and R occurs when �m is near � �or ���� From thiswe �nd that the condition on Cn and R that make j�j � � is

h� � C�

n sin� �i �� � �

Cn

R sin�

��As �� � this gives the stability region

Cn ��

R

which is bounded by a hyperbola and shown in Fig� �����

�� The Explicit�Explicit Method

An analysis similar to the one given above shows that this method produces

j�j q� � C�

n sin� �m

��� �Cn

R

sin��m�

�� � � �m � ��

Again a simple numerical parametric study shows that this has two critical rangesof �m� one near �� which yields the same result as in the previous example� and the

Page 246: Hydrodynamics - CFD

����� EXAMPLE ANALYSIS OF CIRCULANT SYSTEMS ���

other near ��o� which produces the constraint that

Cn ��

�R for R � �

The resulting stability boundary is also shown in Fig� ����� The totaly explicit�factored method has a much smaller region of stability when R is small� as weshould have expected�

������ Analysis of a Second�Order Time�Split Method

Next let us analyze a more practical method that has been used in serious computational analysis of turbulent �ows� This method applies to a �ow in which there isa combination of di�usion and periodic convection� The convection term is treatedexplicitly using the secondorder AdamsBashforth method� The di�usion term isintegrated implicitly using the trapezoidal method� Our model equation is again thelinear convectiondi�usion equation ���� which we split in the fashion of Eq� ����� Inorder to evaluate the accuracy� as well as the stability� we include the forcing function in the representative equation and study the e�ect of our hybrid� timemarchingmethod on the equation

u� �cu� �du� ae�t

First let us �nd expressions for the two polynomials� P �E� and Q�E�� The characteristic polynomial follows from the application of the method to the homogeneousequation� thus

un� un ��

�h�c��un � un��� �

�h�d�un� � un�

This produces

P �E� ��� ��h�d�E

� � �� � ��h�c �

�h�d�E �

�h�c

The form of the particular polynomial depends upon whether the forcing function iscarried by the AB� method or by the trapezoidal method� In the former case it is

Q�E� �

�h��E � �� �����

and in the latter

Q�E� �

�h�E� � E� ���� �

Page 247: Hydrodynamics - CFD

�� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

Accuracy

From the characteristic polynomial we see that there are two ��roots and they aregiven by the equation

� � �

�h�c �

�h�d

s�� �

�h�c �

�h�d

��� �h�c

��� �

�h�d

����� �

�h�d

� �������

The principal �root follows from the plus sign and one can show

�� � � ��c � �d�h��

���c � �d�

�h� ��

���d � �c�

�d � ��c�d � ��c

�h�

From this equation it is clear that ���� ����c � �d�

� does not match the coe�cient

of h� in ��� soer� O�h��

Using P �e�h� and Q�e�h� to evaluate er� in Section ������ one can show

er� O�h��

using either Eq� ��� or Eq� ��� � These results show that� for the model equation�the hybrid method retains the secondorder accuracy of its individual components�

Stability

The stability of the method can be found from Eq� ����� by a parametric study of cnand R de�ned in Eq� ����� This was carried out in a manner similar to that usedto �nd the stability boundary of the �rstorder explicitimplicit method in Section������� The results are plotted in Fig� ����� For values of R � this secondordermethod has a much greater region of stability than the �rstorder explicitimplicitmethod given by Eq� ����� and shown in Fig� �����

���� The Representative Equation for Space�Split

Operators

Consider the �D model� equations

�u

�t

��u

�x����u

�y��������

�The extension of the following to ��D is simple and straightforward�

Page 248: Hydrodynamics - CFD

����� THE REPRESENTATIVE EQUATION FOR SPACE�SPLIT OPERATORS��

R∆

0 4 8

0.4

0.8

1.2

Cn

Stable

Figure ����� *Stability regions for the secondorder timesplit method�

and

�u

�t� ax

�u

�x� ay

�u

�y � �������

Reduce either of these� by means of spatial di�erencing approximations� to the coupledset of ODE�s�

dU

dt �Ax � Ay�U � ��bc� �������

for the space vector U � The form of the Ax and Ay matrices for threepoint centraldi�erencing schemes are shown in Eqs� ����� and ����� for the � � � mesh shownin Sketch ������ Let us inspect the structure of these matrices closely to see how wecan diagonalize �Ax � Ay� in terms of the individual eigenvalues of the two matricesconsidered separately�First we write these matrices in the form

A�x�x

���B BB

� A�x�y

��� %b� � I %b� � I%b�� � I %b� � I %b� � I

%b�� � I %b� � I

�where B is a banded matrix of the form B�b��� b�� b��� Now �nd the block eigenvector

Page 249: Hydrodynamics - CFD

��� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

matrix that diagonalizes B and use it to diagonalize A�x�x � Thus���X

��

X��

X��

����B B

B

����X X

X

� ���# #

#

�where

#

�������

����

��

�Notice that the matrix A�x�

y is transparent to this transformation� That is� if weset X � diag�X�

X��

��� %b� � I %b� � I%b�� � I %b� � I %b� � I

%b�� � I %b� � I

�X

��� %b� � I %b� � I%b�� � I %b� � I %b� � I

%b�� � I %b� � I

�One now permutes the transformed system to the yvector database using the permutation matrix de�ned by Eq� ������ There results

Pyx �X��hA�x�x � A�x�

y

iX � Pxy �����

�� � I�� � I

�� � I�� � I

��������%B

%B%B

%B

� �������

where %B is the banded tridiagonal matrix B�%b���%b��%b��� see the bottom of Eq� ������Next �nd the eigenvectors %X that diagonalize the %B blocks� Let %B � diag� %B� and%X � diag� %X� and form the second transformation

%X�� %B %X

�����%#

%#%#

%#

� � %#

��� %�� %��%��

�This time� by the same argument as before� the �rst matrix on the right side ofEq� ����� is transparent to the transformation� so the �nal result is the completediagonalization of the matrix Axy�h

%X�� � Pyx �X��ihA

�x�xy

ihX � Pxy � %X

i ������

��I � %#

��I � %#

��I � %#

��I � %#

� �������

Page 250: Hydrodynamics - CFD

����� THE REPRESENTATIVE EQUATION FOR SPACE�SPLIT OPERATORS���

It is important to notice that�

� The diagonal matrix on the right side of Eq� ����� contains every possible combination of the individual eigenvalues of B and %B�

Now we are ready to present the representative equation for two dimensional systems� First reduce the PDE to ODE by some choice� of space di�erencing� Thisresults in a spatially split A matrix formed from the subsets

A�x�x diag�B� � A�y�

y diag� %B� �������

where B and %B are any two matrices that have linearly independent eigenvectors �thisputs some constraints on the choice of di�erencing schemes��

Although Ax and Ay do commute� this fact� by itself� does not ensure the property of �all possible combinations�� To obtain the latter property the structure ofthe matrices is important� The block matrices B and %B can be either circulant ornoncirculant! in both cases we are led to the �nal result�

The ��D representative equation for model linear systems is

du

dt ��x � �y�u� ae�t

where �x and �y are any combination of eigenvalues from Ax and Ay� a and are�possibly complex� constants� and where Ax and Ay satisfy the conditions in ������

Often we are interested in �nding the value of� and the convergence rate to� thesteadystate solution of the representative equation� In that case we set � anduse the simpler form

du

dt ��x � �y�u� a �������

which has the exact solution

u�t� ce��x�y�t � a

�x � �y������

�We have used ��point central di�erencing in our example� but this choice was for convenienceonly� and its use is not necessary to arrive at Eq� �� ��

Page 251: Hydrodynamics - CFD

��� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

���� Example Analysis of ��D Model Equations

In the following we analyze four di�erent methods for �nding a �xed� steadystatesolution to the �D representative equation ������ In each case we examine

�� The stability�

�� The accuracy of the �xed� steadystate solution�

�� The convergence rate to reach the steadystate�

������ The Unfactored Implicit Euler Method

Consider �rst this unfactored� �rstorder scheme which can then be used as a referencecase for comparison with the various factored ones� The form of the method is givenby Eq� ���� � and when it is applied to the representative equation� we �nd

��� h �x � h �y�un� un � ha

from which

P �E� ��� h �x � h �y�E � �Q�E� h ����� �

giving the solution

un c

��

�� h �x � h �y

�n� a

�x � �y

Like its counterpart in the �D case� this method�

�� Is unconditionally stable�

�� Produces the exact �see Eq� ����� steadystate solution �of the ODE� for anyh�

�� Converges very rapidly to the steadystate when h is large�

Unfortunately� however� use of this method for �D problems is generally impracticalfor reasons discussed in Section �����

Page 252: Hydrodynamics - CFD

����� EXAMPLE ANALYSIS OF ��D MODEL EQUATIONS ���

������ The Factored Nondelta Form of the Implicit Euler

Method

Now apply the factored Euler method given by Eq� ����� to the �D representativeequation� There results

��� h �x���� h �y�un� un � ha

from which

P �E� ��� h �x���� h �y�E � �Q�E� h �������

giving the solution

un c

��

��� h �x���� h �y�

�n� a

�x � �y � h�x�y

We see that this method�

�� Is unconditionally stable�

�� Produces a steady state solution that depends on the choice of h�

�� Converges rapidly to a steadystate for large h� but the converged solution iscompletely wrong�

The method requires far less storage then the unfactored form� However� it is notvery useful since its transient solution is only �rstorder accurate and� if one tries totake advantage of its rapid convergence rate� the converged value is meaningless�

������ The Factored Delta Form of the Implicit Euler Method

Next apply Eq� ����� to the �D representative equation� One �nds

��� h �x���� h �y��un� � un� h��xun � �yun � a�

which reduces to

��� h �x���� h �y�un� �� � h��x�y

�un � ha

and this has the solution

un c

�� � h��x�y

��� h �x���� h �y�

�n� a

�x � �y

This method�

Page 253: Hydrodynamics - CFD

��� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

�� Is unconditionally stable�

�� Produces the exact steadystate solution for any choice of h�

�� Converges very slowly to the steady�state solution for large values of h� sincej�j � � as h���

Like the factored nondelta form� this method demands far less storage than the unfactored form� as discussed in Section ����� The correct steady solution is obtained�but convergence is not nearly as rapid as that of the unfactored form�

������ The Factored Delta Form of the Trapezoidal Method

Finally consider the delta form of a secondorder timeaccurate method� Apply Eq������ to the representative equation and one �nds�

�� ��h�x

���� �

�h�y

��un� � un� h��xun � �yun � a�

which reduces to��� �

�h�x

���� �

�h�y

�un�

�� �

�h�x

��� �

�h�y

�un � ha

and this has the solution

un c

������ �

�h�x

��� �

�h�y

���� �

�h�x

���� �

�h�y

��n

� a

�x � �y

This method�

�� Is unconditionally stable�

�� Produces the exact steady�state solution for any choice of h�

�� Converges very slowly to the steady�state solution for large values of h� sincej�j � � as h���

All of these properties are identical to those found for the factored delta form of theimplicit Euler method� Since it is second order in time� it can be used when timeaccuracy is desired� and the factored delta form of the implicit Euler method can beused when a converged steadystate is all that is required�� A brief inspection of eqs������ and ����� should be enough to convince the reader that the ��s produced bythose methods are identical to the � produced by this method�

�In practical codes� the value of h on the left side of the implicit equation is literally switched

from h to �h�

Page 254: Hydrodynamics - CFD

����� EXAMPLE ANALYSIS OF THE ��D MODEL EQUATION ���

���� Example Analysis of the ��D Model Equation

The arguments in Section ���� generalize to three dimensions and� under the conditions given in ����� with an A�z�

z included� the model �D cases� have the followingrepresentative equation �with ���

du

dt ��x � �y � �z�u� a �������

Let us analyze a �ndorder accurate� factored� delta form using this equation� Firstapply the trapezoidal method�

un� un ��

�h���x � �y � �z�un� � ��x � �y � �z�un � �a�

Rearrange terms���� �

�h��x � �y � �z�

�un�

�� �

�h��x � �y � �z�

�un � ha

Put this in delta form���� �

�h��x � �y � �z�

��un h���x � �y � �z�un � a�

Now factor the left side���� �

�h�x

���� �

�h�y

���� �

�h�z

��un h���x � �y � �z�un � a� �������

This preserves second order accuracy since the error terms

�h���x�y � �x�z � �y�z��un and

h��x�y�z

are both O�h��� One can derive the characteristic polynomial for Eq� ������ �nd the� root� and write the solution either in the form

un c

����� ��

�h��x � �y � �z� �

�h���x�y � �x�z � �y�z�� �

h��x�y�z

�� ��h��x � �y � �z� �

�h���x�y � �x�z � �y�z�� �

h��x�y�z

�n

� a

�x � �y � �z�������

�Eqs� �� and �� �� each with an additional term�

Page 255: Hydrodynamics - CFD

��� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

or in the form

un c

������ �

�h�x

��� �

�h�y

��� �

�h�z

�� ��h��x�y�z�

�� ��h�x

���� �

�h�y

���� �

�h�z

��n

� a

�x � �y � �z�������

It is interesting to notice that a Taylor series expansion of Eq� ����� results in

� � � h��x � �y � �z� ��

�h���x � �y � �z�

� �������

��

�h�h��z � ���y � ��x� �

����y � ��x�y � ��

�y

�� ��y � ��x�

�y � ��

�x�y � ��x

i� � � �

which veri�es the second order accuracy of the factored form� Furthermore� clearly�if the method converges� it converges to the proper steadystate��

With regards to stability� it follows from Eq� ����� that� if all the ��s are real andnegative� the method is stable for all h� This makes the method unconditionally stablefor the �D di�usion model when it is centrally di�erenced in space�Now consider what happens when we apply this method to the biconvection model�

the �D form of Eq� ����� with periodic boundary conditions� In this case� centraldi�erencing causes all of the ��s to be imaginary with spectrums that include bothpositive and negative values� Remember that in our analysis we must consider everypossible combination of these eigenvalues First write the � root in Eq� ����� in theform

� � � i�� � � i

�� i�� � � i

where �� � and are real numbers that can have any sign� Now we can always �ndone combination of the ��s for which �� and are both positive� In that case sincethe absolute value of the product is the product of the absolute values

j�j� ��� ��� � �� � ��

��� ��� � ��� ��� �

and the method is unconditionally unstable for the model convection problem�From the above analysis one would come to the conclusion that the method rep

resented by Eq� ����� should not be used for the �D Euler equations� In practicalcases� however� some form of dissipation is almost always added to methods that areused to solve the Euler equations and our experience to date is that� in the presenceof this dissipation� the instability disclosed above is too weak to cause trouble�

�However� we already knew this because we chose the delta form�

Page 256: Hydrodynamics - CFD

����� PROBLEMS ���

��� Problems

�� Starting with the generic ODE�

du

dt Au� f

we can split A as follows� A A��A��A��A�� Applying implicit Euler timemarching gives

un� � unh

A�un� � A�un� � A�un� � A�un� � f

�a� Write the factored delta form� What is the error term�

�b� Instead of making all of the split terms implicit� leave two explicit�

un� � unh

A�un� � A�un � A�un� � A�un � f

Write the resulting factored delta form and de�ne the error terms�

�c� The scalar representative equation is

du

dt ��� � �� � �� � ���u� a

For the fully implicit scheme of problem �a� �nd the exact solution to theresulting scalar di�erence equation and comment on the stability� convergence� and accuracy of the converged steadystate solution�

�d� Repeat �c for the explicitimplicit scheme of problem �b�

Page 257: Hydrodynamics - CFD

�� CHAPTER ��� LINEAR ANALYSIS OF SPLIT AND FACTORED FORMS

Page 258: Hydrodynamics - CFD

Appendix A

USEFUL RELATIONS AND

DEFINITIONS FROM LINEAR

ALGEBRA

A basic understanding of the fundamentals of linear algebra is crucial to our development of numerical methods and it is assumed that the reader is at least familar withthis subject area� Given below is some notation and some of the important relationsbetween matrices and vectors�

A�� Notation

�� In the present context a vector is a vertical column or string� Thus

�v

�����v�v����vm

�and its transpose �v

Tis the horizontal row

�vT �v�� v�� v�� � � � � vm� � �v �v�� v�� v�� � � � � vm�

T

�� A general m�m matrix A can be written

A �aij�

�����a�� a�� � � � a�ma�� a�� � � � a�m

� � �

am� am� � � � amm

��

Page 259: Hydrodynamics - CFD

���APPENDIX A� USEFUL RELATIONS ANDDEFINITIONS FROM LINEAR ALGEBRA

�� An alternative notation for A is

A h�a���a�� � � � ��am

iand its transpose AT is

AT

��������aT

�aT

�����aT

m

��� The inverse of a matrix �if it exists� is written A�� and has the property that

A��A AA�� I� where I is the identity matrix�

A�� De�nitions

�� A is symmetric if AT A�

�� A is skew�symmetric or antisymmetric if AT �A��� A is diagonally dominant if aii Pj ��i jaijj � i �� �� � � � � m and aii �

Pj ��i jaijj

for at least one i�

�� A is orthogonal if aij are real and ATA AAT I

�� &A is the complex conjugate of A�

�� P is a permutation matrix if P�v is a simple reordering of �v�

�� The trace of a matrix isP

i aii�

� A is normal if ATA AAT �

� det�A� is the determinant of A�

��� AH is the conjugate transpose of A� �Hermitian��

��� If

A �a bc d

�then

det�A� ad� bc

and

A�� �

det�A�

�d �b�c a

Page 260: Hydrodynamics - CFD

A��� ALGEBRA ���

A�� Algebra

We consider only square matrices of the same dimension�

�� A and B are equal if aij bij for all i� j �� �� � � � � m�

�� A� �B � C� �C � A� �B� etc�

�� sA �saij� where s is a scalar�

�� In general AB BA�

�� Transpose equalities�

�A�B�T AT �BT

�AT �T A

�AB�T BTAT

�� Inverse equalities �if the inverse exists��

�A����� A

�AB��� B��A��

�AT ��� �A���T

�� Any matrix A can be expressed as the sum of a symmetric and a skewsymmetricmatrix� Thus�

A �

�A� AT

���

�A� AT

A�� Eigensystems

�� The eigenvalue problem for a matrix A is de�ned as

A�x ��x or �A� �I��x �

and the generalized eigenvalue problem� including the matrix B� as

A�x �B�x or �A� �B��x �

�� If a square matrix with real elements is symmetric� its eigenvalues are all real�If it is asymmetric� they are all imaginary�

Page 261: Hydrodynamics - CFD

���APPENDIX A� USEFUL RELATIONS ANDDEFINITIONS FROM LINEAR ALGEBRA

�� Gershgorin�s theorem� The eigenvalues of a matrix lie in the complex plane inthe union of circles having centers located by the diagonals with radii equal tothe sum of the absolute values of the corresponding o�diagonal row elements�

�� In general� an m �m matrix A has n�x linearly independent eigenvectors withn�x � m and n� distinct eigenvalues ��i� with n� � n�x � m�

�� A set of eigenvectors is said to be linearly independent if

a � �xm � b � �xn �xk � m n k

for any complex a and b and for all combinations of vectors in the set�

�� If A posseses m linearly independent eigenvectors then A is diagonalizable� i�e��

X��AX #

where X is a matrix whose columns are the eigenvectors�

X h�x�� �x�� � � � � �xm

iand # is the diagonal matrix

#

�������� � � � � �

� ��� � �

������

� � � � � � �� � � � � �m

�If A can be diagonalized� its eigenvectors completely span the space� and A issaid to have a complete eigensystem�

�� If A has m distinct eigenvalues� then A is always diagonalizable� and witheach distinct eigenvalue there is one associated eigenvector� and this eigenvectorcannot be formed from a linear combination of any of the other eigenvectors�

� In general� the eigenvalues of a matrix may not be distinct� in which case thepossibility exists that it cannot be diagonalized� If the eigenvalues of a matrixare not distinct� but all of the eigenvectors are linearly independent� the matrixis said to be derogatory� but it can still be diagonalized�

� If a matrix does not have a complete set of linearly independent eigenvectors�it cannot be diagonalized� The eigenvectors of such a matrix cannot span thespace and the matrix is said to have a defective eigensystem�

Page 262: Hydrodynamics - CFD

A��� EIGENSYSTEMS ���

��� Defective matrices cannot be diagonalized but they can still be put into a compact form by a similarity transform� S� such that

J S��AS

������J� � � � � �

� J�� � �

������

� � � � � � �� � � � � Jk

�where there are k linearly independent eigenvectors and Ji is either a Jordansubblock or �i�

��� A Jordan submatrix has the form

Ji

���������

�i � � � � � �

� �i �� � �

���

� � �i� � � �

���� � � � � � �

� � � � � � �i

��� Use of the transform S is known as putting A into its Jordan Canonical form�A repeated root in a Jordan block is referred to as a defective eigenvalue� Foreach Jordan submatrix with an eigenvalue �i of multiplicity r� there exists oneeigenvector� The other r�� vectors associated with this eigenvalue are referredto as principal vectors� The complete set of principal vectors and eigenvectorsare all linearly independent�

��� Note that if P is the permutation matrix

P

��� � � �� � �� � �

� � P T P�� P

then

P��

���� � �� � �� � �

�P ���� � �� � �� � �

��� Some of the Jordan subblocks may have the same eigenvalue� For example� the

Page 263: Hydrodynamics - CFD

���APPENDIX A� USEFUL RELATIONS ANDDEFINITIONS FROM LINEAR ALGEBRA

matrix ���������������

����� ��� �

��

��� �

�� ���

���� �

��

���

�is both defective and derogatory� having�

� eigenvalues� � distinct eigenvalues� � Jordan blocks� � linearly independent eigenvectors� � principal vectors with ��� � principal vector with ��

A�� Vector and Matrix Norms

�� The spectral radius of a matrix A is symbolized by ��A� such that

��A� j�mjmax

where �m are the eigenvalues of the matrix A�

�� A pnorm of the vector �v is de�ned as

jjvjjp �� MXj��

jvjjp�A�p

�� A pnorm of a matrix A is de�ned as

jjAjjp maxx���

jjAvjjpjjvjjp

Page 264: Hydrodynamics - CFD

A��� VECTOR AND MATRIX NORMS ���

�� Let A and B be square matrices of the same order� All matrix norms must havethe properties

jjAjj �� jjAjj � implies A �jjc � Ajj jcj � jjAjj

jjA�Bjj � jjAjj� jjBjjjjA �Bjj � jjAjj � jjBjj

�� Special pnorms are

jjAjj� maxj����MPM

i�� jaijj maximum column sum

jjAjj� q��A

T � A�

jjAjj� maxi������MPM

j�� jaijj maximum row sum

where jjAjjp is referred to as the Lp norm of A�

�� In general ��A� does not satisfy the conditions in �� so in general ��A� is not atrue norm�

�� When A is normal� ��A� is a true norm� in fact� in this case it is the L� norm�

� The spectral radius of A� ��A�� is the lower bound of all the norms of A�

Page 265: Hydrodynamics - CFD

���APPENDIX A� USEFUL RELATIONS ANDDEFINITIONS FROM LINEAR ALGEBRA

Page 266: Hydrodynamics - CFD

Appendix B

SOME PROPERTIES OF

TRIDIAGONAL MATRICES

B�� Standard Eigensystem for Simple Tridiagonals

In this work tridiagonal banded matrices are prevalent� It is useful to list some oftheir properties� Many of these can be derived by solving the simple linear di�erenceequations that arise in deriving recursion relations�Let us consider a simple tridiagonal matrix� i�e�� a tridiagonal with constant scalar

elements a�b� and c� see Section ���� If we examine the conditions under which thedeterminant of this matrix is zero� we �nd �by a recursion exercise�

det�B�M � a� b� c�� �

if

b � �pac cos

�m�

M � �

� � � m �� �� � � � �M

From this it follows at once that the eigenvalues of B�a� b� c� are

�m b � �pac cos

�m�

M � �

�� m �� �� � � � �M �B���

The righthand eigenvector of B�a� b� c� that is associated with the eigenvalue �msatis�es the equation

B�a� b� c��xm �m�xm �B���

and is given by

�xm �xj�m �a

c

�j � �� sin

�j�

m�

M � �

��� m �� �� � � � �M �B���

���

Page 267: Hydrodynamics - CFD

�� APPENDIX B� SOME PROPERTIES OF TRIDIAGONAL MATRICES

These vectors are the columns of the righthand eigenvector matrix� the elements ofwhich are

X �xjm� �a

c

�j � �� sin

�jm�

M � �

��

j �� �� � � � �Mm �� �� � � � �M �B���

Notice that if a �� and c ���a

c

�j � �� e

i�j����� �B���

The lefthand eigenvector matrix of B�a� b� c� can be written

X�� �

M � �

�c

a

�m� �� sin

�mj�

M � �

��

m �� �� � � � �Mj �� �� � � � �M

In this case notice that if a �� and c ��c

a

�m� �� e

�i�m����� �B���

B�� Generalized Eigensystem for Simple Tridiag�

onals

This system is de�ned as follows��������b ca b c

a b� � � ca b

��������x�x�x����xM

� �

��������e fd e f

d e� � � fd e

��������x�x�x����xM

�In this case one can show after some algebra that

det�B�a� �d� b� �e� c� �f � � �B���

if

b� �me� �q�a� �md��c� �mf� cos

�m�

M � �

� � � m �� �� � � � �M �B��

If we de�ne�m

m�

M � �� pm cos �m

Page 268: Hydrodynamics - CFD

B��� THE INVERSE OF A SIMPLE TRIDIAGONAL ��

�m eb� ��cd� af�p�m � �pm

q�ec� fb��ea� bd� � ��cd� af�pm�

e� � �fdp�mThe righthand eigenvectors are

�xm

�a� �md

c� �mf

�j � ��

sin �j�m� �m �� �� � � � �Mj �� �� � � � �M

These relations are useful in studying relaxation methods�

B�� The Inverse of a Simple Tridiagonal

The inverse of B�a� b� c� can also be written in analytic form� Let DM represent thedeterminant of B�M � a� b� c�

DM � det�B�M � a� b� c��

De�ning D� to be �� it is simple to derive the �rst few determinants� thus

D� �

D� b

D� b� � ac

D� b� � �abc �B� �

One can also �nd the recursion relation

DM bDM�� � acDM�� �B����

Eq� B��� is a linear O�E the solution of which was discussed in Section ���� Itscharacteristic polynomial P �E� is P �E� � bE � ac� and the two roots to P ��� �result in the solution

DM �p

b� � �ac

�� �b �

pb� � �ac�

�M�

��b�

pb� � �ac�

�M����

M �� �� �� � � � �B����

where we have made use of the initial conditions D� � and D� b� In the limitingcase when b� � �ac �� one can show that

DM �M � ��

�b

�M! b� �ac

Page 269: Hydrodynamics - CFD

��� APPENDIX B� SOME PROPERTIES OF TRIDIAGONAL MATRICES

Then for M �

B�� �

D�

�����D� �cD� c�D� �c�D�

�aD� D�D� �cD�D� c�D�

a�D� �aD�D� D�D� �cD�

�a�D� a�D� �aD� D�

�and for M �

B�� �

D�

�������D� �cD� c�D� �c�D� c�D�

�aD� D�D� �cD�D� c�D�D� �c�D�

a�D� �aD�D� D�D� �cD�D� c�D�

�a�D� a�D�D� �aD�D� D�D� �cD�

a�D� �a�D� a�D� �aD� D�

�The general element dmn is

Upper triangle�

m �� �� � � � �M � � ! n m � �� m� �� � � � �M

dmn Dm��DM�n��c�n�m�DM

Diagonal�n m �� �� � � � �M

dmm DM��DM�m�DM

Lower triangle�

m n � �� n� �� � � � �M ! n �� �� � � � �M � �

dmn DM�mDn����a�m�n�DM

B�� Eigensystems of Circulant Matrices

B���� Standard Tridiagonals

Consider the circulant �see Section ������ tridiagonal matrix

Bp�M � a� b� c� � �B����

Page 270: Hydrodynamics - CFD

B��� EIGENSYSTEMS OF CIRCULANT MATRICES ���

The eigenvalues are

�m b � �a� c� cos���m

M

�� i�a� c� sin

���m

M

�� m �� �� �� � � � �M � �

�B����

The righthand eigenvector that satis�es Bp�a� b� c��xm �m�xm is

�xm �xj�m ei j ���mM� � j �� �� � � � �M � � �B����

where i � p��� and the righthand eigenvector matrix has the form

X �xjm� eij

���mM

��

j �� �� � � � �M � �m �� �� � � � �M � �

The lefthand eigenvector matrix with elements x� is

X�� �x�mj� �

Me�im

���jM

��

m �� �� � � � �M � �j �� �� � � � �M � �

Note that both X and X�� are symmetric and that X�� �MX�� where X� is the

conjugate transpose of X�

B���� General Circulant Systems

Notice the remarkable fact that the elements of the eigenvector matrices X and X��

for the tridiagonal circulant matrix given by eq� B��� do not depend on the elementsa� b� c in the matrix� In fact� all circulant matrices of order M have the same set oflinearly independent eigenvectors� even if they are completely dense� An example ofa dense circulant matrix of order M � is�����

b� b� b� b�b� b� b� b�b� b� b� b�b� b� b� b�

� �B����

The eigenvectors are always given by eq� B���� and further examination shows thatthe elements in these eigenvectors correspond to the elements in a complex harmonicanalysis or complex discrete Fourier series�Although the eigenvectors of a circulant matrix are independent of its elements�

the eigenvalues are not� For the element indexing shown in eq� B��� they have thegeneral form

�m M��Xj��

bjei���jmM�

of which eq� B��� is a special case�

Page 271: Hydrodynamics - CFD

��� APPENDIX B� SOME PROPERTIES OF TRIDIAGONAL MATRICES

B�� Special Cases Found From Symmetries

Consider a mesh with an even number of interior points such as that shown in Fig�B��� One can seek from the tridiagonal matrix B��M � a� b� a� � the eigenvector subsetthat has even symmetry when spanning the interval � � x � �� For example� we seekthe set of eigenvectors �xm for which

����������

b aa b a

a� � �

� � � aa b a

a b

�����������

x�x�������x�x�

� �m

�����������

x�x�������x�x�

This leads to the subsystem of order M which has the form

B�M � a��b� a��xm

������������

b aa b a

a� � �

� � � aa b a

a b � a

��xm �m�xm �B����

By folding the known eigenvectors of B��M � a� b� a� about the center� one can showfrom previous results that the eigenvalues of eq� B��� are

�m b � �a cos

���m� ����M � �

�� m �� �� � � � �M �B����

Page 272: Hydrodynamics - CFD

B��� SPECIAL CASES INVOLVING BOUNDARY CONDITIONS ���

and the corresponding eigenvectors are

�xm sin�j��m� ����M � �

��

j �� �� � � � �M

Imposing symmetry about the same intervalbut for a mesh with an odd number of points�see Fig� B��� leads to the matrix

B�M � �a� b� a�

����������

b aa b a

a� � �

� � � aa b a

�a b

By folding the known eigenvalues of B��M �� � a� b� a� about the center� one can showfrom previous results that the eigenvalues ofeq� B��� are

Line of Symmetry

x � x �� � � � � � � �

j � � � � � � �M �

j � � �M

a� An evennumbered mesh

Line of Symmetry

x � x �� � � � � � �

j � � � � � �M �

j � � �M

b� An odd�numbered mesh

Figure B�� � Symmetrical folds forspecial cases

�m b � �a cos

���m� ����M

�� m �� �� � � � �M

and the corresponding eigenvectors are

�xm sin

�j��m� ���

�M

�� j �� �� � � � �M

B� Special Cases Involving Boundary Conditions

We consider two special cases for the matrix operator representing the �point centraldi�erence approximation for the second derivative ����x� at all points away from theboundaries� combined with special conditions imposed at the boundaries�

Page 273: Hydrodynamics - CFD

��� APPENDIX B� SOME PROPERTIES OF TRIDIAGONAL MATRICES

Note� In both cases

m �� �� � � � �Mj �� �� � � � �M

�� � � cos��� �� sin������

When the boundary conditions are Dirichlet on both sides�

���������� �� �� �

� �� �� �� �

� ��

��m �� � � cos

�m�

M � �

��xm sin

hj�

m�M � �

�i �B���

When one boundary condition is Dirichlet and the other is Neumann �and a diagonalpreconditioner is applied to scale the last equation��

���������� �� �� �

� �� �� �� �

� ��

��m �� � � cos

���m� ����M � �

��xm sin

�j���m� ����M � �

�� �B�� �

Page 274: Hydrodynamics - CFD

Appendix C

THE HOMOGENEOUS

PROPERTY OF THE EULER

EQUATIONS

The Euler equations have a special property that is sometimes useful in constructingnumerical methods� In order to examine this property� let us �rst inspect Euler�stheorem on homogeneous functions� Consider �rst the scalar case� If F �u� v� satis�esthe identity

F ��u� �v� �nF �u� v� �C���

for a �xed n� F is called homogeneous of degree n� Di�erentiating both sides withrespect to � and setting � � �since the identity holds for all ��� we �nd

u�F

�u� v

�F

�v nF �u� v� �C���

Consider next the theorem as it applies to systems of equations� If the vectorF �Q� satis�es the identity

F ��Q� �nF �Q� �C���

for a �xed n� F is said to be homogeneous of degree n and we �nd

��F

�q

�Q nF �Q� �C���

���

Page 275: Hydrodynamics - CFD

���APPENDIX C� THE HOMOGENEOUS PROPERTY OF THE EULER EQUATIONS

Now it is easy to show� by direct use of eq� C��� that both E and F in eqs� ���� and���� are homogeneous of degree �� and their Jacobians� A and B� are homogeneousof degree � �actually the latter is a direct consequence of the former��� This beingthe case� we notice that the expansion of the �ux vector in the vicinity of tn which�according to eq� ����� can be written in general as�

E En � An�Q�Qn� �O�h��

F Fn �Bn�Q�Qn� �O�h�� �C���

can be written

E AnQ�O�h��

F BnQ�O�h�� �C���

since the terms En � AnQn and Fn � BnQn are identically zero for homogeneousvectors of degree �� see eq� C��� Notice also that� under this condition� the constantterm drops out of eq� ������As a �nal remark� we notice from the chain rule that for any vectors F and Q

�F �Q�

�x

��F

�Q

��Q

�x A

�Q

�x�C���

We notice also that for a homogeneous F of degree �� F AQ and

�F

�x A

�Q

�x�

��A

�x

�Q �C��

Therefore� if F is homogeneous of degree ��

��A

�x

�Q � �C� �

in spite of the fact that individually ��A��x� and Q are not equal to zero�

�Note that this depends on the form of the equation of state� The Euler equations are homoge�neous if the equation of state can be written in the form p f���� where � is the internal energyper unit mass�

Page 276: Hydrodynamics - CFD

Bibliography

��� D� Anderson� J� Tannehill� and R� Pletcher� Computational Fluid Mechanics andHeat Transfer� McGrawHill Book Company� New York� � ��

��� C� Hirsch� Numerical Computation of Internal and External Flows� volume ����John Wiley + Sons� New York� � �

���