13
Computational Methods for Fluid Dynamics

Computational Methods for Fluid Dynamics - Springer978-3-642-97651-3/1.pdf · Preface Computational fluid dynamics, commonly known under the acronym 'CFD', is undergoing significant

Embed Size (px)

Citation preview

Computational Methods for Fluid Dynamics

Springer Berlin Heidelberg New York Barcelona Budapest Hong Kong London Milan Paris Santa Clara Singapore Tokyo

J. H. Ferziger · M. Peric

Computational Methods for Fluid Dynamics

With 115 Figures

, Springer

Prof. Dr. Joel H. Ferziger Department of Mechanical Engineering Stanford University Stanford, CA 94305-3030 USA

Prof. Dr. Milovan Perie Institut ffir Schiffbau Universitat Hamburg Lammersieth 90 22305 Hamburg Germany

Corrected 2nd printing 1997

All computer codes can be accessed from the publisher's server ftp.springer.de on the internet.

ISBN-13:978-3-540-59434-5

Cip data applied for Die Deutsche Bibliothek - CIP-Einheitsaufnahme Ferziger, Joel H.: Computational methods for fluid dynamics I J. H. Ferziger; M. Perie . -Corr. 2. print. - Berlin; Heidelberg; New York; Barcelona; Budapest; Hong Kong; London; Milan; Paris; Santa Clara; Singapore; Tokyo: Springer, 1997

ISBN-13: 978-3-540-59434-5 e-lsBN-13: 978-3-642-97651-3 DOl: 10.1007/978-3-642-97651-3

This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilm or in other ways, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer-Verlag. Violations are liable for prosecution act under German Copyright Law.

© Springer-Vedag Berlin Heidelberg 1996

The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.

Typesetting: Camera-ready by authors SPIN:10636544 68/3020-543210 - Printed on acid -free paper

Preface

Computational fluid dynamics, commonly known under the acronym 'CFD', is undergoing significant expansion in terms of both the number of courses offered at universities and the number of researchers active in the field. There are a number of software packages available that solve fluid flow problems; the market is not quite as large as the one for structural mechanics codes, in which the use of finite element methods is well established. The lag can be explained by the fact that CFD problems are, in general, more difficult to solve. However, CFD codes are slowly being accepted as design tools by industrial users. At present, users of CFD need to be fairly knowledgeable and this requires education of both students and working engineers. The present book is an attempt to fill this need.

It is our belief that, to work in CFD, one needs a solid background in fluid mechanics and numerical analysis; significant errors have been made by peo­ple lacking knowledge in one or the other. We therefore encourage the reader to obtain a working knowledge of these subjects before entering into a study of the material in this book. Because different people view numerical meth­ods differently, and to make this work more self-contained, we have included two chapters on basic numerical methods in this book. The book is based on material offered by the authors in courses at Stanford University, the Uni­versity of Erlangen-Niirnberg and the University of Hamburg. It reflects the authors' experience in both writing CFD codes and using them to solve engi­neering problems. Many of the codes used in the examples, from the simple ones involving rectangular grids to the ones using non-orthogonal grids and multigrid methods, are available to interested readers; see the information on how to access them via Internet "in the appendix. These codes illustrate the methods described in the book; they can be adapted to the solution of many fluid mechanical problems. Students should try to modify them (e.g. to implement different boundary conditions, interpolation schemes, differen­tiation and integration approximations, etc.). This is important as one does not really know a method until s/he has programmed and/or run it.

The finite volume method is favored in this book, although finite difference methods are described in what we hope is sufficient detail. Finite element methods are not covered in detail as a number of books on that subject already exist.

VI

We have tried to describe the basic ideas of each topic in such a way that they can be understood by the reader; where possible, we have avoided lengthy mathematical analysis. Usually a general description of an idea or method is followed by a more detailed description (including the necessary equations) of one or two numerical schemes representative of the better meth­ods of the type; other possible approaches and extensions are briefly de­scribed. We have tried to emphasize common elements of methods rather than their differences.

