You are on page 1of 10

P S Ghoshdastidar

Associate Professor
Department of Mechanical Engineering
lIT, Kanpur

The present book covers the fundamentals of what is commonly known as


Computational Fluid Oynamics (CFO). The past two decades have witnessed a
phenomenal growth in this area due to the developments in the field of computers.
CFO has now become an integral part of the engineering design and analysis.
Engineers can make use of the CFO tools to simulate fluid flow and heat transfer
phenomena in a design and predict the system performance before manufacturing.
The advantages of CFO are numerous, namely, fewer iterations to the final
design, shorter time to launch the product, fewer expensive prototypes and so on.
Furthermore, CPO provides a cost-efficient means of testing new designs and
concepts that would otherwise be too expensive and hazardous to investigate.
Much of the material in this textbook has been used in a post -graduate course at
the Indian Institute of Technology , Kanpur for over a decade. It is assumed that the
reader has an adequate undergraduate background in Heat Transfer, Fluid Flow,
Calculus and Computer Programming in FORTRAN. The book is suitable as a
text for a one-semester course at the post-graduate or advanced undergraduate
level. It can also be used for self-study by practising engineers.
The book primarily follows finite difference method of discretization.
However, in the Appendix A, other important schemes such as finite element and
finite volume are also discussed. An emphasis has been laid on the physical
understanding of the problems. Most of the methods have been illustrated with
detailed example problems and the solution procedure. Several exercise problems
are given at the end of various chapters. Readers are encouraged to solve these
problems, to get a better understanding of various numerical techniques discussed
in the book. Chapter 7 gives details of two new numerical methods and their
applications. Chapter 8 illustrates the application of CFO in solving industrial
problems. An important subroutine (TOMA) in which tridiagonal matrix
algorithm is programmed is listed in Appendix C.
The softcover version of this book also contains a floppy diskette. The diskette
contains 21 files comprising 10 programs, I subroutine and 10 output files. The
programs are given in FORTRAN language and can be run on a PC-AT or
Pentium as well as on mainframe computer systems having a FORTRAN 77
compiler. Basically, the floppy contains programs and solutions to some unsolved

viii

Preface

problems in the book and solutions '[programs] to some typical problems


discussed in this book.
I would like to acknowledge the interaction with the students, both in and
outside the class, which has greatly contributed towards the shaping of this book.
Their suggestions and comments have been useful in writing this text. I have also
been benefitted by the lively discussions with some of my colleagues. Special
thanks are due to the post-graduate students Suresh Singh, Vipin Kumar,
R Mahesh Kumar and Kali Sanjay who have assisted me in developing some of
the computer programs in the floppy diskette.
I also wish to acknowledge the support and encouragement provided by the
editorial and production team of Tata McGraw-Hill, particularly, Ms Vibha
Mahajan and other members of their highly skilled editorial team. I am also grateful to the anonymous reviewer whose valuable comments and suggestions for
improvement have gone a long way in the formation of the final version of this
book.
The typing was carried out with great care and patience by U S Mishra. The
figures were drawn with great competence by B N Srivastava. 'J.ne writing of this
book would not have been possible without the generous financial support ofthe
Curriculum Development Cell under the Quality Improvement Programme at the
Indian Institute of Technology, Kanpur.
Last but not the least, the greatest contribution to this work has been the
patience and encouragement of my wife Sumita and my daughter Shreya who
often withstood my moody behaviour during the writing cf this book with smiling
faces. Gratitude not expressible in words is due to my parents for their blessings
and good wishes.

P S GHOSHDASTIDAR

CONTENTS
Preface

vii

1.mTRoDucnoN

1.1
1.2
1.3
1.4

What is Computer Simulation? 1


Advantages of Computer Simulation 2
Applications of Fluid Flow and Heat Transfer 2
Why is Computer Simulation Necessary in Fluid Flow
and Heat Transfer? 3
1.5 Basic Approach in Solving a Problem by Numerical Method
1.6 Problem Complexity 4
1.7 A Comparative Study of Experimental, Analytical
and Numerical Methods 5
1.8 Methods of Discretization 7
1.9 Justifications for the Choice of the Finite Difference
Method 8

