Week 8 ::: Flow over a backward face step using openfoam
1.Introduction :
Studying the flow behaviour using openfoam for cosidered geometry
P and U varies with the geometry.
Simulation done for coarsr and finer mesh.

Here we considered the geometry along x =2m and along y = 0.2m.
2. Objective :
1. Simulation of fluid flow for all grading factors.
2. U plots for all the simulations.
3. Velocity plot at 0.45m.
3. Steps in opnefoam :
- Define the problem statement.
- Choode the best solver for the statement.
- Copy the files into the run environment.
- Modify geometry if required , using blockMesh (openfoam utility).
- Check all initial and boundary conditions.
- Run the solver.
- Post-processing the results using paraView.
4. Here considered the incompressible , newtonian fluid, laminar flow, single phase , isothermal , Transient flow.
Transient :: Velocity of a fluid particle changes with both space and time.
Incompressible :: density is constant throughout the flow.
Laminar flow :: High Momentum diffusion anf low momentum convection.
Newtonian flow :: Follows Newton's law of viscosity.
Single phase :: Only on type of fluid.
Isothermal :: No need of energy equation to solve.
icoFoam is the solver for the above assumptions.
Solves using PISO Algorithm.
5. tutorials in openFoam ::
In openFoam , we have a cases for all the solvers , copy the tutorials into the run environment and execute the case.
Here we consider the case , Tutorials -> incompressible -> icoFoam -> cavity.
6. Geometry creation :

Here we created the geometry using blockMeshDict file (opnefoam utility).
Specifications :::
1. Number of cells along x - direction -> $xcells = 200.
2. Number of cells along y - direction -> $ycells = 20.
3. Number of cells along z - direction -> $zcells = 1.
4. Mesh grading factor = 1,0.2.
BlockMeshDict File for grading factor :: 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 0.1;
vertices
(
(0 0 0) // 0
(6 0 0) // 1
(6 2 0) // 2
(0 2 0) // 3
(20 2 0) // 4
(20 0 0) // 5
(20 -2 0) // 6
(6 -2 0) // 7
(0 0 .1) // 8
(6 0 .1) // 9
(6 2 .1) // 10
(0 2 .1) // 11
(20 2 .1) // 12
(20 0 .1) // 13
(20 -2 .1) // 14
(6 -2 .1) // 15
);
blocks
(
hex (0 1 2 3 8 9 10 11) (60 10 1)simpleGrading (1 1 1)
hex (1 5 4 2 9 13 12 10) (140 10 1)simpleGrading (1 1 1)
hex (7 6 5 1 15 14 13 9) (140 10 1)simpleGrading (1 1 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 3 11 8)
);
}
Outlet
{
type patch;
faces
(
(6 14 13 5)
(5 13 12 4)
);
}
fixedWalls
{
type wall;
faces
(
(0 8 9 1)
(3 2 10 11)
(2 4 12 10)
(15 14 6 7)
(15 7 1 9)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 2 3)
(1 5 4 2)
(7 6 5 1)
(8 11 10 9)
(9 10 12 13)
(15 9 13 14)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
convertToMeters = 0.01 -> conerts mm dimensions into meters.
vertices -> vertices for all the blocks of the geometry.
boundary -> defining the type of the boundary.
mergePatchPairs -> Connect the interface boundaries of the blocks of different grading factor.
Type of boundaries :::
patch
wall
symmetry
periodic
wedge
cyclic
Empty.
BlockMeshDict File for grading factor :: 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 0.1;
vertices
(
(0 0 0) // 0
(6 0 0) // 1
(6 2 0) // 2
(0 2 0) // 3
(20 2 0) // 4
(20 0 0) // 5
(20 -2 0) // 6
(6 -2 0) // 7
(0 0 .1) // 8
(6 0 .1) // 9
(6 2 .1) // 10
(0 2 .1) // 11
(20 2 .1) // 12
(20 0 .1) // 13
(20 -2 .1) // 14
(6 -2 .1) // 15
);
blocks
(
hex (0 1 2 3 8 9 10 11) (60 10 1)
simpleGrading
(
// x-direction grading
(
(1 1 0.2)
)
// y-direction grading
(
(0.5 0.5 5)
(0.5 0.5 0.2)
)
// z-direction grading no-expansion
1
)
hex (1 5 4 2 9 13 12 10) (140 10 1)
simpleGrading
(
(
(1 1 5)
)
// y-direction grading
(
(0.5 0.5 5)
(0.5 0.5 0.2)
)
// z-direction grading
1
)
hex (7 6 5 1 15 14 13 9) (140 10 1)
simpleGrading
(
(
(1 1 5)
)
// y-direction grading
(
(0.5 0.5 5)
(0.5 0.5 0.2)
)
// z-direction grading
1
)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 3 11 8)
);
}
Outlet
{
type patch;
faces
(
(6 14 13 5)
(5 13 12 4)
);
}
fixedWalls
{
type wall;
faces
(
(0 8 9 1)
(3 2 10 11)
(2 4 12 10)
(15 14 6 7)
(15 7 1 9)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 2 3)
(1 5 4 2)
(7 6 5 1)
(8 11 10 9)
(9 10 12 13)
(15 9 13 14)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
ControlDict 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 .5s
;
deltaT 0.001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Controls of the numerical solution , time controls.
fvSchemes 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
Discretization schemes for all the terms in the conservation equations.
fvSolution 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 fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.05;
}
pFinal
{
$p;
relTol 0;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //
This file contains , type of solver and type of schems used.
Initial conditions :::
P (pressure conditions) :::
/*--------------------------------*- 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
{
Outlet
{
type fixedValue;
value uniform 0;
}
Inlet
{
type zeroGradient;
}
fixedWalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
U (Velocity conditions) :::
/*--------------------------------*- 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); // Dirichilet Boundary condition
}
Outlet
{
type zeroGradient; // Neumann Boundary condition
}
fixedWalls
{
type noSlip;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
After creating the mesh using blockMesh utility , can observe the mesh genereted in constant-> polymesh folder.
checkMesh -> command for whether the mesh created is correct or not.
S.I Units ::: (7)

dimensions -> [ M m s k cd mol A ].
Steps for the execution Process ::





Velocity plot for grading gactor 1 ::

Velocity plot for grading factor 0.2 ::

Velocity plot for grading factor 0.2 at x = 0.6m.

Velocity profile at grading factor at x=0.6m.

Ca observe from the plots , accuracy of results increases.
Streamlines of the fluid flow for this case ::


Observed the vortex occurance.
velocity for grading factor 1.

Velocity for grading factor 0.2.

Using glyph property in parafoam :::
