Anda di halaman 1dari 68

Computational Fluid Dynamics

Computational Fluid
Dynamics
Course Notes

Dr PK Dyson
Sep 2004

Computational Fluid Dynamics

CFD Overview
and
Introduction to CFX

Computational Fluid Dynamics

Introduction

What do you want to know?

What do you need to define?

Whats the physics?

Computational Fluid Dynamics

Solution of the Equations

Equations are solved numerically, at a series of


discrete points in the flow domain.
5 variables at 100,000 points implies what .?
Results can be viewed graphically and processed
to provide numerical outputs.
For most packages, the data stream is:
Geometry

CAD (usually)

>> Mesh creation

Mesh Generator

>> Fluid definition


>> Problem definition

Pre-processor

>> Solution

Solver

>> Viewing of Results

Post-processor

Computational Fluid Dynamics

ANSYS CFX Overview (1)


Start > University Software > ANSYS >
ANSYS 10
This starts the ANSYS Workbench
environment from which the various
individual components are launched.

Geometry CAD Import

Mesh Control
Parameters

DesignModeller
(*.agdb file)
CFX-Mesh
(*.cmdb file)

Geometry file
(*.gtm)

Computational Fluid Dynamics

ANSYS CFX Overview (2)


Geometry file
(*.gtm)
Problem
type
Solution
control
Case file (*.cfx)

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)

Computational Fluid Dynamics

ANSYS CFX Overview (3)


Definition
file (*.def)
Solver
Output
file (*.out)

Results
file (*.res)

(numerical data
in text file)

CFX-Post

Forces

Velocities
Streamlines

Numerical output

Pressures

(via calculator and export)

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

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

Contact with ANSYS-CFX Staff


IMPORTANT NOTE
If you encounter problems with CFX, then
by all means visit the CFX Community
pages (address is on the Resources
Sheet), but do not contact ANSYS-CFX
Staff until you have first discussed your
problems with UoP staff.
Contact with ANSYS-CFX should
normally be through UoP Staff.

Computational Fluid Dynamics

Theory Overview

Computational Fluid Dynamics

General Principles - Revision


Mass Continuity
u1

u2

For steady flow


1 A 1 v1 2 A 2 v 2

Momentum

net force acting on fluid


= rate of change of momentum
= change of rate of momm flow
=
how?

Computational Fluid Dynamics

Mass Continuity Equation (1)

mass-velocity
= u
y,v

z,w
x,u

y
x
v

Net rate of outflow of mass =


rate of depletion of mass in control volume

Computational Fluid Dynamics

Mass Continuity Equation (2)


u v w

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:

Computational Fluid Dynamics

Momentum Equation (1)


Force
Forceon
onControl
ControlVolume
Volume
==Rate
Rateof
ofChange
Changeof
ofMomentum
Momentum
Velocity Changes across Control Volume
x mom :
uvx
v
uvx
y
v
y
y
y
u

x mom :

u2y

u
x
x

x mom :

u
y
u2y
x
x

x mom :
uvx

Computational Fluid Dynamics

Momentum Equation (2)


Forces Acting in x-Direction
on Control Volume

y
x

Computational Fluid Dynamics

Momentum Equation (3)


Rate of Change of Momentum in x-direction

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

= 0 for steady flow


(from continuity)

Computational Fluid Dynamics

Momentum Equation (4)


Net force in x-direction

Computational Fluid Dynamics

The Navier-Stokes Equations


For:
steady state
2-dimensional
incompressible
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

Computational Fluid Dynamics

Navier-Stokes - Vector Notation

Dv

F P 2 v
Dt

Computational Fluid Dynamics

Navier-Stokes - Summation Convention


Taking u = u1

v = u2

w = u3

u jui, j fi P,i ui, j , j


(separate equation for each of i = 1 to 3
where
1, 2, 3 represent x, y, z directions
a subcripted comma and index represents a
derivitive
u
2v
i.e. u1,2
; u2,3 ,3
y
w 2
repeated subscript means set it to 1, 2, 3 in
turn and sum resulting variables
i.e. u ju1, j u1u1,1 u2u1,2 u3u1,3
u

(so what does

u
u
u
v
w
x
y
z
uj,j = 0

mean?)

Computational Fluid Dynamics

The Energy Equation


Internal generation
u

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

Computational Fluid Dynamics

Analytical Example - Couette Flow


Moving Plate - vel = us
s
y
x

Stationary plate

Infinitely
long

u v

0
x y

2u 2u
u
P
u
u
v X

2
2
y
x
y
x
x

Computational Fluid Dynamics

Solutions to the Equations


The set of equations for incompressible,
viscous, 2D steady flow is:
u v

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 Fluid Dynamics

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

Unknowns are determined at each grid point


Concept may be extended into time domain:
t

Computational Fluid Dynamics

Typical Grid Notation


i-1, j+1

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

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

Differencing Formulae (1)


u
ui+1
ui
i
i+1
x
Taylor Expansion
2u x 2 3u x 3
u
ui1 ui

....
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)

Computational Fluid Dynamics

Differencing Formulae (2)


Adding the Taylor Series equations:
4
4
2u

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

Computational Fluid Dynamics

The Equation Set


If we set up this set of equations at
each of n interior points in the domain,
and we know the boundary conditions
(b) at the exterior points .
b
b
b
b
b
b

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

Computational Fluid Dynamics

The Pressure Correction Approach


Semi-Implicit Method for Pressure Linked
Equations - SIMPLE !!!!
Guess a pressure field

Solve N-S equations


(not continuity)
Solution
for u,v, given these
process may guessed pressures
be iterative
or time
marching

Use modified
continuity
equation to
calculate a
pressure
correction

Do u, v values satisfy
continuity?
(convergence criterion)
Y
Finish

Computational Fluid Dynamics

Boundary Conditions (1)


Boundaries must be defined, but care must be
taken not to:
under-define boundaries (insufficient data
for solution)
over-define boundaries (creating a
physically impossible situation)
eg. With parameters defined on boundaries as
follows ..
wall
u=0,v=0
u=value
v=0
P=value

u=value
v=0
P=value
u=0,v=0

wall

model is over-defined since


velocity and pressure are stipulated
at inlet and outlet. Values may thus
not satisfy the continuity and
momentum equations.

Computational Fluid Dynamics

Boundary Conditions (2)


Boundaries defined will depend on nature
of equations to be solved (steady /
unsteady, incompressible / compressible,
inviscid / viscous)
For example, for steady, incompressible,
viscous flow, solved by pressure correction
method, boundaries conditions may be:
u 0, v 0
v=0
P= value

P= value

u 0, v 0

Computational Fluid Dynamics

Grids (1)
Structured Mesh
usually comprising quadrilateral elements
Physical Space
eg. circular duct

Computational
Space

Computational Fluid Dynamics

Grids (2)
Aerofoil Section (Example of structured
mesh, refined in critical regions)

Computational Fluid Dynamics

Grids (3)
Unstructured Mesh
usually based on triangular pyramids
(eg CFX 5)

Important Modelling Considerations


Grid refinement in critical areas
Grid independent solution - checks required
Computationally economic model
coarse grid in non-critical areas
make use of symmetry and periodic
boundary conditions
use 2-D and axi-symmetric models
where possible

Computational Fluid Dynamics

Turbulence

vel at
a point

time

Computational Fluid Dynamics

Introduction to Turbulence Modelling


Laminar Flow

Turbulent Flow

Momentum
diffusion
by viscosity
Additional momentum
diffusion due to turbulence
Concept of
turbulent (or eddy)
viscosity, t

t is not a fluid property, but depends


on level of turbulence in flow
concept leads to mathematical models
to deal with turbulence; each model is
an approximation to what is really
happening
one popular model (k-epsilon model)
introduces two further unknowns:
uu22 vv22 ww22
kk the
the turbulent
turbulent kinetic
kinetic enegy
enegy
22
the
the rate
rate dissipatio
dissipationn of
of turbulent
turbulent KE
KE

Computational Fluid Dynamics

Turbulence Modelling the Maths


Think of u,v,w and p as comprising of two parts:
ensemble average values and turbulent fluctuations.

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

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

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

where t is the coefficient for turbulent viscosity and


is linked to the turbulent kinetic energy k and
dissipation . The two extra equations that are
needed for the closure are the transport equations
for k and .

k
. U k .
t


. U .
t

t
k Pk
k

t
C1 Pk C 2

Computational Fluid Dynamics

k- Model Theory (continued)


Where

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

The (empirical) constants in the k- model


are usually:

c 0.09, k 1.0; 1.30


c1 1.44, c 2 1.92

Computational Fluid Dynamics

k- Turbulence Model - Summary


requires two further equations, similar to
Navier-Stokes equations for k and
thus requires
inlet values for k and
initial guesses for k and
estimates for these may be obtained from
equations such as the following, available in
the literature
kk 11..55 UU

22

u
where is the turbulence int ensity
2

1
2

k2

( for free shear flow )

where L is characteristic eddy length 0.1


and is the characteristic shear layer width
sensitivity to inlet turbulence quantities
should be checked, and may point to
the need for experimentally derived
values for use in the CFD model.

Computational Fluid Dynamics

CFD Health Warning !


