51
Introduction to Introduction to Computational Fluid Computational Fluid Dynamics Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

Embed Size (px)

Citation preview

Page 1: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

Introduction to Computational Introduction to Computational Fluid DynamicsFluid Dynamics

Adapted from notes by:

Tao Xing and Fred Stern

The University of Iowa

Page 2: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

2

OutlineOutline

What is CFD?Why use CFD?Where is CFD used? PhysicsModelingNumericsCFD processResources

Page 3: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

3

What is CFD?What is CFD?

What is CFD and its objective?

– Computational Fluid Dynamics– Historically Analytical Fluid Dynamics (AFD) and EFD

(Experimental Fluid Dynamics) was used. CFD has become feasible due to the advent of high speed digital computers.

– Computer simulation for prediction of fluid-flow phenomena. – The objective of CFD is to model the continuous fluids with

Partial Differential Equations (PDEs) and discretize PDEs into an algebra problem (Taylor series), solve it, validate it and achieve simulation based design.

Page 4: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

4

Why use CFD?Why use CFD?

Why use CFD?– Analysis and Design

Simulation-based design instead of “build & test”– More cost effectively and more rapidly than with experiments– CFD solution provides high-fidelity database for interrogation of

flow field Simulation of physical fluid phenomena that are difficult to be

measured by experiments– Scale simulations (e.g., full-scale ships, airplanes)– Hazards (e.g., explosions, radiation, pollution)– Physics (e.g., weather prediction, planetary boundary layer,

stellar evolution)

– Knowledge and exploration of flow physics

Page 5: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

5

Where is CFD used? (Aerospace)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical– Chemical Processing– HVAC&R– Hydraulics– Marine– Oil & Gas– Power Generation– Sports

F18 Store Separation

Wing-Body Interaction Hypersonic Launch Vehicle

Page 6: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

6

Where is CFD used? (Appliances)

• Where is CFD used?– Aerospace

– Appliances– Automotive– Biomedical– Chemical Processing– HVAC&R– Hydraulics– Marine– Oil & Gas– Power Generation– Sports

Surface-heat-flux plots of the No-Frost refrigerator and freezer compartments helped BOSCH-SIEMENS engineers to optimize the location of air inlets.

Page 7: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

7

Where is CFD used? (Automotive)

• Where is CFD used?– Aerospace– Appliances

– Automotive– Biomedical– Chemical Processing– HVAC&R– Hydraulics– Marine– Oil & Gas– Power Generation– Sports

External Aerodynamics Undercarriage Aerodynamics

Interior Ventilation Engine Cooling

Page 8: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

8

Where is CFD used? (Biomedical)

• Where is CFD used?– Aerospace– Appliances– Automotive

– Biomedical– Chemical Processing– HVAC&R– Hydraulics– Marine– Oil & Gas– Power Generation– Sports

Temperature and natural convection currents in the eye following laser heating.

Spinal Catheter

Medtronic Blood Pump

Page 9: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

9

Where is CFD used? (Chemical Processing)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical

– Chemical Processing– HVAC&R– Hydraulics– Marine– Oil & Gas– Power Generation– Sports

Polymerization reactor vessel - prediction of flow separation and residence time effects.

Shear rate distribution in twin-screw extruder simulation

Twin-screw extruder modeling

Page 10: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

10

Where is CFD used? (HVAC&R)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical– Chemical Processing

– HVAC&R– Hydraulics– Marine– Oil & Gas– Power Generation– Sports

Particle traces of copier VOC emissions colored by concentration level fall behind the copier and then circulate through the room before exiting the exhaust.

Mean age of air contours indicate location of fresh supply air

Streamlines for workstation ventilation

Flow pathlines colored by pressure quantify head loss in ductwork

Page 11: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

11

Where is CFD used? (Hydraulics)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical– Chemical Processing– HVAC&R

– Hydraulics– Marine– Oil & Gas– Power Generation– Sports

Page 12: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

12

Where is CFD used? (Marine)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical– Chemical Processing– HVAC&R– Hydraulics

– Marine– Oil & Gas– Power Generation– Sports

Page 13: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

13

Where is CFD used? (Oil & Gas)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical– Chemical Processing– HVAC&R– Hydraulics– Marine

– Oil & Gas– Power Generation– Sports

Flow vectors and pressure distribution on an offshore oil rig

Flow of lubricating mud over drill bit

Volume fraction of water

Volume fraction of oil

Volume fraction of gas

Analysis of multiphase separator

Page 14: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