Summary 8
References 9

2. PARTIAL DIFFERENTIAL EQUATIONS


2.1
2.2
2.3
2.4
2.5
2.6
2.7

Classification of PDEs 10
Elliptic, Parabolic and Hyperbolic Equations 11
Initial and Boundary Conditions 13
Initial and Boundary Value Problems 14
Conventions Followed in This Text 15
What About Hyperbolic Problems? 15
How Many Initial and Boundary Conditions do You
Need for Completely Defining a Problem? 16
Summary 17
References
17
Exercise Problems

17

10

Contents

Contents xi

3. INTRODUCTION TO FINITE DIFFERENCE,


3.1
3.2
3.3
3.4
3.5
3.6

Introduction 21
Central, Forward and Backward Difference
Expressions for a Uniform Grid 21
Central Difference Expressions for a Non-Uniform Grid
Numerical Errors 28
Accuracy of Solution: Optimum Step Size 29
Method of Choosing Optimum Step Size:
Grid Independence Test 29
Summary 30
References 30
Exercise Problems

4.22 False Transient Approach 89


4.23 Three-Dimensional Transient Problems 89
4.24 Problems in Cylindrical Geometry: Handling
of Condition at the Centre 90
4.25 Problems in Spherical Geometry 95
4.26 One-Dimensional Transient Conduction in
Composite Media 96
4.27 Treatment of Nonlinearities in Heat Conduction
4.28 Irregular Geometry 106

21

NUMERICAL ERRORS AND ACCURACY

25

Summary 110
References
111
Exercise Problems

30

4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
4.15
4.16
4.17
4.18
4.19
4.20
4.21

5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9

32

HEAT TRANSFER
Applications of Heat Conduction 32
Steady and Unsteady Conduction 32
Dimensionality in Conduction 33
Some Important Examples of Heat Generation in a Body
How Does the Classification of a Conduction
Problem Help? 33
Basic Approach in Numerical Heat Conduction 33
One-Dimensional Steady State Problem 33
Two-Dimensional Steady State Problem 54
Three-Dimensional Problems 62
Transient One-Dimensional Problem 63
Accuracy of Euler, Crank-Nicholson and Pure
Implicit Method 70
Stability: Numerically Induced Oscillations 71
Convection Boundary Condition 76
Stability Limit of the Euler Method from Physical
Standpoint 77
Mathematical Representation of All Three Methods by
a Single Discretization Equation 78
Physical Representation of All Three Methods 79
Advantages and Disadvantages of Each of the
Three Methods
79
How to Choose a Particular Method 80
Consistency 80
Two-Dimensional Transient Problems 81
Example Problem: Two-Dimensional Transient
Heat Conduction in a Square Plate 83

112

5. NUMERICAL METHODS FOR INCOMPRESSmLE


FLUID FLOW

4. NUMERICAL METHODS FOR CONDUCTION


4.1
4.2
4.3
4.4
4.5

98

33

5.10

5.11
5.12
5.13
5.14
5.15
5.16

Introduction 119
Governing Equations 120
Difficulties in Solving Navier-Stokes Equations 120
Stream Function-Vorticity Method 121
General Algorithm for Solution by If! - ~ method 123
Creeping Flow (Very Small Reynolds Number) 125
InviscidFlow(Steady)
127
Determination of Pressure for Viscous Flow 128
Is the Transient Approach Used for Solving Steady
Flow Problems? 131
If! - ~ Method for 3-D Problems
131
The Primitive- Variables Approach
131
Simple (Semi-Implicit Method for Pressure-Linked
Equations) Procedure ofPatankar and Spalding (1972)
Computation of Boundary Layer Flow 138
Similarity Solutions of Boundary Layer Equations:
Shooting Technique 140
Finite Difference Approach 144
Von Mises Transformation
147
Summary 148
References
149
Exercise Problems

119

132

149

6. NUMERICAL METHODS FOR CONVECTION


HEAT TRANSFER
6.1
6.2
6.3

Introduction 153
Convection-Diffusion (Steady, One-Dimensional)
154
Convection-Diffusion (Unsteady, One-Dimensional)
158