There is a vast literature devoted to numerical methods for fluid mechan­ics. -Even if we restrict our attention to incompressible flows, it would be impossible to cover everything in a single work. To do so, would also create confusion for the reader. We have therefore covered only the methods that we have found valuable and that are commonly used in industry in this book. References to other methods are given, however.

We have placed considerable emphasis on the need to estimate numerical errors; almost all examples in this book are accompanied with error analysis. Although it is possible for a qualitatively incorrect solution of a problem to look reasonable (it may even be a good solution of another problem), the consequences of accepting it may be severe. On the other hand, sometimes a relatively poor solution can be of value if treated with care. Industrial users of commercial codes need to learn to judge the quality of the results before believing them; we hope that this book will contribute to the awareness that numerical solutions are always approximate.

We have tried to cover a cross-section of modern approaches, including di­rect and large eddy simulation of turbulence, multigrid methods and parallel computing, methods for moving grids and free surface flows, etc. Obviously, we could not cover all these topics in detail, but we hope that the informa­tion contained herein will provide the reader with a general knowledge of the subject; those interested in a more detailed study of a particular topic will find recommendations for further reading.

While we have invested every effort to avoid typing, spelling and other errors, no doubt some remain to be found by readers. We will appreciate your notifying us of any mistakes you might find, as well as your comments and suggestions for improvement of future editions of the book. For that purpose, the authors' electronic mail addresses are given below. We also hope that colleagues whose work has not been referenced will forgive us, since any omissions are unintentional.

We have to thank all our present and former students, colleagues, and friends, who helped us in one way or another to finish this work; the complete list of names is too long to list here. Names that we cannot avoid mentioning include Drs. Ismet Demirdzic, Samir Muzaferija, Zeljko Lilek, Joseph Oliger, Gene Golub, and Messrs. Eberhard Schreck, Volker Seidl, Kishan Shah, and David Briggs. The help provided by those people who created arid made

VII

available 'lEX, I9\.TEYC, Linux, Xfig, Ghostscript and other tools which made our job easier is also greatly appreciated.

Our families gave us a tremendous support during this endeavor; our special thanks go to Anna, Robinson and Kerstin Perie and Eva Ferziger.

This collaboration between two geographically distant colleagues was made possible by grants and fellowships from the Alexander von Humboldt Foundation and the Deutsche Forschungsgemeinschaft (German National Re­search Organization). Without their support, this work would never have come into existence and we cannot express sufficient thanks to them.

Milovan Perie [email protected] Joel H. Ferziger [email protected]

Table of Contents

Preface....................................................... V

1. Basic Concepts of Fluid Flow ............................ 1 1.1 Introduction........................................... 1 1.2 Conservation Principles ................................. 3 1.3 Mass Conservation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 Momentum Conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.5 Conservation of Scalar Quantities. . . . . . . . . . . . . . . . . . . . . . . . . 9 1.6 Dimensionless Form of Equations. . . . . . . . . . . . . . . . . . . . . . . .. 11 1. 7 Simplified Mathematical Models. . . . . . . . . . . . . . . . . . . . . . . . .. 12

1.7.1 Incompressible Flow. .. . . .. . . . . . . . . .. . .. . . . . . . . . .. 12 1.7.2 Inviscid (Euler) Flow.. . . .. . . . . . . . . . . . .. . . . . . .. . .. 13 1. 7.3 Potential Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 13 1.7.4 Creeping (Stokes) Flow ........................ :.. 14 1. 7.5 Boussinesq Approximation. . . . . . . . . . . . . . . . . . . . . . . .. 14 1. 7.6 Boundary Layer Approximation . . . . . . . . . . . . . . . . . . .. 15 1. 7.7 Modeling of Complex Flow Phenomena ............. 16

1.8 Mathematical Classification of Flows. . . . . . . . . . . . . . . . . . . . .. 16 1.8.1 Hyperbolic Flows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 17 1.8.2 Parabolic Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 17 1.8.3 Elliptic Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 17 1.8.4 Mixed Flow Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 18

