Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

Incompressible flow : In fluid dynamics, incompressible flow refers to a flow in which the density remains constant in any fluid parcel, i.e. any infinitesimal volume of fluid moving in the flow.

Laminar flow : Fluid (gas or liquid) flow in which the fluid travels smoothly or in regular paths .In laminar flow, sometimes called streamline flow, the velocity, pressure, and other flow properties at each point in the fluid remain constant. Laminar flow over a horizontal surface may be thought of as consisting of thin layers, or laminae, all parallel to each other. The fluid in contact with the horizontal surface is stationary, but all the other layers slide over each other.

Reynolds number is used to differentiate the flow between laminar and turblent.For flow in a pipe of diameter D, experimental observations show that laminar flow occurs when ReD < 2300 and turbulent flow occurs when ReD > 2900.

Viscous Flow : The fluid flow in which frictional effects become signification, are treated as viscous flow. When two fluid layers move relatively to each other, frictional force develops between them which is quantified by the fluid property 'viscosity'. Boundary layer flows are the example of viscous flow.

The flow which contains all these effects is called incompressible -laminar -viscous flow.

blockMeshDict;

/*--------------------------------*- 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 1;

vertices

(

(0 0 0) //vertex 0

(8 0 0) //vertex 1

(8 1 0) //vertex 2

(0 1 0) //vertex 3

(14 0 0) //vertex 4

(14 1 0) //vertex 5

(20 0 0) //vertex 6

(20 1 0) //vertex 7

(8 -1 0) //vertex 8

(14 -1 0) //vertex 9

(20 -1 0) //vertex 10

(0 0 10) //vertex 11

(8 0 10) //vertex 12

(8 1 10) //vertex 13

(0 1 10) //vertex 14

(14 0 10) //vertex 15

(14 1 10) //vertex 16

(20 0 10) //vertex 17

(20 1 10) //vertex 18

(8 -1 10) //vertex 19

(14 -1 10) //vertex 20

(20 -1 10) //vertex 21

);

blocks

(

hex (0 1 2 3 11 12 13 14) (200 20 1) simpleGrading (1 1 1)

hex (1 4 5 2 12 15 16 13) (200 20 1) simpleGrading (1 1 1)

hex (4 6 7 5 15 17 18 16) (200 20 1) simpleGrading (1 1 1)

hex (9 10 6 4 20 21 17 15) (200 20 1) simpleGrading (1 1 1)

hex (8 9 4 1 19 20 15 12) (200 20 1) simpleGrading (1 1 1)

);

edges

(

);

boundary

(

inlet

{

type patch;

faces

(

(0 3 14 11)

);

}

outlet

{

type patch;

faces

(

(6 17 18 7)

(10 21 17 6)

);

}

frontAndBack

{

type empty;

faces

(

(0 1 2 3)

(1 4 5 2)

(4 6 7 5)

(9 10 6 4)

(8 9 4 1)

(11 14 13 12)

(12 13 16 15)

(15 16 18 17)

(20 15 17 21)

(19 12 15 20)

);

}

noslipwalls

{

type wall;

faces

(

(2 13 14 3)

(5 16 13 2)

(7 18 16 5)

(9 20 21 10)

(8 19 20 9)

(1 12 19 8)

(0 11 12 1)

);

}

);

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 0.1; deltaT 1e-5; 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; } noslipwalls { 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 (1 0 0); } outlet { type zeroGradient; } frontAndBack { type empty; } noslipwalls { type zeroGradient; }} // ************************************************************************* //

After this;-

  1. After required modifications we change the directory to cavity and run ‘blockMesh’ command to create the blocks and mesh for the BFS. we can check the mesh using ‘checkMesh’ command.
  2. Then we run the solver using ‘icoFom’ command. This will take few minutes to hours as depending upon processors computational power.
  3. After the solver has run, we can post process the solution in paraview using ‘paraFoam’ command.

For Grading Fator = 0.2

BlockMeshDict:

/*--------------------------------*- 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.02;

vertices

(

(0 0 0) //vertex 0

(8 0 0) //vertex 1

(8 1 0) //vertex 2

(0 1 0) //vertex 3

(14 0 0) //vertex 4

(14 1 0) //vertex 5

(20 0 0) //vertex 6

(20 1 0) //vertex 7

(8 -1 0) //vertex 8

(14 -1 0) //vertex 9

(20 -1 0) //vertex 10

(0 0 10) //vertex 11

(8 0 10) //vertex 12

(8 1 10) //vertex 13

(0 1 10) //vertex 14

(14 0 10) //vertex 15

(14 1 10) //vertex 16

(20 0 10) //vertex 17

(20 1 10) //vertex 18

(8 -1 10) //vertex 19

(14 -1 10) //vertex 20

(20 -1 10) //vertex 21

);

blocks

(

hex (0 1 2 3 11 12 13 14) (200 20 1) simpleGrading (.2 1 1)

hex (1 4 5 2 12 15 16 13) (200 20 1) simpleGrading (5 1 1)

hex (4 6 7 5 15 17 18 16) (200 20 1) simpleGrading (.2 1 1)

hex (9 10 6 4 20 21 17 15) (200 20 1) simpleGrading (.2 1 1)

hex (8 9 4 1 19 20 15 12) (200 20 1) simpleGrading (5 1 1)

);

edges

(

);

boundary

(

inlet

{

type patch;

faces

(

(0 3 14 11)

);

}

outlet

{

type patch;

faces

(

(6 17 18 7)

(10 21 17 6)

);

}

frontAndBack

{

type empty;

faces

(

(0 1 2 3)

(1 4 5 2)

(4 6 7 5)

(9 10 6 4)

(8 9 4 1)

(11 14 13 12)

(12 13 16 15)

(15 16 18 17)

(20 15 17 21)

(19 12 15 20)

);

}

noslipwalls

{

type wall;

faces

(

(2 13 14 3)

(5 16 13 2)

(7 18 16 5)

(9 20 21 10)

(8 19 20 9)

(1 12 19 8)

(0 11 12 1)

);

}

);

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 0.05;

deltaT 5e-6;

writeControl timeStep;

writeInterval 100;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

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

All other Velocity & Pressure directory will be same.

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.

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.