0% found this document useful (0 votes)
3 views

CFD Slide Set

Uploaded by

Amine Cfd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CFD Slide Set

Uploaded by

Amine Cfd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Bahram Haddadi

© Copyright- Bahram Haddadi

www.fluiddynamics.at
What is Computational Fluid Dynamics
• Behavior of fluidic systems
• Experimental investigations
• Numerical approaches
• Analytical solutions
• Numerical representation  CFD
• Combination of Physics and Numeric

• Computer based analysis of systems


• fluid flow • Not a tool, but a science
• Heat transfer • The technique is very powerful
• Mass transfer, … • If combined with fluid dynamics
and numerics knowledge
• Application range
• Industrial
• non-industrial

Summer 2023 2
CFD vs. Other Numerical Methods
• Black box modeling

https://en.wikipedia.org
• Just time resolved
• E.g. balance calculations in a system
Details and computational cost

• Very fast but least information provided


Size of the system

• Process simulation

https://en.wikipedia.org
Time resolved
• One space dimension also resolved
• Resonably fast and moderate details about the system
• Suitable for complex industial plants and pilots

• Computational fluid dynamics


• Time resolved

@Bahram Haddadi
• Fully space resolved
• Sutable for detailed systems analysis

Summer 2023 3
CFD Workflow

@Bahram Haddadi

Summer 2023 4
CFD Tools
• Common CFD code categories
• Commercial
www.comsol.com

• Annual license cost


• No/limited access to the code
• Mostly user friendly interface and official support www.ansys.com

• E.g. Ansys Fluent, Ansys CFX, Star CCM+, COMSOL, …


• Free
• No license cost
• Mainly open-source www.star-ccm.com

• Missing official support or paid support


• E.g. OpenFOAM®

• All are built upon the same concept www.openfoam.org

Summer 2023 5
OpenFOAM®
• Open Field Operation And Manipulation
• Original development: 1980s – Imperial College (UK)
• Open source CFD toolbox – written in C++
• Operating system:
• Linux – original development and best compatibility
www.openfoam.com

• Windows – using Docker


• OSX – direct compilation or using Docker
• Different flavours:
• ESI version: openfoam.com – v2212
www.openfoam.org

• Foundation version: openfoam.org – openfoam10


• OpenFOAM extend: Hevoje Jasak – foam-extend-4.1
• Released for free download (source and binary)
• Under General Public License

Summer 2023 6
Why OpenFOAM®
• Advantages over commercial codes:
• Open source and free  No license fee
• Highly parallel
• Users can inspect, alter, expand the source code
• Users have to understand and know what he/she is doing,
not just “clicking”!!!
• Advantages over open source codes:
• One of the most versatile open source CFD programs
• All standard finite volume algorithms implemented.
• Industrial interest
• Large community on the internet: cfd-online.com and
stackoverflow.com
@Bahram Haddadi

Summer 2023 7
Mass Conservation – Continiuty Equation

Accumulation = Input - Output

An introduction to computational fluid dynamics – The finite volume method – 2nd Edition, Versteeg and Malalasekera 2007

Summer 2023 8
Governing Equations

𝜕(𝜌𝜑)
+ ∇ ∙ 𝜌𝜑𝒖 = ∇ ∙
𝜕𝑡
Time derivative

𝜕(𝜌𝜑)
+ ∇ ∙ 𝜌𝜑𝒖 = ∇ ∙ 𝛤∇𝜑 + 𝑆
𝜕𝑡
Convection term

𝜕(𝜌𝜑)
+ ∇ ∙ 𝜌𝜑𝒖 = ∇ ∙ 𝛤∇𝜑 + 𝑆𝜑
𝜕𝑡 Diffusion term

𝜕(𝜌𝜑)
+ ∇ ∙ 𝜌𝜑𝒖 = ∇ ∙ 𝛤∇𝜑 + 𝑆𝜑
𝜕𝑡 Source term

An introduction to computational fluid dynamics – The finite volume method – 2nd Edition, Versteeg and Malalasekera 2007

Summer 2023 9
Finite Volume Approach
• Mesh (grid): Converting the domain into discrete domains
• Grid cell: The small volume surrounds each node of the mesh
• Key step: integration of the transport equation over a three-dimensional control volume
• Gauss divergence theorem: Replacing volume integral of the divergence term by surface
integral
• Terms evaluated as fluxes at the surfaces
• Ensures the conservation of fluxes entering and exiting the grid
• Allows for easy formulation of the balances on unstructured meshes

• Time-dependency: integration with respect to time

𝜕 𝜌𝜑
+ 𝛻 ∙ 𝜌𝜑𝒖 = 𝛻 ∙ 𝛤𝛻𝜑 + 𝑆𝜑
𝜕𝑡 www.en.wikipedia.org

𝜕
න න 𝜌𝜑 𝑑𝑉 𝑑𝑡 + න න 𝒏 ∙ 𝜌𝜑𝒖 𝑑𝐴𝑑𝑡 = න න 𝒏 ∙ 𝛤𝛻𝜑 𝑑𝐴𝑑𝑡 + න න 𝑆𝜑 𝑑𝑉 𝑑𝑡
∆𝑡 𝜕𝑡 𝐶𝑉 ∆𝑡 𝐴 ∆𝑡 𝐴 ∆𝑡 𝐶𝑉

An introduction to computational fluid dynamics – The finite volume method – 2nd Edition, Versteeg and Malalasekera 2007

Summer 2023 10
Mesh Terminology
• Cell: control volume created by domain
discretization
• Node: grid point
• Cell center: center of a cell
• Edge: boundary of a face
• Face: boundary of a cell
• Internal
• Boundary
• Zone: grouping of nodes, faces, cells
• Domain: group of node, face and cell zones
• Nodes positions relative to the vertices
• Cell centered
• Cell vertex
• Staggered
www.manchestercfd.co.uk/post/all-there-is-to-know-about-different-mesh-types-in-cfd

Summer 2023 11
Mesh Types
• Structured Grids
• Cartesian
• Grid lines are always parallel to the coordinate
axes
• Curvilinear
• Coordinate surfaces are curved to fit boundaries
• Orthogonality: all grid lines cross at 90º
• Block-structured Grids
• Matching
• The grid on the common boundaries between
the regions is the same
• Non-matching
• Chimera (overset)

www.manchestercfd.co.uk/post/all-there-is-to-know-about-different-mesh-types-in-cfd

Summer 2023 12
Mesh Types
• Unstructured Grids
• Triangular (tetrahedral)
• Robust meshing algorithms
• Quadrilateral (hexahedral)
• Best for CFD calculations
• Polygon (polyhedral)
• Similar to tet, with less computational overhead
• Hybrid

• Quad/Hex advantages vs Tri/Tet


• Higher quality solutions for flow-aligned problems
• Fewer cells/nodes than a comparable tri/tet mesh.
• Reduced numerical diffusion

www.manchestercfd.co.uk/post/all-there-is-to-know-about-different-mesh-types-in-cfd

Summer 2023 13
OpenFOAM® Applications and Case Structure
• Solvers
• Solving a specific continuum
mechanics problem
• icoFoam
• simpleFoam
• …
• Utilities
• Performing pre and post processing
• Mesh preparation: blockMesh,
snappyHexMesh
• Simulation set-up: topoSet, setFields
• Processing the results: postProcess
• …
@Bahram Haddadi

Summer 2023 14
Mesh in OpenFOAM®
• Unstructured mesh design
• Capable of handling structured
• Basic mesh generation
• blockMesh
• Block structured meshes
• Curved internal and external boundaries.
• The mesh is setup in a script (no GUI)
• Good for simple geometries
• Advanced mesh generation
• snappyHexMesh, cfMesh
• Automatic mesh generator for complex geometries
• Possibility of mesh refinement at desired regions
• Parallel
• Mesh import
@Bahram Haddadi

• gambitToFoam, ansysToFoam, cfxToFoam, …

Summer 2023 15
Initial Conditions
• Starting value for the solver and once specified
• Transient simulations
• Initial state of the system
• Next time step values are calculated based on these
• Steady state simulations
• Initial guess for the numerical system

@Bahram Haddadi
• Initial values will be replaced by newly calculated values
• Better the initial values  the faster the convergence
• Value is assigned to the center of every cell
• A uniform value for the whole field
• Individual value per cell
• Patching fields
• OpenFOAM®: setFields
• Multi-solver solutions

Summer 2023 16
Boundary Conditions

@Bahram Haddadi
• Boundary conditions will connect the simulation domain with its
surroundings
• Each property interaction with outside the domain
• The values specified are located at the boundary faces of the
domain
• Three main types of boundary conditions
• Dirichlet: fixed value on the boundary
• Neumann: fixed gradient on the boundary
• Mixed: combined fixed value and gradient
• Most boundary conditions are either steady state or transient
• Ill-defined boundary conditions
• Non-convergence
• Incorrect results

