SlideShare a Scribd company logo
Introduction to computational
fluid dynamics using the
OpenFOAM Working with free software
丁鹏 13165044378
Disclaimer
This offering is not approved or endorsed by OpenCFD Limited, produc
er and distributor of the OpenFOAM software and owner of the OPEN
FOAM and OpenCFD trade marks.
Objectives
• FVM in general coordinate system
• Have an overview of the OpenFOAM® capabilities
• Installation and Be able to find help and documentation
• Know how to start and post-treat a simulation from existing tutorials
• Start your own simulation by modifying existing tutorials
• Understand what is behind solvers to identify the most suitable
solver for your specific problem
• Program your own solver by modifying an existing solver
What is OpenFOAM® ?
• An open source software package
• Developed by OpenCFD Ltd at ESI Group
• Released under the GNU General Public License [link]
• Abbreviation of Open Field Operation And Manipulation
• An efficient library of C++ modules
• Based on the cell centered Finite Volume Method
• Extensive CFD and Multi-physics capabilities
• Under active development [OpenFOAM Extend Project]
What is OpenFOAM® ?
• Can be freely download at www.openfoam.com
• Designed as a toolbox easily customisable
• Parallel computation implemented
• Cross-platform installation (Linux preferred)
The power of C++ template
OpenFOAM Examples
•
OpenFOAM Multi-physics capabilities:
• Computational fluid dynamics (incompressible and compressible flows).
• Computational heat transfer and conjugate heat transfer.
• Combustion and chemical reactions.
• Multiphase flows and mass transfer.
• Particle methods (DEM, DSMC, MD) and lagrangian particles tracking.
• Stress analysis and fluid-structure interaction.
• Rotating frames of reference, arbitrary mesh interface, dynamic mesh
handling, and adaptive mesh refinement.
• 6 DOF solvers, ODE solvers, computational aero-acoustics,
computational electromagnetics, computational solid mechanics, MHD
OpenFOAM Physical modeling library
• Extensive turbulence modeling capabilities (RANS, DES and LES).
• Transport/rheology models. Newtonian and non-Newtonian viscosity
models.
• Thermophysical models and physical properties for liquids and gases.
• Source terms models.
• Lagrangian particle models.
• Interphase momentum transfer models for multiphase flows.
• Combustion, flame speed, chemical reactions, porous media, radiation,
phase change.
OpenFOAM Under the hood
• Finite Volume Method (FVM) based solver.
• Collocated polyhedral unstructured meshes.
• Second order accuracy in space and time. Many discretization schemes
available (including high order methods).
• Steady and transient solvers available.
• Pressure-velocity coupling via segregated methods (SIMPLE and PISO).
• But coupled solvers are under active development.
• Massive parallelism through domain decomposition.
• It comes with its own mesh generation tools.
• It also comes with many mesh manipulation and conversion utilities.
• It comes with many post-processing utilities.
• All components implemented in library form for easy re-use.
The “GUI”of OpenFOAM
--no native GUI
Totally command line interface
Why should I use OpenFOAM?
Where can I find help and documentation
Getting started with OpenFOAM
Installation:
• OpenFOAM website [http://www.openfoam.org/download/]
• OpenFOAM wiki [https://openfoamwiki.net/index.php/Installation]
References:
• OpenFOAM user guide [http://www.openfoam.org/docs/]
• OpenFOAM programmer’s guide [http://www.openfoam.org/docs/]
• Source code [http://www.openfoam.org/docs/cpp/]
• Book [The OpenFOAM technology primer]
Actions:
Ubuntu64, OpenFoam64, Vmware,Win10.
Introduction to Linux
It is a UNIX-like operating system (OS).
So, now you might be wondering what is UNIX?
UNIX is a family of multitasking, multiuser, stable, and portable computer op
eratingsystems that derive from the original AT&T UNIX, developed in the 19
70s at the BellLabs.
• You will find UNIX/Linux in laptops, desktop PCs, servers, and super computers.
• UNIX/Linux systems: the kernel, the shell, and the programs.
• The kernel is the hub of the OS.
• The shell (or the terminal), acts as an interface between the user and the kernel.
• Programs are the different applications that the user uses.
Some Linux facts
• Originally developed by Linus Torvalds in 1991.
• Free and Open Source (the kernel).
• A wide range of Linux applications are free and Open Source.
• It can be installed in a great variety of hardware (laptops, desktop PCs, servers, su
percomputers, mobile phones, embedded microchips, and so on).
• It is stable, fast-performing, and highly configurable.
• It is the ideal OS for developing applications. It comes with many compilers,
interpreters, and libraries.
• Most modern Linux versions come with a GUI (similar to Windows or MacOSX).
• Knowledge of the terminal is required.
Linux distributions
There are many Linux distributions available (free and commercial)
• Red Hat.
• CentOS.
• Fedora.
• OpenSUSE.
• Slackware.
• Debian.
• Ubuntu.
• Mint.
• Arch.
During this course we will use Ubuntu.
What is the Linux terminal or shell?
• The terminal emulator or the shell acts as an interface between the user
and the OS.
• The shell, is a program that reads commands in the terminal (from the keyboa
rd) and send results back to the terminal (to the screen).
• It acts as a command line interpreter.
Where is the terminal in my Linux
distribution?
In most Linux distributions, finding the shell is pretty easy.
Just look for the terminal or console application in the applications menu
Basic shell interaction
Try input the following three commands , what is the feed
back .
whoami
date (date "+DATE: %m/%d/%y%nTIME: %H:%M:%S")
man
tab
arrow(up down)
history
Some Linux commands
command: pwd(Print Working Directory)
command: ls(List Files)
1. List Files using ls with no option
2. List Files With option –l
3. View Hidden Files –a
4. List Files with Human Readable Format with option -lh
5. List Files in Reverse Order –r
6. Recursively list Sub-Directories -R
7. Sort Files by File Size -lS
command: ls(List Files)
1. List Files using ls with no option
2. List Files With option –l
3. View Hidden Files –la
4. List Files with Human Readable Format with option -lh
5. List Files in Reverse Order –lr
6. Recursively list Sub-Directories -R
7. Sort Files by File Size -ls
command: cd (Change Directory)
1. Switch back to previous directory where you working earlier “ cd –”
2. Change Current directory to parent directory “cd ..”
3. Show last working directory from where we moved “cd –”
4. Move two directory up from where you are now. “cd ../../”
5. Move to users home directory from anywhere “cd ~”
6. using “TAB”.
OpenFOAM file structure
OpenFOAM file structure
OpenFOAM file structure
OpenFOAM file structure
OpenFOAM file structure
OpenFOAM file structure
OpenFOAM file structure
OpenFOAM environment
Load OpenFOAM module:
source /????/openfoam/etc/bashrc
Alternatively for regular OpenFOAM use, edit your
bashrc file:
Open bashrc file:
nano ∼/.bashrc
Add the following at the end of the file:
source /????/openfoam/etc/bashrc
OpenFOAM environment
To list all the environment variables related to
OpenFOAM®, type in the terminal:
env | grep “OpenFOAM”
OpenFOAM environment
Looking for information in OpenFOAM®
source code
locate a directory inside $WM_PROJECT_DIR that co
ntains the string fvPatch in its name
locate a file inside $WM_PROJECT_DIR that contains
the string fvPatch in its name
Looking for information in OpenFOAM®
source code
find the string LES inside all the files within the direc
tory$FOAM_SOLVERS
-r recurisive
-n print out line number
Simulation workflow
Let run----- Heat diffusion
Solver : laplacianFoam
1. Check the path of working directory:
echo $WM_PROJECT_USER_DIR
2. cp -r $FOAM_TUTORIALS/basic/laplacianFoam/flange/ .
3. cd flang
4. ls
5. ./Allrun
General structure of an OpenFOAM case
General structure of an OpenFOAM case
General structure of an OpenFOAM case
General structure of an OpenFOAM case
General structure of an OpenFOAM case
General structure of an OpenFOAM case
Introduction to FVM
Conservation of Mass (Continuity Equation)
Introduction to FVM
Conservation of Momentum
Introduction to FVM
Conservation of Energy
An simple example of FVM
study of heat transfer from a microprocessor connected to
a heat sink with a copper base that acts as a heat spreader
An simple example of FVM
Step I: Geometric and Physical Modeling
An simple example of FVM
Step II: Domain Discretization
discrete non-overlapping cells
An simple example of FVM
Mesh Topology
include element to element relations, face to elements relations, geom
etric information of the surfaces, element centroid and volume, face ce
ntroid, area and normal direction, etc.
An simple example of FVM
An simple example of FVM
Element connectivity and Matrix
relates the local assembly matrix to the global matrix
An simple example of FVM
An simple example of FVM
Step III: Equation Discretization
governing partial differential equations, are transformed into a set of al
gebraic equations, one for each element in the computational domain.
An simple example of FVM
Step III: Equation Discretization
An simple example of FVM
Step III: Equation Discretization
An simple example of FVM
Step III: Equation Discretization
An simple example of FVM
Step III: Equation Discretization
An simple example of FVM
Step III: Equation Discretization
An simple example of FVM
Step IV: Solution of the Discretized Equations
Direct Methods
only good for small A<1000, are rarely used in computational fluid dynamics
Iterative Methods
Gauss-Seidel
Jacobi
Krylov
Multigrid
………………………………………………
very popular
An simple example of FVM
Step Last: Post-Processing
Data processing?................
Beautiful results doesn’t mean correct.
Make conclusion for your study.
Introduction to FVM
The general transport equation
• This is a second order equation. For good accuracy, it is necessary that the
order of the discretization is equal or higher than the order of the equation tha
t is being discretized (in space and time).
• By the way, starting from this equation we can write down the Navier-Stokes
equations (NSE). So everything we are going to address also applies to
the NSE.
Introduction to FVM
Introduction to FVM
• The control volumes can be of any shape (e.g., tetrahedrons, hexes, prisms,
pyramids,and so on). The only requirement is that the faces that made up the
control volume need to be planar.
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Diffusive flux in an orthogonal mesh is very simple
Introduction to FVM
Diffusive flux in a non-orthogonal mesh.
Introduction to FVM
The surface vector should be decomposed.
Introduction to FVM
Minimum Correction Approach
Introduction to FVM
Orthogonal Correction Approach
Introduction to FVM
Over-Relaxed Approach
Introduction to FVM
Cross diffusion
Over-relaxed method is most stable even when the grid is highly
non-orthogonal
Introduction to FVM
Introduction to FVM
When the grid is skewed the line does not necessarily pass throu
gh the centroid of the face, Thus a correction for the interpolated
value at f′ is needed in order to get the value at f.
Introduction to FVM
Gradient computation at cell centroids and faces is fundamental t
o constructing the discretized sets of diffusion equations and con
vection.
Green-Gauss Gradient Method
Introduction to FVM
Gradient computation at cell centroids and faces is fundamental t
o constructing the discretized sets of diffusion equations and con
vection.
Green-Gauss Gradient Method
Introduction to FVM
Least-Square Gradient
Introduction to FVM
In the least square methods, a gradient is computed by an optimi
zation procedure that finds the minimum of the function. w is so
me weighting factor
Introduction to FVM
In the least square methods, a gradient is computed by an optimi
zation procedure that finds the minimum of the function. w is so
me weighting factor
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Where do we set all the discretization
schemes in OpenFOAM
Time discretization schemes
• There are many time discretization schemes available in OpenFOAM.
• You will find the source code in the following directory:
$WM_PROJECT_DIR/src/finiteVolume/finiteVolume/ddtSchemes
• These are the time discretization schemes that you will use most of the ti
mes:
• steadyState: for steady state simulations (implicit/explicit).
• Euler: time dependent first order (implicit/explicit), bounded.
• backward: time dependent second order (implicit), bounded/unb
ounded.
• CrankNicolson: time dependent second order (implicit), bounded
/unbounded.
• First order methods are bounded and stable, but diffusive.
• Second order methods are accurate, but they might become oscillatory.
• we always want a second order accurate solution.
• If you keep the CFL less than one when using the Euler method, numeric
al diffusion is not
Convective discretization schemes
• You will find the source code in the following directory:
$WM_PROJECT_DIR/src/finiteVolume/interpolation/surfaceInterpolati
on
• These are the convective discretization schemes that you will use most of
the times:
• upwind: first order accurate.
• linearUpwind: second order accurate, bounded.
• linear: second order accurate, unbounded.
• A good TVD scheme (vanLeer or Minmod): TVD, second or
der accurate, bounded.
• limitedLinear: second order accurate, unbounded, but mor
e stable than pure linear.
Recommended for LES simulations (kind of similar to the Fr
omm method).
• First order methods are bounded and stable but diffusive.
• Second order methods are accurate, but they might become oscillatory.
Numerical Playground---pure convection
Solver used: scalarTransportFoam
Mission: Comparison of different convection discretization schemes
boundness and overshoot
familiar with gnuplot
Numerical Playground---pure convection
Mission:
• Test convection schemes, which one is more accurate?
• Are all time discretization schemes bounded?
• If you are using the Crank-Nicolson scheme, how will you avoid oscillations?
• Does the solution improve if you reduce the time-step?
• Use the upwind scheme and a really fine mesh. Do the accuracy of the solution
improve?
• Pure convection problems have analytical solutions. You are asked to design
your own tutorial with an analytical solution in 2D or 3D.
• Try to break the solver using a time step less than 0.005 seconds. You are allow
to modify the original mesh and use any combination of discretization schemes.
Convective discretization schemes
• When you use linearUpwind for div(phi,U), you need to tell OpenFOAM® how to
compute the
velocity gradient or grad(U)
Gradient discretization schemes
• You will find the source code in the following directory:
$WM_PROJECT_DIR/src/finiteVolume/finiteVolume/gradSchemes
• These are the gradient discretization schemes that you will use most of the times:
• Gauss
• leastSquares
• To avoid overshoots or undershoots when computing the gradients, you can use gra
dient limiters.
• Gradient limiters increase the stability of the method but add diffusion due to clippi
ng.
• You will find the source code in the following directory:
$WM_PROJECT_DIR/src/finiteVolume/finiteVolume/gradSchemes/limitedG
chemes
• These are the most important gradient limiter schemes available in OpenFOAM®:
Gradient discretization schemes
• These are the most important gradient limiter schemes available in OpenFOAM®:
cellLimited, cellMDLimited, faceLimited, faceMDLimited
• Cell limiters will limit cell-to-cell values.
• Face limiters will limit face-to-cell values.
• The multi-directional (dimensional) limiters (cellMDLimited and faceMDLimited), will
apply the limiter in each face direction separately.
• The standard limiters (cellLimited and faceLimited), will apply the limiter to all comp
onents of
Gradient discretization schemes
• The gradient limiter implementation in OpenFOAM®, uses a blending factor .
• Setting to 0 is equivalent to turning off the gradient limiter. You gain accuracy but t
he solution
might become unbounded.
• By setting the blending factor equal to 1 the limiter is always on. You gain stability b
ut you give
up accuracy (due to gradient clipping).
• If you set the blending factor to 0.5, you get the best of both worlds.
Laplacian terms discretization schemes
• You will find the source code in the following directory:
$WM_PROJECT_DIR/src/finiteVolume/finiteVolume/snGradSchemes
• These are the Laplacian terms discretization schemes that you will use most of the ti
mes:
• orthogonal: mainly limited for hexahedral meshes with no grading (a perfect mesh).
Second order accurate, bounded on perfect meshes, without non-orthogonal correction
s.
• corrected: for meshes with grading and non-orthogonality. Second order accurate,
bounded depending on the quality of the mesh, with non-orthogonal corrections.
• limited: for meshes with grading and non-orthogonality. Second order accurate,
bounded depending on the quality of the mesh, with non-orthogonal corrections.
• uncorrected: usually used on bad quality meshes with grading and non-orthogonality.
Second order accurate, without non-orthogonal corrections. Stable but more diffusive
than the limited and corrected methods
Laplacian terms discretization schemes
• The limited method uses a blending factor :
• Setting to 1 is equivalent to using the corrected method. You gain accuracy, but the
solution might
become unbounded.
• By setting the blending factor equal to 0 is equivalent to using the uncorrected met
hod. You give up accuracybut gain stability.
• If you set the blending factor to 0.5, you get the best of both worlds. In this case, the
non-orthogonal
Numerical Playground---pure diffusion
Solver used: scalarTransportFoam
Mission: Comparison of different laplacian discretization schemes
Numerical Playground---pure diffusion
Solver used: scalarTransportFoam
What method should I use?
• It is equivalent to the default method you will
find
In commercial solvers.
• In overall, this setup is second order accurate
and
fully bounded.
• According to the quality of your mesh, you wi
ll
needto change the blending factor of the
laplacianSchemes and snGradSchemes keywor
ds.
• To keep temporal diffusion to a minimum, us
e a CFL
number less than 2.
• If during the simulation the turbulence quanti
ties
A very stable but too diffusive numerics
• If you are looking for extra stability, you can use thi
s method.
• This setup is very stable but too diffusive.
• This setup is first order in space and time.
• You can use this setup to start the solution in the
presence of bad quality meshes or strong discontin
uities.
• Remember, you can start using a first order method
and then switch to a second order method.
• Start robustly, end with accuracy.
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
Introduction to FVM
• As you can see, when it comes to linear solvers there are many options and comb
inations available in OpenFOAM.
• When it comes to choosing the linear solver, there is no written theory.
• Most of the times using the GAMG method (geometric-algebraic multi-grid), is th
e best choice for symmetric matrices (e.g., pressure).
• The GAMG method should converge fast (less than 20 iterations). If it’s taking m
ore iterations, try to change the smoother.
• And if it is taking too long or it is unstable, use the PCG solver.
Introduction to FVM
• When running with many cores (more than 1000), using the PCG might be a b
etter choice.
• For asymmetric matrices, the PBiCGStab method with DILU preconditioner is a
good choice.
• The smoothSolver solver with smoother GaussSeidel, also performs very well.
• If the PBiCGStab method with DILU preconditioner mysteriously crashed with a
n error related to the preconditioner, use the smoothSolver or change the preco
nditioner.
• But in general the PBiCGStab solver should be faster than the smoothSolver so
lver.
• Usually, computing the velocity and the transported quantities is inexpensive a
nd fast, so it is a good idea to use a tight tolerance (1e-8) for these fields.
On the CFL number
• The CFL number is a measure of how much information ( ) traverses a com
putational grid cell ( ) in a given time-step ( ).
• The CFL number is not a magical number.
• The CFL number is a necessary condition to guarantee the stability of the
numerical scheme.
• But not all numerical schemes have the same stability requirements.
On the CFL number
• The CFD solvers can be explicit and implicit.
• Explicit and implicit solvers have different stability requirements.
• Implicit numerical methods are unconditionally stable. they are not constrained to t
he CFL
number condition.
• However, unconditionally stable, does not mean that you can choose a time step of
any size.
• The time-step must be chosen in such a way that it resolves the time-dependent fe
atures, and it maintains the solver stability.
• When we use implicit solvers, we need to assemble a large system of equations.
• But as we are often interested in the unsteadiness of the solution, we usually use a
CFL number in the order of 1.0
How to control the CFL number
• You can control the CFL number by changing th
e mesh
cell size or changing the time-step size.
• The easiest way is by changing the time-step siz
e.
• If you refine the mesh, and you would like to ha
ve the same CFL number as the base mesh, you w
ill need to decrease the time-step size.
• On the other side, if you coarse the mesh and y
ou would like to have the same CFL number as th
e base mesh, you will need to increase the time-st
ep size.
• The keyword deltaT controls the time-step size
of the simulation (0.0001 seconds in this generic c
ase).
The output screen
Mesh Generation-blockmesh
Block structured grid system 2D and 3D
Mesh Quality
Mesh Generation-blockmesh
Important mesh metrics for OpenFOAM
Mesh Generation-blockmesh
Every block can be seen as a cube in topology space
The blockMeshDict dictionary.
The blockMeshDict dictionary.
The blockMeshDict dictionary.
The blockMeshDict dictionary.
The blockMeshDict dictionary.
The blockMeshDict dictionary.
run foamCleanTutorials
run blockMesh
run checkMesh
run paraFoam
constant/polyMesh/boundary dictionary
The OpenFOAM mesh format
The OpenFOAM mesh format
The OpenFOAM mesh format
The OpenFOAM mesh format
How to change mesh grading
How to change mesh grading
How to change mesh grading
Multi-grading of a block
Multi-grading of a block
Multi-grading of a block
How to work with multiple blocks
face matching(treated automatically):
the set of faces that comprise a patch from one block are formed from the same set of
vertices as a set of faces patch that comprise a patch from another block;
face merging(must specify interfaces):
a group of faces from a patch from one block are connected to another group of faces from a
patch from another block, to create a new set of internal faces connecting the two blocks.
How to work with multiple blocks
How to work with multiple blocks
How to work with multiple blocks
How to work with multiple blocks
How to work with multiple blocks
How to work with multiple blocks
Use curved edges in blockMesh
Use curved edges in blockMesh
Let work with a T-Junction Pipe
Let work with a 3D pipe
O-grid topology
Build in Geomerty
Searchable objects
These objects define analytical shapes, to define the geometry to mesh or refi
nement regions.
Build in Geomerty
Searchable Cone
Build in Geomerty
Searchable Sphere
BlockMesh –project onto
Build in Geomerty
geometry
{
sphere
{
type sphere;
origin (0 0 0);
radius 1.0;
}
}
edges
(
project 0 1 (sphere)
…….
……..
);
faces
(
project (0 4 7 3) sphere
…….
……..
);
OpenFoam Mesh Generation-SnappyHexMesh
◮ SHM is a fully automatic, parallel, octree-refinement-based mesh generati
on app for OpenFOAM.
◮ Mesh generation is based on four steps:
SnappyHexMesh Workflow
SnappyHexMesh
go further by yourself
import a third-party software mesh into
OpenFOAM
The list of currently available mesh conversion utilities can be found in:
ls $FOAM_UTILITIES/mesh/conversion
panacea of meshing? ---polyhedral mesh
• In polyhedral meshes the cells have more neighbors than in tetrahedr
al and/or hexahedral meshes, hence the gradients are approximated be
tter on polyhedral meshes.
• Another interesting property of polyhedral meshes is that they reduce
the cell count. But there is a catch, they increase the number of faces
so you need to compute more fluxes (diffusive and convective).
• Polyhedral meshes are not easy to generate, most of the times you ne
ed to start from tetrahedral meshes.
• polyhedral meshes inhered the same quality problems of the starting
tetrahedral mesh, sometimes they made things worst.
• Are polyhedral meshes better than hex or tet meshes? You need to co
nduct your own numerical experiments.
About the Mesh
• Remember, garbage in - garbage out.
• Use hexahedral meshes whenever is possible, specially if high accurac
y in predicting forces is your goal.(does not mean that tetra mesh are
no good).
• Increasing the cells count will likely improve the solution accuracy
when you refine your mesh (specially when it is done automatically),
the overall quality of the mesh is reduced.
• The mesh density should be high enough to capture all relevant flow
features.
Let run----- 2d driven cavity at Re=100
Technical Report:
Is a 2d driven cavity flow at Re=15,000
steady or unsteady?
Fluent or OpenFOAM
Pressure-Velocity coupling in OpenFOAM
The SIMPLE loop in OpenFOAM
The PISO loop in OpenFOAM
2d driven cavity---workflow
2d driven cavity---running the case
$> foamCleanTutorials
$> blockMesh
$> checkMesh
$> icoFoam
$> postProcess -func sampleDict -latestTime
$> gnuplot gnuplot/gnuplot_script
$> paraFoam
Crash introduction to paraview
Crash introduction to paraview
Crash introduction to paraview
Crash introduction to paraview
Crash introduction to paraview
Crash introduction to paraview
Crash introduction to paraview
Crash introduction to paraview
log files
$> icoFoam | tee ico.log
$> foamLog ico.log
$> gnuplot
Stopping the simulation
Your simulation will automatically stop at the time value you set using the k
eyword endTime in the controlDict dictionary.
Stopping the simulation
If you want to stop the simulation and save the solution, in the controlDict
dictionary made the following modification,
stopAt writeNow;
Stopping the simulation
The previous modifications can be done on-the-fly, but you will need to se
t the keyword runTimeModifiable to true in the controlDict dictionary.
Cleaning the case folder
• If you want to erase the mesh and the solution in the current case folder, you can
type in the terminal,
$> foamCleanTutorials
• If you are running in parallel, this will also erase the processorN directories. We wi
ll talk about running in parallel later.
• If you are looking to only erase the mesh, you can type in the terminal,
$> foamCleanPolyMesh
• If you are only interested in erasing the saved solutions, in the terminal type,
$> foamListTimes -rm
• If you are running in parallel and you want to erase the solution saved in the proc
essor directories, type in the terminal,
$> foamListTimes –rm -processor
A deeper view to the case setup
• The time step directories contain the values of all the variables at those ti
me steps (the solution). The 0 directory is thus the initial condition and bo
undary conditions.
• The constant directory contains the mesh and dictionaries for thermophy
sical, turbulence models and advanced physical models.
• The system directory contains settings for the run, discretization schemes
and solution procedures.
• The postProcessing directory contains the information related to the
functionObjects (we are going to address functionObjects later).
The constant directory
• The transportProperties file is a dictionary for the dimensioned scalar nu,
or the kinematic viscosity.
The constant directory
Therefore, the dimensioned scalar nu or the kinematic viscosity
The Boundary Conditions
The system/blockMeshDict dictionary define all the surface patches where we want
to apply boundary conditions
The Boundary Conditions
The constant/polyMesh/boundary dictionary
The Boundary Conditions
The constant/polyMesh/boundary dictionary
The 0 directory
The 0 directory
remark on the pressure field
Running in parallel
The method of parallel computing used by OpenFOAM is known as domain
decomposition, in which the geometry and associated fields are broken into
pieces and distributed among different processors.
The parallel programming implementation is hidden from the user.
Do not ask about scalability, that is problem/hardware specific.
Running in parallel
Summarizing to run in parallel we proceed in the following way:
$> decomposePar
$> mpirun –np <NPROCS> <application/utility> –parallel
$> reconstructPar
Running in parallel
• The mesh and fields are decomposed using the decomposePar utility.
• They are broken up according to a set of parameters specified in a diction
ary named decomposeParDict that is located in the system directory of the
case.
My simulation is always exploding
If after choosing the numerical scheme, linear solvers, and time step, your simulation always crash, you
can try this.
• Set the discretization scheme of the convectiveterms to upwind.
• Set the discretization scheme of the diffusive terms to Gauss linear limited 0.5
• Set the discretization scheme of the gradient terms to cellLimited Gauss linear 1.0
• Set the temporal discretization scheme to euler.
• Use the PISO method, and set nCorrectors 3, and nNonOrthogonalCorrectors 2.
• Do not use adaptive time-stepping.
• Use a CFL number of the order of 0.5 and set deltaT to a low value in order to avoid jumps
during the first iteration.
• This is one of a hell stable numerical scheme. However it is first order accurate.
• If this does not work, you should check your boundary conditions, initial conditions, physical
properties and model properties.
• You should also know the limitations of the solver you are trying to use, maybe the solver is
not compatible or can not solve the physics involve.
Some kind of conclusion
• Good mesh – good results.
• Start robustly and end with accuracy.
• Stability, accuracy and boundedness, play by these
terms and you will succeed.
• Select wisely the boundary conditions.
That was only the tip of the iceberg
Now the rest is on you

More Related Content

What's hot

OpenFOAMによる気液2相流解析の基礎と設定例
OpenFOAMによる気液2相流解析の基礎と設定例OpenFOAMによる気液2相流解析の基礎と設定例
OpenFOAMによる気液2相流解析の基礎と設定例
takuyayamamoto1800
 
OpenFOAMにおける混相流計算
OpenFOAMにおける混相流計算OpenFOAMにおける混相流計算
OpenFOAMにおける混相流計算takuyayamamoto1800
 
OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-
OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-
OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-Fumiya Nozaki
 
OpenFOAM for beginners: Hands-on training
OpenFOAM for beginners: Hands-on trainingOpenFOAM for beginners: Hands-on training
OpenFOAM for beginners: Hands-on training
Jibran Haider
 
How to chtmultiregionfoam
How to chtmultiregionfoamHow to chtmultiregionfoam
How to chtmultiregionfoam
Eustache Gokpi
 
OpenFOAM の境界条件をまとめよう!
OpenFOAM の境界条件をまとめよう!OpenFOAM の境界条件をまとめよう!
OpenFOAM の境界条件をまとめよう!Fumiya Nozaki
 
Turbulence Models in OpenFOAM
Turbulence Models in OpenFOAMTurbulence Models in OpenFOAM
Turbulence Models in OpenFOAM
Fumiya Nozaki
 
OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』
OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』
OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』
Fumiya Nozaki
 
OpenFOAM Training v5-1-en
OpenFOAM Training v5-1-enOpenFOAM Training v5-1-en
OpenFOAM Training v5-1-en
Cyprien Soulaine
 
OpenFOAMのDEM解析のpatchInteractionModelクラスの解読
OpenFOAMのDEM解析のpatchInteractionModelクラスの解読OpenFOAMのDEM解析のpatchInteractionModelクラスの解読
OpenFOAMのDEM解析のpatchInteractionModelクラスの解読
takuyayamamoto1800
 
OpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能についてOpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能について
Fumiya Nozaki
 
OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)
OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)
OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)takuyayamamoto1800
 
OpenFOAMの壁関数
OpenFOAMの壁関数OpenFOAMの壁関数
OpenFOAMの壁関数
Fumiya Nozaki
 
OpenFOAM LES乱流モデルカスタマイズ
OpenFOAM LES乱流モデルカスタマイズOpenFOAM LES乱流モデルカスタマイズ
OpenFOAM LES乱流モデルカスタマイズ
mmer547
 
Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)
Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)
Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)
takuyayamamoto1800
 
