# 1. INTRODUCTION TO CFD 1.1 What is computational fluid dynamics? 1.2 Principles of fluid mechanics 1.

3 Different ways of expressing the fluid-flow equations 1.4 Basic principles of CFD 1.5 The main discretisation methods Examples

SPRING 2008 (Revised)

1.1 What is Computational Fluid Dynamics? Computational fluid dynamics (CFD) is the use of computers and numerical techniques to solve problems involving fluid flow. CFD has been successfully applied in a huge number of areas, including many of interest in civil engineering (highlighted in the list below): • aerodynamics (aircraft; automobiles); • hydrodynamics (ships; submersibles); • engine flows (internal-combustion and jet engines); • turbomachinery; • heat transfer; • combustion; • process engineering (chemical industry); • wind and wave power; • wind loading (forces and dynamic response of structures); • ventilation; • fire and explosion hazards; • environmental engineering (transport of pollutants and effluent); • coastal and offshore engineering (loading on coastal and marine structures); • hydraulics (pipe networks; channels; weirs; spillways); • sediment transport (sediment load; scour; morphology); • hydrology (flow in rivers and aquifers); • oceanography (tidal flows; ocean currents); • meteorology (numerical weather forecasting); • high-energy physics (plasma flows); • biomedical engineering (blood flow); • electronics (heat dissipation). This range of applications is broad and encompasses many different fluid phenomena and CFD techniques. In particular, CFD for high-speed aerodynamics (where compressibility is significant but viscous effects are often relatively unimportant) is very different from that used to solve low-speed, frictional flows typical of mechanical and civil engineering. Although many elements of this course are generally applicable, the focus will be on simulating viscous, incompressible flow by the finite-volume method.

CFD

1–1

David Apsley

1. (z is usually vertical) t time Field variables: u ≡ (u.2 Notation Position/time: x ≡ (x. x2. All fluids are compressible to some extent. z) or (x1.) T temperature φ concentration (amount per unit mass or per unit volume) Fluid properties: density dynamic viscosity ( ≡ / is the kinematic viscosity) bulk modulus surface tension diffusivity speed of sound K c CFD 1–2 David Apsley . A real fluid is one where viscous effects are assumed to be present. it doesn’t exist.2. This is usually the case for velocities much less than the speed of sound (1480 m s–1 in water. but their flow can be approximated as incompressible if flow-induced pressure changes don’t cause significant density changes. x3) position. y. no matter how small. Hydrostatics is the study of fluids at rest. An ideal fluid is one with no viscosity. The majority of engineering and environmental flows are fully turbulent. v.1. hydrodynamics is the study of fluids in motion.2. but it can be a good approximation. Hydraulics is the study of the flow of liquids (usually water). p* = p + gz is the piezometric pressure. u3) velocity p pressure (p – patm is the gauge pressure.1 Definitions A fluid is a substance that continuously deforms under a shearing force. Fluids may be liquids (have a definite volume and free surface) or gases (expand to fill any container). u2. aerodynamics is the study of the flow of gases (usually air). w) or (u1. Turbulence is the natural state at high Reynolds number. 340 m s–1 in air). Real flows may be laminar (adjacent layers slide smoothly over each other) or turbulent (subject to “random” fluctuations about a mean flow).2 Principles of Fluid Mechanics 1.

If density is constant. gravitational forces can be eliminated entirely from the equations by working with the piezometric pressure. pressure forces balance weight. CFD 1–3 David Apsley . Note that the role of energy is different in compressible and incompressible flows. This can be written mathematically as dp p=− g z or =− g (1) dz The same equation also holds in a moving fluid if there is no vertical acceleration. as an approximation. (1) can be written (2) p* ≡ p + gz = constant p* is called the piezometric pressure. density and temperature are connected by an equation of state. For CFD of incompressible flow there is no need to solve a separate energy equation because the mechanical energy principle (“change of kinetic energy = work done”) is formally equivalent to the momentum equation. R = R0 /m (3) where R0 is the universal gas constant. There are different ways of expressing these physical principles mathematically (Section 2). m is the molar mass and T is the absolute temperature. Equation of State Pressure. They represent the following fundamental principles: • mass: change of mass = 0 • momentum: (rate of) change of momentum = force • energy: change of energy = work + heat and for non-homogeneous fluids: • conservation of individual constituents. Dynamics The most important equations are those governing fluid motion. if vertical acceleration is much smaller than g.2.1. The most important example is the ideal gas law: p = RT . For a constant-density flow without a free surface.3 Mechanical Principles Hydrostatics At rest. combining the effects of pressure and weight. or.

