Flow over a Backward facing step in OpenFOAM
Objectives of the Project:
(1) Create the geometry using BlockMesh in OpenFOAM.
(2) Simulate the flow using the icoFoam solver.
(3) Compare the velocity magnitude profile for different values of mesh grading factor at a distance of 0.085m from the inlet.
Theory:
For this project, the lid-driven cavity tutorial provided in OpenFOAM has been modified. BlockMesh is used to create the geometry as given below-
IcoFoam solver is a transient solver for incompressible, laminar flow of Newtonian fluids. It uses the PISO algorithm to solve the continuity and momentum equation.
Assumptions:
- Number of cells along X-direction=200
- Number of cells along Y-direction=20
- Number of cells along Z-direction=1
- Grading factor near all walls=0.2
- No slip boundary condition at all walls
- Kinematic viscosity=0.01 m^2/sec
- Inlet velocity=0.5 m/sec
- Simulation time=0.5 sec
- time-step=0.0001 sec
The blockMeshDict file has been edited to obtain the geometry as follows:
For ungraded mesh, the grading factor is kept as 1. Also to ensure proper capture of flow properties at the boundaries, grading factor of 0.2 is kept at walls so that mesh is fine in that section.
Mesh grading factor= Size of last cell/Size of the first cell
When mesh grading factor<<1, the mesh is finer at the end as compared to start of blockMesh.
When mesh grading factor>>1, the mesh is finer at the start as compared to end of blockMesh.
BlockMeshDict File-
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
(0 0 0) //0
(8 0 0) //1
(8 0.5 0) //2
(0 0.5 0) //3
(0 0 0.1) //4
(8 0 0.1) //5
(8 0.5 0.1) //6
(0 0.5 0.1) //7
(0 1 0) //8
(8 1 0) //9
(0 1 0.1) //10
(8 1 0.1) //11
(8 -1 0) //12
(20 -1 0) //13
(20 -0.5 0) //14
(8 -0.5 0) //15
(8 -1 0.1) //16
(20 -1 0.1) //17
(20 -0.5 0.1) //18
(8 -0.5 0.1) //19
(20 0 0) //20
(20 0.5 0) //21
(20 0 0.1) //22
(20 0.5 0.1) //23
(20 1 0) //24
(20 1 0.1) //25
);
blocks
(
hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (1 1 1)
hex (3 2 9 8 7 6 11 10) (80 5 1) simpleGrading (1 1 1)
hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (1 1 1)
hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (1 1 1)
hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (1 1 1)
hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 3 7 4)
(3 8 10 7)
);
}
outlet
{
type patch;
faces
(
(23 25 24 21)
(22 23 21 20)
(18 22 20 14)
(17 18 14 13)
);
}
noslipwall
{
type wall;
faces
(
(8 9 11 10)
(13 12 16 17)
(15 1 5 19)
(9 24 25 11)
(12 15 19 16)
(0 4 5 1)
);
}
frontandback
{
type empty;
faces
(
(0 1 2 3)
(3 2 9 8)
(2 21 24 9)
(1 20 21 2)
(15 14 20 1)
(12 13 14 15)
(4 7 6 5)
(7 10 11 6)
(6 11 25 23)
(5 6 23 22)
(19 5 22 18)
(16 19 18 17)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
The BlockMesh Geometry-
Initial condition for Pressure and Velocity are as given below:
Pressure-
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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;
}
}
// ************************************************************************* //
Velocity-
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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 (0.5 0 0);
}
outlet
{
type zeroGradient;
}
noslipwall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
RESULTS:
Case 1: Ungraded Mesh (Mesh grading factor=1)
Case 2: Mesh grading factor=0.2
Only the block command in code is modified to change the mesh grading factor. The mesh near step is made finer by changing the mesh grading factor. The code is as given below:
blocks
(
hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (0.2 5 1)
hex (3 2 9 8 7 6 11 10) (80 5 1) simpleGrading (0.2 0.2 1)
hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (5 0.2 1)
hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (5 5 1)
hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (5 0.2 1)
hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (5 5 1)
);
Case 3: Mesh grading factor=0.5
blocks
(
hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (0.5 2 1)
hex (3 2 9 8 7 6 11 10) (80 5 1) simpleGrading (0.5 0.2 1)
hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (2 0.2 1)
hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (2 2 1)
hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (2 0.5 1)
hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (2 5 1)
);
Case 4: Mesh grading factor=0.8
blocks
(
hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (0.8 1.25 1)
hex (3 2 9 8 7 6 11 10) (80 5 1) simpleGrading (0.8 0.2 1)
hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (1.25 0.2 1)
hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (1.25 1.25 1)
hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (1.25 0.8 1)
hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (1.25 5 1)
);
Velocity Profiles:
From the above plots of the Velocity profile, it can be seen that better distribution of boundary layer separation is obtained for mesh grading factor of 0.2.
Also, the CFL number increase as the grading factor is decreased.
Conclusion:
To capture the proper flow conditions, a finer mesh is required. Especially at the boundaries to get the boundary layer separation.