rhoCentralFoam in OpenFOAM
rhoCentralFoam in OpenFOAMrhoCentralFoam in OpenFOAM
rhoCentralFoam in OpenFOAM
Daisuke Matsubara
 
OpenFOAMのinterfoamによる誤差
OpenFOAMのinterfoamによる誤差OpenFOAMのinterfoamによる誤差
OpenFOAMのinterfoamによる誤差
takuyayamamoto1800
 
multiDimAMR
multiDimAMRmultiDimAMR
multiDimAMR
守淑 田村
 
OpenFOAMにおける相変化解析
OpenFOAMにおける相変化解析OpenFOAMにおける相変化解析
OpenFOAMにおける相変化解析
takuyayamamoto1800
 
Limited Gradient Schemes in OpenFOAM
Limited Gradient Schemes in OpenFOAMLimited Gradient Schemes in OpenFOAM
Limited Gradient Schemes in OpenFOAM
Fumiya Nozaki
 

What's hot (20)

OpenFOAMによる気液2相流解析の基礎と設定例
OpenFOAMによる気液2相流解析の基礎と設定例OpenFOAMによる気液2相流解析の基礎と設定例
OpenFOAMによる気液2相流解析の基礎と設定例
 
OpenFOAMにおける混相流計算
OpenFOAMにおける混相流計算OpenFOAMにおける混相流計算
OpenFOAMにおける混相流計算
 
OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-
OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-
OpenFOAM -空間の離散化と係数行列の取り扱い(Spatial Discretization and Coefficient Matrix)-
 
OpenFOAM for beginners: Hands-on training
OpenFOAM for beginners: Hands-on trainingOpenFOAM for beginners: Hands-on training
OpenFOAM for beginners: Hands-on training
 
How to chtmultiregionfoam
How to chtmultiregionfoamHow to chtmultiregionfoam
How to chtmultiregionfoam
 
OpenFOAM の境界条件をまとめよう!
OpenFOAM の境界条件をまとめよう!OpenFOAM の境界条件をまとめよう!
OpenFOAM の境界条件をまとめよう!
 
Turbulence Models in OpenFOAM
Turbulence Models in OpenFOAMTurbulence Models in OpenFOAM
Turbulence Models in OpenFOAM
 
OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』
OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』
OpenFOAM v2.3.0のチュートリアル 『oscillatingInletACMI2D』
 
OpenFOAM Training v5-1-en
OpenFOAM Training v5-1-enOpenFOAM Training v5-1-en
OpenFOAM Training v5-1-en
 
OpenFOAMのDEM解析のpatchInteractionModelクラスの解読
OpenFOAMのDEM解析のpatchInteractionModelクラスの解読OpenFOAMのDEM解析のpatchInteractionModelクラスの解読
OpenFOAMのDEM解析のpatchInteractionModelクラスの解読
 
OpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能についてOpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能について
 
OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)
OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)
OpenFOAMに実装したS-CLSVOF法検証(静止気泡のLaplace圧)
 
OpenFOAMの壁関数
OpenFOAMの壁関数OpenFOAMの壁関数
OpenFOAMの壁関数
 
OpenFOAM LES乱流モデルカスタマイズ
OpenFOAM LES乱流モデルカスタマイズOpenFOAM LES乱流モデルカスタマイズ
OpenFOAM LES乱流モデルカスタマイズ
 
Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)
Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)
Setting and Usage of OpenFOAM multiphase solver (S-CLSVOF)
 
rhoCentralFoam in OpenFOAM
rhoCentralFoam in OpenFOAMrhoCentralFoam in OpenFOAM
rhoCentralFoam in OpenFOAM
 
OpenFOAMのinterfoamによる誤差
OpenFOAMのinterfoamによる誤差OpenFOAMのinterfoamによる誤差
OpenFOAMのinterfoamによる誤差
 
multiDimAMR
multiDimAMRmultiDimAMR
multiDimAMR
 
OpenFOAMにおける相変化解析
OpenFOAMにおける相変化解析OpenFOAMにおける相変化解析
OpenFOAMにおける相変化解析
 
Limited Gradient Schemes in OpenFOAM
Limited Gradient Schemes in OpenFOAMLimited Gradient Schemes in OpenFOAM
Limited Gradient Schemes in OpenFOAM
 

