Using the icoFOAM solver to simulate the flow through a backward facing step (BlockMesh Drill down)
OBJECTIVE:
Using the icoFOAM solver to simulate the flow through a backward facing step, and creating multiple meshes and will be comparing the results obtained from each mesh.
Introduction:
The purpose of the following project is to generate the geometry for a variation of the incompressible cavity flow problem in OpenFOAM. For this purpose we have modified the lid-driven cavity tutorial in OpenFOAM to generate the mesh. We would be looking at the generation of the Mesh with and without grading and its flow simulation
Setup:
geomentry to be working on provided below
Mesh Specifications:
Number of cells along the x direction (longer dimension) = 200
Number of cells along the y direction = 10
Assumptions taken
- Low speed forced convection flow
- Friction factor in walls have been neglected
- Low Reynolds number flow through a closed channel
- No-slip conditions in the top and bottom wall surfaces
Here is the simplegrading factor has been set to (1 1 1) indicating that its is an ungraded mesh.
Edited the blockMeshDict file shown for above Geometry.
/*--------------------------------*- 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)
(8 0 0)
(8 0.5 0)
(0 0.5 0)
(8 1 0)
(0 1 0)
(20 1 0)
(20 0.5 0)
(20 0 0)
(20 -1 0)
(8 -1 0)
(0 0 0.1)
(8 0 0.1)
(8 0.5 0.1)
(0 0.5 0.1)
(8 1 0.1)
(0 1 0.1)
(20 1 0.1)
(20 0.5 0.1)
(20 0 0.1)
(20 -1 0.1)
(8 -1 0.1)
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 1 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 1 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1 1 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1 1 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1 1 1)
);
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)
(10 1 8 9)
(1 2 7 8)
(2 4 6 7)
(11 12 13 14)
(14 13 15 16)
(21 20 19 12)
(12 19 18 13)
(13 18 17 15)
);
}
Noslipwalls
{
type wall;
faces
(
(5 16 15 4)
(4 15 17 6)
(0 1 12 11)
(10 21 12 1)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
The boundary conditions for the problem is specified as follows:
Pressure file:
/*--------------------------------*- 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 uniform 0;
}
Noslipwalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Velocity file:
/*--------------------------------*- 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;
}
Noslipwalls
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Time steps and time taken for simulation:
/*--------------------------------*- 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;
location \"system\";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.0001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Results From ungraded Mesh:
Mesh profile(Ungraded):
velocity profile:
pressure profile:
ploting Velocity profile at distance of 0.085m:
From the plot we can see little to no boundary layer seperation of the two mixing streams which occurs when the fluid head passes just over the step and experiences exit loss. This is a qualitative effect that should give us an approximation of accuracy of our simulation depending on the mesh refinement (or the grading factor f).
We now introduce a grading factor that is defined by f = (size of the end cell)/(size of the start cell) This is used to refine the mesh at a certain desired location to get a more accurate solution at the said location. In our problem we need to capture the velocity profile at x = O.085m from the inlet and for that we graded the mesh both in the x and y directions. Hence we needed to refine the mesh near the backward step in the object by suitably grading the mesh near the exit of the inlet. The results for various mesh grading factors are:
Mesh grading factor=0.2
Changes in blockMeshDict file
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.2 1.2 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.2 0.2 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.2 0.2 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.2 1.2 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.2 1.2 1)
);
Results:
Mesh profile:
velocity profile:
Pressure Profile:
Plotting Velocity Profile:
The above plot shows a good amount of boundary layer seperation and also provides accurate information of velocity near the top surface. We can observe the boundary layer being formed on the bottom surface due to the viscous shear forces of the incoming fluid stream from the inlet and mixing with the stagnant zone of the exit to the backward step.
Mesh grading factor=0.5
Changes in blockMeshDict file
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.5 1.5 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.5 0.5 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.5 0.5 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.5 1.5 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.5 1.5 1)
);
Results:
Mesh profile:
velocity profile:
Pressure Profile:
Plotting Velocity Profile:
Mesh grading factor=0.8
Changes in blockMeshDict file
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.8 1.8 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.8 0.8 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.8 0.8 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.8 1.8 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.8 1.8 1)
);
Results:
Mesh profile:
velocity profile:
Pressure profile:
Plotting Velocity Profile:
In the above plot, again we can see little to no boundary layer seperation hence the required grading factor (f = 0.8) does not provide much refinement of the mesh at x = 0.085m
CFL number for different Mesh grading factors:
The maximum value of the CFL number increases as the grading factor decreases. It is expected because grading factor f decreases with the decreasing distance between two adjacent cells at some parts of the mesh. The mean value of the CFL number almost remains constant throughout. It is not recommended to use a very low value of f because the max CFL number might go beyond I and make the solution unstable.
Learning Outcome:
- Flow quantities can be accurately predicted at the desired location by grading the mesh
suitablly. - The finer the mesh (lower value of f), the more accurately the fluid physics can be
visualized. - The value of the Kinematic Viscosity v = 0.01 `m^2s^-1`
- The start time of the simulation was set at t = 0 s and the end time was set at t = 0.1 s and the time-step used was set at lit = 0.0001 s
- The solver used was icoFOAM, normally used for low Re, incompressible flows.
Conlusion:
All The velocity graphs obtainted from the different meshing grading factors are similiar with a negligible variations. As the mesher size is lower i.e for finer mesh we can visualize the accurate output.