Week 8 - BlockMesh Drill down challenge
AIM:
Mesh specification
- Number of cells along the x direction (longer dimension) = 200
- Number of cells along the y direction = 10
- Use a graded mesh. Grading factor near all walls should be 0.2
Boundary condition specification
Follow the specifications that are provided in the following figure.
Desired output
- 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.
PROCEDURE:
1.Open terminal ->tut->cd incompressible->icoFoam
2.Copy cavity and paste in FOAM_run folder with a different name. Using command cp -r cavity /$FOAM_RUN/cavity_test.
3.Open $FOAM_RUN using cd $FOAM_RUN.
4. Use cd cavity_test ->cd system-> gedit blockMeshDict to open the blockMeshdict file and edit it as per geometry.
5.cd .. is used to ga back
6.cd 0 ->gedit p is used to edit the pressure file as per boundary condition specified in blocks of blockmesh file
7.cd ->gedit U is used to edit the velocity file as per boundary condition specified in blocks of block Mesh file
8.cd .. back is used to go back a folder
9.cd system ->gedit controlDict to edit the file to provide end time, Delta t and write interval.
10.The delta t value must be specified such that the courant number displayed while executing the code is not more than1
11.Go back to cavity folder and use comand blockMesh to execute the blockMesh dict file.A pollymesh folder with boundary,face,point file will be created in constant folder
12.Use icoFoam command to run the icOFoam solver .
13.Number of folders from 0 to endtime value will be created .They represent the data stored for each time step after solving.
14.Use paraFoam command to open Paraview.
15.Click apply in properties tab the geometry will popup click on surface with wireframe tio see grading .Then click on u from solidcolor and select magnitude to see velocity distribution.
16.USE filter->plot over line ->move the two point to near back step and give accurate values of (X,Y,Z) for both points to determine the variation of velocity along the the line.
17.Repeat the same process for other grading factors by editing the blocks in blockMeshDict file and removing the pre existing polyMesh file ,timesteps and existing logs of previous simulations using -> rm -r polyMesh, foamListTimes -rm.
Grading is given by for 0.2 the cells are smaller at the end andthe reciprocal (1/0.2=5) makes cells smaller at the beginning.
BLOCKMESHDICT
While giving grading make sure the blocks (1,2) (3,4,5) have y grading same and blocks (2,3) (1,4) have x grading same.
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
(0 0 0)//0
(8 0 0)//1
(8 0.5 0)//2
(0 0.5 0)//3
(8 1 0)//4
(0 1 0)//5
(20 1 0)//6
(20 0.5 0)//7
(20 0 0)//8
(20 -1 0)//9
(8 -1 0)//10
(0 0 0.1)//11
(8 0 0.1)//12
(8 0.5 0.1)//13
(0 0.5 0.1)//14
(8 1 0.1)//15
(0 1 0.1)//16
(20 1 0.1)//17
(20 0.5 0.1)//18
(20 0 0.1)//19
(20 -1 0.1)//20
(8 -1 0.1)//21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (0.5 2 1)
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.5 0.5 1)
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (2 0.5 1)
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (2 2 1)
hex (10 9 8 1 21 20 19 12) (120 5 1) simpleGrading (2 0.5 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type patch;
faces
(
(19 20 9 8)
(18 19 8 7)
(17 18 7 6)
);
}
frontback
{
type empty;
faces
(
(21 20 19 12)
(12 19 18 13)
(13 18 17 15)
(11 12 13 14)
(14 13 15 16)
(1 0 3 2)
(2 3 5 4)
(7 2 4 6)
(8 1 2 7)
(9 10 1 8)
);
}
topbottomstep
{
type wall;
faces
(
(4 5 16 15)
(6 4 15 17)
(0 1 12 11)
(10 9 20 21)
(10 21 12 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
PRESSURE
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ 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;
}
frontback
{
type empty;
}
topbottomstep
{
type zeroGradient;
}
}
// ************************************************************************* //
VELOCITY
\\ / A nd | Version: 8
\\/ 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.5 0 0);
}
outlet
{
type zeroGradient;
}
topbottomstep
{
type noSlip;
}
frontback
{
type empty;
}
}
CONTROLDICT
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.05;
deltaT 10e-06;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
RESULTS:
For factor 0.2 and 5
For factor 0.5 and 2
For factor 0.8 and 1.25
INFERENCE:
All the three velocity plots have nearly the same profile.It is noticed that as the mesh gets finer the accuracy improves and 0.2 mesh grading provides the more accurate values when compared with the rest.