Similar to Introdcution to Openfoam--working with free software

Hands on kubernetes_container_orchestration
Hands on kubernetes_container_orchestrationHands on kubernetes_container_orchestration
Hands on kubernetes_container_orchestration
Amir Hossein Sorouri
 
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra Solutions
QUONTRASOLUTIONS
 
Algoritmi e Calcolo Parallelo 2012/2013 - OpenMP
Algoritmi e Calcolo Parallelo 2012/2013 - OpenMPAlgoritmi e Calcolo Parallelo 2012/2013 - OpenMP
Algoritmi e Calcolo Parallelo 2012/2013 - OpenMP
Pier Luca Lanzi
 
Lecture6
Lecture6Lecture6
Lecture6
tt_aljobory
 
Introduction to Linux Slides.pptx
Introduction to Linux Slides.pptxIntroduction to Linux Slides.pptx
Introduction to Linux Slides.pptx
hazhamina
 
Desktop as a Service supporting Environmental ‘omics
Desktop as a Service supporting Environmental ‘omicsDesktop as a Service supporting Environmental ‘omics
Desktop as a Service supporting Environmental ‘omics
David Wallom
 
DSD-INT 2019 RiverLab - Ottevanger
DSD-INT 2019 RiverLab - OttevangerDSD-INT 2019 RiverLab - Ottevanger
DSD-INT 2019 RiverLab - Ottevanger
Deltares
 
Linux
LinuxLinux
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
Linaro
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
IxtiyorTeshaboyev
 
6-9-2017-slides-vFinal.pptx
6-9-2017-slides-vFinal.pptx6-9-2017-slides-vFinal.pptx
6-9-2017-slides-vFinal.pptx
SimRelokasi2
 
Module1
Module1Module1
Module1
shahilashahul
 
Runos OpenFlow Controller (eng)
Runos OpenFlow Controller (eng)Runos OpenFlow Controller (eng)
Runos OpenFlow Controller (eng)
Alexander Shalimov
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & Applications
Maulen Bale
 
How to write shared libraries!
How to write shared libraries!How to write shared libraries!
How to write shared libraries!
Stanley Ho
 
Linux Presentation_SSD.pdf
Linux Presentation_SSD.pdfLinux Presentation_SSD.pdf
Linux Presentation_SSD.pdf
ssuser37b0e0
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)
Gaurav Aggarwal
 
Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)
Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)
Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)
The Linux Foundation
 
Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...
Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...
Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...
The Linux Foundation
 
CPOSC2014: Next Generation Cloud -- Rise of the Unikernel
CPOSC2014: Next Generation Cloud -- Rise of the UnikernelCPOSC2014: Next Generation Cloud -- Rise of the Unikernel
CPOSC2014: Next Generation Cloud -- Rise of the Unikernel
The Linux Foundation
 

Similar to Introdcution to Openfoam--working with free software (20)

Hands on kubernetes_container_orchestration
Hands on kubernetes_container_orchestrationHands on kubernetes_container_orchestration
Hands on kubernetes_container_orchestration
 
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra Solutions
 
Algoritmi e Calcolo Parallelo 2012/2013 - OpenMP
Algoritmi e Calcolo Parallelo 2012/2013 - OpenMPAlgoritmi e Calcolo Parallelo 2012/2013 - OpenMP
Algoritmi e Calcolo Parallelo 2012/2013 - OpenMP
 
Lecture6
Lecture6Lecture6
Lecture6
 
Introduction to Linux Slides.pptx
Introduction to Linux Slides.pptxIntroduction to Linux Slides.pptx
Introduction to Linux Slides.pptx
 
Desktop as a Service supporting Environmental ‘omics
Desktop as a Service supporting Environmental ‘omicsDesktop as a Service supporting Environmental ‘omics
Desktop as a Service supporting Environmental ‘omics
 
DSD-INT 2019 RiverLab - Ottevanger
DSD-INT 2019 RiverLab - OttevangerDSD-INT 2019 RiverLab - Ottevanger
DSD-INT 2019 RiverLab - Ottevanger
 
Linux
LinuxLinux
Linux
 
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
 
6-9-2017-slides-vFinal.pptx
6-9-2017-slides-vFinal.pptx6-9-2017-slides-vFinal.pptx
6-9-2017-slides-vFinal.pptx
 
Module1
Module1Module1
Module1
 
Runos OpenFlow Controller (eng)
Runos OpenFlow Controller (eng)Runos OpenFlow Controller (eng)
Runos OpenFlow Controller (eng)
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & Applications
 
How to write shared libraries!
How to write shared libraries!How to write shared libraries!
How to write shared libraries!
 
Linux Presentation_SSD.pdf
Linux Presentation_SSD.pdfLinux Presentation_SSD.pdf
Linux Presentation_SSD.pdf
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)
 
Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)
Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)
Next Generation Cloud: Rise of the Unikernel V3 (UPDATED)
 
Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...
Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...
Unikernel User Summit 2015: The Next Generation Cloud: Unleashing the Power o...
 
CPOSC2014: Next Generation Cloud -- Rise of the Unikernel
CPOSC2014: Next Generation Cloud -- Rise of the UnikernelCPOSC2014: Next Generation Cloud -- Rise of the Unikernel
CPOSC2014: Next Generation Cloud -- Rise of the Unikernel
 

Recently uploaded

哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
gaafergoudaay7aga
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
Mahmoud Morsy
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 

Recently uploaded (20)

哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 

