You are on page 1of 5

Introduction to Computational Fluid Dynamics

Prepared by Professor J. M. Cimbala, Penn State University


Latest revision: 11 January 2012

Nomenclature
Symbols
A
b
CD
D
FD
FL
H
L
R
ReD
Rex
u
V or U
x
y

projected frontal area or planform area of an object


span or depth of a flat plate (into the page when viewed from the edge)
drag coefficient: CD = 2FD /V2A
height (2-dimensional) or diameter (axisymmetric) of a block or other object in the flow
drag force
lift force
height of computational domain
length of the block in the flow direction
radial extent of computational domain
Reynolds number based on length D: ReD = VD/ (other Reynolds numbers defined similarly)
Reynolds number based on axial distance x: Rex = Vx/ (other Reynolds numbers defined similarly)
streamwise component of velocity at some location inside the boundary layer (in x-direction)
freestream velocity
flow direction
coordinate normal to flow direction, usually normal to a wall
coefficient of dynamic viscosity (also called simply the viscosity)
coefficient of kinematic viscosity (for water, 1.0 10-6 m2/s at room temperature)
density of the fluid (for water, 998 kg/m3 at room temperature)

Educational Objectives
1.
2.
3.
4.
5.

Become acquainted with the basic concepts of computational fluid dynamics (CFD).
Develop familiarity with operation of the Fluent family of CFD software.
Learn the importance of the extent of the computational domain in a CFD solution.
Learn that CFD solutions that use turbulence models are approximations that are not always accurate.
Calculate laminar boundary layer profiles on a flat plate using CFD, and compare with the Blasius solution.

Equipment
1.
2.

Fluent family of CFD computer codes (includes the grid generator, GAMBIT, the flow solver, FLUENT, and the
instructional version, FlowLab)
personal computer

Background
A. Fundamentals of CFD
While other labs in this course involve actual hands-on physical laboratory equipment, this lab introduces the field
of computational fluid mechanics, or CFD. As the name implies, a computer (rather than a wind tunnel or other
experimental test equipment) is used in CFD to predict fluid flow. Consider the flow of a Newtonian fluid. The differential
equations of motion are the continuity equation, representing conservation of mass [from Reference 1],


V 0
t

and the differential conservation of momentum equation, also known as the Navier-Stokes equation of fluid motion,

dV

V V P g 2V
dt
t

(1)

(2)

For simplicity, consider only incompressible flow (constant density) in Cartesian (x,y,z) coordinates, so that Eqs. (1) and (2)
reduce to


V 0

and

or

u v w

0
x y z

(3)

V
2V 2V 2V

V
V
V
u
v
w

P g 2 2 2
x
y
z
y
z
t
x

(4)

Solving these equations with a computer requires a reasonably fast computer and fairly sophisticated software.
There are several software companies who sell commercial CFD codes. The Mechanical Engineering Department at Penn
State has a site license for one family of commercial codes, namely the Fluent family of CFD codes, produced by Fluent,
Inc. In this lab, Fluent CFD codes are used to solve the above set of equations for two flows:

turbulent flow over a rectangular block


laminar flow over a flat plate

In the first flow, Fluents instructional software program called FlowLab is used. In the second flow, Fluents grid generation
software contained within the software package called ANSYS is used, along with the CFD solver FLUENT.
Co mputational
domain

Co mputational domain
Cell

Cell

Boundaries

Boundaries

A(a)

(b)

Figure 1. A computational domain is the region in space in which the equations of motion are solved by
CFD; a cell is a small subset of the computational domain. Shown are (a) a two-dimensional
domain and quadrilateral cell, and (b) a three-dimensional domain and hexahedral cell. The
boundaries of a 2-D domain are called edges, while those of a 3-D domain are called faces.
The various steps in the process of a CFD calculation are
discussed below. For simplicity, only steady-state incompressible flows
are considered. To solve Eqs. (3) and (4) numerically, the following steps
are performed. Note that the order of some of the steps (particularly Steps
2 through 5) is irrelevant.
1.

2.

3.

NOTICE:
Do not proceed with
CFD calculations
until you have
generated a high
quality grid.

A computational domain is chosen and a grid (also called a


mesh) is generated; the domain is divided into many small
elements called cells. For 2-D domains, the cells are areas, while
for 3-D domains the cells are volumes (Figure 1). You can think
of each cell as a tiny control volume in which discretized versions
of the conservation equations are solved. The quality of a CFD
solution is highly dependent on the quality of the grid. Therefore,
you are advised to make sure that your grid is of high quality
before proceeding to the next step (Figure 2).
Boundary conditions are specified on each edge of the
computational domain (2-D flows) or on each face of the domain
(3-D flows).
The type of fluid (water, air, gasoline, etc.) is specified, along
Figure 2. A quality grid is essential to a
with fluid properties (temperature, density, viscosity, etc.). If the
quality CFD simulation.
flow is laminar, Eqs. (3) and (4) are sufficient, and CFD solutions
can be made as accurate as desired, limited only by the resolution
of the mesh and the appropriateness of the imposed boundary conditions. However, a turbulent flow is unsteady,
three-dimensional, and random, and involves turbulent eddies spanning several orders of magnitude in both length
scale and time scale. Eqs. (3) and (4) are still sufficient, but mesh requirements, computer speed and memory

4.

5.
6.

7.

8.

requirements, and CPU time requirements prohibit all but the simplest, low Reynolds number, turbulent flows from
being solvable with todays computers. In engineering practice, therefore, CFD codes like FLUENT and FlowLab
solve only the time-averaged (mean) flow field, and model all the turbulent eddies through use of a turbulence
model to simplify the calculations. A CFD solution that uses a turbulence model is therefore only an
approximation. Although CFD calculations using turbulence models may be reasonably accurate for engineering
approximations, the turbulence models themselves are not universally valid for all flows. Furthermore, in most
commercial CFD codes, there are several different turbulence models available from which to choose. Different
results are obtained for different turbulence models, even if the mesh and boundary conditions are the same.
Numerical parameters and solution algorithms are selected; these are specific to each CFD code, and will not be
discussed here. The default settings of most modern CFD codes are appropriate for the simple problems discussed in
this chapter.
Values for all flow field variables are specified for each cell; these are initial guesses, which are known to be
incorrect, but are necessary as a starting point.
Beginning with the initial guesses, discretized forms of Eqs. (3) and (4) are solved iteratively, usually at the center
of each cell. If one were to put all the terms of Eq. (4) on one side of the equation, the solution would be exact
when the sum of these terms, defined as the residual, is zero for every cell in the domain. In a CFD solution,
however, the sum is never identically zero, but (hopefully) decreases with progressive iterations. A residual can be
thought of as a measure of how much the solution to a given
FL
transport equation deviates from exact, and one monitors the
average residual associated with each transport equation to help
determine when the solution has converged. Sometimes hundreds
or even thousands of iterations are required to converge on a final
FD
solution, and the residuals decrease by several orders of
magnitude.
Once the solution has converged, flow field variables such as
M
velocity and pressure are plotted and analyzed graphically. Users
Figure 3. Global properties of a flow, such
can also define and analyze additional custom field functions that
as forces and moments on an
are formed by algebraic combinations of flow field variables.
object, are calculated after a CFD
Most commercial CFD codes have built in post processors,
solution has converged. They can
designed for quick graphical analysis of the flow field. There are
also be calculated during the
also stand-alone post-processor software packages available for
iteration process to monitor
this purpose. Since the graphics output is often displayed in vivid
convergence.
colors, CFD has earned the nickname colorful fluid dynamics.
Global properties of the flow field, such as pressure drop, and integral properties, such as forces (lift and drag) and
moments acting on a body, are calculated from the converged solution (Figure 3). With most CFD codes, this can be
done on the fly as the iterations proceed. In many cases, in fact, it is wise to monitor these quantities along with
the residuals during the iteration process; when a solution has converged, the global and integral properties should
settle down to constant values as well.
y

B. Grid Generation

j=4
The first step (and arguably the most important step) in a CFD solution is
generation of a grid (also called a mesh) that defines the cells on which
3
flow variables (velocity, pressure, etc.) are calculated throughout the
computational domain. Modern commercial CFD codes come with their
2
own grid generator, and third-party grid generation programs are also
1
available. Many CFD codes can run with either structured or unstructured
grids. A structured grid consists of planar cells with four edges (2-D) or
4 5 6 78
3
2
i=1
x
volumetric cells with six faces (3-D). Although the cells can be distorted
from rectangular, each cell is numbered according to indices (i,j,k) that do
Figure 4. Sample structured 2-D grid with
not necessarily correspond to coordinates x, y, and z. An illustration of a
9 nodes and 8 intervals on top
two-dimensional structured grid is shown in Figure 4. To construct this
and bottom edges, and 5 nodes
grid, 9 nodes are specified on the top and bottom edges; these nodes
and 4 intervals on left and right
correspond to 8 intervals along these edges. Similarly, 5 nodes are
edges. i and j indices are shown;
specified on the left and right edges, corresponding to 4 intervals along
the shaded cell is at (i = 4, j = 3).
these edges. The intervals correspond to i = 1 through 8 and j = 1 through
4, and are numbered and marked in Figure 4. An internal grid is then generated by connecting nodes one-for-one across the
domain such that rows (j = constant) and columns (i = constant) are clearly defined, even though the cells themselves may be
distorted (not necessarily rectangular). In a two-dimensional structured grid, each cell is uniquely specified by an index pair
(i,j). For example, the shaded cell in Figure 4 is at (i = 4, j = 3). All the grids used in this lab are structured grids, generated
with Fluents grid generation package, GAMBIT.

Generation of a good grid is often tedious and time-consuming; engineers who use CFD on a regular basis will agree
that grid generation usually takes more of their time than does the CFD solution itself (engineers time, not CPU time).
However, time spent generating a good grid is time well spent, since the CFD results will be more reliable, and may converge
more rapidly (Figure 5). A high quality grid is critical to an accurate CFD solution; a poorly resolved or low quality grid may
even lead to an incorrect solution. It is important, therefore, for users of CFD to test if their solution is grid independent. The
standard method to test for grid independence is to increase the resolution (by a factor of 2 in all directions if feasible) and
repeat the simulation. If the results do not change appreciably, the original grid is probably adequate. If, on the other hand,
there are significant differences between the two solutions, the original grid is likely of inadequate resolution. In such a case,
an even finer grid should be tried until the grid is adequately resolved. This
method of testing for grid independence is time consuming and
unfortunately not always feasible, especially for large engineering
problems in which the solution pushes computer resources to their limits.
In a two-dimensional simulation, if one doubles the number of intervals on
each edge, the number of cells increases by a factor of 22 = 4; the required
computation time for the CFD solution also increases by approximately a
factor of 4. For three-dimensional flows, doubling the number of intervals
in each direction increases the cell count by a factor of 23 = 8. You can see
how grid independence studies can easily get beyond the range of a
computers memory capacity and/or CPU availability. If you cannot
double the number of intervals because of computer limitations, a good
Figure 5. Time spent generating a good
rule of thumb is that you should increase the number of intervals by at
grid is time well spent.
least 20% in all directions to test for grid independence.

C. Boundary Conditions
While the equations of motion, the computational domain, and even the grid may be the same for two CFD
calculations, the type of flow that is modeled is determined by the imposed boundary conditions. Appropriate boundary
conditions are required in order to obtain an accurate CFD solution. There are several types of boundary conditions
available; the boundary conditions most relevant to the present lab are listed and briefly described below.

