Block Mesh drill down challenge
Objective: Using the icoFoam solver to simulate the flow through a backward facing step. Creating multiple meshes and comparing results.
Theory:
A backward facing step is generated using OpenFOAM as per the given dimensional specifications.
Mesh specification:
- Number of cells in x-direction = 200
- Number of cells in y-direction = 10
- Grading near the walls = 0.2
Solutions steps:
- Open the tutorials folder by navigating through command prompt. Open folder named incompressible inside it and then navigate to icoFoam folder. Copy the folder named inside icoFoam folder.
- Paste a copy of cavity folder inside Run folder.
- Open the blockmesh file in system folder and edit it.
- Open the ‘p’ and ‘u’ file and apply boundary conditions for pressure and velocity.
- Open the controlDict file and edit time steps according to requirement.
- Visualize the results using Paraview post processing tools
For Grading factor of 0.2
.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) // point 0
(8 0 0) // point 1
(8 0.5 0) // point 2
(0 0.5 0) // point 3
(8 1 0) // point 4
(0 1 0) // point 5
(20 1 0) // point 6
(20 0.5 0) // point 7
(20 0 0) // point 8
(20 -1 0) // point 9
(8 -1 0) // point 10
(0 0 0.1) // point 11
(8 0 0.1) // point 12
(8 0.5 0.1) // point 13
(0 0.5 0.1) // point 14
(8 1 0.1) // point 15
(0 1 0.1) // point 16
(20 1 0.1) // point 17
(20 0.5 0.1) // point 18
(20 0 0.1) // point 19
(20 -1 0.1) // point 20
(8 -1 0.1) // point 21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 5 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 0.2 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1 0.2 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1 5 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1 5 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
(
);
// ************************************************************************* //
ControDil 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;
location \"system\";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.00001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
pressure Boundary condition 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 Boundary conditions 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;
}
}
// ************************************************************************* //
For Grading factor of 0.5
only blockMesh is updated while remaining other conditions remains same .
/*--------------------------------*- 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) // point 0
(8 0 0) // point 1
(8 0.5 0) // point 2
(0 0.5 0) // point 3
(8 1 0) // point 4
(0 1 0) // point 5
(20 1 0) // point 6
(20 0.5 0) // point 7
(20 0 0) // point 8
(20 -1 0) // point 9
(8 -1 0) // point 10
(0 0 0.1) // point 11
(8 0 0.1) // point 12
(8 0.5 0.1) // point 13
(0 0.5 0.1) // point 14
(8 1 0.1) // point 15
(0 1 0.1) // point 16
(20 1 0.1) // point 17
(20 0.5 0.1) // point 18
(20 0 0.1) // point 19
(20 -1 0.1) // point 20
(8 -1 0.1) // point 21
);
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)
);
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
(
);
// ************************************************************************* //
For Grading factor of 0.8
/*--------------------------------*- 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) // point 0
(8 0 0) // point 1
(8 0.5 0) // point 2
(0 0.5 0) // point 3
(8 1 0) // point 4
(0 1 0) // point 5
(20 1 0) // point 6
(20 0.5 0) // point 7
(20 0 0) // point 8
(20 -1 0) // point 9
(8 -1 0) // point 10
(0 0 0.1) // point 11
(8 0 0.1) // point 12
(8 0.5 0.1) // point 13
(0 0.5 0.1) // point 14
(8 1 0.1) // point 15
(0 1 0.1) // point 16
(20 1 0.1) // point 17
(20 0.5 0.1) // point 18
(20 0 0.1) // point 19
(20 -1 0.1) // point 20
(8 -1 0.1) // point 21
);
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.8A 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
(
);
// ************************************************************************* //
Conclusion:
- Changing the grading factordoesnt have a significant impact on the results
- Maximum velocity in all cases falls in a certain range
- Maximum velocity for grading factor 0.2 is 2.59 for 0.8 is 2.62m/s
- Velocity contour has less noticable variations
- Looks like solutions is near convergence