You are on page 1of 94

Fundamentals of Computational Fluid

Dynamics

SimScale
Title
3 Column (full page)

What is Computational Fluid Dynamics (CFD)?


2 Column

1 Column

Half page

SimScale SimScale 2016


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.

SimScale SimScale 2016


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

SimScale SimScale 2016


CFD in the product development design cycle

SimScale SimScale 2016


Why Computational Fluid Dynamics (CFD) ?

Lower development costs

Shortened design cycle

Reduce the number of prototypes needed for physical testing

A more robust and reliable finished product

A product that is optimized for performance

SimScale SimScale 2016


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

SimScale SimScale 2016


Title
3 Column (full page)

2 Column
Steps in the CFD Process

1 Column

Half page

SimScale SimScale 2016


Step 1: Create geometric model

Model with CAD software

SimScale SimScale 2016


Step 2: Discretize flow domain

Create a mesh of the fluid domain


SimScale SimScale 2016
Step 3: Define the physics model

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

Flow Outlet
Friction Walls Velocity = ?
Velocity = 0 Pressure = Known static pressure
Pressure = ?

Apply Boundary Conditions


SimScale SimScale 2016
Step 4: Results evaluation

Visualize Pressure, Velocity etc.


SimScale SimScale 2016
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 to meet requirements

SimScale SimScale 2016


Title
3 Column (full page)

2 Column
How CFD works:
The Finite Volume Method
1 Column

Half page

SimScale SimScale 2016


Physical Problem to Simulation Model

Types of Flows Quantity of interest

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

SimScale SimScale 2016


Physical Problem to Simulation Model

Navier-Stokes equations: Mass conservation

Change of mass Flow of mass Mass does not


in time through the disappear or
boundaries appear from
nowhere

SimScale SimScale 2016


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.

SimScale SimScale 2016


The Finite Volume Method

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)

SimScale SimScale 2016


The Finite Volume Method
The Control Volume:
Face centroid

CV CV boundary
centroid

SimScale SimScale 2016


The Finite Volume Method
The Control Volume:

All fields are stored in the centroid.


Data between them is interpolated.

Velocity (U) vector field

Pressure (p) scalar field

Temperature (T) scalar field

SimScale SimScale 2016


How CFD works

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

SimScale SimScale 2016


How CFD works - Process

SimScale SimScale 2016


How CFD works - Process

SimScale SimScale 2016


How CFD works - Process

SimScale SimScale 2016


How CFD works - Process

SimScale SimScale 2016


How CFD works - Process

SimScale SimScale 2016


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

SimScale SimScale 2016


Example: 2D flow in pipe
Length = 5 m

Velocity (V) = Fixed value

Pressure (P) = ?

Velocity (V) = ?

Pressure (P) =
reference static value

Real Friction Wall condition Pressure at wall = ?


Velocity at wall = 0 m/s

SimScale SimScale 2016


The Finite Volume Method: Governing Matrix
Global System of Equation

Source:
https://web.stanford.edu/class/me469b/handouts/incompressible.pdf

SimScale SimScale 2016


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

SimScale SimScale 2016


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 is known.

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
SimScale SimScale 2016
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.

SimScale SimScale 2016


The Finite Volume Method: Numerical Schemes
Lets 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

SimScale SimScale 2016


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

SimScale SimScale 2016


The Finite Volume Method: Numerical Schemes
First order upwind Central differencing 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 Hybrid approach possible

SimScale SimScale 2016


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

SimScale SimScale 2016


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

SimScale SimScale 2016


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

SimScale SimScale 2016


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

SimScale SimScale 2016


Are my results correct?

SimScale SimScale 2016


Are my results correct?

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

Residuals Forces Probes

SimScale SimScale 2016


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

SimScale SimScale 2016


Errors in CFD
Modeling Errors: Outlet Sections

SimScale SimScale 2016


Errors in CFD
Modeling Errors: Inlet Sections

Inlet

Outlet
Flow area of
interest

SimScale SimScale 2016


Errors in CFD
Modeling Errors: Inlet Sections

Inlet too close to


area of interest

Inlet at proper distance


to area of interest

SimScale SimScale 2016


Errors in CFD
Modeling Errors: Taking physics into account

Fluid entering
container

Outlet for Air in


the container

SimScale SimScale 2016


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

SimScale SimScale 2016


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, Schaums Outline Series by M. M. Abbott and H. A. van Ness

SimScale SimScale 2016


Title
3 Column (full page)

2 Column
CFD in SimScale:
Meshing
1 Column

Half page

SimScale SimScale 2016


CAD formats on SimScale

*STEP*, IGES, BREP, STL


Describes precise geometry
Make sure CAD is clean
SimScale uses SI units i.e Meters
STEP/STP format is most compatible
and recommended

SimScale SimScale 2016


CAD formats on SimScale
Always check the CAD import Info and Log

.....
Units are
Meters

SimScale SimScale 2016


CAD Operations on SimScale

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

SimScale SimScale 2016


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

SimScale SimScale 2016


The discrete representation

SimScale SimScale 2016


Elements of control volume

Volume Face centers

Centroid Boundary
faces

Mesh nodes Volume edges

SimScale SimScale 2016


Element Types: 3D Tetrahedrals

SimScale supports tetrahedral volume elements


for CFD
Very robust
Medium-quality meshes
Optional boundary layer refinement
Underlying algorithm: Netgen
4-node
Tet Element

