Week 8 - Simulation of a backward facing step in OpenFOAM
AIM
We have to simulate the incompressible-laminar-viscous flow in a backward facing step with help of OPENFOAM with ParaView interface. As a result if the simulation, velocity, pressure profile for different mesh grading factor can be achieved.
The geometry of backward facing step:-
I used the IcoFoam solver to solve the equations mentioned in the application of system file. IcoFoam is the transient solver for incompressible, laminar flow for Newtonian flow as it is in our case.
I will be solving the system for 2 cases:-
Case 1 - Simulate the flow without using any grading factor (i.e., GF = 1)
Case 2 - Simulate the flow with grading factor of 0.2. The cells should be finer near the walls (includig the step wall).
You can use the following mesh parameters but you can feel free to modify these values.
Mesh specification
- Number of cells along the x direction (longer dimension) = 200
- Number of cells along the longer y direction = 20;
THEORY
Grading Factor
Meshing is one of the most crucial step for solving this problem. Higher the number of mesh elements , higher would be the result accuracy and same trend for the time taken to reach the solution. Grading could not change the number of elements but could increase it's size at one place and decrease at another thus the Courant Number is not affected and further no discrepencies in our solutionj, this could increase the result accuracy at places where the mesh size decreses as expected near the the step walls(in our case)
PROCEDURE
CASE 1) Grading Factor(GF) = 0
We will find the cavity folder under tutorial I coppied this folder in the run folder and named it 'Case_1' Under the 'case_1' we can find 3 folders:- 0 system constant From directory i changed the source code for 1)blockMeshDict 2) controlDict 3) U (Velocity) under '0' 4) p (pressure) under '0' 5) Constant code Then I ran the following commands:- 1) blockMesh 2) checkMesh 3) icoFoam 4) touch test.foam 5) explorer.exe . I opened the test file in ParaView to display our mesh, grid and results. Case 2) Grading Factor = 0.2 I followewd the same steps and name the new cavity file 'Case_2' and editted the source code as given below to specify G.F =0.2 1) blockMeshDict 2) controlDict 3) U (Velocity) from '0' 4) p (pressure) from '0' 5) Constant source code Results 1) GF = 0 1.1) MESH 1,2) VELOCITY PROFILE 1.3) PRESSURE PROFILE 1.4) VELOCITY CHART AT LINE 0.85MM FROM INLET 1.6) Animation https://drive.google.com/file/d/1rGUT9MTHIgj6vLhU790afyYrDGwg-8k1/view?usp=sharing 2) GF = 0.2 2.1) MESH 2.2) VELOCITY PROFILE 2.3) PRESSURE PROFILE 2.4) VELOCITY CHART AT LINE 0.85MM FROM INLET 2.6) Animation https://drive.google.com/file/d/1dIVgYYcxCxOFmeZep3EqKP0X-G25AWu-/view?usp=sharing CONCLUSION From the results we can conclude the following points:- 1) The flow is laminar and fast at inlet and slows down after the step and near the wall. 2) Presence of vortice can be found right after the step due to the pressure difference. 3) Steady state is achieved near the 25th step. 4) Case 1 with no grading factor gives the smoother plot for velocity as compared to the 2nd plot with 0.2 grading factor but no much difference in the slopes.akarsh@DESKTOP-0FNFUIA:~$ tut
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials$ incompressible/
-bash: incompressible/: Is a directory
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials$ cd incompressible/
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible$ ls
SRFPimpleFoam adjointShapeOptimisationFoam icoFoam pisoFoam shallowWaterFoam
SRFSimpleFoam boundaryFoam pimpleFoam porousSimpleFoam simpleFoam
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible$ cd icoFoam/
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam$ ls
cavity elbow
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam$ cd cavity/
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam/cavity$ ls
Allclean Allrun cavity cavityClipped cavityGrade
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam/cavity$ cd cavity
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam/cavity/cavity$ ls
0 constant system
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam/cavity/cavity$ cd ..
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam/cavity$ cp -r cavity/ $FOAM_RUN/case_1
akarsh@DESKTOP-0FNFUIA:/opt/openfoam10/tutorials/incompressible/icoFoam/cavity$ run
akarsh@DESKTOP-0FNFUIA:~/OpenFOAM/akarsh-10/run$ ls
case_1 case_2 cavity flange_te flange_test pitzDaily
akarsh@DESKTOP-0FNFUIA:~/OpenFOAM/akarsh-10/run$ cd case_1/
akarsh@DESKTOP-0FNFUIA:~/OpenFOAM/akarsh-10/run/case_1$ ls
0 constant system
akarsh@DESKTOP-0FNFUIA:~/OpenFOAM/akarsh-10/run/case_1$/*--------------------------------*- 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 1;
vertices
(
// vertices from point 0 to 10
(0 0 0)
(0.08 0 0)
(0.08 0.005 0)
(0 0.005 0)
(0.08 0.01 0)
(0 0.01 0)
(0.2 0.01 0)
(0.2 0.005 0)
(0.2 0 0)
(0.2 -0.01 0)
(0.08 -0.01 0)
// vertices from point 11 to 21
(0 0 0.1)
(0.08 0 0.1)
(0.08 0.005 0.1)
(0 0.005 0.1)
(0.08 0.01 0.1)
(0 0.01 0.1)
(0.2 0.01 0.1)
(0.2 0.005 0.1)
(0.2 0 0.1)
(0.2 -0.01 0.1)
(0.08 -0.01 0.1)
);
blocks
(
// block 1
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 1 1)
//block 2
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 1 1)
//block 3
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (1 1 1)
//block 4
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (1 1 1)
//block 5
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(11 14 3 0)
(14 16 5 3)
);
}
outlet
{
type patch;
faces
(
(6 17 18 7)
(8 7 18 19)
(9 8 19 20)
);
}
otherwall //no slip walls
{ type wall;
faces
(
//top
(15 4 5 16)
(15 17 6 4)
//step
(21 12 1 10)
//bottom left
(11 0 1 12)
//bottom right
(21 10 9 20)
);
}
frontAndBack
{
type empty;
faces
( //back
(0 3 2 1)
(3 5 4 2)
(2 4 6 7)
(1 2 7 8)
(10 1 8 9)
//front
(13 15 16 14)
(12 13 14 11)
(20 19 12 21)
(19 18 13 12)
(18 17 15 13)
);
}
);
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 dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 0.001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
//adaptive timestep
/*
adjustTimeStep true;
maxCo 1;*/
// ************************************************************************* ///*--------------------------------*- 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.1 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.2 0 0);
}
outlet
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
otherwall
{
type noSlip; // zero at 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 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;
}
otherwall
{
type zeroGradient;
}
}
// ************************************************************************* //transportProperties
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
// vertices from point 0 to 10
(0 0 0)
(0.08 0 0)
(0.08 0.005 0)
(0 0.005 0)
(0.08 0.01 0)
(0 0.01 0)
(0.2 0.01 0)
(0.2 0.005 0)
(0.2 0 0)
(0.2 -0.01 0)
(0.08 -0.01 0)
// vertices from point 11 to 21
(0 0 0.1)
(0.08 0 0.1)
(0.08 0.005 0.1)
(0 0.005 0.1)
(0.08 0.01 0.1)
(0 0.01 0.1)
(0.2 0.01 0.1)
(0.2 0.005 0.1)
(0.2 0 0.1)
(0.2 -0.01 0.1)
(0.08 -0.01 0.1)
);
blocks
(
// block 1
hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (0.2 5 1)
//block 2
hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.2 0.2 1)
//block 3
hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (5 0.2 1)
//block 4
hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (5 5 1)
//block 5
hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (5 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(11 14 3 0)
(14 16 5 3)
);
}
outlet
{
type patch;
faces
(
(6 17 18 7)
(8 7 18 19)
(9 8 19 20)
);
}
otherwall //no slip walls
{ type wall;
faces
(
//top
(15 4 5 16)
(15 17 6 4)
//step
(21 12 1 10)
//bottom left
(11 0 1 12)
//bottom right
(21 10 9 20)
);
}
frontAndBack
{
type empty;
faces
( //back
(0 3 2 1)
(3 5 4 2)
(2 4 6 7)
(1 2 7 8)
(10 1 8 9)
//front
(13 15 16 14)
(12 13 14 11)
(20 19 12 21)
(19 18 13 12)
(18 17 15 13)
);
}
);
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 dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 0.001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
//adaptive timestep
/*
adjustTimeStep true;
maxCo 1;*/
// ************************************************************************* ///*--------------------------------*- 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.1 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.2 0 0);
}
outlet
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
otherwall
{
type noSlip; // zero at 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 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;
}
otherwall
{
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;
// ************************************************************************* //