14

Where is CFD used? (Power Generation)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical– Chemical Processing– HVAC&R– Hydraulics– Marine– Oil & Gas

– Power Generation– Sports

Flow pattern through a water turbine.

Flow in a burner

Flow around cooling towers

Pathlines from the inlet colored by temperature during standard operating conditions

Page 15: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

15

Where is CFD used? (Sports)

• Where is CFD used?– Aerospace– Appliances– Automotive– Biomedical– Chemical Processing– HVAC&R– Hydraulics– Marine– Oil & Gas– Power Generation

– Sports

Page 16: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

16

PhysicsPhysics

CFD codes typically designed for representation of specific flow phenomenon– Viscous vs. inviscid (no viscous forces) (Re)– Turbulent vs. laminar (Re)– Incompressible vs. compressible (Ma)– Single- vs. multi-phase (Ca)– Thermal/density effects and energy equation (Pr, , Gr, Ec)– Free-surface flow and surface tension (Fr, We)– Chemical reactions, mass transfer– etc…

Page 17: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

17

PhysicsPhysics

Fluid Mechanics

Inviscid Viscous

Laminar Turbulence

Internal(pipe,valve)

External(airfoil, ship)Compressibl

e(air, acoustic)

Incompressible(water)

Components of Fluid Mechanics

Page 18: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

18

Governing EquationsGoverning Equations

Continuity

Equation of motion

(Equations based on “average” velocity)(Equations based on “average” velocity)

xzxyxxxx

zx

yx

xx g

zyxx

p

z

uu

y

uu

x

uu

t

u

0

zyx uz

uy

uxt

Page 19: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

Claude-Louis Navier George Gabriel Stokes

Navier-Stokes EquationsNavier-Stokes Equations

C.L. M. H. Navier, Memoire sur les Lois du Mouvements des Fluides, Mem. de l’Acad. d. Sci.,6, 398 (1822)C.G. Stokes, On the Theories of the Internal Friction of Fluids in Motion, Trans. Cambridge Phys. Soc., 8, (1845)

Page 20: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

20

Navier-Stokes EquationsNavier-Stokes Equations(constant (constant and and ))

gvpvD t

D 2

xxxxx

zx

yx

xx g

z

u

y

u

x

u

x

p

z

uu

y

uu

x

uu

t

u

2

2

2

2

2

2

yyyyy

zy

yy

xy g

z

u

y

u

x

u

y

p

z

uu

y

uu

x

uu

t

u

2

2

2

2

2

2

zzzzz

zz

yz

xz g

z

u

y

u

x

u

z

p

z

uu

y

uu

x

uu

t

u

2

2

2

2

2

2

Page 21: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

Navier–Stokes ExampleNavier–Stokes Example

21

Fluid

L

x

