Open Source Computational Fluid
Dynamics using OpenFOAM Humberto Medina, Abhinivesh Beechook, Jonathan Saul,
Sophie Porter, Svetlana Aleksandrova and Steve Benjamin
Outline
Introduction
Computational Fluid Dynamics (CFD)
Introduction to OpenFOAM
Getting started (Myths)
Some examples
Introduction and motivation
Why open source?
Challenges?
Motivation? To promote the use of OpenFOAM and encourage its use by the light aircraft
design “community” by providing practical advice to avoid typical pitfalls and
stressing benefits
Computational Fluid Dynamics
• Firstly, the equations that describe the system are derived and/or approximated
• This requires significant mathematical understanding
• System understanding is also essential
• Equations are discretised in space (approximation)
• For example:
• Take a reference frame
• And the actual solution of the system
• Choose discrete points of interest in space
• CFD finds the solution to this discrete system
• We are left with an approximated solution
• Limitation?
• We do not know the solution…
• …so the next shape could also be a solution!
Space
Velocity
Computational Fluid Dynamics
Mesh and boundary conditions
Free-stream
Aerofoil (wall) Inlet Outlet
Free-stream
Approaches used in CFD
• DNS Direct Numerical Simulation
• Very good results
• Extremely expensive
• Used for mostly for fundamental research
• Not suitable for engineering applications
• LES Large Eddy Simulation
• Less expensive than DNS as some flow features are modelled (below inertial sub-
range)
• Difficult to set up i.e. especial boundary conditions and filters
• Practical engineering problems have been solved successfully but mostly research
• Future?
Copyright © Dr Humberto Medina
Approaches used in CFD
• DES Detached Eddy Simulation • Mixed approached
• Slightly less expensive than LES
• Implementation of new models is still a challenge
• RANS Reynolds-Averaged Navier-Stokes • Industry standard
• Inexpensive for most engineering applications
• Well established with numerous models available
• Limited to steady state solutions
• Requires a significant modelling effort to close the system of equations
Approaches used in CFD
RANS
LES
DNS
RANS
LES
DNS
100% modelled turbulence
Turbulence model required
Industrial “workhorse”
Large scales of turbulence (resolved)
Small scales of turbulence (modelled)
Restrictive industrial applications
100% resolved turbulence
Strictly restrictive to industrial
applications for at least the next few
decades
Increasing computational cost &
method accuracy
▬ Figure 2: RANS, LES & DNS comparison - zpg flat plate
The classic CFD workflow
Introduction to OpenFOAM
• Collection of libraries (c++)
• Open source and free to use (GNU GPL) • Large user base
• Development managed by the OpenFOAM Foundation
• Users can contribute new code
• Fast (very fast) development
• Bug reporting system and GIT repositories make code
traceable and trackable
• Offers many, many features! (see paper & website)
Introduction to OpenFOAM
• If OpenFOAM is that great why is not everyone using it?
• Steep learning curve
• No native Graphical User Interface (GUI)
• Case configuration via text files
• It offers so much freedom that it can be overwhelming for
new users
• Native mesh generation tools are powerful but need
refinement
• Pre-processing a current bottleneck of the purely open
source CFD solution (but some very capable solutions do
exist!!!)
Getting started (Myths)
Myth 1: Linux is inaccessible
Myth 2: No documentation
Myth 3: No mesh generation tools
Myth 4: No Graphical User Interface (GUI)
Myth 5: Difficult to post-process
Getting started (Myths)
Myth 1: Linux is inaccessible Many Linux distribution e.g. Ubuntu, Fedora, Debian, Mint, etc.
• Ubuntu download and installation
http://www.ubuntu.com/download/desktop
• Introduction to the Linux terminal
https://help.ubuntu.com/community/UsingTheTerminal
• Community support
https://help.ubuntu.com/ (Ubuntu, similar sites for other distros)
Getting started (Myths)
Myth 1: Linux is inaccessible
Getting started (Myths)
Myth 2: No documentation Sources of information (incl. unofficial)
• Official documentation
http://cfd.direct/openfoam/user-guide/
• Source code information
http://www.openfoam.org/docs/cpp/ (under modules)
https://github.com/OpenFOAM (GitHub repositories)
• Community support
http://www.cfd-online.com/ (CFD online forum)
Getting started (Myths)
Myth 3: No mesh generation tools Virtually all commercial mesh generators can be used.
• Some open-source alternatives
– OpenFOAM (blockMesh and snappyHexMesh)
– cfMesh has enormous potential (issues with boundary layer generation)
– Netgen algorithm is versatile (GUI not intuitive)
– SALOME the most complete solution (some RAM memory issues)
• Includes a very capable CAD module
Getting started (Myths)
Myth 3: No mesh generation tools (Salome)
Getting started (Myths)
Myth 4: No GUI available (Helyx-os)
Getting started (Myths)
Myth 5: Difficult to post-process (ParaView)
Getting started (Myths)
Getting started (Myths)
Getting started (Myths)
Getting started (Myths)
Post-processing
Examples: Plat plate
back
inle
t
wall (plate) leading edge
x
y z
freestream freestream
outl
et
front
U: Dirichlet condition
p: Neumann condition
Turbulent quantities: Dirichlet condition
U: Neumann condition
p: Dirichlet condition
Turbulent quantities: Neumann condition
U: Dirichlet (no slip) condition
p: Neumann condition
Turbulent quantities: Dirichlet condition
U: Neumann condition
p: Neumann condition
Turbulent quantities: Neumann condition
Boundary Conditions
Examples: Plat plate
Skin friction prediction over a flat plate • 3% Turbulence intensity level
• Experimental results (ERCOFTAC)
Launder-Sharma K-Epsilon K-Omega Transition Model (Walters 2008)
Examples: Porous medium
𝑈𝑠
Δ𝑃
𝑆 = − 𝜇𝐷 +1
2𝜌𝑈𝐹 𝑈
Δ𝑃
𝐿= 𝛼𝑈𝑠 + 𝛽𝑈𝑠
2
Examples: Planar diffuser
𝑆 = − 𝜇𝐷 +1
2𝜌𝑈𝐹 𝑈
Any Questions?