We have barely scratched the surface of the
theory of CFD. A few of the possible areas
for further fruitful reading are:
nature of the equations under different
conditions - hyperbolic, parabolic, elliptic.
transient problems
choice of boundary and initial conditions
coupling between momentum and energy
equations (especially in buoyancy driven
flows)
supersonic flows and shock capture
turbulence modelling - what alternative
models are available?
wall boundary conditions (log law of the
wall)
Treat CFD with respect - a little knowledge is
a dangerous thing !

Computational Fluid Dynamics

Exercises

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

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

Computational Fluid Dynamics

Now make sure you understand ..


Whats
Whatsthe
thedifference
differencebetween
between
Sketching
Sketchingmode
modeand
andmodelling
modellingmode
mode
DesignModeller
DesignModellerand
andCFX-Mesh
CFX-Mesh
Surface
SurfaceMesh
Meshand
andVolume
VolumeMesh
Mesh

and now consolidate what youve done


by looking through this example .

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.

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

Finding Out More The Help Pages


Help on ANSYS Workbench, DesignModeller and
CFX-Mesh is available on the Workbench Help button
and the subsequent Folder Tree

Help on CFX Pre, Solver and Post is accessed from


the Advanced CFD panels (-Pre, -Solver, -Post) by
clicking:
Help > Master contents

Now
Nowuse
usethe
theHelp
Helppages
pagesto
toanswer
answerthe
thefollowing
following
questions.
questions.

Computational Fluid Dynamics

Finding Out More


ANSYS Workbench Help > CFX-Mesh Help
What is the principle type of mesh utilised by CFX?
What is its advantage over a quasi-rectangular
mesh?
What is mesh control? Why use it?
What is inflation? Why use it?
What is a mesh independent solution? (Carry out a
search using mesh NEAR independent as
keywords. Make sure that pages referred to are for
CFX-Mesh or DesignModeller; pages referring to, for
example, DesignXplorer or Simulation (top left of
page) are not relevant to you)
CFX Help > CFX-Pre > Fluid Domains
What options are available for the fluid domain
models?
What standard fluids are available?
CFX Help > CFX-Pre > Boundary Conditions
What boundary conditions are available?
CFX Help > CFX-Pre > Initial Conditions
Why are initial values set?
CFX Help > CFX-Pre > Solver Control
What are convergence criteria?

Computational Fluid Dynamics

Treatment of Walls and Flow


Boundaries
Further reading from CFX Help pages:
Near Wall Modelling
(ANSYS CFX-Solver 10.0 Modelling > Turbulence
& Near Wall Modelling - Modelling Flow Near the
Wall)
Boundary Condition Modelling
(ANSYS CFX-Solver 10.0 Modelling - Boundary
Condition Modelling)

Computational Fluid Dynamics

Exercise 4

y
x

Although this is an external flow, (as opposed to


the previous pipe example which was internal),
we still need to define a limit to the domain. This
will effectively be a wind tunnel in which the
cylinder will be placed.
We will treat this as a 2-D example by making
the fluid domain thin in the x direction and
attaching the cylinder to the wall at each side.
You should create a new folder for this problem.

Computational Fluid Dynamics

Using Ansys DesignModeller


1. Sketch surface A (the low-x surface) as a
rectangle.
2. Sketch the circle (rectangle and circle will both
be part of sketch 1)
3. Extrude in the x direction.
The
The3D
3Dbody
bodyformed
formedby
bythe
thebox
boxwith
withthe
thecylinder
cylindercut
cut
out,
out,sometimes
sometimesconfusingly
confusinglyreferred
referredto
toas
asthe
thesolid,
solid,isis
where
wherethe
thefluid
fluidwill
willflow.
flow.

0.3
2

1
x

10
2

z
point 0 0 0

surface A
diameter 0.3

Computational Fluid Dynamics

Using Ansys CFX-Mesh


IfIfwe
wewant,
want,say,
say,around
around66elements
elementsininthe
theregion
regionwith
with
the
themost
mostcoarse
coarsemesh
mesh(near
(nearthe
theexit),
exit),then
thenthis
thisgives
gives
aadefault
defaultmesh
meshlength
lengthof
ofabout
about0.3
0.3m.
m.Since
Sincethis
thisisisaa
2D
2Dproblem,
problem,ititneeds
needsonly
onlyto
tobe
be11element
elementthick,
thick,
which
whichisiswhy
whywe
wealso
alsomake
makethe
thebox
boxwidth
width0.3
0.3m.
m.
Would
Wouldmaking
makingititthicker
thickergive
giveany
anybenefit
benefitor
orpenalty?
penalty?

4. Open CFX-Mesh and create a 2-D region for each


of the surfaces (left, right, inlet, outlet, cylinder
leave top & bottom undefined they will form the
default 2D region), giving each a suitable name
(you will use these later to define boundary
conditions).
5. Set mesh default body spacing to a maximum of
0.3 m.
6. Set up Inflation parameters (use defaults) and
apply inflation to the cylinder with a maximum
thickness of 0.03 m.

Computational Fluid Dynamics

7. Place mesh controls to refine the mesh in the


region of the cylinder and its wake.
8. Create surface mesh, and check it to ensure it is
refined in the appropriate places.
9. Create the volume mesh (thus writing the .gtm file)
and start CFX-Pre.

Computational Fluid Dynamics

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.

Create boundary conditions:


non-slip smooth wall on the cylinder
free slip wall on top and bottom surfaces (why?)
symmetry on the left surface (why?)
symmetry on the right surface
inlet velocity giving Re=105 based on cylinder
diameter
outlet velocity set to average static pressure of 0
Pa.

Computational Fluid Dynamics

13. You can check and edit Boundary Conditions by


double clicking on the relevant condition in Object
Selector. Note that the Default boundary
condition (a no-slip wall) applies to any boundary
which is undefined.
14. Apply defaults for initial values.
15. Apply defaults for the solver parameters, except
number of iterations which you should change to
50.
16. Write definition file and go to Solver.

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

21. Draw vectors and a pressure profile based on one of


the side walls. Experiment with different
arrangements of streamlines, different lengths of
vector arrow, and with a shaded pressure plot (by
checking the Draw Faces box on the Render
panel).
22. Print one of the plots to a JPEG file using File - Print,
and check the White background box. This could
later be included in a report.
23. Use the line which you created earlier to produce a
chart (ie a graph) showing how the z-direction
velocity varies across the wake at a position just
downstream of the cylinder.
24. Use the calculator to find the total force on the
cylinder in the z-direction. Compare this with the
drag shown in the .out file (you will need to add 2
values from .out together to get the drag - why?).
Calculate the drag coefficient - is it anywhere near
correct?

Computational Fluid Dynamics

With a bit of cunning, and judicious use mesh controls


and CFX-Post, this is possible ..

Computational Fluid Dynamics

Modifying the Model


Try placing an extra cylinder in close to the first.
What is the effect on the flow and the drag on the
cylinders?

Computational Fluid Dynamics

Questions

What is the effect of having a very narrow (say


0.01) or a very wide (say 3.0) box?

How does the proximity of the top and bottom


walls affect the solution?

How does the position of the upstream and


downstream boundary affect the solution?

Could a plane of symmetry have been used to


reduce the computational time?

Computational Fluid Dynamics

Extracting Numerical Data


The most useful ways of extracting numerical data are:
Output File. *.out file contains text based data on both
solution and results. In particular there is a listing of
forces (x, y, z components, normal and tangential)
acting on all defined boundaries.
Calculation Facilities. CFX-Post has capability of
calculating certain quantities (eg total mass flow
through a boundary). See help files for information.
Charts. CFX-Post can display line graphs of variation
of a variable in space or time. Firstly a line in space, a
polyline, has to be defined (see over). Then the chart
icon leads you through appropriate menus.
Unfortunately hard copy of charts is tricky, so it is
easier to export the chart data and use Excel to plot it.

Computational Fluid Dynamics

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.

Computational Fluid Dynamics

Polyline Data File


0
0.005
0.0075
0.0125
0.025
0.05
0.075
0.1
0.15
0.2

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.

The Polyline is loaded


using the Polyline
icon

Computational Fluid Dynamics

Exporting Data from CFX-Post


Once a polyline has been defined a chart may be
produced.
Also the variables may be exported for points defined
by the polyline using File Export.
Select the variables required (eg x, y, z, pressure
(hold down control to make multiple selections)) and
locator (eg polyline1) and give an appropriate file
name.
The data is formatted as a series of x-y-z coordinates, and values for the parameters plotted.
The example overleaf shows x, y, z co-ordinates
together with values for P, u, v, w. This has been
tidied up by loading the file into Excel, using space
and ( characters to delimit data, and then carrying
out a search and replace to get rid of ) characters.

Computational Fluid Dynamics

Exporting Data - Example File


##
$x
$x
##
$y
$y
##
$z
$z
##
$1
$1
##
$2
$2
##
-6.12E-16
-6.12E-16
1.89E-07
1.89E-07
-5.48E-16
-5.48E-16
7.92E-08
7.92E-08
-4.83E-16
-4.83E-16
2.48E-06
2.48E-06

------

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

Note: data here for each point stretches across 2 lines as


velocity has 3 components.

After manipulation in Excel, a chart can be plotted:


Pressure around a Cylinder
5.00E+01
Angle (deg)

Pressure (Pa)

0.00E+00
-5.00E+01
-1.00E+02
-1.50E+02
-2.00E+02

50

100

150

200

Anda mungkin juga menyukai