Simulation of an incompressible fluid flow through a backward facing step in OpenFoam
OBJECTIVE:
- To simulate an incompressible flow through a backward facing step using icoFoam solver in OpenFoam.
- To study the changes in the velocity profile as a function of mesh grading factors.
- To study the velocity contours for different grading factors.
Domain:
The flow will be simulated through the above mentioned domain with the specified dimensions. To construct the above domain, it has to build by a set of blocks.
BlockMesh:
The domain is to be built using 5 blocks. Each block should be represented by the correct orientation of vertices. Along with the blocks, the number of mesh points along each axis and the grading factor along each axis is to be specified. The script for generating the blockMesh is as follows.
/*--------------------------------*- 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.001;
vertices
(
(0 0 0) //V0
(80 0 0) //V1
(80 5 0) //V2
(0 5 0) //V3
(80 10 0) //V4
(0 10 0) //V5
(200 10 0) //V6
(200 5 0) //V7
(200 0 0) //V8
(200 -10 0) //V9
(80 -10 0) //V10
(0 0 1) //V11
(80 0 1) //V12
(80 5 1) //V13
(0 5 1) //V14
(80 10 1) //V15
(0 10 1) //V16
(200 10 1) //V17
(200 5 1) //V18
(200 0 1) //V19
(200 -10 1) //V20
(80 -10 1) //V21
);
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
(
inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type patch;
faces
(
(6 17 18 7)
(7 18 19 8)
(8 19 20 9)
);
}
upperWall
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
);
}
lowerWall
{
type wall;
faces
(
(0 1 12 11)
(10 21 12 1)
(10 9 20 21)
);
}
frontAndBack
{
type empty;
faces
(
(3 5 4 2)
(3 2 1 0)
(4 6 7 2)
(2 7 8 1)
(1 8 9 10)
(11 12 13 14)
(14 13 15 16)
(13 18 17 15)
(12 19 18 13)
(21 20 19 12)
);
}
);
// ************************************************************************* //
The boundaries are also specified in the blockmesh generating script itself. It should also be in the correct cyclic order. If a face is represented from outside the block, the order of vertices is in counter clockwise direction. If it is from inside, then the order is clockwise.
Initial conditions:
The key parameters to be studied in the project is pressure and velocity. So the initial profile of the two parameters are to be specified correctly in order to reach convergence as early as possible.
Initial profile of 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 volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
upperWall
{
type zeroGradient;
}
lowerWall
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Initial profile of Velocity:
/*--------------------------------*- 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;
}
upperWall
{
type noSlip;
}
lowerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
The velocity along x-axis is given as 1 m/s. Then the parameters like timestep size, total time of flow, type of solver are specified in the controlDict file. The solver to be used is icoFoam. The timestep size is specified as 0.00001 for a low courant number in order to prevent the solution from blowing up.
Script of 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;
// ************************************************************************* //
MESH:
Grading factor 0.2 :
Grading factor 0.5:
Grading factor 0.8:
Observation on the mesh:
As expected, the mesh with grading factor 0.2 in all walls is finer when compared to the other two cases. The mesh with grading factor 0.8 seems almost like a mesh with uniform grading factor.
VELOCITY PROFILE AT X = 0.085 m (5 mm right side of the step region) :
Grading factor 0.2:
Grading factor 0.5:
Grading factor 0.8:
INFERENCE FROM THE PLOTS:
The velocity profile at x = 0.085 m is plotted above. It is plotted for three different grading factors. But the profiles look almost similar except a very slight variation at the peak velocities. The peak velocity when the grading factor is 0.2 is observed at 7 mm below the upper walls. On the other hand, for grading factor = 0.5, it\'s 6.4 mm whereas for grading factor = 0.8, it\'s 6 mm. Below the step region,i.e at y=10 mm, there is a sudden decrease in the velocity
VELOCITY CONTOUR FOR DIFFERENT GRADING FACTORS:
Grading factor 0.2:
Grading factor 0.5:
Grading factor 0.8:
INFERENCE FROM THE VELOCITY CONTOURS:
In all the three contours, it can be clearly noted that the velocity is high from the inlet area to the step region and also having an almost constant velocity in that region. But the after the step region, the fluid gets expanded suddenly and its velocity is reduced. And it reaches the outlet with an uniform velocity. When the grading factor is 0.5, the velocity after the step region till the outlet area seems to be a bit high.
CONCLUSION:
When the given domain is simulated for an incompressible fluid flow with icoFoam solver, the plots with no variations denote that this setup is grid independent to a fair extent. This can also be justified by the velocity contour plots.