1.9 Plan of This Book. . . . . . . . . . . .. . . . . .. . . . . . . .. . . .. . . . . . .. 18

2. Introduction to Numerical Methods...................... 21 2.1 Approaches to Fluid Dynamical Problems. . . . .. . . .. . . .. . .. 21 2.2 What is CFD? ................ .... .............. ....... 23 2.3 Possibilities and Limitations of Numerical Methods . . . . . . . .. 23 2.4 Components of a Numerical Solution Method. . . . . . . . . . . . .. 25

2.4.1 Mathematical Model.. . .. . . . . . . . . .. . . . . . . .. . . . . . .. 25 2.4.2 Discretization Method. .. . . .. .. . . .. . . .. . . . . . . . . . .. 25 2.4.3 Coordinate and Basis Vector Systems . . . . . . . . . . . . . .. 26 2.4.4 Numerical Grid .................................. 26 2.4.5 Finite Approximations . . . . . . . . . . . . . . . . . . . . . . . . . . .. 30

X Table of Contents

2.4.6 Solution Method ................................. 30 2.4.7 Convergence Criteria ............................. 30

2.5 Properties of Numerical Solution Methods . . . . . . . . . . . . . . . .. 31 2.5.1 Consistency..................................... 31 2.5.2 Stability........................................ 31 2.5.3 Convergence..................................... 32 2.5.4 Conservation.................................... 32 2.5.5 Boundedness..................................... 33 2.5.6 Realizibility..................................... 33 2.5.7 Accuracy........................................ 34

2.6 Discretization Approaches. . . . . . .. . . . .. . .. . . .. .. . . . . .. . .. 35 2.6.1 Finite Difference Method. . . . . . . . . . . . . . . . . . . . . . . . .. 35 2.6.2 Finite Volume Method. . . . . . . . . . . . . . . . . . . . . . . . . . .. 35 2.6.3 Finite Element Method.... ........ .......... ..... 36

3. Finite Difference Methods ................................ 39 3.1 Introduction........................................... 39 3.2 Basic Concept ......................................... 39 3.3 Approximation of the First Derivative. . . . . . . . . . . . . . . . . . . .. 42

3.3.1 Taylor Series Expansion. . . . . . . . . . . . . . . . . . . . . . . . . .. 42 3.3.2 Polynomial Fitting ............................... 46

3.4 Approximation of the Second Derivative.. . . .. . . . . .. . . . . . .. 47 3.5 Approximation of Mixed Derivatives . . . . . . . . . . . . . . . . . . . . .. 50 3.6 Approximation of Other Terms. . . . . . . . . . . . . . . . . . . . . . . . . .. 50 3.7 Implementation of Boundary Conditions ............. '. . . . .. 50 3.8 An Introduction to Spectral Methods ..................... 52

3.8.1 Basic Concept. . .. .. .. . . .. .. . . .. . . .. . . .. . . . . .. . .. 52 3.8.2 Another View of Discretization Error .. . . . . . . . . . . . .. 54

3.9 The Algebraic Equation System ......................... , 55 3.10 Discretization Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 59 3.11 Example .............................................. 60

4. Finite Volume Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 67 4.1 Introduction........................................... 67 4.2 Approximation of Surface Integrals ................ . . . . . .. 68 4.3 Approximation of Volume Integrals . . . . . . . . . . . . . . . . . . . . . .. 71 4.4 Interpolation Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 72

4.4.1 Upwind Interpolation (UDS) . . .. .. . . .. . . .... . . . . . .. 72 4.4.2 Linear Interpolation (CDS) .... , . . .. .... . . . . .. . . . .. 73 4.4.3 Quadratic Upwind Interpolation (QUICK).. . . . .. . . .. 74 4.4.4 Higher-Order Schemes ............................ 75 4.4.5 Other Schemes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 76

4.5 Deferred Correction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 76 4.6 Implementation of Boundary Conditions. . . . . . . . . . . . . . . . . .. 77 4.7 The Algebraic Equation System . . . . . . . . . . . . . . . . . . . . . . . . .. 77

Table of Contents XI

4.8 Examples.............................................. 78

5. Solution of Linear Equation Systems. . . . . . . . . . . . . . . . . . . . .. 85 5.1 Introduction........................................... 85 5.2 Direct Methods ........................................ 86

5.2.1 Gauss Elimination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 86 5.2.2 LV Decomposition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 88 5.2.3 Tridiagonal Systems .............................. 89 5.2.4 Cyclic Reduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 90

5.3 Iterative Methods ...................................... 91 5.3.1 Basic Concept. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 91 5.3.2 Convergence..................................... 92 5.3.3 Some Basic Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 94 5.3.4 Incomplete LV Decomposition: Stone's Method ...... 95 5.3.5 ADI and Other Splitting Methods ................. , 99 5.3.6 Conjugate Gradient Methods ...................... 101 5.3.7 Biconjugate Gradients and CGSTAB ............... 104 5.3.8 Multigrid Methods ............................... 106 5.3.9 Other Iterative Solvers ............................ 110

5.4 Coupled Equations and Their Solution .................... 110 5.4.1 Simultaneous Solution ............................ 111 5.4.2 Sequential Solution ............................... 111

5.5 Non-Linear Equations and their Solution .................. 113 5.5.1 Newton-like Techniques .......................... , 113 5.5.2 Other Techniques ................................ 115

5.6 Convergence Criteria .................................... 115 5.7 Examples .............................................. 120

6. Methods for Unsteady Problems .......................... 127 6.1 Introduction ........................................... 127 6.2 Methods for Initial Value Problems in ODEs ............... 127

6.2.1 Two-Level Methods ............................... 127 6.2.2 Predictor-Corrector and Multipoint Methods ......... 130 6.2.3 Runge-Kutta Methods ............................ 132 6.2.4 Other Methods ................................... 134

6.3 Application to the Generic Transport Equation ............. 134 6.3.1 Explicit Methods ................................ , 135 6.3.2 Implicit Methods ................................. 140 6.3.3 Other Methods ................................... 143

6.4 Examples .............................................. 144

XII Table of Contents

7. Solution of the Navier-Stokes Equations . ................. 149 7.1 Special Features of the Navier-Stokes Equations ............ 149

7.1.1 Discretization of Convective and Viscous Terms ...... 149 7.1.2 Discretization of Pressure Terms and Body Forces .... 150 7.1.3 Conservation Properties ........................... 152

7.2 Choice of Variable Arrangement on the Grid ............... 156 7.2.1 Colocated Arrangement ........................... 157 7.2.2 Staggered Arrangements .......................... 158

7.3 Calculation of the Pressure .............................. 159 7.3.1 The Pressure Equation and its Solution ............. 159 7.3.2 A Simple Explicit Time Advance Scheme ............ 160 7.3.3 A Simple Implicit Time Advance Method ............ 162 7.3.4 Implicit Pressure-Correction Methods ............... 164

7.4 Other Methods ......................................... 170 7.4.1 Fractional Step Methods .......................... 170 7.4.2 Streamfunction-Vorticity Methods .................. 173 7.4.3 Artificial Compressibility Methods .................. 175

7.5 Solution Methods for the Navier-Stokes Equations .......... 179 7.5.1 Implicit Scheme Using Pressure-Correction and a Stag-

gered Grid ....................................... 179 7.5.2 Treatment of Pressure for Colocated Variables ....... 187 7.5.3 SIMPLE Algorithm for a Colocated Variable Arrange-

ment ............................................ 192 7.6 Note on Pressure and Incompressibility .................... 194 7.7 Boundary Conditions for the Navier-Stokes Equations ....... 196 7.8 Examples .............................................. 198

8. Complex Geometries ..................................... 209 8.1 The Choice of Grid ..................................... 209

