Week 8 - Simulation of a backward facing step in OpenFOAM
QUESTION:
In this challenge, you are going to simulate an incompressible-laminar-viscous flow through the backward-facing step geometry. You should perform a transient simulation. The solver can be chosen based on the described physics of the flow. You need to explain the entire simulation procedure (how you set up the case). You should also provide explanations for every change you make inside the reference case files obtained from OpenFOAM tutorials. You can choose the inlet velocity such that the flow is laminar.
After that, you will perform 2 case studies as described below and compare the results.
Case 1 - Simulate the flow without using any grading factor (i.e., GF = 1)
Case 2 - Simulate the flow with a grading factor of 0.2. The cells should be finer near the walls (includig the step wall).
AIM:
- Measure the velocity profile at 0.085 m from the inlet of the geometry for both case studies and compare. You can use the plot overline tool for this.
- Explain why the Grading/Growth factor is essential for meshing.
Mesh specification:
- Number of cells along the x direction (longer dimension) = 200
- Number of cells along the longer y direction = 20;
Boundary condition specification:
The domain specifications are provided in the following figure.
OBJECTIVE.
To simulate an incompressible-laminar-viscous flow through the backwards-facing step geometry and perform a transient simulation.
Case 1 - To Simulate the flow without using any grading factor (i.e., GF = 1)
Case 2 - To Simulate the flow with a grading factor of 0.2. The cells should be finer near the walls (including the step wall).
Incompressible-laminar-viscous flow.
incompressible flow:
The flow in which there is no change in the density is called the incompressible flow.
Mathematically, an incompressible flow can be expressed as ∇⋅u=0">
∇⋅u=0 Re=ρ⋅v⋅Lμ
where,
ρ = density of the fluid (kg/m3)
u = flow speed (m/s)
L = characteristic linear dimension (m)
μ = dynamic viscosity of the fluid (Pa·s or N·s/m2 or kg/(m·s))
ν = kinematic viscosity of the fluid (m2/s)
Mesh grading.
Mesh grading is a factor that is,
Grading factor
=
Size of the last cell
Size of the first cell
PROCEDURE.
CODING BY USING OPENFORM
CODE.
BLOCKMESHDICT
Without applying the grading factor
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
(0 0 0)
(8 0 0)
(8 0.5 0)
(0 0.5 0)
(8 1 0)
(0 1 0)
(20 1 0)
(20 0.5 0)
(20 0 0)
(20 -1 0)
(8 -1 0)
(0 0 0.6)
(8 0 0.6)
(8 0.5 0.6)
(0 0.5 0.6)
(8 1 0.6)
(0 1 0.6)
(20 1 0.6)
(20 0.5 0.6)
(20 0 0.6)
(20 -1 0.6)
(8 -1 0.6)
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (1 1 1)
hex (3 2 4 5 14 13 15 16) (80 10 1) simpleGrading (1 1 1)
hex (2 7 6 4 13 18 17 15) (120 10 1) simpleGrading (1 1 1)
hex (1 8 7 2 12 19 18 13) (120 10 1) simpleGrading (1 1 1)
hex (10 9 8 1 21 20 19 12) (120 20 1) simpleGrading (1 1 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)
);
}
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)
);
}
noslipwall
{
type wall;
faces
(
(4 5 16 15)
(4 15 17 6)
(0 1 12 11)
(9 20 21 10)
(1 10 21 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
With the applied grading factor 0.2
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
(0 0 0)
(8 0 0)
(8 0.5 0)
(0 0.5 0)
(8 1 0)
(0 1 0)
(20 1 0)
(20 0.5 0)
(20 0 0)
(20 -1 0)
(8 -1 0)
(0 0 0.6)
(8 0 0.6)
(8 0.5 0.6)
(0 0.5 0.6)
(8 1 0.6)
(0 1 0.6)
(20 1 0.6)
(20 0.5 0.6)
(20 0 0.6)
(20 -1 0.6)
(8 -1 0.6)
);
blocks
(
hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (0.2 5 1)
hex (3 2 4 5 14 13 15 16) (80 10 1) simpleGrading (0.2 0.2 1)
hex (2 7 6 4 13 18 17 15) (120 10 1) simpleGrading (5 0.2 1)
hex (1 8 7 2 12 19 18 13) (120 10 1) simpleGrading (5 5 1)
hex (10 9 8 1 21 20 19 12) (120 20 1) simpleGrading (5 5 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)
);
}
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)
);
}
noslipwall
{
type wall;
faces
(
(4 5 16 15)
(4 15 17 6)
(0 1 12 11)
(9 20 21 10)
(1 10 21 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
CONTROLDICT
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 3;
deltaT 1e-3;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
PRESSURE FILE
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ 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;
}
frontAndBack
{
type empty;
}
noslipwall
{
type zeroGradient;
}
}
// ************************************************************************* //
VELOCITY FILE
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ 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 (0.066 0 0);
}
outlet
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
noslipwall
{
type noSlip;
}
}
// ************************************************************************* //
TRANSPORT PROPERTIES
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 1e-6;
// ************************************************************************* //
Without assigning grading factors.

given a grading factor of 0.2.

velocity flow diagram without grading factor.

velocity flow diagram with grading factor 0.2

pressure flow diagram without grading factor.

pressure flow diagram with grading factor of 0.2

graph for velocity vs domain length without grading factor.

graph for velocity vs domain length given grading factor 0.2

CONCLUSION.
Grading factor from the value of 0.2 to 1 makes the mesh finer and gives an accurate solution.
The execution time depends upon the meshing grading factor.