Simulation of a backward facing step in OpenFOAM
Intoduction:
A flow in which density remain constant of an each individual fluid parcel is called incompressible flow.Reynolds Number provides a relationship between viscous forces and inertia forces where the high viscous forces will make fluid particle to move smoothly in a regular paths (in a organised way) is called laminar flow.
Backward facing step Geometry-Sudden Increase in diameter/height will causes the decrease in velocity,increase in pressure of the fluid.Fluid will recirculate/turbulence will appear near the sudden expansion (Due to the high reynold number at the sudden expansion where reynolds number depends on characterstic linear dimension and Kinetic energy of the fluid is converted to pressure not fully).
Simulation takes a time for being a steady state is said to be transient simulation.
In this project ,going to perform a incompressible-laminar-viscous flow transient simulation in a backward facing step geometry.
solver:

From the list ,choosen solver is icoFoam.
icoFoam is the solver for the incompressible-laminar transient flow.
icoFoam solver uses incompressible Navier-strokes equation uisng PISO (Pressure Implicit Splitting Operators) Algorithm
PISO Algorithm contains one predictor step and two corector steps.
Case Setup:
steps:
1.copying the cavity folder from `$`FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity to Desktop.
2.Edit the BLOCKMESHDICT file (for changing a geometry) present in the system directory.obtained file has a rectangular in shape whereas modified file contains a edited vertices and blocks.vertices and blocks are modified as per below geometry.

