CFD Lecture 01

download CFD Lecture 01

of 41

Transcript of CFD Lecture 01

  • 7/29/2019 CFD Lecture 01

    1/41

    Introduction to Computational

    Fluid Dynamics (CFD)

  • 7/29/2019 CFD Lecture 01

    2/41

    2

    Computational fluid dynamicsFluid dynamics is the science of fluid motion.

    Fluid flow is commonly studied in one of three ways:Experimental fluid dynamics.

    Theoretical fluid dynamics.

    Numerically: computational fluid dynamics (CFD).

    Computational fluid dynamics (CFD) is the science of predicting

    fluid flow, heat transfer, mass transfer, chemical reactions, andrelated phenomena by solving the mathematical equationswhich govern these processes using a numerical process.

    The result of CFD analyses is relevant engineering data used in:

    Conceptual studies of new designs.

    Detailed product development.

    Troubleshooting.

    Redesign.

  • 7/29/2019 CFD Lecture 01

    3/41

    3

    CFD analysis complements testing and experimentation.

    Reduces the total effort required in the laboratoryHistorically only Analytical Fluid Dynamics (AFD) and Experimental FluidDynamics (EFD).

    CFD made possible by the advent of digital computer and advancingwith improvements of computer resources

  • 7/29/2019 CFD Lecture 01

    4/41

    4

    Why use CFD?

    Analysis and Design1. Simulation-based design instead of build & testMore cost effective and more rapid than EFD

    CFD provides high-fidelity database for diagnosing flowfield

    2. Simulation of physical fluid phenomena that aredifficult for experimentsFull scale simulations (e.g., ships and airplanes)

    Environmental effects (wind, weather, etc.)

    Hazards (e.g., explosions, radiation, pollution)

    Physics (e.g., planetary boundary layer, stellar

    evolution)

    Knowledge and exploration of flow physics

  • 7/29/2019 CFD Lecture 01

    5/41

    5

    Where is CFD used?

    Where is CFD used?

    Aerospace

    Automotive

    Biomedical

    ChemicalProcessing

    HVAC

    Hydraulics

    Marine

    Oil & Gas Power Generation

    Sports

    F18 Store Separation

    Temperature and naturalconvection currents in the eyefollowing laser heating.

    Aerospace

    Automotive

    Biomedical

  • 7/29/2019 CFD Lecture 01

    6/41

    6

    Where is CFD used?

    Polymerization reactor vessel - predictionof flow separation and residence timeeffects.

    Streamlines for workstationventilation

    Where is CFD used? Aerospacee

    Automotive

    Biomedical

    ChemicalProcessing

    HVAC

    Hydraulics

    Marine

    Oil & Gas

    Power Generation

    Sports

    HVAC

    Chemical Processing

    Hydraulics

  • 7/29/2019 CFD Lecture 01

    7/417

    Where is CFD used?

    Where is CFD used? Aerospace

    Automotive

    Biomedical

    Chemical Processing HVAC

    Hydraulics

    Marine

    Oil & Gas

    Power Generation Sports

    Flow of lubricating

    mud over drill bit Flow around coolingtowers

    Marine (movie)

    Oil & Gas

    Sports

    Power Generation

  • 7/29/2019 CFD Lecture 01

    8/418

    Domain for bottle filling

    problem.

    Filling

    Nozzle

    Bottle

    CFD - how it works

    Analysis begins with a mathematicalmodel of a physical problem.

    Conservation of matter, momentum, andenergy must be satisfied throughout theregion of interest.

    Fluid properties are modeled empirically.

    Simplifying assumptions are made inorder to make the problem tractable(e.g., steady-state, incompressible,inviscid, two-dimensional).

    Provide appropriate initial and boundaryconditions for the problem.

  • 7/29/2019 CFD Lecture 01

    9/419

    Mesh for bottle filling

    problem.

    CFD - how it works (2)CFD applies numerical methods (calleddiscretization) to develop approximations

    of the governing equations of fluidmechanics in the fluid region of interest.

    Governing differential equations: algebraic.

    The collection of cells is called the grid.

    The set of algebraic equations are solvednumerically (on a computer) for the flow fieldvariables at each node or cell.

    System of equations are solved simultaneouslyto provide solution.

    The solution is post-processed to extractquantities of interest (e.g. lift, drag,torque, heat transfer, separation,pressure loss, etc.).

  • 7/29/2019 CFD Lecture 01

    10/4110

    CFD process

    Purposesof CFD codes will be different for different

    applications: investigation of bubble-fluid interactions for bubblyflows, study of wave induced massively separated flows forfree-surface, etc.

    Depend on the specific purpose and flow conditions of theproblem, different CFD codescan be chosen for differentapplications (aerospace, marines, combustion, multi-phaseflows, etc.)

    Once purposes and CFD codes chosen, CFD process is thesteps to set up the IBVP problem and run the code:

    1. Geometry

    2. Physics3. Mesh

    4. Solve

    5. Reports

    6. Post processing

  • 7/29/2019 CFD Lecture 01

    11/4111

    CFD Process

    Viscous

    Model

    Boundary

    Conditions

    Initial

    Conditions

    Convergent

    Limit

    Contours

    Precisions

    (single/

    double)

    Numerical

    Scheme

    Vectors

    StreamlinesVerification

    Geometry

    Select

    Geometry

    Geometry

    Parameters

    Physics Mesh Solve Post-

    Processing

    Compressible

    ON/OFF

    Flow

    properties

    Unstructured

    (automatic/

    manual)

    Steady/

    Unsteady

    Forces Report(lift/drag, shear

    stress, etc)

    XY Plot

    Domain

    Shape and

    Size

    Heat Transfer

    ON/OFF

    Structured

    (automatic/

    manual)

    Iterations/

    Steps

    Validation

    Reports

  • 7/29/2019 CFD Lecture 01

    12/4112

    Geometry

    Selection of an appropriate coordinate

    Determine the domain size and shape

    Any simplifications needed?

    What kinds of shapes needed to be used to best

    resolve the geometry? (lines, circular, ovals, etc.) For commercial code, geometry is usually createdusing commercial software (either separated from thecommercial code itself, like Gambit, or combinedtogether, like FlowLab)

    For research code, commercial software (e.g.Gridgen) is used.

  • 7/29/2019 CFD Lecture 01

    13/4113

    Physics Flow conditions and fluid properties

    1. Flow conditions: inviscid, viscous, laminar, orturbulent, etc.

    2. Fluid properties: density, viscosity, and

    thermal conductivity, etc.

    3. Flow conditions and properties usually presented indimensional form in industrial commercial CFDsoftware, whereas in non-dimensional variables forresearch codes.

    Selection of models: different models usually fixed bycodes, options for user to choose

    Initial and Boundary Conditions: not fixed by codes,user needs specify them for different applications.

  • 7/29/2019 CFD Lecture 01

    14/4114

    Mesh

    Meshes should be well designed to resolveimportant flow features which are dependent uponflow condition parameters (e.g., Re), such as thegrid refinement inside the wall boundary layer

    Mesh can be generated by either commercial codes(Gridgen, Gambit, etc.) or research code (usingalgebraic vs. PDE based, conformal mapping, etc.)

    The mesh, together with the boundary conditionsneed to be exported from commercial software in a

    certain format that can be recognized by theresearch CFD code or other commercial CFDsoftware.

  • 7/29/2019 CFD Lecture 01

    15/4115

    Reports Reports saved the time history of the residuals of

    the velocity, pressure and temperature, etc.

    Report the integral quantities, such as total pressuredrop, friction factor (pipe flow), lift and dragcoefficients (airfoil flow), etc.

    XY plots could present the centerlinevelocity/pressure distribution, friction factordistribution (pipe flow), pressure coefficientdistribution (airfoil flow).

    AFD or EFD data can be imported and put on top ofthe XY plots for validation

  • 7/29/2019 CFD Lecture 01

    16/4116

    Post-processing Analysis and visualization

    Calculation of derived variablesVorticity

    Wall shear stress

    Calculation of integral parameters: forces,moments

    Visualization (usually with commercialsoftware) Simple 2D contours

    3D contour isosurface plots

    Vector plots and streamlines(streamlines are the lines whose

    tangent direction is the same as thevelocity vectors)

    Animations

    Post-processing usually through usingcommercial software

  • 7/29/2019 CFD Lecture 01

    17/4117

    DiscretizationDomain is discretized into a finite set of control volumesor cells. The discretized domain is called the grid or the

    mesh.

    General conservation (transport) equations for mass,momentum, energy, etc., are discretized into algebraicequations.

    All equations are solved to render flow field.

    VAAV

    dVSdddVt

    AAV

    unsteady convection diffusion generation

    Eqn.

    continuity 1

    x-mom. u

    y-mom. v

    energy h

    Fluid region of

    pipe flow

    discretized intofinite set of

    control volumes

    (mesh).

    control

    volume

    D i d h id

  • 7/29/2019 CFD Lecture 01

    18/41

    18

    Design and create the gridShould you use a quad/hex grid, a tri/tet grid, a hybridgrid, or a non-conformal grid?

    What degree of grid resolution is required in eachregion of the domain?

    How many cells are required for the problem?

    Will you use adaption to add resolution?Do you have sufficient computer memory?

    triangle

    quadrilateral

    tetrahedron pyramid

    prism or wedgehexahedronarbitrary polyhedron

  • 7/29/2019 CFD Lecture 01

    19/41

    19

    Tri/tet vs. quad/hex meshes

    For simple geometries, quad/hex

    meshes can provide high-qualitysolutions with fewer cells than acomparable tri/tet mesh.

    For complex geometries,quad/hex meshes show nonumerical advantage, and youcan save meshing effort by usinga tri/tet mesh.

  • 7/29/2019 CFD Lecture 01

    20/41

    20

    Hybrid mesh example

    Valve port grid.

    Specific regions can be meshedwith different cell types.

    Both efficiency and accuracy areenhanced relative to ahexahedral or tetrahedral meshalone.

    Hybrid mesh for an

    IC engine valve port

    tet mesh

    hex mesh

    wedge mesh

  • 7/29/2019 CFD Lecture 01

    21/41

    21

    Grids can either be structured(hexahedral) or unstructured(tetrahedral). Depends upon type ofdiscretization scheme and application

    Scheme Finite differences: structured

    Finite volume or finite element:

    structured or unstructured Application

    Thin boundary layers bestresolved with highly-stretchedstructured grids

    Unstructured grids useful forcomplex geometries

    Unstructured grids permitautomatic adaptive refinementbased on the pressure gradient,or regions interested (FLUENT)

    structured

    unstructured

  • 7/29/2019 CFD Lecture 01

    22/41

    22

    Example of CFD Process (Mesh)

    Grid need to be refined near the

    foil surface to resolve the boundary

    layer

    N i l th d ( id

  • 7/29/2019 CFD Lecture 01

    23/41

    23

    Numerical methods (gridtransformation)

    y

    xo o

    Physical domain Computational domain

    x x

    f f f f f

    x x x

    y y

    f f f f f

    y y y

    Transformation between physical (x,y,z)

    and computational (,,z) domains,important for body-fitted grids. The partial

    derivatives at these two domains have the

    relationship (2D as an example)

    Transform

  • 7/29/2019 CFD Lecture 01

    24/41

    24

    Solvers and numerical parameters Solversinclude: tridiagonal, pentadiagonal solvers,,

    solution-adaptive solver, multi-grid solvers, etc. Solvers can be either direct (Cramers rule, Gauss

    elimination, LU decomposition) or iterative (Jacobimethod, Gauss-Seidel method, SOR method)

    Numerical parameters need to be specified to control

    the calculation. Under relaxation factor, convergence limit, etc. Different numerical schemes Monitor residuals (change of results between

    iterations)

    Number of iterations for steady flow or number oftime steps for unsteady flow

    Single/double precisions

  • 7/29/2019 CFD Lecture 01

    25/41

    25

    Example of CFD Process (Solve)

    Residuals vs. iteration

  • 7/29/2019 CFD Lecture 01

    26/41

    26

    Example of CFD Process (Reports)

    E l f CFD P (P t i )

  • 7/29/2019 CFD Lecture 01

    27/41

    27

    Example of CFD Process (Post-processing)

    Di h l

  • 7/29/2019 CFD Lecture 01

    28/41

    28

    Dinosaur mesh example

    S t th i l d l

  • 7/29/2019 CFD Lecture 01

    29/41

    29

    Set up the numerical modelFor a given problem, you will need to:

    Select appropriate physical models.Turbulence, combustion, multiphase, etc.

    Define material properties.Fluid.

    Solid.

    Mixture.

    Prescribe operating conditions.

    Prescribe boundary conditions at all boundaryzones.

    Provide an initial solution.

    Set up solver controls.

    Set up convergence monitors.

    Compute the solution

  • 7/29/2019 CFD Lecture 01

    30/41

    30

    Compute the solutionThe discretized conservation equations are solvediteratively. A number of iterations are usually

    required to reach a converged solution.

    Convergence is reached when:

    Changes in solution variables from one iteration to the nextare negligible.

    Residuals provide a mechanism to help monitor this trend.Overall property conservation is achieved.

    The accuracy of a converged solution is dependentupon:

    Appropriateness and accuracy of the physical models.Grid resolution and independence.

    Problem setup.

    Examine the results

  • 7/29/2019 CFD Lecture 01

    31/41

    31

    Examine the resultsVisualization can be used to answer suchquestions as:

    What is the overall flow pattern?

    Is there separation?

    Where do shocks, shear layers, etc. form?

    Are key flow features being resolved?Are physical models and boundary conditionsappropriate?

    Numerical reporting tools can be used to calculate

    quantitative results, e.g:Lift, drag, and torque.

    Average heat transfer coefficients.

    Surface-averaged quantities.

  • 7/29/2019 CFD Lecture 01

    32/41

    32

    Velocity vectors around a dinosaur

  • 7/29/2019 CFD Lecture 01

    33/41

    33

    Velocity magnitude (0-6 m/s) on adinosaur

  • 7/29/2019 CFD Lecture 01

    34/41

    34

    Pressure field on a dinosaur

    Forces on the dinosaur

  • 7/29/2019 CFD Lecture 01

    35/41

    35

    Forces on the dinosaurDrag force: 17.4 N.

    Lift force: 5.5 N.

    Wind velocity: 5 m/s.

    Air density: 1.225 kg/m3.

    The dinosaur is 3.2 m tall.

    It has a projected frontal area of A = 2.91 m2

    .The drag coefficient is:

    11.091.2*25*225.1*5.0

    4.17

    2

    2

    1

    Av

    FC D

    D

    Consider revisions to the model

  • 7/29/2019 CFD Lecture 01

    36/41

    36

    Consider revisions to the model

    Are physical models appropriate?Is flow turbulent?

    Is flow unsteady?Are there compressibility effects?

    Are there 3D effects?

    Are boundary conditions correct?

    Is the computational domain large enough?Are boundary conditions appropriate?

    Are boundary values reasonable?

    Is grid adequate?Can grid be adapted to improve results?

    Does solution change significantly with adaption, or is the solutiongrid independent?

    Does boundary resolution need to be improved?

    Advantages of CFD

  • 7/29/2019 CFD Lecture 01

    37/41

    37

    Advantages of CFDRelatively low cost.

    Using physical experiments and tests to get essential

    engineering data for design can be expensive.CFD simulations are relatively inexpensive, and costs are likelyto decrease as computers become more powerful.

    Speed.

    CFD simulations can be executed in a short period of time.Quick turnaround means engineering data can be introducedearly in the design process.

    Ability to simulate real conditions.

    Many flow and heat transfer processes can not be (easily)

    tested, e.g. hypersonic flow.

    CFD provides the ability to theoretically simulate any physicalcondition.

    Advantages of CFD (2)

  • 7/29/2019 CFD Lecture 01

    38/41

    38

    Advantages of CFD (2)

    Ability to simulate ideal conditions.

    CFD allows great control over the physical process, andprovides the ability to isolate specific phenomena for study.

    Example: a heat transfer process can be idealized withadiabatic, constant heat flux, or constant temperatureboundaries.

    Comprehensive information.Experiments only permit data to be extracted at a limitednumber of locations in the system (e.g. pressure andtemperature probes, heat flux gauges, LDV, etc.).

    CFD allows the analyst to examine a large number of locationsin the region of interest, and yields a comprehensive set offlow parameters for examination.

    Limitations of CFD

  • 7/29/2019 CFD Lecture 01

    39/41

    39

    Limitations of CFDPhysical models.

    CFD solutions rely upon physical models of real world

    processes (e.g. turbulence, compressibility, chemistry,multiphase flow, etc.).

    The CFD solutions can only be as accurate as the physicalmodels on which they are based.

    Numerical errors.

    Solving equations on a computer invariably introducesnumerical errors.

    Round-off error: due to finite word size available on thecomputer. Round-off errors will always exist (though they can

    be small in most cases).Truncation error: due to approximations in the numericalmodels. Truncation errors will go to zero as the grid is refined.Mesh refinement is one way to deal with truncation error.

    Limitations of CFD (2)

  • 7/29/2019 CFD Lecture 01

    40/41

    40

    poor better

    Fully Developed Inlet

    Profile

    Computational

    Domain

    Computational

    Domain

    Uniform Inlet

    Profile

    Limitations of CFD (2)

    Boundary conditions.

    As with physical models, the accuracy of the CFDsolution is only as good as the initial/boundaryconditions provided to the numerical model.

    Example: flow in a duct with sudden expansion. If

    flow is supplied to domain by a pipe, you shoulduse a fully-developed profile for velocity ratherthan assume uniform conditions.

    Summary

  • 7/29/2019 CFD Lecture 01

    41/41

    Summary

    CFD is a method to numerically calculate heattransfer and fluid flow.

    Currently, its main application is as an engineeringmethod, to provide data that is complementary totheoretical and experimental data. This is mainly thedomain of commercially available codes and in-house

    codes at large companies.CFD can also be used for purely scientific studies,e.g. into the fundamentals of turbulence. This ismore common in academic institutions and

    government research laboratories. Codes are usuallydeveloped to specifically study a certain problem.