flow in backward facing step using openfoam
objective
To simulate backwards-facing step in Icofoam solver which is transient laminar/transition isothermal solver with a dynamic viscosity of fluid 0.01 meter square per sec and inlet condition of 1 meter per sec for hydraulic diameter as 0.01meter.
Meshing in OpenFOAM and initial conditions pressure and velocity
1- meshing
simple block mesh
x=1 meter, y=1meter ,z = 1meter
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20)simpleGrading (1 1 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20)simpleGrading (0.2 1 1)
);
in x-direction `expansion ratio = (east cell)/west cell`that is in this case 0.2
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20)simpleGrading (1 0.2 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20)simpleGrading (0.2 0.2 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20)simpleGrading (5 5 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20)
simpleGrading
(
( //x direction divided in three division
(0.2 0.25 10) //20% lines in division 1 , 25% of total cell in 1 division,8 grading
(0.2 0.50 2) //20% lines in division 1 , 20% of total cell in 2 division,2 grading
(0.2 0.25 0.2)//20% lines in division 1 , 25% of total cell in 3 division,2/10 grading
)
1 1) // ydirection and z diection grading 1 1
);
hex (0 1 2 3 4 5 6 7) (20 20 20)
simpleGrading
(
( //x direction divided in three division
(0.20 0.25 10) //20% lines in division 1 , 25% of total cell in 1 division,8 grading
(0.60 0.50 2) //20% lines in division 1 , 20% of total cell in 2 division,2 grading
(0.20 0.25 0.2)//20% lines in division 1 , 25% of total cell in 3 division,2/10 grading
)
( //y direction divided in three division
(0. 0.25 10) //20% lines in division 1 , 25% of total cell in 1 division,8 grading
(0.60 0.50 2) //20% lines in division 1 , 60% of total cell in 2 division,2 grading
(0.20 0.25 0.2)//20% lines in division 1 , 25% of total cell in 3 division,2/10 grading
)
1) // z diection grading 1 1
backwards-facing geometry and meshing
/*--------------------------------*- 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 1;
vertices
(
(0 0 0) // vertex number 0
(0.12 0 0) // vertex number 1
(-0.08 0.01 0) // vertex number 2
(0 0.01 0) // vertex number 3
(0.12 0.01 0) // vertex number 4
(-0.08 0.015 0) // vertex number 5
(0 0.015 0) // vertex number 6
(0.12 0.015 0) // vertex number 7
(-0.08 0.02 0) // vertex number 8
(0 0.02 0) // vertex number 9
(0.12 0.02 0) // vertex number 10
(0 0 1) // vertex number 11
(0.12 0 1) // vertex number 12
(-0.08 0.01 1) // vertex number 13
(0 0.01 1) // vertex number 14
(0.12 0.01 1) // vertex number 15
(-0.08 0.015 1) // vertex number 16
(0 0.015 1) // vertex number 17
(0.12 0.015 1) // vertex number 18
(-0.08 0.02 1) // vertex number 19
(0 0.02 1) // vertex number 20
(0.12 0.02 1) // vertex number 21
);
blocks
(
hex (2 3 6 5 13 14 17 16) (80 5 1)
simpleGrading
(
1
(
(0.2 0.3 5) //y directional 20 percecent lines ,30 percent_cell,expansion5
(0.6 0.4 1)
(0.2 0.3 0.2)//(1:5 0.2 simple grading factor)
)
1
)
hex (5 6 9 8 16 17 20 19) (80 5 1)
simpleGrading
(
1
(
(0.2 0.3 5) //y directional 20 percecent lines ,30 percent_cell,expansion5
(0.6 0.4 1)
(0.2 0.3 0.2)//(1:5 0.2 simple grading factor)
)
1
)
hex (0 1 4 3 11 12 15 14) (120 10 1)
simpleGrading
(
1
(
(0.2 0.3 5) //y directional 20 percecent lines ,30 percent_cell,expansion5
(0.6 0.4 1)
(0.2 0.3 0.2)//(1:5 0.2 simple grading factor)
)
1
)
hex (3 4 7 6 14 15 18 17) (120 5 1)
simpleGrading
(
1
(
(0.2 0.3 5) //y directional 20 percecent lines ,30 percent_cell,expansion5
(0.6 0.4 1)
(0.2 0.3 0.2)//(1:5 0.2 simple grading factor)
)
1
)
hex (6 7 10 9 17 18 21 20) (120 5 1)
simpleGrading
(
1
(
(0.2 0.3 5) //y directional 20 percecent lines ,30 percent_cell,expansion5
(0.6 0.4 1)
(0.2 0.3 0.2)//(1:5 0.2 simple grading factor)
)
1
)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(2 5 16 13)
(5 8 19 16)
);
}
outlet
{
type patch;
faces
(
(1 4 15 12)
(4 7 18 15)
(7 10 21 18)
);
}
noslipwall
{
type wall;
faces
(
(2 13 14 3)
(3 14 11 0)
(0 11 12 1)
(8 19 20 9)
(9 20 21 10)
);
}
frontandback
{
type empty;
faces
(
(13 14 17 16)
(11 12 15 14)
(14 15 18 17)
(16 17 20 19)
(17 18 21 20)
(2 3 6 5)
(0 1 4 3)
(3 4 7 6)
(5 6 9 8)
(6 7 10 9)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
0.2 grading mesh-like described above in BlockMeshDict
0.5 grading mesh-like described above in BlockMeshDict
0.8 grading mesh-like described above in BlockMeshDict
Contradict
`C ≡ (u∆t )/dx`;`
courant number is important if it gets too high simulation will stop.
/*--------------------------------*- 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; //latestTime more useful than start time
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 1e-5;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
initial conditions velocity and pressure
at inlet fluid having dynamic viscosity of 0.01 is flowing with a velocity of one-meter per sec
/*--------------------------------*- 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;
}
noslipwall
{
type zeroGradient;
}
frontandback
{
type empty;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
noslipwall
{
type zeroGradient;
}
frontandback
{
type empty;
}
}
// ************************************************************************* //
/*--------------------------------*- 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 0 0);
}
outlet
{
type zeroGradient;
}
noslipwall
{
type noSlip;
}
frontandback
{
type empty;
}
}
// ************************************************************************* //
finite volume scheme and finite volume solution
/*--------------------------------*- 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss limitedLinearV 1;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //
/*--------------------------------*- 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 fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.05;
}
pFinal
{
$p;
relTol 0;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 2;
}
// ************************************************************************* //
postprocessing of results
Below image shows the velocity distribution of the backwards-facing step
above images show how velocity is developing in backwards-facing step after taking of step by fluid velocity is decreased and that is shown in plotting section
plotting results at 0.85m of 0.2,0.5 and 0.8 grading factor mesh
above image shows how results are variated for different grading system at a length of 0.85 from an inlet.
conclusion
hence we have simulated backwards-facing step and analysed that how velocity is changed for different meshing grids in OpenFOAM which s transient incompressible laminar/transition layer solver which take dynamic viscosity as transport properties.