This action might not be possible to undo. Are you sure you want to continue?
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?
What‟s 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
>> Mesh creation
>> Fluid definition
>> Problem definition
>> Solution
>> Viewing of Results
CAD (usually)
Preprocessor
Solver
Postprocessor
Mesh Generator
Computational Fluid Dynamics
ANSYS – CFX Overview (1)
Start > University Software > ANSYS >
ANSYS 10
Geometry
DesignModeller
(*.agdb file)
CFXMesh
(*.cmdb file)
Geometry file
(*.gtm)
Mesh Control
Parameters
This starts the ANSYS Workbench
environment from which the various
individual components are launched.
CAD Import
Computational Fluid Dynamics
ANSYS – CFX Overview (2)
Boundary
conditions
Fluid
properties
Problem
type
Solution
control
Definition
file (*.def)
Session file
(*.ses) holds
record of
commands
entered during
session
Journal file (*.jou)
holds record of
commands for
particular
database
Case file (*.cfx)
CFXPre
Geometry file
(*.gtm)
Computational Fluid Dynamics
CFXPost
Solver
ANSYS – CFX Overview (3)
Definition
file (*.def)
Results
file (*.res)
Output
file (*.out)
Velocities
Streamlines
Pressures
Turbulence
Forces
(numerical data
in text file)
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
Numerical output
(via calculator and export)
Computational Fluid Dynamics
File Management
• Create a “MyCFX” folder on the local hard drive
and put each job in a different subfolder.
• 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 ANSYSCFX 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 ANSYSCFX
Staff until you have first discussed your
problems with UoP staff.
Contact with ANSYSCFX should
normally be through UoP Staff.
Computational Fluid Dynamics
Theory Overview
Computational Fluid Dynamics
General Principles  Revision
Momentum
Mass Continuity
u
2
u
1
net force acting on fluid
= rate of change of momentum
= change of rate of mom‟m flow
=
2 2 2 1 1 1
v A v A µ = µ
how?
For steady flow
Computational Fluid Dynamics
Mass Continuity Equation (1)
ox
oy
x,u
y,v
massvelocity
= µu
µv
z,w
Net rate of outflow of mass =
rate of depletion of mass in control volume
Computational Fluid Dynamics
Mass Continuity Equation (2)
( ) ( ) ( )
0
z
w
y
v
x
u
Dt
D
0
z
w
y
v
x
u
z
w
y
v
x
u
t
0
z
w
y
v
x
u
t
=
(
¸
(
¸
c
c
+
c
c
+
c
c
µ +
µ
=
(
¸
(
¸
c
c
+
c
c
+
c
c
µ +
c
µ c
+
c
µ c
+
c
µ c
+
c
µ c
=
c
µ c
+
c
µ c
+
c
µ c
+
c
µ c
Substantial
derivative
For incompressible flow, this becomes:
Computational Fluid Dynamics
Momentum Equation (1)
ox
oy
u
v
Force on Control Volume
= Rate of Change of Momentum
Velocity Changes across Control Volume
y u
: mom x
2
o µ
÷
( )
x
x
y u
y u
: mom x
2
2
o
c
o µ c
+ o µ
÷
x
x
u
u o
c
c
+
y
y
v
v o
c
c
+
( )
y
y
x uv
x uv
: mom x
o
c
o µ c
+ o µ
÷
x uv
: mom x
o µ
÷
Computational Fluid Dynamics
Momentum Equation (2)
Forces Acting in xDirection
on Control Volume
ox
oy
Computational Fluid Dynamics
Momentum Equation (3)
Rate of Change of Momentum in xdirection
( ) ( )
( ) ( )
( ) ( )
y x
y
u
v
x
u
u
y
v
x
u
u
y x
y
v
u
y
u
v
x
u
u
x
u
u
y x v u
y
x y u
x
2
o o
(
¸
(
¸

.

\

c
c
+
c
c
µ =

.

\

c
µ c
+
c
µ c
o o
(
¸
(
¸
c
µ c
+
c
c
µ +
c
µ c
+
c
c
µ =
o o µ
c
c
+ o o µ
c
c
=
= 0 for steady flow
(from continuity)
Computational Fluid Dynamics
Momentum Equation (4)
Net force in xdirection
Computational Fluid Dynamics
The NavierStokes Equations
• steady state
• 2dimensional
• incompressible


.

\

c
c
+
c
c
µ +
c
c
÷ = 
.

\

c
c
+
c
c
µ


.

\

c
c
+
c
c
µ +
c
c
÷ = 
.

\

c
c
+
c
c
µ
2
2
2
2
2
2
2
2
y
v
x
v
y
P
Y
y
v
v
x
v
u
y
u
x
u
x
P
X
y
u
v
x
u
u
For:
Computational Fluid Dynamics
NavierStokes  Vector Notation
( ) v P F
Dt
v D
2
V µ + V ÷ = µ
Computational Fluid Dynamics
NavierStokes  Summation Convention
( ) ( )
j ,
j , i i , i j , i j
u P f u u µ + ÷ = µ
Taking u = u
1
v = u
2
w = u
3
(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
• repeated subscript means set it to 1, 2, 3 in
turn and sum resulting variables
( )
2
2
3 ,
3 , 2 2 , 1
w
v
u ;
y
u
u . e . i
c
c
=
c
c
=
z
u
w
y
u
v
x
u
u
u u u u u u u u . e . i
3 , 1 3 2 , 1 2 1 , 1 1 j , 1 j
c
c
+
c
c
+
c
c
=
+ + =
(so what does u
j,j
= 0 mean?)
Computational Fluid Dynamics
The Energy Equation
ox
oy
u
v
Convection
with mass transfer
Conduction
by temperature gradient
Internal generation
(
(
¸
(

.

\

c
c
+
c
c
+

.

\

c
c
+
c
c
+

.

\

c
c
+
c
c
+

.

\

c
c
+

.

\

c
c
+
¸

.

\

c
c
= u
u µ +


.

\

c
c
+
c
c
=

.

\

c
c
+
c
c
µ
2
2
2
2
2
2
2
2
2
2
p
y
w
z
v
x
w
z
u
x
v
y
u
z
w
2
y
v
2
x
u
2
y
T
x
T
k
y
T
v
x
T
u C
where
Computational Fluid Dynamics
Analytical Example  Couette Flow
Stationary plate
Moving Plate  vel = u
s
s
Infinitely
long
0
y
v
x
u
=
c
c
+
c
c


.

\

c
c
+
c
c
µ +
c
c
÷ = 
.

\

c
c
+
c
c
µ
2
2
2
2
y
u
x
u
x
P
X
y
u
v
x
u
u
x
y
Computational Fluid Dynamics
Solutions to the Equations
The set of equations for incompressible,
viscous, 2D steady flow is:
0
y
v
x
u
=
c
c
+
c
c


.

\

c
c
+
c
c
µ +
c
c
÷ = 
.

\

c
c
+
c
c
µ


.

\

c
c
+
c
c
µ +
c
c
÷ = 
.

\

c
c
+
c
c
µ
2
2
2
2
2
2
2
2
y
v
x
v
y
P
Y
y
v
v
x
v
u
y
u
x
u
x
P
X
y
u
v
x
u
u
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:
x
y
t
Computational Fluid Dynamics
Typical Grid Notation
i, j
i, j+1
i, j1
i1, j+1
i1, j
i1, j1
i+1, j+1
i+1, j
i+1, j1
x A
y A
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
x
u
i+1
u
i
i i+1
Taylor Expansion
( )
( )
( )
( )
2
1 i 1 i
i
3
i
3
3
i
1 i 1 i
3
i
3
3
2
i
2
2
i
i 1 i
3
i
3
3 2
i
2
2
i
i 1 i
x O
x 2
u u
x
u
....
6
x
x
u
2 x
x
u
2 u u
: g Subtractin
....
6
x
x
u
2
x
x
u
x
x
u
u u
Also
....
6
x
x
u
2
x
x
u
x
x
u
u u
A +
A
÷
=

.

\

c
c
+
A


.

\

c
c
+ A

.

\

c
c
= ÷
+
A ÷


.

\

c
c
+
A ÷


.

\

c
c
+ A ÷

.

\

c
c
+ =
+
A


.

\

c
c
+
A


.

\

c
c
+ A

.

\

c
c
+ =
÷ +
÷ +
÷
+
(second order
central difference)
Computational Fluid Dynamics
Differencing Formulae (2)
Adding the Taylor Series equations:
( )
2
2
1 i i 1 i
i
2
2
4
i
4
4
2
i
2
2
i 1 i 1 i
x O
x
u u 2 u
x
u
....
12
x
x
u
x
x
u
u 2 u u
A +
A
+ ÷
=


.

\

c
c
+
A


.

\

c
c
+ A


.

\

c
c
+ = +
÷ +
÷ +
Thus, if we take, say, the x direction
NS equation (steady for simplicity):
(
¸
(
¸

.

\

A
÷ ÷
+ 
.

\

A
+ ÷
µ +

.

\

A
÷
=
(
¸
(
¸

.

\

A
÷
+ 
.

\

A
÷
µ


.

\

c
c
+
c
c
µ +
c
c
= 
.

\

c
c
+
c
c
µ
÷ + ÷ +
÷ + ÷ + ÷ +
2
1 j , i j , i 1 j , i
2
j , 1 i j , i j , 1 i
j , 1 i j , 1 i 1 j , i 1 j , i
j , i
j , 1 i j , 1 i
j , i
2
2
2
2
y
u u 2 u
x
u u 2 u
x 2
P P
y 2
u u
v
x 2
u u
u
becomes
y
u
x
u
x
P
y
u
v
x
u
u
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 nonlinear, so an
iterative approach is usually employed  eg.
guess u, v for the domain
and insert as u
i,j
, v
i,j
in previous set of equations
solve equations
for u, v, P
check
convergence
insert revised
values of u
i,j
,v
i,j
Computational Fluid Dynamics
The Pressure Correction Approach
SemiImplicit Method for Pressure Linked
Equations  SIMPLE !!!!
Guess a pressure field
Use modified
continuity
equation to
calculate a
pressure
correction
Do u, v values satisfy
continuity?
(convergence criterion)
Finish
Y
N
Solution
process may
be iterative
or time
marching
Solve NS equations
(not continuity)
for u,v, given these
guessed pressures
Computational Fluid Dynamics
Boundary Conditions (1)
Boundaries must be defined, but care must be
taken not to:
• underdefine boundaries (insufficient data
for solution)
• overdefine boundaries (creating a
physically impossible situation)
eg. With parameters defined on boundaries as
follows …..
u=value
v=0
P=value
u=0,v=0
u=0,v=0
wall
wall
……… model is overdefined since
velocity and pressure are stipulated
at inlet and outlet. Values may thus
not satisfy the continuity and
momentum equations.
u=value
v=0
P=value
Computational Fluid Dynamics
Boundary Conditions (2)
For example, for steady, incompressible,
viscous flow, solved by pressure correction
method, boundaries conditions may be:
v = 0
P= value
P= value
0 v , 0 u = =
0 v , 0 u = =
Boundaries defined will depend on nature
of equations to be solved (steady /
unsteady, incompressible / compressible,
inviscid / viscous)
Computational Fluid Dynamics
Grids (1)
Computational
Space
Structured Mesh
usually comprising quadrilateral elements
Physical Space
eg. circular duct
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 noncritical areas
•make use of symmetry and periodic
boundary conditions
•use 2D and axisymmetric models
where possible
Computational Fluid Dynamics
Turbulence
u‟
U
vel at
a point
time
Computational Fluid Dynamics
Introduction to Turbulence Modelling
Laminar Flow Momentum
diffusion
by viscosity
Turbulent Flow
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 (kepsilon model)
introduces two further unknowns:
KE turbulent of n dissipatio rate the
2
w v u
enegy kinetic turbulent the k
2 2 2
÷ c
'
+
'
+
'
= ÷
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.
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 NavierStokes
equations and taking the ensemble average, we now
get
p p p w w w v v v u u u
'
+ =
'
+ =
'
+ =
'
+ = , , ,


.

\

' '
÷
c
c
v
c
c
+
c
c
µ
÷ =
c
c
+
c
c
=
c
c
j
i
j
i
j i j
i
j
i
j
j
u u
x
u
x x
p 1
x
u
u
t
u
: momentum
0
x
u
: continuity
Computational Fluid Dynamics
• Equations (also called Reynolds equations) for
ensemble average values are identical to the Navier
Stokes equation except for the crossproducts of
the fluctuation terms.
• 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 crossproduct terms.
Turbulence Closure
( ) ( ) ( ) ( ) ( ) ( ) w v , w u , v u , w , v , u
2 2 2
' ' ' ' ' ' ' ' '
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 secondorder 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.


.

\

c
c
+
c
c
µ =
' '
µ ÷ = t
i
j
j
i
t
j
i ij
x
u
x
u
u u
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 ε.
( )
( )
( )
( ) ( ) µc ÷
c
+
(
¸
(
¸
c V


.

\

o
µ
+ µ V = c µ V +
c
µc c
µc ÷ +
(
¸
(
¸
V 
.

\

o
µ
+ µ V = µ V +
c
µ c
c c
c
2 k 1
t
k
k
t
C P C
k
. .
t
P k . .
t
k
U
U k
Computational Fluid Dynamics
The (empirical) constants in the kε model
are usually:
92 . 1 c , 44 . 1 c
30 . 1 ; 0 . 1 , 09 . 0 c
2 1
k
= =
= o = o =
c c
c µ
Where
( )
( ) ( ) k . .
3
2
P
k
c
x
u
x
u
e ; e e 2
w v u
2
1
k
T
t k
2
t
i
j
j
i
ij ij ij
2 2 2
µ + V V ÷ V + V V µ =
c
µ = µ
c
'
c
+
c
'
c
=
' ' '
v = c
'
+
'
+
'
=
µ
U U U U U.
t
3μ
kε Model – Theory (continued)
Computational Fluid Dynamics
k c Turbulence Model  Summary
• requires two further equations, similar to
NavierStokes equations for k and c
• thus requires
• inlet values for k and c
• initial guesses for k and c
• estimates for these may be obtained from
equations such as the following, available in
the literature
( )
2
U 5 . 1 k
·
I =
• sensitivity to inlet turbulence quantities
should be checked, and may point to
the need for experimentally derived
values for use in the CFD model.
( )
·
'
= I
U
u
ensity int turbulence the is where
2
1
2
) flow shear free for (
k
L
2
3
o
= c
width layer shear stic characteri the is and
1 . 0 length eddy stic characteri is where
L
o
o ~ o
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 folder MyCFX and a subfolder Tutorial_1
Start ANSYS CFX 10.0.
In the Launcher, set the Working Directory to the sub
folder you have just created and then go to ANSYS >
Workbench 10.0.
In the Start panel that now opens, click Empty Project
(under “New”)
Go to Help > ANSYS DesignModeller Help. In the
Contents panel, expand the CFXMesh Help tree and
click Tutorials. Click “Click here”.
Work through Tutorial 1: Static Mixer.
This will take you through:
•Geometry creation using DesignModeller
•Mesh generation using CFXMesh
At the end of this tutorial, under the paragraph “If you
want to continue by working through the ANSYS CFX
example …”, follow steps 1, 2 and 3 to open the mesh in
CFXPre.
Now click Help > Tutorials which will take you into the
CFX (Fluid Modelling) Tutorials (as opposed to the
DesignModeller/CFXMesh (Solid Modelling) Tutorial you
have just been working through) and click “Flow in a
Static Mixer”.
Computational Fluid Dynamics
Exercise 1 (continued)
Continue with this tutorial, but note the instructions in
para 4 at the end of the DesignModeller Tutorial:
“… missing out the instructions in the section “Creating a
New Simulation”. Note that you do not need to copy the
sample file StaticMixerMesh.gtm to your working
directory if you have just created the mesh in CFXMesh,
since you will want to use your new mesh and not the
one supplied with ANSYS CFX. For the “Importing a
Mesh” section, the only action that you need to carry out
is to select Assembly from the Select Mesh dropdown
list, as the mesh is loaded automatically when you start
ANSYS CFX in the manner described above. “
This will take you through:
•Problem Definition using CFXPre
•Solution using CFX Solver Manager
•Viewing of results using CFXPost
Computational Fluid Dynamics
Now make sure you understand …..
What‟s the difference between
•Sketching mode and modelling mode
•DesignModeller and CFXMesh
•Surface Mesh and Volume Mesh
In ANSYS Workbench go to Help > ANSYS
Workbench Help and in the Contents Tree go to
DesignModeller Help > Welcome to the
DesignModeller 10.0 Help > Process for Creating a
Model
Read through the pages and run the video sequences
to remind yourself of the process of creating a
geometry.
… and now consolidate what you’ve done
by looking through this example ….
Computational Fluid Dynamics
Work through Tutorial 2, Static Mixer (Refined
Mesh) which will show you:
• more about the mesh generation process
• modifying geometry
• use of CFX Command Language (CCL) to avoid
too many repetitive keystrokes.
As before you will need to start in the
DesignModeller/CFXMesh (Solid Modelling)
Tutorial and switch to the CFX (Fluid Modelling)
Tutorial.
Exercise 2
Computational Fluid Dynamics
Refine the mesh even further in the outlet region of
the mixer by inserting a mesh control as follows.
• Reopen StaticMixer in CFXMesh
• Right click Control > Insert Point Spacing
• Click Point Spacing 1 in Detail View and change
the settings to: Length scale 0.1 m, Radius of
Influence 0.5 m, Expansion Factor 1.2
• Right click Point Spacing > Insert Line Control
• Click Line Control 1
• In Detail View, for point 1 click Apply, and accept
coordinates as 0,0,0. Repeat for point 2 and make
coordinates 0,0,2. Click in the box next to
spacing, then click Point Spacing 1 in Tree View
& click Apply.
• Right click Body 1 > Suppress and observe
position of Line Control. Unsuppress Body 1.
• Generate the surface mesh as before and note the
difference around the exit.
• Generate Volume Mesh, apply the physics (use
import CCL in Pre), Run Solver and view results.
Exercise 3
Computational Fluid Dynamics
Finding Out More – The Help Pages
Help on CFX Pre, Solver and Post is accessed from
the Advanced CFD panels (Pre, Solver, Post) by
clicking:
Help > Master contents
Help on ANSYS Workbench, DesignModeller and
CFXMesh is available on the Workbench Help button
and the subsequent Folder Tree
Now use the Help pages to answer the following
questions.
Computational Fluid Dynamics
Finding Out More
ANSYS Workbench Help > CFXMesh Help
•What is the principle type of mesh utilised by CFX?
What is its advantage over a quasirectangular
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
CFXMesh or DesignModeller; pages referring to, for
example, DesignXplorer or Simulation (top left of
page) are not relevant to you)
CFX Help > CFXPre > Fluid Domains
•What options are available for the fluid domain
models?
•What standard fluids are available?
CFX Help > CFXPre > Boundary Conditions
•What boundary conditions are available?
CFX Help > CFXPre > Initial Conditions
•Why are initial values set?
CFX Help > CFXPre > Solver Control
•What are convergence criteria?
Computational Fluid Dynamics
Treatment of Walls and Flow
Boundaries
Near Wall Modelling
(ANSYS CFXSolver 10.0 Modelling > Turbulence
& Near Wall Modelling  Modelling Flow Near the
Wall)
Boundary Condition Modelling
(ANSYS CFXSolver 10.0 Modelling  Boundary
Condition Modelling)
Further reading from CFX Help pages:
Computational Fluid Dynamics
Exercise 4
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 2D 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.
y
z x
Computational Fluid Dynamics
1. Sketch surface A (the lowx surface) as a
rectangle.
2. Sketch the circle (rectangle and circle will both
be part of sketch 1)
3. Extrude in the x direction.
0.3
2
10
x
z
y
point 0 0 0
surface A
Using Ansys DesignModeller
1
2
diameter 0.3
The 3D body formed by the box with the cylinder cut
out, sometimes confusingly referred to as the “solid”, is
where the fluid will flow.
Computational Fluid Dynamics
Using Ansys CFXMesh
4. Open CFXMesh and create a 2D 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.
If we want, say, around 6 elements in the region with
the most coarse mesh (near the exit), then this gives
a default mesh length of about 0.3 m. Since this is a
2D problem, it needs only to be 1 element thick,
which is why we also make the box width 0.3 m.
Would making it thicker give any benefit or penalty?
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 CFXPre.
Computational Fluid Dynamics
10. Create a fluid domain  use standard air or water,
select steady state, kc turbulence model, scalable
wall function, isothermal, nonbuoyant. 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:
• nonslip 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=10
5
based on cylinder
diameter
• outlet velocity set to “average static pressure” of 0
Pa.
Using CFXPre
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 noslip 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
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).
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.
Using CFXSolver
Using CFXPost
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 zdirection
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 zdirection. 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 CFXPost, 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. CFXPost has capability of
calculating certain quantities (eg total mass flow
through a boundary). See help files for information.
Charts. CFXPost 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
CFXPre) and a plane (defined in CFXPost) may be
used.
File Input
A text file is written (outside CFX) containing co
ordinates 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 it‟s a straight line.
Computational Fluid Dynamics
Polyline Data File
0 0 0
0.005 0.01193 0
0.0075 0.01436 0
0.0125 0.01815 0
0.025 0.02508 0
0.05 0.03477 0
0.075 0.04202 0
0.1 0.04799 0
0.15 0.05732 0
0.2 0.06423 0
etc
x y z
coodinates,
delimited by
tabs or
spaces.
The Polyline is loaded
using the “Polyline”
icon
Computational Fluid Dynamics
Exporting Data from CFXPost
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 xyz co
ordinates, and values for the parameters plotted.
The example overleaf shows x, y, z coordinates
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  Coordinates m
# $y  Coordinates m
# $z  Coordinates m
# $1  Pressure kgm^1s^2
# $2  Velocity ms^1
#
6.12E16 0.00E+00 2.00E+01 3.29E05
1.89E07 7.22E07 1.88E0
5.48E16 0.00E+00 1.89E+01 7.86E07
7.92E08 5.05E07 1.87E03
4.83E16 0.00E+00 1.79E+01 6.24E05
2.48E06 6.70E07 1.94E03
Note: data here for each point stretches across 2 lines as
velocity has 3 components.
Pressure around a Cylinder
2.00E+02
1.50E+02
1.00E+02
5.00E+01
0.00E+00
5.00E+01
0 50 100 150 200
Angle (deg)
P
r
e
s
s
u
r
e
(
P
a
)
After manipulation in Excel, a chart can be plotted:
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.