Summer 2023 17
Time Stepping and CFL condition
• Time step
• How much the information travels across a computational grid cell
• Too big time step
• Information propagates through more than one grid cell
• Numerically: Inaccurate solution - divergence
• Physically: Nonphysical results
• Too small time step
• Computationally expensive
www.idealsimulations.com

• Information transport should not “overtake” the physical transport


• Courant-Friedrichs-Lewy (CFL) condition – Co
∆𝑡
• One-dimensional: Co = u
∆𝑥
• Less or equal to one
• Finer mesh  smaller time step
• Initial time step: maximum velocity and smallest mesh size

Summer 2023 18
Discretization
• General transport equation 𝜕 𝜌𝜑
+ 𝛻 ∙ 𝜌𝜑𝒖 = 𝛻 ∙ 𝛤𝛻𝜑 + 𝑆𝜑
𝜕𝑡

• Time derivative
𝜕𝜌𝜑 𝜌𝑃𝑛 𝜑𝑃𝑛 − 𝜌𝑃0 𝜑𝑃0
• Integrating over volume න 𝑑𝑉 ≈ 𝑉𝑃
• Euler implicit scheme 𝑉 𝜕𝑡 ∆𝑡

• Convection term
• Integrating over volume න 𝒏 ∙ 𝜌𝜑𝒖 𝑑𝐴 ≈ ෍ 𝒏 ∙ 𝐴𝜌𝒖 𝑓 𝜑𝑓 = ෍ 𝐹𝜑𝑓
𝐴 𝑓 𝑓
• Applying Gauss‘s theorem
• 𝜑𝑓 to be calculated  schemes

• Diffusion term
• Similar to convection term
න 𝒏 ∙ 𝛤𝛻𝜑 𝑑𝐴 = ෍ 𝛤𝑓 𝒏 ∙ 𝛻𝑓 𝜑 𝐴𝑓
𝐴 𝑓
• 𝛻𝑓 𝜑 gradient at the face
𝜑𝑁 − 𝜑𝑃
• Second order accurate  d orthogonal between P and N 𝒏 ∙ 𝛻𝑓 𝜑 =
𝒅
Summer 2023 19
Common Discritization Schemes

@Bahram Haddadi
• First Order Upwind
𝜑𝑒 = 𝜑𝑃 𝑖𝑓, 𝐹𝑒 > 0
𝜑𝑒 = 𝜑𝐸 𝑖𝑓, 𝐹𝑒 < 0

• Central Differencing Scheme

@Bahram Haddadi
𝜑𝐸 + 𝜑𝑃 𝜑𝑃 + 𝜑𝑊
𝜑𝑒 = , 𝜑𝑤 =
2 2

• Quadratic Upwind Interpolation for Convective Kinetics (QUICK)


6 3 1
When 𝐹𝑒 > 0, φ𝑒 = 8 φ𝑃 + 8 φ𝐸 − 8 φ𝑊

@Bahram Haddadi
6 3 1
When 𝐹𝑤 > 0, φ𝑤 = φ𝑊 + φ𝑃 − φ𝑊𝑊
8 8 8

Summer 2023 20
Discritization Schemes Properties
Prerequisite for results to be physically realistic
• Conservativeness: flux across a certain face must be equal the adjacent

@Bahram Haddadi
control volume flux through the same face
• Boundedness: ensures the solution remains within certain bound limits and
guarantees the solution does not exhibit unphysical or unrealistic behavior
• Transportiveness: Peclet number, 𝑃𝑒. It measures the relative strengths of
convection, 𝑁𝑐𝑜𝑛𝑣 and diffusion, 𝑁𝑑𝑖𝑓𝑓 .
First-order Second-order
upwind upwind

8×8
False diffusion: a multidimensional phenomenon and it
occurs when the flow is not perpendicular to the grid

@Bahram Haddadi
lines. It is a numerically introduced diffusion and arises in 64 × 64
convection dominated flows

Numerical diffusion

Summer 2023 21
Discritization Schemes Assessment

Conser Trans-
Scheme Bounded Accuracy Remarks
-vative portive
Include false diffusion if
Upwind Unconditionally the velocity vector is not
Yes First order Yes
bounded parallel to one of the
coordinate directions
Central Conditionally Unrealistic solutions at
Yes Second order No
Differencing bounded⃰ large Pe number
Less computationally
Unconditionally stable. Can give small
QUICK Yes Third order Yes
bounded undershoots and
overshoots

