You are on page 1of 94

Fundamentals ofComputational Fluid

Dynamics
Title
3 Column (full page)

What is 2Computational
Column
Fluid Dynamics (CFD)?

1 Column

Half page
Computational Fluid Dynamics
Computational Fluid Dynamics (CFD) is a “field in fluid dynamics that incorporates
numerical analysis to simulate and solve problems involving fluid flows”.
Applications of CFD

● External Aerodynamics of ground vehicles, aircraft.


● Internal flow for automotive applications
● Liquid and gas flow in industrial equipments
● Ventilation, Heating, and Cooling (HVAC) for buildings
● Industrial blowers, fans, air units.
● Cooling for electronics applications.
● Flow and heat transfer in power generation systems
● Hydrodynamics of marine vehicles
● Wind Engineering
CFD in the product development design cycle
Why Computational Fluid Dynamics (CFD) ?

● Lowerdevelopment costs

● Shortened designcycle

● Reduce the number of prototypes needed for physical testing

● A more robust and reliable finished product

● A product that is optimized for performance


Role of CFD in the development process

● Virtual Prototyping and Testing

Easy,fast,cost-efficient design cycles

Design
Simulation Redesign Build
(CAD)

Iterations for optimal design


Title
3 Column (full page)

Steps in the CFD Process


2 Column

1 Column

Half page
Step 1: Create geometric model

Model with CAD software


Step 2: Discretize flow domain
Step 3: Define the physics model

Flow Inlet
Velocity (flow rate) =known
Pressure =?or may be known

Flow Outlet
FrictionWalls Velocity =?
Velocity = 0 Pressure =Known static pressure
Pressure = ?

Apply Boundary Conditions


Step 4: Results evaluation

Visualize Pressure, Velocity etc.


Step 5: Re-design as necessary

Analyse the design using simulation

Compute design parameters


- Pressure drop across the valve
- Outlet flow field
- Forces on the value plug

Evaluate the designs based on the parameters

Re-design tomeet requirements


Title
3 Column (full page)

How CFDworks:
2 Column

The Finite VolumeMethod


1 Column

Half page
Physical Problem to Simulation Model

Types of Flows Quantity ofinterest

● Incompressible/ Compressible ● Density, ρ

● Steady-state / Transient ● Time, t

● Laminar/ Turbulent ● Reynolds number, Re or Velocity, v

● Inviscid / Viscous ● Viscosity μ

● Sub- / Transonic ● Mach number, M

● Single- / Multi-Phase ● Macroscopic fluid properties


Physical Problem to Simulation Model

Navier-Stokes equations: Massconservation

Change of mass Flow of mass Mass does not


in time through the disappear or
boundaries appear from
nowhere
Physical Problem to Simulation Model

Navier-Stokes equations:Momentum conservation

Time change Convection term Pressure Viscous force Extra forces


forces (gravity,
etc.)

Similar to mass transport. Forces that act on the fluid.


This time we move momentum They generate / dissipate momentum.
The Finite VolumeMethod

● Most equations are derived by considering a very small fluid volume called
“Control Volume (CV)” and applying the conservation laws

● Since each CV has finite size, this method is called “Finite Volume Method” ( FVM)

● The entire continuous flow domain is discretized into these simple shaped
Control Volumes (CVs)
The Finite VolumeMethod
The ControlVolume:
Face centroid

CV CV boundary
centroid
The Finite VolumeMethod
The ControlVolume:

● All fields are stored in the centroid.


● Data between them is interpolated.

Velocity (U) – vector field

Pressure (p) – scalar field

Temperature (T) – scalar field


How CFDworks

Step 0: Physical problem to Mathematical model


Step 1: Meshing generation (discretize the continuum), Pre-processing

Step 2: Select Type of analysis (simplified model version of problem)

Step 3: Specify the Fluid properties or model

Step 4: Specify Boundary conditions


Step 5: Select Solvers and Interpolation Schemes for solution of equation system

Step 6: Post-processing results e.g Pressure loss/gain, Vorticity, Forces


How CFD works - Process
How CFD works - Process
How CFD works - Process


How CFD works - Process
How CFD works - Process
How CFD works - Process

Solvers Tolerances Pre-Conditioners


• GAMG • Relative Conditions a given problem into a
form that is more suitable for
• PCG • Absolute numerical solving
• Smooth Solvers
Example: 2D flow in pipe
Length = 5 m

