Openfoam10 PDF
Openfoam10 PDF
Physical Models
Physical modeling library:
Solvers
OpenFOAM® comes with several ready-to-use or out Of-the box solvers:
New solvers can be easily implemented using OpenFOAM® high level programming or equation
mimicking, e.g.:
Suppose you want to write a solver for this equation so we have to write only 5/4 lines to code
this & you need not to think what discretization method you are going to use (either you go with
Eulerian, implicit explicit crank -nicholson backward anything you use for temporal & for let's say
convective part second order central difference scheme) you need not to think while you are
developing your solver. Why? because when you say divergence of flux and it will understand
whatever the scheme you going to select it immediately applies the discretization in that part of
equation and all the discretization schemes are coded in terms of the libraries , that library is
readily available .Based on the calling of particular scheme, it immediately adds up that part
Same in laplacian part, whatever the scheme you going to add up it is going to work with that
immediately
FVM (finite volume method) and FVC (finite volume calculus)
These imply the concept of implicit and explicit scheme .It means fvm is implicit and FVC is
always explicit that means for FVC whatever the pressure we are going to use for this gradient,
it comes from the previous time step or from the guess value and For FVM all this comes in
terms of the implicit environment .so whatever the term you require in the implicit ,you type
FVM and whatever the term you require in the explicit way you type as a FVC that is how one
can code any class of the equation so it is called equation mimicking syntax
Modifying Solvers
➢ Equation mimicking syntax, achieved through the use of object oriented
programming, enables users to create custom solvers with relative ease.
➢ Users have total freedom to modify existing solvers or use them as the starting point
for new solvers.
➢ Access to complete source: no secret modeling tricks or black magic.
➢ OpenFOAM® design encourages code and libraries re-use.
➢ As solvers can be tailored by a user for a specific need, OpenFOAM is ideal for research
and development.
➢ Top level solvers are written in few 100 lines of code, and are optimized for efficiency.
Core Technology
➢ OpenFOAM® is assembled from components: foundations libraries (vectors and
tensors algebra, mesh handling, Discretization, boundary conditions, linear solvers,
parallel Computing, etc.), physical modeling libraries, utilities and Solvers.
➢ All applications and utilities, are compiled using common functionality in the collection
of libraries distributed with OpenFOAM®.
This ensures consistency across the whole of the OpenFOAM® distribution, rather
than having a suite of Packages compiled from entirely separate source code.
➢ Transparent solution algorithms which can be viewed by the User, encouraging better
understanding of the underlying Physics.
Standard Solvers
Solver Capabilities
➢ Incompressible flows
➢ Multiphase flows
➢ Combustion
➢ Buoyancy-driven flows
➢ Conjugate heat transfer
➢ Compressible flows
➢ Particle methods (DEM, DSMC, MD)
➢ Other (Solid dynamics, electromagnetics)
2. Incompressible flow
➢ simpleFoam: Steady-state solver for incompressible, turbulent flow
➢ icoFoam: Transient solver for incompressible, laminar flow Of Newtonian fluids
➢ pisoFoam: Transient solver for incompressible flow (pisoFoam has a certain
limitation when we go towards highly complex physics. So there we try to stick to
the pimple form later on we try to explore what is difference between the two
➢ pimpleFoam: Large time-step transient solver for Incompressible, flow using the
PIMPLE (merged PISO-SIMPLE) algorithm
➢ nonNewtonianlcoFoam: Transient solver for incompressible, laminar flow of non-
Newtonian fluid
➢ channelFoam: Incompressible LES solver for flow in a channel
➢ porousSimpleFoam: Steady-state solver for incompressible, Turbulent flow with
implicit or explicit porosity treatment
➢ adjointShapeOptimizationFoam: Steady-state solver for incompressible, turbulent
flow of non-Newtonian fluids with optimization of duct shape by applying
"blockage" in region causing pressure loss as estimated using an adjoint
formulation
➢ boundaryFoam: Steady-state solver for incompressible, 1D Turbulent flow, typically
to generate boundary layer Conditions at an inlet, for use in a simulation
➢ MRFSimpleFoam: Steady-state solver for incompressible, Turbulent flow of non-
Newtonian fluids with MRF regions
➢ pimpleDyMFoam:(pimple dynamic foam )Transient solver for incompressible, flow
of Newtonian fluids on a moving mesh using the PIMPLE(merged PISO-SIMPLE)
algorithm
➢ shallowWaterFoam: Transient solver for inviscid shallow water equations with
rotation
➢ SRFSimpleFoam: Steady-state solver for incompressible, Turbulent flow of non-
Newtonian fluids in a single rotating Frame
➢ windSimpleFoam: Steady-state solver for incompressible, Turbulent flow with
external source in the momentum Equation.
3. Compressible flow
➢ rhoSimpleFoam Steady-state SIMPLE Solver for laminar turbulent RANS flow of
compressible fluids
➢ rhoSimplecFoam Steady-state SIMPLEC solver (C is the character in simple
algorithm) for laminar or turbulent RANS flow of compressible fluids
➢ sonicFoam Transient solver for trans-sonic/supersonic, laminar or turbulent flow of
a compressible gas
➢ sonicLiquidFoam Transient solver for trans-sonic/supersonic, laminar flow of a
compressible liquid
➢ rhoPimpleFoam: Transient solver for laminar or turbulent Flow of compressible
fluids for HVAC and similar applications
➢ rhoPorousMRFLTSPimpleFoam: Transient solver for Laminar or turbulent flow of
compressible fluids with support for porous media and MRF for HVAC and similar
applications, with local time-stepping for efficient steady state solution
➢ rhoPorousMRFSimpleFoam: Steady-state solver for turbulent flow of compressible
fluids with RANS turbulence modelling, implicit or explicit porosity treatment and
MRF for HVAC and similar applications
➢ rhoPorousMRFPimpleFoam: Transient solver for laminar or turbulent flow of
compressible fluids with support for porous media and MRF for HVAC and similar
applications
➢ rhoCentralFoam: Density-based compressible flow solver based on central-upwind
schemes of Kurganov and Tadmor (in compressible environment either you work
with the density based algorithm or a pressure based algorithm. If you are working
with a very high speed flows so sometimes the density based algorithm facilitate
much faster convergence as compared to the pressure base so we stick to the
density base type of the solver)
➢ rhoCentralDyMFoam: Density-based compressible flow solver based on central-
upwind schemes of Kurganov and Tadmor with moving mesh capability and
turbulence Modelling
➢ sonicDyMFoam Transient solver for trans-sonic/supersonic, laminar or turbulent
flow of a compressible gas with mesh motion
Note: (whenever there is a DyM that means it has a capability of mesh movement)
5. Electromagnetics
➢ electrostaticFoam: Solver for electrostatics
➢ magneticFoam: Solver for the magnetic field generated by permanent magnets
➢ mhdFoam: Solver for magnetohydrodynamics (MHD): incompressible, laminar
flow of a conducting fluid under the influence of a magnetic field
Note wherever you see interFoam, it has VOF things enabled in it.
11.Combustion
• chemFoam: Solver for chemistry problems – designed for use on single cell cases to
provide comparison against other chemistry solvers – single cell mesh created on-the-fly
fields created on the fly from the initial conditions
• coldEngineFoam: Solver for cold-flow in internal combustion engines
• dieselEngineFoam: Solver for diesel engine spray and combustion
• dieselFoam: Solver for diesel spray and combustion
• engineFoam: Solver for internal combustion engines
• fireFoam: Transient Solver for Fires and turbulent diffusion flames
• PDRFoam: Solver for compressible premixed/partially premixed combustion with
turbulence modeling
• reactingFoam: Solver for combustion with chemical reactions
• rhoReactingFoam: Solver for combustion with chemical reactions using density based
thermodynamics package
• XiFoam: Solver for compressible premixed/partially premixed combustion with
turbulence modelling
12.Particle-tracking flows
Note: couple of the solvers maybe you will not get directly in the Distributed version but it's
source code will be available online in certain class of the hosting
Mesh Generation
• OpenFOAM supports unstructured meshes of cells of any shape
• cells in OpenFOAM can have any number of faces and faces can have any number of
edges
• Such complete freedom on cell shape gives greater flexibility for the generation of
meshes around complex shapes, embedded refinement, etc.
Two types of mesh
1.blockMesh
• For simple geometries, there is blockMesh, a multi-block mesh generator that generates
meshes of hexahedra from a text configuration file.
• The OpenFOAM distribution contains numerous example configuration files for
blockMesh to generate meshes for flows around simple geometries, e.g. a cylinder, a
wedge, etc.
2.snappyHexMesh
• For complex geometries, there is snappyHexMesh that meshes to surfaces from CAD,
but also allows the user to define simple geometric entities such as boxes, spheres,
planes, etc.
• The snappyHexMesh utility can run in parallel, so can generate meshes of 100s of
millions of cells, given a sufficient number of CPUs and memory.
(let’s say you have to generate the mesh on entire car AC or something where
you are expecting millions of mesh size then it not possible to create a mesh on a
single PC then for that purpose we require the parallel computing environment and
with the help of that a sophisticated mesh can be created.)
• It performs automatic load balancing when generating mesh in parallel, i.e.
redistributes cells across the CPUs, so the final mesh has approximately the same
number cells per processor, for optimal performance during simulation.
Mesh Conversion
OpenFOAM accepts meshes generated by any of the major mesh generators:
Mesh Manipulation
OpenFOAM is supplied with several utilties that perform mesh checking and manipulation.
• checkMesh: Checks validity of a mesh (checkMesh gives you the idea either that mesh
is valid for openFoam or not. It tries to check different aspects of the meshing like its
aspect ratio , skewness, volume either it is negative or positive volume. If
it is not suitable type mesh then OpenFOAM immediately gives an error that this mesh
is not suitable in openFOAM environment and you have to modify this mesh)
• mergeMeshes: Merge two meshes
• mirrorMesh: Mirrors a mesh around a given plane
• setSet: Manipulate a cell/face/point set or zone interactively
• setsToZones: Add pointZones/faceZones/cellZones to the mesh from similar named
pointSets/face Sets/cellSets
• topoSet: Operateson cellSets/face Sets/pointSets through a dictionary
• rotateMesh: Rotates the mesh and fields from the n1 direction to the n2 direction
• moveDynamicMesh: Mesh motion and topological mesh changes utility
• moveEngineMesh: Solver for moving meshes for engine calculations
• createPatch: Utility to create patches out of selected boundary faces. Faces come
either from existing patches or from a faceSet
• autoPatch: Divides external faces into patches based on (user supplied) feature angle
If mesh manipulation utility was not there then to change the mesh one has to first modify
the mesh from scratch then perform other steps. let’s say you have put the skew line
direction in X but now you want to change or rotate it to Y direction so either you go back
to the Mesh and change the mesh and then perform the other steps but with the Elbow
rotate mesh immediately it will rotate.
Turbulence Models
OpenFOAM offers a large range of methods and models to simulate turbulence.
The type of models implemented in this library are those found in rheology to describe fluids
with a complex structure, e.g. polymers, sludges, foodstuffs, etc.
Transport Models
➢ Transport models that are primarily temperature dependent, e.g. for gases, are
implemented as part of the thermophysical modelling library.
➢ OpenFOAM is distributed with a huge library of thermophysical models and properties
that can read from standard libraryTables, including liquid and gas properties,
combustion and flame speed models.
(as far as transport property is concerned what we require is to set a Reynolds number, for
that we need the density and the viscosity and here we are going to work with the ratio of
viscosity and density ie. kinematic viscosity. So only kinematic viscosity is required to set a
transport property but if you talk about the compressible flow then we require certain
more properties for that basic thermophysical models are available)
➢ ParaView uses the Visualisation Toolkit (VTK) as its data processing and rendering
engine and can therefore read any data in VTK format.
➢ OpenFOAM includes the foamToVTK utility to convert data from its native format to
VTK format, which means that any VTK-based graphics tools can be used to post-
process OpenFOAM® cases.(let’s say you want the post processing in different post
processer e.g Ansys or EnSight fluent environment then you have to convert the foam
data and foam mesh to the fluent and when you run certain utilities it tries to create a
case and data file you add up that case and data file and do the post processing in
your post processor like Ansys EnSight , Tecplot etc)
➢ The user therefore has the choice of using the reader module or data converter.
Further details about ParaView can be found at http:/www.paraview.org
Run-time Post-processin
1. To check whether the simulation is going in the right direction or not for that we use the
co-processing or run-time processing. Users can configure an OpenFOAM case to carry
out post processing automatically while the simulation is running using function objects.
The range of available functionality is extensive:
• Files of sampled data can be written for graph plotting
• files of force coefficients can be written
• files containing elements for visual post-processing, e.g. cutting planes and
isosurfaces can be written.
2. One major advantage is that this post-processing can run in parallel.
3. Certain utilities
➢ fieldAverage: temporal averaging of fields.
➢ fieldMinMax: writes min/max values of fields.
➢ fieldValue: averaging/integration across sets of faces/cells,e.g. for flux across a plane.
➢ readFields: loads fields to the database for post-processing.
➢ surfacelnterpolateFields: generates surfaceFields from volFields for further
postprocessing.
➢ Forces: calculates pressure/viscous forces and moments.
➢ forceCoeffs: calculates lift, drag and moment coefficients.
➢ sampledSet: data sampling along lines, e.g. for graph plotting.
➢ Probes: data probing at point locations.
➢ isoSurface: generation of an isosurface of given fields in one of the standard sample
formats, e.g. VTK.
➢ cuttingPlane: generation of a cuttingPlane with field data in one of the sample
formats.
➢ sampledPatch: generation of a surface of a patch with field data in one of the sample
formats.
➢ systemCall: execute any system call, e.g. email you to tell you your job is finished.
➢ abortCalculation: Watches for presence of the named file in the case directory and
aborts the calculation if it is present.
➢ partialWrite: allows registered objects, e.g. fields, to be written at different times
(frequencies).
➢ nearWallFields: generates a volField with boundary values from interpolated internal
field. streamLine – generates
➢ streamlines: in one of the sample formats.
➢ timeActivatedFileUpdate: modifies case settings at specified times in a simulation.
➢ writeRegisteredObject: writes registered objects, e.g. fields that are not scheduled to
be written in the application, i.e. created with NO_WRITE.
Third-party Post-processing
OpenFOAM is supplied with reader modules and data converters for post-processing with other
third party products.
• On Windows:
With WSL Ubuntu, launch the “Ubuntu” App
• On native ubuntu Linux:
$ whoami <enter>
2. Command execution usually throws an output and gives back the prompt
$ Exit <enter>
3. Special directories
a. /bin, /usr/bin, etc.: binary applications
b. etc: configuration files
c. /home: private user folders (not visible to others)
d. /tmp: temporary scratch space
e. /var: run time files used by the system
Navigating Directories on Command Line
All terminal commands are executed inside a specific directory
working directory)
$ pwd
$ cd ..
$ pwd
cd $HOME
cd (change directory)
/home/sunthar
$ pwd
$ cd /home
$ cd ../tmp
Listing Directories and Files
1. List out the sub-directories and files under the current directory
$ ls
$ cd /
$ ls
To bring it to a clean slate, we can ‘clear’ the screen (equivalent to ‘cls’ of Windows command
prompt)
$ Clear
$ cd ..
3. Remove directory and all its contents “folder within the folder” (warning: cannot be
recovered) use:
$. mkdir -p docs/plots/two
$. ls
Command Line Completion
To avoid typing Linux prompt can complete some words for you
$ mkdir -p docs/plots/two
$ ls docs
$. ls do<tab> P<tab><tab>
Screen: ls docs/plots/two/
At the press of every <tabs, any unique words will be filled to result in
$ ls docs/plots/two
2. Some arguments can be an option (or a key) with a prefix of ‘minus’ or ‘hyphen’ sign:
$. <command> -<key> <arg>
$ mkdir -p docs/plots/two
(this means create a directory named docs/plots/two
-p for path : suppose directory of docs and plots do not exist so we cannot create
“two” directory , the -p will create entire path of directories i.e all the three directories.
Therefore instead of creating the three directories separately we use a single command
to create the three directories.
3. Two or more options can be combined with a single 'minus
$. rm -f -r docs
$. echo $MYNAME
$. cd $FOAM_RUN
$. pwd
$. cp -r
$FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily
$. cd pitzDaily
$ blockMesh
$ simpleFoam
$. paraFoam
openfoam
thermoData electromagnetics
Thermophysical
bashrc TransportMode financial
ls
controlDict heatTransfer
& some other
solvers incompressible
lagrangian
mesh
linux64GccDPInt32Opt
multiphase
resources
stressAnalysis