Week 8 - Simulation of a backward facing step in OpenFOAM
objective :
In this challenge we are going to simulate the incompressible laminar viscous flow through the backward facing step geometry and simmulate it for the above mentioned grading factors
Theory:
First we need to know how will this how will the backward facing step geometry look like, to do that we take your article to reference on this where a detailed explanation of the geometry and terminologies associated with are provided, since this is the 2D simulation we consider the flow in only two directions i:e (x,y)
According to the geometry, the total length of the mesh is 0.2m, dived into 2 one portion of mesh consumes 0.12m and remaining 0.08m would become another portion of mesh, width of 0.08m = 0.01m adn 0.12 = 0.02m
By looking at the geometry we can say ,we have 21 vertices, divided in to 5 different blocks,each block consists of 8 vertices, and there is an inlet and outlet patch at front and back where the mass flow takes place, also the wall surrounding it. all those 21 vertices values patch and wall values face value of 5 different blocks are provide inside the code
These are all the findings that we draw from the geometry
Now we shall look how can we simulate it using OPENFOAM step by step
we open virtual box machine where we see all the files such as desktop documents OPENFOAM etc , we open that and we get sl9 we still go inside run and we get plitz
when we are in plitz page we open terminal, there we go inside FOAMTUTORIALS/incompressible by selecting 'cd' command and open it using 'ls' command where we see all the files related to incompressible flows,
then we go inside cavity and open it and copy it to OPENFOAM folder using cp-r command, then we shall see the new folder named cavity is formed inside run folder beside plitz
here we again open the terminal under cavity and 'ls' it and minimize it
now we go inside the cavity folder we see 0 constant system folders, first we go inside system folder and open blockmesh dict, where we create the mesh as per geometry by providing all the neccessary details such as vertices, hex(face of each block), simple grinding to have more number of cells in a single grid, also boundary values such as patch and wall conditions and we run blockmesh command in terminal and get the values
after that w eopen 0 folder and get inside the velocity and pressure folders and provide them with neccessary conditions, then we open transport properties under constant folder and provide suitable values which is neccessary for the flow inside the geometry , also open controldict under sysytem folders and give them starting, end, delta time etc
now we are all set , we solve this in terminal using 'icofoam' solver command and obtain velocity, pressure, residual, CFL values
then we open the mesh in paraview using 'parafoam' command in terminal, there we see the 3D image of backward step facing geometry , to view the gridded mesh of the same we click on solid color and surface edges
now we simulate the flow for the above provided grading factors and run simulation and kennly observe where all the velocity and presuure is high and where is it low, also then we measure the velocity profile at 0.085 and plot it using plot over in option
The codes are all the inserted using insert code option please check it and verify it.
*--------------------------------*- 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 blockMes hDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
(0 0 0)//vertex 0
(8 0 0)//vertex 1
(8 0.5 0)//vertex 2
(0 0.5 0)//vertex 3
(8 1 0)//vertex 4
(0 1 0)//vertex 5
(20 1 0)//vertex 6
(20 0.5 0)//vertex 7
(20 0 0)//vertex 8
(20 -1 0)//vertex 9
(8 -1 0)//vertex 10
(0 0 1)//vertex 11
(8 0 1)//vertex 12
(8 0.5 1)//vertex 13
(0 0.5 1)//vertex 14
(8 1 1)//vertex 15
(0 1 1)//vertex 16
(20 1 1)//vertex 17
(20 0.5 1)//vertex 18
(20 0 1)//vertex 19
(20 -1 1)//vertex 20
(8 -1 1)//vertex 21
);
blocks
(
hex (0 1 2 3 11 12 13 14) (50 5 1) simpleGrading (1 5 1)
hex (3 2 4 5 14 13 15 16) (50 5 1) simpleGrading (1 0.2 1)
hex (2 7 6 4 13 18 17 15) (150 5 1) simpleGrading (5 0.2 1)
hex (1 8 7 2 12 19 18 13) (150 5 1) simpleGrading (5 5 1)
hex (10 9 8 1 21 20 19 12) (150 20 1) simpleGrading (5 10 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)
);
}
walls
{
type wall;
faces
(
(4 5 16 15)
(6 4 15 17)
(0 1 12 11)
(10 9 20 21)
(10 21 12 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
/*--------------------------------*- 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;
}
walls
{
type noSlip;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
walls
{
type zeroGradient;
}
// ************************************************************************* //
/*--------------------------------*- 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-5;
/*--------------------------------*- 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 20;
deltaT 1e-2;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
// ************************************************************************* //

