Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

Objective :

1.Transient simulation of an incompressible-laminar-viscous flow through the backward facing step geometry

2. Have to perform 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).

3. Have to compare velocity profil at 0.085 m from the inlet of the geomentry for the both cases.

4.Explain why Grading/Growth factor is essential for meshing.

Geomentry :

The backward facing step geometry with specifications is given. This geometry is to be simulated 2 dimensionally,
recreating the geometry as blocks, we get to see the following arrangement with all the vertices given.

Geometry Creation:

Let us consider creating the geometry using 5 blocks as shown in the figure below,

Case 1 - Simulate the flow without using any grading factor:

As per the geometry and the blocks we edit the blockMeshDict file so that it has all the vertices from 0-21, 5 blocks without grading factor and specifying the type of each boundary.

  • BlockMeshDict:

/*--------------------------------*- C++ -*----------------------------------*\
========= |

\\ / F ield | OpenFOAM: The Open Source CFD Toolbox

\\ / O peration | Website: https://openfoam.org

\\ / A nd | Version: 10

\\/ M anipulation |

\*---------------------------------------------------------------------------*/

FoamFile

{

format ascii;

class dictionary;

object blockMeshDict;

}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.1;

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.1)

(8 0 0.1)

(8 0.5 0.1)

(0 0.5 0.1)

(8 1 0.1)

(0 1 0.1)

(20 1 0.1)

(20 0.5 0.1)

(20 0 0.1)

(20 -1 0.1)

(8 -1 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

(

);

// ************************************************************************* //

  • ControlDict

/*--------------------------------*- C++ -*----------------------------------*\
========= |

\\ / F ield | OpenFOAM: The Open Source CFD Toolbox

\\ / O peration | Website: https://openfoam.org

\\ / A nd | Version: 10

\\/ 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;


// ************************************************************************* //

  • Pressure p code

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 10
\\/ 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;
}
}

}

// ************************************************************************* //

  • Velocity U code

/*--------------------------------*- C++ -*----------------------------------*\
========= |

\\ / F ield | OpenFOAM: The Open Source CFD Toolbox

\\ / O peration | Website: https://openfoam.org

\\ / A nd | Version: 10

\\/ 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 (0.2 0 0);
}

outlet
{
type zeroGradient;
}

frontAndBack
{
type empty;
}
otherwall
{
type noSlip; // zero at walls
}
}

// ************************************************************************* //

  • Transporet Property

/*--------------------------------*- C++ -*----------------------------------*\
========= |

\\ / F ield | OpenFOAM: The Open Source CFD Toolbox

\\ / O peration | Website: https://openfoam.org

\\ / A nd | Version: 10

\\/ M anipulation |

\*---------------------------------------------------------------------------*/

FoamFile

{

format ascii;

class dictionary;

location "constant";

object physicalProperties;

}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu [0 2 -1 0 0 0 0] 0.00001;


// ************************************************************************* //

Post-Processing Results :

  • Surface with edges

  • Velocity Profile U

  • Velocity Plot

velocity profile at x = 0.085 m without grading factor

Case 2: Simulating the flow with grading factor 0.2

This simulation is similar the previous one but has a change in the grading factors for the blocks and that needs

to be edited.

All other files [ controlDict, initial pressure and velocity conditions and transport properties ] are same.

  • BlockMeshDict :

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 10
\\/ M anipulation |
\*---------------------------------------------------------------------------*/

FoamFile

{

format ascii;

class dictionary;

object blockMeshDict;

}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.1;

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.1)

(8 0 0.1)

(8 0.5 0.1)

(0 0.5 0.1)

(8 1 0.1)

(0 1 0.1)

(20 1 0.1)

(20 0.5 0.1)

(20 0 0.1)

(20 -1 0.1)

(8 -1 0.1)

);

blocks

(

// block 1

hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 5 1)

// block 2

hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 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 5 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
(
);

Post-Processing Results :

  • Surface with edges:

  • Velocity Profile:

  • Velocity Plot:

Conclusion :

There is a small change in velocity profiles when grading size decreases we get fine mesh.

The Grading factor of 0.2 shows fine mesh.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.