Week 8 - Simulation of a backward facing step in OpenFOAM
Date: - 21-02-2021
SIMULATION OF A BACKWARD FACING STEP IN OPENFOAM
Choosing of solver: -
Here we deal with incompressible laminar viscous flow. So base on that I took ‘icoform’ solver in open form to simulate given problem because it is very suitable solver for incompressible laminar Newtonian fluids.
Steps to follow to simulate using open FOAM:-
- After choosing the suitable solver we copy the solver folder to openFoam run folder which is used to perform simulations.
- Mainly apart from solver folder wee need three other folders like ‘case’ , ‘system’ and ‘0’ to setup all inputs. We can get suitable tutorial from openFoam then we copy that folder to run folder. Here we chose cavity folder in icofoam folder which is in incompressible folder of tutorials.
- First we have to make block mesh by editing the blockmeshdict.
BlockMesh creation: -
- When we open blockmeshdict file first we have to give convert to meters
- So here I use everything in meters so I gave 1.
- Then I have to write vertices in proper order so that we can use them in future .

Fig (1) :- we can see the order of vertices
- Here we require multiple blocks (5) to create balckward facing step and we have to mention order for each lock in serial manor link below

Fig (2):- order of numbering of block
- Here we give number of nodes along x and y and z axis as 200 and 20 and 1.
- Here majorly we deal with x and y axis effect and effect of z axis is very small.
- Simple grading gives you increase the mesh elements or coarser mesh at particular place in domain.
- Then boundary conditions place very major role in next further steps, so giving boundary conditions correctly is very important.
- Here I gave inlet with type wall and I mentions surfaces in right hand thumb rule order.

Fig (3) :- Inlet and outlet with right handed system representation
- Like inlet, I gave outlet and upper wall and lower wall types as walls and I mentioned faces in right-handed coordinate system. For front and back I gave as empty type.
- Now we can use blockMesh command to run block mesh and we obtain desired block mesh of backward facing step.
Solving:
- After getting block mesh we have to give initial values
- So first we give enter into the ‘0’ folder and enter into the ‘U’ file
- So we have to give initial velocity and I gave 1 m/sec at inlet
- There is no changes require in other boundary condition’s initial values we took default types in files.
- In constant folder we take transport properties and I took default values.
- Then we have to change time step values and total time for simulation.
- This above modification we made in controldict which is in system folder.
- It is very important to maintain CFL number <1 or simply to obtain stable solution.
- Then we run the simulation using solver name as a command then we obtain flow filed values for each time step.
- By using paraFoam we can visualize the flow filed variable changes with respect to time changes.
GRADING FACTOR :-
- As I mentioned above at simple grading we give grading factor values
- By giving 1 for all 3 directions we can obtain desired velocity profile at x=0.085m for GF=1.
- By giving GF=0.2 values such a way that we should get final mesh near the walls.so after that we obtain velocity profile at x=0.085 m.
Results for GF=1: -

Fig(4):- Front view of block mesh

Fig (5): - velocity couture after attaining steady state

Fig(6):- velocity profile at x=0.085m along y-direction at steady state
Results for GF=0.2: -

Fig(7):- Isometric and front view of block mesh

Fig (8): - velocity couture after attaining steady state

Fig (9):- velocity profile at x=0.085m along y-direction at steady state
Comparison between velocity profiles and simulations for GF 1 and 0.2 :
- If we consider case1 and case 2 for GF1 and GF0.2 then following are the observations from above graphs.
- Regards number of control volumes in case 2 we have more control volumes than in case1.
- Regards velocity profiles both profiles look same but if you compare closely more accurate solution (in decimals) we can obtain case 2 compare to case1 .
- Regards computational time case 2 took more time compare to case 1.
Modified BlockMeshDict file for GF=1: -
/*--------------------------------*- 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.08 0.01 0)
(0 0.01 0)
(0.2 0.01 0)
(0.2 0.005 0)
(0.2 0 0)
(0.2 -0.01 0)
(0.08 -0.01 0)
(0 0 0.01)
(0.08 0 0.01)
(0.08 0.005 0.01)
(0 0.005 0.01)
(0.08 0.01 0.01)
(0 0.01 0.01)
(0.2 0.01 0.01)
(0.2 0.005 0.01)
(0.2 0 0.01)
(0.2 -0.01 0.01)
(0.08 -0.01 0.01)
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 20 1) simpleGrading (1 1 1)
hex (3 2 4 5 14 13 15 16) (200 20 1) simpleGrading (1 1 1)
hex (2 7 6 4 13 18 17 15) (200 20 1) simpleGrading (1 1 1)
hex (1 8 7 2 12 19 18 13) (200 20 1) simpleGrading (1 1 1)
hex (10 9 8 1 21 20 19 12) (200 20 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type wall;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type wall;
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)
(1 2 7 8)
(2 4 6 7)
(10 1 8 9)
(16 14 13 15)
(14 11 12 13)
(15 13 18 17)
(13 12 19 18)
(12 21 20 19)
);
}
upperWall
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
);
}
lowerWall
{
type wall;
faces
(
(1 10 21 12)
(0 1 12 11)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Modified BlockMeshDict file for GF=0.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.08 0 0)
(0.08 0.005 0)
(0 0.005 0)
(0.08 0.01 0)
(0 0.01 0)
(0.2 0.01 0)
(0.2 0.005 0)
(0.2 0 0)
(0.2 -0.01 0)
(0.08 -0.01 0)
(0 0 0.01)
(0.08 0 0.01)
(0.08 0.005 0.01)
(0 0.005 0.01)
(0.08 0.01 0.01)
(0 0.01 0.01)
(0.2 0.01 0.01)
(0.2 0.005 0.01)
(0.2 0 0.01)
(0.2 -0.01 0.01)
(0.08 -0.01 0.01)
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 20 1) simpleGrading (0.2 5 1)
hex (3 2 4 5 14 13 15 16) (200 20 1) simpleGrading (0.2 0.2 1)
hex (2 7 6 4 13 18 17 15) (200 20 1) simpleGrading (5 0.2 1)
hex (1 8 7 2 12 19 18 13) (200 20 1) simpleGrading (5 5 1)
hex (10 9 8 1 21 20 19 12) (200 20 1) simpleGrading (5 5 1));
edges
(
);
boundary
(
inlet
{
type wall;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type wall;
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)
(1 2 7 8)
(2 4 6 7)
(10 1 8 9)
(16 14 13 15)
(14 11 12 13)
(15 13 18 17)
(13 12 19 18)
(12 21 20 19)
);
}
upperWall
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
);
}
lowerWall
{
type wall;
faces
(
(1 10 21 12)
(0 1 12 11)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Modified ‘U’ file: -
/*--------------------------------*- 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 (1 0 0);
}
outlet
{
type zeroGradient;
}
upperWall
{
type noSlip;
}
lowerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Modified Controldic file:-
/*--------------------------------*- 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 0.5;
deltaT 1e-5;
writeControl timeStep;
writeInterval 10000;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //