Simulating flow through Backward Facing Step using IcoFoam solver with different Grading Factor for mesh
Aim: To simulate the flow through a backward facing step using icoFoam solver
Objective:
- To create create the geometry as given and then develop mesh for that
- Use different scale factor to refine mesh near the walls
- Solve the flow through the domain using icoFoam solver to obtain results
- Compare velocity profile generated for different scaling factor
Problem Specification:
The dimensions of the figure above shown are in meters. Using blockMeshDict file present in sytem subdirectory of the case directory, the geometry as shown above is generated.
IcoFoam solver is used to simulate the flow through the geometry. IcoFoam is a transient solver which is used to solve incompressible flows. The equations used by the solver are:
Continuity Equation-
`nabla.u=0`
Momentum Equation-
`(delu)/(delt)+nabla.(uoxu)-nabla.(nugradu)=-gradp`
where u is velocity, p is kinematic pressure(pressure/density) and `nu` is kinematic viscosity
Boundary Conditions:
At Inlet:
`u_x=1 ms^-1`
At Oulet:
`p=0 m^2s^-2`
At Walls:
`u_x=u_y=0` that is at no-slip condition
Code for U:
/*--------------------------------*- 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;
}
FixedWalls
{
type noSlip;
}
FrontAndBack
{
type empty;
}
}
// ************************************************************************* //
Code for p:
/*--------------------------------*- 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 $internalField;
}
FixedWalls
{
type zeroGradient;
}
FrontandBack
{
type empty;
}
}
// ************************************************************************* //
BlockMeshDict code for 0.2 grading factor:
/*--------------------------------*- 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.01;
vertices
(
(0 0 0) // Vertex 0
(8 0 0) // 1
(8 0.5 0) // 2
(0 0.5 0) // 3
(0 1 0) // 4
(8 1 0) // 5
(20 1 0) // 6
(20 0.5 0) // 7
(20 0 0) // 8
(20 -1 0) // 9
(8 -1 0) // 10
(0 0 0.1) // 11
(8 0 0.1) // 12
(8 0.5 0.1) // 13
(0 0.5 0.1) // 14
(0 1 0.1) // 15
(8 1 0.1) // 16
(20 1 0.1) // 17
(20 0.5 0.1) // 18
(20 0 0.1) // 19
(20 -1 0.1) // 20
(8 -1 0.1) // 21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (1 5 1)
hex (3 2 5 4 14 13 16 15) (80 10 1) simpleGrading (1 0.2 1)
hex (2 7 6 5 13 18 17 16) (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 10 1) simpleGrading (5 5 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 15 4)
);
}
Outlet
{
type patch;
faces
(
(8 19 20 9)
(7 18 19 8)
(6 17 18 7)
);
}
FixedWalls
{
type wall;
faces
(
(16 5 4 15)
(17 6 5 16)
(0 1 12 11)
(10 9 20 21)
(1 12 21 10)
);
}
FrontandBack
{
type empty;
faces
(
(0 3 2 1)
(3 4 5 2)
(2 5 6 7)
(1 2 7 8)
(10 1 8 9)
(12 13 14 11)
(13 16 15 14)
(18 17 16 13)
(19 18 13 12)
(20 19 12 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
BlockMeshDict code for grading factor 0.5
/*--------------------------------*- 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.01;
vertices
(
(0 0 0) // Vertex 0
(8 0 0) // 1
(8 0.5 0) // 2
(0 0.5 0) // 3
(0 1 0) // 4
(8 1 0) // 5
(20 1 0) // 6
(20 0.5 0) // 7
(20 0 0) // 8
(20 -1 0) // 9
(8 -1 0) // 10
(0 0 0.1) // 11
(8 0 0.1) // 12
(8 0.5 0.1) // 13
(0 0.5 0.1) // 14
(0 1 0.1) // 15
(8 1 0.1) // 16
(20 1 0.1) // 17
(20 0.5 0.1) // 18
(20 0 0.1) // 19
(20 -1 0.1) // 20
(8 -1 0.1) // 21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (1 2 1)
hex (3 2 5 4 14 13 16 15) (80 10 1) simpleGrading (1 0.5 1)
hex (2 7 6 5 13 18 17 16) (120 10 1) simpleGrading (2 0.5 1)
hex (1 8 7 2 12 19 18 13) (120 10 1) simpleGrading (2 2 1)
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (2 2 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 15 4)
);
}
Outlet
{
type patch;
faces
(
(8 19 20 9)
(7 18 19 8)
(6 17 18 7)
);
}
FixedWalls
{
type wall;
faces
(
(16 5 4 15)
(17 6 5 16)
(0 1 12 11)
(10 9 20 21)
(1 12 21 10)
);
}
FrontandBack
{
type empty;
faces
(
(0 3 2 1)
(3 4 5 2)
(2 5 6 7)
(1 2 7 8)
(10 1 8 9)
(12 13 14 11)
(13 16 15 14)
(18 17 16 13)
(19 18 13 12)
(20 19 12 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
BlockMeshDict code of 0.8 grading factor
/*--------------------------------*- 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.01;
vertices
(
(0 0 0) // Vertex 0
(8 0 0) // 1
(8 0.5 0) // 2
(0 0.5 0) // 3
(0 1 0) // 4
(8 1 0) // 5
(20 1 0) // 6
(20 0.5 0) // 7
(20 0 0) // 8
(20 -1 0) // 9
(8 -1 0) // 10
(0 0 0.1) // 11
(8 0 0.1) // 12
(8 0.5 0.1) // 13
(0 0.5 0.1) // 14
(0 1 0.1) // 15
(8 1 0.1) // 16
(20 1 0.1) // 17
(20 0.5 0.1) // 18
(20 0 0.1) // 19
(20 -1 0.1) // 20
(8 -1 0.1) // 21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (1 1.25 1)
hex (3 2 5 4 14 13 16 15) (80 10 1) simpleGrading (1 0.8 1)
hex (2 7 6 5 13 18 17 16) (120 10 1) simpleGrading (1.25 0.8 1)
hex (1 8 7 2 12 19 18 13) (120 10 1) simpleGrading (1.25 1.25 1)
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (1.25 1.25 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 15 4)
);
}
Outlet
{
type patch;
faces
(
(8 19 20 9)
(7 18 19 8)
(6 17 18 7)
);
}
FixedWalls
{
type wall;
faces
(
(16 5 4 15)
(17 6 5 16)
(0 1 12 11)
(10 9 20 21)
(1 12 21 10)
);
}
FrontandBack
{
type empty;
faces
(
(0 3 2 1)
(3 4 5 2)
(2 5 6 7)
(1 2 7 8)
(10 1 8 9)
(12 13 14 11)
(13 16 15 14)
(18 17 16 13)
(19 18 13 12)
(20 19 12 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Results:
a) For 0.2 Grading factor
Pressure Distribution :
Velocity Distribution:
b) For 0.5 Grading Factor
Pressure Distribution:
Velocity Distribution:
c) For 0.8 Grading Factor
Pressure Distribution:
Velocity Distribution:
Velocity Profile for different grading factors at 0.085 m from Inlet:
a) For 0.2 grading factor
b) For 0.5 grading factor
c) For 0.8 grading factor
Plots analysis for Velocity Profile:
- In all three line plots at 0.085 m from inlet, same trend is observed with peak velocity of 1.1 m/s close to 0.005 m from x-axis towards the top wall. X-axis is defined at the top face edge of the step.
- The difference in the plot is seen near the walls -
- For 0.2 grading factor, the velocity at the bottom wall (-0.01 m from x-axis) is 0 m/s but at the top wall(+0.001 m) it is not zero but close to 0.05 m/s.
- For 0.5 grading factor, the velocity at the bottom wall(-0.01 m) is zero and also the top wall (0.01 m) it is close to zero.
- For 0.8 grading factor, the velocity at the bottom wall(-0.01 m) tends to zero whereas at the top wall(+0.01 m) it is close to 0.1 m/s.
So out of the three grading factor 0.5 value gives a good approximate of the desired simulation because the boundary conditions at the walls were set with no-slip condition where velocity magnitude should be zero but only plot with 0.5 grading factor shows it almost accurately. So it can be said that less refinnig or sometimes over-refining the meshes can deviate from the desired result.