Introduction To Finite Difference Methods For Numerical Fluid Dynamics
Introduction To Finite Difference Methods For Numerical Fluid Dynamics
C*2
DO NOT CIRCULATE
Retention Copy
..-->
.-=_..,
-..
._--=
._.
-,
~.
;;
;
.-.
-.
.F
-- ...
Introduction tqFinite-Difference
Methods for Numerical Fluid Dynamics
k:.
..
-.
,-=.
IliE
.+
~~
-i2
=_=,..=-
- --.
.
.~-.
--
._,
-
-=-----
~~
.as.t,.
_~
,,g@gz+&q
. . . ... --,
ti+$~.
., ~
......<
:%*
~r>:-..--.,&
:(. *
-Q
,,.
: ;+&:
,.-:44
...-.>,
.,
. ..
-----
...
.:
-..
E., . . . -. . . .- .
--
.._
,.
. ...
~---
_..
.i.
...
.*+A
... .+
..
Irn
..,..
.. . .,
..:
___
.-
.-
:+,*.-.:,-+
.. . :...
..
... .,,,.+.,
_-
..---=.
y
,;
..
.
.;:
,+..:~~~i
-
,
_?
.-
-.
--
%&-..
..
..
..
--
,,J=r,.,-%-,
,-- ,5,3.
->..1
Los Alamos
NATIONAL
LABORATORY
Edited by
PatriciaW.Mendius,GrcJupClC-l
An A&mafive
Action/Equal
Opportunity Employer
LA-12984
UC-700
Issued: September 1995
Introduction to Finife-Dz~erence
Methods for Numerical Fluid Dynamics
Evan Scannapieco
Francis H. Harlow
Los Alamos
NATIONAL
LABORATORY
TABLE
Abstract
OF CONTENTS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
I. INTRODUCTION
. . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . 6
6
.
.
7
.
11
.
13
.
17
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
22
22
26
28
31
35
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
,
.
,
.
.
.
41
41
42
49
51
56
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
Simulations
.
.
.
.
.
.
66
66
67
74
79
84
.
.
.
.
.
.
92
92
93
94
96
98
II. ONEDIMENSIONAL
HEAT FLOW
A. Flux and Conservation . . . . .
B. Numerical Representation
. . .
C. Partial-Differential Equations . .
D. Computational Implementation of
E. Programming and Results . . .
. . . . .
. . . . .
. . . . .
. . . . .
Equations
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . .
. . . . .
Fluid Flow
. . . . .
. . . . .
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
Lagrangian
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . .
. . .
Flow
. . .
. . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
100
100
103
110
115
125
133
133
139
147
157
162
.
.
.
.
IX. TURBULENCE TRANSPORT . . . . . . . . . . . .
.
. . .
.
.
A. Tensor Notation
. . . . . . . . . . . . . .
. . . .
B. Turbulence ~ansport and K c Models . . . . .
C. Computational Implementation of the K e TurbulenceTkansport Model
D. Turbulence Transport and the Karman Vortex Street . . . . . . . . .
172
172
174
179
186
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
196
Acknowledgments
206
. . .
VIII. ADDITIONS TO TWO-DIMENSIONAL FLUID CODE .
.
.
A. Flow Regions with Obstacles . . . . . . . . .
. .
B. HeatlIlansfer
. . . . . . . . . . . . . . .
.
. .
C. Convection Calculations . . . . . . . . . . .
.
D. Two-Dimensional Compressible Flow
. . . . . . .
. . .
E. Results of Two-Dimensional Compressible Flow .
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
INTRODUCTION
TO FINITEDIFFERENCE
FOR NUMERICAL
METHODS
FLUID DYNAMICS
by
ABSTRACT
This work is intended to be a beginners exercise book for the study of basic finitedifference techniques in computational fluid dynamics.
ranging from high-school senior to university senior.
themselves is not discussed. Topics examined in this work include: one-dimensional heat
flow, one-dimensional compressible fluid flow, two-dimensional compressible fluid flow, and
two-dimensional incompressible fluid flow with additions of the equations of heat flow and
the K e model for turbulence transport. Emphasis is placed on numerical instabilities
and methods by which they can be avoided, techniques that can be used to evaluate the
accuracy of finite-difference approximations, and the writing of the finite-difference codes
themselves. Concepts introduced in this work include: flux and conservation, implicit and
explicit methods, Lagrangian and Eulerian methods, shocks and rarefactions, donor-cell
and cell-centered advective fluxes, compressible and incompressible fluids, the Boussinesq
approximation for heat flow, cartesian tensor notation, the Boussinesq approximation for
the Reynolds stress tensor, and the modeling of transport equations. A glossary is provided
which defines these and other terms.
I.
INTRODUCTION
One of the most important techniques used in the computer modeling of physical
the worlds climate, finite-difference programs have opened up an entire field of research
that has only been possible within the the past 40 years.
In the following paper we will examine a series of finite-difference programs, gaining a
clearer understanding of their underlying physical principles and the techniques by which
these are implemented. It is our intention to represent these physical systems so that they
will be easily understood both by those who are dealing with them for the first time and
those familiar with their partial-differential representations. Partial differential equations
will be used but only as a result of a discussion of the basic principles from which they are
derived. The mathematics will follow, as it should, fi-om a clear set of physically meaningful
observations.
It will be essential, however, for the reader to have a clear understanding of the
FORTRAN computer language in which all programs will be written. While there are many
finite difference simulations that are written in other languages, FORTRAN has proved to
be an efficient, easily understood, and widely accepted language for scientific computing.
For these reasons we will limit our discussion to simulations written in this language, and
for reasons of scope we will not discuss the meanings of each of its commands. We assume
that the reader is already familiar with computers and desires to apply this knowledge
to the study of physical systems. It is our intention to apply physical principles to the
crest ion of computer simulations, not to discuss the syntax of the simulations themselves.
There are two ways to approach this work. It can be interpreted as a guide to writing
ones own finite difference simulations, a type of handbook for creating ones own codes, or
3
it can be read as a textbook, omitting actual programming by the reader. We hope that
the reader will adopt the former approach. While it will take more time for the reader to
create his own simulations, the extra time will prove to be time well spent.
The reasons for writing ones own code are twofold. First, the reader who is able to
structure his own code will be sure to have a full understanding of the concepts involved.
There is only so much that can be explained about the process; true understanding will
result only from experience. Secondly, by writing his own programs, the reader gains the
advantage of being able to examine the results obtained from various initial parameters.
Only a limited number of results will be presented in this work, thereby leaving the reader
with a vast set of cases which can be independently investigated.
As we move through this series of programs, we will examine a broad spectrum of
physical systems.
examining various forms of numerical instabilities and explicit and implicit solution
techniques.
Our discussion will then move to compressible fluid flow in one dimension,
representations
translating them into terms which can be dealt with by the computer. The form will be
greatly changed, but the basic physical principles will always be faithfully represented.
In as much as we can simulate reality, we can use the computer to make predictions
about what will occur in a certain set of circumstances.
Finite-difference techniques
can create an artificial laboratory for examining situations which would be impossible
to observe otherwise, but we must always remain critical of our results. Finite-differencing
can be an extremely powerful tool, but only when it is firmly set in a basis of physical
meaning.
beginning, dealing with simple cases and examining our logic each step of the way. Building
further insights on what we have done in the past, we will start with the simplest case
possible: heat transfer in a single dimension. The rest will follow logically.
II.
ONEDIMENSIONAL
A.
HEAT
FLOW
The first system that will be examined in this series of studies is that of heat conduction
in a single dimension.
a single equation of heat transfer over a one-dimensional array. This program can most
easily be pictured as the simulation of a metal rod that is initially at an even temperature
and is insulated along its sides. _As the program progresses, the simulated rod is heated
horn one end, and the resulting change in temperature along the rod is recorded ss output.
A diagram of this system appears in Fig. II-1.
a
+
~
insulation
heat sourCe
Fig. II-1
codes are based: FLUX and CONSERVATION. Flux is the amount of something passing
through a unit area in a unit time. In our current example, the flux that is of interest is
HEAT FLUX, the transport of heat from one zone to another. But flux is by no means
limited to only heat. It can represent the movement of mass, momentum, energy, or any
other value that describes the amount of something that is present in a zone. No matter
what is being fluxed, the concept remains essentially the same. Flux represents motion
from one place to another, the rate at which something moves through a given area.
Conservation means that the total amount of something never changes regardless of
its motion from one region to another.
amount of something that exists in a finite region, conservation means that in any region
of space the change in something equals the amount that goes in minus the amount that
comes out plus the change of that amount within the region. Once again, this principle
holds true for many diflerent quantities.
from experimental observation are all that is necessary to represent the transfer of heat
numerically.
B.
Numerical Representation
In order to represent this system in a manner that can be solved computationally,
we must first examine the structure represented by each zone in our simulated metal rod.
Looking at an individual zone (also called a CELL), we find a physical system as in Fig. II-2.
T-left
T-tight
Fig. II-2
Here T-left and T-right represent the temperature along either edge of the zone, and d
represents the thickness. The heat flux of this system is defined by an equation known as
Ficks Law. A result of direct experimental observations, Ficks Law is as follows:
flux of heat =
k (T1.ft ~right
d
OF HEAT CONDUCTIVITY
(H-1)
and
is proportional to the rate at which a given material conducts heat across a temperature
gradient.
chosen based on the conductive properties of that material. For example, silver, a very
conductive metal, is represented by a high value of k, around 4 J/scm 0C. Wood on the
other hand, is a poor heat conductor and is consequently associated with a low k value,
1.3 x 103 J/s.cm. C. The conductivity of iron is somewhere between these two materials,
yielding an intermediate value for k, 0.67 J/scm C.
Taking this equation as it applies to a single cell, we can now make a generalization
as to how it can be implemented over an array. Given a rod of length D, this length can
be divided into an array of size ~. Each zone will now have a length dz, which is defined
as D/~. Such a system is shown in Fig H-3.
8
I
r
I
1-
T1
T2
dx
,.
[A
T
1j-1
0123
j +1
A
J+ 1
j+l12
!
j-1/2
Fig. II-3
with zonesj
1 and
being the zonesat the left and right respectively. Note that the flux between zones
will occur at the walls and will therefore occur at points such as j + 1/2 and j 1/2 in
the diagram. Note also that the diagram contains both a zone O and a zone ~ + 1, existing
beyond the normal bounds of the rod. These zones are used to implement BOUNDARY
CONDITIONS,
equations that represent the external conditions that affect the values of
The heating source at the left of the pipe is represented by one such
boundary condition.
Temperatures for each cell are defined at the center of the cell,
exist ing at positions 1, 2, 3, etc. Density of cells and cross-sectional area between cells are
defined as
and A respectively.
These definitions can be used to write an expression for the heat energy contained in
any given cell:
Volume = Adz
Heat energy of cell j = Mass b Tj ,
(11-2)
(II-3)
(II-4)
I
Heat energy of cell j = A dx
p b 7
(II-5)
We now apply our conservation of energy principle to derive an equation for the
change in energy. The letter n will be used as a TIME CYCLE COUNTER,
that represents the number of time cycles that have been calculated.
an integer
called time steps, can be thought of as individual frames in our analogy of the motion
picture. The time at a cycle n is represented by tn, which is computed as follows:
tn=ndt.
(H-6)
In this equation dt is equal to the time increment per cycle, i.e., the change in time between
each frame. The superscript n in tn notates that the value being expressed occurs at time
cycle n. It does not indicate t raised to the power n. We will continue to use superscripts
in this manner, combining them with the subscripts used earlier to_represent position. Tjn
will therefore be defined as the temperature in cell j at time step n, and similarly, ~+ 1
will represent the temperature in cell -j at the time step n + 1.
By using this notation and assuming that our heat source is always placed at the left,
energy conservation can be expressed as
(II-7)
(II-8)
(II-9)
and
10
Using Ficks law to determine flux at j + 1/2 and j 1/2, and using the equation for heat
energy of a cell (II-5), we can express Eq. (II-7) as follows:
A p dx b T~+l Apdxb
T;=k
(11-10)
T~
--=#q?l T;
~+T;+J
CONDUCTIVITY
(11-11)
of a material and is
represented by the Greek letter a. Thus, our conservation equation in final form appears
as follows:
+
g+l)
(11-12)
solved.
Based upon our knowledge of the previous time step, this equation allows us to calculate the
new temperatures for every zone along the rod. By carrying out this equation repeatedly,
the overall flow of heat can be observed.
Based on our discussion so far, it is now possible to begin writing the finite-difference
code itse~ but before this process is begun, let us first examine the nature of our equation.
Although this equation has been generated from basic principles, it is obtained more
often through the manipulation of partial differential equations. While not necessary to
the writing of simple finite-difference codes, these partial-differential equations (P.D. E.s)
give scientists greater insight into simple systems and allow for analysis of much more
complicated physical phenomena. Because these equations are continually being applied
to finite-difference codes, it is important that they be examined and related to the problem
at hand.
c.
Partial-Differential
Equations
For those familiar with partial-differential equations and their use, the following
discussion of heat flow in analytical terms will serve to provide a different viewpoint into
11
the writing of this code and should, therefore, not deter the reader who is unfamiliar
with these expressions. Such a reader should try to work through these concepts without
intimidation; they are merely provided as an alternate method to examining this problem.
Going back to Eq. (II-11) and distributing the dZ2 term among the temperatures, we
obtain the following equation:
q+l
Ty
dt
T3+~ TJn _
dx
_
0
T? TJn_ ~
dz
dx
(11-13)
~(~j,
~n),
T.~+1 as ~(~j
~p+*
(zj~
n + ~)o
(11-14)
namely
J(z + dz)
df
= hno
f(z)
dx
dx
hlo
lim
t) =
dx
Z(Zj +
t)
~(X.j
()
~
ax
dx, t) =
dx
(.
[ox]
(11-16)
j+l/2
(H-17)
j-1/2
1,2
dx
12
(%),+
1,2
(11-18)
dx
O:
(11-19)
would have been able to work backwards, choosing finite differences for each derivative
and eventually generating Eq. (H-12).
Computational
Implementation
of Equations
Having derived an expression for heat flow in finite-difference form, the question still
remains of how it will be computationally
implemented.
in the writing of our code, three major issues must be examined: boundary conditions,
redefinition of variables, and the structure of the program itself.
Our first major issue is the construction of boundary conditions.
As was previously
discussed, boundary conditions represent the external conditions that act to change a
system. This representation is accomplished by the placing of zones beyond the normal
boundaries of the array. The values of these FICTITIOUS ZONES or GHOST ZONES are
chosen in such a way that they accurately express the external environment of the system
in question. In this chapter, the conditions to be simulated will be a heat source at the
left and an uninsulated area at the right of the rod.
While the temperature in each true zone withh
successive calculations of Eq. (11-12), the values at the fictitious zones will be calculated to
represent fixed temperatures at either end of the array. In order to determine these values,
consider the situation at either end of the array as represented in Fig. II-4.
13
l
I
I
7j . . .
I
I
Fig. II-4
In this diagram, T~ represents the temperature along the left end of the rod, the
value that should remain constant throughout the simulation.
the actual array, this constant temperature can be thought of as T112, the average of the
temperatures at zone Tl and ghost zone To. Therefore TL can be expressed as follows:
TL=
To + T1
~
.
(11-20)
T1.
(11-21)
Similarly, if TR is defined as the temperature along the right end of the rod, T~+l can be
expressed as follows:
Tj+l =2TR
Tj.
(II-22)
By implementing these two equations, boundary conditions can be expressed for both
the left and right of the system. Expressions for the other surfaces of the rod will not be
needed, as they are assumed to be completely insulated, thus reducing the problem to one
dimension.
The second major issue in solving of Eq. (11-12) computationally is the redefinition of
variables. Thus far in this chapter, our equations have been represented in a manner that
is not accepted by the FORTRAN programming language. Therefore certain modifications
14
must be made in the way that various variables are represented; they must be redefined
in terms of computationally accepted symbols:
~~
jba
0-
sig
T;, the temperature at zone j at time cycle n, will now be defined as T(j), an element in
an array T defined from T(0) to T(jbar +1). Likewise, ~+1
of the
Our finite-difference code will be divided into five sections, each with a clearly defined
task. The first of these sections is the initialization procedure that dimensions the arrays
and assigns initial values to all variables. This initialization is done in a subroutine that
is called only once at the beginning of the program.
The second section of our code sets up a loop that repeats each time cycle. This section
determines if the time counters pt and st have reached ptime and stime respectively and
then increments the counters. If pt has reached ptime, it is reset to zero, and the current
array of zones is sent to the output subroutine. If st reaches stime, the program terminates.
The third major section is the definition of boundary conditions, which occurs after
the test for ptime and stime and before the actual computation of the next time cycle. In
our particular program, this section should carry out Eq. (11-21) and Eq. (II-22) on the
array T, updating values for the ghost zones at each time cycle.
15
The fourth section is the portion of the program that implements Eq. (11-12), which
also occurs within the time-counting loop. This implementation is made up of two loops,
the first of which assigns Tnew according to this equation, and the second of which transfers
the values of Tnew back into T. The code for this section is as follows:
do 100 j =1, jbar
Tnew(j) = T(j) + sig*dt/dx**2
* (T(j+l)
+ T(j-1)-2*T(j))
100 continue
do 200 j=l,
jbar
T(j) = Tnew(j)
200 continue
This two-loop structure is essential to the successful computation of T at the new
time step. If one were to forego the computation of Tnew and directly compute T, the
temperature terms at the right hand of the equation would not exist at the same time cycle.
While T(j+l ) and T(j) would still be at time n, T(j-1), having already been computed in
the previous iteration of this do loop, would exist at time n + 1. By creating a second
array and moving these values into T after they are all computed, we are able to avoid
this problem.
The final section in our code is the output subroutine, which occurs when pt=ptime.
This procedure could contain various graphics routines, write results to an output file, or
simply display the various array values on the screen. A diagram of these sections and
their interactions appears in Fig. 11-5.
16
Q
t
I1.
Initial Conditions
st = stime
3. Boundary Conditions
4. Temperature
Computation
Fig. II-5
E.
Programming
and Results
We have now reached a point where the reader should be able to write his own finitedifference code for heat transfer. In this work a limited series of examples are examined in
order to demonstrate the output of our code.
Figures II-6 through 11-10 below show the results of a simulation of an insulated
rod that is originally at 0 C, with a fixed temperature at the left (TL) of 400 C, fixed
temperature at the right (T~) of OC, a thermometric conductivity (a) of 1.0 m2 per see,
a zone length (dz) of one meter, a ~ of 50, and a time step (dt) of 0.1 seconds. Results are
shown at 10, 50, 100, 250, and 1000 seconds.
17
$
ii
.
i
0
Rrt
0
0.0
1!2.s
it
w, a
St. )
;0
i
-.
Ii
-.
s,~ \
.
.
00
tat
N a
t
37,
J&-+
18
SL b
i,
g:
a)
5:
~(l)
3 :.
G
.
-.
0 .D
!=
K.O
r
~F
C(I,D
Notice how the zone temperatures approach a straight line as the simulation progresses.
Such a line is the final steady-state solution of this system, regardless of thermometric
conductivity. Solutions at earlier time steps can be approximated using Eq. (III-55), which
is derived at the end of Chapter III.
In the next three graphs, the effects of changes in time step are shown in relation to a
simulation which is otherwise identical to the one above. Figure II-11 shows a temperature
curve for a system at a time of 100 seconds with a time step of 0.495, just under 1/2.
.
.
b.o
Ia.
:5
wfl
m-)
This figure is almost identical to Fig. II-8, indicating that there is Iittle difference
between the results obtained with a time step of 0.1 and the results obtained with a time
step of 0.495. Results are quite different, however, when a time step of 0.5 is used, as in
Fig. 11-12.
2-
ga
32?
&
a 0.
a?
&
The stair-step type temperatures that can be seen in this graph are a result of a
numerical instability. This instability becomes even more violent when the time step is
further increased to 0.505, as in Fig. 11-13.
:1
G;
w.
!28
s.
Id
&.
a
ls~
; a .n
lx
Zn
Zl,l
U h
Notice that in this figure the highest temperatures are much greater than 400C, whereas
the lowest temperatures are below 250C.
is greater than 1/2. The presence of this instability means that the more accurately
one wishes to resolve a set of circumstances, the shorter the time step that must be chosen.
This problem highly limits the sorts of cases that can be simulated, yet there is a method
by which it can be overcome. The following chapter examines this numerical instability
and discusses the use of an implicit method of solutiona method that increases the speed,
accuracy, and applicability of our finit~difference codes.
21
III.
A.
NUMERICAL
INSTABILITY
AND
IMPLICIT
CALCULATIONS
is known as the diffusional stability condition, and it is one of two important conditions
that we will examine in our series of finit~difference codes.
Consider the simplest case possible for our simulation: that of a rod at a constant
temperature, To, with this same temperature at either end. Now consider the case in which
this system of constant temperatures is pert w-bed by slightly increasing the temperatures
of the odd-numbered
the even-numbered zones by the same amount. The result is a system such as depicted in
Fig. III-1.
12
34
. . .
Zone
Fig. HI-1
Let us now chose an odd numbered zone, j, and examine the calculation of its
temperature at each time step. We begin with
(11-12)
22
C+&2
~[Toc+TO
e2(To+e)]
(III-1)
4~dt
1
dx2
[1
=To+e
(III-3)
C].
(III-4)
Note that ~ in this equation is made up of all positive components; therefore, & >0
and
as To + c (fraction), yielding a value closer to To than the previous time step. Subsequent
iterations of this equation generate a series of temperatures such as shown in Fig. III-2.
&
123456
7...
Time Step
Fig. III-2
23
In this case, the temperature converges towards To, moving towards the array of constant
temperatures that defines a correct solution.
In our second case ~ = 1, leaving us with the equation ~+1
Time Step
Fig. HI-3
Our third curve is similar to. the first and occurs when 1 < & < 2. When this is true,
I ~ is again a fraction, but this time it is a number between O and 1. The result is a
set of values which alternate above and below To but converge toward that value as shown
in Fig. III-4.
I
E
T)
Time Step
Fig. III-4
24
I
. . .
oscillates but
does not converge, asin Fig. IH-5. This case, while nonconvergent, is still consideredto
represent the bounds of numerical instability.
g= 2.0
To
~
12
34
. . .
Time Step
Fig. III-5
Our fourth and final case occurs as soon as this bound is crossed, when ~ >2.
In this
set of circumstances 1 ( < 1, yielding values of Tn+ 1 that not only oscillate but diverge
from the correct solution. The graph of temperatures appears as in Fig. III-6, with values
diverging until the program is terminated.
12
34
. . .
Time Step
Fig. III-6
25
In order to avoid this condition, as well as the stable but nonconverging state pictured
in Fig. III-5, we must choose ( such that ~ <2.
we obtain
.
4crdt
<2,
dx2
(111-5)
crdt
(111-6)
S<5
We have therefore demonstrated graphically that this condition must be met for a solution
to converge.
B.
Mathematical
been made graphically. This section, like section II-C, is not essential to the writing
of our codes; it is simply another method of arriving at the dlffusional stability condition
and better explaining the manner in which it can be overcome. Again, one should follow
as closely as possible, gaining familiarity with the application of various mathematical
methods towards this problem.
We will begin with the heat-flow equation as expressed in Eq. (11-12), this time
substituting our definition for ~:
(III-7)
Let us examine the behavior of T; with the following trial solution:
T; = Aeikjdxezwndt
(III-8)
ezwdt
&i
k j dxrn
(III-9)
From this equation, we see that r must be between 1 and 1 for T? to converge.
If r > 1, the solution will diverge monotonically, moving farther and farther towards
either positive or negative infinity. If r < 1, the solution will diverge in an oscillatory
manner, alternating between positive and negative values but always moving away horn
convergence.
Keeping these restrictions on ~ in mind, let us now use our test definition of T~ to
substitute for temperature terms in Eq. (III-7):
Aeikjd~p+l
Aeikj~r~
+ < Aeik(j+l)rn
4 [
+ Aeik
(jl)rn
-2Aeik@]
(111-10)
r=l+$[eikdz
4
+e-zkdz_2]
(111-11)
Using the identity eio = cos O+ i sin O we can rewrite this equation as
r=l+
:[2coskdx-2]
(111-12)
or
r=l
z[l
coskdz].
(111-13)
Consider the extreme cases for the cos kdz term, namely cos k dz = +1 and 1. If
cos k dx = +1, then Eq. (HI-13) reduces to r = 1, a valid statement according to the
restrictions that we have placed on r. This case poses no problems.
Taking the other extreme, cos kdx = 1, we are left with
T=l
<.
(111-14)
27
1<1~
(111-15)
<<2.
(111-16)
or
Using our definition of ~, we find that Eq. (111-16) is simply another statement of the
diffusional stability condition:
crdt
(111-17)
G<5
Our analytical method arrives at precisely the same result as the pictorial analysis; the
diffusional stability condition must be met in order to ensure numerical stability.
C.
Implicit
Calculations
as well as
graphically and have demonstrated that it is essential to the numerical solving of Eq. (H12). It is possible, however, to solve the heat-flow equation numerically without meeting
this condition, by expressing the & terms of the heat-flow equation at time n + 1 rather
than at time n. In this method, heat flow is not represented by Eq. (11-12), but instead
by the following:
(111-18)
Let us now examine this equation mathematically as we did in Section B. Inserting a
similar trial solution and dividing by Ae2 k j *rn,
[ e kdxT
we obtain
ekd% 27] .
(111-19)
or
[2~ COS kdx - 2r] ,
28
(111-20)
1+$(1
coskdz)
(111-21)
Examining the upper and lower limits for cos kdx, we find that
r=l
(III-22)
or
1
(III-23)
=1+<
Because ~ is always positive, r will be between O and 1 in all cases, indicating that
our solution will be numerically stable regardless of the value of ~.
Equation (111-18)
will therefore remain stable at any resolution and time step; all that remains is to solve it
numerically.
Equation (111-18) represents an IMPLICIT METHOD of calculation. In this method,
values at the new time cycle are not directly calculated from old values as they were in
the EXPLICIT METHOD used in the previous chapter. They are instead calculated using
an iterative process that begins with a trial solution and modifies that solution with each
iteration until it has converged to within a specified value. In our program this iteration
will be done using Newtons Method.
Newtons Method is an iterative process that uses successive approximations to solve
an equation in the form ~(z) = O. In Newtons method a trial value for Z1 is first chosen,
then the following equation is applied iteratively:
f(xn)
+l=X g
()
(III-24)
Xn
This equation generates successive approximations for x, each more accurate than the one
before it. When z has converged to within a speciiled range, z. is then taken as the final
solution.
29
Zn+l = Zn
X:-2
2xn
(III-25)
Z1 = 2.000
X2 = 1,500
X3 = 1.466
X4
1.414
Z5
1.414
A plot of these values along the graph of the equation appears in Fig. 111-7.
f(x)
x,
x
Fig. HI-7
This figure illustrates how one solution is used to obtain the next. The tangent is
used to approximate the graph of .f(xn) at the value Zn, and Zm+1 is given the value of
30
x for which the tangent crosses the x-axis. This value is then substituted for z and the
process is repeated until it has converged.
Let us now apply this process to Eq. (III-18). Expressing this equation as a function
of T?+1, we obtain
f (T+l)
= T;+l
x
~z~ [~-:+
T;
7??
- 2T+]
(III-26)
f(q+l)=l+%.
Using both of these definitions in Eq. (III-24), we are left with the final formula:
~+1 (new guess) = T~+l (old guess)
(III-28)
((~:=)))
By using this formula iteratively, we can now compute values for T?+l for any values of
D.
Computational
Implementation
Now that we have developed an implicit method for use in solving the heat-transfer
equation, we can implement this method on the computer.
small modifications to the heat-transfer code that has already been written.
We begin by defining a constant beta that is set during the initialization procedure.
Beta is defined as
p=
1
1+S
and is used to avoid successive calculation of the denominator in Eq. (HI-28) during
iterations of Newtons method.
is equal to the margin of error to which our iterative procedure will converge. Typically
ftest has a value of approximately 0.001 times some maximum value of T in the problem.
Besides these two definitions in the initialization procedure,
in the previous chapter). This section in its explicit form should be removed and replaced
with an implicit section of code.
This implicit section should consist of a loop that makes the initial guesses for the
temperatures at time n + 1 and a loop that iterates until the values of Tn+1 have converged
to within ftest. The first loop is simply a do loop that defines the initial guesses for the
new temperatures as the temperatures at the old time step. Thus,
Tnew(j) = T(j) .
(III-29)
This loop is then followed by an until loop that is constructed in the following manner.
At the beginning of each iteration, a value fmax is set at zero. After this statement, the
.program moves into another loop that calculates j(T)
and uses these values to calculate the next guess for the new temperatures.
Also in this
100p, the largest absolute value for ~(T) is stored in the variable fmax. After this loop,
the program makes a check to see if fmax is less than ftest. If ftest is larger, the until loop
ends; if fmax is larger, the loop is repeated. The code for this loop should be similar to
the following:
100 fmax = O.
do 200 j= l,jmax
f = Tnew(j) - T(j) - (sig*dt/(dx*dx))
* (Tnew(j+l)+
T (j-1) - 2*T(j))
When this loop has finally terminated, the T array is redefined with the values from
the Tnew array, and the progam
remain in the same form as in our original program. No other modifications are necessary
to create a fully-implicit version of our onedimensional
heat-transfer code.
F
+
1. Initial Conditions
5. output
1
~pthe
st = stime
2. Tests
3. Boundary Conditions
4. Implicit solver
f>
max
f tad
f max <
ftest
Fig. III-8
33
By using the implicit code with the same set of parameters as were present in Fig. II12 (T. = OC, T1 =
= 100 see, ~
400C,
T,
OC,
a =
\.
The system
Q ;.
cd
k
3.
~R
a)
#
&=
n
0+
cm
Ku
s. o
Zflz
Ka)
is equal to
10
computed up to time 100, the system remains numerically stable. The results in Fig. 111-11
34
below appear almost identical to those calculated explicitly in Fig. II-11, yet the time step
used is over twenty times as large.
0
u
J,
Q ~$!
~:
Es
a)
$:,.
B
m
-1.
1
Ia.c
ml
.a
Cob
We see through example that implicit methods are able to generate results for sets of
parameters that are numerically unstable when calculated explicitly. This technique will
prove essential in later simulations, preventing the first of two major numerical instabilities
that we will examine in our series of exercises.
E.
an analytic solution that can be used to check the validity of our computational results.
Once again, following the manipulation of this partial-differential equation is not essential
to making use of the derived solution.
We begin with Eq. (11-19), the onedimensional
heat-flow equation
in partial-
differential form
~T
z=
32T
~~
(11-19)
and make the assumption that T is a function of the single dimensionless quantity that
includes C, z, and t:
T = T(t)
(111-30)
35
By making this definition, we are assuming that the rod is of infinite length, so that the
length of the rod does not enter into these parameters. This assumption is made because
the derivation of a solution for a finite rod is a much more involved process than a solution
for the infinite case. For our purposes an analytic solution to the infinite rod case will
prove to be sufficient.
Using Eq. (111-30), we can obtain expressions for its partial-derivatives. Differentiating
with respect to t we obtain
(111-31)
and
d2T
t32T
(III-33)
==&F
Equations (111-31) and (III-33) are substituted into Eq. (11-19) to obtain
x
_t3/2
2/6
_dT
C&
o d2T
d
(III-34)
Cl&
or
(III-35)
If we define a variable y such that
#!,
W
Eq. (III-35) becomes
iy<
36
dy
d~
(HI-36)
or
(III-37)
which can be integrated to obtain
<2
.=
(III-38)
lny+C,
4
where C is a constant.
(III-39)
or
e4
where K1 is a constant.
*
=
(111-40)
yK1 ,
equation by ~ to obtain
e~cL$
= KldT
(111-41)
e~d<=KIT+Kz
(III-42)
<1
where K2 is another constant. If we choose cl to represent < at a distance of zero from the
end of the rod this equation becomes
(III-43)
27.
2
37
(HI-44)
e-z dz=KITi-K2.
I
o
To determine the values K1 and K2, we examine two test cases. In the case where x
is O, the temperature is equal to that of the wall at the left end of the rod. We then have:
o
2
e-zdz
KITL + K2
J
o
(III-45)
or
K2 = (KITL)
(III-46)
In the case where we are at an infinite distance f.i-omthe heat source at one end of the rod,
the temperature is equal to the initial temperature specified for the rod:
m
z
e-zd~
= KITO + Kz ,
(III-47)
= KITO + K2
(III-48)
J
0
which reduces to
Zfi
()
2
or
(III-49)
fi-K1To=K2.
Setting Eqs. (111-46) and (111-49) equal to each other, we obtain
KITL
= K
KITO
(111-50)
or
1
+
= (T. TL)
(111-51)
(III-52)
2
J
o
e-zzdz = (T T)
(III-53)
((ToTTd)
or
5?%7
( )/
T= TL+(TO-TL)
[+~e-Z2&)
in this equation
;e
Zdz .
(III-54)
INTEGRAL,
also
called the ERROR FUNCTION. This term is not integrable in terms of simple polynomials,
but it can be solved by defining
a
f(a)
=:
-[
eZdz
erf(a)
erj(a)
0.0;
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
0.45
0.50
0.55
0.60
0.65
0.70
0.75
0.80
0.0000
0.0564
0.1125
0.1680
0.2227
0.2763
0.3286
0.3794
0.4283
0.4755
0.5205
0.5633
0.6039
0.6420
0.6778
0.7112
0.7421
0.;
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2.0
2.1
2.2
2.3
2.4
2.5
erf(a)
0.7969
0.8427
0.8801
0.9103
0.9340
0.9523
0.9661
0.9764
0.9838
0.9891
0.9928
0.9953
0.9970
0.9981
0.9987
0.9994
0.9996
39
(III-55)
This equation can be used to check the accuracy of our numerical results. It represents
the infinite rod case in which the temperature wave is not affected by the conditions at
the right end of the rod. At early time steps, the temperatures in our finite-rod simulation
should approximate those generated by this equation. Solutions at late time steps, as we
saw in Chapter II, should approach a straight line. By examining the results generated
by our code in both these circumstances, we can verify the validity of our finite-difference
calculations.
40
N.
A.
LAGRANGIAN
FLUID DYNAMICS
transfer [Eq. (11-19)], but heat flow is only one of many phenomena that can be modeled
using the finite-difference method.
at another physical phenomenon that can be simulated in this manner: the motion of
FLUIDS.
For our purposes, we will define a fluid as anything that is infinitely deformable or
malleable. This means that, while a fluid may resist moving from one shape to another,
it resists the same amount in all directions and in all shapes.
COMPRESSIBLE
or INCOMPRESSIBLE.
change its density much when pressure is applied to it, meaning that the fluid is moving
at a velocity much less than its sound speed, A compressible fluid is one that undergoes a
large change in its density as pressure is applied to it, meaning that the fluid is moving at
a speed that is comparable to its sound speed. We will be dealing with compressible fluids
in this chapter.
Our simulation will be of a system that can be reduced to one dimension: a piston
moving in a long cylinder that is filled with gas. The compression of gas in this manner
can by dealt with in one of two ways: through LAGRANGIAN
or EULERIAN methods.
In an Eulerian code, zones remain fixed in space throughout the simulation. Fluids
move in and out of the zone at various rates, causing the mass contained in a particular
zone to change as the simulation progresses. All physical quantities are fluxed between
cells, but the position of the cells at all time steps remains the same. We will examine this
method in Chapter V.
Another method for simulating this situation is the Lagrangian technique.
Lagrangian code the positions of zones vary between each time step.
In a
As fluids are
compressed and decompressed, the zones move accordingly, maintaining an equal mass
41
and
position of a given zone vary from time step to time step; only the mass contained by the
zone is held fied.
B.
of Equations
Description
In order to derive the equations that are used in a one-dimensional Lagrangian code,
we must first define a group of variables and coordinates similar to those used in our first
two simulations. We again have a onedimensional
a certain section of the system being simulated. The system appears as in Fig. II-3, with
a series of ~ true zones and ghost zones appearing at O and ~ + 1
1-
012
j-l
j+l
[+1
Figure IV-1
The variables that will be applied to this system, however, are quite different from
those of the heat-transfer problem. In the fluid-flow case there is no longer a single array
of temperatures, but instead a group of arrays that represent position, pressure, velocity,
density, internal energy, and viscous pressure. The definition of these variables over a zone
j is shown in Fig. IV-2.
In this figure:
Zj+ 1i2 a position of cell wall to the right of zone j
Uj+ 112= velocity at cell wall to the right of zone j
pj ~ pressure of zone j
.Jj s internal energy per unit mass of zone j
qj S viscous pressure of zone j
p = density of zone j
42
- 1/2
j+
1/2
112
j+
1/2
j1 jU2
j+l12 j+l
Figure IV-2
Note
that
u and x are located at the walls of the cells while the rest of the variables are
located at the centers. These positions will be important in determining the relationship
among these various quantities.
With our variables defined as in Fig. IV-2, the equations that relate them to one
another can be derived. Consider the relationship between x and u: z is the array of wall
positions and u is the array of the time rate of change of those wall positions, i.e., velocity.
From these definitions, we see that
ax
(IV-1)
%=u
Finite-differencing this equation gives us
n+l
j+l/2
q+l/2
dt
(IV-2)
7.$+1/2 >
q-1/2
u7+l/2dt
(Iv-3)
This is the first important equation of our Lagrangian fluid flow code.
The next equation follows from Newtons second law of motion, (Force = Mass x
Acceleration), and the definition of pressure, (pressure -
=).
momentum
cell
+Yj+l
j+l
Figure IV-3
momentum cell whose center lies at the boundary between two normal cells and define F
and Fj+l as the force at the right and the left of the j momentum cell. A momentum cell
is depicted in Fig. IV-3.
By the definition of pressure, F and F+l are rewritten in terms of variables defined
in Fig. IV-2:
J = (pj +qj)A
Fj+l = (Pj+l + qj+l)A
(IV-4)
1
(Iv-5)
where A is the surface area of a cell wall. Note that here we use the sum of the physical
pressure and the viscous pressure, an additional pressure that is necessary to achieve
numerical stability. The viscous pressure will be discussed in more detail in section C.
Using Newtons second law and noting that acceleration is the time rate of change of
velocity, we obtain
(Iv-6)
where F+112 is equal to the net force at the cell wall j + 1/2. In the case where there are
no outside forces such as gravity in the x-direction, the net force at j + 1/2 is equal to the
44
force pushing the momentum cell from the left (F) minus the force by which it pushes the
next momentum cell on the right (Fj+l ):
~j+l/2
= q
q+l
(IV-7)
~:+1
J+l/2
q+l/2
(IV-8)
(it
(qjPj qj+l
Pj+l)
=m
n+l
j+l/2~?+I/2 .
(IV-9)
Defining the quantity M as ~ and solving for u~~/,2, we are left with the expression
(IV-1O)
which gives change in u in terms of variables used in Fig. IV-2.
An expression for p can be obtained by again using our definition of M.
Because
~
j+l/2
(IV-II)
71/2
AE=QpAV,
(IV-12)
where AE is the change in heat energy, Q is the heat received from both conduction from
an outside source (which will not be important in this simulation) and dissipation of mean
flow kinetic energy, p is the pressure, and AV is the change in volume.
45
We now make use of the variable g, which we called the viscous pressure earlier in
this chapter. One way of thinking of this pressure is as Q/AV,
energy over the compressive (or negative) change in volume. Using q, Eq. (IV-12) can be
written as
AI=
(q+p)AV
(IV-13)
Because the total internal energy is equal to m x 1, this equation can be rewritten in the
following differential form:
81
- -(q+P)#
(IV-14)
~;+l In
j
dt
8Xj-~/2
= -(q+
PM
az~t
(IV-15)
Using our definition of M as ~ and ~j+l/2 as ax-.J22, we solve for ~+ 1 and obtain the
Lagrangian internal energy equation in finite-difference form:
(IV-16)
To obtain an equation for pressure (p), we employ the ideal gas law, namely
pV = nRT ,
(IV-17)
where p is the pressure, V is volume, n the number of moles, T the temperature, and R is
the universal gas constant. In S1 units R = 8.3145 J/K mol
In an ideal gas it can be shown that when CP and CV are the molar heat capacities at
constant pressure and constant volume,
CP CV=R.
(IV-18)
Combining this equation with Eq. (IV-17) and solving for p gives
P=;
46
(CP CV)T,
(IV-19)
~ ~cT
()
=F
(IV-20)
v.
c.
Because Cv is the molar specific heat and 1 is the internal energy per unit mass,
nCvT = mI .
(IV-21)
()
(IV-22)
Cv
GAS CONSTANT.
greater than one and represents the ratio of specific heats and is a property of the gas
being simulated. Some typical values of ~ are
air, -y= 1.4
helium, ~ = 1.66
co~,
y= 1.34
EQUATION
(IV-23)
.
OF STATE, is used to
9; =
90P:C
741/2
q+l/2
or if negative
if positive
q: =(),
(IV-24)
where go is a constant between 0.1 and 0.25, and c is a characteristic velocity of the system.
This equation will not be derived in this work, but it is important to understand why
it appears in this form. The irreversible processes that are modeled through the use of the q
equation occur when there is a rapid change in the volume occupied by a gas in a system. In
our system this change occurs when there is a large differential between the velocities at the
left and right of a given cell. Hence we make q proportional to u~_li2 U~+1i2, indicating
a large amount of kinetic energy dissipated when there is a large velocity differential and a
small amount dissipated when there is a lesser difference in velocities. Because dissipated
kinetic energy is never returned to the system, this term is said to have a value of zero
when its computed value is negative.
In order to be dimensionally correct u~_1,2 u;+ 1,2 is multiplied by the density of
the zone and by c, which is called the characteristic velocity. As cs purpose is simply to
make our equation dimensionally correct, we have some leeway in choosing this velocity.
Typically it is chosen in one of three ways. The simple& method is to define c as equal to
the value of some other major velocity in the simulation. In our simulation this would be
the velocity of the piston that compresses the gas in the cylinder. Another way that this
velocity can be defined is by using the sound speed of the fluid in question. Namely
c
=d
7P
7
(IV-25)
The third way in which c can be determined is by combining these two approaches by
adding the sound speed to a prevalent velocity in the problem. In this case
(IV-27)
In this section transport equations for position, velocity, density, internal energy,
pressure, and viscous pressure were derivedall the equations necessary to construct a onedimensional compressible fluid-flow simulation. The equations of fluid flow, particularly
those of density (or continuity), internal energy, and velocity (or momentum), are often
called the NAVIER-STOKES
EQUATIONS.
Having derived
these equations, we are ready to move our discussion to the construction of the computer
code itsel~ but before we take this step, let us first take a closer look at the artificial
viscous pressure. Its relationship with the diffusion equation will help us derive a stability
requirement that will be important in this simulation.
C.
our definition of q [Eq. (IV-24)] into the momentum equation, while dropping the ps and
the subscripts on p, gives us
u7+l/2 i-
q. P c t
~
u;_1,2 + u~+3/2
(
2U:+1,2
(IV-29)
(IV-31)
u=qocdx.
Using the diffusional stability condition on o [Eq. (III-6)],
(111-6)
we find that
qocdt
dx
(IV-33)
This important stability requirement arises from the parallelism between the effect
of q on the momentum equation and the equation of heat diffusion. It is the first of two
major stability conditions that are found in this code.
The second condition,
the COURANT
STABILITY
CONDITION,
is a stability
V
tt
d.%
Figure IV-4
In this case, we see that for a given time step (dt), the left wall will move toward
the right wall a distance v dt. In order for our Lagrangian simulation to remain valid, the
50
left wall cannot be allowed to move past the right wall, Mathematically the system must
satisfy the following equation:
vdt<dx.
(Iv-34)
(IV-35)
Since cross-overs can also occur when a right wall moves leftward past a left wall, our final
stability condition is
(IV-36)
In our code, v is equal to the maximum velocity in the system Iu] + c. Equation (IV-36)
is the Courant stability condition.
work. In this chapter, we need only note its restrictions when we represent our system of
equations computationally.
D.
Computational
Using the equations derived in Section B, we can begin writing our one-dimensional
Lagrangian compressible fluid-flow code. As was true in the heat code, we must define our
variables in FORTRAN
terms before we discuss their use in the code itself. Our variable
qj
uj+l/2
xj1/2
(j))
~j+l/2
x(j),
uj1/2
U(j-1),
and
40,
~j
x(j-1).
W),
Pj
rhdj),
while still defined at j + 1/2 and j 1/2, are written as x(j), u(j), x(j-1), and u(j-1). For
both of these variables an array index of j indicates a value at position j + 1/2, the wall
directly to the right of cell j.
Our program is structured similarly to the heat flow problem illustrated in Fig. II-5.
The code exists in five main sections: an initialization routine, a section for time checks
and incrementation of counters, the definition of boundary conditions, the updating of
variable values, and an output procedure.
51
First, let us examine our initialization procedure, which defines allthe initial values
necessary for the problem. Just as in the last simulation, this procedure is used to initialize
time counters and define the length of the system being simulated, but this procedure must
also set values which were not present in our last case.
It defines the constants:
qo
gamma
mass/area
U1
ur
sieO
Uo
A loop such as the one that assigned temperatures in the previous problem must be
constructed to initialize all the real elements of arrays rho as rhoO, sie as sieO, and u as
uO, and to compute initial values for x, p, and q using Eqs. (IV-3), (IV-23), and (IV-24),
respectively.
After the initialization procedure, the program moves into the same sort of loop as
did the heat program:
conditions, and updating the arrays. The time check portion of the loop is exactly the
same as in our last two codes and can be written by repeating what was discussed in
Chapter II. The boundary conditions and array assignments are also quite similar to those
of our first program but must now be modified to deal with a group of arrays as opposed
to a single array of temperatures.
The boundary conditions must be defined for each variable that is referenced at the
j = 0 or j = jbar+l
52
positions by referring to the equations that define our variable values: Eqs. (IV-3), (IV-1 O),
(IV-11), (IV-16), (IV-23), and (IV-24).
From Eq. (N-l 1), which appears in code form as
rho(j) = M/(x(j)
x(j 1)) ,
(IV-37)
we see that x(0) will be referenced, indicating the need for the position at the left of the
system to be prescribed in our boundary conditions. By similar analysis of Eqs. @V-16)
and (IV-24), we see that there is also a need for values to be determined for u.1f2 and
Uj+~/2, and for this reason boundary conditions must be assigned to u(0) and u(jbar),
representing u_l/2 and Uj+ 1)2, respectively.
An examination of Eq. (IV-1O) might lead the reader to believe that boundary
conditions are also required for p and q at position jbar+ 1.
be true if the wall at the right of the cell were not prescribed, indicating a u(jbar) that is
determined independently of p and q. The only three variables that must be modified to
establish our boundary conditions are x(0), u(0), and u(jbar).
These variables should be assigned according to the system we wish to represent. For
the piston problem, the wall at the right is stationary, indicating that u(jbar) = ur. The
velocity at the leftmost cell wall in this problem is equal to the velocity of our simulated
piston, u(0) = u1. The position of the leftmost cell wall is equal to its position at the old
time step plus the distance that it moves to the right during the new time step, x(0) =
x(O) + dt * u1.
In our boundary conditions, we set a value of u(jbar) and not u(jbar+l ). This value
may seem strange to the student, as it does not make use of a ghost zone but rather
modifies a real value in the array. It is allowed because u(jbar) itself exists at a boundary,
representing the velocity at the wall directly to the left of zone jbar. In effect, a ghost zone
is being modified in which u(jbar) defines the rightmost wall.
With the boundary conditions updated, the code then moves into the updating portion
of the program. This is an explicit procedure, which does not use the nested loop structure
53
that was employed in the previous chapter. We are once again dealing with a single loop
that assigns new array values based on the values at the previous time step. However, this
time we are not dealing with a single array of temperatures but a series of interdependent
arrays.
This change presents a problem that was not present in the previous simulation,
namely that of updating the values of the variables in an order such that all terms defined
at time n in an equation exist at the same time step. This problem is a more complicated
version of the one that caused us to create a Tnew array in Chapter II. Now we are not
only concerned that the terms of a single array exist at the same time step, but that the
values of a group of arrays be updated in an order such that each variable is calculated
using values from appropriate time steps.
To understand how this order is determined, let us first list our six equations in
pseudo-code format. All variables are expressed as they would be in FORTRAN
with the
exception of the superscripts which are used to remind the reader of the time step at which
each of these terms exists. In this form, Eq. (IV-3) becomes
xn+l(j)
(IV-38)
(Iv-39)
(IV-40)
).
* (qn(j)+pm(j))
* (um(j-l) - un(j)).
(IV-41)
(IV-42)
qn+(j)=
if (qn+l(j)
C@ *
rhon+(j)
(IV-43)
Eq. (IV-
41), Eq. (IV-39), Eq. (IV-40), Eq. (IV-42), and Eq. (IV-43), where the third and fourth
are interchangeable, as well as the fifth and sixth. The variable updating portion of the
program is a loop that implements these transport equations in an appropriate order.
.
Start
+
Setup
&
! Initial B.C.
[
output
Tests
1
!
L= stime
1
,CEcI
Figure IV-5
55
procedure desirable to the user, and the on~dimensional Lagrangia.g fluid code is complete.
A graphical representation of this code appears in Figure IV-5.
E.
sieO = O (cm2/s2), qO= 0.3, and dt = 0.05(s). Plots appear at times of 2, 4, 6, 8, and 10
seconds respectively.
=.
v
Y
-.
b.O
.?.!~
51
Figure IV-6
Densities at Time 4 (s)
Figure IV-7
56
7s
1D.a
-.
~.
~
b
5.0
2.$
7 ,a
10.0
7 .s
10.0
Figure IV-8
DO
2. s
5,8
Figure IV-9
Densities at Time 10 (s)
/
57
The phenomenon that we are exarnining in these plots is known as a SHOCK, a rapid
transition between two states that moves relative to the fluid. Weak shocks occur when
fluid is moved at low speeds, but the effects of shocks are most notable when a fluid is
moved at a velocity that is near to or greater than the sound speed of the fluid. A shock
can be visualized by using the analogy of an evenly spaced line of billiard balls.
Consider the case in which a narrow channel has a piston at one end and is filled with
evenly spaced billiard balls, as depicted in Fig. IV-11.
Figure W-11
The leftmost ball is pushed to the right by the piston and begins to pile up balls in fi-ont
of it as it moves down the passage. This movement creates a re@on in which billiard balls
exist at a much higher density than in the rest of the passage, because the billiard balk
that are moving are touching each other whereas the stationary ones are stilI evenly spread
apart. The front of this compressed region (called the shock or SHOCK FRONT)
forward faster than the piston itself because b~ard
moves
of the piston as it moves to the right. This system is illustrated in Fig. IV-12. Note that
in this figure the transition from the compressed region to the undisturbed surroundings
is virtually instantaneous, and that the shock front is not a gradual change in density but
rather takes place over a very narrow span.
Our Lagrangian plots demonstrate this sharp contrast between compressed
and
uncompressed fluid that occurs in a shock. In these plots we can also see the compressed
region expanding and the shock front moving at a velocity that is greater than that of
the piston.
58
The velocity of the shock front can be predicted, as can other properties,
compressed region
shock front
(moves faster than the piston)
Figure IV-12
byappealing
totheequatiom
be using the equations of INFINITE STRENGTH SHOCKS, shocks that occur when the
shock speed is large compared to the sound speed ahead.
These equations will not be derived in this work, but such derivations are available in
various textbooks and monographs, specifically in Fluid Dynamics-A
by Flancis Harlow and Anthony Amsden, LA-4700.
LASL Monograph
equations are
~~_y+l
up
(Iv-44)
where us is the velocity of the shock, and UPis the velocity of the piston, and
~~_7+l
_
Y-lpo
(I-V-45)
where p~ the density behind the shock, and p. is the initial density of the fluid.
Applying these equations to the parameters used in our simulation, we predict that
the shock will move forward at a speed of 0.66 (cm/s), and produce a compressed region
of density 4 (g/cm3).
The next two graphs illustrate the effect of qO on the accuracy of our numerical
simulations.
-1
Densities
at Time
10 (s), qO = 0.1
0. D
2.3
SOB
7.%
ma
Figure IV-13
If qO is too high, on the other hand, the answer is stable but inaccurate, losing the degree
of clarity that was present in the gO = 0.3 graphs.
Densities
at Time
10 (s), qO = 0.75
-.7
a
n--
0
~_
-,
.-,
~
-0.0
1
2.3
sol
Figure IV-14
At even higher qO values, the difEusional stability condition is violated, resulting in the
program being terminated by errors.
60
Computationally,
creating an array that is made up of one set of zones at a density plefi and another set
of zones at a different density ~~ight. Because our equations assume a constant M, these
zones must be MASS MATCHED such that the mass of every zone is a constant.
This
matching is done by decreasing the initial length of the denser zones relative to the initial
length of the less dense zones such that dx p is a constant.
In the example presented in this work, pl,~ is chosen to be 1 (g/cm3) w~e
4 (g/cm3).
pright is
Mass matching is achieved by multiplying the length of the left zones by 8/5
and multiplying the length of the right zones by 2/5 so that 8/5 x 1 = 8/5 = 2/5 x 4. The
resulting code appears as the following:
do 100 j = l,jbar/2
rho(j) = rhoO
x(j) = x(j1)+(8./5.)(
length/float(jbar))
100 continue
do 200 j = (jbar/2)+l,jbar+l
rho(j) = rhoO*4
x(j) = x(j1)+(2./5.)*
(length/float(jbar))
200 continue
For the results shown in this simulation, the following parameters are used: length =
10.0 (cm), ul = 0.0 (cm/s),
(g/cm3),
sieO = 1.0(cm2/s2),
rhor = 4.0
qO= 0.3, gamma = 5/3, and dt = 0.05 (s). Note that sieO
is not equal to zero in this simulation; there wo~d be no motion of fluids in the shock
tube without some initial internal energy being present. Figures IV-15 through IV-20 are
graphs of this system at times of O, 1, 2, 3, 4, and 5 seconds respectively.
61
Densities
at Time
O (s)
iCI
a
c.z-
!-i
-.
o-u
,
Za
3.0
7.~
10.0
7.2
I ao
Figure IV-15
Densities
a!0.
at Time
2a
1 (s)
5 .a
Figure IV-16
Densities
at Time
2 (s)
=1
+ -
n
i-
+-+2.1
5.U
Figure IV-17
62
7.3
Ia.a
Densities
at Time
3 (s)
/
0
.=
n
~
1
O-D
2a
1
3.4
lao
7.3
Figure lV-18
Densities
-.
0.
za
at Time
4 (s)
,
5.0
7.3
Figure IV-19
Densities
at Time
5 (s)
0
.+-
Figure IV-20
I au
In these graphs we see three major features: a shock wave moving to the left, a
CONTACT
DISCONTINUITY
a RAREFACTION
between the two fluids that is also moving to the left, and
WAVE that is moving to the right and bouncing off of the wall. Each
rarefaction
wave
A-
contad
Q.
shock
discontinuity
front
\
s~
=
Figure IV-21
The equations that describe the properties of each of these three features of the shock
tube problem will not be included in this work. Once again, the reader interested in these
equations should refer to LA-4700 or a similar work.
The same sort of instabilities that were present in the piston problem can also be
induced in the shock tube problem, as is ilhstrated by the following plots of density at a
time of 2 seconds, each generated by the same parameters as the previous graphs except
for qO, which is 0.1 in the first graph and 0.75 in the second.
64
z-
Densities
at Tixne
2 (s), qO = 0.1
m
*
-..
&
~
70.D
3 .a
2a
,
7.3
I
I ao
Figure IV-22
Densities
at Time
2 (s), qO = 0.75
n
~
=
<
Figure IV-23
Again, if qOis increased to an even higher level, the code will become numerically unstable.
In this chapter we have seen a number of simulations that can be created using the
Lagrangiam equations for onexiirnensional compressible fluid flow. In the following chapter,
.
we will solve the same sorts of problems using an Eulerian method, learning a different
technique that can be used to solve the equations of fluid motion computationally.
65
V.
EULERIAN
FLUID DYNAMICS
A.
Eulerian Methods
and Advective
FIUX
In the previous chapter we examined the use of Lagrangian methods in solving the
equations of one-dimensional compressible fluid flow. We are now going to approach the
same problem from a d.iEerentperspective, using an Eulerian technique. In this method the
zone positions are held completely tied,
zones. Cell masses are not constant in time, but instead fluid moves between cells; while
only the spatial coordinates of the zones remain constant.
in our Lagrangian calculations. Those fluxes occur when the quantities themselves move
from one region to another without any motion of material. An example of a nonadvective
flux is heat conduction.
While our previous simulation dealt only with nonadvective fluxes, our Euleria.n one
dimensional fluid code will include both advective and nonadvective fluxes. In order to
accomplish this, we must return to our six equations that describe the interaction of the
various physical quantities and add to each a term that describes the advective fluxes that
are intrinsic to the Eulerian method.
66
B.
represented, we must first take a closer look at the situation that it represents. Consider a
system such as in Fig. V-1, in which a portion of the material in one zone is being moved
into the zone that is adjacent to the right.
udt
~
u = velocity
Figure V-1
In this picture we see that when the material in a zone is moving at a velocity u, the
material contained in a length u dt will be moved into the adjacent cell. Because each zone
ha.5an area A, the volume moved horn one cell to another is Au dt.
This transfer of volume can be multiplied by p, the mass per unit volume, to obtain
the following equation for total mass crossing the cell boundary in a given time step:
Total Mass Crossing Boundary in a Time Step (dt) = A p u dt
(v-1)
This equation can be used to find the mass flux, the total mass crossing per unit time per
unit area:
Mass Flux = ~:d
= ~u
(v-2)
Equation (V-2) is a statement of the advective mass flux between two cells. It illustrates
.
a much more general principle that can be shown by replacing p by a value Q, the density
of any quanti~ that is being advected. In this general case
Advective Flux = Qu .
(v-3)
67
The density of each of the various physical variables is computed by simply dividing
the desired quantity by the volume of a cell. Consider the case of momentum, for example.
As was stated in the previous chapter, momentum is mass times velocity:
m u = momentum .
(v-4)
moment um
volume
is p and momentum/volume
(v-5)
can be rewritten:
(V-6)
p u = momentum density .
By a similar process, we find that
(v-7)
p U2
= kinetic energy density .
2
(V-8)
and
p U2
(v-lo)
(V-n)
$U
We will use these expressions in deriving the equations of EuIerian fluid flow.
68
(v-9)
(V-12)
We begin with the expression for density, which was described in our Lagrangian
calculations as
=
M
~n
j+l/2
~n
jl/2
(I-V-11)
This expression needs to be modified to reflect the fact that mass is no longer a constant
and that distance between cell walls is no longer a variable. To modi~ this equation, we
first substitute eke,the fixed distance between the cell walls, for Z~+l,2 Z~_l,2:
M
(V-13)
=Z
We must now derive an expression for changes in M, the mass of a cell divided by the
area. This derivation is similar to that of the expression for heat in Chapter II. From mass
conservation,
mass~+l mass; = amount in - amount out .
(V-14)
Because amount in and amount out are simply flux x area x time step, and flux has been
defined by Eq. (V-2), numerical expressions for both these terms can be calculated
amount in = fluxl,ft A dt = (P U)j-1/2
amo~t
Ad~
(V-15)
(V-16)
By substituting these two values into Eq. (V-14) the change in mass, mass~+l msss~,
can be expressed as follows:
A msss = (pU)j_l/Q A dt (p U)j+l/QAdt .
(V-17)
Using our defm.ition of M as mass divided by area and factoring out like terms, we obtain
an equation for change in M:
AM=
dt
((pu)j-1/2
-(PU)j+l/2)
(V-18)
dt
~
((Pw-1/2
- (Pw+l/2)
(V-19)
69
Because the new density is equal to the old density plus the change in density, p + Ap, we
are left with a final equation for the updating of densities that is made up of two parts:
an expression for the density at the old time step and an expression for the change due to
advective flux:
P;+l .p~.+
dt
~
()
((P4j-1/2
(P@j+l/2)
(V-20)
This analysis leaves us with an equation that expresses density at the new time step, but
also presents us with a problem. Equation (V-20) makes use of the advected ~j_l/2
Pj~IIZ de~ities
and
expressed at the left and right wall Of ce~ ~ These quantiti~ cannot be
referenced directly but instead must be computed using one of two methods: CENTERED
or DONOR CELL.
Centered expressions for advected qumtities are computed by averaging the values at
the cell centers to the right and left of the wall across which fluid is being advected.
In
our cssej centering would lead to an expression for density in the form of Eq. (V-15):
Pj-1/2
= ;(%
+ Pj-1)
(V-21)
.if
= pj-l~j-1/2
uj_l\2 >0
or
(P)j-1/2
= Pjuj-1/2
(v-22)
if
uj-1/2
<0
j-112
Figure V-2
The donor technique should be employed wherever a quantity is being advected across a
cell wall, as is the case with internal energy.
The Eulerian internal energy equation can be calculated beginning with the Lagrangian equation:
~+l=~y+~~
(~;+
P;) ( q-l/2
(IV-16)
- 7$+1/2 )
at the last time step (1$) and the change because of nonadvective flux # (q~ + p?)
Un
U7+1,2 . To write this equation in an Eulerian manner, we must add a third
)
( 31/2
term to represent the advective flux. Before this term is added, however, this equation
must first be modified. Multiplying by M, we obtain
(M 1)~+1 = (M 1)7+
(V-23)
We saw in Eq. (V-20) that the transport equation for a variable whose value is changed
only by advective flux appears in the form
(9;1=
(a;+
(V-24)
where Q is any variable property of the cells and V is the volume of a single zone. Using
this equation to express change due to advective flux in terms of energy density, we obtain
(M?I);+l
= (MI);
d-t (pu~)7+1/2
(PU07-1/2
(V-25)
71
Combining this equation with Eq. (V-23) gives us an expression for change in internal
energy that accounts for both advective and nonadvective fluxes:
(MI);+l = (Ml);
-u;-,,,)]
o (V-26)
Because zones are stationary in an Eulerian simulation, M = p dz. Therefore, this equation
can be rewritten as
This equation is computed using the donor-cell technique for the puI terms:
if
= Uj.-1/2(d)j-1
(P4j-1/2
uj1/2
>0
(V-28)
or
(Pq-l/2
= 74-1/2(POj
if
uj-1/2
<0.
(W;32
(~u);+l/2
d~ ((P + !?);+1
(P + !?);)
(V-29)
This equation is combined with an advective equation in the form of Eq. (V-25), namely
(V-30)
to obtain an equation that accounts for both the advective and nonadvective fluxes that
affect momentum:
(~u);::/2
= (~47+1/2
((PU2);+1
(PZL2); + (P + q)~+I
(P + d~)
(V-31)
Once again referring to our equation for M given afixed distance between celk (M = p dz)
we obtain
(%4;:;/2=
72
(P4;+l/2
((PU2);+1
(V-32)
In this equation, values for u at the cell centers must be computed using the donor-cell
,
technique. These appear in the form
(W2)j
= j(W)j-l/2
if
Uj >0
if
or
(Pu2)j= j(PU)j+l/2
<0,
(v-33)
where uj, ~j-1/2, and ~j+l/2 are computed as averages of the values half a cell to the left
and half a cell to the right of the point at which these quantities are defined:
(
j-2=(p1Jp9p9
jl/2
Uj =
+ j+l/2
(v-34)
(v-35)
(V-36)
Pj+l/2
(p+~+l)
The student may pose the question of why these averages are used in donor-cell calculations,
as they seem to indicate a centered approach that is unconditionally unstable. To explain
why these averages are employed, we return to our momentum cell diagram, noting where
these vsrious variables are located.
r-.
massccll
Figure V-3
73
The terms that employ the donor cell technique are made up of two portions, the
donoring velocity andthe
these quantities are uj 112and ~j 1f2, respectively. The donoring velocity is always taken
at the position at which the flux is taking place, whereas the donored quantity is taken at
the center of the cell to the upstream side of the cell wall at which a flux is taking place.
For density flux and internal ener~ flux, all of these values can be taken from positions at
which these quantities were directly defined: density and internal energy at the cell centers
and velocity at the cell walls. For momentum flux, however, the situation is different.
From Fig. V-3, we see that the donoring velocity at the wall of the momentum cell is
uj, whereas the donored quantities at the center of the momentum cell exist at positions
j 1/2 or j + 1/2. This configuration forces us to use values that are not directly present
in our arrays.
The Partial-Differential
Equations
of Fluid Flow
Once again, we are going to exarnine the partial-differential equations that relate
to our finite-diiTerence equatio~.
equations, this section is not necessary in the writing of our finite-difference code.
provided only as an additional method of looking at this system.
74
It is
zero and
generating equations in partial-differential form. In this form Eqs. (V-20) (mass), (V-27)
(momentum), and (V-31) (heat energy) appear as follows:
(v-37)
6yYu~ 8(2U2
at
@I ~ 8/YuI
at
ax
These equations
(V-38)
ax
=-(P+q)&
(v-39)
equations
for mass,
Equations.
We are going to take a look at these Eulerian equations and relate them to the
equations used in the Lagrangian code, trying to gain a better understanding of why
these two seemingly dissimilar methods yield computationally similar results.
We will begin with the mass equation, Eq. (V-37). By the chain rule, the second term
can be expanded to obtain
@
ap
~+u~+p~=o.
&L
(V-40)
We now employ the mathematical identity for the total differential of a function of
two variables, ~(x, t):
df = ~dt
+ ~dx
(V-41)
in t and x (denoted by dt and dx)
the function f changes by an amount df, as given by the formula. Dividing by dt gives us
df
=
dt
af
af dz .
z+axdt
(V-42)
75
calc~ation,
then ~ = u and
df
~f
8f
= at +u~.
dt
(V-43)
This is an expression for the rate of change of f along the motion of a fluid, also known
as the LAGRANGIAN
to ~.
DERIVATIVE.
the difference between the partial and Lagrangian derivatives. The meaning, however, is
equivalent.
Using the Lagrangian derivative to rewrite Eq. (V-40), we obtain
dp
(v-44)
~+pgo.
This equation is the Lagrangian partial-differential equation for fluid flow; its finitedifference approximation is equivalent Eq. (IV-11).
(v-45)
or
d~
1 au
~+ pax
=o.
(V-46)
dt + pdx
(j+l/2
Uj-1/2)
= 00
(v-47)
Note that in this equation dz is no longer part of a partial derivative but a finite distance
between zones.
From Eq. (V-13) we have M = p dz, and from Eq. (IV-1) we have u = dz/dt, so we
can write this equation as
d$
dt ~
76
dxj+l/2
dt
d~j1/z = o
dt
(V-48)
retreated
in the
same manner. We can therefore integrate this equation with respect to dt to obtain
1
=
~j+l/2
~j1/2
(v-49)
(rv-11)
j+l/2
We see then,
x;1/2
through the use of partial-differential equations, that the Eulerian and the
Lagrangian mass equations are equivalent in the properties that they represent.
This equivalence is also true fm the momentum equation, which appears in Eulerian
form as Eq. (V-38). This equation can be expanded to obtain
au
ap
P~+u@Pu~z
~+u
apu
8P
&J = & 9
(V-50)
%Pu~=-
p&
ax
(V-51)
or
(V-52)
Employing the Lagyangian derivative, we obtain
du
8P
z=-%
(v-53)
q!+l/2 qE1/2 ~
)
=
pdx (
(v-54)
77
= 7+1/2
+ %
M
PJ + q: ?-$+1
q;+l
) -
(Iv-1o)
the second and fourth terms are dropped using the mass equation
(V-56)
and finally the Lagrangian derivative is used to get the Lagrangian equation for change in
internal energy:
dI
~ 8U
z=
Through
(v-57)
at
ax
%=
apI ~ 8PUI ~
P6+.L
at
ax
ax o;
(V-58)
[V-59)
du
8P
Z+z=o
P:+
78
Pg=o.
(v-44)
(V-60)
(V-61)
equations and demonstrate that, although these are seemingly difFerent, their underlying
principles are the same.
D.
Computational
Implementation
of Equations
Lagrangian code: it contains the same five sections, its variable declarations are almost
the same, and the output procedure is of the same type.
There are, however, some major differences between these two codes. These differences
are found in the initialization procedure, in the boundary conditions, and in the equations
that are used to update the variable values.
The order in which our variables are given new values is again rho, u, I, p, and q; but
rho, u, and I must now be calculated using quantities calculated before the program enters
the loop that assigns new values to these arrays. This loop must generate values for rho,
u, and I; but the transport equations that were derived in Section B are written in terms
f Pj
(W)j+l/2>
and (pI)~. We have to obtain array values for the following quantities
)P~~~l/2
rhoin(j)-pl~+l
The
calculations are done for all array values before any updating of rho, u, 1, p, or q is
done.
Density is computed by simply setting the rho array equal to the rhon array:
rho(j) = rhon(j)
Velocity, u is computed by dividing the density times velocity array by the density array
at position j+l/2:
79
u(j) = rhou(j)/(.5
* (rhon(j) + rhon(j+l)))
Internal energy is computed by dividing the internal energy times density array by the
density array:
sic(j) = rhoin(j)/rhon(j)
The p and q equations remain unchanged from the Lagrangian case. This situation leaves
us with a loop that assigns values for rho, u, I, p, and q that appears in the following form
do 300 j =I,jbar
rho(j) = rhoun(j)
u(j) = rhoun(j)/(.5*(rhon(j)
+rhon(j+l))
* rho(j) * sic(j)
continue
This loop is preceeded by another loop that computes rhon, rhoun, and rhoin arrays
using the Eulerian equations for the transport of mass, energy, and momentum:
?+~=p;
PJ
(pq~+l
(P@;::,,
+z
dt
((P@-1/2
= (pI)$ :
[( PUI ) ;+1/2
= (P@&+l/2 :
(V-20)
(P4j+l/2)
(P@;-1/2
+ (P +
L?)7(~7+l/2 q-1/2)
(v-m
(V-32)
Each of these equations requires the use of the donor-cell technique, meaning that donor.
80
and
Pj+I/2
(PU ~)j1/2
ad
(P u ~)j+I/z
(~u2)j
~d
(w2)j+l
The problem of having to write our equations in a manner that allows the computation of
donor-cell for each of these terms can be approached in at least two ways: with a series of
if/then checks or with a double look-up technique.
The fist of these methods involves writing a separate if/then check for each of these six
terms. This approach uses six different variables, each with values determined according
to the direction of the motion of the fluid, with six separate checks being made for the
direction of fluid motion at every loop iteration. This method is viable, but it triples the
number of if/then checks, calls for the use of additional scalar variables, and unnecessarily
complicates our code.
A much easier technique is to carry out all the flow direction checks before any of the
arrays are computed.
loop at the beginning of the variable updating portion of the program, all the elements in
these arrays are assigned values of either O, if the flow is from the left to the right, or 1, if
the flow is from the right to the left. idnr represents the motion of fluid at the cell walls
(j -1-1/2), while jdnr represents the flow of the fluid at the cell centers (j).
The loop in
continue
jdnr(j)=l
..
We can use these integer arrays to determine the positions at which the donor-cell terms
I
are computed. By indexing our variables with j plus an appropriate value of idnr or jdnr,
I
we can rewrite the donor cell terms in the following manner:
I
81
(p~)j-lj~rho(j-l+iti(j-l))
* u(j-1)
(p~)j+lfzrho(j+idnr(j))
* u(j)
(p~~)j--~l~-rho(j-l+idnr(j-l))
* u(j-1) * sie(j-l+idnr(j-1))
(pu~)i+~f~rho(j+idnr(j))
* u(j) * sie(j+id@))
(pu)~(u(j-l)+u(j))
*.5 * u(j-l+jdnr(j-1))
(rho(j-l+jdnr(j-l)
(p~2)j+l(4j)+4.i+
l))
*.5
(rho(j+jdnr(j))
)+rho(j+jdnr(j)))
* UO+W40)
* .5
+rho(j+l+jdnr(j+
l))) * .5
The terms on the right of this table are simply computational translations of Eqs. (V-22),
(V-28), and (V-33), using a double look-up technique rather than carrying out an if/then
statement for each of the equations.
We can compute rhon(j), rhoun(j), and rhoin(j) by constructing a loop that follows
the computation of the donor-cell arrays but comes before the computation of the rho-u-sic
loop.
This loop should appear similar to the following, with the values from the above
table being used whenever one of the bold (donor-cell) terms is used.
do 200 j = 1Jbar
c ..
density
rhon(j) = rho(j) + ((dt/ti)
c ..
* ( (rho
&(rho u sie)j-~tz
+ (p(j) +q(j))
&((rho
82
continue
* ( (rho u
sie)j+l/2
* (u(j) ~(jl))))
..
momentum
rhoun(j) = (((rho(j) +rho(j+l))
200
(rhou)j+l/2))
internal energy
rhoin(j) = (rho(j) * sic(j)) ((dt/dx)
c ..
u)j1/2
U2)j+1 - (rho
U)j)
-q(j)))
To summarize, the variable updating portion of our program consists of first a donor-cell
loop; then a loop to compute the mass, momentum, and internal energy densities; and
finally a loop that changes the values of the rho, sic, u, p, and q arrays.
The return
indicates a need for specified values of rho(0) and sic(O) in addition to u(0) and u(jbar) as
in the Lagrangian case. Positions need no longer be updated because they remain fked
throughout the simulatio~ instead, the conditions must be added that sie at position O is
equal to a variable siel, and rho at position O is equal to a variable rhol. These boundary
conditions are of a different nature than those in the heat-transfer problem.
There, a
constant temperature was maintained at the wall by the recalculation of the value of T(O)
at every time step. The equation was
To = 2TL TL .
T@
(11-21)
averaging is not necessary in the present code, because the value used at the wall is
computed using the donor-cell technique. If flow is from the left to the right, as is the case
with our piston, the values sssigned to sie and rho at position j = O will effectively exist
at the rightmost wall, j = 1/2. We are now faced with the question of what values should
be assigned to the variables at these positions.
In the Eulerian case, we do not represent the piston itself but rather a shock that
is created by the motion of a piston somewhere upstream.
the equations for the fluid dynamics of shocks to determine our boundary conditions at
the left: p = ipo,
~_l
and ~ =
$Po.
and us in these equations, we can generate quantities for rhol and siel that will help
to maintain a shock wave.
procedure, completing our Eulerian code. A graphical representation of this code appears
in Figure V-4.
83
output
;
1-)
*
Boundary Conditions
XL
Y
Figure V-4
E.
shock moves in from the left. The parameters chosen for this simulation are: length = 10.0
(cm), ul = 0.5 (cm/s), ur = 0.0 (cm/s), jbar=20, rhoO = 1.0 (g/cm3), sieO= O (cm2/s2), qO
= 0.25, gamma = 5/3, and dt = 0.05 (s). Note that these parameters are precisely those
used to run the Lagrangian piston problem, with the exception of qO, which is lowered
horn 0.3 to 0.25 for the Eu.lerian simulation. Plots appear at times of 2, 4, 6, 8, and 10
seconds respectively.
84
at Time 4 (s)
n
:. .
20
za
i.!
7.>
1
10.0
Figure V-6
-w%
0
Figure V-7
85
3E
cl
lb
7.1
Figure V-8
Figure V-9
Note that the Eulerian shock is not as sharp as the Lagrangian shock, even at this
lower value of qO. This difference is due to an artificial diffusion that results as an effect
of the donor-cell technique. This effect will be discussed in Chapter VI.
Once again applying the equations of shocks [Eqs. (IV-44) and (IV-45)]
to the
parameters used in our simulation, we predict that our shock will move forward at a
speed of 0.66 (cm/s) and produce a compressed region with a density of 4 (g/m2s) . These
values verify the results presented in Figs. V-5 through V-9.
The next set of plots demonstrate the results that can be obtained by applying an
Eulerian code to the shock tube problem.
10. (cm), ul = 0.0 (cm/s),
86
rhor = 4.0
(g/cm3),
is set up such
that 0.8 of the tube is filled with the less dense fluid and 0.2 is filled with the denser
fluid. This set up is necessary to parallel the situation simulated in Chapter IV. Unlike
the Lagrangian simulation, however, no mass matching is necessary in the Eulerian case.
As was previously stated, masses of zones in an Eulerian simulation are variabl~ only the
positions of zones are constant. Figures V-10 through V-15 are graphs of density within
the shock tube system at times of O, 1, 2, 3, 4, and 5 seconds respectively.
xe
ar
1%
10.1
Figure V-10
Figure V-n
87
1 !t
~m
71
lD. B
Figure V-12
~
ml
1.5
,
7$
5.1
Un
Figure V-13
..
%
2.3
SI
71
11.1
Figure V-14
%
=.
=
v,
0.1
.25
~B
7s
lD.a
Figure V-15
a shock wave
moving to the left, a contact discontinuity between the two fluids that is also moving
to the left, and a rarefaction wave that is moving to the right. These features have the
same properties w those of the Lagrangian graph and are described by the same set of
fluid-dynamics equations.
Lagmmgian and Eulerian simulations are also subject to the same stability conditions.
At-low qO values, the Cou.rant condition is violated, as illustrated in Fig. V-16.
Figure V-16
89
.
=
I
,,.
Figure V-17
If qO is raised even higher, the d.ifksional stability condition is violated and the program
terminates.
Although the Lagrangian and Eulerian simulations share the same stability conditions,
they are quite different in the sharpness with which they resolve features at a given set of
parameters. We see this by comparing graphs of both these simulations at a time step of
2 (s) and a qO of 0.3.
i:.
Lagrangian
Figure V-18
90
In this figure, we see that the features of the Lagrangian graph are much sharper than
those of the Eulerian simulation. The difference in sharpness is particularly noticeable for
the contact discontinuity, which is clear in the Lagrangian simulation but smeared out over
several zones in the Eulerian simulation.
The smearing of features in the Eulerian case is a result of the artificial difEusion
that is intrinsic to the donor-cell technique. In order to understand why the donor-cell
technique causes difFusion in this manner, as well as to understand why the Courant
condition is present in an Eulerian simulation, we will have to make use of a method
known as truncation error analysis. This method will be discussed in Chapter VI.
91
VI.
A.
TRUNCATION
CONDITION
ERROR
ANALYSIS
AND
THE COURANT
Introduction
This chapter is unique in this book in that it is the only chapter in which we will
ERROR
ANALYSIS, which can be used to analyze the error of fin.ite-difference approximations, and
we will apply this method to determine a condition that must be met to ensure numerical
stability of our fluid-flow model.
This chapter is also unique in that it is almost exclusively based on the manipulation
of partial-ci.iflerential equations. As was the case before, the use of these equations means
that this analysis is not essential to the construction of simulations. As was stated in the
introduction, mastery of these equations is not a prerequisite to writing finite-difference
codes. This chapter does not present the reader with any additional stability conditions
or methods of representing finite-difference equations; its purpose is merely to clarifi the
ones that have already been discussed.
Although not crucial to the writing of our programs, this discussion presents a method
of analysis that is important for a person dealing with finite-difference codes. It serves to
introduce a new method for examinin g the validity of our finite-difference approximations
and determining the constraints that must be met for our equations to be numerically
stable.
We will apply this method to a number of cases, but first let us return to a previously
discussed method for determining numerical stability.
introduced in section III-B, we will address the question of the numerical stability of
the cell-centered finite-difference wave equation.
B.
Approach
(VI-1)
(W-2)
(VI-3)
. .
(eZ~(j+l)& _
2dx
eM-l)d~
(VI-6)
or
r1
ikdx _ ~ikdx
~+ae
We now defie
o.
2dx
(VI-7)
(VI-7) as:
r=l~
(ezkdx
- @kdx)
2
(VI-8)
93
r=l
iZ
Sin
(VI-9)
kdx .
(VI-1o)
This value is always greater than one, indicating that the solution will always diverge.
Hence, the cell-centered wave equation is unconditionally unstable.
C.
Truncation
Error Analysis
We will now approach the same problem of determining the numerical stability of
a wave equation that uses cell-centered differencing with another method of analysis.
Instead of using a test case, the numerical stability of our finite-dii%erenceequations will be
determine by truncation error analysis. In this method, partial differential equations are
finitd.iflerenced,
of the finitd.ifference
approximations.
A Taylor series expansion is based on Taylors theorem which states that for any
differentiable function ~(z):
where ~, f,
Zf(z)
+ ~
dx3
+ &(z)
+ ~f(z)
+ ... .
f,
etc., are the fi.rst~second) third) etc >derivatives of he iCtion
(VI--11)
= T(j A, ndt)
.
= T(j dx, (n + 1) dt)
~+1 = T ((j+
~_l
94
I)dz, ndt)
Expanding these values using a Taylor series and substituting the resulting terms into our
cell-centered wave equation, Eq. (VI-4), gives us
T~+dt~+$~Ty
+
dt
(
TJn+dx~+$~
T;dx~+$~
)(
2dx
(VI-12)
= o.
In this equation, all terms of order dx3 or higher have been ignored. This equation can be
reduced to
~T
dt ~2T
t3T
.
2 aP aax=o
K+
(VI-13)
or
t3T
z
We will ignore our $ ~
8T
dt i72T
(VI-14]
a%=Yw
(VI-15)
Differentiating this equation with respect to time gives
i32T
82T
~
= a/jzat + O(dt) ,
(VI-16)
~2T
+ O(dt) .
= ap
Zz
We can now use the value for &
(VI-17)
~ =aam
+o(~d
1+O(w
82T
82T
(VI-18)
or
82T
z t32T
~
= a
(jz2 + O(dt) ,
(VI-19)
95
term, we see that we are left with a wave equation that includes a
and we ignore our 0(dt2) term and the propagation term (a%),
we have
(VI-21)
dt
dzz
(VI-22)
z dt
1+2a
(VI-23)
. From this expression we see that r will always be greater than 1, indicating the
unconditional instability of the centered approach. The error in this type of finite-difference
approximation causes a negative diffusion that causes the system to become numerically
uust able.
D.
Technique
Now let us apply this same form of analysis to a wave equation that is difference
using the donor-cell technique. Consider a flow that moves from the left to the right, where
a>O,
(VI-24)
.
then
96
Tj_l/2 = Tj_l
(VI-25)
Tj+l/2 = Tj .
(VI-26)
_ g
T? Ty_l
dt
dx
(VI-27)
Expanding this equation using a Taylor series up to the second order terms yields
T;+dt~+$$
T?
+
dt
T?
a
T? dx~
(VI-28)
+ $@
= o,
dx
dx (92T = o
.
dxs
(VI-29)
Analysis similar to that of of Eqs. (VI-15) through (VI-18) gives the expression
82T = az d2T
~
+ O(dz) + O(dt) .
~
(VI-30)
I
ia2dt
1
+ ~adx
(
By dropping our a%,
difkion
0(dt2),
d2T
~
+ 0(dt2) + O(dzdt) .
and O(dtdz)
(VI-31)
equation where
7
(VI-32)
but this equation assumes that a is greater than zero; a more general 0 is
CT=
~laldx ~a2dt
.
(VI-33)
(VI-34)
97
or
-4.:
<o;
(VI-35)
(VI-36)
(VI-37)
or
(VI-38)
This equation is simply a statement of the Courant condition,
(IV-36)
We see then that an Eulerian calculation that uses the donor-cell technique has the same
Co-&ant stability condition found in Lagrangian codes.
E.
difference approximation of the wave equation, we have shown that this approximation
represents not only the motion of a wave but a form of difhsion.
the conduction coefficient of th~ artificial diffusion is negative, indicating a system that is
unconditionally unstable. This coefficient is
0 =
~a2dt .
.
(VT-39)
This instability can be avoided by using a donor-cell method, which yields a diffusion
coefficient
o = ~a2dt + ~ la]dz .
98
(VI-40)
This method remains stable as long as the Courant condition is satisfied. This method is
flawed, however; for when we choose a case in which dt is very small compared to dz, o
becomes large, creating a large amount of artificial diffusion in the simulation. While this
diffusion does not create a numerical instability, it results in a less accurate simulation,
causing sharp boundary layers to become smooth.
In our simulations we will not attempt to avoid this lack of accuracy, but several
methods exist that avoid this problem.
ARTIFICIAL
VISCOSITY
additional diffusional term added to counteract the negative difFusionintrinsic to the finite
difference approximations.
the form
i3T
ZJT
x ax=
1
t12T
82T
~a2dt
~z2 + Va
.
&2
(W-41)
Va>
()2
a2dt ,
(VI-42)
the numerical stability of the system can be maintained while increasing the accuracy of
solutions. This method of improving finite-difference codes is a direct result of truncation
error analysis.
Thmcation
approximations,
describe methods by which the accuracy of solutions can be improved. Although it does
not have a major effect on the codes that we are miting in this series of exercises, it helps
to explain some of the reasoning that lies behind these programs. A versatile and powerful
tool, truncation error analysis is essential to the ~erson who wishes to examine the basic
foundations on which finite-difference codes are based.
99
VII.
A.
TWO-DIMENSIONAL
INCOMPRESSIBLE
FLUID FLOW
Calculations in Two-Dimensions
Up to this point in this series of exercises, all problems have been one-dimensional.,
thus simplifying our simulations in a number of ways: their equations had only to take into
account changes in a single direction, their boundary conditions have existed at only two
points, and their arrays of variable values have been of a small, one-dimensional sort. For
the systems that we have been dealing with up to this point, a one-dimensional approach
has allowed us to simpli& our problems while still generating results that were accurate.
However, few problems can be represented in a single dimension. Our one-dimensional
models assumed both cylindrical symmetry and radial uniformity, two qualities that are
rarely found in the same system. Many more systems can be represented by using twodimensional models. These models can represent any system that has uniformity in a single
dimension, including the azimuthal direction used in cylindrically symmetric situations.
The type of two-dimensional code that assumes cylindrical symmetry employs an r-z
set of coordinates.
r represents the distance of a cell center from the axis of the cylinder, and z represents
the position of a cell center along that axis. The higher the r, the farther away from the
center of the cytinder; the higher the z, the farther down along it.
A second sort of two-dimensional
in one
direction. While changes between cells in such a code may take place in two directions, all
quantities are assumed to be invariant in the third direction. It is this type of simulation
that we will examine in this chapter.
In this sort of code, an i-j set of cell counters are employed, with z representing the cell
number in the horizontal direction and j representing cell number in the vertical direction.
The resulting two-dimensional mray of zones, also known as a MESH, is made up of i x j
individual rectangles of length CZZand height dy. This mesh appears in Fig. VII-1.
100
.
.
.
3
2
dy
I
I
Notice that each cell is referenced by two numbers: i and j. The position of cell quantities
will now be referenced by two subscripts instead of one: [Quantity] ~,j. Notice also that
there are now four one-dimensional arrays of fictitious zones: (i, O), (i, ~ + 1), (O,j), and
(~+ 1, j). These are needed to represent the two-dimensional boundary conditions.
101
We will be using this mesh to simulate incompressible fluid flow in two dimensions.
Our simulations will be Eulerian, allowing for a mesh of rectangles with fixed positions.
Three main variables will be used, as shown in the following table:
P~j = p(i, j) = pressure per unit density
4+1/2,3 . = u(i, j)
horizontal velocity
= V(i, j)
vertical velocity
4j+l/2
Note that pressure per unit density is represented at the cell centers, horizontal velocity at
the right and left walls of the cells, and vertical velocity at the top and bottom cell walls.
A mesh in which variables are configured in this manner is known as a STAGGERED
MESH.
1/2 , j
Figure VII-2
Internal energy, density, and artificial (viscous) pressure arrays are not needed since
the flow is incompressible; and therefore there are no changes in density, no changes in
102
energy due to pdV work, and no shocks that would require an artificial viscosity. Velocity
in two directions and pressure per unit density are the only variables that are needed in
the equations that describe two-dimensional incompressible fluid flow.
B.
(VII-1)
The total amount of mass moving across a boundary in a given time step is equal to the
msss flux multiplied by the area of the boundary multiplied by the time step:
AMass=FluxAdt.
(VII-2)
Applying this equation along with Eq. (VII-1) to a cell in the mesh gives the following
expressions for changes in mass due to flux across the left, right, bottom,
walls:
A MaSSleR = pui-~/s,jwdydt
(VII-3)
A M~sright = _pui+l/z,~ W d~ dt
A Massbottom
pvi,j-1/2w
dx dt
A MasstOP=
/%,j+l/2w
dz
(VII-4)
(VII-5)
(VII-6)
dt .
In these equations, p is the constant value for the density of the fluid and W is the width
of a cell, its thickness in the third dimension. The change in mass is negative in Eqs. (VII4) and (VII-6) because they represent mass being carried out of the cell by rightward
velocities through the right cell wall and upward velocities through the top.
Mass conservation tells us that the total change in mass is equal to the sum of the
masses that are fluxed across each of the boundaries:
A MasstOtal= A MasS~ght + A MassM + A MasstOP+ A Massbottom
(VII-7)
103
For the incompressible Eulerian case, the total mass of a cell remains constant. Therefore,
(VII-8)
A MasstOt&l= O .
A M=sright + A hkSSM.
+ A Mast.oP + A
M~bottom
O ;
(VII-9)
PW [ui+l/2,j@+ ui-~/2,jdy
ui,j+l/2~
vi,j-1/2dx]
O >
(w-lo)
which reduces to
dy
(ui+l/2,j
.)+
%-I/z3
dx (ViJ+I/2
- vi,j-1/2)
= o
(VII-11)
or
ui+l/2,j
il/2,j
dz
i,jl/2
vijj+l/2
dy
o.
(VII-12)
in an incompressible system, one of the two major equations that will be used in our code.
It is closely related to the Eulerian onedimensional
ap ap
~+~=o.
(v-37)
ap apu
Y&+~+
which, assuming a constant p, becomes
apv = o
ay
~+av =, o
ax ay
which
104
(VII-13)
(VII-14)
The second major equation that isused to simulate incompressible fluid flow is the
momentum equation. In a two-dimensional system, this equation becomes two equations,
one representing vertical momentum and one representing horizontal momentum. Each of
these equations is solved over a momentum cell that is staggered such that its center exists
where a velocity is directly represented. Two such momentum cells appear in Fig. VII-3.
j+l
vertical
momentum cell
{
~
()
%
()
~
()
, an
105
appear in the two-dimensional equation but with several changes made to the advective
and pressure contributions.
Advective flux of momentum in two dimensions occurs in much the same manner
as advective flux of mass.
momentum can be carried: the left, right, top, and bottom cell walls. Just as mass flux
in Eq. (VII-1) was density times velocity, momentum flux across each of the surfaces in
the momentum cell is momentum density (fluid velocity x mass density) multiplied by
carrying velocity:
(VII-15)
(@.1~
i +
1/2, j +1/2
1
(pU2)i+13
(PU2) i, j
i+l
..
106
As was the case with mass flux, the total amount of momentum moving across a
boundary in a given time step due to advective flux is equal to the momentum flux
multiplied by the area of the boundary multiplied by the time step:
(VII-16)
A MomentumAd. = FhwAdVA dt .
Using this equation to determine the change in the momentum of a cell i + 1/2, j due to
the fluxes shown in Fig. VII-4, we obtain
A Mom6?MnnAdvl.ft
= ~uf,j
(VII-17)
W dy dt
A MomentumAdvri~~,= P@+l, j W dy dt
A kfOLIM31tUInAdvb.tt.m = P(UV)i+l/2,j-I/2
(VII-18)
(VII-19)
W dx dt
A MomentumAdvtOP= P(UV)Z+l/2,j+1/2W
(VII-20)
dx dt .
These four equations can be combined to form an equation for the total change in
momentum due to advection:
A MornentumAd.t.t.]
= W dt@/
((p~2)i,j
(PU2)i+l,j)
(VII-21)
d dz
+ W
((~~~)i+l/2,j-l/2
(PUV)i+I/2,~+1/2)
.
Dividing both sides by the volume of a cell (W dx dy) to generate an expression in terms
of moment urn density, we obtain
@uadv
(pu2)i,j
= dt
[
(pu2)i+l,j
(Puv)i+l/2,j+l/2
+ (Puv)i+l/2,j-l/2
dx
dy
(VII-22)
or
Apuadv=
dt
(pu2)z+l,j
(Pu2)i,j
dx
(Puv)i+l/2,j+l/2
(Wv)i+l/2,j-l/2
..
dy
(~~-z.3)
apu
()
z
8pu2
=
ax
adv
qx.w
.
ay
(VII-24)
107
In the two-dimensional momentum equation for the horizontal direction, the term
that is analogous to the advective term in Eq. (V-38) (~)
[( PU2) i+l,j
(Pu2)iJ]
[ (P@i+l/2,j+l/2
dz
is
(Puw+l/2,j-l/2]
-IL
or
(5&
apuu
ax
t$l
The pressure term of Eq. (V-38) is written for two-dimensional incompressible flow
by first separating it into two components:
(VH-25)
The effect of the real pressure (p) on momentum in the x-direction in two dimensions is the
same as in one dimension; this term remains in the same form. The viscous pressure term
in two dimensions, however, is rewritten in terms of a true viscosity. This true viscosity
paralIels artificial viscous pressure in a manner that can be seen by dividing the viscous
pressure equation into two terms:
@lx + @y
~
K
These terms can be rewitten
q; = qo p; c
U7+2
u7+l/2
or if negative
if positive
(IV-24)
q~=()
or
!?X = qo pcdx
()
:d;
ul
(VII-26)
(lx =
108
q. pcdx$
(VII-27)
==-+(03
)
(VII-28)
%=-%(03
-
(VII-29)
-G+%)~
where v is a constant known as the KINEMATIC
VISCOSITY.
constant is used rather than the qoc dx and qoc dy values in Eq. (VII-31) is to represent
the rate of difIusion of momentum in the fluid in an ISOTROPIC
The
constant v in this equation is the simplest manner for representing the physical phenomena
of viscosity, which parallels the concept of thermometric conductivityy used in our equations
of heat transfer. Both these equations appear as a coefficient times a second derivative:
and
109
preserve the isotropy of the difhsion terms while reconciling the disparity between the
q equation and the difhsive terms. These methods are beyond the scope of this work,
however, and have never been fully successful. Therefore we will use a constant v.
Now that terms for advective flux and pressure (now pressure plus difEusion) have
been determined, a two-dimensional equation for Eulerian change in momentum in the
x-direction can be written
apu
(VII-32)
ap
+=(%+9=0
ax
ay
(VII-33)
(VII-34)
where .P is equal to p/p. Similarly, the equation for change in momentum in the y-direction
is
a)
Z+K
au
+ w
~=
aP
ay
--+(=+2)
(VII-35)
~
These two equations, along with the mass equation, Eq. (VII-14) [in finite-diilerence form
Eq. (VII-12)] make up yet another form of the Navier-Stokes Equations and form our
mathematical model of two-dimensional Eulerian incompressible fluid flow.
C.
Solving Two-Dimensional
Fluid-Flow Equations
To solve the equations of two-dimensional incompressible fluid flow, we will make use
of a method that combines both explicit and implicit solving techniques. This method is
used because of a stability condition that is present in the pressure term in the momentum
equation.
110
This stability condition can be explained by examining the general equation for sound
speed.
For an ADIABATIC
C=$.
(VU-36)
(VII-37)
()
1 ap
C2ap
=
.
pax
p ax
(VII-38)
= O. But, pressure
dx
(VII-39)
indicating that our system will be unstable if pressures are computed explicitly.
Our one-dimensional fluid simulations have shown, however, that the advective terms
of the momentum equation can be solved explicitly without becoming unstable, and the
viscous terms are limited only by the difFusional stability condition
udt
G
5
vdt
1
@
5
(VII-40)
(VII-41)
This calculation is done by fist grouping together the advective and viscous terms of
the momentum equations. Equations (VII-34) and (VII-35) become
L3U2
(---%+%=))-=
(----+ (2+3)-%
au
z=
au
a
%=
tw
%++1}2,3 = 4+1/2,3
= v:j+l/2
.+dt
+
(VII-43)
dy
8X
n+l
%,j+l/2
(VII-42)
ax
and ~,
we obtain
(---%+v(~+wd~m-M)
&42
ax
avz
8UV
dt
(
ax
---z+
v(s+w-d%
W1-45)
-~-~+v(g+%))
~n+- 1
#1
t,j+l/2
V~j+~/2 + dt
(
8UV
&J2
ax
( ---W+G+W
These terms represent the horizontal and vertical velocities at the next time step, barring
any contribution made by pressure. They allow us to rewrite our momentum equations as
In finitdifference
%++1;2,3 = w+l/2,3
ui+3/2,j
i+l,j+l/2
(
~n+l
i,~+l/2
~n+ 1
iJ+l/2
._d~[(u~+l~~u~,jJ+
~ i
(VII-46)
-dt~
-
dt~.
(VII-47)
((uvli+l/2,j+l/2~(uV)i+l/2,j-l/2J
. zUi+~/2,j
1/2,3
dx2
= V~j+l/2
-n+l
= i+l/2,j
-n+ 1
2,j+l/2
Un+l
z+l/2J
dt
_ ~
ui+l/2,j-l-l
[(
+ i-l,j+l/2
&2
zui+l/2,j
dyz
(uv)i+l/2,j+l/2
+ i+l/2,j-l
(u4i-l/2,j+l/2
)1
(VII%I)
)+~v~j+~~v?,j)
dz
2vi,j+l/2
_ ~
)(
.~,j+3/2
+ U,j-l/2
dy2
2vi,j+l/2
)1
(WI-49)
112
In these equations the advective terms can again be calculated using either a donorcell or cell-centered technique. In this case, a cell-centered approach is allowable because
the viscous term prevents numerical instability in a manner described in Chapter VI. This
approach results in a code that is able to resolve delicate physical phenomena that occur
at low viscosities.
The KARMAN
phenomenon.
VORTEX
STREET,
flows in from the top and bottom thirds of the left wall and out through the entire right
wall. At low viscosities, this system will form a fluctuating stream called a vortex street.
This phenomenon will be discussed in more detail later in this chapter.
Use of the donor-cell technique results in a code that is able to handle more violent
phenomena, such as the rushing of fluid over a stationary block.
at higher velocities and with more change in velocity to be simulated without becoming
numerically unstable but loses much of the precision of the cell-centered technique. Because
the Karman vortex street will not evolve with this imprecision, the cell-centered technique
is used in the examples in this chapter.
n+ 1
i+l/2,j
(VII-50)
=
J/2j-(p2~p:;p);)
n+ 1
v.z,j+l/2
= v2,j+l/2
n+
(VII-51)
-d(pr;:~p:;l
113
tozeroti
equation. This
convergence is achieved by defining a quantity Di,j such that it is the d.ifIerence between
the momentum equation and its desired value of zero:
Dz,j s
%+1/2,3
U~-1/2,j
dz
VZ,j+l/2
vi, j
1/2
dy
Because ii and 0 are calculated before any implicit calculations are done, they do not
change
during
are therefore functions only of pressures, as shown in Eqs. (VII-46) and (VII-47). Newtons
method [Eq. (III-24)] can therefore be applied to the solution of the pressures with D(P)
replacing ~(z).
(VII-52)
(%)i,j
is computed using the chain ruIe, which says that for a function
y =
F(a(z),
b(x)c(z) . ..)
(VII-53)
()
*
8Da,j
i,j
~ui+l/2,j
~Di,j
aui-1/2,j
6Ua+~/2,j
8Pi,j
8ZLi-1/2,j
t3Di,j
6bi,j+1/2
t3Di,j
aVt,j+l/2
api,j
aPi,j
(VII-54)
avi,j_112
+ &l~,j_~/2
aP~,j
These partial-differential terms can be rewitten using Eqs. (VII-50) and (VII-51) and our
definition of D:
(%)ij=+(:)+(-+)
(-3)+
(VII-55)
which reduces to
(VII-56)
%)i,j=2d(&++)
114
where
1
D=
2dt ~++
(VII-58)
Through the use of this equation along with the ii and z equations [Eqs. (VII48) and (VII-49)], two-dimensional incompressible Eulerian fluid flow can be accurately
represented.
These equations make up a method that uses both explicit and implicit
Computational
Implementation
of Equations
incrementations, boundary conditions, variable updating, and output; but the interaction
of these sections is slightly different from that of previous codes.
Our twd.imensional
Start
Setup
= Initial B.C.
*
Tests
End
a
Implicit
Outflow B.0.
Dmaxc Dw
Figure VII-5
115
Notice that in this figure, three difFerent types of boundary conditions appear, along with
an explicit/implicit
solver. Each of these will be discussed, but first let us examine the
setup routine.
This procedure includes the same time variables present in our previous finitedifference codes (dt, pt, etc.) and the following additional variables:
ibar and jbar the number of interior zones in the x- and y-directions
xlen and ylen lengths in the x and y-directions
dxanddy
p=
2dt(*+*
ur, ul the fluid velocities normal to the right and left walls
vt, vb the fluid velocities normal to the top and bottom walls
Dtest the accuracy to which D ~J should converge
In certain cases, output maybe required at regular intervals beginning after a certain time.
(Every 10 seconds after 100 seconds have elapsed, for example.)
To do this, an optional
variable btime can be used to represent the time that the program should begin to call
the output procedure. The check for output would then become an and statement that
check both for pt ~ ptime and st z btime.
The setup procedure assigns all read in constants and calculate dx, dy, and beta.
Velocities and pressures should be set to their initial values. Dtest has the dimensions of
s-1, a velocity divided by a distance, and should be assigned a value of a characteristic
velocity of the system multiplied by a value between 1/100 and 1/1000 and divided by a
length of a cell. For example, for a system where the major inflow of fluid was from the
left, 0.005 * ul/dx would be a reasonable value to assign to Dtest.
116
Optionally, a perturbation can be added to the initialization routine, which allows for
turbulent phenomena such as the Karman vortex street to develop more rapidly in our
simulations,
a point somewhere near the center of the mesh: z = ;/3, j = ~/2, for example.
In this
%+1/2,3 . =
perturb
(VII-59)
(VII-60)
vi+l,j+l/z = perturb
%+1/2,3+1
i,j+l/2
perturb
= perturb
(VII-61)
,
(VII-62)
major inflow of fluid is at the left wall, perturb could be equal to ul.
Flow velocities at the cell wall must be assigned so that the amount of inward flow is
equal to the outward flow. That is
(VII-63)
or
dyEuOUt+ dxZvOUt= dyEuin + dx~vin ,
where ZuOUt and I&t
(VII-64)
are the sums of the velocities of all outward flowing zones and
Xui. and ~~i~ are the sums of the velocities of all inward flowing zones. This constraint
is necessary to ensure the conservation of mass in an incompressible system and must be
applied according to the system that one wishes to represent. For example, if velocities at
the top and bottom are set to zero, inflow of fluid is from the bottom and top thirds of
the left wall, and outflow occurs all along the left wall, ur would be equal to ~ul.
These velocities are assigned at the wall in an initial boundary condition procedure
that is called only once during the program. This procedure assigns the ur value to the
117
appropriate zones in the u(Oj) array, ul to the u (ibar,O) array, vb to v(i,O), and vt to
the v(i~bar) array. In the Karman vortex street problem, for example, ur, vt, and vb are
assigned to all the elements of their respective arrays, and ul is assigned over the range
u(O,1) to u(O,jbar/3) and u(O,jbar- (jbar/3))
~+lto~~l.
Notethatavalue~
of the system in cases when ~ is not divisible by three. The initial boundary need not
assign pressures for the ghost zones, however, as the pressure values in the ghost zones are
never used.
The initial boundary condition routine that sets flow velocities in and out of the
system is contrasted with the tangential boundary condition routine, which is called at
the beginning of each time cycle. This routine sets the flow velocities in the ghost zones
that run parallel to the walls of the system: v at the left and right, and u at the top
and bottom.
METHOD,
which
assumes that fluid running parallel to the walls experiences no friction with that surface.
This sort of boundary condition is used in situations where the layer of fluid that is affected
by friction with the wall is much smaller than a cell. In these cases the effect of friction is
negligible, allowing it to be approximated through the use of tangential velocities outside
the wails equal to the tangential velocities inside the walls. This condition is expressed in
the foIIowing equations:
?l(z,
o)= u(i, 1)
(VII-65)
(VII-66)
(VII-67)
(VII-68)
which make up the tangential boundary condition routine that must be computed every
time cycle.
118
There is also a third type of boundary condition procedure, the outflow boundary
condition routine. This routine is called at every implicit iteration to update the velocities
at any wall at which outflow occurs.
accurately represent the outflow velocities of the system, while maintaining the balance
between inward and outward flow as shown in Eq. (VII-64).
In order to accurately represent the physical system, the outward flow at a given cell
wall must be proportional to the outward flow before that wall. That is
outZ+l/2,
Uoutl/2,j
vouti,j+l/2
vout~,l/2
while
also maintaining
Eq.
(VII-64).
By specializing to the case where there is no inward or outward flow at the top and
bottom walls, Eq. (VII-64) can be written as
YEuZ-l-l/2,j = dyEul/2,j
(VII-69)
or
7+l/2,j
= ZU~/2,j
(VII-70)
= A ui~/2,j
(WI-71)
where A is a constant.
Substituting this equation into Eq. (VII-70) we obtain
.
A Eu~_l/2,j = ~u~l~,j
(VII-72)
or
A=
~U1/2,j
(VK73)
ZU~-J,/z,j
119
Wethensubstitute
%-1/2,3
=u-/,j(S:tt,j)
(VII-74)
This equation is applied to the array of right fictitious zones at every implicit iteration. It
describes the outward boundary conditions for the Karman vortex street problem.
Returning to the question of solving our equations using a partially-implicit method,
we see that the code that must be written has been described to a large extent. The variable
updating portion of the program is divided up into two sections: an explicit routine that
computes ii and D, and an implicit routine that computes pressures and horizontal and
vertical velocities.
The explicit routine is simply a double loop that computes ii and ~ values for all cell
edges except for those at the boundaries of the system z and z are calculated only once
each time step, using Eqs. (VII-48) and (VII-49).
The implicit routine is similar to the solver used in Chapter III. This section consists
of a loop that iterates until the values of D have converged to within Dtest.
At
the
beginning of each iteration, a variable Dmuz is assigned a value of zero. The program
then moves into a double loop that calculates Dz,j for every point within the mesh and
stores the largest absolute value for Di,j as Dmax.
Eq. (VII-57), velocities are updated, and outflow boundary conditions are implemented.
A test is then made between Dmax
program moves to the next time step; if D has not yet converged, the loop iterates. This
implicit loop should not be repeated more than about 100 times.
coding of this loop is the following:
times = o
100
Dmax = O
do 200 i = 1, ibar
do 200 j = 1, jbar
D(i, j) = (u(i, j)-u(i-1, j))/dx
if (abs(D(i, j)).gt.Dmax)
200
continue
c.. compute Ps
do 300 i = 1, ibar
do 300 j = 1, jbar
P(i, j) = P(i, j) - (beta*D(i, j))
300
continue
j)-p(i+l,
j))
continue
do 400 i = 1, ibar
do 400 j = 1, jbar-1
v(i, j) = vbar(i, j) + (dt/dy)*(P(i,
400
j)-P(i, j+l))
continue
times =
times + 1
continue
do 600 j=l, jbar
u(ibar, j) = u(ibar-1, j)*(2./3.)*(jbar*u.l/totd)
121
600
continue
if ((Dmax.lt.Dtest) .or. (times. gt.100)) goto 1000
goto 100
1000 return
end
The program should contain an output routine that represents the system in a way that
is meaningful to the user. One useful output technique is the plotting of STREAMLINES,
lines that indicate the path along which the fluid is flowing.
Consider the
following case:
dy
(volt)
(ijj)
__
dx
(udt)
Figure VII-6
In this diagram, d~ represents the displacement of the fluid at a point i,j over a time cit.
This vector is made up of two components, dx and dy. The values of dx and C@ me the
horizontal and vertical velocities multiplied by the time step:
122
dz=udt
(VII-75)
dy=vdt.
(VII-76)
A function @(z, y) can be defined such that it is constant along the motion of the
fluid. Along u%, then,
(VII-77)
d@=O.
Returning to the mathematical identity expressed in Eq. (VII-53), we see that
d+=
~dx
+ $dy
(VII-78)
Substituting values from Eqs. (VII-75), (VII-76), and (VII-77) this equation becomes
0=::udt+ ~vdt
(VII-79)
or
8+
u+~v.
0-::
To solve this equation for ~
and ~,
8+
ax
(VII-80)
Av
(V-H-81)
and
(VII-82)
+ B(?.w) = O
(VII-83)
or
A=B.
(VII-84)
(VII-86)
123
:(%)+8(-%)=0
a%)
a2~
axag
=
axay
(VII-87)
(VII-88)
This equation indicates that if either of Eqs. (VII-85) or (VII-86) is used to compute @
over a system that satisfies the Eulerian mass equation, the other one will be automatically
satisfied. Values of +, as described by either Eq. (VII-85) or Eq. (VII-86), are constant
along the direction of fluid flow. A contour plot of the two-dimensional array of ~s will
therefore indicate the shape of the flow in the system. This array is numerically calculated
by using @ values that exist at the cell corners:
psi(i
j) =
lJi+l/2,j+l/2
(VII-89)
streamline, psis along this boundary can all be set to a constant, O for example. The rest
of the psi array cm be calculated using the finite-difference approximation of Eq. (VII-86),
nfiely
!J<+l/2,j+l/2
$2+1/2,j-l/2
= ~i+1,2,j
(VII-90)
dy
or
@i+l/z,j+l/Q
= @i+l/z,j-l/z
+ dyui+ljz,j
(VII-91)
+ dy * u(ij) .
(VII-92)
Lines of constant psi can be plotted by using a contour plot routine, which will result
in graphs that indicate the motion of the fluid at . any given time step. These graphs use
the reference frame where the obstacle is stationary but can be placed in the reference
frame of the fluid by calculating psi as
psi(i,j) = psi(i,j-1) + dy * (u(i,j) -ur) .
124
(VII-93)
Contour plots of@ in both reference frames appear in the results portion of this chapter.
The output procedure is the last section that must be written in our incompressible
two-dimensional Eu.lerianfluid-flow code. This code is structured as was shown in Fig. VII5. A version of this code that includes streamlines can be used to examine the Karman
vortex street problem, generating results such as appear below.
E.
code.
By varying the dimensions of the object, the speed of the flow, and the viscosity
The Reynolds
number is a dimensionless quantity that measures the ratio of advective effects to viscous
effects in a system. For the Karman Vortex Street problem, it is calculated as
Re =
hOb~uw
)
u
(VII-94)
where hob~is the height of the obstacle, v is the viscosity of the fluid, and u is the velocity
of the fluid at a point far away from the obstacle. In our case
(VII-95)
?.&=ur.
As the Reynolds number increases, the system is likely to become more and more turbulent.
At low Reynolds numbers (numbers lower than about 4), the flow is steady and exhibits
no flow separation. This behavior can be seen in Fig. VII-7 which is taken at a time of 25
(s) using the following parameters: xlen = 50 (cm), ylen 15 (cm), ibar= 50, jbar = 30, anu
= 1.25 (cm2/s), UI = 1.5 (cm/s), dt = 0.1 (s), and PO, uO, and VOare all O. The object
is 5 (cm) wide, taking up the middle third of the left wall. Thk system has a Reynolds
number of 4.
125
/2
Streamlines at time 25
Reynolds Number = 4
Figure VII-7
Note that in this simulation dx is not equal to dy; this inequality demonstrates the fact
that these quantities need not be equal for accurate results to be obtained.
At slightly higher Reynolds numbers (numbers above 4 to about 40), a pair of
VORTICES
with the main flow, but rather circling behind the object. At these Reynolds numbers, the
direction of the flow in some areas behind the object is opposite to that of the main flow
stream. A flow containing vortices is illustrated in Fig. VII-8, which is generated using the
same parameters as Fig. WI-7 except for anu which is 0.2 (cm/s2).
Streamlines at time 25
Reynolds Number =25
Figure VII-8
126
At Reynolds numbers between 40-500, the vortices become larger and begin to move
away from the object as is illustrated in Fig. VII-9 (anu = 0.02; all other parameters are
the same as in the previous graph).
Streamlines at time 25
Reynolds Number = 250
Figure VII-9
Notice that in this graph, the vortices are asymmetric.
initiated by the presence of miniature flaws in the fluid. Numerically, this asymmetry is
a consequence of the perturbation that was added in the setup procedure.
- The vortices move away from the object one at a time in an alternating fashion,
creating a fluctuating stream, the Karman vortex street. Figure VII-10 shows the same
system as Fig. VII-9 but at a later time, when the Karman vortex street has has time to
develop.
Streamlines at time 50
Reynolds Number = 250
Figure VII-10
127
Note that the vortices that are shed from the object move downstream to the right with
the main fluid flow, and cannot be seen in this graph.
Figure VII-11 shows a fully developed street at a time of 100 (s). Other parameters are
the same as in the previous graphs, except for jbar,
to
demonstrate that the vortex street can be simulated at relatively coarse resolutions.
Streamlines at time100
Reynolds Number = 250
Figure VII-11
. The vortex street can be better seen by placing the streamlines in the reference frame
of the fluid, as if the object were moving
and
the kid
were stationary.
Streamlines at time100
Reynolds Number = 250
ur~f= 1.0 (fluidreferenceframe)
Figure VII-12
128
This approach
The fluctuations in the Karman vortex street occur at regular periods, as can be seen
in the next series of graphs, obtained using the same parameters as the previous graph.
Graphs appear in the reference fiarne of the object (u,,f = O.).
Streamlines at time100
Reynolds Number = 250
Figure
VII-13
Figure
VII-14
Figure VII-15
Figure
VII-16
VII-17
129
Analysis of these graphs indicates that the stream is fluctuating with a period of roughly
15 seconds.
We can use this period to calculate the STROUHAL
period of the stream to the size of the object and the rate of the flow.
The Strouhal
7
?.-&TStre&,
(VII-96)
where hOb~is the height of the obstacle, Um is the velocity of the fluid at a point far away
(in our case u,), and T.treet is the period of one oscillation.
Experimentally, the Strouhal number in a Karman vortex street has been observed to
be about 0.20. For our computational system, we calculate a Strouhal number of about
0.33. This difference in values can be explained by examining the differences between the
laboratory experiments and our computational system.
In the laboratory, the Strouhal number is calculated by sending flow over a cylinder,
whereas the computational results are obtained by blocking off the flow in a portion of
a boundary.
object
These two methods d.ifEerin that the fluid flow around the computational
moves parallel to the main flow, whereas the fluid flow around the laboratory
cylinder moves outwards around the cylinder, spreading out before finally becoming parallel
to the main fluid flow. Consequently, the object simulated computationally
with a smaller experimental object. This effect is illustrated in Fig. VII-18.
<Q
Experim~ntal
Cylinder
I
I
.
Computational
Object
Figure VII-18
130
corresponds
Our experimental Strouhal number is then smaller than the number calculated
numerically. Assuming a ratio of about 2:3 between our real and computational objects,
our computational Strouhal number would then relate to a experimental number of about
0.22, a value consistent with observed data.
At very high Reynolds numbers (above about 500), miniature turbulent fluctuations
occur within the vortex street and begin to drown out the fluctuating stream itself. Our
computational results seem to simulate this case (anu = 0.005):
What we are actually observing in this graph, however, is not the turbulent fluctuations
that drown out the vortex street, but rather a numerical instability that results horn a
violation of the diffusional stability condition.
which it no longer counteracts the negative diffusion intrinsic to the centered difference
momentum equation, and the solution becomes full of random highs and lows.
This
instability can be seen clearly by placing the graph in the reference fhme of the fluid.
131
Streamlines at time100
Reynolds Number = 1000
ur~f = 1.0 (fluidreferenceframe)
Figure VH-20
We have seen that the Karman vortex street can be modeled computationally
have discussed some of the theory associated with this phenomenon.
and
We have also
examined some of the inaccuracy= that can result from our numerical approximations.
In -Chapter VIII, we wiIl apply our two-dimensional fluid code to the simulation of more
complicated systems, examining the modeling of obstacles placed within the flow passage
itself and the simulation of heat flow.
132
VIII.
A.
ADDITIONS
TO TWO-DIMENSIONAL
FLUID CODE
OBSTACLE is present in the flow region. For our purposes, we will define an obstacle as
an object that prevents fluid from flowing through a specified region. Unlike the object
simulated by the use of boundary conditions in the Karman vortex street problem, the
obstacles that we will be examining in this section are found within the mesh and can be
placed adjacent to the walls or anywhere in the flow region.
Obstacles are simulated by creating a boundary that exists within the flow region.
For purposes of simplicity, we will limit the shape of our obstacles to be rectangles, but in
principle, obstacles can be of many difFerent shapes. A diagram of a rectangular obstacle
appears in Fig. VIII-1:
jobt
jobb
.
iobl
iobr
Figure VIII-1
133
In this figure, iobl and iobr are the i values at the left and right of the obstacle, and
jobb and jobt are the j values at the bottom and top of the obstacle. These can be chosen
to have values anywhere within the mesh, includlng adjacent to the walls.
Over the walls of the subregion described by these four values, the velocities normal
to the obstacle are set to zero, and the tangential velocities are set according to the desired
boundary conditions, for example, free slip boundary conditions.
Values me assigned in
= O
u(iobr,j) = O
100
continue
do 200 i=iobl,iobr
v(i,jobb-1)
= O
v(i,jobt) = O
200
continue
and v(i,jobb-1)
because velocities exist at the right aqd top of the cells, whereas the normal
velocities at the bottom and left of the obstacle are at the bottom and left of the cells.
If freeslip boundary conditions are desired, tangential velocities at the obstacle walls
should be set to the value of the tangential velocities of the surrounding flow.
134
The
assignments are similar to those of the wall tangential boundary conditions described in
the previous chapter. In this case
(VIII-1)
v.iobl,j+l/2 = viobll,j+l/2
and
viobr,j+l/2
= viobr+l,j+l/2
>
(VTII-2)
= %+1/2,jobb 1
Ui+l/2,jobt
= ui+l/2,jobt+l
(VIII-3)
and
>
(V-HI-4)
fk)m ~obr+~/2
h 20~~-1/2.
Tangential velocities are not set to zero at the corner of the object because they would
act as normal velocities at these points.
v(iobr,j) = v(iobr+l,j)
100
continue
do 200 i=iobl,iobr-1
u(i,jobb)
= u(i,jobb-1)
u(i,jobt) = u(ijobt+l)
200
continue
Note that in this code, the loops run horn jobb to jobt-1 and iobl to iobr-1, again due to
the use of a staggered mesh with us and vs that exist at the right and top cell walls.
With these two elements, the setting of the normal velocities to zero and the use of
free slip boundary conditions, a routine can be written that creates a rectangular obstacle
135
in any subregion of the mesh. Multiple objects can be simulated by multiple calls to the
obstacle routine, with jobbl, jobt 1, iobrl, and iobll specifying the dimensions of the first
obstacle; jobb2, jobt2, iobr2, and iob12 spec@ng
etc. These calls must be made at every implicit iteration, resulting in a two-dimensional
fluid code as illustrated in Fig. VIII-2.
Start
Setup
Initial B.C.
Teats
1
+
]Tangential B.C. I
End
r&cl+l
+
/ Obstaclen tiobbm
jobtn...)I
Figure VIII-2
This
first series of plots uses the following parameters: vclen = 40 (cm) ylen = 10 (cm), ibar =
40, jbar = 10, and U1= ur = 1.0 (cm/s).
5, iobl =11, and iobr = 15. The dimensions of the obstacle are 5 (cm) x 5 (cm), and it is
placed 10 cm down the flow passage.
136
This results in
a Reynolds number of 5.
Streamlinesat time 5
Reynolds Number = 5
Figure VIII-3
If the viscosity is reduced to 0.1, so that the Reynolds number is 50, a vortex forms
behind the object. This is illustrated in Figs. VIII-4 through VIII-6.
Streamlinesat time 5
Reynolds Number =50
Figure VIII-4
137
Streamlinesat time 10
Reynolds Number = 50
Figure VI1l.5
Streamlinesat time 15
Reynolds Number =50
.
Figure w1l-6
138
In these last three graphs, we can see the presence of a numerical instability that
occurs when fluid accelerates. A careful truncation error analysis indicates that the finite
difference approximation of the momentum equation has a negative diffusion term that
is associated with the acceleration of the fluid. When the fluid is accelerating, as is the
case when the fluid moves over the object fi-om the right, this negative diffusion results in
a numerically unstable solution. We can see this instabilityy in the jagged streamlines in
this portion of the graph. When the fluid is decelerating, as is the case as the fluid moves
away from the object into the open flow channel, there is an additional positive diffusion.
Hence, this portion of the graph remains numerically stable.
As viscosity is again lowered, the contrast between these stable and unstable regions
becomes clearer. Figure VIII-7 illustrates the results of a simulation with a viscosity of
0.02 (cm2/s)
l\!l
Y/
(7
Streamlines at time15
Reynolds Number = 250
Figure VIII-7
.
B.
Heat Transfer
The second topic in our study of additions to a two-dimensional incompressible fluid
flow code is the modeling of heat transfer. This modeling requires the addition of a new
139
array of temperatures that exists at the cell centers, and must be declared and initialized
in the setup procedure. The resulting mesh is pictured in Fig. VIII-8.
V,j+l/2
a
e
A &
vv
i+l/2,
~,j ~,j
j + 1/2
4U i+l/2,j
Figure VIII-8
The equation that describes the evolution of temperature is similar to the twodimensional
momentum
equation,
The two-dimensional
Eq. (VII-34).
temperature
equation is
677+ 8uT
z
(VIII-5)
ax
erm ((=+%))
in both directions ( %$ ) ~
) ~ ad
T+l T;j
(uT)?+l/2,~
~,~
dt+
(uT)7-1/2,j
dz
0
?+l,j
+ ?l$j
dZ2
2T~j
(vT)~j+l/2
(~T)~j-1/2
dy
+ ~
fj+l
)(
(VIII-6)
+ ~jl
@2
2Tcj
)
or
~;l
T; + dt
(uT)L1/2,j
(uT)?+l/2,j
+ (vT)$j-1/2
dz
(vT)~j+l/2
dy
(VIII-7)
Temperatures at cell walls are calculated through the use of the donor-cell method, by
creating two two-dimensional arrays: idnr and jdnr. These arrays are made up of integers
that are calculated at the cell walls. idnr is calculated from the u velocities at position
i + 1/2, j and is zero if the flow is from left to right and 1 if the flow is from right to
left. jdnr is calculated from the v velocities at position i, j + 1/2 and is zero if the flow is
upwards and 1 if the flow is downwards. These two arrays are then used in a double lookup
fas~on, as was done in Chapter V. The advective terms of Eq. (VIII-5), thus appear as
~
= (u(iJ)*T(i+idnr(i,j)j)
- u(i-l,j)*T(i-l+idnr(i-l
= (v(iJ)*T(i,j+jdnr(i,j))
- v(i&l)*T(iJ-l+jd.nr(i,j-1))
j),j))/dx
)/dy ,
Equation (VIII-7) is implemented in a double loop just before the the explicit calculation
of ii and Z. The addition of this double loop is the first major modification that must be
made to our code to simulate the transfer of heat.
The second major modification is the addition of a buoyancy term to the u equation.
This term represents the upward acceleration created by a decrease in density due to the
heating of the fluid. This upward acceleration is equal to the gravitational force on the
system multiplied by the ratio of the density of the fluid to a given reference density:
Pi,j
9,
Po
141
where ~i,j is the density at a point ~ j, p. is the base density of the fluid, and g is the gravity
of the system, defined as negative in the downward direction. On Earth g = 9.8 m/s2.
This use of a change in density creates an apparent inconsistency
between the
buoyancy term and the the rest of the terms in the vertical momentum equation.
The
au
.
8?)2
Z+ax
8P
t?2v
ay=z+v
(- axz+w
a%
-!9
) - Po
(VIII-8)
In this equation, all terms assume constant density except the buoyancy term.
approximation
problems.
This
It can be used in cases where the driving forces for velocity are the result of
small changes in density. Herej the buoyancy term is O (alp) while the effect of changing
density on the other terms in 0(dp2).
buoyancy term, the following analysis is used to express the driving force in terms of
temperature.
We begin with Eq. (IV-23):
p=(y-l)pI.
(IV-23)
and rewrite I, the internal energy, as the temperature times the specific heat, TCV, to
obtain
p = (-y
l)pc.lr
(VIII-9)
(v-m-lo)
Pressure in this equation is actually made up of two different pressures: the reference
pressure, or nominal pressure of the surroundings, and the dynamic pressure, which changes
according to the motion of the fluid. Because our pressure terms have only dealt with the
change in pressure, our p from Chapter VII was essentially p@n$ the dynamic pressure. k
Eq. (VIII-1O) p is no longer p@n but the sum of the nominal and dynamic pressures:
p=pn+pd~n
142
(VIII-11)
% ~ Pdyn
l)CVT
(7
(VIII-12)
But the nominal pressure of the system is much larger than the dynamic pressure, so we
can ignore pdyn in this equation and write
(V-III-13)
The substitution of this equation into our defiltion
(T+@T
:9=9
(VIII-14)
(T+l)&o
where To is the reference temperature of the system. Assuming that the nominal pressure
is unchanging, this equation becomes
To
(VIII-15)
:g=gT.
then
T=
6);
TO(l+
(V-III-16)
/w=
Po
By expanding the ~
imi
(V-HI-17)
1
=16+6263.
1+6
.
(VIII-18)
Ignoring the terms of second and higher order, we can use this expansion to write our
buoyancy term as
:k(%w
(VIII-19)
143
If we look at this term in conjunction with the pressure term and expand pressure to
represent both the nominal and dynamic elements we have
To maintain atmospheric equilibrium, the nominal pressure must satisfy the equation
Pn = 9POY+ c >
(VIII-20)
W+:.
Po
Pn
(VIII-21)
ay g
This g cancels with the g from the buoyancy equation, leaving
TTO
TO
aP
g
ay
where @ = & =
~
273- Our equation for ~ is then equal
to the old o modified by a buoyancy
.
term,
~bUO~= g~O~e~t g~Tdt ,
where g is negative for a downward force of gravity.
144
(VIII-23)
The third major modMcation that must be made to simulate the effect of heat in a twodimensional incompressible fluid is the implementation of thermal boundary conditions.
These conditions should be calculated once per time cycle in a procedure that is called after
the tangential boundary conditions. There are two types of thermal boundary conditions
that we will use: INSULATED and PRESCRIBED.
Insulated means that there is no heat fluxed across the wall in question. This situation
occurs when there is no temperature gradient across the wall:
Tout~ide
= ~l~ide.
(VIII-24)
Insulated boundaries are contrasted with prescribed boundary conditions, which were
used in the orwdimensional heat flow problem. For this condition the temperature gradient
across the wall is chosen such that the temperature at the wall is a constant:
Tout~ide
= 2TW=11
Ti~~ide.
(VIII-25)
Together these two boundary conditions may be used, for example, to create a system
that is insulated on three walls and a portion of the fourth one but contains a HOT SPOT
which uses prescribed boundary conditions. This system would appear as in Fig. VIII-9.
Ins
Prescribed
Ins
(ToUt= 2 Tw~ll- i )
Figure VIII-9
145
I
Each of these sections of wall is described by assigning Z&t values to the appropriate arrays
in the system. For example, a procedure that implements insulated boundary conditions
along the top wall, the sides, and the left half of the bottom wall, and implements prescribed
boundary conditions at the right half of the bottom, appears as follows:
c.. insulated sides
do 100 j =ljbar
T(O,j) = T(l,j)
T(ibar+lJ)
100
= T(ibarJ
continue
= T(i,jbar)
continue
continue
With these three major eIements: the calculation of the heat transfer equation, the
use of a buoyancy term from the Boussinesq approximation,
of insulated and prescribed temperature boundary conditions, heat transfer in a twodimensional incompressible fluid can be modeled computationally. A diagram illustrating
the interactions of these three elements appears below:
146
etup&itialize Ts)
End
output
lThermalEquationsI
e
Implicit
OutflowB.C.
D-
< Dt=t
Figure VIII-10
Co
Convection Calculations
Our two-dimensional
CONVECTION.
Natural convection
is the
circulating motion of fluid between regions of difFerent temperatures due to the difference
in the fluid density at each of these temperatures. It can be described by using the example
of an initially cold room in which a heat source is placed in one corner. The heat source
heats the air around it, consequently reducing the density of that air. The heated air then
moves upwards and across the ceiling, where it is cooled back to its original temperature.
Once again dense, the cool air moves down towards the floor as new heated air flows up
from the heat source. Finally, the dense air finds it way back to the heat source, and the
cycle is repeated. This cycle is illustrated in Fig. VIII-11.
147
heated gas
moves up
cool gas
moves
downward
Figure VIII-11
fluid experiencing natural convection. These plots use the following set of parameters: TO
= O (C) ibar = 15, jbar = 15, xlen = 3 (m), ylen = 3 (m), anu = 1 X104 (m2/s).
All
ghost zones use insulated boundary conditions except zones 17 on the bottom wall, where
the wall is set to a prescribed temperature of 100C.
148
149
Figures VIII-16 through VIII-19 are contour plots of temperature in this fluid at times
of 5, 2040, and 60 seconds. These plots illustrate the flow of heat from the hot spot.
=4)
Temperatures at time 5 (s)
Figure VIII-16
Figure VIII-19
Figure VIII-18
In a fluid in which natural convection occurs, the rate of heat flow is greater than that
of a fluid that is not in motion, because heat is not only being conducted but advected by
the circular motion of fluid. A ratio can be formed between the total heat flux in a system
and the heat flux due only to convection, such that
Nu =
Total
(VIII-26)
Conductive Flux
PROBLEM.
heated at the bottom, cooled at the top, and insulated along each side, as illustrated in
Fig. VIII-20.
cooled
insulated
insulated
heated
Figure VIII-20
Parameters are variable, such that the Nusselt number in this system can be observed
at different RAYLEIGH NUMBERS. The Rayleigh number relates the magnitudes of the
buoyancy and viscous forces in a system. In the Benard problem, the Rayleigh number is
calculated as:
~a = gh3/3AT
Vo
(VIII-27)
&
()
The equation for the computational calculation of the Nusselt number can be derived
by examining the conductive and actual heat fluxes. In this system, the conductive heat
flux is calculated by Ficks Law, expressed in terms of thermometric conductivity:
conductive flux =
a P b o (Tiot
jdg
Ttop)
(VIII-28)
where p is the density and b is the specific heat of the fluid. The actual flux of heat across
a given plane existing at a vertical position of j + 1/2 is made up of both conductive and
advective fluxes. This flux appears as
&
O i=l
Actual Flux = p b
Ti,j
5 %j+l/2Ti,j+l/2
Ti,j+l
a=l
(VIII-29)
-#=
~vi,j+-~/2Ti,j-i-l/z
i=l
)/
Nu=
(Zkt Ttop)
jdy
~Pb
.
(
Nu =
(VIII-30)
.
z
~~1i,j
i,j+l
Z i,j+l/2Ti,j+l/2
2=1
; (TbOt Ttop)
).
(VIII-31)
If we choose to compute the Nusselt number at the bottom and top of the system,
then we have no advective flux, and our equation becomes
a
Zj
NUbot = ~
~:1Tbot
Ti,l
(VIII-32)
Tbot Ttop
and
Zj
Nutop = ~
,$1
Tjj
Ttc)p
Tot Ttop
(VIII-33)
.
When both of these numbers have equal values, heat flow into the system horn the bottom
is equal to heat flow out of the system through the top, and the system has reached a
steady state.
A routine to compute Nusselt numbers can be added to the output portion of our
program. The code should be similar to the following
152
ttot = o.
btot = O.
do 100 i=2,ibar+l
ttot = ttot - (tTmp-T(iJbar+l))
btot = btot + (bTmp-T(i,2))
100
continue
run = (2*jbar*&)/(xlen*
(bTmptTmp))
tnuss = ttot*nm
bnuss = btot*nm
Using this routine, we can calculate the Nusselt number at the top and bottom in
systems with various Rayleigh numbers. The next set of graphs are of a system with the
following parameters:
sigma = 0.01 (m2/s2), anu = 0.01 (m2/s2), beta = 1/300 (l/ C), TtOP= O (C). These
parameters correspond to a Rayleigh number that is equal to the TbO~~O~x 333. At a
temperature of 1 C, the top and bottom Nusselt numbers converge to 1 ~ is shown in the
following graph
Nusselt numbers
Rayleigh number= 333
Figure VIII-21
153
41
+
-q
j
81
. .
.
q
D
Lo
U.o IA.()
m. D
41. #
S1. b
10D
ma
do
91,0
U&n
IA I
~L)ft?Cal
Nusselt numbers
Rayleigh number= 1665
Figure VIII-22
!if121!alo
.
Streamlines at time 10 (s)
Rayleigh number= 1665
Figure VIII-23
154
Figure VIII-25
Despite the presence of this instability, it is possible to use our code to calculate
Nusselt numbers at diEerent Rayleigh numbers to within a reasonable degree of accuracy.
The data from one such study appears below:
Tot
.5
1
3
4
5
10
33
67
333
1000
R-z
167
333
1000
1332
1X55
3330
10*
2 x 10*
105
3.33 x 105
Nu
1.00
1.00
1.01
1.40
2.33
3.03
3.92
5.25
7.00
8.50
If we compare these Nusselt numbers with numbers that have been generated from
numerous different experiments, we see that our computational vglues are very similar,
as can be seen in Fig. VIII-26.
&
E
2
=al
(n
u)
2
n
100
1 100
1 E+4
Rayleigh Number
Figure VIII-26
156
1E+5
1E+6
In this graph, computational Nusselt numbers are plotted as circles and are connected
with a dotted line. Experimental values appear as a solid line. Discrepancies between
computational results and experimental results are most likely due to the coarseness of the
mesh used in these simulations and the fact that our mesh is two-dimensional whereas the
laboratory flow passage exists in three dimensions.
D.
Two-Dimensional
Compressible Flow
Our last topic in this chapter of additions to a two-dimensional Eulerian code is more
an extension of previous concepts than an addition of a new element to an already existing
code. An Eulerian two-dimensional compressible code is based on the same Navier-Stokes
compressible flow equations that were used in the one-dimensional Eulerian code, but
extended to two dimensions. In the one-dimensional code the equations were
ap
apu
~+=
ax
apu + @u2
8P
at
ax z=
(v-37)
(V-58)
8pI 8puI ~
P&.L
&
8X
ax o
(v-59)
apu ~ apv
.
%+8X
ay=o
(VIII-34)
(VIII-35)
(VIII-36)
(VIII-37)
where P signifies total pressure (p + q) rather than pressure per unit density. Note that
the momentum equation becomes two equations when extended to two dimensions.
157
These equations are implemented in two dimensions much as they were in one. Six
two-dimensional
Fig. VIII-27.
v
a
sie
rho
p
q
Figure VIII-27
These arrays are initialized to their desired values in an initialization routine. This routine
also sets time counters as was done in previous programs.
Boundary conditions are set such that each wall of the system acts in one of three
ways: as a rigid wall, a specified boundary, or an outflow boundmy.
represented by setting a normal velocity of zero in all cells along the desired boundary.
Specified boundaries are created by setting the normal velocity to some specified value as
well as supplying sie and rho values for this flow. These values can be set according to the
infinit~strength shock equations,
=V+l
P
7-lp0
(rv-45)
and
u
I= 2P0,
(V-61)
set to the same values as the initial rhos and sics in the mesh, or set to some other values,
such as those present in a rarefaction wave. Outflow boundaries are created by setting
the velocities normal to a wall equal to the normal velocities directly before the wall
158
with a routine that first calculates mass density, momentum density, and internal energy
density and then uses these values to determine new values of rho, sic, u, v, p, and q. The
equations that determine the new densities are finite-difference versions of Eqs. (VIII-34)
through (VIII-37). These appear as
(P@:+l/2J
P~~~ = p~j dt
(P)$$__/2,j
(Pwl/2.j
(Pv);J+l/2
dx
dx
(P@?+@J+lp
= (Pv)~j+l/2
(Puv)?+@,j+~
(Puv)?+l@,j-~
dg
(@)~~~~/2
(VIII-38)
dy
(Pu2)~~J (Pu2)~J +
(W) !+l/2,j t
(Po&l/2
(Puv)?-@,j+W
1
+ (PV2)?+1
dz
+ Pz,j+l Pi,j + !?i,j+l Q,j
dy
dy
(VIII-39)
(PV2)YJ
dy
(pI):;l
>
= (pI);j
(Pw+l/2J
dt
(Pw-l/2J
(P@?.j+l/2
%-+1/2,3. ?J:_l/2,j
dx
(Pm&l/2
dy
dz
+ (P+ d:j
[j+l/2
v;j_l/2
,
dy
)]
1
(VIII-41)
where the bold terms are donor-cell terms., which can be calculated using either a series of
if/then checks or a doubblookup
If a doublelookup
technique.
technique is used, integer arrays of ones and zeros must be set for
horizontal flux and vertical flux at cell centers, and horizontal and vertical flux at cell
corners. These six different locations are illustrated in Fig. (VIII-28).
5
i+ 112,j+ 112
3
i,j
i+ l/2,j
Figure VIII-28
Six arrays must therefore be defined for each of the six types of advective fluxes. We
then have idnr and jdnr, which represent fluxes in the i and j directions at the cell centers
160
(1 and 2 in the previous figure); idnrw, which represent flux across the right cell wall (3);
jdnrw, which represents flux across the top of the cell (4); and idnrc and jdrnc, which
represent fluxes in the i- ad
arrays are calculated each time cycle and are used in the advective terms of the transport
equations according to the position and direction of the flux that is being represented.
After quantity densities are calculated using either a series of if/then statements or
a doubl~lookup
the appropriate density arrays divided by the mass densities, if necessary. Then p and q
are determined horn these arrays. In two dimensions the pressure equation is the same
polytropic equation of state,
P; = (Y Wp;
(IV-23)
but the q equation is modified to respond to velocities in both the i- and j-directions. The
two-dimensional q equation is
if positive
,,j=*op,jcJ-(-1+1j~+:j+1,2;tj+1,2)1,2)
or if negative
q~j=o.
(VIII-42)
Note that if dy is equal to dz and there is no vertical motion of the fluid, this equation is
identical to the one-dimensional q equation.
The output routine for a two-dimensional flow code can contain contour plots of
density, internal energy, pressure, and viscous pressure. Streamlines are rarely used in the
compressible case, however, because the divergence of the velocity is not equal to zero, and
therefore Eq (VII-88) is not valid.
The sections in this program interact in much the same way as did the sections in
.
the two-dimensional incompressible fluid code. The two-dimensional compressible code is
structured as is illustrated in Fig. VIII-29.
161
CEcl
c+
Setup
InitialB.C.
st = .Sime
E+l+lLJ,
output
Tests
pt =ptims
Outflow
Em
B.C.
Obstacle
1
2
Obstacle
Obstacle
n
Explicit
Figure VIII-29
E.
Results of Two-Dimensional
Compressible
Flow
Using our two-dimensional compressible flow code, we can model a number of different
problems.
One simple problem that can be simulated is the piston problem that was
compressible code should yield exactly the same results. Comparing these two codes is a
good method for removing
162
code.
The two-dimensional code can also extend the piston problem, such that the shock is
moving down a flow passage with an obstacle in it. The following set of plots show the
effect of an infinite strength shock moving down such a passage. Parameters are xlen= 30
I
(cm), ylen = 10 (cm), ibar = 75, jbar = 25, iobl = 21, iobr = 25, jobb = 1, jobt = 5, rhoO
= 1 (~),
sieO = O, gamma = 5/3, dt = .1(s), and u.1= 1 (cm/s); rhos and sics at the
input boundary are defined using the equations of iniinite strength shocks.
163
In this plot we see that the reflected shock has moved upwards towards the top of the
passage and leftwards towards the inlet. The shock is reflected off the top of the psssage,
and the shock and its reflection form a MACH STEM which will close off the incoming
flow, choking the channel. A Mach stem is a shock that is formed between a shock that
164
hits a wall and the resulting reflected shock. A Mach stem is always perpendicular to the
Mach stem
Figure VIII-34
The formation of a Mach stem is dependent on the angle at which the shock hits the top
of the flow passage. Experiments have found that if the shock reaches the top wall at an
angle of less than about 40 degrees, it will form a reflected shock but not a Mach stem and
will eventually reach a steady state. If the shock reaches the wall at an angle greater than
about 40 degrees; however, a Mach stem will form. In our plots we can scarcely see the
Mach stem due to the coarseness of resolution; we can, however, see its effect of choking
off the channel as is shown by the contour lines above the obstacle in the next figure.
165
A reflected shock that does not forma Mach stem can be generated by modifying our
program such that we are no longer dealing with an reflected infinite strength shock moving
over a stationary obstacle. Instead, we simulate the problem of an obstacle creating a shock
as it moves through stationary flow. This simulation is done by setting the velocities,
densities, and internal energies of the internal zones equal to the input values, as if one is
traveling in the reference frame of the obstacle.
Setting up the code in this way allows us to examine flows at high MACH NUMBERS.
The Mach number is the ratio of the velocity of a shock to the sound speed ahead of that
shock:
MEL.
~ound
The lower the Mach number, the less intense the shock.
We can create shocks at any specified Mach number by using our equation for the
sound speed,
(IV-26)
If we substitute this value into our definition of M, we obtain
=&.
(VIII-43)
1=
d
M27(7
(VIII-44)
1) .
In the infinite-strength shock problem, input Is were defined as ?@2, causing the
Mach number of the flow to have a maximum of
*Z.
however, I can be defined at any specified value, allowing for flows of any Mach number
to be exa.rnhed. For example by using Eq. (VIII-44), we can create a system with a Mach
number of 10 by speci&ng
sics are set to rhoO and sieO respectively, and initial velocities are set equal to the input
velocity at the left. These parameters correspond to the simulation of an obstacle that is
moving to the left. The results of this simulation appear in Figs. VIII-36 through VIII-41.
166
167
Note that the shock formed in front of the obstacle is more swept back than the lower
Mach number shock (see Figs. VIII-30 through VIII-32).
angle less than 40 degrees and hence does not choke the channel. Instead it is reflected off
the top wall and reaches a steady state. This reflection can be seen in the following three
plots of pressure:
168
tan(O a) =
2 + (y I)hff sin2 O
(7+ l) M&lecose
(v-III-45)
where t9is the angle of the shock, a is the angle of the wedge, and Al. is the Mach number
of incoming flow. We can create a wedge of this type by making multiple calls to the
object routine and stacking these objects in a triangle shape. These following set of figure
are of a system with the parameters xlen= 5 (cm), ylen = 5 (cm), ibar = 50, jbar = 50,
.
Al. = 10, and with a wedge that begins in zone 11 and goes to the end of the mesh, ending
at a height of 20 zones, and corresponding to an angle of 27 degrees. Figure VIII-42 is a
contour plot of pressures in this system at a time of 50 seconds.
169
170
For this set of circumstances, the analytical solution predicts an angle of 19 degrees whereas
the computational solution yields an angle of approximately 21 degrees.
- In this chapter, we examined three diflerent modifications that can be made to a twodimensional incompressible Eulerian flow code and discussed some additional problems
that can be modeled with codes that include these modifications.
we will again be making
an addition
to our compressible
fluid code,
element will be difFerent horn the ones discussed in this chapter. Up to now, our equations
have followed
directly
from mathematical
manipulation
of equations
derived
horn basic
physical principles, but this will not be the case in the next chapter. Instead, a complex
mathematical model will be constructed to successfully approximate rigorously derived
equations that are not able to be directly computed. Our turbulence transport equations
.
will contain many of the properties, but will not directly represent, the computational
calculation of the miniature fluctuations that are present in fluid flow of sufficiently high
Reynolds number.
IX.
A.
TURBULENCE
TRANSPORT
ThsorNotation
Before we discuss the equations of turbulence tramport,
TENSOR NOTATION,
same manner regardless of the coordinates that are chosen to describe it.
We can see
this property in the momentum equations (VII-34 and VII-35), where an equation that
expressed motion in the x-direction is coupled with a similar equation for motion in the
y-directiory Eq. (VII-35) is simply Eq. (VII-34) with the xs exchanged with the ~s and the
us exchanged with the VS. This same concept is also present in the heat equation, where
the advective and viscous terms are symmetric with respect to the x- and y-directions.
Cartesian tensor notation makes use of subscripts to express the general directionality
of a quantity without explicitly stating that it is in a particular x-, y-, or z-direction.
This concept can be demonstrated by an example such as the two-dimensional heat-flow
equation. In partial diilerential form, the heat-flow equation is Eq. (VIII-5):
(VIII-5)
Each of the u, v, Z, and g terms in this equation is in reality a component of a vector,
associated with either the x- or y-direction. If we let the symbol z represent a scalar (i.e.,
no direction) length and u represent a scalar speed, we can represent lengths and velocities
in definite directions with subscripts. Lengths and velocities in the x-direction become xx
and u=, and lengths and velocities in the y-direction become XV and Uv. Equation (m~-5)
would then appear as follows:
(Ix-1)
172
From this form, our equation can be rewritten using general subscripts (i, j, etc.) rather
than specific numbered directions. This rewriting is done using the two major rules that
govern equations written in Cartesian tensor notation.
The first of these rules is that any repeated index indicates the sum of all the elements
in each of the available dimensions. For a thredimensional
+ ~
into a single
term, ~.
The second rule of Cartesian tensor notation is that any free (i.e., not repeated)
index in one term must be the same in every other term. For example, in two dimensions,
(Ix-4)
would become two equations:
apul ~
at
am;
apu1u2
azl
ap2 + aplu2
at
az2
ap
=
axl
(Ix-5)
+ aw;
ap
8X2 =
ax2
azl
(IX-6)
This rule of consistency of free indices coupled with the summation rule for repeated
indices forms the basis of Cartesian tensor notation. We can use this notation to express
Eq. (Ix-2) as follows:
aT ~ auaT
Z
axi
a
.
= axj
m
() ~Xj
(Ix-7)
auv
ap
(VII-34)
ay = --(=3
ax
and
au
auv
T&+7&+
ad
ap
ay = --(=3
ag
(WI-35)
)
173
8P
~U~Uj
3F
8Xj
8X~
v8Xj -(
Ai
~
(IX-8)
)
Notice that in each of these tensor equations [Eqs. (IX-7) and (IX-8)], all the terms have
the same number of free indices.
Equation (IX-7) has no free indices in any of its terms; it is made up of scalars.
Such a scalar equation can be said to be made up of terms of TENSOR ORDER zero.
Equation (IX-8), on the other hand, hss one free index in each of its terms and therefore
is made up of vectors, or first-order tensors. As the number of free indices increases in an
equation, its tensor order similarly increases. Tensors of any order may exist, but all the
terms of a given equation must be of the same order.
Cartesian tensor notation will be useful when discussing the equations of turbulence
transport. It greatly increases the clarity of these equations and simplifies the notation in
the complex derivations that are used to generate turbulencetransport
B.
models.
we mean by turbulence. Any flow can be divided into steady and fluctuating parts. For
our purposes, we will define TURBULENCE
underlying average velocities over which these turbulent fluctuations exist will be called
the MEAN FLOW.
Precisely what we deii.ne to be the mean flow and what we consider to be turbulence
is a matter of choice.
at low viscosities a fluctuating stream moving to the right. This rightward flow could be
considered the mean flow, whereas the up-and-down oscillations could be called turbulence.
But another definition could be chosen: both the rightward velocity and the upand-down
motion could be considered part of the mean flow, whereas the miniature fluctuations that
are present within the up-and-down stream could be labeled as turbulence. Both of these
174
definitions are valid. Flow is divided into mean flow and turbulence, and the threshold
between these two types of flow is set at any arbitrary resolution.
In our simulations of turbulence, we will consider this threshold to be at the level of
resolution of the mesh. Flow that can be resolved through the use of us and vs will be
mean flow, and fluctuations that are smaller than the area of a cell will be considered to be
turbulence. In principle, however, our turbulence equations can resolve fluctuations even
greater than the resolution of the mesh. Although this is rarely desired, it is interesting
to note that turbulence equations can be used to represent fluctuations at any scale.
Our turbulence model will not resolve the turbulent fluctuations themselves but rather
the TURBULENT
KINETIC ENERGY per unit mass, the amount of kinetic energy per
unit mass present in the turbulent fluctuations. This two-dimensional array will be defined
at the cell centers and designated by a K. A variable, e, will also be calculated over the
mesh to represent the rate of dissipation of turbulent kinetic energy in different subregions
in the fluid. The resulting placement of variables on the mesh appears below:
Vi, j+ l/2
.a
R,j
Ki,
j ~Ui+l/2,
&i, j
Figure IX-1
The method of simulating turbulence that makes use of these variables is known as the
K e TURBULENCE
of
momentum, we begin with the momentum equation as expressed in tensor form (IX-8).
175
Each velocity and pressure in this equation is made up of a mean value and a fluctuating
value:
Ui ~fji.+u:
P=
P+
P,
where iii and ~ represent the average parts, and u: and P represent the fluctuating parts
of Ui and P. Substituting these definitions into Eq. (IX-8) gives us
~(iii+
U:)
at
axi
8Xj
(82(%))
m-)
Because the turbulent fluctuations are symmetric about the mean flow, the time averages
of the fluctuations (ii;, fi$, ~) are equal to zero. Therefore, all terms that contain a single
fluctuating factor are also equal to zero when averaged, and the time average of Eq. (IX-1O)
caq be written as
&i.iiij
dtii +
Z
8Xj
Wu.
3Lj3
ap
axz+v
diii
()
(IX-II)
This equation is almost identical to the original momentum equation, (IX-8) but contains
an additional term. While u; and u; are both equal to zero when averaged over time, the
time average of their product (u~u$) is not equal to zero, resulting in the ~
Eq. (IX-II).
STRESS TENSOR,
term in
abbreviated ss &.
This second-order tensor represents the effect of turbulence on the mean flow.
Computationally, this tensor is approximated by calculating a turbulent viscosity that
is added to the molecular viscosity to represent the total viscous forces on the fluid. To
.
make this approximation, we substitute the variable &,j for (~).
Equation (IX-n)
becomes
aiii
%_+
176
&iiiij
axj
_.
=
8P
azi + u
a%ii
a+
(-)
amti
axj
(IX-12)
which is a somewhat limited case of the fluid-flow equation. It is valid only when v is a
constant and the fluid is incompressible. This equation is more properly written as
(IX13)
(IX-14)
VISCOSITY,
turbulence in the system, K is the turbulent kinetic energy, and di,j is the KRONEC!KER
SYMBOL which is one if i equals j, and zero otherwise. The MODELING of R,i,j in this
manner is a somewhat arbitrary decision. It is made because more rigorous representations
of this tensor are unnecessary for the accuracy to which we desire a solution.
This
representation is chosen because it has the correct dimensions, is of the right tensor order,
and has been experimentally demonstrated to be reasonably accurate. This model is known
as the BOUSSINESQ APPROXIMATION
&ii ~
&~iij
8Xj
8.P
+ (V+vt)
8Xa
()
tJ2iia
K, the turbulent
units are those of energy per unit mass per unit the:
of w,
(IX-15)
=.
kinetic
of K, and its
K2
e
177
where CV is a constant that has been experimentally determined to be about 0.09. Our
equation for vt at a point (i, j) on the mesh is then
Vt(~,j)
K~j
0.09
.
~~,j
(IX-16)
Having related K and e to the momentum equation, we must also derive transport
equations for these two quantities. K is calculated by relating it to the Reynolds stress
tensor, and using the classical equation for kinetic energc
1
(IX-17)
Ekinetic= ~mv2 .
Turbulent kinetic energy, which is expressed as kinetic energy per unit mass, is then
(IX-18)
which can also be written as
K = ;R,i
(IX-19)
Using this equation for Kin terms of the Reynolds tensor, we calculate K by first deriving
an equation for
R,j.
This derivation will not be carried out in detail in this work, but a short overview
is included to give some insight into the process: First, Eq. (IX-9) is multiplied by U:
to obtain an equation in terms of u; ~.
+ u~#
becomes w,
+ u; ~.
is then left with a transport equation for K which contains some terms that cannot be
computationally represented using only K and e. These terms are then modeled, resulting
in a final equation for the transport of K:
;+2-=2((v+v)%)+:+
??.. )(~+2)~-&oE-20)
178
II
III
IV
In this equation the term denoted by I represents the time rate of change of K, II represents
advection, III
turbulence
of
different velocities rubbing against each other), and V (e) represents the dissipation of
turbulence.
A transport equation for ~ is derived by modeling an equation after the transport
equation for K. The e transport equation is
where Oc, Ccl, CC2are constants which have been determined as a result of experimentation.
C4? = 2.0.
Equation (IX-21), like Eq. (IX-20) is made up of a rate of change term (1), an advection
term (11), a diffusion term (111), a generation term (IV), and a dissipation or dampening
term (V).
These two transport equations [Eqs. (IX-20) and (IX-21)], combined with the equation
for turbulence viscosity Pq.
(H-16)]
model.
We will
Computational
Implementation
The K e turbulence
of the IS e Turbulence-Tkansport
model is implemented
Model
K and eps.
The values of these arrays are specified at cell centers as is illustrated in Fig. IX-1 in
Section B. Both two-dimensional arrays are initialized in the setup procedure.
A typical
179
initial value for K is one-tenth of the energy per mass of the mean flow. In the Karman
vortex street problem, for example, initial Ks might be assigned such that
0=(+)
(+2)
-
(Ix-22)
A typical value of epsO, the initial value of the eps array, is K312 divided by some
characteristic size of the turbulence of the system.
typical turbulence size is half the width of the obstacle. For this problem, the c array is
then initialized to
Ko312
Ps = (o.5)(hob.)
(IX-23)
In addition to these two arrays, three other arrays are created for the turbulence viscosity
at the cell centers, the top of the cells, and the right cell walls. These are configured as in
Fig. IX-2.
anuKj
A
a;uK
Figure IX-2
These arrays need not be initialized because they will be calculated before they are ever
used in the program.
The u, v, ubar, vbar, and pressure arrays are implemented as they were in our
I
other two-dimensional simulations with the exception of the total viscosity (molecular
180
plus turbulent) being used rather than simply the molecular viscosity.
Our turbulence
transport code will not contain a temperature array or equations of heat transport.
Besides the initialization of the K and eps arrays in the setup procedure, our turbulence
transport code contains three major sections that did not exist in the basic two-dimensional
incompressible code: the implementation of turbulent boundary conditions, the calculation
of turbulent viscosities, and the calculation of the K and e equations themselves.
The
I
I
4
Setup(initializeKs&es)
pt =ptime
End
Tests
lTsnrzential
B.C.I
Figure IX-3
.
The turbulence boundary conditions will be reflective, with the values of K and eps at
the ghost zones equal to the values at the real zones directly adjacent to them.
This
system. Much more accurate boundary conditions exist, using WALL FUNCTIONS,
that
carefully calculate more appropriate values for the ghost zones. Even these functions have
their Limitations, however; and for turbulence to be completely modeled at a wall, each
component of the Reynolds stress tensor must be calculated separately rather than the
overall turbulent kinetic energy (K). Because our simulation is not overly concerned with
turbulence at the walls of the system, neither of these methods is necessary.
A simple
Kgho~t
= K~eal
(IX-24)
~ghost = ~real
(IX-25)
and
these calculations along the top Wd bottom and along the edges of the mesh comprise the
turbulent boundary condition routine.
The routine to compute the total viscosities assigns value-s to the three turbulence
viscosity arrays (anuk, anuki, and anukj) by using K and eps values at the desired positions
to calculate Vt as in Eq. (IX-16) and adding the molecular viscosity. Ks and d s at cell
walls are calculated by averaging. The three equations for the total viscosities are
K!.
(anfl)i,j
= ~
+ %nolec.lar
(IX-26)
(anuKi)i+l/2,~ =
Ki,j+Ki+l.j#
C,,~~,+, ) + Vmolecular
(~uK&+l/2
J)
Ki,j+Ki,j+l3
)
C,,~ei .jl
+ molecular .
2
(j
)
(IX-27)
(IX-28)
These should be carried out every time step, just before the program enters the routine
for turbulence transport.
182
The turbulence transport equations are calculated by computing Eqs. (IX-20) and (lX21) at every point on the mesh. For this calculation local arrays of variables are employed
to represent each term in the equations. Equations (lX-20) and (IX-21) are then written
as
8K
=Ktl+Kt2+Kt3e
at
(IX-29)
and
42
(IX-30)
Ft=-Etl+ct2+d3-Et4
(IX-31)
w~ch
leaves us the issue of how each of the terms in these equations is calculated.
are calculated.
and is zero if the flow is from left to right and one if the flow is horn right to left. jdnr
is calculated from the v velocities at position i, j + 1/2 and is zero if the flow is upwards
and one if the flow is downwards. These two arrays are used to calculate donor cell in a
doublelookup
fashion.
(ue)~+l/2,j (ue)~-1/2,j +
dx
(ve)~j+l/2
(ve)~j-1/2
dg
(lx-34)
183
where each K and e at a cell wall is calculated using the donor-cell technique. In code form
these equations appear as
Ktl(i,j)
=(u(i,j)*K(i+idnr(i,j),j)
& u(i-l,j)*K(i-l+iti(i-l,j),j))/dx
& (v(i,j)*K(i,j+jdnr(i,j))
& v(i-l,j)*K(i,j-l+jdnr(i-l,j))/dy
Epstl(i,j)
=( u(i,j)*Eps(i+idnr(i,j)J)
& u(i-l,j)*Eps(i-l+idnr(i-lJ),j)
& (v(i,j)*Eps(i,j+j~(
iJ))
)/dx +
-
& v(i-lJ)*Eps(i,j-l+jdnr(i-l,j)
)/dy
(~+
7wi+l/2,j))(K+l,j
(v + v,(i-1/2,j))(K,j K-l,j)
K,j)
dzz
(v+
(Ix-35)
t(i,j+l/2))(Kki+l
@2
&4j
1
=
o~
(v + %(i+l/2,j)
) (~i+l,j
% ) (v + 1.4(i-l/2J))(G,j
dx2
(~+
~t(i,j+l/2))
In
*(K(i+l,j)-K(i,j))
& + anuki(i-lJ)*(K(i-l,j)-K(iti)))/(~*~))
& + ((anukj(i,j)*(K(i,j+
l)-K(i,j))
& + anukj(i,j-l)*(K(iJ-l
)-K(i,j)))/(dy*dy))
Epst2(i,j)=((anuki(i,j)*
(Eps(i+l,j)-Eps(i,j))
& + anuki(i-lJ*(Eps(i-l,j)-Eps(i,j)))/(dx*dx))
184
Q,J
& + ((anukj(i,j)*(Eps(i,j+
l)-Eps(i,j))
& + anukj(i,j-l)*(Eps(iJ-l
)-Eps(iJ)))/(dy*dy))
V~(~,j-~/2))
(GJ
G,j-1)
.
1
(IX-36)
& * (1/sige)
Kt3 = (v+ VJ
g+%
[(
(%+2)%
g+
)
This reduces to
Kt3 = (v+ VJ 2
[
(2)2+
(;+~)2+2(~)2]
~
(IX-38)
~j+l/2
~j~/2
dy
(Ix-39)
Y
1
term involves
ad
differences
taken across a
distance of 2 dz and 2 ddy, due to the positions at which u and v are defined. In code form
Eq. (IX-39) appears as the the following:
Kt3(i,j)=
anuK(iJ) * ((u(iJ)-u(i-l,j)
& ((v(ijj)-v(i,j-l
))**2)/(dy*dy)
& (((u(iJ+l)+u(i-l,j+
& ((v(i+l,j)+v(i+
)**2)/(dx*dx)
l)-u(i,j-l)-u(i-l,j-l)
)/(4*dy))
l,j-l)-v(i-l,j)-v(i-l,j-l))/(4*&)))**2
* Kt3(i,j)
185
This term is used along with the other e terms to calculate the array of turbulence
dissipation rates.
The turbulence transport routine is made up of three major loops: the first to calculate
donor-cell arrays; the second to calculate Kt 1, Kt2, Kt3, Epstl, Epst2, Epst3, and Epst4;
and a third to combine these terms using Eqs. (IX-31) and (IX-32).
This routine, along with the turbulent boundary condition routine and the routine to
calculate total viscosities, makes up the K c turbulence model. The implementation of
these three procedures, along with the use of total viscosity wherever molecular viscosity
appears in the momentum and turbulence transport equations, is all that is necessary to
create a code that calculates turbulence transport.
D.
Chapter VII, we can use the same set of parameters, namely: a flow passage 50 (cm) long
and 15 (cm) wide, flow around the obstacle at a rate of 1.5 (cm/s), an initial flow rate at
the right of 1 (cm/s), and a variable fluid viscosity.
The graphs presented in this section use these parameters on a grid of dimensions ibar
=
25 and jbar = 15. Initial K values and input K values are set to 0.01 (cm2/s2), whereas
initial and input e values are set such that the TU@ULENCE
The turbulence scale is a measure of the size of the turbulent fluctuations; it is represented
by an s and is calculated as
K3/2
s =
186
(IX-42)
A typical turbulence scale at low Reynolds numbers is about one to one half the size
of a major feature, such as the obstacle. At high Reynolds numbers the turbulence scale
of the size of a major feature.
In this first set of graphs, anu is set to 1; resulting in a system with a Reynolds number
of 5. Graphs appear at a time of 100 seconds.
187
Notice that in these graphs, there is no flow separation, and turbulent fluctuations
are confined to the region where turbulence is being directly pumped into the system.
Turbulent kinetic energy cannot be sustained in this nonfluctuating system and is therefore
dissipated.
- At a viscosity of 0.2, the system begins to develop stationary vortices as can be seen
in Fig. 7.
Streamlinesattime100
(s)
Reynolds Number =25
Figure IX-7
188
189
Again we see turbulence energy being dissipated by the system. Turbulence energy is
much stronger where it is being pumped into the system than it is anywhere else. At this
Reynolds number, however, turbulence energy reaches an area farther downstream than
it did in the first example. The Repolds
that turbulence is being generated by the system, but it is now sufficiently high for the
input turbulence to persist for an extended period of time.
- At a viscosity of 0.02 and a Reynolds number of 250, the system develops a Karman
vortex street. This can be seen in the following two graphs taken at a time of 100 seconds.
\w--z,,/
Streamlines at time100 (s)
Reynolds Number = 250
Figure IX-n
190
In these graphs, turbulence is once again strongest where it is being pumped in, but
shearing forces farther down the street have created other regions of turbulence.
The
Reynolds number has been increased to a point where turbulence not only persists but is
generated by the system.
The Karman vortex street can be simulated in another manner, by setting the initial
Ks and the K at the left to a higher value and allowing for the turbulence equations to
represent not only the small fluctuations within the stream but the large changes in velocity
of the stream itself The system then evolves into a situation where the turbulence kinetic
energy is high, thereby resulting in a high-turbulence viscosity. This viscosity lowers the
EFFECTIVE
REYNOLDS
using the sum of the molecular and turbulence viscosities. The effective reynolds number is
in contrast to the MOLECULAR
the molecular viscosity. At a low eflective Reynolds number, the resolved system does not
contained the Karman vortex street itself, but the-kinetic energy contained in this stream
is visible in the turbulence kinetic energies. Such a system is shown in the following set of
plots, which are taken at a Reynolds number of 250 and an initial K and input K of 0.225
(cm/s).
192
1////
In these plots, K values are about 0.17 (cm2/s2) whereas e values are about 0.016
(cm2/s3).
an effective Reynolds number of 30, which is consistent with the type of resolved flow that
can be seen in Fig. IX-15.
It is hoped that the difference between the resolved kinetic energies in this and in
another calculation that has no equations of turbulence transport will be comparable to
the turbulent kinetic energy. This hypothesis can be tested by recording the resolved
kinetic energy and turbulent energy per unit mass of a turbulence transport calculation
and the resolved kinetic energy per unit mass of the second calculation at equal time
intervals. The difference between the two resolved kinetic energies can then be compared
with the turbulence kinetic energy.
Figure 18 shows a comparison of these two values for the parameters used in Figs. IX15-17.
(n
(n
E
.%
-g:-
s
3
a
~.
9.
O-J
.-a)
UI
$
c
a)
a)
U)
~
a)
>:
m
=..
q
0turbulence
--l
&a
I
/6.0
I
s
I
%.1
I
f.11.1
time in seconds
.
194
1
@j
In this figure, we can see that the turbulent kinetic energy is in fact much less than the
difference between the two resolved kinetic energies. This difference is caused by the fact
that the turbulence equations are only able to model the fluctuations in the shear layer that
occurs behind the object.
its effect in the top and bottom portions of the flow psssage. In the resolved vortex street,
fluctuations in the center of the graph have large and immediate effects on the areas in
the top and bottom of the graph; these areas can be said to be CORRELATED.
This
correlation, which can be clearly seen in Fig. IX-12, fails to be accurately represented by
the K e turbulence model.
The problem is that the K e model is a SINGLE POINT TURBULENCE
MODEL,
meaning that it relies on the values of quantities directly surrounding a single point to
generate the turbulence values at that point.
the SPECTRAL
TURBULENCE
Such
195
Glossary
Adiabatic
system
(VII-C).
generate heat. In an adiabatic system, both pressure and internal energy are functions
of density.
Advective
flux
(V-A).
viscosity
(VI-E).
problem
(VIII-C).
cooled at the top, and insulated along the sides. The Nusselt
conditions
(II-B).
act on a system.
Boussinesq
approximation
pressible fluid code that all terms of the momentum equation can be modeled at constant
density except the buoyancy term. The Boussinesq approximation for heat flow is not
to be confused with the Boussinesq approximation for the Reynolds stress tensor. These
are completely independent concepts.
Boussinesq
approximation
stress tensor
(IX-B).
The approx-
where K is the turbulent kinetic energy and ut is the turbulent viscosity. The Boussinesq
approximation for the Reynolds stress tensor is not to be confused with the Boussinesq
approximation for heat flow.
196
the general directionality of a quantity without explicitly stating that the quantity is in
a particular x-, y-, or z-direction. This notation is helpful in simplifying the equations
of fluid motion and aids in the complex derivations that are used to generate turbulence
transport models, as well as many other models in physics.
Cell
(II-B).
An element of &ite
flux (V-B).
the quantities on both sides of the advective surface as the value of the advected qusntity.
Coefficient
of heat conductivity
(II-B).
Compressible
fluid (IV-A).
(II-A).
Discontinuity
(IV-E).
(IX-D).
is
]v]dt
--j-J
<1-,
(IV-36)
where v is (I?-L]
-1-%ound).
Donor-cell
flux (V-B).
advected quantity.
197
Effective Reynolds
number (IX-D).
Function.
erf(x)
5 e .
Zdx
The error function can be calculated using the table at the end of Section III-E. It is
also called the probability integral.
Eulerian fluid-mechanics
code (IV-A).
In this type of code, fluids move in and out of zones at various rates, causing the msss
contained in a particular zone to change as the simulation progresses.
All physicaI
quantities are fluxed between cells, but the positions of the cells remain the same.
Explicit
solving
method
(III-C).
cycle are calculated directly horn the values at the previous time cycle. This is in contrast
to the implicit solving method.
Fictitious
zones
(II-D).
aries of a system and are used in representing boundary conditions. Fictitious zones are
also called ghost zones.
Fluid
(IV-A).
moving from one shape to another but resists the same amount in all directions and in
all shapes.
Flux
Ghost
(II-A).
zones
are used in representing boundary conditions. They are also called fictitious zones.
Hot spot (VIII-B).
(III-C).
cycle are calculated based on the rate of change of values at this new time step. Values
at the old time step are used only indirectly, This is in contrast to the explicit method.
Incompressible fluid (lV-A).
shock (IV-E).
heat fluxed across the wall. It is achieved by specifying a zero temperature gradient
across the wall.
Isotropic (VII-B).
equations for the turbulent kinetic energy per unit mass (K) and the dissipation rate of
that turbulence (e).
Karman vortex street (VII-C).
in which a fluid within an appropriate range of velocities and viscosities flows around an
object. The Karman vortex street is a fluctuating stream with alternating eddies that is
caused by the shedding of vortices. It is also sometimes called the Von Karman vortex
street.
Kinematic viscosity (VII-B).
symbol
(IX-B).
The
fluid-mechanics
code
(IV-A).
zones vary between time steps. As fluids are compressed and decompressed, the zones
move accordingly, maintaining an equal mass throughout the simulation. In a Lagrangia.n
calculation, the energies, momenta, and positions of the zones change from time step to
time step; only the mass contained by each zone is held fixed.
Mach number
(VIII-E).
M=J--Csound
and the resulting reflected shock. A Mach stem is always perpendicular to the obstacle.
Mass
Matching
(IV-E).
volumes of the denser zones and the increasing of the initial volumes of the less dense
zones in a manner such that the masses of all zones are equal.
Mean
flow (IX-B).
The steady part of a fluid flow; the part of a fluid flow that is not
considered turbulence.
Modeling
(IX-B).
equation that retains the properties of the original equation but is not algebraically
equivalent.
Molecular Reynolds number (IX-D).
Convection
different temperatures
temperatures.
200
(VIII-C).
Navier-Stokes
Equations (IV-B).
motion of fluids.
Nonadvective
flux (V-A).
quantities diiluse from one area to another. Examples of this sort of flux are pressure
flux in the momentum equation and work flux in the energy equation.
Nusselt
Number
(VIII-C).
The ratio between the total heat flux in a system and the
Nu =
Obstacle
Total Flux
(VIII-26)
Conductive Flux
(VIII-A).
subregion.
Prescribed-temperature
boundary
condition
(VIII-B).
A boundary condition in
which the wall exists at a prescribed temperature. For this condition the temperature
gradient across the wall is chosen such that the temperature at the wall remains at a
specified value.
Polytropic
equation
of state
(IV-D).
p=(y-l)pI.
Polytropic
gas constant.
Integral.
Wave
number
(VIII-C).
number is calculated as
Ra=
gh3/3AT
Vo
7
(VIII-27)
201
h is the height
of the passage, AT is the difference in temperatures between the top and the bottom
of the passage, v is the viscosity of the fluid, a is the thermometric conductivity of the
fluid, and @ is & the inverse of the reference temperature.
Reynolds
number
(VII-E).
It can be used to
(VII-94)
hob~is the height of the obstacle, Um is the velocity of the fluid far away from
where
the obstacle, and v is the viscosity of the fluid. As the Reynolds number increases, the
system is likely to become more turbulent.
Reynolds
stress tensor
(IX-B).
the turbulence of a system. The Reynolds stress tensor is equal to the ensemble average
of the product of the fluctuations in fluid velocities in two directions:
where u: and u; are first order tensors representing the fluctuations in velocities in the
i- and j-directions.
Shear
force
(IX-B).
(IV-E) .
A rapid transition between two states that moves relative to the fluid.
Front
Shock Tube
(IV-E).
(IV-E).
Same as a shock.
A tube containing two fluids, usually gasses, of different densities
Single-Point
Turbulence
Model
(IX-D).
values of quantities directly surrounding a single point to generate the turbulence values
at that point. Such a model contains no correlations.
Spectral
Turbulence
Model
(IX-D).
between difIerent regions in a fluid. Turbulence values at any given point are calculated
in conjunction with these correlations rather than using only the values adjacent to that
point .
Staggered
mesh
(VII-B).
(VII-D).
Number
Lines that indicate the path along which the fluid is flowing.
(VII-E).
stream to the size of the object and the rate of the flow. The Strouhal number is a
dimensionless quantity that is calculated as
St=
where
bob.
u~r~tr=t
(VII-96)
hob~is the height of the obstacle, Uw is the velocity of the fluid far away from
the obstacle, and T is the period of the street. In a Karman vortex street, the Strouhal
number has been experimentally observed to be approximately 0.2.
Taylor-series
expansion
(VI-C).
In a
$(z) +
where ~, f, f,
+f(z)+:f(z)+$f(z)
+... .
.
etc., are the first, second, third, etc., derivatives of the function ~.
with a quantity. A scalar, for example, has a tensor order of zero, indicating that it has
no directionality associated with it. A vector, having a single direction, is a quantity
with a tensor order of one. The Reynolds stress tensor, the product of two vectors, has
203
a tensor order of two. Higher order tensors exist with a number of directions equal to
their tensor order.
Thermometric
conductivity
(II-B).
coefficient of heat conductivity of a material divided by its density and specific heat
~ . Its units are those of an area per unit time.
()pb
An integer that represents the number of time cycles that
Time cycle counter (II-B).
have been calculated in a simulation.
Truncation
error
analysis
(VI-A).
!lluncation
(IX-B).
scale (IX-D).
The
(IX-42)
s=.
e
Turbulent
fluctuations. Turbulent kinetic energy is often measured as turbulent kinetic energy per
unit mass which is denoted by
Turbulent
viscosity (IX-B).
K.
Viscosity that results from turbulent fluctuations in a
unstable
(V-B).
chosen.
Vortices
(VII-E).
Areas in a fluid flow where fluid is not moving along with the main
(IX-C).
zones in problems where the turbulent conditions at the boundaries are important.
204
Zone (II-A).
205
Acknowledgments
We would like to thank Margaret Findley for typesettingthis work and creating the figures,
as well as Eric Harstad, Denise Hunter, and Patricia Mendius for help in editing, and
Thornas Adams and XHM for making the publication of this work possible.
We would
also like to thank thank T-3, XHM, and Los Alamos National Laboratory for continuing
to support research programs for students in the sciences.
206
m
cd
c)
cc
m
a-l
.
Los Alamos
NATIONAL
LABORATORY