Effect of mesh Grading factor on Velocity of Blockmesh
Aim:
To simulate the flow through a backward facing step & to create multiple meshes and compare the results obtained from each mesh for the following profile using icoFoam.
Objective:
- To create a block for the given dimensions.
- Then Define the control conditions to the specifications.
- Use different mesh grading factors along the walls of the profile to compare the difference in the output of velocity profile.
- Give the wall conditions for velocity & pressure calculations.
- Run the simulation to get the velocity profile.
- Conclude the observations for the change in mesh grading factor.
Conditions:
- Number of cells along the x direction (longer dimension) = 200
- Number of cells along the y direction = 10
- Use a graded mesh. Grading factor near all walls should be 0.2
- Take the boundary conditions as given in the figure for each side of the walls.
Steps for simulation:
- Get in to the tutorial file by using \'cd\' command.
- In the tutorial file select the icoFoam file as given in the problem.
- Copy the file to be edited inside the icoFoam.
- \'cp -r/$FOAM_RUN/\' command is used to copy the required file.
- Give the destination name for the copied file at the end of the command.
- Open the destination file using \'cd $FOAM_RUN\' command.
- You can see the copied file inside the path.
- In the Destination file there will be 3 files \'0\' , \'constant\' & \'system\'.
- Get into the system file were we have to edit \'blockMeshDict\' & \'controlDict\'.
Code edit (blockMeshDict):
- In this file we are going to edit the vertices of the profile, Geometry of the blocks, Number of meshes along the axis, Mesh grading factor along the wall & Conditions of the walls.
- After editing the blockMeshDict we can get the required profile that is to be simulated for getting the results.
- Create and check the meshes along the profile by using the commands \'blockMesh\' & \'checkMesh\'.
/--------------------------------- 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
(0 1 0) //V4
(8 1 0) //V5
(20 1 0) //V6
(20 0.5 0)//V7
(20 0 0) //V8
(20 -1 0) //V9
(8 -1 0) //V10
(8 0 0.1) //V11
(0 0 0.1) //V12
(0 0.5 0.1) //V13
(8 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 12 11 14 13) (200 10 1) simpleGrading (0.8 1.8 1)
hex (3 2 5 4 13 14 15 16) (200 10 1) simpleGrading (0.8 0.8 1)
hex (2 7 6 5 14 18 17 15) (200 10 1) simpleGrading (1.8 0.8 1)
hex (1 8 7 2 11 19 18 14) (200 10 1) simpleGrading (1.8 1.8 1)
hex (10 9 8 1 21 20 19 11) (200 10 1) simpleGrading (1.8 0.8 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(13 12 0 3)
(16 13 3 4)
);
}
outlet
{
type patch;
faces
(
(6 17 18 7)
(7 18 19 8)
(8 19 20 9)
);
}
front
{
type empty;
faces
(
(13 12 11 14)
(16 13 14 15)
(15 14 18 17)
(14 11 19 18)
(11 21 20 19)
);
}
Back
{
type empty;
faces
(
(3 0 1 2)
(4 3 2 5)
(5 2 7 6)
(2 1 8 7)
(1 10 9 8)
);
}
topandbottom
{
type wall;
faces
(
(0 12 11 1)
(11 10 21 1)
(10 21 20 9)
(16 4 5 15)
(15 5 6 17)
);
}
);
mergePatchPairs
Code edit (contolDict):
Assume the deltaT value according to the problem.
/--------------------------------- 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-05;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// *********
- After completing the editing in system file, we have to edit the 0 file.
- Inside the 0 file we have conditions for both pressure \'p\' & velocity \'U\'.
- Give the wall conditions for both the pressure & velocity with the respect to the conditions given in the blockMeshDict file.
Code edit (pressure \'p\'):
/--------------------------------- 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;
}
front
{
type empty;
}
Back
{
type empty;
}
topandbottom
{
type zeroGradient;
}
}
// ************************* //
Code edit (Velocity \'U\'):
/--------------------------------- 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;
}
front
{
type empty;
}
Back
{
type empty;
}
topandbottom
{
type noSlip;
}
}
// ************************* //
Mesh Grading Factor:
- Specifies the maximum ratio of adjacent mesh edges for transitioning between coarse and fine regions.
- A smaller grading factor produces a more uniform mesh.
- In the program we can change the factor in blockMeshDict code.
- By changing the values at the marked portion of the image we can vary the grading factor.
Results:
As given in the problem for each of the grading factors we are taking the velocity profiles at a point 0.085 meters away from the inlet wall.
Mesh Grading Factor 0.2:
Mesh Grading Factor 0.5:
Mesh Grading Factor 0.8:
Conclusion:
- As we can observe from the graphs, there is not much difference between the three meshes.
- But if the values are taken, we can see a slight variation among the three graphs.
- We can conclude that as the grading factor decreases, the meshes becomes more smoother and thus gives a much neater curve in less time consumption.