Wall Boundary Condition The simplest boundary condition is that of a wall. Since fluid cannot pass through a
wall, the normal component of velocity is set to zero relative to the wall along a face on which the wall boundary
condition is prescribed. In addition, because of the no-slip condition, we usually set the tangential component of
velocity at a stationary wall to zero as well.
Velocity Inlet Boundary Condition Flow enters the
computational domain through a face along a portion of the
domain. At a velocity inlet, we specify a constant velocity of the
incoming flow along the inlet face. If energy and/or turbulence
Pout = Patm
equations are being solved, the temperature and/or turbulence
properties of the incoming flow need to be specified as well.
Pressure Outlet Boundary Condition Flow leaves the
computational domain through a face along a portion of the
domain. At a pressure outlet, fluid flows out of the computational
Pressure outlet
domain. We specify a constant static pressure along the outlet
face; in many cases this is atmospheric pressure (zero gage
pressure). For example, the pressure is atmospheric at the outlet
Figure 6. When modeling an
of an exhaust pipe open to ambient air (Figure 6). Flow properties
incompressible flow field, if a
such as temperature and turbulence properties are also specified
pipe or duct is exposed to
at pressure inlets and pressure outlets. However, these properties
ambient air, the proper boundary
are not used unless the solution demands reverse flow across the
condition is a pressure outlet
outlet. Reverse flow at a pressure outlet is usually an indication
with Pout = Patm. Shown here is
that the computational domain is not large enough. If reverse
the
tail pipe of an automobile.
flow warnings persist as the CFD solution iterates, the
Photo
by Abel Po-Ya Chuang.
computational domain should be extended.
Symmetry Boundary Condition Oftentimes an edge (2-D) or face (3-D) of a computational domain divides the
flow field into two symmetric halves. The symmetry boundary condition forces flow field variables to be mirrorimaged across a symmetry plane. Mathematically, gradients of most flow field variables in the direction normal to
the symmetry plane are set to zero across the plane of symmetry. For physical flows with one or more symmetry
planes, this boundary condition enables us to model a portion of the physical flow domain, thereby conserving
computer resources.

The first flow to be calculated here is flow over a rectangular block. Figure 7 illustrates how the above four boundary
conditions are applied to this flow field. Flow enters the computational domain through the left face, which is specified as a
velocity inlet. Flow leaves the computational domain through the right face, which is specified as a pressure outlet. (The
shape of these faces is not critical; in the present calculations, we use circular arcs of radius R for convenience.) The left, top,
and right faces of the rectangular block are specified as walls, of course. Finally, the two bottom faces of the computational
domain are specified as symmetry boundary conditions; the solved flow is mirror-imaged about these faces.

V
Computational
Domain

V
L
V

Block

FD

Pressure
outlet

Velocity
inlet
Wall

V
Symmetry

Symmetry
R

(a)

(b)

Figure 7. When using CFD to calculate flow over a two-dimensional rectangular block, we may take
advantage of the top-bottom symmetry: (a) the physical geometry with dimensions and drag
force shown, and (b) the computational domain (blue shaded area), with boundary conditions
and extent R of the computational domain shown.

Consider a two-dimensional rectangular block whose length L is 1.5 times its height D (Figure 7a). In this lab, you will
use CFD to calculate the drag coefficient CD on the block. In particular, you will examine how CD is affected by the extent of
the computational domain by varying R/D. You will also examine how CD is affected by the choice of turbulence model.

References
1.

engel, Y. A. and Cimbala, J. M., Fluid Mechanics Fundamentals and Applications, McGraw-Hill, NY, 2006.

2.

White, F. M., Fluid Mechanics, Ed. 5, McGraw-Hill, NY, 2003.

3.

FLUENT Reference Manuals (in the bookcase in the Fluids Lab; also on-line).

You might also like