1.2 Differential Equations In regions without shocks. energy.3 Different Ways of Expressing the Fluid-Flow Equations 1. V For an arbitrary control volume the balance of a physical quantity over an interval of time is change = amount in − amount out + amount created In fluid mechanics this is usually expressed in rate form by dividing by the time interval (and transferring the net amount passing through the boundary to the LHS of the equation): RATE OF CHANGE inside V + NET FLUX out of boundary = SOURCE inside V (4) The flux (i. These describe what is going on at a point rather than over a whole control volume. Mathematically. diffusion – net transport by random (molecular or turbulent) motion. This will be demonstrated in Section 2. The finite-difference method is based on the direct approximation of a differential form of the governing equations. momentum. they can be derived by making the control volumes infinitesimally small.3. …) within specified regions of space (control volumes). is based on approximating these control-volume equations. chemical content etc.e. CFD 1–4 David Apsley . instead of dealing with lots of different equations we can consider the numerical solution of a general scalar-transport equation (Section 4). RATE OF CHANGE inside V + ADVECTION + DIFFUSION through boundary = SOURCE inside V (5) The important point is that there is a single generic scalar-transport equation of the form (5). the fluid-flow equations can also be written in equivalent differential forms.3. momentum. where it will also be shown that there are several different ways of writing these differential equations.1 Control-Volume (“Integral”) Approach Continuum (as opposed to particle) mechanics considers changes to the total amount of some physical quantity (mass. which is the subject of this course. The finite-volume method. regardless of whether the physical quantity is mass. rate of transport across a surface) is due to: advection – movement with the fluid flow. 1. interfaces or other discontinuities. Thus.

The equations of motion are discretised (approximated in terms of values at nodes): control-volume or differential equations algebraic equations (continuous) (discrete) The resulting system of algebraic equations is solved to give values at the nodes. continuous curve discrete approximation The fundamental elements of any CFD simulation are: (1) The flow field is discretised. boundary conditions). Post-processing: – visualisation. – construction of a computational mesh. u. v. i. – analysis of results. field variables ( . Solving: – discretisation of the governing equations. (2) (3) The main stages in a CFD simulation are: Pre-processing: – problem formulation (governing equations.4 Basic Principles of CFD The approximation of a continuously-varying quantity in terms of values at a finite number of points is called discretisation. …) are approximated by their values at a finite number of nodes. p. w. CFD 1–5 David Apsley .e.1. – numerical solution of the governing equations.

. substitute into some form of the governing equations and solve for the coefficients (aka degrees of freedom or weights). • it is directly relatable to physical quantities (mass flux. (1) A flow geometry is defined. j − u i −1. This course will focus on the finite-volume method.1. u (x) = u S (x)   ¡ ¡ Finite-difference and finite-element methods are covered in more detail in the Computational Mechanics course. In the finite-volume method .j-1 (ii) Finite-Volume Method Discretise the governing control-volume equations directly. e. net mass outflow = ( uA) e − ( uA) w + ( vA) n − ( vA) s uw vn ue vs = 0 (iii) Finite-Element Method Express the solution as a weighted sum of shape functions S (x). approximated in terms of values at nodes – to form a set of algebraic equations. j vi . for velocity.5 The Main Discretisation Methods i.g. u i +1. • it is flexible in terms of both geometry and the variety of fluid phenomena. j −1 ∂u ∂v ≈ + 0 = + ∂x ∂y 2∆x 2∆y i.g.j i. etc.. (3) The control-volume equations are discretised – i. e.j i+1. (2) The flow domain is decomposed into a set of control volumes or cells called a computational mesh or grid.g. The finite-element method is popular in solid mechanics (geotechnics. (4) The discretised equations are solved numerically. The finite-volume method is popular in fluid mechanics because: • it enforces conservation.). j +1 − vi ..j Discretise the governing differential equations directly.e.j+1 (i) Finite-Difference Method i-1. e. • general-purpose codes can be used for a wide variety of physical problems. CFD 1–6 David Apsley . structures) because: • it has considerable geometric flexibility.

calculate: (a) the initial concentration of gas in ppm by mass. What is the mass flux across the surfaces S1 and S2? 10 cm 2 m/s 45 o S1 S2 D=10 cm u=8 m/s F Q2. Q3.) Q4.5 m s–1 through an aperture of 6 m2. A fire in the hydraulics laboratory released 2 kg of a toxic gas into a room of dimensions 30 m × 8 m × 5 m.5 kg hr–1. What is the average concentration of the chemical (in kg m–3) downstream of the spill? CFD 1–7 David Apsley . Water (density 1000 kg m–3) flows at 2 m s–1 through a circular pipe of diameter 10 cm. Assuming the laboratory air to be well-mixed and to be vented at a speed of 0. (For air. A burst pipe at a factory causes a chemical to seep into a river at a rate of 2. and compute the force F required to hold the plate fixed. (b) the time taken to reach a safe concentration of 1 ppm.20 kg m–3. 2 m deep and flows at 0. A water jet strikes normal to a fixed plate (see left). density = 1.3 m s–1.Examples The following rather simple examples develop the notation and control-volume framework to be used in the rest of the course. Neglect gravity and friction. Q1. The river is 5 m wide.