153

xii

Contents

6.4
6.~
6.6
6.7
6.8
6.9

Contents xiii

Convection-Diffusion (Unsteady, Two-Dimensional)


159
Computation of Thermal Boundary Layer Flows (Part A) 162
Computation of Thermal Boundary Layer Flows (Part B) 163
Transient Free Convection from a Heated Vertical Plate 170
Problem Statement 171
Free Convection in Enclosure 174
Summary 175
References
175
Exercise Problems

176

References

7. SPECIALTOPICS I NEWMEmODS
7.1
7.2

7.3

A.7 Finite Element Method Based on Galerkin's Weighted


Residual Approach 268
A.8 Extension to 2-D and 3-D Problems 278
A.9 Accuracy of Solution 279
A.I0 Summary 279
A.ll Control Volume Formulation (also Known as Finite
Volume Method) 280
A.12 Closure 287

179

Introduction 179
New Method (I): Application of ADI Method to Solve
the Problem of 2-D Transient Heat Transfer from a
Straight Composite Fin 179
New Method (II): Alternative to Upwind SchemeApplication of Operator-Splitting Algorithm to Solve
Convection- Diffusion Problems 183

C.l
C.2

8.5
8.6

190

Introduction 190
Transient Combined Mixed Convection and
Radiation from a Vertical Aluminium Fin
(Ghoshdastidar and Raju, 1992) 190 .
Heat Transfer in Rotary Kiln Reactors 205
Modelling of Thermal Transport Processes in
Single-Screw Plasticating Extruder with Applications to
Polymer and Food Processing 220
Heat Transfer in Metal and Alloy Solidification 237
Cooling of Electronic Equipments 246

Appendix A Other Discretization Methods


A.l
A.2
A.3
A.4
A.5
A.6

The Essence of the Finite Element Methods 255


Finite Element Method Based on Variational Calculus
Convection Boundary Condition 265.
Two-Dimensional Steady State Problem 266
Three-Dimensional Problems 267
Summary 268

Appendix D

Reference

Summary 252
References 252

255
256

291

Subroutine TDMA 291


Demonstration Program Showing Application
of Subroutine TDMA 292
Reference

Index

288

The Essence of Runge-Kutta Methods 288


Simultaneous Ordinary Differential Equations 289
Solution of Higher Order ODE by R-K Methods 290
References 290

Appendix C Listing of Subroutine IDMA

8. SPECIALTOPICSn

8.3
8.4

Appendix B Runge-Kutta Methods


B.l
B.2
B.3

Summary 189
References 189

8.1
8.2

287

292

Numerical Method for Radiation in


Enclosure with Diffuse-Gray Surfaces:
The Absorption Factor Method

293

295

296

1
INTRODUCTION
1.1

WHAT IS COMPUTER SIMULATION?

The simulation of an industrial system on computer involves mathematical


representation of the physical processes undergone by the various components of
the system, by a set of equations (usually differential equations) transformed to
difference equations which are in turn solved as a set of simultaneous algebraic
equations.
At this stage, a reader uninitiated into the numerical methods may ask the
question "What is the role of computer here?". The aforesaid query is a valid one.
Many seem to forget that some of the numerical schemes (e.g. Finite-Difference)
that are extensively used today for solution of problems on computer were developed when computer was not even invented. Now, to return to the original question, the answer is that with the aid of the algorithm of the solution method translated into a programming language like FORTRAN fed into a computer which
does the arithmetic operations at a tremendous speed one can obtain the solution
of mathematical equations in seconds or even in fraction of a second. A simple
example will clarify this point. One can very easily solve a set of three linear
simultaneous algebraic equations. by hand through Gaussian Elimination
method.Typically in this method, for a system ofn equations the total number of
multiplications and divisions is roughly.!. n3 Therefore, for n = 3, the number of
3
operations is 9, which is clearly manageable by hand calculations. However, for
n 10, this number jumps to 333. For n 100, the number skyrockets to 333000.
A mainframe computer (e.g. VAX 8810) having an average megaflop * rating of
around 1 (that is, 106 arithmetic operations per sec) will solve the aforesaid problem in 0.333 second. A personal computer (e.g., IBM PC) with a megaflop rating

