CFD Assignment 2,3
CFD Assignment 2,3
Assignment – 2 & 3
On
Submitted To
Dr. Majed Etemadi
On
Date: July 4, 2023
Submitted By
Contents
Table of Contents ....................................................................................................................... 1
Overview .................................................................................................................................... 2
1. Introduction ............................................................................................................................ 2
5. cf Mesh................................................................................................................................... 8
References: ............................................................................................................................... 17
List of Figures
1|Page
Overview
The report explains the two cases worked with realizable k-Omega SST turbulence model. For
the first case, a Mesh is generated for the ahmedBody using SnappyHexMesh and other using
cfMesh respectively. A Steady-state, incompressible simulation was conducted in open source
CFD tool openFoam to reproduce the aerodynamic drag & lift coefficient of the body.
1. Introduction
cfMesh:
An open-source mesh-generating library termed cfMesh has been included in the
OpenFOAM® framework. The library facilitates the easy implementation of new meshing
processes and applications. It is accomplished by making use of the flexible idea of mesh
modifiers, which enables effective parallelization utilising both distributed memory
parallelization using MPI and shared memory parallelization (SMP).
It can generate a number of meshes, including polyhedral, tetrahedral, and Cartesian (hex-
dominant) in both 3D and 2D. It is 4-5 times faster than snappyHexMesh and involves
significantly less manual effort. It permits complete covering of the boundary layer.
2. Project Inputs
1. ahmedBody.stl
2|Page
2. https://www.fluidmechanics101.com/pages/tools.html
This website used to calculate the First Layer and Final Layer .
3. BlockMesh Generation
BlockMesh is a multi-block mesh generator which can be used for Simple Geometries. The
mesh here is generated from a dictionary file name as blockMeshDict, which is in the Constant
directory of the chosen Model. The blockmeshDict can be easily parametrize as per size and
requirements of geometries. Any simulation will require domain to simulate the specific object.
In this report, snappyHexMesh and cfMesh consist of a single rectangular block which is
named as domain, therefore blockMesh need to be used.
Since this is also a 3D case, faces are defined in blockMeshDict based on the nodes in
counterclockwise direction.
3|Page
Faces:
Min X(left) | Max X(Right)
Min Y(Front) | Max Y(Back)
Min Z(Up) | Max Z(Down)
4|Page
4. Snappy Hex Mesh
SnappyHexMesh is a split-hex, completely parallel mesh generator that ensures a certain level
of mesh quality. It is especially well suited to batch-driven operation and is controlled via
OpenFOAM dictionaries. The refinement of Feature angle can be adjusted in ParaView in the
properties section.
Workflow of Snappy Hex Mesh:
The various meshing procedures can be turned on and off in the first three lines.
I. Castellation – Removes cells based on volume of the object.
II. Snapping – It increase the edges perfection.
III. Mesh layers – Create boundary layers(It also called Prism layers)
5|Page
Meshing Process:
Step 1: Creating Background
Now that the blockMesh domain is created, Ahmedbody .stl can be placed by copying it to the
Constant directory in a newly created folder named as “trisurface”. The dictionary
snappyHexMeshDict, which is placed in the System directory, is read by the meshing tool
snappyHexMesh.
Step 2. Castellated Mesh Control
Cell splitting is performed in the castellatedMeshControls sub-dictionary in the
snappyHexMeshDict dictionary. By changing the Input the values of maxLocalCells,
maxGlobalCells, minRefinementCells, maxLoadUnbalance, nCellsBetweenLevels.
Step 3. Change the level number under features. (Level number shows refinements on the
edges)
Step 4. Refinement of Surfaces – Change the values of level(x y), where x depicts minimum
refinement and y depicts maximum refinement. Additionally, x shows Global Refinement level
and y shows Curvature Refinement.
Step 6. Refinement Regions – Refine the geometry of the box. A region can further divide the
cells into those that are contained by one or more designated volume areas. the data in the
refinementRegions block of the castellatedMeshControls sub-dictionary of the
snappyHexMeshDict dictionary that pertains to the refinement of the volume regions.
Step 7. Location In Mesh - The region in which cells are retained are simply identified by a
location point within the region, specified by the locationInMesh keyword in the
castellatedMeshControls sub-dictionary in the snappyHexMeshDict dictionary.
Step 8. snapControls - The points are snapped on the surface to build a conforming mesh after
removing the cells in the designated region and fine-tuning the volume mesh. The snapping is
controlled in the snapControls sub-dictionary in snappyHexMeshDict.
The following information can be modified:
I. nSmoothPatch –Number of patch smoothing iterations before finding correspondence.
II. Tolerance – Maximum relative distance for points to be attracted by surface.
III. nSolveIter – Number of mesh displacement relaxation iterations. (Recommended 30)
IV. nRelaxIter – Maximum number snapping relaxation iterations.
V. nFeatureSnapIter – Improve the snapping of edges.
This is a valid snapped or body fitted mesh that can be used for a simulation.
Step 9. addLayersControls – introducing the boundary layer meshing in selected parts of the
mesh. This below information can be modified in the addLayersControls sub-dictionary in the
snappyHexMeshDict dictionary:
I. relativeSizes – help to create smooth transition.
II. expansionRatio – Geometric gross ratio
III. finalLayerThickness
IV. minThickness – input the minimum value as possible.
6|Page
V. featureAngle – To avoid boundary layer collapsing close to the corners, increase the
value of it.
MeshQualityDict
MeshQualityDict depicts the quality of the mesh. During the mesh generation process, the mesh
quality is continuously monitored. snappyHexMesh will try to generate a mesh using the mesh
quality Parameters and these parameters can modified as per the requirements.
Compute command “snappyHexMesh” in openFoam. This will create three folders inside the
KOmega directory.
1. Castellation
2. Snapping
3. Prism Layer
Copy the polyMesh from folder 3 (Prism Layer) and paste it to constant folder (remove the
existing polyMesh folder). Now, delete all three folders which were generated.
Figure 4.2: Snappy Hex Mesh view with whole domain and around AhmedBody
7|Page
5. cf Mesh
Step 1. Deleting sub-Folders and Files – A Copy of kOmega directory to be created and sub
directories with name polyMesh, trisurface, extendedFeatureEdgeMesh, postprocessing and
Allrun files are to be deleted.
Step 4. Modify the Value in meshDict – Open System Directory and change the values of
maxCellSize, minCellSize, boundryCellSize according to the specifications.
The values in Object Refinements, localRefinements are be modified.
The boundryLayers to be updates as {patchBoundryLayers}
In order to increase the level of refinement the value under optimiseLayer need to be increased.
The values to be changes under renameBoundry
Figure 5.1: cf Mesh view with whole domain and bounding box
8|Page
Figure 5.1: cf Mesh view with around AhmedBody
9|Page
6. Post processing data representation of Snappy Hex Mesh
Y+
1.00E+03
8.00E+02
6.00E+02
4.00E+02
2.00E+02
0.00E+00 1550
50
150
250
350
450
550
650
750
850
950
1050
1150
1250
1350
1450
1650
1750
1850
1950
2050
2150
2250
2350
2450
2550
2650
2750
2850
2950
Y+
Drag
1.00E+07
5.00E+06
0.00E+00
-5.00E+06
-1.00E+07
1 501 1001 1501 2001 2501
Drag
10 | P a g e
Lift
6.00E+04
2.00E+04
-2.00E+04
-6.00E+04
1 501 1001 1501 2001 2501
Lift
Residual
4.00E-01
3.00E-01
2.00E-01
1.00E-01
0.00E+00
1 501 1001 1501 2001 2501
11 | P a g e
7. Post processing data representation of cf Mesh
Y+
6.00E+02
4.00E+02
2.00E+02
0.00E+00 1550
50
150
250
350
450
550
650
750
850
950
1050
1150
1250
1350
1450
1650
1750
1850
1950
2050
2150
2250
2350
2450
2550
2650
2750
2850
2950
Y+
Drag
8.00E+06
2.00E+06
-4.00E+06
-1.00E+07
1 501 1001 1501 2001 2501
Drag
12 | P a g e
Lift
6.00E+03
3.00E+03
0.00E+00
-3.00E+03
-6.00E+03
1 501 1001 1501 2001 2501
Lift
Residual
4.00E-01
3.00E-01
2.00E-01
1.00E-01
0.00E+00
1 501 1001 1501 2001 2501
13 | P a g e
8. General Explanations
1. Selection of First Layer size and Final Layer size also selection of refinement layer
Ans: First layer size and Final Layer size is calculated using an opensource website as
screenshot attached.
Refinement Levels: Refinement levels are calculated in the Excel sheet. For reference
screenshot is attached below.
14 | P a g e
Figure 8.2: Refinement calculation Excel screenshot
2. Use of Wall Function
Ans: The Wall function is employed in this simulation of the AhmedBody.
Wall function is essentially utilised to obtain exact mesh refinement.
In other words, wall functions are not required if the grid close to the wall is fine enough
(y+1 everywhere and at least 4-5 nodes below y+=5). Low Re values should also be suitable
for SA and kOmegaSST, which are needed for kEpsilon.
1. Calculate the boundary layer profile and resolve the near-wall flow by adding a layer of
cells that is increasing. It costs a lot to compute.
2. Wall functions, the specified function of the boundary layer (logarithmic), can be used in
the turbulence model. One boundary layer cell (not smaller and not more significant than the
BL itself) is required for this. Then, though, it is computationally less expensive and could be
less precise.
Therefore, it's crucial to simplify meshing and lower CPU usage when dealing with huge
models.
Drag Coefficient
The air resistance for a certain form is determined by the drag coefficient, which is a
dimensional number. It is computed by dividing the drag force (Fd) by dynamic pressure
(which is equal to 1/2 air density times the square of the speed v), then multiplying the result
by the reference area A of the form.
2𝐹𝑑
𝐶𝑑 = 2
𝜌𝑢 𝐴
15 | P a g e
Lift Coefficient
A lifting body's lift is related to the fluid density, fluid velocity, and an associated reference
area through the lift coefficient (CL), a dimensionless variable.
2𝐹𝑙
𝐶𝑙 = 2
𝜌𝑢 𝐴
Snappy Hex Mesh: Resulting Drag = ~24 N and Resulting Lift = ~28 N
Co efficient of drag = 0.27 and lift = 0.09
Cf Mesh: Resulting Drag = ~29 N and Resulting Lift = ~ 33 N
Co efficient of drag = 0.25 and lift = 0.08
4. Conclusion of flow:
Ans: As all graphs of drag, lift, residual and y+ mentioned in the chapter 6 (Snappy Hex
Mesh resulting graph) and chapter 7 (cf Mesh resulting graph).
Graphs clearly represents that the mean value of the terms are constant so that conclude that
the flow is converged.
16 | P a g e
References:
[1]“Fluid Mechanics 101,” Fluid Mechanics 101. [Online]. Available:
https://www.fluidmechanics101.com/pages/tools.html
17 | P a g e