CFD simulation of backward facing step using openFOAM
Objective : Numerical simulation of backward facing step using openFOAM.
Geometry:
***Dimensions are in m
blockMeshDict file with grading factor 0.8
/*--------------------------------*- 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) //p0
(8 0 0) //p1
(8 0.5 0) //p2
(0 0.5 0) //p3
(8 1 0) //p4
(0 1 0) //p5
(20 1 0) //p6
(20 0.5 0) //p7
(20 0 0) //p8
(20 -1 0) //p9
(8 -1 0) //p10
(0 0 0.05) //p11
(8 0 0.05) //p12
(8 0.5 0.05) //p13
(0 0.5 0.05) //p14
(8 1 0.05) //p15
(0 1 0.05) //p16
(20 1 0.05) //p17
(20 0.5 0.05) //p18
(20 0 0.05) //p19
(20 -1 0.05) //p20
(8 -1 0.05) //p21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 1.8 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 0.8 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (4.8 0.8 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (4.8 1.8 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (4.8 4.8 1)
);
edges
(
);
boundary
(
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)
);
}
frontAndBack
{
type empty;
faces
(
(3 2 1 0)
(3 5 4 2)
(10 1 8 9)
(1 2 7 8)
(2 4 6 7)
(12 13 14 11)
(13 15 16 14)
(21 20 19 12)
(12 19 18 13)
(13 18 17 15)
);
}
NoSlipWall
{
type wall;
faces
(
(4 5 16 15)
(6 4 15 17)
(0 1 12 11)
(10 9 20 21)
(1 10 21 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict file with grading factor 0.5
/*--------------------------------*- 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) //p0
(8 0 0) //p1
(8 0.5 0) //p2
(0 0.5 0) //p3
(8 1 0) //p4
(0 1 0) //p5
(20 1 0) //p6
(20 0.5 0) //p7
(20 0 0) //p8
(20 -1 0) //p9
(8 -1 0) //p10
(0 0 0.05) //p11
(8 0 0.05) //p12
(8 0.5 0.05) //p13
(0 0.5 0.05) //p14
(8 1 0.05) //p15
(0 1 0.05) //p16
(20 1 0.05) //p17
(20 0.5 0.05) //p18
(20 0 0.05) //p19
(20 -1 0.05) //p20
(8 -1 0.05) //p21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 1.5 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 0.5 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (4.5 0.5 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (4.5 1.5 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (4.5 4.5 1)
);
edges
(
);
boundary
(
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)
);
}
frontAndBack
{
type empty;
faces
(
(3 2 1 0)
(3 5 4 2)
(10 1 8 9)
(1 2 7 8)
(2 4 6 7)
(12 13 14 11)
(13 15 16 14)
(21 20 19 12)
(12 19 18 13)
(13 18 17 15)
);
}
NoSlipWall
{
type wall;
faces
(
(4 5 16 15)
(6 4 15 17)
(0 1 12 11)
(10 9 20 21)
(1 10 21 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict file with 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 0.01;
vertices
(
(0 0 0) //p0
(8 0 0) //p1
(8 0.5 0) //p2
(0 0.5 0) //p3
(8 1 0) //p4
(0 1 0) //p5
(20 1 0) //p6
(20 0.5 0) //p7
(20 0 0) //p8
(20 -1 0) //p9
(8 -1 0) //p10
(0 0 0.05) //p11
(8 0 0.05) //p12
(8 0.5 0.05) //p13
(0 0.5 0.05) //p14
(8 1 0.05) //p15
(0 1 0.05) //p16
(20 1 0.05) //p17
(20 0.5 0.05) //p18
(20 0 0.05) //p19
(20 -1 0.05) //p20
(8 -1 0.05) //p21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 1.2 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 0.2 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (4.2 0.2 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (4.2 1.2 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (4.2 4.2 1)
);
edges
(
);
boundary
(
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)
);
}
frontAndBack
{
type empty;
faces
(
(3 2 1 0)
(3 5 4 2)
(10 1 8 9)
(1 2 7 8)
(2 4 6 7)
(12 13 14 11)
(13 15 16 14)
(21 20 19 12)
(12 19 18 13)
(13 18 17 15)
);
}
NoSlipWall
{
type wall;
faces
(
(4 5 16 15)
(6 4 15 17)
(0 1 12 11)
(10 9 20 21)
(1 10 21 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
The boundary conditions and controlDict files shown below remains same for all the CFD simulations carried out with different mesh refinements.
Boundary conditions (Velocity and Pressure):
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
controlDict file:
/*--------------------------------*- 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.5;
deltaT 0.00001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
The transient solver for incompressible flow \"icoFoam\" is used and simulation is run for 0.5 seconds. The solution obtained from simulation is visualized using the paraview software and results are briefly shown below.
Results:
Mesh with grading factor 0.8:
Velocity distribution:
Line plot for velocity:
Mesh with grading factor 0.5:
Velocity distribution:
Line plot for velocity:
Mesh with grading factor 0.2:
Velocity distibution:
Line plot for velocity:
Conclusion:
- Development of boundary layer flow is clearly seen and diffusion of velocity is observed across the backward facing step.
- Creation of recirculation zones are also observed to form near to the backward facing step.
- Mesh refinements through grid grading improves the simulation accuracy and is strongly recommended for all CFD simulations.