Download presentation
Presentation is loading. Please wait.
Published byLiliana Arnold Modified over 8 years ago
1
Computational Fluid Dynamics Course Notes Original notes: Dr PK Dyson, modified by: Dr. Ashwini K. Otta Sep 2004
2
Computational Fluid Dynamics What is Computational Fluid Dynamics ?
3
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
4
Computational Fluid Dynamics Mathematical description …. A few basic terms: Velocity Vector Steady and unsteady flow Point (Eulerian) and Lagrangian velocity Streamlines
5
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)
6
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)
7
Computational Fluid Dynamics General Principles - Revision Momentum Mass Continuity u2u2 u1u1 net force acting on a fluid (control) volume = rate of change of momentum + net momentum flux through the surface how?
8
Computational Fluid Dynamics Mass Continuity Equation (1) xx yy x,u y,v mass-velocity = u vv z,w Net rate of outflow of mass = rate of depletion of mass in control volume
9
Computational Fluid Dynamics Mass Continuity Equation (2) Substantial derivative For incompressible flow, this becomes:
10
Computational Fluid Dynamics Momentum Equation (1) xx yy u 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
11
Computational Fluid Dynamics Momentum Equation (2) Forces Acting in x-Direction on Control Volume xx yy Forces: Body: acting over the volume (X) Surface: Normal (Pressure) Tangential (shear) X
12
Computational Fluid Dynamics Momentum Equation (3) Net Momentum Flux in x-direction (for a 2D fluid motion)
13
Computational Fluid Dynamics Momentum Equation (4) Net force in x-direction Body force in X-direction: usually zero Normal force: pressure Tangential surface force
14
Computational Fluid Dynamics The Navier-Stokes Equations steady state 2-dimensional incompressible For: Where, X,Y: body forces per unit volume in x and y direction respectively μ: coefficient of viscosity (dynamic)
15
Computational Fluid Dynamics Incompressible flow: (Navier-Stokes in Vector Notation) 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!
16
Computational Fluid Dynamics Navier-Stokes - Summation Convention 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 (so what does u j,,j = 0 mean?)
17
Computational Fluid Dynamics The Energy Equation for incompressible fluid (Transport equation for temperature) xx yy u v Convection with mass transfer Conduction by temperature gradient Internal generation
18
Computational Fluid Dynamics Analytical Example - Couette Flow Stationary plate Moving Plate - vel = u s s Infinitely long x y
19
Computational Fluid Dynamics Solutions to the Equations The set of equations for incompressible, viscous, 2D unsteady flow is: 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.
20
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
21
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
22
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.
23
Computational Fluid Dynamics Differencing Formulae (1) u x u i+1 uiui ii+1 Taylor Expansion (second order central difference)
24
Computational Fluid Dynamics Differencing Formulae (2) Adding the Taylor Series equations: Thus, if we take, say, the x direction N-S equation (steady for simplicity):
25
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 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
26
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 satisfy continuity? (convergence criterion) Finish Y N Solution process may be iterative or time marching Solve N-S equations (not continuity) for u,v, given these guessed pressures
27
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 wall ……… is over-defined since velocity and pressure are stipulated at inlet and outlet. Values may thus not satisfy the continuity and momentum equations.
28
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 Boundaries defined will depend on nature of equations to be solved (steady / unsteady, incompressible/compressible, inviscid/viscous)
29
Computational Fluid Dynamics Grids (1) Computational Space Structured Mesh usually comprising quadrilateral elements Physical Space eg. circular duct
30
Computational Fluid Dynamics Grids (2) Aerofoil Section (Example of structured mesh, refined in critical regions)
31
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
32
Computational Fluid Dynamics Turbulence u’ vel at a point time
33
Computational Fluid Dynamics Mathematical Modelling of Turbulence Laminar FlowMomentum 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 (k-epsilon model) introduces two further unknowns:
34
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 sensitivity to inlet turbulence quantities should be checked, and may point to the need for experimentally derived values for use in the CFD model.
35
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 !
36
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 Control Parameters Note: CFX-Build has been superseded by DesignModeller and CFX-Mesh. Thus references to CFX-Build in Help pages are no longer relevant.
37
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 *.gtm file Case file (*.cfx) CFX-Pre Start > University Software > CFX
38
Computational Fluid Dynamics CFX-Post Solver ANSYS – CFX Overview (3) Definition file (*.def) Results file (*.res) Output file (*.out) Velocities Streamlines Pressures Turbulence Forces (numerical data in text file) For further details, see CFX Help page: Installation & Introduction, Overview of CFX5, CFX File types, p193
39
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.
40
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
41
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 ….
42
Computational Fluid Dynamics 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.
43
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 contents Now 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.
44
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?
45
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:
46
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
47
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 z y point 0 0 0 surface A Using CFX-Build 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.
48
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?
49
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.
50
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=10 5 based on cylinder diameter outlet velocity set to “average static pressure” of 0 Pa. Using CFX-Pre
51
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.
52
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
53
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?
54
Computational Fluid Dynamics With a bit of cunning, and judicious use mesh controls and CFX-Post, this is possible …..
55
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?
56
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?
57
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.
58
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 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.
59
Computational Fluid Dynamics Polyline Data File 000 0.0050.011930 0.00750.014360 0.01250.018150 0.0250.025080 0.050.034770 0.0750.042020 0.10.047990 0.150.057320 0.20.064230 etc x y z coodinates, delimited by tabs or spaces. The Polyline is loaded using the “Polyline” icon
60
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.
61
Computational Fluid Dynamics Exporting Data - Example File #$x-Coordinatesm #$y-Coordinatesm #$z-Coordinatesm #$1-Pressurekgm^-1s^-2 #$2-Velocityms^-1 # -6.12E-160.00E+002.00E+01-3.29E-05 1.89E-077.22E-071.88E-0 -5.48E-160.00E+001.89E+017.86E-07 7.92E-085.05E-071.87E-03 -4.83E-160.00E+001.79E+016.24E-05 2.48E-066.70E-071.94E-03 #$x-Coordinatesm #$y-Coordinatesm #$z-Coordinatesm #$1-Pressurekgm^-1s^-2 #$2-Velocityms^-1 # -6.12E-160.00E+002.00E+01-3.29E-05 1.89E-077.22E-071.88E-0 -5.48E-160.00E+001.89E+017.86E-07 7.92E-085.05E-071.87E-03 -4.83E-160.00E+001.79E+016.24E-05 2.48E-066.70E-071.94E-03 Note: data here for each point stretches across 2 lines as velocity has 3 components. After manipulation in Excel, a chart can be plotted:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.