Week 8 - Simulation of a backward facing step in OpenFOAM
OBJECTIVE: To simulate an incompressible-laminar-viscous flow through the backwards-facing step geometry.
Case 1 - Simulate the flow without using any grading factor (i.e., GF = 1)
Case 2 - Simulate the flow with a grading factor of 0.2. The cells should be finer near the walls (including the step wall).
Simulation Type: Transient
Type of Flow: Incompressible Laminar Viscous Flow
Grading Factor: (Size of the Last cell) / (Size of the First cell)

CODE:
1. Without any Grading Factor
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0.08 0 0)
(0.08 0.005 0)
(0 0.005 0) //*//
(0 0 0.04)
(0.08 0 0.04)
(0.08 0.005 0.04)
(0 0.005 0.04) //Block1 completed//
(0.08 0.01 0)//Block2 start//
(0 0.01 0)
(0.08 0.01 0.04)
(0 0.01 0.04)//Block2 completed
(0.20 0.005 0) //Block3 started
(0.20 0.01 0)
(0.20 0.005 0.04)
(0.20 0.01 0.04)//Block 3 completed
(0.20 0 0) //Block4 started
(0.20 0 0.04)
(0.08 -0.01 0) //Block5 started
(0.20 -0.01 0)
(0.08 -0.01 0.04)
(0.20 -0.01 0.04)//Block 5 completed
);
blocks
(
hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (1 1 1)
hex (3 2 8 9 7 6 10 11) (80 5 1) simpleGrading (1 1 1)
hex (2 12 13 8 6 14 15 10) (120 5 1) simpleGrading (1 1 1)
hex (1 16 12 2 5 17 14 6 ) (120 5 1) simpleGrading (1 1 1)
hex (18 19 16 1 20 21 17 5 ) (120 10 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
(3 7 11 9)
);
}
outlet
{
type patch;
faces
(
(12 13 15 14)
(16 12 14 17)
(19 16 17 21)
);
}
fixedWalls
{
type wall;
faces
(
(8 9 11 10)
(13 8 10 15)
(0 1 5 4)
(18 19 21 20)
(1 18 20 5)
);
}
frontAndBack
{
type empty;
faces
(
(3 2 1 0)
(9 8 2 3)
(2 8 13 12)
(1 2 12 16)
(18 1 16 19)
(4 5 6 7)
(7 6 10 11)
(20 21 17 5)
(5 17 14 6)
(6 14 15 10)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
2. Code With Grading Factor
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0.08 0 0)
(0.08 0.005 0)
(0 0.005 0) //*//
(0 0 0.04)
(0.08 0 0.04)
(0.08 0.005 0.04)
(0 0.005 0.04) //Block1 completed//
(0.08 0.01 0)//Block2 start//
(0 0.01 0)
(0.08 0.01 0.04)
(0 0.01 0.04)//Block2 completed
(0.20 0.005 0) //Block3 started
(0.20 0.01 0)
(0.20 0.005 0.04)
(0.20 0.01 0.04)//Block 3 completed
(0.20 0 0) //Block4 started
(0.20 0 0.04)
(0.08 -0.01 0) //Block5 started
(0.20 -0.01 0)
(0.08 -0.01 0.04)
(0.20 -0.01 0.04)//Block 5 completed
);
blocks
(
hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (1 2 1)
hex (3 2 8 9 7 6 10 11) (80 5 1) simpleGrading (1 0.5 1)
hex (2 12 13 8 6 14 15 10) (120 5 1) simpleGrading (2 0.5 1)
hex (1 16 12 2 5 17 14 6 ) (120 5 1) simpleGrading (2 2 1)
hex (18 19 16 1 20 21 17 5 ) (120 10 1) simpleGrading (2 2 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
(3 7 11 9)
);
}
outlet
{
type patch;
faces
(
(12 13 15 14)
(16 12 14 17)
(19 16 17 21)
);
}
fixedWalls
{
type wall;
faces
(
(8 9 11 10)
(13 8 10 15)
(0 1 5 4)
(18 19 21 20)
(1 18 20 5)
);
}
frontAndBack
{
type empty;
faces
(
(3 2 1 0)
(9 8 2 3)
(2 8 13 12)
(1 2 12 16)
(18 1 16 19)
(4 5 6 7)
(7 6 10 11)
(20 21 17 5)
(5 17 14 6)
(6 14 15 10)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
RESULTS
1. Block Mesh without grading
2. Block Mesh with grading

3. Velocity profile without grading

4. Velocity profile with grading

5. Pressure profile without grading

6. Pressure profile with grading
7. Velocity vs Domain Length without grading

8. Velocity vs Domain Length with grading

CONCLUSION
Seeing the above results it can be concluded that making the mesh finer makes the results more accurate. However, the simulation time also increases with the refinement of the mess.