Open-source CFD toolbox: OpenFOAM is now a mature open-source CFD program with reliability matching that of commercial products. This page describes summary of utilities and dictionaries used in OpenFOAM meshing and visualization such as (blockMesh, snappyHexMesh, ParaView) and OpenFOAM CFD codes and pre-processors such as (simpleFoam, pimpleFoam, engineFoam...).
OpenFOAM CFD: A Beginner's Diary
This content is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM CFD software and owner of the OpenFOAM and OpenCFD trademarks.
However, if one does not want to run parallel version (using more than 1 processor), simply use blockMesh and then snappyHexMesh on the command prompt to get the desired mesh, thus skipping the utilities decomposePar, reconstructParMesh and reconstructPar.
List of Sampe Cases
As per user guide: "Steady-state solver for incompressible, 1D turbulent flow, typically to generate boundary layer conditions at an inlet". The description of flow geometry and boundary conditions used are shown below.
incompressible/simpleFoam/airfoil2D A detailed description of this tutorial case by Grant Ingram from Durham University can be found here.
No blockMeshDict available in tutorial folder. polyMesh data available for simulation. Typically, the information is provided in utility file Allrun. If there is no mention of mesh in this file, there is not one. For example, in problem case 'flange' under laplacianFoam, there is neither blockMeshDict nor polyMesh. But there is a file 'flange.ans'. Inside 'Allrun' it is explained that flange.ans is ANSYS file.
This is one of the test cases described in user guide. There are two simulation cases - they differ mainly between the turbulence model used and the way input boundary conditions are specified. "pitzDailyExptInlet" demonstrate how to interpolate or apply non-uniform boundary conditions at the inlet. The differences in U sub-dictionaries are shown below.
Go to top incompressible/simpleFoam/simpleCar This is a good demonstration of block mesh utility to generate mesh with internal cavities and nice representation of car as simplified geometry.
This demo case shows how to use parameter definition in blockMeshDict, use of #calc utility and create wedge elements [axisymmetric domain with zero inner radius]. The blockMesh utility creates on-the-fly library for few occurrence of #calc [in Windows version of 1606+]. Some messages appearing in the terminal are:
wmakeLnInclude: linking include files to ./lnInclude
ln: creating symbolic link './codeStreamTemplate.C': Protocol error
Making dependency list for source file codeStreamTemplate.C
Creating new library in "dynamicCode/_9273df81ebe52476e105ce9128b702a57ad95417/platforms/
Go to top Flow of Buildings - snappyHexMesh This case demonstrates snappyHexMesh utility. User should follow the steps defined in file Allrun. surfaceFeatureExtract needs to be run before blockMesh and snappyHexMesh.
sHM requires other utilities such as surfaceCheck which can check the input STL geometry and prints overall size (bounding box) of the geometry. Output from surfaceCheck utility:
Reading surface from "constant/triSurface/Fan_in_Duct.stl" ...
Triangles : 23474
Vertices : 11749
Bounding Box : (-550 -185 -185) (540 185 185)
Surface has no illegal triangles.
Triangle quality (equilateral=1, collapsed=0):
0.00 .. 0.05 : 0.1744
0.05 .. 0.10 : 0.1612
min 4.76e-06 for triangle 19519
max 0.999899 for triangle 11050
min 0.00290 for edge 352 points (-22.92 108.37 143.69)(-22.9 108.37 143.7)
max 500.073 for edge 101 points (-550.0 152.62 104.55)(-50.0 157.29 97.39)
Checking for points less than 1e-6 of bounding box ((1090 370 370) metre) apart.
Found 0 nearby points.
Surface is not closed since not all edges connected to two faces:
connected to one face : 24
connected to >2 faces : 8
Conflicting face labels:48
Dumping conflicting face labels to "problemFaces"
Paste this into the input for surfaceSubset
Number of unconnected parts : 2
Splitting surface into parts ...
Writing zoning to "zone_Fan_in_Duct.vtk"...
writing part 0 size 1084 to "Fan_in_Duct_0.obj"
writing part 1 size 2239 to "Fan_in_Duct_1.obj"
Number of zones (connected area with consistent normal) : 10
More than one normal orientation.
The command surfaceFeatureExtract creates the *.eMesh files from the *.stl files with the geometry data. Folder extendedFeatureEdgeMesh is created in the constant directory. The creation of eMesh files with the command surfaceFeatureExtract is not mandatory stops to use sHM. This step isnecessary only if edges need to be refined.
Rotating Walls and Domains mixerVessel2D - simpleFoam This case can be obtained by adding baffles to the case 2D rotor. However, note that 2D rotor case uses simpleFoam and not SRFSimpleFoam.
Go to top pimpleDyMFoam - Moving Cone In recent versions (OpenFOAM v1806 or later) the dynamic mesh functionality in pimpleDyMFoam has been merged into pimpleFoam and the pimpleDyMFoam tutorials moved into the pimpleFoam tutorials directory. This tutorial demonstrates the moving mesh without any re-meshing or addition/deletion of layer. The size of elements expands and contracts during the mesh motion with constant velocity 1 [m/s] defined in dictionary 0/pointMotionUx.
Go to top pimpleDyMFoam - propeller with AMI (Arbitrary Mesh Interface)
snappyHexMesh [sHM]: Used to create high quality hex-dominant meshes [similar to but not exactly Cartesian Mesh in ICEM CFD] based on arbitrary geometry, the controlling dictionary is system/snappyHexMeshDict. Requires a starting [hexahedral] mesh created by blockMesh [designated as base mesh or level 0 mesh] and geometry data in STL and Nastran (.nas) files format. A snappyHexMeshDict file created after reading through such files used in various tutorial application can be found here. This is a generic dictionary which demonstrates all the features of this utility. Different stages of mesh generation in snappyHexMesh utility is shown in following images.
Examples of snappyHexMesh application can be found in tutorial cases:
The background mesh or base mesh can be generated using blockMesh or an external mesher with following constraints:
The background mesh must contain only hexahedrons.
The cell aspect ratio should be approximately 1, at least near the
There should be at least 1 intersection of a cell edge with the STL surface.
The STL geometry can be obtained from any 3D CAD geometry modeling tool or pre-processor so long it results in a water tight geometry.
The STL file can be made up of a single surface describing the geometry or multiple surfaces that describe the geometry.
In the case of a STL file with multiple surfaces, local refinement in each individual surface can be exploited.
Multiple STL files can be used.
The STL geometry is always located in the directory constant/triSurface.
The final mesh is always placed in the directory
Conductive heat transfer using laplacianFoam in openFOAM
Go to top heatTransfer\chtMultiRegionFoam\multiRegionHeater Conjugate Heat Transfer - a well documented PDF version can be found here.
pimpleFoam This module demonstrates use of PISO-SIMPLE (PIMPLE) algorithm in test cases such as TEE-junction and fan pressure jump boundary conditions.
multiphase\multiphaseInterFoam\laminar\damBreak4phaseFine Multiphase flow using VOF method for 4 immiscible phases.
The content on CFDyna.com is being constantly refined and improvised with on-the-job experience, testing, and training. Examples might be simplified to improve insight into the physics and basic understanding. Linked pages, articles, references, and examples are constantly reviewed to reduce errors, but we cannot warrant full correctness of all content.