All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: To perform flow analysis through a given geometry on OpenFOAM, and draw conclusions. To find how the velocity magnitude profile change as a function of mesh grading factor, 0.2, 0.5, and 0.8 Measure the velocity profile at 0.085 m from the inlet of the geometry Compare velocity magnitude contours near the step region…
Shaloy Elshan Lewis
updated on 17 Dec 2020
Aim:
To perform flow analysis through a given geometry on OpenFOAM, and draw conclusions.
Geometry:
Dividing the geometry into blocks:
The given geometry is divided into 5 blocks as shown above. Each block is further divided into 200 mesh elements in the x-direction and 10 mesh elements in the y-direction. Since we are not interested in the flow parameters in the z-direction, only one mesh element is defined.
boundary conditions:
inlet - [0 5 16 11]
outlet - [6 9 20 17]
velocity of flow of fluid at inlet = 1.5 m/s
Solution:
The above problem is first solved for a mesh grading factor of 0.2 and then it can be subsequently solved for mesh grading factor of 0.5 and 0.8. Similarly, the velocity profile for these mesh grading factors can be compared and analyzed.
a) Mesh grading factor = 0.2
BlockmeshDict code:
/*--------------------------------*- C++ -*----------------------------------*
========= |
/ F ield | OpenFOAM: The Open Source CFD Toolbox
/ O peration | Website: https://openfoam.org
/ A nd | Version: 7
/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
(0 0 0)//v0
(8 0 0)//v1
(8 0.5 0)//v2
(0 0.5 0)//v3
(8 1 0)//v4
(0 1 0)//v5
(20 1 0)//v6
(20 0.5 0)//v7
(20 0 0)//v8
(20 -1 0)//v9
(8 -1 0)//v10
(0 0 0.1)//v11
(8 0 0.1)//v12
(8 0.5 0.1)//v13
(0 0.5 0.1)//v14
(8 1 0.1)//v15
(0 1 0.1)//v16
(20 1 0.1)//v17
(20 0.5 0.1)//v18
(20 0 0.1)//v19
(20 -1 0.1)//v20
(8 -1 0.1)//v21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.2 5 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.2 0.2 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (5 0.2 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (5 5 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (5 5 1)
);
edges
(
);
boundary
(
topandbottom
{
type wall;
faces
(
(4 5 16 15)
(6 4 15 17)
(12 11 0 1)
(20 21 10 9)
(1 10 21 12)
);
}
frontandback
{
type empty;
faces
(
(3 2 1 0)
(5 4 2 3)
(4 6 7 2)
(2 7 8 1)
(1 8 9 10)
(11 12 13 14)
(14 13 15 16)
(13 18 17 15)
(12 19 18 13)
(21 20 19 12)
);
}
inlet
{
type patch;
faces
(
(11 14 3 0)
(14 16 5 3)
);
}
outlet
{
type patch;
faces
(
(17 18 7 6)
(18 19 8 7)
(19 20 9 8)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
In blockMeshDict code, the following are defined
ControlDict code:
/*--------------------------------*- C++ -*----------------------------------*
========= |
/ F ield | OpenFOAM: The Open Source CFD Toolbox
/ O peration | Website: https://openfoam.org
/ A nd | Version: 7
/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.05;
deltaT 1e-5a;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
In ControlDict code the following are defined
Velocity code:
/*--------------------------------*- C++ -*----------------------------------*
========= |
/ F ield | OpenFOAM: The Open Source CFD Toolbox
/ O peration | Website: https://openfoam.org
/ A nd | Version: 7
/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (1.5 0 0);
}
outlet
{
type zeroGradient;
}
topandbottom
{
type noSlip;
}
frontandback
{
type empty;
}
}
// ************************************************************************* //
The velocity code contains the velocity boundary conditions. Here, the inlet velocity in the x-direction is given as 1.5 m/s, and inlet velocity in y and z-direction is given as 0 m/s.
Pressure code:
/*--------------------------------*- C++ -*----------------------------------*
========= |
/ F ield | OpenFOAM: The Open Source CFD Toolbox
/ O peration | Website: https://openfoam.org
/ A nd | Version: 7
/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
topandbottom
{
type zeroGradient;
}
frontandback
{
type empty;
}
}
// ************************************************************************* //
The pressure code contains the pressure boundary conditions
Blocks divided into mesh elements:
Here, the given blocks are divided into 200, 10, and 1 mesh elements in x, y, and z-direction respectively. Mesh grading is defined as the ratio of the size of the first element to the ratio of the final element. Here mesh grading of 0.2 is provided, wherein the mesh element are densely packed near the walls and the diverging section so as to visualize the flow separation clearly.
Velocity contours:
Velocity profile at 0.085m from inlet:
This is the profile of the magnitude of velocity at a distance of 0.085m from the inlet. The start point is taken as the bottom wall and the endpoint is taken as the top wall. We get the highest velocity magnitude of 1.67269m/s at a distance of 0.01368m.
b) Mesh grading factor = 0.5
BlockmeshDict code:
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.5 2 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.5 0.5 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (2 0.5 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (2 2 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (2 2 1)
);
Here, the grading factor is changed and the rest of the blockMeshDict code remains the same. Similarly, the ControlDict, velocity, and pressure code remains the same unless we want to change any boundary conditions.
Geometry divided into the mesh:
Here, the given blocks are divided into 200, 10, and 1 mesh elements in x, y, and z-direction respectively. Mesh grading is defined as the ratio of the size of the first element to the ratio of the final element. Here mesh grading of 0.5 is provided, wherein the mesh element are densely packed near the walls and the diverging section so as to visualize the flow separation clearly.
Velocity contours:
Velocity profile at 0.085m from inlet:
This is the profile of the magnitude of velocity at a distance of 0.085m from the inlet. The start point is taken as the bottom wall and the endpoint is taken as the top wall. We get the highest velocity magnitude of 1.67853m/s at a distance of 0.0137m.
c) Mesh grading factor = 0.8
BlockmeshDict code:
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.8 1.25 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.8 0.8 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.25 0.8 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.25 1.25 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.25 1.25 1)
);
Here, the grading factor is changed and the rest of the blockMeshDict code remains the same. Similarly, the ControlDict, velocity, and pressure code remains the same unless we want to change any boundary conditions.
Geometry divided into the mesh:
Here, the given blocks are divided into 200, 10, and 1 mesh elements in x, y, and z-direction respectively. Mesh grading is defined as the ratio of the size of the first element to the ratio of the final element. Here mesh grading of 0.8 is provided, wherein the mesh element are densely packed near the walls and the diverging section so as to visualize the flow separation clearly.
Velocity contours:
Velocity profile at 0.085m from inlet:
This is the profile of the magnitude of velocity at a distance of 0.085m from the inlet. The start point is taken as the bottom wall and the endpoint is taken as the top wall. We get the highest velocity magnitude of 1.67224m/s at a distance of 0.0136m.
d) Mesh grading factor = 1
BlockMeshDict code:
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 1 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 1 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1 1 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1 1 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1 1 1)
);
Here, the grading factor is changed and the rest of the blockMeshDict code remains the same. Similarly, the ControlDict, velocity, and pressure code remains the same unless we want to change any boundary conditions. With mesh grading factor = 1.0, the mesh elements remain of the same size throughout. Hence, we can compare the results obtained from this mesh to the results obtained with mesh grading.
Geometry divided into the mesh:
Velocity contours:
Velocity profile:
This is the profile of the magnitude of velocity at a distance of 0.085m from the inlet. The start point is taken as the bottom wall and the endpoint is taken as the top wall. We get the highest velocity magnitude of 1.67235m/s at a distance of 0.01366m.
Results:
Hence, the given geometry was divided into the required number of blocks, and these blocks were divided into the required number of mesh elements, with different mesh grading factors to compare them with each other. The velocity magnitude results obtained at a distance of 0.085m from the inlet of the pipe for various mesh grading factors can be summarized in the table below:
Mesh-grading factor | Highest velocity magnitude | The location from the bottom wall |
1.0 | 1.67235 | 0.01368 |
0.8 | 1.67224 | 0.0136 |
0.5 | 1.67853 | 0.0137 |
0.2 | 1.67269 | 0.01368 |
From the above table, we see that the results obtained are almost the same using different mesh grading factors. Some advantages of using a graded mesh are:
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Photo Realistic Rendering
MODELING AND RENDERING OF THE AMERICAN CHOPPER Objective:3D modeling of all American chopper parts and assemble them using SolidWorks to fully define the resultant assembly. Once the assembly is complete, render it using Photo view 360. Introduction:The American chopper is designed and developed in a step-by-step…
06 Jun 2021 06:12 PM IST
Surface wrap of power-train assembly using ANSA
Aim: To check for geometrical errors on the given individual components (engine, transmission, gearbox), and delete the unwanted surfaces. Then surface-wrap the engine, transmission, and gearbox assembly with a set target length using ANSA. Problem statement: 1. Delete all the unwanted components present in…
17 Dec 2020 08:16 AM IST
Generating a CFD mesh over the Tesla Cybertruck model to perform external aerodynamic simulations
Aim: To check and solve all the geometrical errors on the given Tesla Cybertruck geometry and assign appropriate Property IDs (PIDs). Then, deploy the surface mesh for different parts (PIDs) with appropriate target lengths and element quality criteria. Then enclose the car model in a virtual wind tunnel, and deploy CFD…
17 Dec 2020 08:13 AM IST
Generating a CFD mesh over the BMW M6 model to perform external aerodynamic simulations
Aim: To check and solve all the geometrical errors on the given BMW M6 car geometry and assign appropriate Property IDs (PIDs). Then, deploy the surface mesh for different parts (PIDs) with the given target length and element quality criteria using ANSA. Then enclose the car model in a virtual wind tunnel, and deploy CFD…
17 Dec 2020 08:12 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.