Summer 2023 22
Variables Storage
• Variables evaluation
• Checker-board problem

dynamics, Versteeg and Malalasekera, 2007


An introduction to computational fluid
• The cell pressure is not considered in the pressure
gradient
• Using Staggered grid
• Scalar
• Pressure, temperature, density etc.
• At ordinary nodal points
• Vectors
• Velocity
• At Staggered grid, centered around cell faces

• Generation of velocities at exactly the locations


where they are needed

Summer 2023 23
Pressure – Velocity Coupling Algorithms
• Semi-Implicit Method for Pressure Linked Equations (SIMPLE)
• Originally for steady state problems
• A guess-and-correct procedure
• SIMPLER (SIMPLE Revised) and SIMPLEC (SIMPLE Consistent)

dynamics, Versteeg and Malalasekera, 2007


An introduction to computational fluid
• Pressure Implicit with Splitting of Operators (PISO)
• Originally for unsteady compressible flows
• Non-iterative: using one predictor and two corrector steps

• PIMPLE
• Hybrid SIMPLE/PISO
• PISO internal loop with SIMPLE External loops
• Higher stability and reliability for bigger time steps

• Coupled algorithm
• Discritized pressure and velocity equations are solved in a single matrix
• Implicit coupling between pressure and velocity
• Computationally more expensive
• More stable for low quality meshes or large time steps

Summer 2023 24
Models – Turbulence
• Many engineering applications are turbulent
• Turbulence
• Reynolds number (Re)
• Highly transient phenomenon

http://home.iitk.ac.in/~aksaha/QIP_Comp_Turb/background.htm
• Characterized by a wide range of eddy sizes
• Fully resolve these eddies numerically
• Obtain a full profile of the turbulent flow field
• Computationally very expensive
• Hence we require a turbulence model

• Turbulence modeling
• Important feature is averaging
• Scales of the flow that are not resolved by the grid 
models need to be applied

• Turbulence resolving
• Reynolds Average Navier Stokes (RANS)-based models
• Large eddy simulations (LES)
• Direct Numerical Simulation (DNS)

Summer 2023 25
Models – Turbulence – RANS
• Any property can be written as the sum of an average and a fluctuation  Reynolds decomposition
𝜑෤ = Φ + φ
• The average of the fluctuating component is identically zero
• Conservation of mass
𝜕𝜌 𝜕𝜌
+ 𝛻 ∙ 𝜌෥
𝒖 =0 + 𝛻 ∙ 𝜌𝐔 = 0
𝜕𝑡 𝜕𝑡
• Conservation of momentum (Navier-Stokes equation)
𝜕 𝜌𝑢෤ 𝑖 𝜕𝑝෤ 𝜕 𝜌U𝑖 𝜕𝑃 𝜕 𝜌𝑢𝑢𝑖 𝜕 𝜌𝑣𝑢𝑖 𝜕 𝜌𝑤𝑢𝑖
෥ =−
+ 𝛻 ∙ 𝜌𝑢෤ 𝑖 𝒖 + 𝛻 ∙ 𝜇𝛻𝑢෤ 𝑖 + 𝑆ሚ𝑀𝑖 + 𝛻 ∙ 𝜌U𝑖 𝐔 = − + 𝛻 ∙ 𝜇U𝑖 − + + + S𝑀𝑖
𝜕𝑡 𝜕𝑥𝑖 𝜕𝑡 𝜕𝑥𝑖 𝜕𝑥 𝜕𝑦 𝜕𝑧
• Conservation of passive scalars (given a scalar 𝑒ǁ )
𝜕 𝜌𝑒ǁ 𝜕 𝜌E 𝜕 𝜌𝑢𝑒 𝜕 𝜌𝑣𝑒 𝜕 𝜌𝑤𝑒
ǁ 𝒖 = 𝛻 ∙ 𝑘𝛻 𝑇෨ + 𝑆ሚ𝑒
+ 𝛻 ∙ 𝜌𝑒෥ + 𝛻 ∙ 𝜌EU = 𝛻 ∙ 𝑘𝛻T − + + + S𝑒
𝜕𝑡 𝜕𝑡 𝜕𝑥 𝜕𝑦 𝜕𝑧
• New unknowns
• 6 turbulent stresses (𝜌𝑢𝑢, 𝜌𝑣𝑢, 𝜌𝑤𝑢, 𝜌𝑢𝑣, 𝜌𝑣𝑣, 𝜌𝑤𝑣, 𝜌𝑢𝑤, 𝜌𝑣𝑤, 𝜌𝑤𝑤)
• 3 turbulent fluxes (𝜌𝑢𝑒, 𝜌𝑣𝑒, 𝜌𝑤𝑒)
• Additional equations based on empirical observations Turbulence Modeling (e.g. k-ε, k-ω, ...)
• Using PDE’s for the turbulent stresses and fluxes
• Suitable for steady-state problems