SimScale SimScale 2016


How Netgen creates the Tet mesh

Meshing steps: Parameters to control:


Split 1-D edges Minimum edge length
Mesh surfaces Maximum edge length
Grow mesh in 3-D Overall mesh fineness
So called Bottom-up Element order
approach

SimScale SimScale 2016


1-D Tet meshing

Node

Element

SimScale SimScale 2016


2-D Surface Tet meshing

2D Cell/Element

SimScale SimScale 2016


3-D Tet meshing

SimScale SimScale 2016


Element Types: 3D Hexahedral mesh

SimScale supports Hexahedral volume


elements for CFD

Robust
High-quality meshes
Optional boundary layer refinement
Underlying algorithm: snappyHexMesh

SimScale SimScale 2016


Hex-mesh*: Defining bounding box

Top-bottom approach.

*Uses the Snappy Hex Mesh algorithm from OpenFOAM

SimScale SimScale 2016


Hex-mesh: Base Mesh for Domain

SimScale SimScale 2016


Hex-mesh: Base Mesh and refinement level

Base Mesh

Cell Size
for X

Refinement level n
n = 1, 2, 3..10, 11.

SimScale SimScale 2016


Hex-mesh: Surface refinement

SimScale SimScale 2016


Hex-mesh: Region refinement

SimScale SimScale 2016


Hex-mesh: Mesh removal

SimScale SimScale 2016


Hex-mesh: Surface snapping

SimScale SimScale 2016


Hex-mesh: Layer addition

SimScale SimScale 2016


Which Mesh Type To Select

SimScale SimScale 2016


Which Mesh Type 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.

SimScale SimScale 2016


Checking mesh quality

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

SimScale SimScale 2016


Checking mesh quality
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

SimScale SimScale 2016


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

SimScale SimScale 2016


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 3D cells

SimScale SimScale 2016


Title
3 Column (full page)

2 Column
CFD in SimScale:
Analysis Types
1 Column

Half page

SimScale SimScale 2016


CFD in SimScale

1 CAD Import 2 Mesh & Simulate 3 Design Decision

SimScale SimScale 2016


CFD Analysis in SimScale
CFD Analysis Types in SimScale
Incompressible flow
Compressible flow
Passive Scalar Transport
Multiphase flow
Discrete Phase Model (coupled
particle-fluid interaction)
Advance Concepts
Rotating Zones, Porous Media, Solid Body
Motion and 6 Degree of Freedom (6DOF)

SimScale SimScale 2016


Incompressible vs. Compressible

Incompressible Compressible
Mass and Momentum conservation Mass and Momentum conservation
only Energy (heat) balance also solved
No Energy (Heat) balance
Density is a variable
Density is constant
Mostly all Liquids Mostly gases at high speed or
Usually low speed gas flow pressure

SimScale SimScale 2016


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 compute intensive
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

SimScale SimScale 2016


Title
3 Column (full page)

2 Column
CFD in SimScale:
Incompressible Flow Analysis
1 Column

Half page

SimScale SimScale 2016


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

SimScale SimScale 2016


When is incompressibility NOT 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 ( = ), 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

SimScale SimScale 2016


Gas Properties and Models

Mach Number
Mach Number=Velocity of flow / Velocity of sound
Gases become significantly compressible at M>=0.3

Ma = /

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

SimScale SimScale 2016


Fluid Properties and Models

Incompressible Fluid Compressible Fluid

Density is constant Density changes are significant,


Depends on Pressure and Temperature
Viscosity is constant Equation of state
(no variation due to temperature change)
Viscosity may be constant or can change with
So only Kinematic Viscosity is required: temperature
Sutherlands law etc
= /
Several properties are required e.g Cp, , Pr

SimScale SimScale 2016


Steady-State or Transient
Steady or Transient Flow

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

SimScale SimScale 2016


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
Highly dissipative process
Energy cascade from large vortices to smaller vortices
Increased heat transfer
Usually at high flow speeds

Reynolds experiment showing the transition from


laminar to turbulent pipe flow. Van Dyke, 1982

SimScale SimScale 2016


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 Re becomes high:


High velocities
Large domain size Kinematic
Low kinematic viscosity of fluid
viscosity

SimScale SimScale 2016


Turbulence Models

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


way.

k-epsilon models RANS family


Available on SimScale
k-omega models
Large Eddy Simulation models LES family
Available on SimScale

SimScale SimScale 2016


Applications and Comparison
k-epsilon models k-omega SST model
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
Works well for external flow cases without flow layer simulations.
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
exhibit adverse pressure gradients, flow separation, Computationally more expensive than standard k-epsilon
strong curvature to the flow, or jet flow and k-omega
Requires a good resolution mesh

SimScale SimScale 2016


Title
3 Column (full page)

Case Study: Laminar Steady pipe flow


2 Column

1 Column

Half page

SimScale SimScale 2016


Laminar Steady Pipe Flow
Fixed Flow Inlets

Wall

Flow Outlet

SimScale SimScale 2016


Laminar Steady Pipe Flow

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

Interested in time
Fluid: Water Velocity: Low independent flow

Incompressible
Laminar Flow Steady-State
Analysis

SimScale SimScale 2016


Thank you for your attendance!
For further information about SimScale and upcoming webinars
subscribe to our social media channels or go to

www.simscale.com

You might also like