Week 8 - Simulation of a backward facing step in OpenFOAM
OBJECTIVE: To simulate an incompressible-laminar-viscous flow through the backward facing step geometry using OpenFOAM.
STEPS FOLLOWED:
We first went to tutorial folder by using "tut" shortcurt command.
then we used "ls" to list al the files in the folder.
After that we used "cd incompressible" command to get into the directory
after that we used "cp -r cavity $FOAM_RUN/cavity_challenge" to copy the cavity file into the FOAM_RUN folder by name cavity_challenge.
we then went to FOAM_RUN folder where
we opened the cavity folder by using "cd cavity"
after that we used "ls" to list the entities of the directory, after that we went into system folder and used the command "gedit blockMeshDict" to open the text editor file called blockMeshDict which had all the information regarding geometry which was then modified as per need. after that by using the same "gedit" command we edited controlDict file which had inofrmation regarding simulation control.
then "cd .." was used to level up directory location and then we went into constant directory where we edited transportProperties which stores the constant values of the simulation.
again we went back and this opened the 0 directory which stores the initial values of the simulation.
There we edited the p and U files as per our requirements.
after that we again went back and used the "blockMesh" command to verify our mesh after we got ok result we used "icoFoam" to run the icoFoam solver on our model, the simulztion then ran and we used the "paraFoam" command to use the paraview so see our simulation and plot V over the the line using the "plot over the line" filter of paraview.
OpenFOAM SETTINGS:
INITIAL BLOCKMESH WITH NO GRADING
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
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 (1 1 1) //block1
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 1 1) //block2
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (1 1 1) //block3
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (1 1 1) //block4
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (1 1 1) //block5
);
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)
);
}
fixedWalls
{
type wall;
faces
(
(6 4 15 17)
(4 5 16 15)
(10 21 12 1)
(12 11 0 1)
(20 21 10 9)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(11 12 13 14)
(3 5 4 2)
(13 15 16 14)
(2 4 6 7)
(13 18 17 15)
(1 2 7 8)
(12 19 18 13)
(10 1 8 9)
(21 20 19 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
CONTROL SETTINGS FOR SIMULATION
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.2;
deltaT 0.00001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
TRANSPORT PROPERTIES VALUE
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 1e-3;
// ************************************************************************* //
INITIAL PRESSURE CONDITIONS
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
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;
}
frontAndBack
{
type empty;
}
fixedWalls
{
type zeroGradient;
}
}
// ************************************************************************* //
INITIAL VELOCITY CONDITIONS
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
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;
}
frontAndBack
{
type empty;
}
fixedWalls
{
type noSlip;
value uniform(0,0,0);
}
}
// ************************************************************************* //
BLOCKMESH WITH 0.2 GRADING FACTOR NEAR THE WALLS
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
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.2 5 1) //block1
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.2 0.2 1) //block2
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (5 0.2 1) //block3
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (5 5 1) //block4
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (5 5 1) //block5
);
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)
);
}
fixedWalls
{
type wall;
faces
(
(6 4 15 17)
(4 5 16 15)
(10 21 12 1)
(12 11 0 1)
(20 21 10 9)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(11 12 13 14)
(3 5 4 2)
(13 15 16 14)
(2 4 6 7)
(13 18 17 15)
(1 2 7 8)
(12 19 18 13)
(10 1 8 9)
(21 20 19 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
WITH NO GRADING


WITH GRADING OF 0.2


CONCLUSION: We can conclude from our observation that grading of mesh is important for getting smoother and cleaner outputs. Though we dont see change in values due to change in grading hence grading does not affect output values.