Week 8 - BlockMesh Drill down challenge
Objective:-
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:-
Geometry Creation:
Let us consider creating the geometry using 5 blocks as shown in the figure below,
Isometric view
Each of these blocks have 8 vertices, they are:-
[0] = (0 0 0)
[1] = (8 0 0)
[2] = (8 0.5 0)
[3] = (0 0.5 0)
[4] = (8 1 0)
[5] = (0 1 0)
[6] = (20 1 0)
[7] = (20 0.5 0)
[8] = (20 0 0)
[9] = (20 -1 0)
[10] = (8 -1 0)
[11] = (0 0 1)
[12] = (8 0 1)
[13] = (8 0.5 1)
[14] = (0 0.5 1)
[15] = (8 1 1)
[16] = (0 1 1)
[17] = (20 1 1)
[18] = (20 0.5 1)
[19] = (20 0 1)
[20] = (20 -1 1)
[21] = (8 -1 1)
method:-
1) First we need to run terminal in ubuntu.
2) Then we need to type openfoam shortcut 'tut', which take us directly to the tutorials folder.
3) Use 'ls' command to see all the files in tutorial folder.
4) Open incompressible folder using command 'cd incomprisible/'
4) Use 'ls' to see all the files in incomprisible folder.
5) Open icoFoam folder in incomprissible folder.
6) Check for contain using 'ls' command and copy cavity folder to $FOAM_RUN using the command 'cp -r cavity/ $FOAM_RUN/ cavity_test'
7) Use run command in terminal to open folder 'run'
8) Use 'ls' command to check the contain of the folder.
9) Open cavity folder inside cavity_test folder.
10) Edit blockMeshDict using the command 'gedit blockMeshDict'.
11) Simillarly we have to edit controlDict which is inside system folder.
12) Edit initial condition for velocity and pressure using 'gedit' command which is located inside '0' folder.
13) Now return to the cavity folder using 'cd ../' command and use 'blockMesh' command, it creates the mesh and does other calculations here.
14) Now type 'icoFoam' to perform simulation. Type 'paraFoam' to use paraview for post processing.
15) After simulation runs through, open case in paraview and click apply.
Then click on the Filters, then expand data analysis group. you will find plot over line options.
After selecting the plot over line, click apply. Now scroll down the plot over line defination, and input the right values of (x,y,z) to position the probe, scroll down futher untill you find the checklist to select the parameter you want to plot along the line probe.
Hit apply to get parameter plotted along the line probe.
1] blockMeshDict file
/*--------------------------------*- 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.1;
vertices
(
(0 0 0)
(8 0 0)
(8 0.5 0)
(0 0.5 0)
(8 1 0)
(0 1 0)
(20 1 0)
(20 0.5 0)
(20 0 0)
(20 -1 0)
(8 -1 0)
(0 0 1)
(8 0 1)
(8 0.5 1)
(0 0.5 1)
(8 1 1)
(0 1 1)
(20 1 1)
(20 0.5 1)
(20 0 1)
(20 -1 1)
(8 -1 1)
);
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 (5 0.2 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (5 5 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (5 5 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 3 14 11)
(3 5 16 14)
);
}
outlet
{
type patch;
faces
(
(7 18 17 6)
(8 19 18 7)
(9 20 19 8)
);
}
topAndBottom
{
type wall;
faces
(
(5 16 15 4)
(4 15 17 6)
(0 11 12 1)
(10 1 12 21)
(10 21 20 9)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 2 3)
(11 12 13 14)
(3 2 4 5)
(14 13 15 16)
(2 7 6 4)
(13 18 17 15)
(1 8 7 2)
(12 19 18 13)
(10 9 8 1)
(21 20 19 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
2] controlDict file
/*--------------------------------*- 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.005;
deltaT 0.00001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
3] Pressure condition
/*--------------------------------*- 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;
}
topAndBottom
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
4] Velocity condition
/*--------------------------------*- 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 volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (1 0 0);
}
outlet
{
type zeroGradient;
}
topAndBottom
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Result:-
1] when mesh grading factor is taken to be 0.2 along the wall
i) Mesh Profile:-
ii) Pressure profile:-
iii) Velocity profile:-
iv) velocity profile variation at 0.085m from the inlet of geometry for grading of 0.2
2] When Mesh grading factor is taken to be 0.5 along the walls:-
i) Pressure profile:-
ii) Velocity profile:-
iii) Velocity profile variation at 0.085m from the inlet of geometry at grading of 0.5
3] When Mesh grading factor is taken to be 0.8 along the walls:-
i) Pressure profile:-
ii) Velocity profile:-
iii) Velocity profile variation at 0.085m from the inlet of geometry at grading of 0.8
Conclusion:-
1) There is no significant effect in simulation because of change of grading factor.
2) There is a minor difference in maximum and minimum values.
3) when grading factor is 0.2 mesh can be easily seen.
4) Velocity is most accurate when grading factor is 0.2.