Velocity (V) = Fixed value

Pressure (P) =?

Velocity (V) =?

Pressure (P) =
reference staticvalue

Real FrictionWall condition Pressure at wall = ?


Velocity at wall = 0 m/s
The FiniteVolume Method:Governing Matrix
Global System of Equation

Source:
https://web.stanford.edu/class/me469b/handouts/incompressible.pdf
The Finite Volume Method: Boundary conditions
The Dirichlet condition:

● Is a ‘fixed value condition’ for a flow variable at the boundary e.g


velocity set to zero at the wall.

● The value always remains constant .

u|∂Ω = 0 on ∂Ω
The Finite Volume Method: Boundary conditions
The Neumann condition:

● Is a ‘fixed derivative condition’ for a flow variable on the boundary e.g velocity,
pressure
● It is used when the actual value is an unknown and a variable but the rate of
change isknown.

● For example in fully developed condition at an outlet, the gradient of flow


variables is set to zero (gradients are taken normal to the boundary)

∂u/∂ν |∂Ω = 0 on ∂Ω
The Finite Volume Method: Boundary conditions
The Mixed/Robin condition:

● Is a combination of ‘fixed value and fixed derivative condition’ for a flow


variable and are suited for complex behaviour.
● Here either the value of the variable or the derivative can remain constant
at a particular part of the boundary.

● For example, in Heat Transfer, a Mix/Robin condition is used to model


cooling, where convective heat flux (derivative) and source temperature
(value) are both specified.
The Finite Volume Method: Numerical Schemes
Let‘s take a look at Navier-Stokes-Equation….

Derivative Gradient Laplacian

The necessary derivatives can only be evaluated numerically

1st order schemes Higher order schemes


• Upwind • Linear
• LinearUpwind • Van leer
• Quick • CubicCorrected
The Finite Volume Method: Numerical Schemes
Cell 1 Need to be Cell 2
calculated!

Cell center 1 Cell center 2

Properties of Numerical Schemes:


● Conservativeness: global conservation of the fluid properties must be ensured
● Boundedness:values predicted by the scheme should be within realistic bounds
● Transportive:diffusion works in all directions but convection only in the flow direction
The Finite Volume Method: Numerical Schemes
First order upwind Centraldifferencing scheme
• Value of the face is the same as the •• Linear interpolation between the cell centered
centered value in upstream cell values
• High robustness, low precession •• Can cause divergence if local Peclet >2
• Well suited to start calculation • Hybridapproach possible
The Finite Volume Method: Numerical Schemes
Second-order upwind
• Linear interpolation from the cell values in the
two cells upstream of the face
• Combination of accuracy and robustness
The Finite Volume Method: Numerical Schemes
The Interpolation schemes:
● Used for convective flux terms and pressure calculation on the cell faces
○ Gradient ∇
○ Divergence ∇
○ Laplacian Δ

Scheme Order of interpolation Description


Depends on the flow direction
Upwind 1st
Very stable but dissipative, less accurate

Independent of the flow direction


Linear 2nd
Not dissipative but less stable

May depend on the flow direction


QUICK-Cubic 3rd
Not bounded

Depends on the flow direction


Linear Upwind 2nd
Less dissipative, can be made limited
The Finite Volume Method: Solution methods

Solvers for the Linear System of Equations:

● Gauss Seidel(G.S)
○ Slow convergence
○ Very stable
● Conjugate Gradient(C.G)
○ Faster convergence
○ Stability highly dependant on
mesh quality
● Multi-Grid method(MG)
○ Very fast convergence (uses
multi-level approach)
Source:
○ Stable *A conjugate gradient method for solving the non-LTE line radiation transfer problem
+http://people.bath.ac.uk/em459/research_ellipticsolvers.html
Are my results correct?

● Experience and engineering judgement are the most important factors for
performing an accurate analysis.
● Correct implementation of the physics and modeling steps is critical for
accuracy
● Simulation results should be compared quantitatively with analytical data or
calculations
● It is always recommended to compare simulation results to some experimental
data for setting a baseline case
Are my results correct?
Are my results correct?

● The following criteria can also help to judge if a simulation is converged

Residuals Forces Probes


