Créer une présentation
Télécharger la présentation

Télécharger la présentation
## AN INTRODUCTION TO COMPUTATIONAL FLUID DYNAMICS

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**AN INTRODUCTION TO COMPUTATIONAL FLUID DYNAMICS**Shuisheng He School of Engineering The Robert Gordon University Introduction to CFD (Pisa, 30/09/2005)**OBJECTIVES**The lecture aims to convey the following information/ message to the students: • What is CFD • The main issues involved in CFD, including those of • Numerical methods • Turbulence modelling • The limitations of CFD and the important role of validation and expertise in CFD Introduction to CFD (Pisa, 30/09/2005)**OUTLINE OF LECTURE**• Introduction • What is CFD • What can & cannot CFD do • What does CFD involve … • Issues on numerical methods • Mesh generation • Discretization of equation • Solution of discretized equations • Turbulence modelling • Why are turbulence models needed? • What are available? • What model should I use? • Demonstration • Use of Fluent Introduction to CFD (Pisa, 30/09/2005)**1. INTRODUCTION**Introduction to CFD (Pisa, 30/09/2005)**What is CFD?**• Computational fluid dynamics (CFD): • CFD is the analysis, by means of computer-based simulations, of systems involving fluid flow, heat transfer and associated phenomena such as chemical reactions. • CFD involves ... Introduction to CFD (Pisa, 30/09/2005)**What does CFD involve?**• Specification of the problem • Development of the physical model • Development of the mathematical model • Governing equations • Boundary conditions • Turbulence modelling • Mesh generation • Discretization of the governing equations • Solution of discretized equations • Post processing • Interpretation of the results Introduction to CFD (Pisa, 30/09/2005)**Depth of sea: 500m ~ 1000m**• Tidal current: 10 to 20m/s • Waves (unsteady): -5m/s to +5m/s • Diameters: 150~200mm • Gap above sea bed: 10mm An example • Initiation of the problem • DP Offshore Ltd is keen to know what (forces ) caused the damage they recently experienced with their offshore pipelines. • Development of the physical model • After a few meetings with the company, we have finally agreed a specification of the problem (For me, it defines the physical model of the problem to be solved): Introduction to CFD (Pisa, 30/09/2005)**Symmetry**Inlet: Flat inlet profiles V=25m/s Turbulence=5% 10D Outlet: fully developed zero gradient Flow Smooth wall 20D 10D An example (cont.) • Development of the mathematical model • Governing equations • Equations: momentum, thermal (x), multiphase (x), … • Phase 1: 2D, steady; Phase 2: unsteady, …, • The flow is turbulent! • Boundary conditions • Decide the computational domain • Specify boundary conditions Introduction to CFD (Pisa, 30/09/2005)**An example (cont.)**• Development of the mathematical model (cont.) • Turbulence model • Initially, a standard 2-eq k-ε turbulence model is chosen for use. • Later, to improve simulation of the transition, separation & stagnation region, I would like to consider using a RNG or a low-Re model • Mesh generation • Finer mesh near the wall but not too close to wall • Finer mesh behind the pipe Introduction to CFD (Pisa, 30/09/2005)**An example (cont.)**• Discretization of the equations • Start with 1st order upwind, for easy convergence • Consider to use QUICK for velocities, later. • There is no reason for not using the default SIMPLER for pressure. • Solver • Use Uncoupled rather than coupledmethod • Use default setup on under-relaxation, but very likely, this will need to be changed later • Convergence criterion: choose 10-5 initially: check if this is ok by checking if 10-6 makes any difference. Iteration • Start iteration Failed • Plot velocity or other variable to assist identifying the reason(s) • Potential changes in: relaxation factors, mesh, initial guess, numerical schemes, etc. Converged solution • Eventually, solution converged. Introduction to CFD (Pisa, 30/09/2005)**An example (cont.)**• Post processing • Interpretation of results Force vector: (1 0 0) pressure viscous total pressure viscous total zone name force force force coefficient coefficient coefficient n n n ------------------------- -------------- -------------- -------------- -------------- -------------- -------------- pipe 8.098238 0.12247093 8.2207089 13.221613 0.1999 13.421566 ------------------------- -------------- -------------- -------------- -------------- -------------- -------------- net 8.098238 0.12247093 8.2207089 13.221613 0.199 13.421566 Introduction to CFD (Pisa, 30/09/2005)**Specify the problem**Select turbulence model Generate Mesh Discretize equations Solve discretized equations Post processing CFD road map Pre-processor Solver Post-processor Introduction to CFD (Pisa, 30/09/2005)**Why CFD?**• Continuity and Navier-Stokes equations for incompressible fluids: Introduction to CFD (Pisa, 30/09/2005)**Flow in a pipe**• For laminar flow: ? • For turbulent flow: Or Why CFD? (cont.) • Analytical solutions are available for only very few problems. • Experiment combined with empirical correlations have traditionally been the main tool - an expensive one. • CFD potentially provides an unlimited power for solving any flow problems Important conclusion: There is no analytical solution even for a very simple application, such as, a turbulent flow in a pipe. Introduction to CFD (Pisa, 30/09/2005)**CFD applications**• Aerospace • Automobile industry • Engine design and performance • The energy sector • Oil and gas • Biofluids • Many other sectors Introduction to CFD (Pisa, 30/09/2005)**CFD applications (cont.)**• As a design tool, CFD can be used to perform quick evaluation of design plans and carry out parametric investigation of these designs. • As a research tool, CFD can provide detailed information about the flow and thermal field and turbulence, far beyond these provided by experiments. Introduction to CFD (Pisa, 30/09/2005)**What can CFD do?**• Flows problems in complex geometries • Heat transfer • Combustions • Chemical reactions • Multiphase flows • Non-Newtonian fluid flow • Unsteady flows • Shock waves Introduction to CFD (Pisa, 30/09/2005)**What can’t CFD do?**• CFD is still struggling to predict even the simplest flows reliably, for example, • A jet impinging on a wall • Heat transfer in a vertical pipe • Flow over a pipe • Combustion in an engine • Important conclusions: • Validation is of vital importance to CFD. • Use of CFD requires more expertise than many other areas • CFD solutions beyond validation are often sought and expertise plays an important role here. Introduction to CFD (Pisa, 30/09/2005)**Validation of CFD modelling**Errors involved in CFD results • Discretization errors • Depending on ‘schemes’ used. Use of higher order schemes will normally help to reduce such errors • Also depending on mesh size – reducing mesh size will normally help to reduce such errors. • Iteration errors • For converged solutions, such errors are relatively small. • Turbulence modelling • Some turbulence models are proved to produce good results for certain flows • Some models are better than others under certain conditions • But no turbulence model can claim to work well for all flows • Physical problem vs mathematical model • Approximation in boundary conditions • Use of a 2D model to simplify calculation • Simplification in the treatment of properties Introduction to CFD (Pisa, 30/09/2005)**Validation of CFD modelling (cont.)**• CFD results always need validation. They can be • Compared with experiments • Compared with analytical solutions • Checked by intuition/common sense • Compared with other codes (only for coding validation!) Introduction to CFD (Pisa, 30/09/2005)**Commercial CFD packages**• Phoenix • Fluent • Star-CD • CFX (FLOW3D) • Many others • Computer design tools – integrating CFD into a design package Introduction to CFD (Pisa, 30/09/2005)**Specify the problem**Generate Mesh Select equations to solve Select turbulence models Define boundary conditions Select numerical methods Iterate – solve equations Fail – calculation does not converge or converges too slowly Improve model: Physical model Mesh Better initial guess Numerical methods (e.g., solver, convection scheme) Under-relaxations Post processing Interpretation of results – Always question the results How to use a CFD package? Introduction to CFD (Pisa, 30/09/2005)**How to use a CFD package? (cont.)**• Important issues involved in using CFD: • Mesh independence check • Selection of an appropriate turbulence model • Validation of the solution based on a simplified problem (which contains the important features similar to your problem) • Careful interpretation of your results Introduction to CFD (Pisa, 30/09/2005)**How to use a CFD package? (cont.)**• The commercial packages are so user friendly and robust, why do we still need CFD experts? Because they can provide: • Appropriate interpretation of the results and knowledge on the limitations of CFD • More accurate results (by choosing the right turbulence model & numerical methods) • Ability to obtain results (at all) for complex problems • Speed: both in terms of the time used to generate the model and the computing time Introduction to CFD (Pisa, 30/09/2005)**Basic CFD strategies**• Finite difference (FD) • Starting from the differential form of the equations • The computational domain is covered by a grid • At each grid point, the differential equations (partial derivatives) are approximated using nodal values • Only used in structured grids and normally straightforward • Disadvantage: conservation is not always guaranteed • Disadvantage: Restricted to simple geometries. • Finite Volume (FV) • Finite element (FE) Introduction to CFD (Pisa, 30/09/2005)**Basic CFD strategies (cont.)**• Finite difference (FD) • Finite Volume (FV) • Starting from the integral form of the governing equations • The solution domain is covered by control volumes (CV) • The conservation equations are applied to each CV • The FV can accommodate any type of grid and suitable for complex geometries • The method is conservative (as long as surface integrals are the same for CVs sharing the boundary) • Most widely used method in CFD • Disadvantage: more difficult to implement higher than 2nd order methods in 3D. • Finite element (FE) Introduction to CFD (Pisa, 30/09/2005)**Basic CFD strategies (cont.)**• Finite difference (FD) • Finite Volume (FV) • Finite element (FE) • The domain is broken into a set of discrete volumes: finite elements • The equations are multiplied by a weight function before they are integrated over the entire domain. • The solution is to search a set of non-linear algebraic equations for the computational domain. • Advantage: FE can easily deal with complex geometries. • Disadvantage: since unstructured in nature, the resultant matrices of linearized equations are difficult to find efficient solution methods. • Not often used in CFD Introduction to CFD (Pisa, 30/09/2005)**2. ISSUES IN NUMERICAL METHODS**Introduction to CFD (Pisa, 30/09/2005)**CFD Road Map**Specify the problem Select turbulence model Generate Mesh Discretize equations Solve discretized equations Post processing Mesh generation Why do we care? • 50% time spent on mesh generation • Convergence depends on mesh • Accuracy depends on mesh Main topics • Structured/unstructured mesh • Multi-block • body fitted • Adaptive mesh generation Introduction to CFD (Pisa, 30/09/2005)**- MESH GENERATION -Computational domain and mesh structure**• Carefully select your computational domain • The mesh needs • to be able to resolve the boundary layer • to be appropriate for the Reynolds number • to suit the turbulence models selected • to be able to model the complex geometry Introduction to CFD (Pisa, 30/09/2005)**- MESH GENERATION -Structure/unstructured mesh**• Structured grid • A structured grid means that the volume elements (quadrilateral in 2D) are well ordered and a simple scheme (e.g., i-j-k indices) can be used to label elements and identify neighbours. • Unstructured grid • In unstructured grids, volume elements (triangular or quadrilateral in 2D) can be joined in any manner, and special lists must be kept to identify neighbouring elements Introduction to CFD (Pisa, 30/09/2005)**- MESH GENERATION -Structure/unstructured mesh**• Structured grid Advantages: • Economical in terms of both memory & computing time • Easy to code/more efficient solvers available • The user has full control in grid generation • Easy in post processing Disadvantages • Difficult to deal with complex geometries • Unstructured grid • Advantages/disadvantages: opposite to above points! Introduction to CFD (Pisa, 30/09/2005)**- MESH GENERATION -Multi-Block and Overset Mesh**Introduction to CFD (Pisa, 30/09/2005)**- MESH GENERATION -Body fitted mesh - transformation**Regular mesh Body fitted mesh Introduction to CFD (Pisa, 30/09/2005)**- MESH GENERATION -Adaptive mesh generation**• Adaptive mesh generation • The mesh is modified according to the solution of the flow • Two types of adaptive methods • Local mesh refinement • Mesh re-distribution • Dynamic adaptive method • Mesh refinement/redistribution are automatically carried out during iterations • Demonstration – flow past a cylinder Introduction to CFD (Pisa, 30/09/2005)**CFD Road Map**Specify problem Select turbulence model Generate Mesh Discretize equations Solve discretized equations Post processing Equation discretization Relevant issues • Convergence strongly depends on numerical methods used. • Accuracy – discretization errors Main topics • Staggered/collocated variable arrangement • Convection schemes • Accuracy • Artificial diffusion • Boundedness • Choice of many schemes • Pressure-velocity link • Linearization of source terms • Boundary conditions Introduction to CFD (Pisa, 30/09/2005)**V**U,V,P,T U P,T - EQUATION DISCRETIZATION -Staggered/collocated variable arrangement • Collocated variable arrangement • All variables are defined at nodes • Staggered variable arrangement • Velocities are defined at the faces and scalars are defined as the nodes Collocated Arrangement Staggered Arrangement Introduction to CFD (Pisa, 30/09/2005)**The problem:**Unless special measures are taken, the collocated arrangement often results in oscillations The reason is the weak coupling between velocity & pressure Staggered variable arrangement Almost always been used between 60’s and early 80’s Still most often used method for Cartesian grids Disadvantage: difficult to treat complex geometry Collocated variable arrangement Methods have been developed to over-come oscillations in the 80’s and such methods are often being used since. Used for non-orthogonal, unstructured grids, or, for multigrid solution methods - EQUATION DISCRETIZATION -Staggered/collocated variable arrangement Introduction to CFD (Pisa, 30/09/2005)**- EQUATION DISCRETIZATION -Convection schemes**The problem • To discretize the equations, convections on CV faces need to be calculated from variables stored on nodal locations • When the 2nd order-accurate linear interpolation is used to calculate the convection on the CV faces, undesirable oscillation may occur. • Development/use of appropriate convection schemes have been a very important issue in CFD • There are no best schemes. A choice of schemes is normally available in commercial CFD packages to be chosen by the user. Introduction to CFD (Pisa, 30/09/2005)**- EQUATION DISCRETIZATION -Convection schemes (cont.)**The requirements for convection schemes: • Accuracy: Schemes can be 1st, 2nd, 3rd...-order accurate. • Conservativeness: Schemes should preserve conservativeness on the CV faces • Boundedness: Schemes should not produce over-/under-shootings • Transportiveness: Schemes should recognize the flow direction Introduction to CFD (Pisa, 30/09/2005)**- EQUATION DISCRETIZATION -Convection schemes (cont.)**Examples of convection schemes • 1st order schemes: • Upwind scheme (UW): most often used scheme! • Power law scheme • Skewed upwind • Higher order schemes • Central differencing scheme (CDS) – 2nd order • Quadratic Upwind Interpolation for Convective Kinematics (QUICK) – 3rd order and very often used scheme • Bounded higher-order schemes • Total Variation Diminishing (TVD) – a group of schemes • SMART Introduction to CFD (Pisa, 30/09/2005)**- EQUATION DISCRETIZATION -Pressure-velocity link**• The problem • The pressure appears in the momentum equation as the driving force for the flow. But for incompressible flows, there is no transport equation for the pressure. • In stead, the continuity equation will be satisfied if the appropriate pressure field is used in the momentum equations • The non-linear nature of and the coupling between, the various equations also pose problems that need care. • The remedy • Iterative guess-and-correct methods have been proposed – see next slide. Introduction to CFD (Pisa, 30/09/2005)**- EQUATION DISCRETIZATION -Pressure-velocity link (cont.)**Most widely used methods • SIMPLE (Semi-implicit method for pressure-linked equations) • A basic guess-and-correct procedure • SIMPLER (SIMPLE-Revised): used as default in many commercial codes • Solve an extra equation for pressure correction (30% more effort than SIMPLE). This is normally better than SIMPLE. • SIMPLEC (SIMPLE-Consistent): Generally better than SIMPLE. • PISO (Pressure Implicit with Splitting of Operators) • Initially developed for unsteady flow • Involves two correction stages Introduction to CFD (Pisa, 30/09/2005)**- EQUATION DISCRETIZATION -Linearization of source terms**• This slide is only relevant to those who develops CFD codes. • The treatment of source terms requires skills which can significantly increase the stability and convergence speed of the iteration. • The basic rule is that the source term should be linearizated and the linear part can the be solved directly. • An important rule is that only those of linearization which result in a negative gradient can be solved directly Introduction to CFD (Pisa, 30/09/2005)**- EQUATION DISCRETIZATION -Boundary conditions**• Specification of boundary conditions (BC) is a very important part of CFD modelling • In most cases, this is straightforward but, in some cases, it can be very difficult ..., • Typical boundary conditions: • Inlet boundary conditions • Outlet boundary conditions • Wall boundary conditions • Symmetry boundary conditions • Periodic boundary conditions Introduction to CFD (Pisa, 30/09/2005)**Relevant issues**• Cost/speed • Stability/Convergence Main topics • Solver – solution of the discretized equation system • Convergence criteria • Under-relaxation • Solution of coupled equations • Unsteady flow solvers CFD Road Map Specify problem Select turbulence model Generate Mesh Discretize equations Solve discretized equations Post processing Solution of discretized equations Introduction to CFD (Pisa, 30/09/2005)**- SOLUTION OF DISCRETIZED EQUATIONS -Solvers**• Discretized Equations – large linearized sparse matrix = * Introduction to CFD (Pisa, 30/09/2005)**- SOLUTION OF DISCRETIZED EQUATIONS -Solvers (cont.)**• The discretized governing equations are always sparse,non-linear but linearizated, algebraic equation systems • The ‘matrix’ from structured mesh is regular and easier to solve. • A non-structured mesh results in an irregular matrix. • Number of equations = number of nodes • Number of molecules in each line: • Upwind, CDS for 1D results in a tridiagonal matrix • QUICK for 1D results in a penta-diagonal matrix • 2D problems involves 5 & more molecules • 3D problems involves 7 & more molecules Introduction to CFD (Pisa, 30/09/2005)**Very expensive!**Very effective method used for tridiagonal matrix Simple and probably most often used method Used for more ‘complex’ problems Effective method for more ‘complex’ problems - SOLUTION OF DISCRETIZED EQUATIONS -Solvers (cont.) • Direct methods • Gauss elimination: • Tridiagonal Matrix Algorithm (TDMA): • Indirect methods • Basic methods: • Jacobi • Gauss-Seidel • Successive over-relaxation (SOR) • ADI-TDMA • Strongly implicit procedure (SIP) • Conjugate Gradient Methods (CGM) • Multigrid Methods Introduction to CFD (Pisa, 30/09/2005)**- SOLUTION OF DISCRETIZED EQUATIONS -Convergence criteria**• Two basic methods: • Changes between any two iterations are less than a given level • Residuals in the transport equations are less than a given value • Criteria can be specified using absolute or relative values Introduction to CFD (Pisa, 30/09/2005)