AL 1 MA TE RI WHAT IS CFD? D 1.1 INTRODUCTION TE We start with a definition: GH CFD (computational fluid dynamics) is a set of numerical methods applied to obtain approximate solutions of problems of fluid dynamics and heat transfer. CO PY RI According to this definition, CFD is not a science by itself but a way to apply the methods of one discipline (numerical analysis) to another (heat and mass transfer). We will deal with details later. Right now, a brief discussion is in order of why exactly we need CFD. A distinctive feature of the science of fluid flow and heat and mass transfer is the approach it takes toward description of physical processes. Instead of bulk properties, such as momentum or angular momentum of a body in mechanics or total energy or entropy of a system in thermodynamics, the analysis focuses on distributed properties. We try to determine entire fields such as temperature T (x , t) velocity v(x , t), density ρ(x , t), etc.1 Even when an integral characteristic, such as the friction coefficient or the net rate of heat transfer, is the ultimate goal of analysis, it is derived from distributed fields. The approach is very attractive by virtue of the level of details it provides. Evolution of the entire temperature distribution within a body can 1 Throughout the book, we will use x = (x , y, z ) for the vector of space coordinate and t for time. 1 2 WHAT IS CFD? be determined. Internal processes of a fluid flow such as motion, rotation, and deformation of minuscule fluid particles can be taken into account. Of course, the opportunities come at a price, most notably in the form of dramatically increased complexity of the governing equations. Except for a few strongly simplified models, the equations for distributed properties are partial differential equations, often nonlinear. As an example of complexity, let us consider a seemingly simple task of mixing and dissolving sugar in a cup of hot coffee. An innocent question of how long or how many rotations of a spoon would it take to completely dissolve the sugar leads to a very complex physical problem that includes a possibly turbulent two-phase (coffee and sugar particles) flow with a chemical reaction (dissolving). Heat transfer (within the cup and between the cup and surroundings) may also be of importance because temperature affects the rate of the reaction. No simple solution of the problem exists. Of course, we can rely on the experience acquired after repeating the process daily (perhaps more than once) for many years. We can also add a couple of extra, possibly unnecessary, stirs. If, however, the task in question is more serious—for example, optimizing an oil refinery or designing a new aircraft—relying on everyday experience or excessive effort is not an option. We must find a way to understand and predict the process. Generally, we can distinguish three approaches to solving fluid flow and heat transfer problems: 1. Theoretical approach —using governing equations to find analytical solutions 2. Experimental approach —staging a carefully designed experiment using a model of the real object 3. Numerical approach —using computational procedures to find a solution Let’s look at these approaches in more detail. Theoretical approach. The approach has a crucial advantage of providing exact solutions. Among the disadvantages, the most important is that analytical solutions are only possible for a very limited class of problems, typically formulated in an artificial, idealized way. One example is the Poiseuille solution for a flow in an infinitely long pipe (see Figure 1.1). The steady-state laminar velocity profile is U (r) = r 2 − R 2 dp , 4μ dx 1.1 INTRODUCTION 3 U(r) x r Figure 1.1 Laminar flow in an infinite pipe. where U is the velocity, R is the pipe radius, dp/dx is the constant pressure gradient that drives the flow, and μ is the dynamic viscosity of the fluid. On the one hand, the solution is, indeed, simple and gives insight into the nature of flows in pipes and ducts, so its inclusion into all textbooks of fluid dynamics is not surprising. On the other hand, the solution is correct only if the pipe is infinitely long,2 temperature is constant, and the fluid is perfectly incompressible. Furthermore, even if we were able to build such a pipe and find a useful application for it, the solution would be correct only at Reynolds numbers Re = URρ/μ (ρ is the density of the fluid) that are below approximately 2,000. Above this limit, the flow would assume fully three-dimensional and time-dependent turbulent form, for which no analytical solution is possible. It can also be noted that derivation of analytical solutions often requires substantial mathematical skills, which are not among the strongest traits of many modern engineers and scientists, especially if compared to the situation of 30 or 40 years ago. Several reasons can be named for the deterioration of such skills, one, no doubt, being development of computers and numerical methods, including the CFD. Experimental approach. Well-known examples are the wind tunnel experiments, which help to design and optimize the external shapes of airplanes (also of ships, buildings, and other objects). Another example is illustrated in Figure 1.2. The main disadvantages of the experimental approach are the technical difficulty (sometimes it takes several years before an experiment is set up and all technical problems are resolved) and high cost. Numerical (computational) approach. Here, again, we employ our ability to describe almost any fluid flow and heat transfer process as a solution of a set of partial differential equations. An approximation to this solution is found in the result of a computational procedure. This approach is not problem-free, either. We will discuss the problems throughout the book. 2 In practice, the solution is considered to be a good approximation for laminar flows in pipes at sufficiently large distance (dependent on the Reynolds number but, at least few tens of diameters) from the entrance. 4 WHAT IS CFD? Krananlage Laser Kühlplatte konvektionsströmung PIVKamera Heizplatte Figure 1.2 The experiment for studying thermal convection at the Ilmenau University of Technology, Germany (courtesy of A. Thess). Turbulent convection similar to the convection observed in the atmosphere of Earth or Sun is simulated by air motion within a large barrel with thermally insulated walls and uniformly heated bottom. The computational approach, however, beats the analytical and experimental methods in some very important aspects: universality, flexibility, accuracy, and cost. 1.2 BRIEF HISTORY OF CFD The history of CFD is a fascinating subject, which, unfortunately, we can only touch in passing. The idea to calculate approximate solutions of differential equations describing fluid flows and heat transfer is relatively old. It is definitely older than computers themselves. Development of numerical methods for solving ordinary and partial differential equations started in the first half of the twentieth century. The computations at that time required use of tables and dull mechanical work of dozens, if not hundreds, of people. No wonder that only the most important (primarily military-related) problems were addressed and only simple, one-dimensional equations were solved. Invention and subsequent fast development of computers (see Figure 1.3) opened a wonderful possibility of performing millions—and then millions of millions—of arithmetic operations in a matter of seconds. This caused a rapid growth of the efforts to develop and apply methods of numerical simulations. Again, military applications, such as modeling shock waves from an explosion or a flow past a hypersonic 1.2 BRIEF HISTORY OF CFD 5 1016 Peak Floating Point Performance [flops] Blue Gene/L 1014 1012 1010 Cray T3E(64 proc.) 108 Cray I 106 104 102 Mark I 100 1940 1950 1960 1970 1980 1990 2000 2010 Year Figure 1.3 Development of high-performance computers. The speed measured as the number of floating operations per second grows approximately tenfold every five years. jet aircraft were addressed first. In fact, development of faster and bigger computers until 1980s was largely motivated by the demands of military-related CFD. First simulations of realistic two-dimensional flows were performed in the late 1960s, while three-dimensional flows could not be seriously approached until the 1980s. In the last 20 to 30 years, the computer revolution has changed the field of CFD entirely. From a scientific discipline, in which researchers worked on unique projects using specially developed codes, it has transformed into an everyday tool of engineering design, optimization, and analysis. The simulations are routinely used as a replacement of or addition to prototyping and other design techniques. The problem-specific codes are still developed for scientific purposes, but the engineering practice has almost entirely switched to the use of commercial or open-source CFD codes. The market is largely divided between a few major brands, such as FLUENT, STAR-CD, CFX, OpenFOAM, and COMSOL. They differ in appearance and capabilities but are all essentially the numerical solvers of partial differential equations with attached physical and turbulence models, as well as modules for grid generation and post-processing the results. 6 WHAT IS CFD? 1.3 OUTLINE OF THE BOOK This book is intended as a brief but complete introduction into CFD. The focus is not on development of algorithms but on the fundamental principles, formulation of CFD problems, the most basic and common computational techniques, and essentials of a good CFD analysis. The book’s main task is to prepare the reader to make educated choices while using one of the ready CFD codes. A reader seeking deeper and more detailed understanding of specific computational methods is encouraged to use more advanced and more specialized texts, references to some of which are presented at the end of each chapter. A comment is in order regarding the bias of the text. All CFD texts are, to some degree, biased in correspondence with the chosen audience and personal research interests of the authors. More weight is given to some of the methods (finite difference, finite element, spectral, etc.) and some of the fields of application (heat transfer, incompressible fluid dynamics, or gas dynamics). The preferences made in this book reflect the choice of mechanical, chemical, and civil engineers as the target audience and the intended use for applied CFD instruction. The focus is on the finite difference and finite volume methods. The finite element and spectral techniques are introduced, but only briefly. Also, more attention is given to numerical methods for incompressible fluid dynamics and heat transfer than for compressible sub- and supersonic flows. The book contains 13 chapters. We are already at the end of Chapter 1. The remaining chapters are separated into three parts: “Fundamentals,” “Methods,” and “Art of CFD.” Part I deals with the basic concepts of numerical solution of partial differential equations. It starts with Chapter 2 introducing the equations we are most likely to solve: the governing equations of fluid flows and heat transfer. We consider various forms of the equations used in CFD and review common boundary conditions. Necessary mathematical background and the concept of numerical approximation are presented in Chapter 3. Chapter 4 discusses the basics of the finite difference method. We also introduce the key concepts associated with all CFD methods, such as the truncation error and consistency of numerical approximation. The principles and main tools of the finite volume method are presented in Chapter 5. Chapter 6 is devoted to the concept of stability of numerical time integration. Some popular and important (both historically and didactically) schemes for one-dimensional model equations are presented in Chapter 7. The material summarizes the discussion of the fundamental concepts and can be used for a midterm programming project. REFERENCES AND SUGGESTED READING 7 Part II, which includes Chapters 8 through 10, contains a compact description of some of the most important and commonly used CFD techniques. Methods of solution of systems of algebraic equations appearing in the result of the CFD approximation are discussed in Chapter 8. Chapter 9 presents some schemes used for nonsteady heat conduction and compressible flows. The discussion is deliberately brief for such voluminous subjects. It is expected that a reader with particular interest in any of them will refer to other, more specialized texts. Significantly more attention is given to the methods developed for computation of flows of incompressible fluids. Chapter 10 provides a relatively broad explanation of the issues, presents the projection method, and introduces some popular algorithms. Part III consists of Chapters 11 to 13 and deals with subjects that are not directly related to the numerical solution of partial differential equations, but nevertheless are irreplaceable in practical CFD analysis. They all belong to a somewhat imprecise science in the sense that the approach is often decided on the basis of knowledge and experience rather than exact knowledge alone. The subjects in question are the turbulence modeling (Chapter 11), types and quality of computational grids (Chapter 12), and the complex of issues arising in the course of CFD analysis, such as uncertainty and validation of results (Chapter 13). The discussion is, by necessity, brief. A reader willing to acquire truly adequate understanding of these difficult but fascinating topics should consult the books listed at the end of each chapter. REFERENCES AND SUGGESTED READING http://www.top500.org/— Official Web site of the TOP500 project providing reliable and detailed information on the world most powerful supercomputers. http://www.cfd-online.com/— A rich source of information on CFD: books, links, discussion forums, jobs, etc.