Errors in CFD
● Modeling and Setup Error: “1st biggest source of errors”
○ A simplified mathematical model, replicating physical setup & conditions

● Discretization Error: “2nd biggest source of errors”


○ Errors that arise from a bad or inadequate mesh
○ Domain approximations

● Numerical Error
○ Introduced by the computer when it rounds or truncates numbers as it
assembles matrices and solved equations
Errors in CFD
ModelingErrors: Outlet Sections
Errors in CFD
Modeling Errors:Inlet Sections

Inlet

Outlet
Flow area of
interest
Errors in CFD
Modeling Errors:Inlet Sections

Inlet too close to


area ofinterest

Inlet at proper distance


to area of interest
Errors in CFD
Modeling Errors:Taking physics into account

Fluid entering
container

Outlet forAir in
the container
Responsibility of the user

● Smooth and colorful contours can be produced by any model, good or bad

● A responsible user must understand the nature of the problem and the inherent
assumptions before setting up the problem and analyzing the results

● The results should always be first compared qualitatively and then with Analytical
calculations or Hand approximations to check for obvious inconsistencies
Books &resources
● “An Introduction to Fluid Dynamics” by G. K. Batchelor
● “Physical Fluid Dynamics” by D. J. Tritton
● “Fundamentals of Aerodynamics” Book by John D. Anderson
● “Modern Compressible Flow: With Historical Perspective” 2nd Edition Book by John D. Anderson

● “Modern Compressible Flow: With Historical Perspective” by J. D. Anderson


● “Elements of Gasdynamics” by H. A. Liepmann and A. Roshko. Liepmann and Roshko
● “Boundary Layer Theory” by H. Schlichting
● “Turbulent Flows” by Stephen B. Pope
● “Thermodynamics, Schaum’s Outline Series” by M. M. Abbott and H. A. van Ness

SimScale SimScale © 2016


Title
3 Column (full page)

2 Column
CFD : Meshing

1 Column

Half page

SimScale SimScale © 2016


CAD formats onSimScale

*STEP*, IGES, BREP, STL


● Describes precisegeometry
● Make sure CAD is clean
● SimScale uses SI units i.e Meters
● STEP/STP format is most compatible
and recommended
CAD formats onSimScale
Always check the CAD import‘Info’ and‘Log’

. . . ..
Units are
Meters
CAD Operations onSimScale

Scaling the model


● Perform unit scaling for uploaded or imported
CAD models. Important if CAD model was not
in meters.
● Scales all the solid parts in an assembly

Splitting of faces for STLs


● Perform face splitting operation based on a feature
angle for STL files that have only 1 face/shell
● Splitting is important for boundary condition
specification
Meshing - Why Is It Important?

● The original problem is discretized via the meshing process

● Simulation computes the results of the discretized domain

● Mesh resolution and quality has major effects on the results


○ Rate of convergence
○ Solution accuracy
○ CPU time required

● A ‘Bad’ mesh (based on resolution and quality) is the 2nd biggest


cause of simulation errors or crashes
The discrete representation
Elements ofcontrol volume

Volume Face centers

Centroid Boundary
faces

Mesh nodes Volume edges


Element Types: 3DTetrahedrals

● SimScale supports tetrahedral volume elements


for CFD

○ Very robust
○ Medium-quality meshes
○ Optional boundary layer refinement
○ Underlying algorithm:Netgen
4-node
Tet Element
How Netgen creates the Tet mesh

Meshing steps: Parameters to control:


● Split 1-D edges ● Minimumedge length
● Mesh surfaces ● Maximum edge length
● Grow mesh in 3-D ● Overall mesh fineness
● So called‘Bottom-up
● Element order
approach’
1-D Tetmeshing

Node

Element
2-D SurfaceTet meshing

2D Cell/Element
3-D Tetmeshing
Element Types: 3D Hexahedral mesh

SimScale supports Hexahedralvolume


elements for CFD

● Robust
● High-quality meshes
● Optional boundary layer refinement
● Underlying algorithm:snappyHexMesh
Hex-mesh*: Definingbounding box

‘Top-bottom’ approach.

*Uses the “Snappy Hex Mesh” algorithm from OpenFOAM


Hex-mesh: Base Mesh for Domain
Hex-mesh: Base Mesh and refinement level

Base Mesh

Cell Size
for X