y

)x-Lx(2

1 Expression Final

0 2

L

Lat x 0 0,at x 0 B.C.

2

x Integrate

x Integrate

0

2y

21

21

2

y

1

2

2

gdy

pdu

Cgdy

pdC

uu

CxCgdy

pdu

Cgdy

pd

dx

ud

gdx

ud

dy

pd

yy

y

y

Laminar Flow Static Parallel Plates

yyyyy

zy

yy

xy g

z

u

y

u

x

u

y

p

z

uu

y

uu

x

uu

t

u

2

2

2

2

2

2

Page 22: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

22

ModelingModeling Mathematical representation of the physical problem

– Some problems are exact (e.g., laminar pipe flow)– Exact solutions only exist for some simple cases. In these cases nonlinear

terms can be dropped from the N-S equations which allow analytical solution.– Most cases require models for flow behavior [e.g., K-, K-, Reynolds

Averaged Navier Stokes equations (RANS) or Large Eddy Simulation (LES) for turbulent flow]

Initial —Boundary Value Problem (IBVP), include: governing Partial Differential Equations (PDEs), Initial Conditions (ICs) and Boundary Conditions (BCs)

Page 23: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

23

Turbulent Flow RepresentationTurbulent Flow Representation

(K- (K- as an example) as an example)

velocityousinstantaneu and flow, ofdirection in the

ty net velociconstant uvelocity,deviatingu': Whereu'uu

i

i

Page 24: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

Turbulent Boundary LayerTurbulent Boundary Layer

24

Wall

y

x

U0

Bulk Stream

Outer layer

Fully turbulent layer

Sublayer + buffer layer

Edge of boundary layer

Page 25: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

25

yuyy

uu

dy

Udw

y

w

ScaleLength Viscous Velocity Friction StressShear Wall

0

y+ is similar to a local Reynolds number. Small y+ - Viscous effects dominateLarge y+ - Turbulence dominates

Page 26: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

26

COMSOL has many turbulent models available

Low-Re models require a y+ resolution of < 1 to guarantee accuracy

Low-Re models are necessary to accurately estimate skin friction and flow separation

High-Re models use wall functions to approximate averaged turbulent flow properties

Less accurate, but more computationally efficientIn COMSOL, a minimum y+ of 11.06 is enforced. To maintain accuracy, ensure cells meet this requirement

yy++ and Turbulence Models and Turbulence Models

Page 27: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

27

Numerics / DiscretizationNumerics / Discretization

Computational solution of the IBVPMethod dependent upon the model equations and

physicsSeveral components to formulation

– Discretization and linearization– Assembly of system of algebraic equations– Solve the system and get approximate solutions

Page 28: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

28

Finite DifferencesFinite Differences

Methods of Solution

Direct methods Iterative methods

Cramer’s Rule, Gauss eliminationLU decomposition

Jacobi method, Gauss-SeidelMethod, SOR method

62

2

,

3

3

,

2

2,,1

,

x

x

ux

x

u

x

uu

x

u

jiji

jiji

ji

Finite differencerepresentation

Truncation error

Page 29: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

29

Numeric SolutionNumeric Solution (Finite Differences) (Finite Differences)

o xi i+1i-1

j+1j

j-1

imax

jmaxx

y

62

3

,

3

32

,

2

2

,,,1

x

x

ux

x

ux

x

uuu

jijijijiji

Taylor’s Series Expansion u i,j = velocity of fluid

Discrete Grid Points

Page 30: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

30

Finite Difference Truncation ErrorFinite Difference Truncation Error

percentErrorfforsolutionExact

ff

xx

fxfxxf

xf

xfxat

xxf

n

x

x

fx

x

fx

x

fxfxxf

n

ji

n

n

ji

775.09823.0)22.0(

9899.0)02.0()]2.0(2cos[2)2.0()22.0(

)(

02.0????)22.0(

9511.0)(2.0:

2sin)(

!2)(

,

2

,

2

2

Page 31: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

31

CFD processCFD process

Geometry descriptionSpecification of flow conditions and propertiesSelection of modelsSpecification of initial and boundary conditionsGrid generation and transformationSpecification of numerical parametersFlow solutionPost processing: Analysis, and visualizationUncertainty assessment

Page 32: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

32

Geometry descriptionGeometry description

Typical approaches

– Make assumptions and simplifications

– CAD/CAE integration– Engineering drawings– Coordinates include Cartesian

system (x,y,z), cylindrical system (r, θ, z), and spherical system(r, θ, Φ)

Page 33: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

33

Flow conditions and propertiesFlow conditions and properties

Flow conditions and properties required are unique for each flow code and application– FlowLab requires all variables in dimensional

form– Because of focused application, research codes

often use non-dimensional variables.

Page 34: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

34

Selection of models for flow fieldSelection of models for flow field Direct Numerical Simulations (DNS) is to solve the N-S equations

directly without any modeling. Grid must be fine enough to resolve all flow scales. Applied for laminar flow and rare be used in turbulent flow.

Reynolds Averaged Navier-Stokes (NS) equations (RANS) is to perform averaging of NS equations and establishing turbulent models for the eddy viscosity. Too many averaging might damping vortical structures in turbulent flows

Large Eddy Simulation (LES), Smagorinsky’ constant model and dynamic model. Provide more instantaneous information than RANS did. Instability in complex geometries

Detached Eddy Simulation (DES) is to use one single formulation to combine the advantages of RANS and LES.

Page 35: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

35

Initial and boundary conditionsInitial and boundary conditionsFor steady/unsteady flow

IC should not affect final solution, only convergence path, i.e. iteration numbers needed to get the converged solution.

Robust codes should start most problems from very crude IC, . But more reasonable guess can speed up the convergence.

Boundary conditions– No-slip or slip-free on the wall, periodic, inlet (velocity

inlet, mass flow rate, constant pressure, etc.), outlet (constant pressure, velocity convective, buffer zone, zero-gradient), and non-reflecting (compressible flows, such as acoustics), etc.

Page 36: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

36

Grid generationGrid generation Grids can either be structured (hexahedral) or

unstructured (tetrahedral). Depends upon type of discretization scheme and application

– Scheme Finite differences: structured Finite volume or finite element:

structured or unstructured– Application

Thin boundary layers best resolved with highly-stretched structured grids

Unstructured grids useful for complex geometries

Unstructured grids permit automatic adaptive refinement based on the pressure gradient, or regions of interest (FLUENT)

Page 37: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

37

Grid ResolutionGrid Resolution

Page 38: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

38

Grid generation and transformationGrid generation and transformation

Grids designed to resolve important flow features which are dependent upon flow parameters (e.g., Re)

Commercial codes such as Gridgen, Gambit

For research code, grid generated by one of several methods (algebraic vs. PDE based, conformal mapping)

For complex geometries, body-fitted coordinate system will have to be applied (next slide). Grid transformation from the physical domain to the computational domain will be necessary

Sample grid established by Gambit of FLUENT

Page 39: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

39

Grid transformationGrid transformationy

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 () domains, important for body-fitted grids. The partial derivatives at these two domains have the relationship (2D as an example)

Page 40: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

40

Numerical parameters & flow Numerical parameters & flow solutionsolution

Numerical parameters are used to control flow solution. – Under relaxation factor, tridiagonal or pentadiagonal solvers – CFD Labs using FlowLab

Monitor residuals (change of results between iterations) Number of iterations for steady flow or number of time steps for unsteady flow

Flow solution– Solve the momentum, pressure Poisson equations and get flow field quantities, such as velocity, turbulence intensity,

pressure and integral quantities (drag forces)

Page 41: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

41

Numerical parameters & flow Numerical parameters & flow solution solution

Typical time history of residuals

The closer the flow field to the converged solution, the smaller the speed of the residuals decreasing.

Solution converged, residuals do not change after more iterations

Page 42: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

42

Post-processingPost-processing Analysis, and visualization

– Calculation of derived variables Vorticity Wall shear stress

– Calculation of integral parameters: forces, moments– Visualization (usually with commercial software)

Simple X-Y plots Simple 2D contours 3D contour carpet plots Vector plots and streamlines (streamlines are the lines

whose tangent direction is the same as the velocity vectors)

Animations (dozens of sample pictures in a series of time were shown continuously)

Page 43: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

43

Post-processing (Parallel Plates)Post-processing (Parallel Plates)

Page 44: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

44

Post-Processing (example)Post-Processing (example)

Pressure contour and velocity vectors .

Note the locations of the highest and lowest pressure regions.

Page 45: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

45

Uncertainty assessmentUncertainty assessment Rigorous methodology for uncertainty assessment using

statistical and engineering concepts– Verification: process for assessing simulation numerical uncertainty

Iterative convergence: monitoring point & integral quantities should change within the convergence criterions

Grid independent studies: 3-grids and Richardson Extrapolation– Validation: process for assessing simulation modeling uncertainty by

using benchmark experimental data Certification: full Verification and Validation done for a

certain range of geometries & parameters which are well known and then extrapolated, qualitatively as well as quantitative

– Simulating flows for which experiments are difficult (e.g., full-scale Reynolds numbers, hypersonic flows, off-design conditions)

– Objective: Simulation-based design

Page 46: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

CFD ExampleCFD Example

46

Sulzer Chemtech250 Y Plastic Structured Packing

Page 47: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

GeometryGeometry

47

• CT > STL > CFD

• CT = 0.322 mm Min Resolution

• Copy/Pasted 2x

• Surface Wrapping

• Adaptive Meshing

• Tetrahedral Mesh

• Polyhedral Mesh

Page 48: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

48

Mess DimensionsMess Dimensions

Page 49: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

49

Experiment vs. SimulationExperiment vs. Simulation

Page 50: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

50

Velocity MapVelocity Map

Page 51: Introduction to Computational Fluid Dynamics Adapted from notes by: Tao Xing and Fred Stern The University of Iowa

51

Software and resourcesSoftware and resources CFD software was built upon physics, modeling, numerics. Two types of available software

– Commercial (e.g., FLUENT, CFX, Star-CCM, COMSOL)– Research (e.g., CFDSHIP-IOWA, U2RANS)

More information on CFD can be got on the following website:– CFD Online: http://www.cfd-online.com/– CFD software

FLUENT: http://www.fluent.com/ COMSOL http://www.comsol.com/ CD-adapco: http://www.cd-adapco.com/

– Grid generation software Gridgen: http://www.pointwise.com GridPro: http://www.gridpro.com/

– Visualization software Tecplot: http://www.amtec.com/ Fieldview: http://www.ilight.com/