Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

Backward Facing Flow:

when flow enters the domain from inlet,after some time the flow reaches the step, because of expansion of flow channel, pressure gradient exists, it detaches and a recirculation zone is formed. A turbulent boundary layer encounters a sudden back step, causing flow separation. Later the flow eventually reattaches to the bottom wall.

Why Flow seperation and Flow reversal zone occurs

Here inlet area is lower than Outlet area(`A_iltA_o`),hence inlet pressure is lower than outlet pressure(`p_iltp_o`).this condition is known as Adverse pressure gradient, because fluid flowing from lower pressure(`p_i`) to higher pressure(`p_o`).This condition happens because of BERNOULLI'S Principle. i.e flow flowing from Higher energy(inlet) to lower energy region(outlet).

Due to sudden enlargement,flow seperation occurs. Due to Adverse pressure gradient,fluid particles at No Slip condition(near wall,velocity =0),tend to flow reverse direction.hence Flow reversal zone occurs and due to this turbulent eddies will form.

SOLVER Selection:

OpenFOAM does not have a generic solver applicable to all cases. Instead, users must choose a specific solver and tutorial for a class of problems to solve.

given :Incompressible-laminar-viscous flow

Hence for given Incompressible-laminar-viscous flow, ICOFOAM is suitable solver and tutorial

Formation of Mesh:

Firstly navigate to icoFoam tutorial folder and copy cavity directory and paste in local folder.

In system folder, edit "blockMeshDict "

  • set suitable units conversion
  • update vertices of geometry as per given geometry condition
  • update formation of blocks along with mesh specification & Grading factor
  • In order to check created geometry and mesh,ensure boundary conditons are empty and navigate one step back and excute command called "blockMesh".
  • Again edit "blockMeshDict"
  • update boundary specification and ensure type of boundaries are updated correctly(eg:patch,wall,empty)
  • save "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)
    (0 -0.005 0)
    (0 -0.01 0)
    (0.08 0 0)
    (0.08 -0.005 0)
    (0.08 -0.01 0)
    (0.08 -0.015 0)
    (0.08 -0.02 0)
    (0.2 0 0)
    (0.2 -0.005 0)
    (0.2 -0.01 0)
    (0.2 -0.015 0)
    (0.2 -0.02 0)
    (0 0 0.0001)
    (0 -0.005 0.0001)
    (0 -0.01 0.0001)
    (0.08 0 0.0001)
    (0.08 -0.005 0.0001)
    (0.08 -0.01 0.0001)
    (0.08 -0.015 0.0001)
    (0.08 -0.02 0.0001)
    (0.2 0 0.0001)
    (0.2 -0.005 0.0001)
    (0.2 -0.01 0.0001)
    (0.2 -0.015 0.0001)
    (0.2 -0.02 0.0001)
    
);

blocks
(
   hex (1 4 3 0 14 17 16 13) (80 5 1) simpleGrading (1 1 1)

    hex (2 5 4 1 15 18 17 14) (80 5 1) simpleGrading (1 1 1)

    hex (4 9 8 3 17 22 21 16) (120 5 1) simpleGrading (1 1 1)
    
    hex (5 10 9 4 18 23 22 17) (120 5 1) simpleGrading (1 1 1)

    hex (6 11 10 5 19 24 23 18) (120 5 1) simpleGrading (1 1 1)
    
    hex (7 12 11 6 20 25 24 19) (120 5 1) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
 inlet
    {
        type patch;
        faces
        (
            (0 1 14 13) 
            (1 2 15 14)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (8 21 22 9)
            (9 22 23 10)
            (10 23 24 11)
            (11 24 25 12)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 3 4 1)
            (1 4 5 2)
            (3 8 9 4)
            (4 9 10 5)
            (5 10 11 6)
            (6 11 12 7)
            (13 14 17 16)
            (14 15 18 17)
            (16 17 22 21)
            (17 18 23 22)
            (18 19 24 23)
            (19 20 25 24)
        );
    }
    noSlipWalls
    {
        type wall;
        faces
        (
            (0 13 16 3)
            (3 16 21 8)
            (2 5 18 15)
            (5 6 19 18)
            (6 7 20 19)
            (7 12 25 20)
        );
    }   
    
);

mergePatchPairs
(
);

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

Update ControlDict:

The OpenFOAM solvers begin all runs by setting up a database. The database controls I/O and, since output of data is usually requested at intervals of time during the run, time is an inextricable part of the database. The controlDict dictionary sets input parameters essential for the creation of the database.

while setting time step "dt",ensure it has to satisfy Courant-Friedrichs-Lewy conditions(`cle1`)

where `c=nu*dt/dx^2`

here kinematic visocity `nu=0.01` is updated in transportProperties file in Constant folder

calculation of mesh size `dx`

we know,

grading factor=(meshsize of finemesh)/(meshsize of coarse mesh)

dx = mesh size of fine mesh

let grading factor =0.2(smallest)

mesh size of coarse mesh = 0.004

dx=0.004*0.2

dx=0.0008

`c=0.01*(0.00001/0.0008^2)`

`c=0.15625`

hence `clt1`,it satisfy Courant-Fried-Lewy conditions

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

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

Update Initial and Boundary condition:

For velocity(U):

/*--------------------------------*- 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            noSlip;
    }
    
}

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

For pressure(p):

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

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

After updation of all above parameters, run "blockMesh" command to update boundary condition in "blockMeshDict" file.

After run "icoFoam" command

finally run "paraFoam" command.

In paraview for "plot over line" tool,Navagite to filter option and use search option to find "plot over line".Finally update points(0.085 -0.02 0) & (0.085 0 0).and click apply.Finally graph will obtained.

Result:

for grading factor 1:

for grading factor 0.2:

for grading factor 0.5:

Graded mesh:

A graded mesh determines the element density in each region of the model based on the complexity of the geometry. More complex geometry with more angles and cuts will have a higher density of elements to better capture the topographical features. The mesh density grades away from the complex regions.

here geometry topographical is simple,so it doesn't have much effect.but if geometry is complex,mesh grading will give good results.

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.