BlockMesh Drill down and simulation of Backfacing step flow using OpenFOAM
In this project, flow over back facing step is simulated for three different meshes. To simulate the flow OpenFOAM's icoFoam solver is utilised, which solves for incompressible, laminar, transient, single phase newtonian fluids under isothermal condition. The time step for each mesh is decided such that the courant number stays below 1. The simulation is carried out for 0.01s. Plot for velocity and pressure were captured using plot over line function at 0.085m from inlet using a line that goes from bottom to the top wall (0.02m).
The initial conditions are taken as follows for all the three meshes:
Pressure:
/*--------------------------------*- 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
{
upperWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
lowerWall
{
type zeroGradient;
}
sideWall
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Velocity:
/*--------------------------------*- 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
{
upperWall
{
type noSlip;
}
inlet
{
type fixedValue;
value uniform (1.5 0 0);
}
outlet
{
type zeroGradient;
}
lowerWall
{
type noSlip;
}
sideWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
For all the meshes simpleGrading function is utilised to give finer meshes near the walls to capture in detail the velocity boundary layer formed.
blockMeshDict file of mesh with 0.2 grading near the walls:
/*--------------------------------*- 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 1;
vertices
(
(0 0 0.005) //0
(0.08 0 0.005) //1
(0.08 0.005 0.005) //2
(0 0.005 0.005) //3
(0.08 0.01 0.005) //4
(0 0.01 0.005) //5
(0.2 0.01 0.005) //6
(0.2 0.005 0.005) //7
(0.2 0 0.005) //8
(0.2 -0.01 0.005) //9
(0.08 -0.01 0.005) //10
(0 0 -0.005) //11
(0.08 0 -0.005) //12
(0.08 0.005 -0.005) //13
(0 0.005 -0.005) //14
(0.08 0.01 -0.005) //15
(0 0.01 -0.005) //16
(0.2 0.01 -0.005) //17
(0.2 0.005 -0.005) //18
(0.2 0 -0.005) //19
(0.2 -0.01 -0.005) //20
(0.08 -0.01 -0.005) //21
);
blocks
(
hex (11 12 13 14 0 1 2 3) (80 10 1) simpleGrading (1 5 1)
hex (14 13 15 16 3 2 4 5) (80 10 1) simpleGrading (1 0.2 1)
hex (12 19 18 13 1 8 7 2) (120 10 1) simpleGrading (5 5 1)
hex (13 18 17 15 2 7 6 4) (120 10 1) simpleGrading (5 0.2 1)
hex (21 20 19 12 10 9 8 1) (120 10 1) simpleGrading (5 5 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(11 14 3 0)
(14 16 5 3)
);
}
outlet
{
type patch;
faces
(
(20 9 8 19)
(19 8 7 18)
(18 7 6 17)
);
}
upperWall
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
);
}
lowerWall
{
type wall;
faces
(
(11 0 1 12)
(21 10 9 20)
);
}
sideWall
{
type wall;
faces
(
(21 12 1 10)
);
}
frontAndBack
{
type empty;
faces
(
(16 14 13 15)
(14 11 12 13)
(13 12 19 18)
(15 13 18 17)
(12 21 20 19)
(0 3 2 1)
(3 5 4 2)
(1 2 7 8)
(2 4 6 7)
(10 1 8 9)
);
}
);
// ************************************************************************* //
0.2 grading near the walls mesh:

0.2 grading near the walls mesh(zoomed):

controlDict file of mesh with 0.2 grading near the walls:
/*--------------------------------*- 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 latestTime;
startTime 0;
stopAt endTime;
endTime 0.01;
deltaT 0.000075;
writeControl timeStep;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Pressure/density plot captured using line at 0.085m from inlet:

Velocity plot captured using line at 0.085m from inlet:

Velocity contour plot captured at the last time step:

blockMeshDict file of mesh with 0.5 grading near the walls:
/*--------------------------------*- 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 1;
vertices
(
(0 0 0.005) //0
(0.08 0 0.005) //1
(0.08 0.005 0.005) //2
(0 0.005 0.005) //3
(0.08 0.01 0.005) //4
(0 0.01 0.005) //5
(0.2 0.01 0.005) //6
(0.2 0.005 0.005) //7
(0.2 0 0.005) //8
(0.2 -0.01 0.005) //9
(0.08 -0.01 0.005) //10
(0 0 -0.005) //11
(0.08 0 -0.005) //12
(0.08 0.005 -0.005) //13
(0 0.005 -0.005) //14
(0.08 0.01 -0.005) //15
(0 0.01 -0.005) //16
(0.2 0.01 -0.005) //17
(0.2 0.005 -0.005) //18
(0.2 0 -0.005) //19
(0.2 -0.01 -0.005) //20
(0.08 -0.01 -0.005) //21
);
blocks
(
hex (11 12 13 14 0 1 2 3) (80 10 1) simpleGrading (1 2 1)
hex (14 13 15 16 3 2 4 5) (80 10 1) simpleGrading (1 0.5 1)
hex (12 19 18 13 1 8 7 2) (120 10 1) simpleGrading (2 2 1)
hex (13 18 17 15 2 7 6 4) (120 10 1) simpleGrading (2 0.5 1)
hex (21 20 19 12 10 9 8 1) (120 10 1) simpleGrading (2 2 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(11 14 3 0)
(14 16 5 3)
);
}
outlet
{
type patch;
faces
(
(20 9 8 19)
(19 8 7 18)
(18 7 6 17)
);
}
upperWall
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
);
}
lowerWall
{
type wall;
faces
(
(11 0 1 12)
(21 10 9 20)
);
}
sideWall
{
type wall;
faces
(
(21 12 1 10)
);
}
frontAndBack
{
type empty;
faces
(
(16 14 13 15)
(14 11 12 13)
(13 12 19 18)
(15 13 18 17)
(12 21 20 19)
(0 3 2 1)
(3 5 4 2)
(1 2 7 8)
(2 4 6 7)
(10 1 8 9)
);
}
);
// ************************************************************************* //
0.5 grading near the walls mesh:

0.5 grading near the walls mesh(zoomed):

controlDict file of mesh with 0.5 grading near the walls:
/*--------------------------------*- 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 latestTime;
startTime 0;
stopAt endTime;
endTime 0.01;
deltaT 0.0001;
writeControl timeStep;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Pressure/density plot captured using line at 0.085m from inlet:

Velocity plot captured using line at 0.085m from inlet:

Velocity contour plot captured at the last time step:

blockMeshDict file of mesh with 0.8 grading near the walls:
/*--------------------------------*- 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 1;
vertices
(
(0 0 0.005) //0
(0.08 0 0.005) //1
(0.08 0.005 0.005) //2
(0 0.005 0.005) //3
(0.08 0.01 0.005) //4
(0 0.01 0.005) //5
(0.2 0.01 0.005) //6
(0.2 0.005 0.005) //7
(0.2 0 0.005) //8
(0.2 -0.01 0.005) //9
(0.08 -0.01 0.005) //10
(0 0 -0.005) //11
(0.08 0 -0.005) //12
(0.08 0.005 -0.005) //13
(0 0.005 -0.005) //14
(0.08 0.01 -0.005) //15
(0 0.01 -0.005) //16
(0.2 0.01 -0.005) //17
(0.2 0.005 -0.005) //18
(0.2 0 -0.005) //19
(0.2 -0.01 -0.005) //20
(0.08 -0.01 -0.005) //21
);
blocks
(
hex (11 12 13 14 0 1 2 3) (80 10 1) simpleGrading (1 1.25 1)
hex (14 13 15 16 3 2 4 5) (80 10 1) simpleGrading (1 0.8 1)
hex (12 19 18 13 1 8 7 2) (120 10 1) simpleGrading (1.25 1.25 1)
hex (13 18 17 15 2 7 6 4) (120 10 1) simpleGrading (1.25 0.8 1)
hex (21 20 19 12 10 9 8 1) (120 10 1) simpleGrading (1.25 1.25 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(11 14 3 0)
(14 16 5 3)
);
}
outlet
{
type patch;
faces
(
(20 9 8 19)
(19 8 7 18)
(18 7 6 17)
);
}
upperWall
{
type wall;
faces
(
(16 15 4 5)
(15 17 6 4)
);
}
lowerWall
{
type wall;
faces
(
(11 0 1 12)
(21 10 9 20)
);
}
sideWall
{
type wall;
faces
(
(21 12 1 10)
);
}
frontAndBack
{
type empty;
faces
(
(16 14 13 15)
(14 11 12 13)
(13 12 19 18)
(15 13 18 17)
(12 21 20 19)
(0 3 2 1)
(3 5 4 2)
(1 2 7 8)
(2 4 6 7)
(10 1 8 9)
);
}
);
// ************************************************************************* //
0.8 grading near the walls mesh:

0.8 grading near the walls mesh(zoomed):

controlDict file of mesh with 0.8 grading near the walls:
/*--------------------------------*- 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 latestTime;
startTime 0;
stopAt endTime;
endTime 0.01;
//0.01, 0.000001
deltaT 0.0002;
writeControl timeStep;
//20
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Pressure/density plot captured using line at 0.085m from inlet:

Velocity plot captured using line at 0.085m from inlet:

Velocity contour plot captured at the last time step:

The velocity and pressure plots give near similar results with different types of grading near the walls.
From the pressure plots one can observe that, at the bottom near the step there exists a low pressure region. When the same flow is solved for a high Reynold's number using a turbulent flow solver, vortices will be formed in this region due to flow recirculation caused by low pressure. Finally, the velocity plots show the velocity boundary layer formed due to the no slip condition applied to the walls.
Velocity contour animation captured for 0.2grading mesh with 10 frames per sec: