BlockMesh Drill down challenge
Theory:
Backward facing step is to be generated using OPENFOAM which is solved by icoFoam solver of incompressible flow for newtonian fluids.
Mesh specification
- Number of cells along the x direction (longer dimension) = 200
- Number of cells along the y direction = 10
- Grading factor near all walls = 0.2
Procedure:
a.First create a copy of cavity folder from tutorials of incompressible flow.
b.Edit the blockmesh file from system folder.
c.Apply boundary conditions by changing \'p\' & \'u\' files for pressure & velocity.
Solution to problem
This problem is solved in three steps:
1.For Grading of 0.2
a.Generation of BlockMesh 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 dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
(0 0 0) //v0
(8 0 0) //v1
(8 0.5 0) //v2
(0 0.5 0) //v3
(8 1 0)//v4
(0 1 0)//v5
(20 1 0)//v6
(20 0.5 0)//v7
(20 0 0)//v8
(20 -1 0)//v9
(8 -1 0)//v10
(0 0 0.1)//v11
(8 0 0.1)//v12
(8 0.5 0.1) //v13
(0 0.5 0.1) //v14
(8 1 0.1) //v15
(0 1 0.1) //v16
(20 1 0.1) //v17
(20 0.5 0.1) //v18
(20 0 0.1) //v19
(20 -1 0.1) //v20
(8 -1 0.1) //v21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (0.2 0.2 1)
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.2 0.2 1)
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (0.2 0.2 1)
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (0.2 0.2 1)
hex (10 9 8 1 21 20 19 12) (120 5 1) simpleGrading (0.2 0.2 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)
);
}
topandbottom
{
type wall;
faces
(
(5 16 15 4)
(4 15 17 6)
(10 21 12 1)
(0 1 12 11)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
b.Changing ControlDict file for changing time steps.
/*--------------------------------*- 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.01;
deltaT 1e-5;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
c.Applying Pressure as a boundary conditions:
/*--------------------------------*- 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;
}
frontAndBack
{
type empty;
}
topandbottom
{
type zeroGradient;
}
}
// ************************************************************************* //
d.Applying velocity as a boundary conditions:
/*--------------------------------*- 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 (2 0 0);
}
outlet
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
topandbottom
{
type noSlip;
}
}
// ************************************************************************* //
e.Results:
a.Plot for Pressure
b.Plot for velocity
c.Line plot at a distance of 0.085 from x
2.For Grading of 0.5
Code for block mesh at grading factor of 0.5 changes, rest files remains the same for the analysis.
/*--------------------------------*- 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) //v0
(8 0 0) //v1
(8 0.5 0) //v2
(0 0.5 0) //v3
(8 1 0)//v4
(0 1 0)//v5
(20 1 0)//v6
(20 0.5 0)//v7
(20 0 0)//v8
(20 -1 0)//v9
(8 -1 0)//v10
(0 0 0.1)//v11
(8 0 0.1)//v12
(8 0.5 0.1) //v13
(0 0.5 0.1) //v14
(8 1 0.1) //v15
(0 1 0.1) //v16
(20 1 0.1) //v17
(20 0.5 0.1) //v18
(20 0 0.1) //v19
(20 -1 0.1) //v20
(8 -1 0.1) //v21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (0.5 0.2 1)
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.5 0.2 1)
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (0.5 0.2 1)
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (0.5 0.2 1)
hex (10 9 8 1 21 20 19 12) (120 5 1) simpleGrading (0.5 0.2 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)
);
}
topandbottom
{
type wall;
faces
(
(5 16 15 4)
(4 15 17 6)
(10 21 12 1)
(0 1 12 11)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
a.Results:
a.Plot for Pressure
b.Plot For Velocity
c.Line plot at a distance of 0.085 from x
3.For Grading of 0.8
Code for block mesh at grading factor of 0.8 changes, rest files remains the same for the analysis.
/*--------------------------------*- 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) //v0
(8 0 0) //v1
(8 0.5 0) //v2
(0 0.5 0) //v3
(8 1 0)//v4
(0 1 0)//v5
(20 1 0)//v6
(20 0.5 0)//v7
(20 0 0)//v8
(20 -1 0)//v9
(8 -1 0)//v10
(0 0 0.1)//v11
(8 0 0.1)//v12
(8 0.5 0.1) //v13
(0 0.5 0.1) //v14
(8 1 0.1) //v15
(0 1 0.1) //v16
(20 1 0.1) //v17
(20 0.5 0.1) //v18
(20 0 0.1) //v19
(20 -1 0.1) //v20
(8 -1 0.1) //v21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (0.8 0.2 1)
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.8 0.2 1)
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (0.8 0.2 1)
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (0.8 0.2 1)
hex (10 9 8 1 21 20 19 12) (120 5 1) simpleGrading (0.8 0.2 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)
);
}
topandbottom
{
type wall;
faces
(
(5 16 15 4)
(4 15 17 6)
(10 21 12 1)
(0 1 12 11)
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Results:
a.Plot for Pressure
b.Plot for Velocity
c.Line plot at a distance of 0.085 from x
Conclusion from the Results:
- Changing the grading does not have too much effect on the solution, in other words we can say that we have attain a convergence to the solution.
- For a grid of 0.2 we can see a maximum velocity to be around 2.62 m/s, for a grid of 0.5 we can see maximum velocity to be around 2.65 m/s, for a grid of 0.8 we can see maximum velocity is around 2.68 m/s.
- One thing can be noticed from the results is that if we go on finer grids, we see variation in the results.
- Moreover, we can see that velocity in the graph increases and then decreases to zero which clearly indicates no slip condition on the walls.
- We can see that as distance increases there is decrease in the value of the pressure.