Study of flow over a backward facing step using OpenFOAM
Objective:
The objective of this challenge is to create a desired geometry and mesh in OpenFOAM and to run the simulation by applying boundary conditions. The grid dependency was also found out by using different grading factors of 0.2, 0.5 and 0.8.
Procedure:
- The fluid used for this problem was incompressible. The icoFoam solveer was used since the flow was incompressible and laminar.
- The solver can be found inside the tutorials folder under Tutorials --> incompressible --> icoFoam --> cavity. Copy this folder in the run folder using the command cp -R cavity /$FOAM_RUN/
- Now go in the run folder using cd $FOAM_RUN and go inside the cavity folder.
- Once inside the cavity folder, we need to edit the blockMeshDict and controlDict files in the \'systems\' folder and the \'p\' and \'U\' values inside the \'0\' folder. The modified versions of these files are given below.
- First edit the blockMeshDict file as per the required geometry and grading factor. Also make sure to use the right hand thumb rule while entering the co-ordinates for faces.
- Once this file is modified, check the created geometry and mesh using the paraFoam command. After checking the mesh, edit the remaining three files and then run the simulation using the command \'icoFoam\'.
blockMeshDict (grading factor 0.2):
/*--------------------------------*- 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 1;
vertices
(
(0 0 0) //0
(0.08 0 0) //1
(0.08 0.005 0) //2
(0 0.005 0) //3
(0.08 0.01 0) //4
(0 0.01 0) //5
(0.2 0.01 0) //6
(0.2 0.005 0) //7
(0.2 0 0) //8
(0.2 -0.01 0) //9
(0.08 -0.01 0) //10
(0 0 0.001) //11
(0.08 0 0.001) //12
(0.08 0.005 0.001) //13
(0 0.005 0.001) //14
(0.08 0.01 0.001) //15
(0 0.01 0.001) //16
(0.2 0.01 0.001) //17
(0.2 0.005 0.001) //18
(0.2 0 0.001) //19
(0.2 -0.01 0.001) //20
(0.08 -0.01 0.001) //21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 5 1)
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 0.2 1)
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (5 0.2 1)
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (5 5 1)
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (5 5 1)
);
edges
(
);
boundary
(
NoSlipWall
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
(11 0 1 12)
(12 1 10 21)
(21 10 9 20)
);
}
frontAndBack
{
type empty;
faces
(
(11 12 13 14)
(14 13 15 16)
(13 18 17 15)
(12 19 18 13)
(21 20 19 12)
(0 3 2 1)
(3 5 4 2)
(2 4 6 7)
(1 2 7 8)
(10 1 8 9)
);
}
inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type patch;
faces
(
(7 6 17 18)
(8 7 18 19)
(9 8 19 20)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
grading factor 0.5:
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 2 1)
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 0.5 1)
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (2 0.5 1)
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (2 2 1)
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (2 2 1)
);
grading factor 0.8:
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 1.25 1)
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 0.8 1)
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (1.25 0.8 1)
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (1.25 1.25 1)
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (1.25 1.25 1)
);
controlDict:
/*--------------------------------*- 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.1;
deltaT 0.00005;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
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;
}
NoSlipWall
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
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 0 0);
}
outlet
{
type zeroGradient;
}
NoSlipWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
RESULTS:
The geometry created is as below. The thickness of the geometry in the z direction was taken to be 5 mm.
Meshes with different grading factors-
grading factor 0.2
grading factor 0.5
grading factor 0.8
Velocity profile along with the plot over line plot at x=0.085 for different grading factors.
grading factor 0.2
grading factor 0.5
grading factor 0.8
Conclusions:
- As can be seen, the mesh with grading factor 0.2 is a lot finer at the edges and hence a smoother plot is acheived.
- The velocity profile through the mesh graded at 0.2 is a lot finer sharper than that from the mesh graded at 0.8.
- In the line plots, the highest velocity magnitude is slightly lower for the mesh with grading factor 0.2 as compared to 0.5. The plot for grading factor 0.8 is a bit distorted.
- Hence, the mesh with grading factor 0.2 gives the better resukts of the three. This can be attributed to the small cell size and hence calculation of the velocity magnitude at more number of points resulting into higher accuracy.