BlockMesh
Objectives :-
- Create a 3D diagram of the given specification by use of blockmeshdict file.
- Use the icoFoam solver to simulate the flow through a backward facing step.
- Creating multiple meshes and will be comparing the results obtained from each mesh.
- How does the velocity magnitude profile change as a function of mesh grading factor. Use factors, 0.2, 0.5,0.8
- Measure the velocity profile at 0.085 m from the inlet of the geometry
- Plot must be a line plot
- Compare velocity magnitude contours near the step region for the above mentioned grading factors.
Given Inputs :-
- Number of cells along the x direction (longer dimension) = 200
- Number of cells along the y direction = 10
- Use a graded mesh.
Creating above figure by editing the blockMeshDict file
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ M anipulation |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0) // Vertices 0
(0.08 0 0) // Vertices 1
(0.08 0.005 0) // Vertices 2
(0 0.005 0) // Vertices 3
(0.08 0.01 0) // Vertices 4
(0 0.01 0) // Vertices 5
(0.2 0.01 0) // Vertices 6
(0.2 0.005 0) // Vertices 7
(0.2 0 0) // Vertices 8
(0.2 -0.01 0) // Vertices 9
(0.08 -0.01 0) // Vertices 10
(0 0 0.001) // Vertices 11
(0.08 0 .001) // Vertices 12
(0.08 0.005 0.001) // Vertices 13
(0 0.005 0.001) // Vertices 14
(0.08 0.01 0.001) // Vertices 15
(0 0.01 0.001) // Vertices 16
(0.2 0.01 0.001) // Vertices 17
(0.2 0.005 0.001) // Vertices 18
(0.2 0 0.001) // Vertices 19
(0.2 -0.01 0.001) // Vertices 20
(0.08 -0.01 0.001) // Vertices 21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.8 1 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.8 1 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (0.8 1 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (0.8 1 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (0.8 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)
);
}
front
{
type empty;
faces
(
(11 12 13 14)
(14 13 15 16)
(13 18 17 15)
(12 19 18 13)
(21 20 19 12)
);
}
Back
{
type empty;
faces
(
(3 2 1 0)
(5 4 2 3)
(4 6 7 2)
(2 7 8 1)
(1 8 9 10)
);
}
top
{
type wall;
faces
(
(5 16 15 4)
(4 15 17 6)
);
}
stepside
{
type wall;
faces
(
(10 21 12 1)
);
}
bottom
{
type wall;
faces
(
(0 1 12 11)
);
}
bottomdown
{
type wall;
faces
(
(10 9 20 21)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Fig 1 :- Figure that created after running the above file
Note :- we change the boundary condition in the blockMeshDict file so now we have to change the boundary condition in both pressure and velocity file and also edit the velocity input accordingly.
Velocity Boundary condition :-
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ 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;
}
front
{
type empty;
}
back
{
type empty;
}
top
{
type noSlip;
}
stepside
{
type noSlip;
}
bottom
{
type noSlip;
}
bottomdown
{
type noSlip;
}
}
// ************************************************************************* //
Pressure Boundary Condition :-
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ 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;
}
front
{
type empty;
}
back
{
type empty;
}
top
{
type zeroGradient;
}
stepside
{
type zeroGradient;
}
bottom
{
type zeroGradient;
}
bottomdown
{
type zeroGradient;
}
}
// ************************************************************************* //
For the simulation purpose we have to edit controlDict file accordingly that courant number less than 1. So the solution is converge.
controlDict file :-
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ M anipulation |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location \"system\";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.005;
deltaT 0.000005;
writeControl timeStep;
writeInterval 10;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Some of the data taken for the simulation :-
- Velocity = 2 m/s in x direction.
- Simulation time 0 to 0.005 second.
- dt = 0.000005 second.
- Every 10 time step value of velocity will be stored.
Result and Plot :-
Fig 2 :- Velocity distribution profile of the above geometry for grading factor 0.2
Fig 3 :- Velocity profile of the above geometry for grading factor 0.2 (Line plot)
Fig 4 :- Velocity profile at 0.085 m from the inlet of the geometry for grading factor 0.2
Fig 5 :- Velocity distribution profile of the above geometry for grading factor 0.5
Fig 6 :- Velocity profile of the above geometry for grading factor 0.5 (Line plot)
Fig 7 :- Velocity profile at 0.085 m from the inlet of the geometry for grading factor 0.5
Fig 8 :- Velocity distribution profile of the above geometry for grading factor 0.8
Fig 9 :- Velocity profile of the above geometry for grading factor 0.8 (Line plot)
Fig 10 :- Velocity profile at 0.085 m from the inlet of the geometry for grading factor 0.8
Conclusion :-
- Fig 2,5,8 shows the velocity distribution profile for the grading factor 0.2,0.5,0.8. Dark red indicate high velocity area and blue area shows the lower velocity area.
- Fig 3,6,9 shows the line plot of velocity for the grading factor 0.2,0.5,0.8 from inlet to the outlet of the above profile shown in fig 1.
- Near the step region velocity start decreasing rapidly from 3 m/s to near 1.1 m/s.
- Fig 4,7,10 shows the line plot of velocity for the grading factor 0.2,0.5,0.8 from inlet to 0.085 m of the above profile shown in fig 1.
- By comparing the velocity profile of all the three grading factor minor changes in velocity will be observe.