Professional Documents
Culture Documents
Lecture 1
GENERAL INTRODUCTION: HISTORICAL
BACKGROUND AND SPECTRUM OF APPLICATIONS
1.1 INTRODUCTION
Analysis of physical problems in any area of engineering and science involves a multi-
pronged approach:
Idealized physical model: experiments on scale models of the problem
Mathematical model: Theoretical analysis (analytical solution) / approximate
numerical solution.
Physical
Problem
Experimental Mathematical
Analysis Modeling
Note that although word heat transfer is missing from CFD, it is an intrinsic part of this
discipline.
CFD deals with approximate numerical solution of governing equations based on the
fundamental conservation laws of physics, namely mass, momentum and energy
conservation. The CFD solution involves
Conversion of the governing equations for a continuum medium into a set of discrete
algebraic equations using a process called discretization.
Solution of the discrete equations can using a high speed digital computer to obtain
the numerical solution to desired level of accuracy.
Algorithmic Front
1960s: Development of Particle-In-Cell (PIC), Marker-and-Cell (MAC) and Vorticity-
Stream function methods at NASA.
WEB RESOURCES
http://www.cfd-online.com/
Figure 1.3 Pressuree distributioon around a high-speedd train obtainned from RANS
R simulation
(a) CAD
D model of geometry
g (b) Structurred Grid used in CFD analysis
a
(c) P
Pressure disstribution ovver runner blades
b (d) Pressure contours in
i stator andd runner
Figurre 1.4 RAN NS simulatioon of turbuleent flow in a Francis tuurbine
D K M Sin
Dr ngh, Indian
n Institute oof Technoloogy Roorkeee NPTE
EL L1.6
COMPUTATIONAL FLUID DYNAMICS INTRODUCTION: Numerical Simulation Process
Lecture 2
NUMERICAL SIMULATION PROCESS
2.1 NUMERICAL SIMULATION PROCESS
Numerical simulation of a physical problem involves approximation of the problem
geometry, choice of appropriate mathematical model and numerical solution techniques,
computer implementation of the numerical algorithm and analysis of the data generated by
the simulation. Thus, this process involves the following steps:
Model the geometry of the problem domain.
Choose appropriate mathematical model of the physical problem.
Choose a suitable discretization method.
Generate a grid based on the problem geometry and the discretization method.
Use a suitable solution technique to solve the system of discrete equations.
Set suitable convergence criteria for iterative solution methods.
Prepare the numerical solution for further analysis
Let us have a bit more detailed look at the preceding steps. Each of these steps clearly
reminds us of the approximations involved at each step of numerical simulation: from
approximations/idealizations used in geometry modelling to solution process and post-
processing.
2.2GEOMETRY MODELLING
The numerical simulation requires a computer representation of the problem domain. For
most of the engineering problems, it may not be possible or even desirable to include all the
geometric details of the system in its geometric model. The analyst has to make a careful
choice regarding the level of intricate details to be chosen. For example, in the numerical
simulation of flow field around an automobile, finer details of the front air-intake grills would
be avoided. Incorporation of these finer features would make the grid generation process very
difficult, but would hardly contribute to the accuracy of the velocity and pressure fields.
turbulent flows. Similarly, commercial CFD codes have shown a distinct preference for the
finite volume method.
The convergence criterion for the iterative solvers depends on the accuracy as well as
efficacy requirements. The tightness of the specified error tolerance would also depend on the
precision chosen for numerical computations.
2.7 POST-PROCESSING
Numerical simulation provides values of field variables at discrete set of computational
nodes. For analysis of the problem, the analyst would like to know the variation of different
variables in space-time. Further, for design analysis, secondary variables such a stresses and
fluxes must be computed. Most of the commercial CFD codes provide their own post-
processor which compute the secondary variables and provide variety of plots (contour as
well as line diagrams) based on the nodal data obtained from simulation. These computations
involve use of further approximations for interpolation of nodal data required in integration
and differentiation to obtain secondary variables or spatial distributions.
2.8 VALIDATION
Numerical solution of a physical problem must be validated with available experimental data
to ensure that it gives a reasonably accurate description of the physical reality. In general,
numerical solution is sought for a problem for which no experimental results are available.
For example, it is not feasible to perform experiments on a full scale prototype of an airplane
or high-speed train. In such situations, validation of the simulation process is carried out with
the scale model for which experimental data are available. Thereafter, the simulation process
can be extended for numerical solution of the full-scale problem.
REFERENCES/SUGGESTED READING
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Lecture 3
APPROXIMATE SOLUTION TECHNIQUES
3.1 INTRODUCTION
Numerous approximate solution techniques have been developed for different types of
problems in CFD. These methods can be classified into two categories:
Mesh-based methods which require discretization of the problem domain into a
mesh (or grid), e.g. finite difference, finite element, and finite volume methods.
Mesh-free methods which primarily use a collection of nodes with no apparent
connectivity, e.g. smooth particle hydrodynamics (SPH), mesh-less Petrov-
Galerkin (MLPG), lattice Boltzmann methods.
Of the preceding two types, mesh-based methods are more popular in CFD. Of these, finite
volume method has been the most popular due to its simplicity and ease of application for
problems in complex geometries. In fact, majority of commercial CFD packages (e.g. Fluent,
StarCD, etc.) are based on finite volume method. In this lecture, we will have a brief
overview of finite difference, finite element and finite volume methods.
The main disadvantage of the finite difference method is its restriction to simple
geometries (although immersed boundary techniques do remove this restriction). We provide
a detailed description of this method in the following section.
FEM is ideally suited to problems on complex geometries, and hence, this method has
been very popular in computational solid mechanics. There is an extensive literature available
on all aspects of this method: type of elements, shape functions, mesh generation,
applications to different type of problems, etc. For detailed study of FEM, interested reader
can refer to books by Zienkiewicz et al. (2005a, 2005b), Reddy (2005), Reddy and Gartling
(2010) amongst others.
The FVM can accommodate any type of grid, and hence, it is naturally suitable for
complex geometries. This explains its popularity for commercial CFD packages, which must
cater to problems in arbitrarily complex geometries. This method has immensely benefited
from the unstructured grid generation methods developed for the finite element method.
REFERENCES/SUGGESTED READING
Anderson, J. D., Jr. (1995). Computational Fluid Dynamics: The Basics with Applications.
McGraw Hill, New York.
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Reddy, J. N. (2005). An Introduction to the Finite Element Method. 3rd Ed., McGraw Hill,
New York.
Reddy, J. N. and Gartling, D. K. (2010). The Finite Element Method in Heat Transfer and
Fluid Dynamics, 3rd ed., CRC Press
Zienkiewicz, O. C., Taylor, R. L., Zhu, J. Z. (2005b). The Finite Element Method: Its Basis
and Fundamentals, 6th Ed., Butterworth-Heinemann (Elsevier).
Lecture 4
CONSERVATION LAWS AND MATHEMATICAL
PRELIMINARIES
4.1 CONSERVATION LAWS
CFD is based on fundamental governing equations of fluid dynamics which are essentially
mathematical models of conservation laws of physics. Assuming a fluid to be a continuum,
these conservation laws are
1. Conservation of mass
2. Conservation of momentum (Newtons second law)
3. Conservation of energy (first law of thermodynamics)
These conservation laws are supplemented with constitutive relations (e.g. stress-strain rate
relation, heat diffusion law, etc.) for a specific material.
In this lecture, we provide a brief overview mathematical notation and a few important
theorems which are used to obtain mathematical statements of the conservation laws, in
integral as well as differential forms. The integral forms provide the starting point for the
finite volume method whereas the differential form of conservation equations is used by the
finite difference and the finite element methods. This lecture closely follows the approach of
Kundu and Cohen (2008) and Panton (2005) which should be consulted for further details
and supplemental reading.
Summation convention
A repeated index in a term implies summation over the range of that index. For example
ai bi ai bi (Dot product of two vectors a and b) (4.1)
i
vi v v v v
i 1 2 3 (Divergence of vector v) (4.2)
xi xi x1 x2 x3
Kronecker delta
The Kronecker delta, ij , is a second order isotropic tensor defined as
1 if i j
ij (4.3)
0 if i j
Substitution property of Kronecker delta:
ij u j ui (4.4)
Gradient operator ( )
The gradient operator, (del) is the vector operator defined as
i j k ii (4.14)
x y w xi
When operated on a scalar function , it generates a vector whose ith component is / xi .
Divergence operator ( . )
The divergence of a vector field is defined as the scalar quantity given by
v v v v
.v i 1 2 3 (4.15)
xi x1 x2 x3
Divergence of a second order tensor yields a vector whose ith component is given by
. i ij (4.16)
x j
Thus, divergence operator decreases the order of a tensor by 1, whereas gradient operator
increases the order of a tensor by 1.
which is popularly known as Gauss divergence theorem. Gauss divergence theorem is used to
convert a surface integral to a volume integral (or vice-versa).
provides a relation between the time rates of change in two descriptions, and is used to obtain
the integral form of the conservation laws for a fluid medium.
where CM represents the volume of the system which occupies the control volume at a
given instant of time and is mass density. Reynolds transport theorem states that the time
rate of change of for the system is equal to the rate of change of in control volume plus
net flux of through boundaries of the control volume, i.e.
d
d v v c dA (4.20)
dt CM t S
where v c is velocity of the control volume with respect to the fixed inertial reference frame
in which v is defined, and S denotes the boundary surface of the control volume. The second
term on RHS is usually called the convective (or advective) term.
We would employ the preceding notations and theorems to derive the integral as well as the
differential forms of the mass, momentum and energy equations in next few lectures.
REFERENCES
Kundu, P. K. and Cohen, I. M. (2008). Fluid Mechanics, 4th Ed., Academic Press.
Panton, R. L. (2005). Incompressible Flow, 3rd Ed., Wiley.
Lecture 5
CONTINUITY EQUATION
Reynolds transport theorem (L4.22) yields the following integral form for the mass
conservation (or continuity) equation for a stationary control volume:
t
d v dA 0 (5.1)
S
The preceding equation holds for any control volume which is possible only if the integrand
vanishes everywhere, i.e.
. v 0 (5.4)
t
Equation (5.4) represents the differential form of continuity equation in vector notation. In
Cartesian coordinates with usual notation of velocity components (i.e. v ui vj wk vi i i ),
the continuity equation becomes
u v w vi
0 (5.5)
t x y z t xi
The differential form (5.4) or (5.5) can be also derived by considering mass conservation for
an infinitesimal differential control volume (see Example 5.1 below). Expanded form of
continuity equation in cylindrical polar and spherical polar coordinates can be found in any
text on fluid mechanics, e.g. Kundu and Cohen (2008) and Panton (2005).
Example 5.1
Derive the differential form of continuity equation using an infinitesimal differential control
volume in Cartesian coordinates.
Solution
Let us consider flow of a fluid through an infinitesimal differential control volume of
dimensions dx, dy and dz. For the sake of clarity, Figure 5.1 depicts the flow through a two-
dimensional control volume. The mass flow rate of fluid entering from the left face (negative
x-face) of the CV is udydz and the mass flow rate leaving the positive x-face of the CV is
u
u dx dydz. Further, the mass flow rate entering from the bottom face (negative y-
x
face) of the CV is vdxdz and the mass flow rate leaving the top face (positive y-face) of the
v
CV is v dy dxdz. Therefore,
y
u
Net mass efflux rate through x-faces = u dx dydz udydz
x
u
= dxdydz
x
v
Net mass efflux rate through y-faces = v dy dxdz vdxdz
y
v
= d xd y d z
y
v
v dy
y y
u
u u dx
dy
x
dx
v
Figure 5.1 Mass fluxes through two-dimensional differential control volume
w
Net mass efflux rate through z-faces = dxdydz
z
u v w
Hence, the net mass efflux rate = dxdydz
x y z
Rate of accumulation of mass inside the CV = dxdydz
t
For mass conservation, the rate of mass accumulation in the control volume must be negative
of the net mass efflux rate, i.e.
u v w
dxdydz dxdydz
t x y z
Dividing both sides by the differential volume dxdydz and transferring all the terms on one
side gives the following equation for mass conservation:
u v w
0
t x y z
which is same as the continuity equation (5.5) derived from the integral form of the continuity
equation.
Exercise 5.1: Derive the differential form of continuity equation in polar coordinates by take
an infinitesimal control volume in (a) cylindrical polar coordinates and (b) spherical polar
coordinates.
REFERENCES
Kundu, P. K. and Cohen, I. M. (2008). Fluid Mechanics, 4th Ed., Academic Press.
Panton, R. L. (2005). Incompressible Flow, 3rd Ed., Wiley.
Lecture 6
MOMENTUM EQUATION
where P is the linear momentum of the system. The intensive property corresponding to P is
v . Hence, from Reynolds transport theorem for a fixed control volume
dP
t
vd vv dA (6.3)
dt
S
Rate of change of Rate of efflux of momentum
momentum in the CV across the control surface
Net force F on the control volume can be expressed as sum of the surface force, FS (pressure,
viscous stress), and body force, FB (gravity, electromagnetic, centrifugal, Coriolis etc.), i.e.
F FS FB (6.4)
The surface force FS essentially represents microscopic momentum flux across a surface and
can be expressed as
FS dA (6.5)
S
FB b d (6.6)
where b is body force per unit mass. Combining (6.2)-(6.6), the integral form of momentum
equation can be written as
t
v d vv dA dA b d (6.7)
S S
Convective flux Diffusive flux
Note that since momentum is a vector quantity, its convective and diffusive fluxes are the
scalar products of second order tensors vv and with the surface vector dA.
( v)
. vv . b d 0 (6.9)
t
Equation (6.9) holds for any control volume which is possible only if the integrand vanishes
everywhere, i.e.
( v)
. vv . b (6.10)
t
Equation (6.10) is referred as the conservative or strong conservation form of momentum
equation. It is also known as Cauchy equation of motion.
The integral form of momentum equation (6.7) or its differential form represented by
Eq. (6.10) is applicable to an inertial control volume. Similar forms can be derived for
moving control volumes and non-inertial reference frames (Batchelor 1973, Panton 2005,
Kundu and Cohen 2008).
( v) v
. vv . v v v v
t t t
Using continuity equation (5.4), the first term on the RHS of the preceding equation vanishes.
Thus, Eq. (6.10) takes the following form:
v Dv
v v . b or . b (6.12)
t Dt
where the operator (D/Dt) denotes the material or particle derivative. Equation (6.12) is
referred to as the non-conservative form of the momentum equation.
Example 6.1
Derive the differential form of the momentum equation using an infinitesimal differential
control volume in Cartesian coordinates.
Solution
Let us consider flow of a fluid through an infinitesimal differential control volume of
dimensions dx, dy and dz. For the sake of clarity, Figure 6.2 depicts the flow through a three-
dimensional control volume, and the forces acting on the surfaces of the control volume in x-
direction only. The resultant force in x-direction is
Fx bx dxdydz xx xx dx xx dydz
x
yx
yx dy yx dxdz + zx zx dz yx dxdy
y z
yx zx
= bx xx dxdydz
x y z
Similarly, components of the resultant force in y- and z-directions are
xy yy zy
Fy by dxdydz
x y z
yz zz
Fz bz xz dxdydz
x y z
Figure 6.2 Forces acting on the faces of a differential control volume (only the x-components
are shown in the figure for clarity)
Rate of momentum u u
u dx dydz u dx ( udydz )u
efflux in x-direction x x
v u dy u dy
+ v dy dxdz u -( vdxdz ) u
y y 2 y 2
w u dz u dz
+ w dz dxdy u -( wdxdy ) u
z z 2 z 2
u u v u w u
u u u v u w dxdydz
x x y y z z
uu uv uw
dxdydz
x y z
Similarly, rate of momentum efflux in y- and z-directions are
Rate of momentum uv vv vw
dxdydz
efflux in y -direction x y z
Rate of momentum uw vw ww
dxdydz
efflux in z -direction x y z
DPx ( u ) uu uv uw
dxdydz dxdydz
Dt t x y z
yx zx
= Fx bx xx dxdydz
x y z
which can be simplified to obtain the x-component of momentum equation. We can similarly
obtain y- and z-components of the momentum equation, and these equations are given by
( u ) uu uv uw yx zx
bx xx
t x y z x y z
( v) uv vv vw xy yy zy
by
t x y z x y z
( w) uw vw ww yz zz
bz xz
t x y z x y z
The preceding equations represent the conservation form of the momentum equation. Non-
conservation form can be obtained using alternative form of the Newtons second law given
by
Dv
ma ( dxdydz ) F
Dt
Thus,
Du yx zx
max ( dxdydz ) Fx bx xx dxdydz
Dt x y z
Simplification of the preceding equation and similar equations for y and z-components leads
to the non-conservation form of momentum equation in Cartesian component form given by
the following set of scalar equations:
Du yx zx
bx xx
Dt x y z
Dv xy yy zy
by
Dt x y z
Dw yz zz
bz xz
Dt x y z
Exercise 6.1: Derive the differential form of momentum equation in polar coordinates by
take an infinitesimal control volume in (a) cylindrical polar coordinates and (b) spherical
polar coordinates.
REFERENCES
Batchelor, G. K. (1973). An Introduction to Fluid Dynamics. Cambridge University Press,
Cambridge.
Kundu, P. K. and Cohen, I. M. (2008). Fluid Mechanics, 4th Ed., Academic Press.
Panton, R. L. (2005). Incompressible Flow, 3rd Ed., Wiley.
Lecture 7
NAVIER-STOKES EQUATIONS
Most of the common fluids (e.g. air, water, and gases) have little or no memory, and the
stress-strain rate relationship is linear. Such fluids are called Newtonian fluids for which
constitutive relationship becomes (Panton, 2005)
p I ( v ) I 2 S (7.3)
where and are fluid properties (called viscosities). For a wide class of Newtonian fluids,
the bulk viscosity, 3 2 , is quite small, i.e. 3 2 0. This is called the Stokes
hypothesis, and leads to the following constitutive relation for Newtonian fluids:
1
pI 2 S ( v)I (7.4)
3
where is the (dynamic) viscosity of the fluid. Substitution of relation (7.4) into momentum
equation (6.10) leads to the so-called Navier-Stokes equation in conservation form given by
( v) 1
. . vv b p 2. S ( v)I (7.5)
t 3
Non-conservation form of Navier-Stokes equation can be obtained by substituting Eq. (7.4)
into Eq. (6.12) and is given by
v 1
v v b p 2. S ( v)I (7.6)
t 3
2 v b p 0 (7.12)
REFERENCES
Batchelor, G. K. (1973). An Introduction to Fluid Dynamics. Cambridge University Press,
Cambridge.
Kundu, P. K. and Cohen, I. M. (2008). Fluid Mechanics, 4th Ed., Academic Press.
Panton, R. L. (2005). Incompressible Flow, 3rd Ed., Wiley.
Lecture 8
ENERGY AND SCALAR TRASPORT EQUATIONS
DE Q W
(8.1)
Dt t t
where E denotes the total stored energy which consists of kinetic energy, potential energy and
internal energy. The potential energy usually represents the work done by the external force
field (i.e. body forces), and hence, this part can be accounted for by the second term on RHS
of Eq. (8.1). Hence, we take the stored energy E as the sum of the internal energy and kinetic
energy, and its specific measure (i.e. stored energy per unit mass) is given by
1 2
e v (8.2)
2
where e represents internal energy per unit mass. From Reynolds transport theorem, the rate
of increase of the stored energy is given by
DE
Dt t
d v dA (8.3)
S
Energy addition by heat transfer can be due to volumetric heat generation and heat transfer
across the surface of the control volume. Thus,
Q
t g
q d q dA (8.4)
S
where q g is the rate of volumetric heat generation and q is the surface heat flux.
Rate of work done is obtained by taking dot product of force with velocity vector. Note that
surface force is given by dot product of stress tensor by area vector. Thus, rate of energy
addition due to the work done on the system by body as well as surface forces is given by
W
t S
v ( dA) v ( b) d (8.5)
Substitution of Eqs. (8.3)-(8.5) into Eq. (8.1) yields the integral form of the total energy
equation:
t
d v dA q g d q dA v ( dA) v ( b) d (8.6)
S S S
Using Gauss divergence theorem, the preceding equation leads to the following differential
equation for the total energy:
v dA ( v)d, q dA q d and v ( dA) ( v ) d (8.7)
S S S
Equation (8.8) holds for any control volume which is possible only if the integrand vanishes
everywhere leading to the following differential equation for the total energy:
( )
. v q g .q .( v ) v ( b) (8.9)
t
To obtain the equation of thermal energy, we subtract the equation for mechanical energy
(which can be obtained by taking the dot product of velocity v with momentum equation
(6.10)) from the preceding equation. After some algebraic manipulation, we obtain the
equation for thermal energy given by
( e)
. ev q g .q v : (8.10)
t
where the double dot product is defined as
u j
v : ij (8.11)
xi
The last term in the thermal energy equation consists of the work done by pressure and
viscous dissipation. For the low speed flows (i.e. flow speeds are small as compared to the
speed of sound), viscous dissipation part is negligible. Pressure related term has the form
p.v and can be combined with the left hand side of Eq. (8.10) to give the following
equation:
DT
C p q g .q (8.12)
Dt
If the heat flux obeys the Fouriers law q k T , and thermal conductivity k is assumed
constant, Eq. (8.12) simplifies to
DT 1
q g 2T (8.13)
Dt C p
where q represents the volumetric generation (or source) term and q denotes the surface
flux associated with . Usually, the surface flux is related to by a gradient law (such as
Fouriers law for heat conduction, Ficks law for mass diffusion) which can be expressed as
q . Substituting this expression in Eq. (8.17) and use of Gauss divergence theorem
leads to the following differential equation for transport of :
( )
. v q ( ) (8.18)
t
In Cartesian coordinates, Eq. (8.18) takes the form
t
x j
v j
x j x j
q (8.19)
Preceding equation represents the conservation form of the transport equation. Expanding
terms on the left had side, and using the continuity equation, one can obtain the non-
conservation form of the transport equation given by
D
( v.) q ( ) (8.20)
Dt t
It can be easily observed that Eq. (8.19) [or Eq. (8.20)] can be made to represent the mass,
momentum or energy equation by proper choice of the flux and source terms. Thus, in this
course on CFD, we will first focus our discussion on the approximation techniques for the
generic transport equation (8.19), and then discuss their application and extension to the
solution of Navier-Stokes equations.
Let us note that general form of all the conservation equations is similar: each equation
contains a temporal derivative, a convective term, a diffusive term and a source term. This
commonality is exploited in CFD while developing algorithms and computer programs to
solve the fluid flow and scalar transport problems. Further, all of these equations are coupled
nonlinear partial differential equations. Thus, analytical solution is very difficult (if not
impossible), and approximate numerical solution using techniques of CFD is required for
practical problems.
REFERENCES
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Kundu, P. K. and Cohen, I. M. (2008). Fluid Mechanics, 4th Ed., Academic Press.
Panton, R. L. (2005). Incompressible Flow, 3rd Ed., Wiley.
Lecture 9
CLASSIFICATION OF GOVERNING EQUATIONS
9.1 INTRODUCTION
The governing equations of fluid flow (momentum, energy or scalar transport) are second
order partial differential equations (PDEs). Choice of the numerical solution technique and
number of initial/boundary conditions required for their solution depends on their
mathematical character. However, since these equations are system of coupled nonlinear
equations in four independent variables (time + three space coordinates), their mathematical
classification is rather difficult. Nevertheless, a classification of these equations is usually
applied to the linearized form of Navier-Stokes equations.
2u 2u 2u u u
A B C D E Fu G 0 (9.1)
x 2
xy y 2
x y
where A, B, C, D, E, F and G are functions of x and y. Let us assume that A 0 and
B 2 4 AC is of uniform sign for the range of values of x and y of interest. Classification of
PDE (9.1) is based on the type of roots of the associated characteristic equation
2
dy dy
A B C 0 (9.2)
d x dx
Let r ( x, y ) and s ( x, y ) be the solutions of the preceding equation. Each of these is called a
characteristic. Existence of these roots depends on the value of the discriminant B 2 4 AC.
We list in Table 9.1 the type of the PDE for each of the three possible cases.
The type name for the PDE has been assigned in analogy with conic sections from analytical
geometry wherein the quadratic equation
Ax 2 Bxy Cy 2 Dx Ey F 0
represents a hyperbola if B 2 4 AC 0 , a parabola if B 2 4 AC 0 and an ellipse if
B 2 4 AC 0 .
The classification of PDE tells us about physical behaviour of the problem. The
propagation of information (e.g. effect of disturbance introduced in a flow field) takes place
along the characteristics. It also sets the required number of initial/boundary conditions for
the given problem.
2 2
0 (9.5)
x 2 y 2
which may describe steady state heat conduction or potential flow problem.
Energy equation has the same behaviour, i.e. it is elliptic for steady flows, and parabolic, for
time dependent problems. Unsteady Navier-Stokes and energy equations are in fact parabolic
in time and elliptic in space. Hence, solution of these equations requires (a) one set of initial
conditions, and (b) boundary conditions at all the boundary points for all values to time t > 0.
Compressible Navier-Stokes equations may be considered as mixed hyperbolic, parabolic and
elliptic (or incompletely parabolic) equations.
Note that elliptic equations are more difficult to solve than parabolic equations, which
lend themselves to marching type solution procedure. Thus, in practice, steady viscous flows
are usually converted to unsteady problems, and solved using a time marching scheme. The
solution obtained for large values of time t provides the desired solution of the steady viscous
flow problem.
Abbett, 1966), since the unsteady Euler equation for compressible flows is hyperbolic
everywhere (irrespective of the local Mach number). In fact this time dependent approach to
steady state is also widely used now for solution of steady state viscous flows.
REFERENCES
Anderson, J. D., Jr. (1995). Computational Fluid Dynamics: The Basics with Applications.
McGraw Hill, New York.
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Moretti, G. and Abbett, M. (1966). A time-dependent computational method for blunt body
flow. AIAA Journal, 4, 2136-2141.
Versteeg, H. K. and Malalasekera, W. M. G. (2007). Introduction to Computational Fluid
Dynamics: The Finite Volume Method. Second Edition (Indian Reprint) Pearson Education
Lecture 10
BOUNDARY CONDITIONS
1. Physical boundary conditions which are imposed by the physical processes at the
bounding surfaces of the flow domain, and
2. Artificial boundary conditions which are specified at the boundaries of computational
domain which are not natural boundaries (sometimes referred to as the fluid
boundaries).
The artificial boundaries arise from the approximation of physical problem domain for
numerical simulation in both internal and external flows. For example, in simulation of flow
over an aircraft, its solid surface represents the natural physical boundary. Flow is otherwise
unbounded, i.e. flow domain is infinite. However, numerical simulation requires a finite
computational domain. Thus, artificial external boundaries must be chosen, and appropriate
values of flow parameters must be specified based on physical reasoning.
For inviscid flows, the fluid can freely slip over the surface. However, there can be no
velocity component normal to the surface. This velocity boundary condition is called free slip
condition, and is given by
v n 0 where v n is velocity component normal to the solid surface.
Conditions on artificial or fluid boundaries can take variety of form: inlet, outflow,
symmetry, cyclic or periodic are few of the popular types of boundary conditions specified on
fluid boundaries. Details of these boundary conditions are:
Inlet: specified pressure, velocity, temperature and density as a function of
position.
Outflow boundary condition: specified pressure, v n / n 0, T / n 0.
Symmetry boundary condition: / n 0 for all flow variables .
Periodic boundary condition: 1 2 for all flow variables where subscripts 1
and 2 denote the periodic boundaries.
REFERENCES
Anderson, J. D., Jr. (1995). Computational Fluid Dynamics: The Basics with Applications.
McGraw Hill, New York.
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Lecture 11
FINITE DIFFERENCE METHOD: METHODOLOGY AND
GRID NOTATION
Each node is identified by a set of indices which are the indices of the grid lines that intersect
at it. Thus,
Node i represents the grid point x = xi in one dimension.
Node (i,j) represents the intersection point of grid lines x = xi and y = yj in 2-D.
Node (i,j,k) represents the intersection point of grid lines x = xi, y = yj and z = zk in
3D.
1 i-1 i i+1 M
j+1
(i,j)
j
j-1
1
1 i-1 i i+1 M
Figure 11.2 Two dimensional finite difference grid
A finite difference grid is called a uniform grid if the spacing between the grid lines of the
same family is constant, i.e. xi 1 xi xi xi 1 x, for all i. Similarly, for multi-dimensional
In view of the index notation for the grid points, the following short notations are commonly
used in finite difference equations for the function values at grid points:
For one dimensional problems, fi f xi .
For two-dimensional problems, f i , j f ij f xi , y j .
For three-dimensional problems, f i , j , k f ijk f xi , y j , zk .
which clearly indicates that an approximate value of the derivative can be obtained from the
finite difference expression given by
f f xi x f xi fi 1 fi
(11.3)
x xi x x
The preceding equation is commonly referred to as the forward difference approximation.
More refined finite difference approximations for the derivatives can be obtained using a
number of formal approaches. The two most popular approaches are:
Pade approximants offer another method, and are used to obtain higher order finite difference
approximations (Chung, 2010).
Thus, the truncation error represents a correction term which if added to the finite difference
approximation can yield an exact value of the derivative at the point. On a uniform grid with
spacing x, the truncation error can be expressed as (Ferziger and Peric, 2003):
where s are higher order derivatives multiplied by constant factors. The leading power m of
x determines the order of accuracy of a finite difference approximation.
Conservation equations in fluid dynamics and heat transfer involve first and second order
derivatives. We, therefore, focus on the finite difference approximation of these derivatives in
the next two lectures.
REFERENCES
Anderson, J. D., Jr. (1995). Computational Fluid Dynamics: The Basics with Applications.
McGraw Hill, New York.
Chung, T. J. (2010). Computational Fluid Dynamics. 2nd Ed., Cambridge University Press,
Cambridge, UK.
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Lecture 12
APPROXIMATION OF FIRST ORDER DERIVATIVES
12.1 INTRODUCTION
Convective term in conservation equations involve first order derivatives. The simplest
possible approach for discretization of these terms would be to use the approximation based
on the basic definition of the derivative. In this lecture, we learn systematic procedures to
obtain FD approximations based on Taylor series expansion and polynomial fitting for a
generic function f(x) of a generic variable x.
f x xi f x xi n f H (12.1)
2 2 n
f x f xi x xi .....
x i 2! x 2 i n ! x n i
In series expansion, symbol H has been used to denote the higher order terms which have not
been indicated explicitly. Thus, function values at grid points xi 1 and xi 1 can be expressed as
f x x f
2 2
f i 1 f xi 1 f xi xi 1 xi i 1 i 2 H (12.2)
x i 2! x i
f x x f
2 2
fi 1 f xi 1 f xi xi 1 xi i 1 i 2 H (12.3)
x i 2! x i
f fi 1 fi xi 1 xi 2 f
2 H (12.4)
x i xi 1 xi 2 x i
f f i 1 f i
O xi (12.5)
x i xi
where xi xi 1 xi . Similarly, Eq. (12.3) yields the backward difference scheme (BDS)
given by
f f i fi 1
O xi 1 (12.6)
x i xi 1
where xi 1 xi xi 1. Subtracting Eq. (12.3) from Eq.(12.2), we obtain the central difference
scheme (CDS) given by the formula
f i 1 fi 1 xi xi 1 xi 1 xi 2 f
2 2
f
2 H (12.7)
x i xi 1 xi 1 2 xi 1 xi 1 x i
f f f
FDS: i 1 i , Truncation Error ~ O x
x i xi 1 xi
f f f
BDS: i i 1 , Truncation Error ~ O x
x i xi xi 1
f f f
CDS: i 1 i 1 , Truncation Error ~ O x on non-uniform mesh
x i xi 1 xi 1
f fi 1 fi 1
, Truncation Error ~ O x 2 on uniform grid
x i 2x
Note that the truncation error of the first order FDS or BDS is given by
x 2 f
(12.8)
2 x2 i
The truncation error of the CDS is given by
x xi 1 2 f xi xi 1 3 f
2 2 3 3
CDS i 2 H (12.9)
2 xi xi 1 x i 6 xi xi 1 x3 i
Thus, although the truncation error for CDS is formally of the same order as FDS or BDS, the
magnitude of the truncation error for CDS is much smaller than FDS/BDS. In fact, on grid refinement,
the convergence of CDS becomes second order asymptotically (Ferziger and Peric, 2003).
Further, let us substitute the value of second order derivative from Eq. (12.2) into Eq.
(12.4). On rearrangement, we get
which has second order accuracy on any grid (uniform or non-uniform). It reduces to the
simpler form of CDS on uniform grids.
Example 12.1
Derive a three point backward difference formula on uniform grid using general procedure
given by equation (12.11).
Solution
For three point backward difference formula, Eq. (12.11) takes the following form:
f afi bf i 1 cfi 2
(i)
x i x
f 2x f (2x) f
22 3 3
fi 2 f i 2x 2 3 .... (iii)
x i 2 x i 6 x i
Hence,
af i bfi 1 cfi 2 a b c f x 2 f
f i b 2c b 4c 2
x x x i 2 x i
(iv)
x 2 3 f
b 8c 3 ...
6 x i
Equations (i) and (iv) indicate that the following three conditions must be satisfied:
abc 0 (v)
b 2 c 1 (vi)
b 4c 0 (vii)
Solving Eqs. (v)-(vii), we get
a 3 / 2, b 2, c 1/ 2 (viii)
f 3 f i 4 fi 1 f i 2
, TE ~ O x 2 (x)
x i 2x
f 3 f i 4 fi 1 f i 2
, TE ~ O x 2 (x)
x i 2x
f x a0 a1 x a2 x2 .... an xn (12.12)
or
f x a0 a1 x xi x a2 x xi ... an x xi
2 n
(12.13)
Coefficients a0, a1, a2,.., an are determined by fitting the interpolation curve to function values
at appropriate number of points. The second form given by Eq. (12.13) is usually preferred as
it directly provides the expression for derivatives at point xi, i.e.
f 2 f 3 f
a ,
1 2
2 a 2 , 3 6a3 , .... (12.14)
x i x i x i
The order of approximation of the resulting finite difference approximation can obtained
using Taylor series expansion. The following example illustrates the use of polynomial fitting
for derivation of finite difference approximation for the first order derivative.
Example 12.2
Derive a three point central difference formula on non-uniform grid using polynomial fitting
at points xi 1 , xi and xi 1 .
Solution
We can fit the following quadratic curve through three points xi 1 , xi and xi 1 :
f x a0 a1 x xi x a2 x xi2 (i)
The first order derivative at point xi is a1 . To obtain the value of a1 , we fit the interpolation
curve (i) to the function values at points xi 1 , xi and xi 1 , which results in the following set
of linear equations:
f i a0 (ii)
fi 1 fi a1 xi a2 xi
2
(iii)
f i 1 fi a1 xi 1 a2 xi 1
2
(iv)
The preceding formula is identical to that given by Eq. (12.10) derived earlier using Taylor
series expansion. Further, on a uniform grid, xi xi 1 x , Eq. (vi) (or Eq. (12.10))
reduces to the standard CDS formula
f f i 1 fi 1
(vii)
x i 2x
as expected.
Let us note that other polynomials, splines or shape functions can be used to
approximate the function, and thereby obtain an approximate formula for the derivative.
Using the procedure outlined above, we can obtain higher order approximations. For
example, by fitting a cubic polynomial to four points, the following third order
approximations can be obtained on a uniform grid (Ferziger and Peric, 2003):
f 2 fi 1 3 fi 6 fi 1 fi 2
O((x)3 ) (12.15)
x i 6x
f fi 2 6 fi 1 3 fi 2 fi 1
O((x)3 ) (12.16)
i
x 6 x
The preceding approximations are third order BDS and third order FDS respectively. These
schemes are very useful in convective transport problem where these are referred as upwind
difference schemes (UDS).
In general, approximation of the first derivative obtained using polynomial fitting has the
truncation error of the same order as the degree of polynomial (Ferziger and Peric, 2003).
REFERENCES
Chung, T. J. (2010). Computational Fluid Dynamics. 2nd Ed., Cambridge University Press,
Cambridge, UK.
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Lecture 13
APPROXIMATION OF SECOMD ORDER
DERIVATIVES
2 (13.1)
x i xi 1 xi
We can use a different formula (say, BDS) for the approximation of the first order derivatives
in the preceding equation which results in
fi 1 fi fi fi 1
f
2
xi 1 xi xi xi 1 fi 1 xi xi 1 fi 1 xi 1 xi fi xi 1 xi
2 (13.2)
x i xi 1 xi xi 1 xi xi xi 1
2
2 f f i 1 fi 1 2 fi
2 (13.3)
x i x
2
Approximation (13.1) is first order accurate. A better approximation for the second order
derivative can be obtained using CDS at points halfway between nodes, i.e.
f f
1 1
2 f x i 2 x i 2
2 (13.4)
x i xi 1 xi 1
2 2
CDS is also used for approximation of the first order derivatives in Eq. (13.4), i.e.
f f i 1 f i f f i f i 1
1 and 1 (13.5)
x i 2 xi 1 xi x i 2 xi xi 1
Substitution of Eq. (13.5) into Eq. (13.4) yields the following formula for the second order
derivative
2 f fi 1 xi xi 1 fi 1 xi 1 xi fi xi 1 xi 1
2 1
(13.6)
x i xi 1 xi 1 xi 1 xi xi xi 1
2
fi 1 fi xi 1 xi i 1 i 2 i 1 i 3 H (13.7)
x i 2! x i 3! x i
f x x f x x f
2 2 3 3
fi 1 fi xi xi 1 i i 1 2 i i 1 3 H (13.8)
x i 2! x i 3! x i
Multiply Eq. (13.8) by xi 1 xi and add it to xi xi 1 Eq. (13.7) to eliminate the first
order derivative. Rearrangement of the resulting equation leads to the following relation for
the second order derivative:
2 f fi 1 xi xi 1 fi 1 xi 1 xi f i xi 1 xi 1
2 1
x i xi 1 xi 1 xi 1 xi xi xi 1
2 (13.9)
1 3 f
xi 1 xi xi xi 1 3 H
3 x i
which is identical to Eq. (13.6) obtained using CDS. The leading term in the truncation error
of preceding approximation is formally of first order on a non-uniform grid, and of second
order on uniform grids. However, even for a non-uniform grid, the truncation error is reduced
as in a second order scheme with the grid refinement (Ferziger and Peric, 2003).
On uniform grids, we can define the difference approximation for the second order derivative
as (Chung, 2010)
2 f af i bf i 1 cf i 1 dfi 2 ef i 2 ...
2 (13.10)
x i x 2
Coefficients a, b, c, d, e, . can be determined from Taylor series expansion for the function
values involved at the RHS around point xi. Using this approach, the three point central
difference formula (13.3) can be derived starting with the relation
2 f af i bf i 1 cf i 1
2 (13.11)
x i x 2
Taylor series expansion for f i 1 and f i 1 lead to the following relation:
afi bfi 1 cfi 1 (a b c) (c b) f (b c) 2 f
fi
x 2 x 2 x x i 2 x 2 i
(13.12)
x 3 f x 2 4 f
(c b) 3 (b c) ....
6 x i 24 x 4 i
From the preceding equation, it is clear that Eq. (13.11) will represent an approximation for
the second order derivative if and only if a b c 0, b c 0 and b c 2. Clearly,
b c 1 and a 2. Thus, we obtain the following central difference approximation
2 f f i 1 f i 1 2 f i x 2 4 f
2 (13.13)
x i x 12 x 4 i
2
which is second order accurate. Similarly, we can derive the following one-sided formula
2 f fi 2 fi 1 fi 2 3 f
2 x 3 (13.14)
x i x x i
2
which is only first order accurate (Chung, 2010). Further, using this approach, we can easily
derive a higher order central difference approximation using function values at five points
(for details, see Example 13.1 below) given by
f 30 f i 16( f i 1 f i 1 ) ( f i 2 f i 2 )
O x 4 (13.15)
x i 12x 2
Example 13.1
Derive a five point central difference formula for the second order derivative on uniform grid
using Taylor series expansion and Eq. (13.10).
Solution
Five point central difference formula for the second order derivative can expressed as
2 f afi bf i 1 cf i 1 dfi 2 ef i 2
2 (i)
x i x 2
Taylor series expansions for f i 2 , f i 1 , f i 1 and fi 2 , we get
af i bf i 1 cfi 1 df i 2 ef i 2 a b c d e b c 2d 2e f
fi
x 2
x 2
x x i
1 2 f x 3 f
b c 4d 4e 2 b c 8d 8e 3
2 x i 6 x i
(ii)
x 2 4 f x 3 5 f
b c 16d 16e 4 b c 32d 32e 5
24 x i 120 x i
x 4 6 f
b c 64d 64e 6 H
720 x i
Equations (i) and (iv) indicate that the coefficients in Eq. (i) must satisfy the following
conditions:
a bcd e 0 (iii)
b c 2 d 2e 0 (iv)
b c 4 d 4e 2 (v)
b c 8 d 8e 0 (vi)
b c 16 d 16e (vii)
Solving Eqs. (v)-(vii), we get
a 5 / 2, b c 4 / 3, d e 1/ 12 (viii)
f 30 fi 16( fi 1 fi 1 ) ( fi 2 f i 2 )
, TE~O x 4 (x)
x i 12x 2
Example 13.2
Derive Eq. (13.15) by fitting a polynomial of degree 4 on uniform grid. Also obtain the
corresponding approximations for the first, third and fourth order derivatives.
Solution
To obtain a central difference approximation, we can fit the following 4th degree polynomial
through five points xi 2 , xi 1 , xi , xi 1 and xi 2 :
f x a0 a1 x xi x a2 x xi a3 x xi a4 x xi
2 3 4
(i)
Formal differentiation of the preceding equation leads to the following relations:
f 2 f 3 f 4 f
a1 , 2 2a2 , 3 6a3 , 4 24a4 (ii)
x i x i x i x i
To obtain the values of coefficients ai , we fit the interpolation curve (i) to the function values
at points xi 2 , xi 1 , xi , xi 1 and xi 2 , which results in the following set of linear equations:
f i a0 (iii)
fi 2 fi a1 2x a2 2x a3 2x a2 2x
2 3 4
(iv)
fi 1 fi a1 x a2 x a3 x a2 x
2 3 4
(v)
fi 1 fi a1 x a2 x a3 x a2 x
2 3 4
(vi)
fi 2 fi a1 2x a2 2x a3 2x a2 2x
2 3 4
(vii)
Solution of simultaneous Eqs. (iv)-(vii) yields the following values for coefficients ai:
fi 2 8 fi 1 8 fi 1 fi 2 fi 2 16 fi 1 30 fi 16 fi 1 fi 2
a1 , a2
12x 24x 2
(viii)
f 2 fi 1 2 fi 1 fi 2 f 4 fi 1 6 fi 4 fi 1 fi 2
a3 i 2 , a4 i 2
12x3 24x 4
Thus, approximations for the derivatives obtained from two-sided 4th degree polynomial
fitting on a uniform grid are
f f i 2 8 f i 1 8 f i 1 f i 2
a1 (ix)
x i 12x
2 f f i 2 16 f i 1 30 fi 16 f i 1 f i 2
2 2 a2 (x)
x i 12x 2
3 f f i 2 2 f i 1 2 f i 1 f i 2
3 6a3 (xi)
x i 2 x 3
4 f f i 2 4 f i 1 6 f i 4 f i 1 f i 2
4 24a4 (xii)
x i x 4
Equation (x) is the same as Eq. (13.15) derived earlier using Taylor series expansion.
Central difference approximation of the first order derivatives on RHS of the preceding
equation are
i 1 i i i 1
1 and 1 (13.17)
x i xi 1 xi x i xi xi 1
2 2
Combining Eq. (13.16) and Eq. (13.17), we get
i 1 i 1 i i 1 i i 1
2
xi 1 xi 2
xi xi 1
x x 1
(13.18)
i xi 1 xi 1
2
Note that if is a function of , values at a point midway between the nodes can be evaluated
using simple average of function values at the neighbouring nodes, i.e.
1 1
1 i 1 i , ( xi 1 xi ) (13.20)
i
2 2 2
Other approximations can be easily obtained using different finite difference approximations
for the inner and outer derivatives.
REFERENCES
Chung, T. J. (2010). Computational Fluid Dynamics. 2nd Ed., Cambridge University Press,
Cambridge, UK.
Ferziger, J. H. and Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Lecture 14
MULTIDIMENSIONAL DERIVATIVES
f fi 1, jk f ijk
O x (14.1)
x i , j , k x
f f fijk
i , j 1, k O y (14.2)
y i , j ,k y
f f f
i , j ,k 1 ijk O z (14.3)
z i , j ,k z
Similarly, second order central difference formulae for the second order derivatives are:
2 f f i 1, jk fi 1, jk 2 f ijk
2 O x 2 (14.4)
x ijk x
2
2 f f
(14.7)
xy x y
f f
y
2 f i 1, j y i 1, j
O x 2 (14.8)
xy i , j 2x
f fi 1, j 1 f i 1, j 1 f fi 1, j 1 f i 1, j 1
O y 2 , O y 2 (14.9)
y i 1, j 2 y y i 1, j 2 y
2 f fi 1, j 1 fi 1, j 1 fi 1, j 1 fi 1, j 1
O x 2 , y 2 (14.10)
xy i , j 4xy
f f 2 f1
(14.11)
x 1 x2 x1
which is first order accurate. For more accurate approximation, we can use higher order one-
sided difference formulae involving function values at the boundary node and interior grid
points. For instance, use of quadratic polynomial fit involving function values at boundary
point x1 and interior nodes x2 and x3 leads to the following second order approximation
(Ferziger and Peric, 2003):
f ( x2 x1 ) f 3 ( x3 x1 ) f 2 ( x3 x1 ) ( x2 x1 ) f1
2 2 2 2
(14.12)
x 1 ( x2 x1 )( x3 x1 )( x3 x2 )
f 3 42 31
(14.13)
x i 2x
One-sided difference formulae (14.11)-(14.13) would also be useful in post processing, e.g.
in evaluation of heat flux from computed temperature field.
W P E
Figure 9.5 Central difference computational molecules (1D and 2D)
Collection of algebraic equation (14.14) at all the computational nodes leads to a system of
algebraic equations given by
A Q (14.15)
where A is the coefficient matrix, is the vector of unknown nodal values of and Q is the
vector containing terms on RHS of Eq. (14.14). Matrix A is sparse. However, its structure
depends on ordering of variables in vector .
For structured grids, variables are usually ordered starting from a corner and
traversing line after-line in a regular manner. This ordering scheme is called lexicographic
ordering and results in a poly-diagonal structure for matrix A. Note that this ordering is not
unique as it depends on the order of line traversal in different directions. For example, if we
start ordering the entries in vector starting from southwest corner of the domain, proceed
eastward along each grid line, and then northward across the domain, we get the ordering of
indices as given in Table 14.1.
Table 14.1 Conversion of i, j, k grid indices to one dimensional storage locations in vector
.
Because matrix A is sparse and has a poly-diagonal structure for structured grids, it is
preferable to store it as a set of one dimensional arrays instead of a full two-dimensional
array. We can use the directional connection in naming these 1D arrays (calling them as
AP , AW etc.), and thus write the algebraic equation (14.14) for a two dimensional problem as
AWW ASS APP ANN QP (14.16)
At present, most of the programming languages (including Fortran 90) support user-
defined data types. An alternative storage scheme for matrix A can be adopted using records
or structure data types wherein the matrix A is stored as an array of records (or struct). Each
element of this record contains the number of modes connected to a given node, nodal
connectivity (i.e. indices of neighbouring nodes) and corresponding matrix entries. This
scheme can be used not only for the system matrix arising from finite difference
discretization on structured grids, but also for the matrix resulting from finite volume/finite
element method on structured as well as unstructured grids. A sample implementation of
such a record in C is as follows:
struct Matrix
{
int nn; // number of neighbours of the node
double AP; // matrix entry AP
double *AL; // array to hold coefficients Al
int *nc; // array to hold connectivity information
}
Note that the indexing scheme described above is primarily required if one plans to
use a direct solver which require specification of an algebraic system in the standard form Ax
= b. In practical CFD applications, large size of the system matrix normally dictates use of
iterative solvers (even for linear systems).
REFERENCE
Ferziger, J. H. And Peri, M. (2003). Computational Methods for Fluid Dynamics. Springer.
Lecture 15
APPLICATIONS OF FDM TO SCALAR TRANSPORT
PROBLEMS
T 0 T (15.2)
dT
k h T Ta (15.3)
dx x L
For finite difference formulation, let us use a uniform grid of size x L / N where N
denotes the number of divisions in the grid. Thus, there are (N+1) grid points. Using CDS for
approximation of the second order derivative, discretized form of Eq. (15.1) at an internal
node x xi becomes
Ti 1 Ti 1 2Ti qg ,i q g , i x 2
0 or Ti 1 2Ti Ti 1 (15. 4)
x 2 k k
Using the matrix notation introduced in the previous section, the preceding equation can be
written as
TN 1 TN k k
k h TN 1 Ta i.e. TN 1 TN 1 Ta (15.6)
x hx hx
Thus, APN 1 1 k / ( hx), AEN 1 0, AWN 1 k / ( hx) and QN Ta . The linear algebraic
system obtained for this problem is tri-diagonal and can be easily solved using TDMA (tri-
diagonal matrix algorithm) discussed in a later section.
2T 2T
0 (15.7)
x 2 y 2
Governing equation (15.7) involves second order derivatives which can be approximated
using central difference scheme. Associated boundary conditions may involve first order
derivatives (in case Neumann or convective boundary conditions), which would require the
use of one-sided difference formula.
Ti 1, j Ti 1, j 2Tij Ti , j 1 Ti , j 1 2Tij
0 (15.8)
x 2
y 2
Let us employ a non-uniform grid with a total of N+1 grid points (nodes 1 and N+1
represent the boundary nodes x 0 and x L respectively) for finite difference solution of
this problem. We can discretize Eq. (15.10) using finite difference scheme based on a there
point computational molecule. The resulting discretized equation for an interior node i can be
represented as
where coefficients A contain contributions from both the convective and diffusive terms, i.e.
A Ad Ac (in which superscripts d and c indicate contribution from diffusive and
convective terms respectively).
Central difference scheme (CDS) is commonly used for approximation of the diffusive term
(for inner as well as the outer derivative). Thus,
d d i 1 i i i 1
i 1 i 1
d d dx i 1 dx i 1 2 xi 1 xi 2 x x
2 2
i i 1
(15.13)
dx dx i 1
( xi 1 xi 1 )
1
( xi 1 xi 1 )
2 2
Therefore, contributions of the diffusive term to the coefficients of algebraic equation (15.12)
are
2 i 1 2 i 1
AEd 2
, AWd 2
, APd AEd AWd (15.14)
xi 1 xi 1 xi 1 xi xi 1 xi 1 xi xi 1
If the convection term is also discretized using CDS, then
d ( u )i 1 ( u )i 1
dx u xi 1 xi 1
(15.15)
i
and its contributions to the coefficients of Eq. (15.12) are
( u )i 1 ( u )i 1
AEc , AWc , APc 0 (15.26)
xi 1 xi 1 xi 1 xi 1
Use of CDS for convective term can result in spurious wiggles or oscillations in numerical
solution if the local Peclet number, Pe ( u x / ) 2. To reduce/eliminate these
oscillations, upwind difference is usually employed for convective term. However, first order
upwind scheme (based on FDS/BDS) is highly diffusive. Hence, higher order TVD (total
variation diminishing schemes) should be preferred for discretization of the convective terms
(Versteeg and Malalasekera, 2007; Chung, 2010).
Example 15.1
Consider the steady state heat conduction in a slab of width l = 0.5 m with heat generation.
The left end of the slab (x = 0) is maintained at T = 373 K. The right end of the slab (x = 0.5
m) is being heated by a heater for which the heat flux is 1 kW/m2. The heat generation in the
slab is temperature dependent and is given by Q = (1273 T) W/m3. Thermal conductivity is
constant at k = 1 W/(m-K).Write down the governing equation and boundary conditions for
the problem. Use the finite difference method (central difference scheme) to obtain an
approximate numerical solution of the problem. For the first order derivative, use forward or
backward difference approximation of first order. Choose x = 0.1, and use the TDMA.
Solution
Governing equation for the steady state heat conduction with constant heat generation:
d 2T
k 2 Q 0 (i)
dx
Given: Q = 1273 T. Thus, Eq. (i) becomes
d 2T
k 2 T 1273 (ii)
dx
1 0 0 0 0 0 T1 373
1 2.01 1
0 0 0 T2 12.73
0 1 2.01 1 0 0 T3 12.73
0 0 0 2.01 1 0 T4 12.73 (x)
0 0 0 1 2.01 1 T5 12.73
0 0 0 0 1 1 T6 100
REFERENCES
Chung, T. J. (2010). Computational Fluid Dynamics. 2nd Ed., Cambridge University Press,
Cambridge, UK.