Week 8 - Simulation of a backward facing step in OpenFOAM
Aim
· To simulate an incompressible-laminar-viscous flow through the backward facing step geometry
· To Simulate the flow without using any grading factor (i.e., GF = 1)
· To Simulate the flow with grading factor of 0.2. The cells should be finer near the walls (including the step wall).
· To perform 2 case studies as described below and compare the results.
1. Case 1 - Simulate the flow without using any grading factor (i.e., GF = 1)
2. Case 2 - Simulate the flow with grading factor of 0.2. The cells should be finer near the walls (including the step wall).
Introduction
Typical Openfoam folder consists system and constant folder
A system folder consists of ‘controldict’, ‘fvSchemes’ and ‘fvsolution’ files which is used specifying the numerical schemes and control the solution procedure. System also contain blockMeshDict which helps to create the block which helps to create the geometry and mesh
Constant folder contains ‘polymesh’ and ‘transport properties’. The polyMesh directory outlining the various aspects of the mesh such as 'boundary', 'points', 'faces', etc., and a file that defines the physical properties.
A time directory, usually called the '0' directory that consists of files representing the different fields or fluid flow properties with values as required at the start of simulation run or at time t=0">t=0.
Analysis Procedure
Identify the suitable governing equation from “FOAM_TUTORIALS” folder. Copy to “FOAM_RUN” folder
By updating the blockMeshDict file we can define the geometry, boundary and mesh parameters.
By updating the files in ‘0’ directory folder. U' and 'p', with the boundary list as specified in the 'blockMeshDict' file and appropriate values at the relevant boundary to ensure the given numerical problem has the right boundary conditions and that the solution would be correctly initialised.
Updating the 'controlDict' file, in this case the 'deltaT' and 'endTime' parameters with values that take into consideration domain specific attributes such as length of the domain in the direction of flow, fluid flow velocity and avoiding violation of Courant-Friedrichs-Lewy Condition or the CFL number by limiting its mean and maximum value during simulation run below
Geometry
Mesh specification
Number of cells along the x direction (longer dimension) = 200
Number of cells along the longer y direction = 20;


Front and back of the block (type empty)
0 1 2 3 4 5 6 7
1 8 9 2 5 10 11 6
12 13 8 1 14 15 10 5
Inlet (type Patch)
0 4 7 3
Outlet (type Patch)
8 9 11 10
13 8 10 15
No slip wall (Top and Bottom) (Type wall)
7 6 2 3 6 11 9 2
0 1 5 4 1 12 14 5
12 13 15 14
Code for case 1
flow without using any grading factor (i.e., GF = 1)
blockMeshDict
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.1;
vertices
(
(0 0 0)
(8 0 0)
(8 1 0)
(0 1 0)
(0 0 0.1)
(8 0 0.1)
(8 1 0.1)
(0 1 0.1)
(20 0 0)
(20 1 0)
(20 0 0.1)
(20 1 0.1)
(8 -1 0)
(20 -1 0)
(8 -1 0.1)
(20 -1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (80 10 1) simpleGrading (1 1 1)
hex (1 8 9 2 5 10 11 6) (120 10 1) simpleGrading (1 1 1)
hex (12 13 8 1 14 15 10 5) (120 10 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(8 9 11 10)
(13 8 10 15)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(1 2 9 8)
(12 1 8 13)
(4 5 6 7)
(5 10 11 6)
(14 15 10 5)
);
}
noslipwalls
{
type wall;
faces
(
(7 6 2 3)
(6 11 9 2)
(0 1 5 4)
(1 12 14 5)
(12 13 15 14)
);
}
);
// ************************************************************************* //
controlDict
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Velocity file / volVectorField
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ 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;
}
noslipwalls
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Pressure file / volScalerField
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ 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;
}
noslipwalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Code for case 2
flow with grading factor of 0.2. The cells should be finer near the walls (including the step wall).
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.1;
vertices
(
(0 0 0)
(8 0 0)
(8 1 0)
(0 1 0)
(0 0 0.1)
(8 0 0.1)
(8 1 0.1)
(0 1 0.1)
(20 0 0)
(20 1 0)
(20 0 0.1)
(20 1 0.1)
(8 -1 0)
(20 -1 0)
(8 -1 0.1)
(20 -1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (80 10 1) simpleGrading (0.2 0.2 1)
hex (1 8 9 2 5 10 11 6) (120 10 1) simpleGrading (5 0.2 1)
hex (12 13 8 1 14 15 10 5) (120 10 1) simpleGrading (5 5 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(8 9 11 10)
(13 8 10 15)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(1 2 9 8)
(12 1 8 13)
(4 5 6 7)
(5 10 11 6)
(14 15 10 5)
);
}
noslipwalls
{
type wall;
faces
(
(7 6 2 3)
(6 11 9 2)
(0 1 5 4)
(1 12 14 5)
(12 13 15 14)
);
}
);
// ************************************************************************* //
Velocity file / volVectorField
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ 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;
}
noslipwalls
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Pressure file / volScalerField
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ 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;
}
noslipwalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Results
Case 1
Solid colour surface with edges

Velocity Profile

Velocity Line plot
velocity profile at 0.085 m from the inlet of the geometry

Case 2:
Solid colour surface with edges

Velocity Profile

Velocity Line plot
velocity profile at 0.085 m from the inlet of the geometry

CONCLUSION:
1. By Observing the velocity line plot, we get different plots for different grading factor at same location.
2. Grading factor fines the mesh at required location which helps more clear result especially in critical areas in simulation model.
3. Overall, the change in the size of simple grading factor (mesh size) the results remain the same as approximately.