Summer 2023 26
Models – Turbulence – LES
• Physical representation
• large eddies of the flow are dependent on the geometry
• The smaller eddies are more universal
RANS
• Mathematical approach
• Velocity field separated into a resolved and sub-grid part using a
filter function

@Bahram Haddadi
• Convolution of a function with a filtering kernel
• Large eddies explicitly resolved by the grid
LES
• Small eddies handled implicitly by sub grid-scale model (SGS)
• most practical (and commercial) implementations of LES use
the grid itself
• No explicit filtering is needed
• Sub grid-scale turbulence models usually employ the
Boussinesq hypothesis
• Turbulent stresses are related to the mean velocity gradients

Summer 2023 27
Models – Viscosity
• Viscosity
• Intensive property of a fluid
• Fluid internal resistance to motion or deformation
• Viscous fluids are less willing to flow than the less viscous fluids
• Newton’s law of viscosity

https://en.wikipedia.org/wiki/Apparent_viscosity
• Relationship between a fluid’s shear stress and shear rate when
subjected to mechanical stress
• Types of viscosity
• Dynamic (absolute) viscosity: fluid’s internal resistance to flow
• Kinematic viscosity: ratio of dynamic viscosity to density
• Apparent (steady shear) viscosity: shear stress ratio to shear rate
• Fluids
• Newtonian
• Non-Newtonian
• Viscosity not constant (e.g. shear-rate dependent)

Summer 2023 28
Models – Multiphase
• Simultaneous flow of materials in different phases
• Multiple components can be present per phase.
• gas-liquid, gas-solid, liquid-solid, liquid-liquid and three-phase flows

• Phases (visual appearance)

@Bahram Haddadi
• Separated: the boundary between phases is described in detail
• Mixed: dispersed particles as well as semi-continuous interfaces exist together
• Dispersed: one phase is dispersed in a continuous phase

• Modeling approaches
• Lagrangian
• Tracking individual point particles during their movement
• More suitable for dispersed configuration
• Studying particle flows, e.g. in Discrete Element Method (DEM)

@Bahram Haddadi
Eulerian
• Observing fluid behavior in a given control volume
• More suitable for fluid-fluid multiphase flows
• CFD approaches such as Euler-Euler and Volume of Fluid

Summer 2023 29
Models – Multiphase – Eulerian
• Euler-Euler approach (Multi-fluid model)
• All phases are treated as continuous
• The phases interact through the drag and lift forces Eulerian
• Concept of phasic volume fractions
• Continuous functions of space and time
• Their sum equal to one

Clemens Lischka, www.youtube.com


• A transport equation for the volume fraction is solved
• Individual conservation equations solved per phase

• Volume of Fluid (VoF) method


• Fraction function (C)
• C=1, the control volume is completely filled with the chosen phase
VoF
• C=0, the control volume is filled with a different phase
• 0<C<1, the interface between phases is present inside the control volume
• The flow domain is modeled on a fine grid
• The interface to be resolved
• To track the interface between phases:
• All field variables are shared between the phases
• The transport equations are solved for mixture properties
• An advection equation for the fraction function C is solved

Summer 2023 30
Parallel Processing
• Simultaneous use of more than one processor
• CPU
• GPU

• Save time and cost


• Computational load will be distributed among processors
• domain
• calculations

@Bahram Haddadi
• Load distribution
• Shared memory: the whole system seen as a single computer
• Distributed memory: individual computers connected through network
each seen as a computational node
Shared Memory Multiprocessor Distributed Memory Multicomputer

Data is saved in a global memory that can Each computer has a local memory and a
Memory
be accessed by all processors processor can only access its local memory
Message is sent explicitly from one
The sender processor simply needs to
Data transfer computer to another using a message
write the data in a global variable and the
between processors passing library, e.g. Message Passing
receiver can read it
Interface (MPI)

Summer 2023 31

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy