Simulation of fluid flow in a backward facing step geometry using OpenFOAM
Objective: The main objective of this project is to simulate flow through a backward-facing step profile using OpenFOAM and to compare the velocity magnitude contour for different grading factors.
Geometry:
Simulations constraints:
Velocity magnitude contour is measured along Y-axis at the following locations:
- Line 1: (0.079, 0, 0.005), (0.079, 0.01, 0.005)
- Line 1: (0.085, -0.01, 0.005), (0.085, 0.01, 0.005)
No. of cells along X direction (longer dimension) = 300 (120 for blocks 1&2, 180 for blocks 3,4&5)
No. of cells in Y direction = 30 (for blocks 1,2,3&4)
No. of cells in Y direction = 25 (for block 6)
No. of cells in Y direction = 1 (for all blocks)
Kinematic viscosity `nu =8.532*10^-7` (water at `27^o C`)
Inlet velocity = `0.2 ms^-2`
Simulation end time = 2.2 seconds
Delta T (timestep) = 0.0001 seconds
Inbuilt tutorial - Cavity under incompressible flow tutorials is modified according to the setup and geometry discussed above,
blockMesh is used to generate the mesh for the geometry using blockMeshDict file
decomposePar is used to divide the geometry into 4 equal parts to run the simulation in the parallel mode which greatly reduces the simulation time.
icoFoam solver is used to simulating the flow,
reconstructPar is used to reconstruct the solution into 1 single part,
paraFoam is used for post-processing.
Geometry coordinate layout (used as reference):


Simulation setup files:
blockMeshDict:
/*--------------------------------*- 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 0.01;
vertices
(
(0 0 0) //vertice 0
(8 0 0) //vertice 1
(8 0.5 0) //vertice 2
(0 0.5 0) //vertice 3
(8 1 0) //vertice 4
(0 1 0) //vertice 5
(20 1 0) //vertice 6
(20 0.5 0) //vertice 7
(20 0 0) //vertice 8
(20 -1 0) //vertice 9
(8 -1 0) //vertice 10
(0 0 1) //vertice 11
(8 0 1) //vertice 12
(8 0.5 1) //vertice 13
(0 0.5 1) //vertice 14
(8 1 1) //vertice 15
(0 1 1) //vertice 16
(20 1 1) //vertice 17
(20 0.5 1) //vertice 18
(20 0 1) //vertice 19
(20 -1 1) //vertice 20
(8 -1 1) //vertice 21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (120 30 1) simpleGrading (1 5 1) //block 1
hex (3 2 4 5 14 13 15 16) (120 30 1) simpleGrading (1 0.2 1) //block 2
hex (2 7 6 4 13 18 17 15) (180 30 1) simpleGrading (1 0.2 1) //block 3
hex (1 8 7 2 12 19 18 13) (180 30 1) simpleGrading (1 5 1) //block 4
hex (10 9 8 1 21 20 19 12) (180 25 1) simpleGrading (1 5 1) //block 5
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 11 14 3) //block 1
(3 14 16 5) //block 2
);
}
outlet
{
type patch;
faces
(
(9 8 19 20) //block 5
(8 7 18 19) //block 4
(7 6 17 18) //block 3
);
}
front
{
type empty;
faces
(
(11 12 13 14) //face 1
(14 13 15 16) //face 2
(13 18 17 15) //face 3
(12 19 18 13) //face 4
(21 20 19 12) //face 5
);
}
back
{
type empty;
faces
(
(0 3 2 1) //face 1
(3 5 4 2) //face 2
(2 4 6 7) //face 3
(1 2 7 8)//face 4
(10 1 8 9) //face 5
);
}
topandbottom
{
type wall;
faces
(
(5 16 15 4) //top of block 2
(4 15 17 6) // top of block 3
(0 1 12 11) // bottom of block 1
(1 10 21 12) // bottom left of block 5
(10 9 20 21) //bottom of block 5
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
controlDict:
/*--------------------------------*- 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;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 2.2;
deltaT 1e-4;
writeControl timeStep;
writeInterval 25;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
decomposeParDict:
/*--------------------------------*- 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;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method simple;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
distributed no;
roots ( );
// ************************************************************************* //
transportProperties:
/*--------------------------------*- 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;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.532e-7; //water at 27C
// ************************************************************************* //
Initial conditions:
p:
/*--------------------------------*- 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 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;
}
}
// ************************************************************************* //
U:
/*--------------------------------*- 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 volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.2 0 0);
}
outlet
{
type zeroGradient;
}
front
{
type empty;
}
back
{
type empty;
}
topandbottom
{
type noSlip;
}
}
// ************************************************************************* //
Results:
Simple grading = 0.2 & 5:

Mesh:


Simple grading = 0.5 & 2:

Mesh:


Simple grading = 0.8 & 1.25:

Mesh:


Conclusion:
On observing the fluid flow animation and velocity magnitude contour for every grading factor, it can be concluded as a lower grading factor increases the accuracy of the solution and decreases system instability but the difference in results are not very large so to achieve respectable accuracy and also decrease computational power requirement, a medium grading factor can be used.