Introdcution to Openfoam--working with free software

  • 1. Introduction to computational fluid dynamics using the OpenFOAM Working with free software 丁鹏 13165044378
  • 2. Disclaimer This offering is not approved or endorsed by OpenCFD Limited, produc er and distributor of the OpenFOAM software and owner of the OPEN FOAM and OpenCFD trade marks.
  • 3. Objectives • FVM in general coordinate system • Have an overview of the OpenFOAM® capabilities • Installation and Be able to find help and documentation • Know how to start and post-treat a simulation from existing tutorials • Start your own simulation by modifying existing tutorials • Understand what is behind solvers to identify the most suitable solver for your specific problem • Program your own solver by modifying an existing solver
  • 4. What is OpenFOAM® ? • An open source software package • Developed by OpenCFD Ltd at ESI Group • Released under the GNU General Public License [link] • Abbreviation of Open Field Operation And Manipulation • An efficient library of C++ modules • Based on the cell centered Finite Volume Method • Extensive CFD and Multi-physics capabilities • Under active development [OpenFOAM Extend Project]
  • 5. What is OpenFOAM® ? • Can be freely download at www.openfoam.com • Designed as a toolbox easily customisable • Parallel computation implemented • Cross-platform installation (Linux preferred)
  • 6. The power of C++ template
  • 8. OpenFOAM Multi-physics capabilities: • Computational fluid dynamics (incompressible and compressible flows). • Computational heat transfer and conjugate heat transfer. • Combustion and chemical reactions. • Multiphase flows and mass transfer. • Particle methods (DEM, DSMC, MD) and lagrangian particles tracking. • Stress analysis and fluid-structure interaction. • Rotating frames of reference, arbitrary mesh interface, dynamic mesh handling, and adaptive mesh refinement. • 6 DOF solvers, ODE solvers, computational aero-acoustics, computational electromagnetics, computational solid mechanics, MHD
  • 9. OpenFOAM Physical modeling library • Extensive turbulence modeling capabilities (RANS, DES and LES). • Transport/rheology models. Newtonian and non-Newtonian viscosity models. • Thermophysical models and physical properties for liquids and gases. • Source terms models. • Lagrangian particle models. • Interphase momentum transfer models for multiphase flows. • Combustion, flame speed, chemical reactions, porous media, radiation, phase change.
  • 10. OpenFOAM Under the hood • Finite Volume Method (FVM) based solver. • Collocated polyhedral unstructured meshes. • Second order accuracy in space and time. Many discretization schemes available (including high order methods). • Steady and transient solvers available. • Pressure-velocity coupling via segregated methods (SIMPLE and PISO). • But coupled solvers are under active development. • Massive parallelism through domain decomposition. • It comes with its own mesh generation tools. • It also comes with many mesh manipulation and conversion utilities. • It comes with many post-processing utilities. • All components implemented in library form for easy re-use.
  • 11. The “GUI”of OpenFOAM --no native GUI Totally command line interface
  • 12. Why should I use OpenFOAM?
  • 13. Where can I find help and documentation
  • 14. Getting started with OpenFOAM Installation: • OpenFOAM website [http://www.openfoam.org/download/] • OpenFOAM wiki [https://openfoamwiki.net/index.php/Installation] References: • OpenFOAM user guide [http://www.openfoam.org/docs/] • OpenFOAM programmer’s guide [http://www.openfoam.org/docs/] • Source code [http://www.openfoam.org/docs/cpp/] • Book [The OpenFOAM technology primer] Actions: Ubuntu64, OpenFoam64, Vmware,Win10.
  • 15. Introduction to Linux It is a UNIX-like operating system (OS). So, now you might be wondering what is UNIX? UNIX is a family of multitasking, multiuser, stable, and portable computer op eratingsystems that derive from the original AT&T UNIX, developed in the 19 70s at the BellLabs. • You will find UNIX/Linux in laptops, desktop PCs, servers, and super computers. • UNIX/Linux systems: the kernel, the shell, and the programs. • The kernel is the hub of the OS. • The shell (or the terminal), acts as an interface between the user and the kernel. • Programs are the different applications that the user uses.
  • 16. Some Linux facts • Originally developed by Linus Torvalds in 1991. • Free and Open Source (the kernel). • A wide range of Linux applications are free and Open Source. • It can be installed in a great variety of hardware (laptops, desktop PCs, servers, su percomputers, mobile phones, embedded microchips, and so on). • It is stable, fast-performing, and highly configurable. • It is the ideal OS for developing applications. It comes with many compilers, interpreters, and libraries. • Most modern Linux versions come with a GUI (similar to Windows or MacOSX). • Knowledge of the terminal is required.
  • 17. Linux distributions There are many Linux distributions available (free and commercial) • Red Hat. • CentOS. • Fedora. • OpenSUSE. • Slackware. • Debian. • Ubuntu. • Mint. • Arch. During this course we will use Ubuntu.
  • 18. What is the Linux terminal or shell? • The terminal emulator or the shell acts as an interface between the user and the OS. • The shell, is a program that reads commands in the terminal (from the keyboa rd) and send results back to the terminal (to the screen). • It acts as a command line interpreter.
  • 19. Where is the terminal in my Linux distribution? In most Linux distributions, finding the shell is pretty easy. Just look for the terminal or console application in the applications menu
  • 20. Basic shell interaction Try input the following three commands , what is the feed back . whoami date (date "+DATE: %m/%d/%y%nTIME: %H:%M:%S") man tab arrow(up down) history
  • 23. command: ls(List Files) 1. List Files using ls with no option 2. List Files With option –l 3. View Hidden Files –a 4. List Files with Human Readable Format with option -lh 5. List Files in Reverse Order –r 6. Recursively list Sub-Directories -R 7. Sort Files by File Size -lS
  • 24. command: ls(List Files) 1. List Files using ls with no option 2. List Files With option –l 3. View Hidden Files –la 4. List Files with Human Readable Format with option -lh 5. List Files in Reverse Order –lr 6. Recursively list Sub-Directories -R 7. Sort Files by File Size -ls
  • 25. command: cd (Change Directory) 1. Switch back to previous directory where you working earlier “ cd –” 2. Change Current directory to parent directory “cd ..” 3. Show last working directory from where we moved “cd –” 4. Move two directory up from where you are now. “cd ../../” 5. Move to users home directory from anywhere “cd ~” 6. using “TAB”.
  • 33. OpenFOAM environment Load OpenFOAM module: source /????/openfoam/etc/bashrc Alternatively for regular OpenFOAM use, edit your bashrc file: Open bashrc file: nano ∼/.bashrc Add the following at the end of the file: source /????/openfoam/etc/bashrc
  • 34. OpenFOAM environment To list all the environment variables related to OpenFOAM®, type in the terminal: env | grep “OpenFOAM”
  • 36. Looking for information in OpenFOAM® source code locate a directory inside $WM_PROJECT_DIR that co ntains the string fvPatch in its name locate a file inside $WM_PROJECT_DIR that contains the string fvPatch in its name
  • 37. Looking for information in OpenFOAM® source code find the string LES inside all the files within the direc tory$FOAM_SOLVERS -r recurisive -n print out line number
  • 39. Let run----- Heat diffusion Solver : laplacianFoam 1. Check the path of working directory: echo $WM_PROJECT_USER_DIR 2. cp -r $FOAM_TUTORIALS/basic/laplacianFoam/flange/ . 3. cd flang 4. ls 5. ./Allrun
  • 40. General structure of an OpenFOAM case
  • 41. General structure of an OpenFOAM case
  • 42. General structure of an OpenFOAM case
  • 43. General structure of an OpenFOAM case
  • 44. General structure of an OpenFOAM case
  • 45. General structure of an OpenFOAM case
  • 46. Introduction to FVM Conservation of Mass (Continuity Equation)
  • 49. An simple example of FVM study of heat transfer from a microprocessor connected to a heat sink with a copper base that acts as a heat spreader
  • 50. An simple example of FVM Step I: Geometric and Physical Modeling
  • 51. An simple example of FVM Step II: Domain Discretization discrete non-overlapping cells
  • 52. An simple example of FVM Mesh Topology include element to element relations, face to elements relations, geom etric information of the surfaces, element centroid and volume, face ce ntroid, area and normal direction, etc.
  • 54. An simple example of FVM Element connectivity and Matrix relates the local assembly matrix to the global matrix
  • 56. An simple example of FVM Step III: Equation Discretization governing partial differential equations, are transformed into a set of al gebraic equations, one for each element in the computational domain.
  • 57. An simple example of FVM Step III: Equation Discretization
  • 58. An simple example of FVM Step III: Equation Discretization
  • 59. An simple example of FVM Step III: Equation Discretization
  • 60. An simple example of FVM Step III: Equation Discretization
  • 61. An simple example of FVM Step III: Equation Discretization
  • 62. An simple example of FVM Step IV: Solution of the Discretized Equations Direct Methods only good for small A<1000, are rarely used in computational fluid dynamics Iterative Methods Gauss-Seidel Jacobi Krylov Multigrid ……………………………………………… very popular
  • 63. An simple example of FVM Step Last: Post-Processing Data processing?................ Beautiful results doesn’t mean correct. Make conclusion for your study.
  • 64. Introduction to FVM The general transport equation • This is a second order equation. For good accuracy, it is necessary that the order of the discretization is equal or higher than the order of the equation tha t is being discretized (in space and time). • By the way, starting from this equation we can write down the Navier-Stokes equations (NSE). So everything we are going to address also applies to the NSE.
  • 66. Introduction to FVM • The control volumes can be of any shape (e.g., tetrahedrons, hexes, prisms, pyramids,and so on). The only requirement is that the faces that made up the control volume need to be planar.
  • 74. Introduction to FVM Diffusive flux in an orthogonal mesh is very simple
  • 75. Introduction to FVM Diffusive flux in a non-orthogonal mesh.
  • 76. Introduction to FVM The surface vector should be decomposed.
  • 77. Introduction to FVM Minimum Correction Approach
  • 78. Introduction to FVM Orthogonal Correction Approach
  • 80. Introduction to FVM Cross diffusion Over-relaxed method is most stable even when the grid is highly non-orthogonal
  • 82. Introduction to FVM When the grid is skewed the line does not necessarily pass throu gh the centroid of the face, Thus a correction for the interpolated value at f′ is needed in order to get the value at f.
  • 83. Introduction to FVM Gradient computation at cell centroids and faces is fundamental t o constructing the discretized sets of diffusion equations and con vection. Green-Gauss Gradient Method
  • 84. Introduction to FVM Gradient computation at cell centroids and faces is fundamental t o constructing the discretized sets of diffusion equations and con vection. Green-Gauss Gradient Method
  • 86. Introduction to FVM In the least square methods, a gradient is computed by an optimi zation procedure that finds the minimum of the function. w is so me weighting factor
  • 87. Introduction to FVM In the least square methods, a gradient is computed by an optimi zation procedure that finds the minimum of the function. w is so me weighting factor
  • 99. Where do we set all the discretization schemes in OpenFOAM
  • 100. Time discretization schemes • There are many time discretization schemes available in OpenFOAM. • You will find the source code in the following directory: $WM_PROJECT_DIR/src/finiteVolume/finiteVolume/ddtSchemes • These are the time discretization schemes that you will use most of the ti mes: • steadyState: for steady state simulations (implicit/explicit). • Euler: time dependent first order (implicit/explicit), bounded. • backward: time dependent second order (implicit), bounded/unb ounded. • CrankNicolson: time dependent second order (implicit), bounded /unbounded. • First order methods are bounded and stable, but diffusive. • Second order methods are accurate, but they might become oscillatory. • we always want a second order accurate solution. • If you keep the CFL less than one when using the Euler method, numeric al diffusion is not
  • 101. Convective discretization schemes • You will find the source code in the following directory: $WM_PROJECT_DIR/src/finiteVolume/interpolation/surfaceInterpolati on • These are the convective discretization schemes that you will use most of the times: • upwind: first order accurate. • linearUpwind: second order accurate, bounded. • linear: second order accurate, unbounded. • A good TVD scheme (vanLeer or Minmod): TVD, second or der accurate, bounded. • limitedLinear: second order accurate, unbounded, but mor e stable than pure linear. Recommended for LES simulations (kind of similar to the Fr omm method). • First order methods are bounded and stable but diffusive. • Second order methods are accurate, but they might become oscillatory.
  • 102. Numerical Playground---pure convection Solver used: scalarTransportFoam Mission: Comparison of different convection discretization schemes boundness and overshoot familiar with gnuplot
  • 103. Numerical Playground---pure convection Mission: • Test convection schemes, which one is more accurate? • Are all time discretization schemes bounded? • If you are using the Crank-Nicolson scheme, how will you avoid oscillations? • Does the solution improve if you reduce the time-step? • Use the upwind scheme and a really fine mesh. Do the accuracy of the solution improve? • Pure convection problems have analytical solutions. You are asked to design your own tutorial with an analytical solution in 2D or 3D. • Try to break the solver using a time step less than 0.005 seconds. You are allow to modify the original mesh and use any combination of discretization schemes.
  • 104. Convective discretization schemes • When you use linearUpwind for div(phi,U), you need to tell OpenFOAM® how to compute the velocity gradient or grad(U)
  • 105. Gradient discretization schemes • You will find the source code in the following directory: $WM_PROJECT_DIR/src/finiteVolume/finiteVolume/gradSchemes • These are the gradient discretization schemes that you will use most of the times: • Gauss • leastSquares • To avoid overshoots or undershoots when computing the gradients, you can use gra dient limiters. • Gradient limiters increase the stability of the method but add diffusion due to clippi ng. • You will find the source code in the following directory: $WM_PROJECT_DIR/src/finiteVolume/finiteVolume/gradSchemes/limitedG chemes • These are the most important gradient limiter schemes available in OpenFOAM®:
  • 106. Gradient discretization schemes • These are the most important gradient limiter schemes available in OpenFOAM®: cellLimited, cellMDLimited, faceLimited, faceMDLimited • Cell limiters will limit cell-to-cell values. • Face limiters will limit face-to-cell values. • The multi-directional (dimensional) limiters (cellMDLimited and faceMDLimited), will apply the limiter in each face direction separately. • The standard limiters (cellLimited and faceLimited), will apply the limiter to all comp onents of
  • 107. Gradient discretization schemes • The gradient limiter implementation in OpenFOAM®, uses a blending factor . • Setting to 0 is equivalent to turning off the gradient limiter. You gain accuracy but t he solution might become unbounded. • By setting the blending factor equal to 1 the limiter is always on. You gain stability b ut you give up accuracy (due to gradient clipping). • If you set the blending factor to 0.5, you get the best of both worlds.
  • 108. Laplacian terms discretization schemes • You will find the source code in the following directory: $WM_PROJECT_DIR/src/finiteVolume/finiteVolume/snGradSchemes • These are the Laplacian terms discretization schemes that you will use most of the ti mes: • orthogonal: mainly limited for hexahedral meshes with no grading (a perfect mesh). Second order accurate, bounded on perfect meshes, without non-orthogonal correction s. • corrected: for meshes with grading and non-orthogonality. Second order accurate, bounded depending on the quality of the mesh, with non-orthogonal corrections. • limited: for meshes with grading and non-orthogonality. Second order accurate, bounded depending on the quality of the mesh, with non-orthogonal corrections. • uncorrected: usually used on bad quality meshes with grading and non-orthogonality. Second order accurate, without non-orthogonal corrections. Stable but more diffusive than the limited and corrected methods
  • 109. Laplacian terms discretization schemes • The limited method uses a blending factor : • Setting to 1 is equivalent to using the corrected method. You gain accuracy, but the solution might become unbounded. • By setting the blending factor equal to 0 is equivalent to using the uncorrected met hod. You give up accuracybut gain stability. • If you set the blending factor to 0.5, you get the best of both worlds. In this case, the non-orthogonal
  • 110. Numerical Playground---pure diffusion Solver used: scalarTransportFoam Mission: Comparison of different laplacian discretization schemes
  • 111. Numerical Playground---pure diffusion Solver used: scalarTransportFoam
  • 112. What method should I use? • It is equivalent to the default method you will find In commercial solvers. • In overall, this setup is second order accurate and fully bounded. • According to the quality of your mesh, you wi ll needto change the blending factor of the laplacianSchemes and snGradSchemes keywor ds. • To keep temporal diffusion to a minimum, us e a CFL number less than 2. • If during the simulation the turbulence quanti ties
  • 113. A very stable but too diffusive numerics • If you are looking for extra stability, you can use thi s method. • This setup is very stable but too diffusive. • This setup is first order in space and time. • You can use this setup to start the solution in the presence of bad quality meshes or strong discontin uities. • Remember, you can start using a first order method and then switch to a second order method. • Start robustly, end with accuracy.
  • 122. Introduction to FVM • As you can see, when it comes to linear solvers there are many options and comb inations available in OpenFOAM. • When it comes to choosing the linear solver, there is no written theory. • Most of the times using the GAMG method (geometric-algebraic multi-grid), is th e best choice for symmetric matrices (e.g., pressure). • The GAMG method should converge fast (less than 20 iterations). If it’s taking m ore iterations, try to change the smoother. • And if it is taking too long or it is unstable, use the PCG solver.
  • 123. Introduction to FVM • When running with many cores (more than 1000), using the PCG might be a b etter choice. • For asymmetric matrices, the PBiCGStab method with DILU preconditioner is a good choice. • The smoothSolver solver with smoother GaussSeidel, also performs very well. • If the PBiCGStab method with DILU preconditioner mysteriously crashed with a n error related to the preconditioner, use the smoothSolver or change the preco nditioner. • But in general the PBiCGStab solver should be faster than the smoothSolver so lver. • Usually, computing the velocity and the transported quantities is inexpensive a nd fast, so it is a good idea to use a tight tolerance (1e-8) for these fields.
  • 124. On the CFL number • The CFL number is a measure of how much information ( ) traverses a com putational grid cell ( ) in a given time-step ( ). • The CFL number is not a magical number. • The CFL number is a necessary condition to guarantee the stability of the numerical scheme. • But not all numerical schemes have the same stability requirements.
  • 125. On the CFL number • The CFD solvers can be explicit and implicit. • Explicit and implicit solvers have different stability requirements. • Implicit numerical methods are unconditionally stable. they are not constrained to t he CFL number condition. • However, unconditionally stable, does not mean that you can choose a time step of any size. • The time-step must be chosen in such a way that it resolves the time-dependent fe atures, and it maintains the solver stability. • When we use implicit solvers, we need to assemble a large system of equations. • But as we are often interested in the unsteadiness of the solution, we usually use a CFL number in the order of 1.0
  • 126. How to control the CFL number • You can control the CFL number by changing th e mesh cell size or changing the time-step size. • The easiest way is by changing the time-step siz e. • If you refine the mesh, and you would like to ha ve the same CFL number as the base mesh, you w ill need to decrease the time-step size. • On the other side, if you coarse the mesh and y ou would like to have the same CFL number as th e base mesh, you will need to increase the time-st ep size. • The keyword deltaT controls the time-step size of the simulation (0.0001 seconds in this generic c ase).
  • 131. Mesh Generation-blockmesh Every block can be seen as a cube in topology space
  • 137. The blockMeshDict dictionary. run foamCleanTutorials run blockMesh run checkMesh run paraFoam
  • 139. The OpenFOAM mesh format
  • 140. The OpenFOAM mesh format
  • 141. The OpenFOAM mesh format
  • 142. The OpenFOAM mesh format
  • 143. How to change mesh grading
  • 144. How to change mesh grading
  • 145. How to change mesh grading
  • 149. How to work with multiple blocks face matching(treated automatically): the set of faces that comprise a patch from one block are formed from the same set of vertices as a set of faces patch that comprise a patch from another block; face merging(must specify interfaces): a group of faces from a patch from one block are connected to another group of faces from a patch from another block, to create a new set of internal faces connecting the two blocks.
  • 150. How to work with multiple blocks
  • 151. How to work with multiple blocks
  • 152. How to work with multiple blocks
  • 153. How to work with multiple blocks
  • 154. How to work with multiple blocks
  • 155. How to work with multiple blocks
  • 156. Use curved edges in blockMesh
  • 157. Use curved edges in blockMesh
  • 158. Let work with a T-Junction Pipe
  • 159. Let work with a 3D pipe O-grid topology
  • 160. Build in Geomerty Searchable objects These objects define analytical shapes, to define the geometry to mesh or refi nement regions.
  • 163. BlockMesh –project onto Build in Geomerty geometry { sphere { type sphere; origin (0 0 0); radius 1.0; } } edges ( project 0 1 (sphere) ……. …….. ); faces ( project (0 4 7 3) sphere ……. …….. );
  • 164. OpenFoam Mesh Generation-SnappyHexMesh ◮ SHM is a fully automatic, parallel, octree-refinement-based mesh generati on app for OpenFOAM. ◮ Mesh generation is based on four steps:
  • 167. import a third-party software mesh into OpenFOAM The list of currently available mesh conversion utilities can be found in: ls $FOAM_UTILITIES/mesh/conversion
  • 168. panacea of meshing? ---polyhedral mesh • In polyhedral meshes the cells have more neighbors than in tetrahedr al and/or hexahedral meshes, hence the gradients are approximated be tter on polyhedral meshes. • Another interesting property of polyhedral meshes is that they reduce the cell count. But there is a catch, they increase the number of faces so you need to compute more fluxes (diffusive and convective). • Polyhedral meshes are not easy to generate, most of the times you ne ed to start from tetrahedral meshes. • polyhedral meshes inhered the same quality problems of the starting tetrahedral mesh, sometimes they made things worst. • Are polyhedral meshes better than hex or tet meshes? You need to co nduct your own numerical experiments.
  • 169. About the Mesh • Remember, garbage in - garbage out. • Use hexahedral meshes whenever is possible, specially if high accurac y in predicting forces is your goal.(does not mean that tetra mesh are no good). • Increasing the cells count will likely improve the solution accuracy when you refine your mesh (specially when it is done automatically), the overall quality of the mesh is reduced. • The mesh density should be high enough to capture all relevant flow features.
  • 170. Let run----- 2d driven cavity at Re=100
  • 171. Technical Report: Is a 2d driven cavity flow at Re=15,000 steady or unsteady? Fluent or OpenFOAM
  • 173.
  • 174. The SIMPLE loop in OpenFOAM
  • 175. The PISO loop in OpenFOAM
  • 177. 2d driven cavity---running the case $> foamCleanTutorials $> blockMesh $> checkMesh $> icoFoam $> postProcess -func sampleDict -latestTime $> gnuplot gnuplot/gnuplot_script $> paraFoam
  • 186. log files $> icoFoam | tee ico.log $> foamLog ico.log $> gnuplot
  • 187. Stopping the simulation Your simulation will automatically stop at the time value you set using the k eyword endTime in the controlDict dictionary.
  • 188. Stopping the simulation If you want to stop the simulation and save the solution, in the controlDict dictionary made the following modification, stopAt writeNow;
  • 189. Stopping the simulation The previous modifications can be done on-the-fly, but you will need to se t the keyword runTimeModifiable to true in the controlDict dictionary.
  • 190. Cleaning the case folder • If you want to erase the mesh and the solution in the current case folder, you can type in the terminal, $> foamCleanTutorials • If you are running in parallel, this will also erase the processorN directories. We wi ll talk about running in parallel later. • If you are looking to only erase the mesh, you can type in the terminal, $> foamCleanPolyMesh • If you are only interested in erasing the saved solutions, in the terminal type, $> foamListTimes -rm • If you are running in parallel and you want to erase the solution saved in the proc essor directories, type in the terminal, $> foamListTimes –rm -processor
  • 191. A deeper view to the case setup • The time step directories contain the values of all the variables at those ti me steps (the solution). The 0 directory is thus the initial condition and bo undary conditions. • The constant directory contains the mesh and dictionaries for thermophy sical, turbulence models and advanced physical models. • The system directory contains settings for the run, discretization schemes and solution procedures. • The postProcessing directory contains the information related to the functionObjects (we are going to address functionObjects later).
  • 192. The constant directory • The transportProperties file is a dictionary for the dimensioned scalar nu, or the kinematic viscosity.
  • 193. The constant directory Therefore, the dimensioned scalar nu or the kinematic viscosity
  • 194. The Boundary Conditions The system/blockMeshDict dictionary define all the surface patches where we want to apply boundary conditions
  • 195. The Boundary Conditions The constant/polyMesh/boundary dictionary
  • 196. The Boundary Conditions The constant/polyMesh/boundary dictionary
  • 199. remark on the pressure field
  • 200. Running in parallel The method of parallel computing used by OpenFOAM is known as domain decomposition, in which the geometry and associated fields are broken into pieces and distributed among different processors. The parallel programming implementation is hidden from the user. Do not ask about scalability, that is problem/hardware specific.
  • 201. Running in parallel Summarizing to run in parallel we proceed in the following way: $> decomposePar $> mpirun –np <NPROCS> <application/utility> –parallel $> reconstructPar
  • 202. Running in parallel • The mesh and fields are decomposed using the decomposePar utility. • They are broken up according to a set of parameters specified in a diction ary named decomposeParDict that is located in the system directory of the case.
  • 203. My simulation is always exploding If after choosing the numerical scheme, linear solvers, and time step, your simulation always crash, you can try this. • Set the discretization scheme of the convectiveterms to upwind. • Set the discretization scheme of the diffusive terms to Gauss linear limited 0.5 • Set the discretization scheme of the gradient terms to cellLimited Gauss linear 1.0 • Set the temporal discretization scheme to euler. • Use the PISO method, and set nCorrectors 3, and nNonOrthogonalCorrectors 2. • Do not use adaptive time-stepping. • Use a CFL number of the order of 0.5 and set deltaT to a low value in order to avoid jumps during the first iteration. • This is one of a hell stable numerical scheme. However it is first order accurate. • If this does not work, you should check your boundary conditions, initial conditions, physical properties and model properties. • You should also know the limitations of the solver you are trying to use, maybe the solver is not compatible or can not solve the physics involve.
  • 204. Some kind of conclusion • Good mesh – good results. • Start robustly and end with accuracy. • Stability, accuracy and boundedness, play by these terms and you will succeed. • Select wisely the boundary conditions.
  • 205. That was only the tip of the iceberg Now the rest is on you