A mega is a million and flops is an abbreviation for floating point operations per
second. A floating point operation is an arithmetic operation (addition, subtraction,
multiplication and division) on operands which are real numbers with fractional
parts. NormaUy multiplications and divisions are counted asinajor arithmetic operations as compared to addition and subtraction on a computer.

Introduction

Computer Simulation of Flow and Heat Transfer

of 0.01 will take about 33 seconds. In computer simulation, it is possible to handle one hundred or more (even greater than thousand) number of equations and
there lies the necessity of using the computer.

1.2

ADVANTAGES OF COMPUTER SIMUlATION

Now that the use of computer in simulation is established, let us enumerate some
of the important advantages of computer simulation (also known as numerical
simulation):
It is possible to see simultaneously the effect of various parameters and
variables on the behaviour of the system since the speed of computing is
very high. To study the same in an experimental setup is not only difficult
and time-consuming but in many cases, may be impossible.
It is much cheaper than setting up big experiments or building prototypes
of physical systems.
Numerical modelling is versatile. A large variety of problems with
different levels of complexity can be simulated on a computer.
"Numerical experimentation" (another synonym for computer simulation)
allows models and hence physical understanding of the problem to be
improved. It is similar to conducting experiments.
In some cases, it is the only feasible substitute for ~xperiments, for
example, modelling loss of coolant accident (LOCA) in nuclear reactors,
numerical simulation of spread of fire in a building and modelling of
incineration of hazardous waste.
However, it is to be emphasized that not every problem can be solved by
computer simulation. Experiments are still required to get an insight into the
phenomena that are not well understood (and hence cannot be translated into the
language of mathematics) and also to check the validity of the results of computer
simulation of complex problems.

1.3 APPUCATIONS OF FLUID FLOW AND HEAT


TRANSFER
Fluid flow and heat transfer playa very important role in nature, living organisms
and in a variety of practical situations. More often than not, flow and heat transfer
are coupled and rarely an engineer solves a problem of either pure fluid flow or
pure heat transfer. In many applications flow and heat transfer are accompanied
by chemical reaction and/or mass transfer. The various applications of fluid flow
and heat transfer are:
All methods of power production, e.g. thermal, nuclear, hydraulic, wind,
and solar power plants.
Heating and air-conditioning of buildings.
Chemical and metallurgical industries, e.g. furnaces, heat exchangers,
condensers and reactors.

Design of IC engines.
Optimization of heat transfer from cooling fins.
Aircraft and spacecraft.
Design of electrical machinery and electronic circuits.
Cooling of computers.
Weather prediction and environmental pollution.
Materials processing such as solidification and melting, metal cutting,
welding, rolling, extrusion, plastics and food processing in screw
extruders, laser cutting of materials.
Oil exploration.
Production of chemicals such as cement and aluminium oxide.
Drying.
Processing of solid and liquid wastes.
Bio-heat transfer (as in human and animal bodies).

It is no wonder that J.B. Joseph Fourier, father of the theory of heat diffusion
made this remark in 1824 "Heat, like gravity, penetrates every substance of the
universe; its rays occupy all parts of space. The theory of heat will hereafter form
one of the most important branches of general physics". Lord Kelvin, in 1864
obtained a rough estimate of the age of earth based on an idea proposed by Fourier
in 1820 to be 94 x 106 years (0.094 billion years) by applying the principle of
transient heat conduction in a semi-infinite solid. Modem dating methods have
revealed the age of earth to be approximately 4.7 billion years. So Kelvin's result
was not really too far off the mark considering the fact that the data for the measured value of the geothermal gradient (rate of increase of temperature of earth
with depth), average thermal diffusivity of rock and the initial temperature of
molten earth when cooling began available with him at that time were not very
,ccurate. The aforesaid example is probably the first known application of heat
transfer simulation.

1.4

WHY IS COMPUTER SIMUlATION NECESSARY


IN FLUID FLOW AND HEAT TRANSFER?

Ifope looks at a classical textbook on fluid dynamics and heat transfer, one would
find only a handful of analytical (or exact) solutions. In actual situations, problems are lot more complex as in those involving non-linear governing equations
and/or boundary conditions, and irregular geometry which do not allow analytical solutions to be obtained. Therefore, it is necessary to use numerical techniques for most problems of practical interest. Furthermore, to design and
optimize thermal processes and systems, numerical simulation of the relevant
transport phenomena is a must, since experimentation is usually too involved and
expensive. However, necessary experimentation must still be done in checking
the accuracy and validity of numerical results. Sometimes, numerical model can
be refined by input from results of a companion experimental set-up for the same
problem.

4 Computer Simulation of Flow and Heat Transfer


1.5

BASIC APPROACH IN SOLVING A PROBLEM


BY NUMERICAL METIIOD

Suppose we wish to. obtain the temperature field in the domain as shown in
Fig. 1.1. We imagine that the domain is filled by a grid, and seek the values of
temperatures at the grid points. Therefore, the energy equation (which is the
governing differential equation for the problem) is valid at all the grid points. The
governing differential equation is then transformed into a system of difference
equations resulting in a set of simultaneous algebraic equations which means that
if there are 100 grid points (where variables are not known) there will be 100
equations to solve per variable. The simplification inherent in the use of algebraic
equations rather than differential equations is what makes numerical methods so
powerful and widely applicable.
x

Grid points
(known temperatures)

o Grid points
(unknown temperatures)

Introduction

For the problem shown in Fig. 1.1, since there are 16 tiny squares, GG = 16. If
a direct method like Gaussian Elimination method is used, then SS = 1, VG = 1,
FP

= 1. (9)3 = 243.
3

PC

= 16 x 1 x 1 x 243 = 3.89 x 103 operations

Thus, even with a fairly coarse grid, the number of operations is quite large.
Currently a large number of realistic applications like modelling of supersonic
aircraft or weather prediction requires 1012 to 1014 operations per solution
(Rajaraman, 1993). If each solution has to be done in about an hour, then the
average speed of computing should be 1014/60 x 60 operations per second which
is equal to 27,700 Megaflops! The peak megaflop rating of modem supercomputers is around 1000 megaflops (Rajaraman, 1993). From the aforesaid example, it is clear why we need supercomputers with speeds in thousands of megaflops
range to solve extremely complex problems.

1.7 A COMPARATIVE STUDY OF EXPERIMENTAL,


ANALYTICAL AND NUMERICAL METIIODS
(a) Experimental Method Experimental methods are used to obtain reliable
informations about physical processes that are not well understood, e.g. combustion and turbulence. It may involve full scale, small scale or blown-up scale
models. The major disadvantages of experimental investigations are high cost,
measurement difficulties and probe errors. Often, small scale models do not always simulate all the features of the full scale set-up. The advantage is that it is
most realistic.

Fig. 1.1

1.6

4 x 4 grid for computation of two-dimensional


steady-state heat conduction in a square plate

PROBLEM COMPLEXI1Y

(b) Analytical Method Analytical methods or methods of classical mathematics are used to obtain the solution of a mathematical model consisting of a set of
differential equations which represent a physical process within the limit of assumptions made. Only a handful of analytical solutions are available in heat transfer and fluid mechanics because analytical methods are inadequate in handling
complex boundary and non-linearities in the differential equations and/or boundary conditions. Furthermore, the analytical solutions often contain infinite series,
-special functions, transcendental equations for eigenvalues, etc. the numerical
evaluation of which becomes quite cumbersome.

In general, the problem complexity is described by the formula


PC= GGx VGxSSxFP
where,

PC problem complexity
GG = geometry of the grid system
VG = variables per grid point
SS = number of steps per simulation for solving problem
FP = number of floating point operations per variable.

(c) Numerical Method As explained in Sec. 1.5, a numerical prediction works


out the consequences of a mathematical_ model but the solution is obtained for
variables at discrete grid points in the computational domain in contrast with
analytical method which gives closed form solution at all points (theoretically
infinite number of points in the solution domain or continuum). The major advantages of numerical solution are its abilities to handle complex geometry and nonlinearities in the governing equation and/or boundary conditions. Other advantages of numerical method are briefly described below:

6 Computer Simulation of Flow and Heat Transfer

Introduction 7

Low Cost While prices of most items are increasing, cost of computing
(mainframe, mini and PC's) is going down every year.
High Speed In the past 20 years there has been a thousand fold increase
in the speed of arithmetic operations of computers.
Complete Information A Computer simulation gives detailed and
complete information of all the variables over the computational domain.
Ability to simulate realistic conditions For a computer program, there
is absolutely no problem in having an area of size 10 km x 10 km or
10-6 m x 10-6 m, 5000 C or -50C, hazardous or flammable material.
Ability to simulate ideal conditions There is no problem in idealizations
like two-dimensionality, insulated or isothermal boundary, infinite
reaction rate. On the other hand, it is extremely difficult, if not impossible
to set up the same in experiments.

The disdvantages of numerical predictions are the associated truncation error


and round-off error and the difficulty in simulating complicated boundary conditions.
The aforesaid discussion can now be represented in a capsuled form in
Table 1.1.
Table 1.1 Comparison of Experimental, Analytical and
Numerical Methods of Solution
Name of the Method
1. Experimental

Advantages
Capable of
Being most
realistic

2. Analytical

Clean, general
information
which is
usually in
formulaform

3. Numerical

No restriction
to linearity
Ability to handle
irregulargeometry
and complicated
physics
Low cost and
high speed of
computation

Disadvantages
Equipment
required
Scaling
problem
Measurement
difficulties
Probe errors
High operating costs
Restricted
to simple
geometry
and physics
Usually
restricted
to linear problems
Cumbersome
results-difficult
to compute
Truncation
and round-off errors
Boundary
condition
problems

1.8

METHODS OF DISCRETIZATION

There are several methods of discretizing a given differential equation. They are
briefly described below.
(a) Finite-Difference Method .The ilsual procedure for deriving finite-difference equations consists of approximating derivatives in the differential equation
via a truncated Taylor series. The method includes the assumption that the variation of the unknown to be computed is somewhat like a polynomial in x, y or z so
that higher derivatives are unimportant. The great popularity of finite-difference
methods is mainly due to their straight-forwardness and relative simplicity by
which a newcomer in the field is able to obtain solutions of simple problems. As
a matter of fact, the subject of Computational Fluid Dynamics (commonly abbreviated as CFD) was born as early as 1933 (remember that world's first computer
called ENIAC was built at the University of Pennsylvania, USA, in 1946) with
the remarkable work (published in the proceedings of the Royal Society) ofThom
(1933) who solved the Navier-Stokes equations for the steady, incompressible
viscous flow around a circular cylinder by finite-difference method using hand
calculations. However, several shortcomings and limitations of finite-difference
method came to light when researchers tried to solve problems with increasing
degree of physical complexity such as, for example, flows at higher Reynolds,
numbers, flows around arbitrarily shaped bodies, strongly time-dependent flows,
etc. (Fasel, 1978). This led to a search for and development of superior methods,
particularly in the areas where difference methods seemed to have disadvantages.
These methods can be divided into two main categories (i) finite-element methods
and (ii) spectral methods.
(b) Finite-Element Method (FEM) Finite-element methods basically seek solutions at discrete spatial regions (called elements) by assuming that the governing
differential equations apply to the continuum within each element. It is based on
integral minimization principle and provides piecewise (or regional) approximations to the governing equations.
Finite-element methods were already found to be successful in solid mechanics applications. Their introduction and ready acceptance in fluid mechanics was
due to relative ease by which flow problems with complicated boundary shapes
can be modelled, especially when compared with finite-difference methods. However, disadvantages of FEM arises from the fact that more complicated matrix
operations are required to solve the resulting system of equations. Furthermore,
meaningful variational formulations are difficult to obtain for high Reynolds
number flows. Hence, variational principle-based FEM is limited to solutions of
creeping flow and heat conduction problems.
Galerkin's weighted residual method, which is also another finite-element
method is a powerful method and circumvents the difficulties faced by variational

You might also like