BlockMesh Drill down challenge
Aim :-
To simulate the flow through a backward facing step & create multiple meshes and compare the results obtained from eash mesh for the following profile using icoFoam.
Objective :-
- The number of cells along the direction of flow = 200
- The number of cells along the y-direction for each block = 10
- Inlet Velocity is 1 m/sec.
- Run the first simulation without grading factor.
- Run the second simulation with the mesh grading factors of 0.2, 0.5 & 0.8. Compare the effect of grading factor with necessary contours & plots.
- Measure the velocity profile at 0.085 m from the inlet of the geometry with a line plot.
- Compare velocity magnitude contours near the step region for the above-mentioned grading factors.
open Foam :-
- OpenFOAM (for "Open-source Field Operation And Manipulation") is a C++ toolbox for the development of customized numerical,solvers and pre-/post-processing utilities for the solution of continum mechanics problems, most prominently including computational fluid mechanics(CFD).
-
OpenFOAM simulation are configured by several plain text input files located across the following three directories:
- system/:
- controlDict
- fvSchemes
- fvSolution
- fvOptions (optional)
- (other dictionaries (configuration files in OpenFOAM))
- constant
- polyMesh/
- (other dictionaries)
- 0/ (or another initial time directory)
- (field files)
Additional directories can be generated, depending on user selections. These may include:
- (result time directories): field predictions as a function of iteration count or time
- postProcessing/: data typically generated by function objects data conversion,
- system/:
Block Mesh Drill Down image :-
BlockMesh code :-
/--------------------------------- 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) //vertices 0
(8 0 0) //vertices 1
(8 0.2 0) //vertices 2
(0 0.2 0) //vertices 3
(0 1 0) //vertices 4
(8 1 0) //vertices 5
(20 1 0) //vertices 6
(20 0.2 0) //vertices 7
(20 0 0) //vertices 8
(20 -1 0) //vertices 9
(8 -1 0) //vertices 10
(8 0 0.1) //vertices 11
(0 0 0.1) //vertices 12
(0 0.2 0.1) //vertices 13
(8 0.2 0.1) //vertices 14
(8 1 0.1) //vertices 15
(0 1 0.1) //vertices 16
(20 1 0.1) //vertices 17
(20 0.2 0.1) //vertices 18
(20 0 0.1) //vertices 19
(20 -1 0.1) //vertices 20
(8 -1 0.1) //vertices 21
);
blocks
(
hex (0 1 2 3 12 11 14 13) (200 10 1) simpleGrading (0.2 1.2 1)
hex (3 2 5 4 13 14 15 16) (200 10 1) simpleGrading (0.2 0.2 1)
hex (2 7 6 5 14 18 17 15) (200 10 1) simpleGrading (1.2 0.2 1)
hex (1 8 7 2 11 19 18 14) (200 10 1) simpleGrading (1.2 1.2 1)
hex (10 9 8 1 21 20 19 11) (200 20 1) simpleGrading (1.2 0.2 1)
);
edges
(
);
boundary
(
inlet
{
type wall;
faces
(
(13 12 0 3)
(16 13 3 4)
);
}
outlet
{
type wall;
faces
(
(6 17 18 7)
(7 18 19 8)
(8 19 20 9)
);
}
front
{
type empty;
faces
(
(13 12 11 14)
(16 13 14 15)
(15 14 18 17)
(14 11 19 18)
(11 21 20 19)
);
}
back
{
type empty;
faces
(
(3 0 1 2)
(4 3 2 5)
(5 2 7 6)
(2 1 8 7)
(1 10 9 8)
);
}
topandbottom
{
type wall;
faces
(
(0 12 11 1)
(11 10 21 1)
(10 21 20 9)
(16 4 5 15)
(15 5 6 17)
);
}
);
mergePatchPairs
(
);
// ************************* //
ControlDict Code :-
/--------------------------------- 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.05;
deltaT 1e-05;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************* //
Pressure Code :-
/--------------------------------- 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;
}
front
{
type empty;
}
back
{
type empty;
}
topandbottom
{
type zeroGradient;
}
}
// ************************* //
Velocity Code :-
/--------------------------------- 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 (1.5 0 0);
}
outlet
{
type zeroGradient;
}
front
{
type empty;
}
back
{
type empty;
}
topandbottom
{
type noSlip;
}
}
// ************************* //
Explanation for Simulation :-
- We have to open the terminal by using command (Ctrl+Alt+t) in the linux operating system.
- After the terminal has been opened you have to given the command has tutorials and it takes you to ib-build tutorials files of the openFoam software.then type ls (list) command to view the contents in the tutorials.
- Type the command for incompressible directory file is cd incompressible.
- Then type cd icoFoam and it will run after that use ls command.
- We have to copy the cavity directory file in icoFoam by using the command is cd -r cavity/$FOAM_RUN/. and it paste in run folder.
- Type cd command for command directory it takes to run folder which creates automatically for file created.
- Open the files using the change the directory cd command.
- The files we copied give the command ls it will show you cavity directory open cavity_test.
- After the list command has been opened your directory will show two type files blockMeshDict, controlDict are the text file we have to edit the file accordingly to our boundary conditions.
- Then gedit blockMeshDict as type in yourcommand window we given a shape to the problem applying the mesh grading ,allocating the grid numbers to the respective points we assumed and save the files.
- Likewise, edit controlDict file also given limits in words of time, like starttime , end time,,time interval, and deltat.
- While selecting the deltat value be aware of courant number . it should be less than one otherwise the solution may diverge and stopped forcibly by software itself.
- Come back to the cavity file using change directory command cd ..
- In the file we need to edit the velocityand pressure files accordingly to the problem for that what we need 0 file.
- In 0 file represents us that the initial conditions of the problem and these files are inbuild files.
- After editing thefour lines come tothe cavity directory.than we need to give command blockMesh to the mesh structuredand the other mesh calculations are done here.
- After completing it we need to check the mesh that it has any error in it or not for that checkMesh command is used.
- Now type icoFoam to calculate simulation smulation because in icoFoam it run only onlythe file we copied .
- After the completion of simuation type ParaFoam for the post-processing.
- The ParaView is an open source multiple platform application for interactive , scientific visualization . it has a client server architecture to faciliate remote visualization of datasets, and generates level of level of detail(LOD) modelsto maintain interactive frame rates for large datasets. Itis an application builts on top of the visualization tool kitlibraries. Paraview is an application designed for data parallesium on shared memory or distributed memor multicomputers and clusters . it can also be run as a single computer application.
Results :-
velocity profile for 0.2 :-
Graph plot :
velocity profile for 0.5 :-
Graph plot :-
velocity profile for 0.8 :-
Graph plot :-
Conclusion :-
- By observing the above plots, we can see that how the gradiation of mesh appears. from the plots we can say some effect on simulation by changing the mesh grading factor.
- In simulation of mesh grading factor of 0.2,0.5,0.8 we can see similar plots. the difference have been observed by tghe plots is maximum velocity and pressure points .
- The veocity plots we observe that plot has been bent to is right side, becauyse we given condition of the walls as no-slip conditio throughout the block.
- The formation of pressure plots is first it increasin and then decreasing ,because there is increasing in velocity the pressure also observed.