MECH 8290 - 79: Practical CFD and Turbulence Modelling: Dr. Majed Etemadi
MECH 8290 - 79: Practical CFD and Turbulence Modelling: Dr. Majed Etemadi
Final Project
On
Submitted To
Dr. Majed Etemadi
On
Date: August 14, 2023
Submitted By
Contents
Abstract ...................................................................................................................................... 4
1. Introduction ............................................................................................................................ 4
6. cfMesh.................................................................................................................................. 12
7. CheckMesh .......................................................................................................................... 14
References: ............................................................................................................................... 50
1|Page
List of Figures
2|Page
Figure 14.3: p stream visuals Side view close ......................................................................... 42
Figure 14.4: p stream visuals Side view .................................................................................. 43
Figure 15.1: Cp visual 3D ........................................................................................................ 44
Figure 15.2: Cp visual Top ...................................................................................................... 44
Figure 15.3: Cp visual Side ...................................................................................................... 45
Figure 16.1: steps for Y+ vs U+ and X vs Cf .......................................................................... 46
Figure 6.2: Y+ vs U+ ............................................................................................................... 47
Figure 6.3: Points X vs Cf........................................................................................................ 47
3|Page
Abstract
This report aims to perform simulation on Tesla Cybertruck using openFOAM CFD software
and ParaView for Visualization. The drag coefficient plays a crucial role in determining the
amount of aerodynamic drag experienced by a vehicle. A lower drag coefficient means less
resistance, which in turn means the vehicle requires less energy to maintain a given speed. With
the help of this simulation, the drag coefficient is calculated by generating the structured mesh
using blockMesh and cfMesh.
1. Introduction
The Tesla Cybertruck is an all-electric pickup truck developed by Tesla, Inc., an electric vehicle
(EV) manufacturer led by Elon Musk. Cybertruck was announced in November 2019 and has
gained significant attention due to its unique, futuristic design and promising performance
specifications [1].
Regarding its aerodynamics, the Cybertruck's design has been a subject of debate and
discussion in terms of its drag coefficient. The drag coefficient (Cd) is a measure of how
aerodynamic an object is, and lower values indicate better aerodynamic efficiency. Traditional
passenger cars typically have a drag coefficient ranging from around 0.25 to 0.35, with high-
efficiency models achieving even lower values [2].
However, the Cybertruck's design deviates significantly from conventional passenger cars,
featuring a boxy, angular shape that might not be as aerodynamically optimized. Tesla has not
officially released the drag coefficient for the Cybertruck at the time of my last update, so the
exact value remains speculative.
4|Page
2. Project Inputs
Below are some of the project inputs required to run the simulation in order to analyze
aerodynamics on the cybertruck using openFOAM and ParaView:
1) Geometry: 3D Model of the cybertruck modified in Solid works and converted to. STL
format. The Dimensions of the Model are 1.07 (Length) x 0.36 (Width) x 0.35 (Height).
The dimensions of stl file is reduced to have less simulation time.
2) Solver: Setting up the case directory with appropriate solver. For this project
simpleFoam is selected.
3) Turbulence modeling: Setting up turbulence modeling. For this project k-epsilon is
selected.
4) Project Initial Conditions: Parameters such as Velocity, density, etc.
5) Calculated Project Boundary Layers: The First and Final Layers are calculated using
the tools available at fluidmechanic website.
https://www.fluidmechanics101.com/pages/tools.html
Boundary Conditions
Velocity @ Inlet 40
Density of Air 1.225
Model Type Symmetrical
Slip for (top, bottom, side 1, side
Boundary filed 2)
Body Slip
Figure 2.1: Boundary conditions
First layer size and Final Layer size is calculated using an opensource website as screenshot
attached.
Following input parameters are required:
- Velocity
- Length Scale
- Viscosity
- Density
- Target Y+
- Layers
- Velocity: In the velocity block need to write the value of the velocity in m/s
- Length Scale: in this need to write the value of the length of the object in m
- Viscosity: Need to enter the viscosity in Pa s
- Density: Need to enter the density in kg/m3
- Target Y+ : Need to enter the value as per the turbulence model like k-Epsilon or k-Omega
SST. Mostly for k-Epsilon preferred value of Y+ need to be more than 30 and for k-Omega
need to be less than 5. Ideally for k-Omega preferred value is 1.
- Layers: Need to be enter the value of the number of layers are required.
5|Page
Figure 2.2: Layer Calculation website [2]
Refinement Levels: Refinement levels are calculated in the Excel sheet. For reference
screenshot is attached below.
6|Page
3. Introduction of Turbulence Models
OpenFOAM provides a variety of turbulence models that can be used to simulate distinct types
of turbulent flows. Some of the most used turbulence models in OpenFOAM include:
k-epsilon Model
This is a two-equation turbulence model that solves for the turbulent kinetic energy (k) and
turbulent dissipation rate (epsilon). It is one of the most widely used turbulence models and is
suitable for a wide range of turbulent flows.
k-omega Model
The k-omega turbulence model is another two-equation model that solves for the turbulent
kinetic energy (k) and the specific dissipation rate (omega). It is often used for boundary layer
flows and flows with adverse pressure gradients.
The Shear Stress Transport (SST) k-omega model combines elements of the k-epsilon and k-
omega models to provide improved accuracy in predicting near-wall and free shear flows.
The choice of turbulence model depends on the specific characteristics of the flow to be
simulated and the level of accuracy required. It is important to select the appropriate turbulence
model based on the physics of the problem and available computational resources. In this
project Realizable K-Epsilon Turbulence Model is selected based on many engineering
applications, the K-epsilon model's balance of accuracy and efficiency makes it a suitable
choice, especially when dealing with vehicle aerodynamics simulations at practical scales.
7|Page
4. Case Directories in k-Epsilon Model
Case directories refer to the organizational structure used to set up, run, and post-process
simulations. Each simulation is typically organized within its own directory, often referred to
as a "case directory." Within this directory, various subdirectories and files that control
different aspects of the simulation can be found. Some of the directories for a K-epsilon
turbulence model simulation in OpenFOAM:
0
This directory holds the initial condition files for various flow properties such as the Value of
k which is the Initial conditions for turbulent kinetic energy (K). For this project value of
epsilon which defines the Initial conditions for turbulent dissipation rate (epsilon).
Constant
This directory contains the fundamental settings of the simulation that remain constant
throughout the simulation, such as physical properties, mesh-related information, and initial
conditions. One of the examples is Turbulence Properties file, this file specifies the turbulence
model being used, along with its parameters. For the K-epsilon model, settings related to
turbulence viscosity, initial conditions for K and epsilon, and other relevant parameters are
defined in this file.
System
The system directory contains files that control the simulation setup, such as time-stepping
settings, numerical schemes, and solver controls. This includes the ControlDict file which
contains settings related to the time stepping and overall simulation control.
8|Page
5. Domain and Domain Mesh
The Domain mesh is generated using a dictionary file named blockMeshDict, which is in the
Constant directory of the chosen Model. The blockmeshDict can be easily parametrized as per
size and requirements of geometries. Any simulation will require domain to simulate the
specific object. To generate a Mesh, a Domain is created by defining the nodes, block
connectivity and number of cells in each direction in the dictionary file.
The blockMesh parameters in OpenFOAM are defined in a text file named blockMeshDict.
This file is located within the system directory of the case directory. The blockMeshDict file
contains specifications that define the structured hexahedral (block-structured) mesh to be
generate.
Below are few of the sections under blockMeshDict.
1- Vertices: In the vertices section of the blockMeshDict file, the coordinates of the
vertices are listed that form the corners of the blocks. Vertices are defined in a nested
set of parentheses, with each set representing a vertex's (x y z) coordinates.
2- blocks: In the block section, each block is defined by specifying the vertices that define
its eight corners as well as the number of cells in each direction within the block.
Sample Format > hex (0 1 2 3 4 5 6 7) (nx ny nz) simpleGrading (1 1 1). Here, the (0 1
2 3 4 5 6 7) inside the parentheses refers to the vertex indices that define the corners of
the block. These vertices determine the shape and orientation of the block in space. The
(nx ny nz) defines the discretization of the block into cells, which affects the mesh
resolution in that block. The simpleGrading keyword is used to specify the mesh
grading (cell stretching or refinement) along each of the block's dimensions. Grading is
a way to control the mesh resolution within a block by specifying how the cell sizes
change from one end of the block to the other. The simpleGrading keyword is followed
by three values (gradx grady gradz) which represent the grading factors for the x, y, and
z directions, respectively.
3- edges: This section is optional and is used to define edges that are not aligned with the
global coordinate system. It can be used to create more complex geometries.
4- Boundary Condition: The boundary conditions for each face of each block need to be
specified. Each boundary condition definition includes the type of boundary condition,
name of Boundary condition and associated properties.
The syntax for specifying boundary conditions is as follows:
<boundaryName>: The name of the boundary patch (e.g., "inlet", "outlet", "walls", etc.).
<boundaryType>: The type of boundary condition (e.g., "patch", "inlet", "outlet",
"symmetryPlane", etc.).
5- Boundary Condition Types: Here are some of boundary condition types and their
associated properties.
Patch: This condition is used to specify Wall-like or symmetry conditions. Faces need to be
specified on which this conditioned is applied.
9|Page
Inlet: For inlet boundary condition properties like velocity, pressure, temperature, etc. are
specified.
Outlet: For outlet boundary condition properties like pressure, flow properties are specified.
The blockMeshDict text editor file to be saved after defining the individual sections. Run the
blockMesh utility in the case directory to generate the mesh based on the defined vertices and
other parameters. After blockMesh completes, the console output for any warnings or errors
need to be checked. The blockMesh can be viewed in visualization tools like ParaView to load
and visualize the generated mesh.
1- Vertices: In the vertices section of the blockMeshDict file, the coordinates of the
vertices are listed that form the corners of the blocks. Vertices are defined in a nested
set of parentheses, with each set representing a vertex's (x y z) coordinates.
2- blocks: In the block section, each block is defined by specifying the vertices that define
its eight corners as well as the number of cells in each direction within the block.
Sample Format > hex (0 1 2 3 4 5 6 7) (nx ny nz) simpleGrading (1 1 1). Here, the (0 1
2 3 4 5 6 7) inside the parentheses refers to the vertex indices that define the corners of
the block. These vertices determine the shape and orientation of the block in space. The
(nx ny nz) defines the discretization of the block into cells, which affects the mesh
resolution in that block. The simpleGrading keyword is used to specify the mesh
grading (cell stretching or refinement) along each of the block's dimensions. Grading is
a way to control the mesh resolution within a block by specifying how the cell sizes
change from one end of the block to the other. The simpleGrading keyword is followed
by three values (gradx grady gradz) which represent the grading factors for the x, y, and
z directions, respectively.
3- edges: This section is optional and is used to define edges that are not aligned with the
global coordinate system. It can be used to create more complex geometries.
4- Boundary Condition: The boundary conditions for each face of each block need to be
specified. Each boundary condition definition includes the type of boundary condition,
name of Boundary condition and associated properties.
<boundaryName>: The name of the boundary patch (e.g., "inlet", "outlet", "walls", etc.).
5- Boundary Condition Types: Here are some of boundary condition types and their
associated properties.
Patch: This condition is used to specify Wall-like or symmetry conditions. Faces need to be
specified on which this conditioned is applied.
Inlet: For inlet boundary condition properties like velocity, pressure, temperature, etc. are
specified.
10 | P a g e
Outlet: For outlet boundary condition properties like pressure, flow properties are specified.
The blockMeshDict text editor file to be saved after defining the individual sections. Run the
Mesh utility in the case directory to generate the mesh based on the defined vertices and other
parameters. After Mesh completes, the console output for any warnings or errors need to be
checked. The Mesh can be viewed in visualization tool ParaView to load and visualize the
generated mesh.
11 | P a g e
6. cfMesh
OpenFOAM's mesh creation framework uses the free and opensource cfMesh library.
Numerous cell types, input geometries, boundary layers, and parallelization techniques are
supported, making it simple to develop novel meshing workflows and applications. cfMesh is
specifically designed to work with OpenFOAM and can produce high-quality, structured, and
unstructured meshes for a variety of complex geometries.
With the help of the core library's extensible and mix-and-match components, cfMesh offers a
variety of meshing workflows in both 3D and 2D. The notion of mesh modifiers is used in the
core library to enable effective parallelization utilizing both distributed memory parallelization
with MPI and shared memory parallelization (SMP). Additionally, special attention has been
paid to memory utilization, which is maintained low by employing data containers (lists,
graphs, etc.) that don't necessitate a lot of dynamic memory allocation operations during the
meshing process.
It is important to have the latest version of OpenFOAM installed for the cfMesh tool to work.
In this project the updated version OpenFOAM v2212 to create domain over STL file with the
help of feature called “surfaceGenerateBoundingBox” by specifying min and max values of
coordinates.
Utilities
In order to simplify several parts of mesh generation, pre-processing, and adaptation in
Computational Fluid Dynamics (CFD) simulations, cfMesh offers a series of utilities. The
following utilities have been used in this project:
surfaceGenerateBoundingBox
A box is generated around the STL file. If the box intersects the rest of the geometry, it does
not resolve self-intersections.
surfaceFeatureEdges
The method of meshing treats features edges as restrictions. Where three or more feature edges
intersect on a surface, those points are referred to as corners. The utility surfaceFeatureEdges
can produce feature edges. Feature edges are saved as generated edges if the output is a fms
file. In the absence of that, it produces patches that are limited by the chosen feature edges.
Steps involved
• Compute the command surfaceGenerateBoundingBox <Cybertruck.stl>
<CybertruckBox.stl> <xMin> <xMax> <yMin> <yMax> <zMin> <zMax> in
openFOAM by specifying the offset in each axis. This created the Box around the
Cybertruck STL file.
• Now, rename the STL file to the FMS file. Due to its denser mesh generation, it is
simple to use in cfMesh. This can be done by refining the edges with the command
surfaceFeatureEdges -angle15 CybertruckteslaBox.stl Cybertrucktesla.fms
• Modify the Values in meshDict file located in the System Directory. cfMesh requires
only two mandatory settings to start a meshing process. One is to define the name of
12 | P a g e
surfaceFile and the other is to define the values of maximum, minimum boundary cell
size. These values need to be set as per the case.
• Modify the object refinement settings in meshDict. For defining refinement zones
inside the volume, objectRefinement setting to be used. Lines, spheres, boxes, truncated
cones, and hollow cones are examples of supported objects that can be utilized for
refining. In this case a Box type is utilized. Each dictionary inside the objectRefinement
dictionary specifies the name of the object used for refinement, and this specification
describes it as a dictionary of dictionaries.
• To determine the thickness of the refinement zone distant from the object, the
refinementThickness option can be used. The intended cell size inside the volume is
specified by cellSize. This is usually 10 times smaller than the Maximum Cell size
defined in meshDict.
• Modify the Local refinement zones that are allowed at the boundary with the help of
localRefinement. Each dictionary inside the main localRefinement dictionary is named
by a patch or facet subset in the geometry that is used for refinement.
• Run the cartesianMesh command in openFOAM. Cartesian process produces 3D
meshes that are mostly made up of hexahedral cells with polyhedra in the transition
zones between the various-sized cells. It creates one boundary layer by default, but the
user can request more refinement. Additionally, MPI parallelization, which is designed
for the creation of massive meshes that cannot fit into the memory of a single accessible
machine, can be used to conduct this procedure.
13 | P a g e
7. CheckMesh
CheckMesh is a tool for analyzing and assessing mesh statistics and quality factors. Command
for that is : checkMesh
Once this command run that will gives the statistics about the points, faces, cells etc., number
of cells of each type and number of cells with respect to their faces, topology checks and
statistics, patch topology checks and statistics, geometry checks and quality parameters
14 | P a g e
8. Mesh Files Visuals
15 | P a g e
Figure 8.2: meshDict
16 | P a g e
Figure 8.3: meshDict rename boundary part
17 | P a g e
Figure 8.4: surfaceFeatureExtract
18 | P a g e
9. Mesh Visuals
19 | P a g e
Figure 9.3: mesh visual with domain and car
Figure 9.4: mesh visual with domain and car from inside domain
20 | P a g e
Figure 9.5: Domain mesh 2D
21 | P a g e
Figure 9.7: close mesh visual 2D
22 | P a g e
Figure 9.9: mesh visual of boundary layer around the car
23 | P a g e
Figure 9.11: boundary layer mesh visual
24 | P a g e
10. PostProcessed Files Visuals
25 | P a g e
Figure 10.2: fvSchemes
26 | P a g e
Figure 10.3: fvSolution
27 | P a g e
Here realizable KE is used as RAS model :
The realisable k-∈ model is a recent discovery that differs from the classic k- model in two
significant ways:
A novel formulation for turbulent viscosity is included in the realisable k-∈ model.
An accurate equation for the transfer of the mean-square vorticity fluctuation has been used to
generate a novel transport equation for the dissipation rate,∈.
28 | P a g e
Figure 10.6: epsilon
29 | P a g e
Figure 10.7: p file
30 | P a g e
Figure 10.8: U file
31 | P a g e
11. Post Processing Visuals
32 | P a g e
Figure 11.3: U profile 2D close view
33 | P a g e
Figure 11.5: p profile 2D
34 | P a g e
Figure 11.7: y+ profile 3D
35 | P a g e
Figure 11.9: y+ profile 2D
36 | P a g e
12. Post Processing Data Representation Analysis
37 | P a g e
Figure 12.3: Time and y+ graph at 100 time steps
38 | P a g e
Figure 12.5: Time and Residual Graph
39 | P a g e
13. Force, Torque and Cp (Total Pressure Coefficient) calculation
Stream Tracer:
1. take volumeMesh
2. take Z normal slice
3. take stream tracer and give points for arrow from which stream line need to check
4. apply that will gives the stream tracer around the body
40 | P a g e
14. StreamTracer Visual
41 | P a g e
Figure 14.3: p stream visuals Top view
42 | P a g e
Figure 14.4: p stream visuals Side view
43 | P a g e
15. Cp Visuals
44 | P a g e
Figure 15.3: Cp visual Side
45 | P a g e
16. Graphical analysis of k-Epsilon model through Y+ vs U+ and point X vs Cf
𝑆ℎ𝑒𝑎𝑟 𝑇𝑜𝑡𝑎𝑙
𝑈− 𝑡𝑎𝑢 = 𝑠𝑞𝑟𝑡 ( )
𝑑𝑒𝑛𝑠𝑖𝑡𝑦
𝑈− 𝑋
𝑈+ =
𝑈− 𝑡𝑎𝑢
46 | P a g e
𝑈 + 𝐿𝑎𝑚 𝑖𝑛𝑎𝑟 = 𝑌 +
𝑚𝑎𝑔(𝑤𝑎𝑙𝑙𝑆ℎ𝑒𝑎𝑟𝑆𝑡𝑟𝑒𝑠𝑠)
𝐶𝑓 =
0.5 ⋅ (𝐷𝑒𝑛𝑠𝑖𝑡𝑦) ⋅ (𝑉𝑒𝑙𝑜𝑐𝑖𝑡𝑦)2
Figure 6.2: Y+ vs U+
47 | P a g e
17. Results : Drag and Lift Calculation
Coefficient of Drag
The drag coefficient, a dimensionless quantity, determines the air resistance for a certain shape.
It is calculated by
𝐹𝑑
𝐶𝑑 = 2 ∗
𝜌 ∗ 𝑢2 ∗ 𝐴
The Drag Coefficient Cd measures an object's resistance relative to its frontal area as it passes
through a fluid. Aerodynamicists can use it to simulate the effects of form, tilt, and flow
conditions on aerodynamic drag. Aerodynamicists may simply evaluate several designs to
determine which has the optimum aerodynamic efficiency since the coefficient of drag is
dimensionless.
Coefficient of Lift
The lift coefficient (CL) is a dimensionless variable that connects the lift created by a lifting
body to the fluid density surrounding the body. It is Calculated by
𝐹𝑙
𝐶𝑙 = 2 ∗
𝜌 ∗ 𝑢2 ∗ 𝐴
As per the simulation, Cd and Cl are calculated and following are the values of the Cd and Cl
𝑪𝒅 = 𝟎. 𝟑𝟔
𝑪𝒍 = 𝟎. 𝟏𝟏
48 | P a g e
18. Conclusion
➢ As all graphs of drag, lift, residual and y+ mentioned in the chapter 12.
Graphs clearly represents that the mean value of the terms are constant so that conclude that
the flow is converged.
➢ The Drag Coefficient is estimated and discovered to be around 0.36. This is consistent with
the findings of references [3] [4]. Though, as Elon Musk, CEO of Tesla Motors Inc., stated,
it might be decreased through a variety of techniques and changes.
49 | P a g e
References:
[3] Ruffo, Gustavo Henrique. “Tesla Cybertruck Aerodynamic Studies Point To Cd Of 0.4:
Musk Says 0.3.” InsideEVs, InsideEVs, 3 Dec. 2019, insideevs.com/news/385856/tesla-
cybertruck-aerodynamic-coefficient-03/.
s
[4] Remmerie, Wouter. “Is the Tesla Cybertruck Aerodynamic?” AirShaper, AirShaper, 2 Feb.
2021, airshaper.com/cases/tesla-cybertruck-aerodynamics.
50 | P a g e