ConvertToMeters are changed from millimeter(mm) to meter (m) in Blockmeshdict file
name of the patches are changed accordingly in Blockmeshdict file.
simple grading present in the blocks subdictionary consisted by Blockmeshdict file.simple grading has been modified from 1 to 0.2 / 5 based on the definition last cell length divided by first cell length (0.2 is the grading factor away from defined origin/co-ordinate system and 5 is the grading factor near to defined origin/co-ordinate system)
3.new Patches has to be included in P file.
type of the outlet patch has modified from gradient to the uniform fixed value function in P file .
newly introduced patches has the type of Zero gradient(except outlet).
new patches has to be include the U file.
value of the inlet patch has changed from 0 m/s to 2 m/s
Reason:
if fluid velocity is 0 said to be static.if fluid velocity is less than 4 and greater than 0 then it is laminar based on the Reynolds Number.
noSlip type of patch is applied for the step,bottom,top patches because the fluid will stick at the walls
4.Delta T has modified from 0.0005 to 0.0001 and endtime has modified from 0.5 to 1 in the CONTROLDICT file.
Reason:
It is because courant Number depends on velocity(directly proprtional ) and timestep (Delta T is directly proprtional) and spacing of grid in numerical model (indirectly proportional).
where simplegrading feature in blockmesh leads to the smaller the size of the spacing the grid in the numerical model.Based upon the velocity time step has determined.
endtime modification is due to achieve steady state.
5.nu has modified from 1 to kinematic viscousity of air (1.608e-5 m2/s).
reason:
Understand the fluid behaviour.
6.running a blockMesh on the terminal
7.runnig a solver icoFoam using terminal
8.opened a paraview by typing paraFoam in the terminal.
i had view a solution using vtk controls for the different parameters.using save animation under the file option to save the animation videos.
Modified files:
1.Blockmeshdict File
/*--------------------------------*- C++ -*----------------------------------*
========= |
\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\ / O peration | Website: https://openfoam.org
\ / A nd | Version: 9
\/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0.01 0) //0
(0.08 0.01 0) //1
(0.08 0.015 0) //2
(0 0.015 0) //3
(0.08 0.02 0) //4
(0 0.02 0) //5
(0.2 0.02 0) //6
(0.2 0.015 0) //7
(0.2 0.01 0) //8
(0.2 0 0) //9
(0.08 0 0) //10
(0 0.01 0.01) //11
(0.08 0.01 0.01) //12
(0.08 0.015 0.01) //13
(0 0.015 0.01) //14
(0.08 0.02 0.01) //15
(0 0.02 0.01) //16
(0.2 0.02 0.01) //17
(0.2 0.015 0.01) //18
(0.2 0.01 0.01) //19
(0.2 0 0.01) //20
(0.08 0 0.01) //21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (1 1 1)
hex (3 2 4 5 14 13 15 16) (80 10 1) simpleGrading (1 1 1)
hex (2 7 6 4 13 18 17 15) (120 10 1) simpleGrading (1 1 1)
hex (1 8 7 2 12 19 18 13) (120 10 1) simpleGrading (1 1 1)
hex (10 9 8 1 21 20 19 12) (120 20 1) simpleGrading (1 1 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)
);
}
top
{
type wall;
faces
(
(4 5 16 15)
(4 15 17 6)
);
}
step
{
type wall;
faces
(
(1 10 21 12)
);
}
bottom
{
type wall;
faces
(
(0 1 12 11)
(9 20 21 10)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(2 3 5 4)
(2 4 6 7)
(1 2 7 8)
(1 8 9 10)
(11 12 13 14)
(13 15 16 14)
(13 18 17 15)
(12 19 18 13)
(12 21 20 19)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
2.ControlDict File
/*--------------------------------*- C++ -*----------------------------------*
========= |
\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\ / O peration | Website: https://openfoam.org
\ / A nd | Version: 9
\/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 1;
deltaT 0.0001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
3.Pressure File
/*--------------------------------*- C++ -*----------------------------------*
========= |
\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\ / O peration | Website: https://openfoam.org
\ / A nd | Version: 9
\/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
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;
}
top
{
type zeroGradient;
}
bottom
{
type zeroGradient;
}
step
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
4.Velocity File
/*--------------------------------*- C++ -*----------------------------------*
========= |
\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\ / O peration | Website: https://openfoam.org
\ / A nd | Version: 9
\/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
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 (2 0 0);
}
outlet
{
type zeroGradient;
}
top
{
type noSlip;
}
bottom
{
type noSlip;
}
step
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
5.BlockMeshDict File of refined mesh near walls
/*--------------------------------*- C++ -*----------------------------------*
========= |
\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\ / O peration | Website: https://openfoam.org
\ / A nd | Version: 9
\/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0.01 0) //0
(0.08 0.01 0) //1
(0.08 0.015 0) //2
(0 0.015 0) //3
(0.08 0.02 0) //4
(0 0.02 0) //5
(0.2 0.02 0) //6
(0.2 0.015 0) //7
(0.2 0.01 0) //8
(0.2 0 0) //9
(0.08 0 0) //10
(0 0.01 0.01) //11
(0.08 0.01 0.01) //12
(0.08 0.015 0.01) //13
(0 0.015 0.01) //14
(0.08 0.02 0.01) //15
(0 0.02 0.01) //16
(0.2 0.02 0.01) //17
(0.2 0.015 0.01) //18
(0.2 0.01 0.01) //19
(0.2 0 0.01) //20
(0.08 0 0.01) //21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (1 5 1)
hex (3 2 4 5 14 13 15 16) (80 10 1) simpleGrading (1 0.2 1)
hex (2 7 6 4 13 18 17 15) (120 10 1) simpleGrading (5 0.2 1)
hex (1 8 7 2 12 19 18 13) (120 10 1) simpleGrading (5 5 1)
hex (10 9 8 1 21 20 19 12) (120 20 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)
);
}
top
{
type wall;
faces
(
(4 5 16 15)
(4 15 17 6)
);
}
step
{
type wall;
faces
(
(1 10 21 12)
);
}
bottom
{
type wall;
faces
(
(0 1 12 11)
(9 20 21 10)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(2 3 5 4)
(2 4 6 7)
(1 2 7 8)
(1 8 9 10)
(11 12 13 14)
(13 15 16 14)
(13 18 17 15)
(12 19 18 13)
(12 21 20 19)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Plots:
Velocity with grading factor =1 at steady state

Velocity with grading factor =0.2 at steady state

velocity (grading factor -1) @ 0.1 timestep

velocity (grading factor-0.2) @ 0.1 timestep

Conclusion:
1.Simulated backward facing step for the pressure and velocity on without grading and grading factor of 0.2
I.changes in pressure can be observed with the help of animation.Link is provided below
https://www.youtube.com/watch?v=Tfgh7Cv4fLY
II.Changes in velocity can be observed with the help of animation.Link is provided below
III.changes in pressure(grading factor-0.2) can be observed with the help of animation.Link is provided below
iv.changes in velocity (grading factor-0.2) can be observed with the help of animation.Link is provided below
2.Due to grading factor 0.2, the mesh becomes finer near the walls where as the coarse away from the walls ,accuracy would be more at finer and less at coarse when compared to the results using mesh with grading factor 1 at unsteady state.As per plots it is similar because it is taken at steady state
3.Grading will helps to refine where we need much accuracy instead of that possible to refine mesh for whole geometry but it takes much time for computing compared to grading.