61
Computational Fluid Dynamics Computational Fluid Dynamics Course Notes Original notes: Dr PK Dyson, modified by: Dr. Ashwini K. Otta Sep 2004

Computational Fluid Dynamics Course Notes

  • Upload
    gunda

  • View
    124

  • Download
    6

Embed Size (px)

DESCRIPTION

Computational Fluid Dynamics Course Notes. Original notes: Dr PK Dyson, modified by: Dr. Ashwini K. Otta Sep 2004. What is Computational Fluid Dynamics ?. What are the elements of CFD? Mathematical description of the fluid behaviour Numerical discretisation - PowerPoint PPT Presentation

Citation preview

Page 1: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Computational Fluid Dynamics

Course Notes

Original notes: Dr PK Dyson, modified by: Dr. Ashwini K. OttaSep 2004

Page 2: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

What is Computational Fluid Dynamics ?

Page 3: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

What are the elements of CFD?

Mathematical description of the fluid behaviour

Numerical discretisation

Solution of the discretised problem

Visualisation of the result

Page 4: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Mathematical description ….

A few basic terms:

Velocity Vector

Steady and unsteady flow

Point (Eulerian) and Lagrangian velocity

Streamlines

Page 5: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Mathematical description ….

Basic equations governing the fluid behaviour

Equation of continuity

Equation of momentum

Property of fluid

Transport of temperature

Variables: density (ρ), velocity ( u,v,w),

pressure (P), temperature (T)

Page 6: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

The mathematical description …

No knowledge can be certain, if it is not based upon mathematics or upon some other knowledge which is itself based upon the mathematical sciences.

Leonardo da Vinci (1425-1519)

Page 7: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

General Principles - Revision

Momentum

Mass Continuityu2u1

net force acting on a fluid (control) volume= rate of change of momentum+ net momentum flux through

the surface

?222111 uAuA

how?

Page 8: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Mass Continuity Equation (1)

x

y

x,u

y,v

mass-velocity= u

vz,w

Net rate of outflow of mass =rate of depletion of mass in control volume

Page 9: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Mass Continuity Equation (2)

0zw

yv

xu

DtD

0zw

yv

xu

zw

yv

xu

t

0zw

yv

xu

t

Substantialderivative

For incompressible flow, this becomes:

0

z

w

y

v

x

u

Page 10: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Momentum Equation (1)

x

yu

v

Force on Control Volume= Rate of Change of Momentum in the volume +net momentum flux through the surface

Force on Control Volume= Rate of Change of Momentum in the volume +net momentum flux through the surface

Velocity Changes across Control Volume

yu

:momx2

x

xyu

yu

:momx2

2

xxu

u

yyv

v

y

yxuv

xuv

:momx

xuv

:momx

Page 11: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Momentum Equation (2)

Forces Acting in x-Directionon Control Volume

x

y

Forces:

Body: acting over the volume (X)

Surface: Normal (Pressure)

Tangential (shear)

X

Page 12: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Momentum Equation (3)

Net Momentum Flux in x-direction(for a 2D fluid motion)

yxyu

vxu

u

yv

xu

u

yxyv

uyu

vxu

uxu

u

yxvuy

xyux

2

Page 13: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Momentum Equation (4)

Net force in x-direction

•Body force in X-direction: usually zero

•Normal force: pressure

•Tangential surface force

Page 14: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

The Navier-Stokes Equations

• steady state• 2-dimensional• incompressible

2

2

2

2

2

2

2

2

yv

xv

yP

Yyv

vxv

u

yu

xu

xP

Xyu

vxu

u

For:

Where,X,Y: body forces per unit volume in x and y direction respectively

μ: coefficient of viscosity (dynamic)

Page 15: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Incompressible flow: (Navier-Stokes in Vector Notation)

VPFDt

VD

V

2:momentum

:continuity 0

This now has four equations altogether for the four variables (u,v,w) and pressure P.

But, we are not there yet in having a complete mathematical model for CFD!

Page 16: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Navier-Stokes - Summation Convention

jjiiijij

i uPfuut

u,,,,

Taking u = u1 v = u2 w = u3

(separate equation for each of i = 1 to 3where• 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,22,1 ;..z

vu

y

uuei

zu

wyu

vxu

u

uuuuuuuu.e.i 3,132,121,11j,1j

(so what does uj,,j = 0 mean?)

Page 17: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

The Energy Equation for incompressible fluid(Transport equation for temperature)

x

yu

vConvection

with mass transfer Conductionby temperature gradient

Internal generation

22

2222

2

2

2

2

222

where

y

w

z

v

x

w

z

u

x

v

y

u

z

w

y

v

x

u

y

T

x

Tk

y

Tv

x

TuC p

Page 18: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Analytical Example - Couette Flow

Stationary plate

Moving Plate - vel = us

sInfinitelylong

0yv

xu

2

2

2

2

yu

xu

xP

Xyu

vxu

u

x

y

Page 19: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Solutions to the Equations

The set of equations for incompressible, viscous, 2D unsteady flow is:

0yv

xu

2

2

2

2

2

2

2

2

yv

xv

yP

Yyv

vxv

udtdv

yu

xu

xP

Xyu

vxu

udtdu

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.

Page 20: Computational Fluid Dynamics Course Notes

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

Page 21: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Typical Grid Notation

i, j

i, j+1

i, j-1

i-1, j+1

i-1, j

i-1, j-1

i+1, j+1

i+1, j

i+1, j-1

x

y

Page 22: Computational Fluid Dynamics Course Notes

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.

Page 23: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Differencing Formulae (1)u

x

ui+1

ui

i i+1Taylor Expansion

21i1i

i

3

i3

3

i1i1i

3

i3

3

2

i2

2

ii1i

3

i3

32

i2

2

ii1i

xOx2uu

xu

....6x

xu

2xxu

2uu

:gSubtractin

....6x

xu

2x

xu

xxu

uu

Also

....6x

xu

2x

xu

xxu

uu

(second ordercentral difference)

Page 24: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Differencing Formulae (2)

Adding the Taylor Series equations:

22

1ii1i

i2

2

4

i4

42

i2

2

i1i1i

xOx

uu2uxu

....12x

xu

xxu

u2uu

Thus, if we take, say, the x direction N-S equation (steady for simplicity):

21j,ij,i1j,i

2j,1ij,ij,1i

j,1ij,1i1j,i1j,ij,i

j,1ij,1ij,i

2

2

2

2

y

uu2u

x

uu2u

x2

PP

y2

uuv

x2

uuu

becomes

yu

xu

xP

yu

vxu

u

Page 25: Computational Fluid Dynamics Course Notes

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 domainand insert as ui,j, vi,j

in previous set of equations

solve equationsfor u, v, P

checkconvergence

insert revisedvalues of ui,j,vi,j

Page 26: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

The Pressure Correction Approach

Semi-Implicit Method for Pressure Linked Equations - SIMPLE !!!!

Guess a pressure field

Use modified continuity

equation to calculate a pressure correction

Do u, v values satisfycontinuity?

(convergence criterion)

Finish

Y

N

Solution process maybe iterative

or timemarching

Solve N-S equations (not continuity)for u,v, given these guessed pressures

Page 27: Computational Fluid Dynamics Course Notes

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

u, v, P u,v, P

u,v

u,v

wall

wall

……… is over-defined since velocity and pressure are stipulated at inlet and outlet. Values may thus not satisfy the continuity and momentum equations.

Page 28: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Boundary Conditions (2)

For example, for steady, incompressible, viscous flow, solved by pressure correction method, boundaries conditions may be:

v, P P

0yP

,0v,0uw

0yP

,0v,0uw

Boundaries defined will depend on nature of equations to be solved (steady / unsteady, incompressible/compressible, inviscid/viscous)

Page 29: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Grids (1)

ComputationalSpace

Structured Meshusually comprising quadrilateral elements

Physical Space

eg. circular duct

Page 30: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Grids (2)

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

Page 31: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Grids (3)Unstructured Meshusually 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

Page 32: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Turbulence

u’

U

vel ata point

time

Page 33: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Mathematical Modelling of Turbulence

Laminar Flow Momentumdiffusionby viscosity

Turbulent FlowAdditional momentum diffusion due to turbulence

Concept ofturbulent (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:

KEturbulentofndissipatioratethe2

wvuenegykineticturbulentthek

222

KEturbulentofndissipatioratethe2

wvuenegykineticturbulentthek

222

Page 34: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

k- Turbulence Model

• 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

widthlayershearsticcharacteritheisand

1.0lengtheddysticcharacteriiswhere

)flowshearfreefor(k

Uu

ensityintturbulencetheiswhere

U5.1k

L

L

2

2

23

21

• sensitivity to inlet turbulence quantities should be checked, and may point to the need for experimentally derived values for use in the CFD model.

Page 35: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

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 !

Page 36: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

ANSYS – CFX Overview (1)

Start > University Software > ANSYS > ANSYS CFX CAD2MESH

Geometry

DesignModeller(*.agdb file)

CFX-Mesh(*.cmdb file)

(*.gtm file)

Mesh ControlParameters

Note: CFX-Build has been superseded by DesignModeller and CFX-Mesh. Thus

references to CFX-Build in Help pages are no longer relevant.

Note: CFX-Build has been superseded by DesignModeller and CFX-Mesh. Thus

references to CFX-Build in Help pages are no longer relevant.

Page 37: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

ANSYS – CFX Overview (2)

Boundaryconditions

Fluidproperties

Problemtype

Solutioncontrol

Definitionfile (*.def)

Session file (*.ses) holds

record of commands

entered during session

Journal file (*.jou) holds record of commands for

particular database

*.gtm file

Case file (*.cfx) CFX-Pre

Start > University Software > CFX

Page 38: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

CFX-Post

Solver

ANSYS – CFX Overview (3)

Definitionfile (*.def)

Resultsfile (*.res)

Outputfile (*.out)

Velocities

Streamlines

Pressures

Turbulence

Forces

(numerical datain text file)

For further details, see CFX Help page: Installation & Introduction, Overview of CFX5, CFX File types, p193

For further details, see CFX Help page: Installation & Introduction, Overview of CFX5, CFX File types, p193

Page 39: Computational Fluid Dynamics Course Notes

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 (not across the Network from your U: drive)

• At the end of the session, drag and drop your entire working folder to your U: drive.

• You are strongly advised to back up your work to a CD or memory stick at the end of each session.

Page 40: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Exercise 1

Create folder MyCFX on the hard drive.

Work through Tutorial 1, Static Mixer, starting from page 6, “If you are using ANSYS Workbench ….”

You should follow the particular instructions in brackets for users of ANSYS Workbench 8.0.1, and note that the arrows shown will be reversed.

This will take you through:

•Geometry creation using DesignModeller

•Mesh generation using CFX-Mesh

After creating the mesh you will need to start CFX, specify your working folder (directory) on the CFX launch panel, and then start CFX-Pre.

Continue working through the tutorial from p 42 of the CFX tutorials, “To create a new simulation”.

This will take you through:

•Problem Definition using CFX-Pre

•Solution using CFX Solver Manager

•Viewing of results using CFX-Post

Create folder MyCFX on the hard drive.

Work through Tutorial 1, Static Mixer, starting from page 6, “If you are using ANSYS Workbench ….”

You should follow the particular instructions in brackets for users of ANSYS Workbench 8.0.1, and note that the arrows shown will be reversed.

This will take you through:

•Geometry creation using DesignModeller

•Mesh generation using CFX-Mesh

After creating the mesh you will need to start CFX, specify your working folder (directory) on the CFX launch panel, and then start CFX-Pre.

Continue working through the tutorial from p 42 of the CFX tutorials, “To create a new simulation”.

This will take you through:

•Problem Definition using CFX-Pre

•Solution using CFX Solver Manager

•Viewing of results using CFX-Post

Page 41: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Now make sure you understand …..

What’s the difference between

•Sketching mode and modelling mode

•DesignModeller and CFX-Mesh

•Surface Mesh and Volume Mesh

What’s the difference between

•Sketching mode and modelling mode

•DesignModeller and CFX-Mesh

•Surface Mesh and Volume Mesh

In ANSYS Workbench go to Help > DesignModeller 8.0 Help > Welcome to the DesignModeller 8.0 Help > Process for Creating a Model

Read through the page and run the video sequences to remind yourself of the process of creating a geometry.

In ANSYS Workbench go to Help > DesignModeller 8.0 Help > Welcome to the DesignModeller 8.0 Help > Process for Creating a Model

Read through the page 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 ….

Page 42: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Work through Tutorial 2, Static Mixer (Refined Mesh) which will show you more about the mesh generation process.

Work through Tutorial 2, Static Mixer (Refined Mesh) which will show you more about the mesh generation process.

Exercise 2

Exercise 3

Refine the mesh even further in the outlet region of the mixer by inserting a mesh control as follows.

• Re-open StaticMixer in CFX-Mesh• Right click Point Spacing > 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.

• 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, Run Solver and view results.

Refine the mesh even further in the outlet region of the mixer by inserting a mesh control as follows.

• Re-open StaticMixer in CFX-Mesh• Right click Point Spacing > 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.

• 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, Run Solver and view results.

Page 43: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Finding Out More – The Help Pages

Help on CFX Pre, Solver and Post is accessed from the CFX launch panel by clicking:

Help > Master contentsNow click the relevant + sign and then click contents.Each section heading is a hotlink to take you to the relevant page.

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

Now use the Help pages to answer the following questions.

Now use the Help pages to answer the following questions.

Page 44: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Finding Out More

(ANSYS) Help > CFX-Mesh 2.1 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?

(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?

Page 45: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Treatment of Walls and Flow Boundaries

Near Wall Modelling(Solver Modelling - Turbulence & Near Wall Modelling - Modelling Flow Near the Wall pp 116-120)

Boundary Condition Modelling(Solver Modelling- Boundary Condition Modelling pp 50-82)

Further reading from CFX Help pages:

Page 46: Computational Fluid Dynamics Course Notes

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

y

zx

Page 47: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

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.

0.3

2

10

x zy

point 0 0 0

surface A

Using CFX-Build

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

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.

Page 48: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Using CFX-Mesh

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.

If we want, say, around 6 elements in the region with the most coarse mesh (near the exit), then this give 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?

If we want, say, around 6 elements in the region with the most coarse mesh (near the exit), then this give 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?

Page 49: Computational Fluid Dynamics Course Notes

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.

Page 50: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

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.

Using CFX-Pre

Page 51: Computational Fluid Dynamics Course Notes

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, with “Shut down CFX build” checked and “Start solver manager” showing.

Page 52: Computational Fluid Dynamics Course Notes

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 CFX-Solver

Using CFX-Post

Page 53: Computational Fluid Dynamics Course Notes

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?

Page 54: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

With a bit of cunning, and judicious use mesh controls and CFX-Post, this is possible …..

Page 55: Computational Fluid Dynamics Course Notes

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?

Page 56: Computational Fluid Dynamics Course Notes

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?

Page 57: Computational Fluid Dynamics Course Notes

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.

Page 58: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Defining Polylines

Intersection LineA 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 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.

Page 59: Computational Fluid Dynamics Course Notes

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

Page 60: Computational Fluid Dynamics Course Notes

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 co-ordinates, 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.

Page 61: Computational Fluid Dynamics Course Notes

Computational Fluid Dynamics

Exporting Data - Example File

# $x - Coordinatesm# $y - Coordinatesm# $z - Coordinatesm# $1 - Pressure kgm^-1s^-2# $2 - Velocity ms^-1#-6.12E-16 0.00E+00 2.00E+01 -3.29E-051.89E-07 7.22E-07 1.88E-0-5.48E-16 0.00E+00 1.89E+01 7.86E-077.92E-08 5.05E-07 1.87E-03-4.83E-16 0.00E+00 1.79E+01 6.24E-052.48E-06 6.70E-07 1.94E-03

# $x - Coordinatesm# $y - Coordinatesm# $z - Coordinatesm# $1 - Pressure kgm^-1s^-2# $2 - Velocity ms^-1#-6.12E-16 0.00E+00 2.00E+01 -3.29E-051.89E-07 7.22E-07 1.88E-0-5.48E-16 0.00E+00 1.89E+01 7.86E-077.92E-08 5.05E-07 1.87E-03-4.83E-16 0.00E+00 1.79E+01 6.24E-052.48E-06 6.70E-07 1.94E-03

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)

Pre

ssu

re (

Pa)

After manipulation in Excel, a chart can be plotted: