Professional Documents
Culture Documents
Computational Fluid Dynamics: Course Notes
Computational Fluid Dynamics: Course Notes
Computational Fluid
Dynamics
Course Notes
Dr PK Dyson
Sep 2004
CFD Overview
and
Introduction to CFX
Introduction
CAD (usually)
Mesh Generator
Pre-processor
>> Solution
Solver
Post-processor
Mesh Control
Parameters
DesignModeller
(*.agdb file)
CFX-Mesh
(*.cmdb file)
Geometry file
(*.gtm)
CFX-Pre
Session file
(*.ses) holds
record of
commands
entered during
session
Journal file (*.jou)
holds record of
commands for
particular
database
Boundary
conditions
Fluid
properties
Definition
file (*.def)
Results
file (*.res)
(numerical data
in text file)
CFX-Post
Forces
Velocities
Streamlines
Numerical output
Pressures
Turbulence
See Help:- from Advanced CFX Panel:
Help > Master Contents
ANSYS CFX, Release 10.0: Installation and Overview >
Overview of ANSYS CFX > ANSYS CFX File types
File Management
Create a MyCFX folder on the local hard drive
and put each job in a different sub-folder.
Do not leave spaces in folder or file names
anywhere in the path to your working folder.
Work from the local hard drive or pen drive (not
across the Network from your U: drive)
At the end of the session, drag and drop your
entire working folder to your pen drive.
WARNING: Always keep files on you own
independent storage media the hard drives
are cleaned each night.
Theory Overview
u2
Momentum
mass-velocity
= u
y,v
z,w
x,u
y
x
v
0
t
x
y
z
u v w
u
v
w
t
x
y
z
z
x y
Substantial
derivative
D
u v w
Dt
z
x y
For incompressible flow, this becomes:
x mom :
u2y
u
x
x
x mom :
u
y
u2y
x
x
x mom :
uvx
y
x
2
u y x u v x y
x
y
u
u
u
v
u
u
v
u
x y
x
x
y
y
u v
u
y
x
u
u
u
v x y
y
x
2v 2v
v
P
v
u
v Y
2
2
y
y
y
x
x
Dv
F P 2 v
Dt
v = u2
w = u3
u
u
u
v
w
x
y
z
uj,j = 0
mean?)
y
x
Convection
with mass transfer
v
Conduction
by temperature gradient
2T 2T
T
T
C p u
v k
2
2
y
y
x
x
where
u
2
v
2
w
2
u w
z x
u v
y x
2
v w
z y
Stationary plate
Infinitely
long
u v
0
x y
2u 2u
u
P
u
u
v X
2
2
y
x
y
x
x
0
x y
2u 2u
u
P
u
u
v X
2
2
y
x
y
x
x
2v 2v
v
P
v
u
v Y
2
2
y
y
y
x
x
Unknowns are u, v, P which are to be solved
in terms of x and y - i.e. across flow domain.
Solutions are typically plots of velocity
vectors, streamlines, pressure contours (and
temperature contours if energy equation is
added).
These may be processed to produce such
data as forces (eg lift and drag on a foil) or
pressure loss in pipes and fittings.
Computational Grid
Since analytical solution is available only in
simplest of cases, numerical techniques are
required; thus a grid across flow domain
needs to be defined
i, j+1
i+1, j+1
i-1, j
i, j
i+1, j
y
i-1, j-1
i, j-1
x
i+1, j-1
Solution Techniques
Broadly speaking, one of three techniques is
adopted for the solution of the governing
equations:
finite difference, in which the differential
terms are discretised for each element
finite volume, in which the governing
equations are integrated around the mesh
elements
finite element, in which variation of
variables within elements is approximated
by a function, and a residual (or error term)
is minimised.
The first of these is perhaps the easiest
conceptually, and thus we will use this to
outline a typical solution procedure.
CFX uses the finite volume method.
....
x
2
3
x i
x i 2
x i 6
Also
ui1
2u
u
ui
x
2
x i
x
x 2
i
3u
3
x
x 3 ....
i
Subtractin g :
3u x 3
u
ui1 ui 1 2
....
x 2
3
x i
x i 6
ui 1 ui 1
2
u
(second order
2x
x i
central difference)
x
2
ui1 ui 1 2ui
....
2
4
x i
x i 12
2u
ui 1 2ui ui 1
2
O x
2
2
x
x i
Thus, if we take, say, the x direction
N-S equation (steady for simplicity):
2u 2u
u
P
u
u
v
2
2
y
x
y
x
x
becomes
ui 1, j ui 1, j
ui, j 1 ui, j 1
Pi 1, j Pi 1, j
ui, j
v i, j
2 x
2y
2 x
ui 1, j 2ui, j ui 1, j ui, j 1 2ui, j ui, j 1
2
2
x
y
b
b
b
b
b
b
. then we will form 3n simultaneous
equations in 3n unknowns.
Unfortunately, these are non-linear, so an
iterative approach is usually employed - eg.
guess u, v for the domain
and insert as ui,j, vi,j
in previous set of equations
insert revised
values of ui,j,vi,j
solve equations
for u, v, P
check
convergence
Use modified
continuity
equation to
calculate a
pressure
correction
Do u, v values satisfy
continuity?
(convergence criterion)
Y
Finish
u=value
v=0
P=value
u=0,v=0
wall
P= value
u 0, v 0
Grids (1)
Structured Mesh
usually comprising quadrilateral elements
Physical Space
eg. circular duct
Computational
Space
Grids (2)
Aerofoil Section (Example of structured
mesh, refined in critical regions)
Grids (3)
Unstructured Mesh
usually based on triangular pyramids
(eg CFX 5)
Turbulence
vel at
a point
time
Turbulent Flow
Momentum
diffusion
by viscosity
Additional momentum
diffusion due to turbulence
Concept of
turbulent (or eddy)
viscosity, t
u u u , v v v, w w w, p p p
Superscript bar denotes the ensemble average or
the mean value.
Dash denotes the fluctuating part.
Turbulence fluctuations usually have small length and
time scales compared to the mean flow.
Substituting this decomposition to the Navier-Stokes
equations and taking the ensemble average, we now
get
continuity :
uj
0
x j
ui
ui
1 p
ui
momentum :
uj
uiu j
t
x j
x i x j x j
Turbulence Closure
Equations (also called Reynolds equations) for
ensemble average values are identical to the NavierStokes equation except for the cross-products of
the fluctuation terms.
u 2 , v 2 , w 2 , uv, uw , vw
Since these terms have similar functions as viscous
stresses, they are called turbulent stresses or
Reynolds stresses.
To properly close the system, we have to define the
behaviour for turbulence cross-product terms.
This is where many different types and levels of
turbulence modelling come in.
At the highest level, transport equations can be
set up for each of these terms. This will increase
the number of equations to solve by six.
Turbulence models based on this approach are
called Reynolds stress equation model (RSM) or
the second-order closure model.
A commonly used turbulence model in
engineering differs from this approach by
reducing the number of extra equations to only
two and is known by the name k- model.
k- Model - Theory
In this model, the Reynolds stresses are linked to
the mean flow; i.e.
ui uj
ij uiu j t
x
j
i
k
. U k .
t
. U .
t
t
k Pk
k
t
C1 Pk C 2
1 2
k u v 2 w 2
2
2 eij eij ;
ui uj
eij
x j x i
k2
t c
2
Pk t U. U U .U 3t.U k
3
T
22
u
where is the turbulence int ensity
2
1
2
k2
Exercises
Exercise 1
Create
Createfolder
folderMyCFX
MyCFXand
andaasub-folder
sub-folderTutorial_1
Tutorial_1
Start
StartANSYS
ANSYSCFX
CFX10.0.
10.0.
In
Inthe
theLauncher,
Launcher,set
setthe
theWorking
WorkingDirectory
Directoryto
tothe
thesubsubfolder
folderyou
youhave
havejust
justcreated
createdand
andthen
thengo
goto
toANSYS
ANSYS>>
Workbench
Workbench10.0.
10.0.
In
Inthe
theStart
Startpanel
panelthat
thatnow
nowopens,
opens,click
clickEmpty
EmptyProject
Project
(under
(underNew)
New)
Go
Goto
toHelp
Help>>ANSYS
ANSYSDesignModeller
DesignModellerHelp.
Help.In
Inthe
the
Contents
Contentspanel,
panel,expand
expandthe
theCFX-Mesh
CFX-MeshHelp
Helptree
treeand
and
click
clickTutorials.
Tutorials.Click
ClickClick
Clickhere.
here.
Work
Workthrough
throughTutorial
Tutorial1:
1:Static
StaticMixer.
Mixer.
This
Thiswill
willtake
takeyou
youthrough:
through:
Geometry
Geometrycreation
creationusing
usingDesignModeller
DesignModeller
Mesh
Meshgeneration
generationusing
usingCFX-Mesh
CFX-Mesh
At
Atthe
theend
endof
ofthis
thistutorial,
tutorial,under
underthe
theparagraph
paragraphIf
Ifyou
you
want
wantto
tocontinue
continueby
byworking
workingthrough
throughthe
theANSYS
ANSYSCFX
CFX
example
example,
,follow
followsteps
steps1,
1,22and
and33to
toopen
openthe
themesh
meshinin
CFX-Pre.
CFX-Pre.
Now
Nowclick
clickHelp
Help>>Tutorials
Tutorialswhich
whichwill
willtake
takeyou
youinto
intothe
the
CFX
CFX(Fluid
(FluidModelling)
Modelling)Tutorials
Tutorials(as
(asopposed
opposedto
tothe
the
DesignModeller/CFX-Mesh
DesignModeller/CFX-Mesh(Solid
(SolidModelling)
Modelling)Tutorial
Tutorialyou
you
have
havejust
justbeen
beenworking
workingthrough)
through)and
andclick
clickFlow
Flowininaa
Static
StaticMixer.
Mixer.
Exercise 1 (continued)
Continue
Continuewith
withthis
thistutorial,
tutorial,but
butnote
notethe
theinstructions
instructionsinin
para
para44at
atthe
theend
endof
ofthe
theDesignModeller
DesignModellerTutorial:Tutorial:
missing
missingout
outthe
theinstructions
instructionsininthe
thesection
sectionCreating
Creatingaa
New
NewSimulation.
Simulation.Note
Notethat
thatyou
youdo
donot
notneed
needto
tocopy
copythe
the
sample
samplefile
fileStaticMixerMesh.gtm
StaticMixerMesh.gtmto
toyour
yourworking
working
directory
directoryififyou
youhave
havejust
justcreated
createdthe
themesh
meshininCFX-Mesh,
CFX-Mesh,
since
sinceyou
youwill
willwant
wantto
touse
useyour
yournew
newmesh
meshand
andnot
notthe
the
one
onesupplied
suppliedwith
withANSYS
ANSYSCFX.
CFX.For
Forthe
theImporting
Importingaa
Mesh
Meshsection,
section,the
theonly
onlyaction
actionthat
thatyou
youneed
needto
tocarry
carryout
out
isisto
toselect
selectAssembly
Assemblyfrom
fromthe
theSelect
SelectMesh
Meshdrop-down
drop-down
list,
list,as
asthe
themesh
meshisisloaded
loadedautomatically
automaticallywhen
whenyou
youstart
start
ANSYS
ANSYSCFX
CFXininthe
themanner
mannerdescribed
describedabove.
above.
This
Thiswill
willtake
takeyou
youthrough:
through:
Problem
ProblemDefinition
Definitionusing
usingCFX-Pre
CFX-Pre
Solution
Solutionusing
usingCFX
CFXSolver
SolverManager
Manager
Viewing
Viewingof
ofresults
resultsusing
usingCFX-Post
CFX-Post
In
InANSYS
ANSYSWorkbench
Workbenchgo
goto
toHelp
Help>>ANSYS
ANSYS
Workbench
WorkbenchHelp
Helpand
andininthe
theContents
ContentsTree
Treego
goto
to
DesignModeller
DesignModellerHelp
Help>>Welcome
Welcometo
tothe
the
DesignModeller
DesignModeller10.0
10.0Help
Help>>Process
Processfor
forCreating
Creatingaa
Model
Model
Read
Readthrough
throughthe
thepages
pagesand
andrun
runthe
thevideo
videosequences
sequences
to
toremind
remindyourself
yourselfof
ofthe
theprocess
processof
ofcreating
creatingaa
geometry.
geometry.
Exercise 2
Work
Workthrough
throughTutorial
Tutorial2,
2,Static
StaticMixer
Mixer(Refined
(Refined
Mesh)
Mesh)which
whichwill
willshow
showyou:
you:
more
moreabout
aboutthe
themesh
meshgeneration
generationprocess
process
modifying
modifyinggeometry
geometry
use
useof
ofCFX
CFXCommand
CommandLanguage
Language(CCL)
(CCL)to
toavoid
avoid
too
toomany
manyrepetitive
repetitivekeystrokes.
keystrokes.
As
Asbefore
beforeyou
youwill
willneed
needto
tostart
startininthe
the
DesignModeller/CFX-Mesh
DesignModeller/CFX-Mesh(Solid
(SolidModelling)
Modelling)
Tutorial
Tutorialand
andswitch
switchto
tothe
theCFX
CFX(Fluid
(FluidModelling)
Modelling)
Tutorial.
Tutorial.
Exercise 3
Refine
Refinethe
themesh
mesheven
evenfurther
furtherininthe
theoutlet
outletregion
regionof
of
the
themixer
mixerby
byinserting
insertingaamesh
meshcontrol
controlas
asfollows.
follows.
Re-open
Re-openStaticMixer
StaticMixerininCFX-Mesh
CFX-Mesh
Right
Rightclick
clickControl
Control>>Insert
InsertPoint
PointSpacing
Spacing
Click
ClickPoint
PointSpacing
Spacing11ininDetail
DetailView
Viewand
andchange
change
the
thesettings
settingsto:
to:Length
Lengthscale
scale0.1
0.1m,
m,Radius
Radiusof
of
Influence
Influence0.5
0.5m,
m,Expansion
ExpansionFactor
Factor1.2
1.2
Right
Rightclick
clickPoint
PointSpacing
Spacing>>Insert
InsertLine
LineControl
Control
Click
ClickLine
LineControl
Control11
In
InDetail
DetailView,
View,for
forpoint
point11click
clickApply,
Apply,and
andaccept
accept
coordinates
coordinatesas
as0,0,0.
0,0,0.Repeat
Repeatfor
forpoint
point22and
andmake
make
coordinates
coordinates0,0,-2.
0,0,-2.Click
Clickininthe
thebox
boxnext
nextto
to
spacing,
spacing,then
thenclick
clickPoint
PointSpacing
Spacing11ininTree
TreeView
View
&&click
clickApply.
Apply.
Right
Rightclick
clickBody
Body11>>Suppress
Suppressand
andobserve
observe
position
positionof
ofLine
LineControl.
Control.Unsuppress
UnsuppressBody
Body1.
1.
Generate
Generatethe
thesurface
surfacemesh
meshas
asbefore
beforeand
andnote
note
the
thedifference
differencearound
aroundthe
theexit.
exit.
Generate
GenerateVolume
VolumeMesh,
Mesh,apply
applythe
thephysics
physics(use
(use
import
importCCL
CCLininPre),
Pre),Run
RunSolver
Solverand
andview
viewresults.
results.
Now
Nowuse
usethe
theHelp
Helppages
pagesto
toanswer
answerthe
thefollowing
following
questions.
questions.
Exercise 4
y
x
0.3
2
1
x
10
2
z
point 0 0 0
surface A
diameter 0.3
Using CFX-Pre
10. Create a fluid domain - use standard air or water,
select steady state, k- turbulence model, scalable
wall function, isothermal, non-buoyant. Set
reference pressure at 0 Pa.
11. In the Object Selector Panel, double click on the
material you have chosen (under the library
tree), and make a note of its density and dynamic
viscosity (under Transport Properties).
12.
Using CFX-Solver
17. Run the solver. Does it converge within the 50
iterations which have been set? If not you can
click start again and the solver will continue
where it left off. (If, when tackling other problems,
it shows no prospect of converging after a
reasonable time, click stop and consider
modifying the modelling strategy).
Using CFX-Post
18. View streamlines, using the inlet as the location.
19. Create a line from 0.15,0,1 to 0.15,2 ,1 using a
cut line type. Now use this as the location for the
streamlines. (where the line cuts an element, a
seed point for a streamline is created.
20. Move the line to a location just downstream of the
cylinder.
Questions
Defining Polylines
Intersection Line
A line of intersection between a boundary (defined in
CFX-Pre) and a plane (defined in CFX-Post) may be
used.
File Input
A text file is written (outside CFX) containing coordinates of the points required, in a format shown by
the following example.
Coordinates may define a straight or curved line. Data
(eg pressures) will only be plotted at the points you
define, so if you want good resolution, you need plenty
of points, even if its a straight line.
0
0.01193
0.01436
0.01815
0.02508
0.03477
0.04202
0.04799
0.05732
0.06423
etc
0
0
0
0
0
0
0
0
0
0
xyz
coodinates,
delimited by
tabs or
spaces.
------
Coordinates
Coordinates m
m
Coordinates
Coordinates m
m
Coordinates
Coordinates m
m
Pressure
kgm^-1s^-2
Pressure
kgm^-1s^-2
Velocity
ms^-1
Velocity
ms^-1
0.00E+00
0.00E+00
7.22E-07
7.22E-07
0.00E+00
0.00E+00
5.05E-07
5.05E-07
0.00E+00
0.00E+00
6.70E-07
6.70E-07
2.00E+01
2.00E+01
1.88E-0
1.88E-0
1.89E+01
1.89E+01
1.87E-03
1.87E-03
1.79E+01
1.79E+01
1.94E-03
1.94E-03
-3.29E-05
-3.29E-05
7.86E-07
7.86E-07
6.24E-05
6.24E-05
Pressure (Pa)
0.00E+00
-5.00E+01
-1.00E+02
-1.50E+02
-2.00E+02
50
100
150
200