Refinement level‘n’
n = 1, 2, 3……..10, 11.
Hex-mesh: Surface refinement
Hex-mesh: Region refinement
Hex-mesh: Mesh removal
Hex-mesh: Surface snapping
Hex-mesh: Layeraddition
Which MeshType To Select
Which MeshType To Select
Automatic mesher
● For simpler models with less or no relatively small faces and edges
Tet-mesh: Auto Global and local surface refinements with layers, works for single part or assembly.
Hex-mesh: Global surface refinement with layers, works only for single part that must be the fluid domain.

Parametric/Manual
● For complex models with complicated small features, faces and edges
Tet-mesh: User specified Global and local surface refinements with layers, works for single part or assembly.
Hex-mesh: All types of refinement with layers, works for single part or assembly.
Checking meshquality

Always check the meshing log for illegal cells


(The number should be low,relative to total size )

Then,inspect the mesh body visually at critical areas


(e.g.by hiding mesh surfaces)

● High Aspect-Ratio cells

● Non-Orthogonal cells

● High Skewness

● Concavity
Checking meshquality
The accuracy of the simulation depends highly on the quality of the mesh
---------------------
Layer mesh : cells:8250379 faces:26747115 points:10388056
Cells per refinement level:
0 102169
1 4096
2 14944
3 282757
4 111811
5 539081
6 2103732
7 2559871
8 2531918
Writing mesh to time constant
Wrote mesh in = 27.97 s.
Layers added in = 249.49 s.
Checking final mesh ...
Checking faces in error :
non-orthogonality > 75 degrees : 21
faces with face pyramid volume < 1e-13 : 5
faces with concavity > 80 degrees : 2
faces with skewness > 4 (internal) or 20 (boundary) : 0
faces with interpolation weights (0..1) < 0.01 : 0
faces with volume ratio of neighbour cells < 0.01 : 3
faces with face twist < 0.005 : 17
faces on cells with determinant < 0.005 : 25
Finished meshing with 73 illegal faces (concave, zero area or negative cell pyramid volume)
Finished meshing in = 820.84 s.
Should be smaller than 75 Degree!
End
Performing a mesh convergence study
● Do a convergence study to obtain mesh-independent results
○ Create a mesh using the fewest (coarse), reasonable number of
elements/cells and analyze the velocity field on a cross section
○ Recreate the mesh with a smaller (finer) element/cell distribution,
re-analyze it, and compare the results to those of the previous mesh.
○ Keep increasing the mesh density and re-analyzing the model until the
results converge and are not changing anymore.
○ Accurate results with lowest computation times
Performing a mesh convergence study
● Use point and line plots at critical sections to check value of velocity and pressure
● Compare velocity contours at cross sections for changes in results

Static Pressure (mPa)


Mesh 3Dcells
Title
3 Column (full page)

2 Column
CFD : Analysis Types

1 Column

Half page

SimScale SimScale © 2016


CFD in SimScale

1 CADImport 2 Mesh &Simulate 3 Design Decision


CFD Analysis inSimScale
● CFDAnalysisTypes in SimScale
○ Incompressible flow
○ Compressible flow
○ Passive ScalarTransport
○ Multiphase flow
○ Discrete Phase Model (coupled
particle-fluid interaction)

● Advance Concepts
○ Rotating Zones, Porous Media, Solid Body
Motion and 6 Degree of Freedom (6DOF)
Incompressible vs. Compressible

Incompressible Compressible
● Mass and Momentum conservation ● Mass and Momentum conservation
only
● Energy (heat) balance also solved
● No Energy (Heat) balance
● Densityis constant ● Density is a variable
● Mostlyall Liquids ● Mostly gases at high speed or
● Usually low speed gas flow pressure
Single vs. Multi-Phase

Single Phase Multi Phase


● Only a single fluid (liquid or gas) is ● Two fluids of different phases or 2
present different components of same phase.
● Less complicated Example Air-Water (gas-liquid) or
Oil-Water (liquid-liquid)
● less computeintensive
● More complicated and compute
● Domain is always filled with the specified intensive
fluid
● Domain has both fluids present, so
● No phase change can occur interface tracking is required
● No phase change can occur
Title
3 Column (full page)

2 Column
CFD : Incompressible
Flow Analysis
1 Column

Half page
What is an Incompressible Flow Analysis?