8.1.1 Stepwise Approximation Using Regular Grids ........ 209 8.1.2 Overlapping Grids ................................ 210 8.1.3 Boundary-Fitted Non-Orthogonal Grids ............. 211

8.2 Grid Generation ........................................ 211 8.3 The Choice of Velocity Components ...................... 213

8.3.1 Grid-Oriented Velocity Components ................ 213 8.3.2 Cartesian Velocity Components .................... 214

8.4 The Choice of Variable Arrangement ...................... 214 8.4.1 Staggered Arrangements .......................... 215 8.4.2 Colocated Arrangement ........................... 216

8.5 Finite Difference Methods ............................... 216 8.6 Finite Volume Methods ................................. 219

8.6.1 Approximation of Convective Fluxes ................ 219 8.6.2 Approximation of Diffusive Fluxes .................. 221 8.6.3 Approximation of Source Terms .................... 227 8.6.4 Three-Dimensional Grids .......................... 228

Table of Contents XIII

8.6.5 Block-Structured Grids ........................... 230 8.6.6 Unstructured Grids ............................... 232

8.7 Control-Volume-Based Finite Element Methods ............ 233 8.8 Pressure-Correction Equation . . . . . . . . . . . . . . . . . . . . . . . . . . .. 234 8.9 Axisymmetric Problems ................................. 240 8.10 hnplementation of Boundary Conditions ................... 242

8.10.1 Inlet ............................................ 242 8.10.2 Outlet .......................................... 243 8.10.3 hnpermeable Walls ............................... 243 8.10.4 Symmetry Planes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 8.10.5 Specified Pressure ................................ 246

8.11 Examples .............................................. 247

9. Turbulent Flows .......................................... 253 9.1 Introduction ........................................... 253 9.2 Direct Numerical Simulation (DNS) ....................... 255

9.2.1 Example: Spatial Decay of Grid Thrbulence .......... 261 9.3 Large Eddy Simulation (LES) ............................ 263

9.3.1 Smagorinsky and Related Models ................... 264 9.3.2 Dynamic Models ................................. 266 9.3.3 Example: Flow Over a Wall-Mounted Cube .......... 268

9.4 RANS Models .......................................... 271 9.4.1 Reynolds Averaged Navier-Stokes (RANS) Equations. 271 9.4.2 Simple Thrbulence Models and their Application ..... 273 9.4.3 Example: Flow Around a Valve ................. , .. 279

9.5 Reynolds Stress Models ................................. 281

10. Compressible Flow ....................................... 283 10.1 Introduction ........................................... 283 10.2 Pressure-Correction Methods for Arbitrary Mach Number ... 284

10.2.1 Pressure-Velocity-Density Coupling ................ 285 10.2.2 Boundary Conditions ............................. 289 10.2.3 Examples ....................................... 293

10.3 Methods Designed for Compressible Flow .................. 298 10.3.1 An Overview of Some Specific Methods ............. 299

11. Efficiency and Accuracy Improvement .................... 303 11.1 Multigrid Methods for Flow Calculation ................... 303 11.2 Adaptive Grid Methods and Local Grid Refinement ......... 311 11.3 Parallel Computing in CFD .............................. 315

11.3.1 Iterative Schemes for Linear Equations .............. 316 11.3.2 Domain Decomposition in Space ................... 318 11.3.3 Domain Decomposition in Time .................... 321 11.3.4 Efficiency of Parallel Computing ................... 322

XIV Table of Contents

12. Special Topics ............................................ 327 12.1 Moving Grids .......................................... 327 12.2 Free Surface Flows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 333 12.3 Heat Transfer .......................................... 343 12.4 Flow With Variable Fluid Properties ...................... 345 12.5 Meteorological and Oceanographic Applications ............ 346 12.6 Combustion ........................................... 347

A. Appendeces .............................................. 349 A.l List of Computer Codes and How to Access Them .......... 349 A.2 List of Frequently Used Abbreviations ..................... 350