Week 8 - Simulation of a backward facing step in OpenFOAM
In the challenge the flow to be simulated is incompressible laminar viscous flow, therefore icoFoam solver is used. Reynolds number for laminar flow is below 2300. The reynolds number for simulation of this flow is 500.
BlockMesh file:-
Case 1
The geometry is made by dividing it in 5 different blocks.
/*--------------------------------*- 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
(0.08 0 0)//1
(0.08 0.005 0)//2
(0 0.005 0)//3
(0.08 0.01 0)//4
(0 0.01 0)//5
(0.2 0.01 0)//6
(0.2 0.005 0)//7
(0.2 0 0)//8
(0.2 -0.01 0)//9
(0.08 -0.01 0)//10
(0 0 0.005)//11
(0.08 0 0.005)//12
(0.08 0.005 0.005)//13
(0 0.005 0.005)//14
(0.08 0.01 0.005)//15
(0 0.01 0.005)//16
(0.2 0.01 0.005)//17
(0.2 0.005 0.005)//18
(0.2 0 0.005)//19
(0.2 -0.01 0.005)//20
(0.08 -0.01 0.005)//21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 1 1)//b1
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 1 1)//b2
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (1 1 1)//b3
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (1 1 1)//b4
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (1 1 1)//b5
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type patch;
faces
(
(9 8 19 20)
(8 7 18 19)
(7 6 17 18)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(3 5 4 2)
(2 4 6 7)
(1 2 7 8)
(10 1 8 9)
(11 12 13 14)
(14 13 15 16)
(13 18 17 15)
(12 19 18 13)
(21 20 19 12)
);
}
noslipwalls
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
(21 12 1 10)
(0 1 12 11)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

Case 2
/*--------------------------------*- 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
(0.08 0 0)//1
(0.08 0.005 0)//2
(0 0.005 0)//3
(0.08 0.01 0)//4
(0 0.01 0)//5
(0.2 0.01 0)//6
(0.2 0.005 0)//7
(0.2 0 0)//8
(0.2 -0.01 0)//9
(0.08 -0.01 0)//10
(0 0 0.005)//11
(0.08 0 0.005)//12
(0.08 0.005 0.005)//13
(0 0.005 0.005)//14
(0.08 0.01 0.005)//15
(0 0.01 0.005)//16
(0.2 0.01 0.005)//17
(0.2 0.005 0.005)//18
(0.2 0 0.005)//19
(0.2 -0.01 0.005)//20
(0.08 -0.01 0.005)//21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (0.2 5 1)//b1
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.2 0.2 1)//b2
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (5 0.2 1)//b3
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (5 5 1)//b4
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (5 0.2 1)//b5
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type patch;
faces
(
(9 8 19 20)
(8 7 18 19)
(7 6 17 18)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(3 5 4 2)
(2 4 6 7)
(1 2 7 8)
(10 1 8 9)
(11 12 13 14)
(14 13 15 16)
(13 18 17 15)
(12 19 18 13)
(21 20 19 12)
);
}
noslipwalls
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
(21 12 1 10)
(0 1 12 11)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
The mesh grading is changed to 0.2 or 5 accordingly, in each block to make it fine near the wall and the step.

Pressure:-
Since the flow is incompressible kinematic pressure is used. And since pressure is not specified in the problem we set it zero as it will just compute the difference. The pressure condition are same for both cases.
/*--------------------------------*- 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;
}
frontAndBack
{
type empty;
}
noslipwalls
{
type zeroGradient;
}
}
// ************************************************************************* //
Velocity condition:-
The value of velocity calculated using the Reynolds number 500 is 0.05 m/s. The Velocity condition for both cases are same and are as follows.
/*--------------------------------*- 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.05 0 0);
}
outlet
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
noslipwalls
{
type noSlip;
}
}
// ************************************************************************* //
Transport Property:-
The property defined here is kinematic viscosity as fluid is incompressible.
/*--------------------------------*- 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] 1e-6;
// ************************************************************************* //
ControlDict:-
The time step was calculated by setting the courant number 0.5. `triangle t=(Co*trianglex)/U` from this timestep is 0.01. The endTime is set to 40 sec, as it is the time that the fluid would take to flow complete 10 times. For the second case the timestep is set to 0.001 as the `trianglex`is reduced.
/*--------------------------------*- 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 40;
deltaT 0.01;
writeControl timeStep;
writeInterval 500;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Output:-
Case 1

The velocity profile at 0.085m is attached below

Case 2

The velocity profile at 0.085m is attached below

Conclusion/Inference:-
1)It is observed that case 2 reaches steady state faster than case 1, as it finely meshed near the step where the initial disturbance/circulation occur.
2)The case 2 has better defined profile than the case 1, which can be seen in the diagram and in the graph.