● An Incompressible Flow Analysis can be used to predict the fluid (liquid/gas)


flow in systems where the density change in time and space of the fluid can be
neglected. This assumption is valid at low fluid velocities and temperatures.

● This assumption is valid at:

○ Low fluid velocities

○ Low temperatures
When is incompressibilityNOT valid
Compressibility:
“Flow is compressible if the pressure or temperature changes due to flow are large
enough to cause significant density changes”.

● Liquid flow is predominantly incompressible e.g water, oil


● Gases are generally compressible (pV=nRT), but can be regarded incompressible at
low speeds

● Gases with high Pressure and Temperature variations are compressible

Compressible flow is more demanding numerically (additional equations) and should only
be selected if necessary
Gas Properties andModels

Mach Number

● Mach Number=Velocity of flow / Velocity of sound


● Gases become significantly compressible at M>=0.3

Ma =v / a

Rule of thumb:
If Ma > 0.3 then compressible flow should be applied for gases
Fluid Properties and Models

Incompressible Fluid Compressible Fluid

● Density is constant ● Density changes are significant,


○ Depends on Pressure and Temperature
● Viscosityis constant ○ Equation ofstate
(no variation due to temperature change)
● Viscosity may be constant or can change with
temperature
● So only KinematicViscosity is required:
○ Sutherland’s lawetc
v =µ/ρ
● Several properties are required e.g Cp, µ, Pr
Steady-State orTransient
Steady or TransientFlow

● If the system is expected to converge to a state where it doesn't change any more, use
steady-state.
● Transient flow changes with time and has periodic phenomenon e.g vortex shedding

Sources: http://www.bakker.org, https://en.wikipedia.org/wiki/K%C3%A1rm%C3%A1n_vortex_street


http://www.rpi.edu/dept/chem-eng/WWW/faculty/plawsky/.../CylinderTransient/Ch13CylinderTime.html
Turbulence

Turbulence is characterized by [Ferziger et al, 1999] :


● Irregular, chaotic and unsteady 3-dimensional phenomenon
● Presence of eddies, vortices and vortex stretching
● Increased mixing and interaction in the flow
● Highlydissipative process
● Energy cascade from large vortices to smaller vortices
● Increased heattransfer
● Usually at high flow speeds

Reynold’s experiment showing the transition from


laminar to turbulent pipe flow. Van Dyke, 1982
Reynolds number

● Flow remains laminar if Reynolds number is low

● The flow becomes turbulent if Reynolds number


is higher than critical value e.g. for pipe flow Velocity scale Length scale
critical Re=2300

Reasons Rebecomes high:


● High velocities
● Large domainsize Kinematic
● Low kinematic viscosity of fluid
viscosity
Turbulence Models

Turbulence models have been developed in order to simulate turbulence in a feasible


way.

k-epsilon models RANS family


k-omega models Available on SimScale

Large Eddy Simulation models LES family


Available on SimScale
Applications andComparison

e. psilon models k-omega SSTmodel


● Popular due to good convergence rate ● Useful in several cases where the k-epsilon model is not
accurate,e.g.internal flows,separated flows and jet flow
● More robust and widely used despite the known ● k-omega-SST model is a combination of the standard
limitations as it is computationally cheap k-epsilon in the free stream and the k-omega models near
the walls.
● Valid for fully turbulent flows only
● k-omega-SST is recommended for high accuracy boundary
layer simulations.
● Works well for external flow cases without flow
separation ● Works well for external flow cases with flow separation e.g
Airfoils
● Poor predictions for swirling and rotating flows ● Works well for internal flow cases
● Sometimes difficult to converge
● It performs poorly (not accurate) for flow that
● Computationally more expensive than standard k-epsilon
exhibit adverse pressure gradients, flow separation,
and k-omega
strong curvature to the flow, or jet flow
● Requires a good resolution mesh
Title
3 Column (full page)

Case Study: Laminar Steady pipe flow


2 Column

1 Column

Half page

SimScale SimScale © 2016


Laminar Steady PipeFlow
Fixed FlowInlets

Wall

Flow Outlet
Laminar Steady PipeFlow

Problem Overview:
● Velocity:Low
● Flow behaviour:Independent of time
● Fluid:Water

Interested intime
Fluid:Water Velocity:Low independent flow

Incompressible
Analysis Laminar Flow Steady-State

You might also like