Project

Flow over a Backward facing step in OpenFOAM

The blockMeshDict file has been edited to obtain the geometry as follows:

For ungraded mesh, the grading factor is kept as 1. Also to ensure proper capture of flow properties at the boundaries, grading factor of 0.2 is kept at walls so that mesh is fine in that section.

Mesh grading factor= Size of last cell/Size of the first cell

  • When mesh grading factor<<1, the mesh is finer at the end as compared to start of blockMesh.
  • When mesh grading factor>>1, the mesh is finer at the start as compared to end of blockMesh.

BLOCKMESHDICT FILE:(no grading)

/*--------------------------------*- C++ -*----------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  4.1                                   |
|   \\\\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\\\/     M anipulation  |                                                 |
\\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.01;

vertices
(
    (0 0 0)    //0
    (8 0 0)    //1
    (8 0.5 0)   //2
    (0 0.5 0)   //3
    (0 0 0.1)   //4
    (8 0 0.1)   //5
    (8 0.5 0.1)   //6
    (0 0.5 0.1)  //7
    (0 1 0)    //8
    (8 1 0)    //9
    (0 1 0.1)   //10
    (8 1 0.1)   //11
    (8 -1 0)   //12
    (20 -1 0)   //13
    (20 -0.5 0)   //14
    (8 -0.5 0)   //15
    (8 -1 0.1)   //16
    (20 -1 0.1)   //17
    (20 -0.5 0.1)   //18
    (8 -0.5 0.1)   //19
    (20 0 0)   //20
    (20 0.5 0)   //21
    (20 0 0.1)   //22
    (20 0.5 0.1)   //23
    (20 1 0)   //24
    (20 1 0.1)   //25
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (1 1 1)
    hex (3 2 9 8 7 6 11 10 ) (80 5 1) simpleGrading (1 1 1)
    hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (1 1 1)
    hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (1 1 1)
    hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (1 1 1)
    hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (1 1 1)
);

edges
(
);

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

mergePatchPairs
(
);

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

Initial condition for Pressure :

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

    noslipwall
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

Initial condition for Velocity:

Here 0.5 m/s is taken as the inlet velocity. The initial velocity is selected to satisfy the Courant number criteria which should be less than 1. Only then the solution will converge.

/*--------------------------------*- C++ -*----------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  4.1                                   |
|   \\\\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\\\/     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.5 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    noslipwall
    {
        type            noSlip;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

Ungraded Mesh:

Velocity Profile

When Grading Factor = 0.2

blocks
(
    hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (0.2 5 1)
    hex (3 2 9 8 7 6 11 10) (80 5 1) simpleGrading (0.2 0.2 1)
    hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (5 0.2 1)
    hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (5 5 1)
    hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (5 0.2 1)
    hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (5 5 1)
);

Velocity Profile

When Grading Factor = 0.5

blocks
(
    hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (0.5 2 1)
    hex (3 2 9 8 7 6 11 10) (80 5 1) simpleGrading (0.5 0.2 1)
    hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (2 0.2 1)
    hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (2 2 1)
    hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (2 0.5 1)
    hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (2 5 1)
);

Velocity Profile

When Grading Factor = 0.8

blocks
(
    hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (0.8 1.25 1)
    hex (3 2 9 8 7 6 11 10) (80 5 1) simpleGrading (0.8 0.2 1)
    hex (2 21 24 9 6 23 25 11) (120 5 1) simpleGrading (1.25 0.2 1)
    hex (1 20 21 2 5 22 23 6) (120 5 1) simpleGrading (1.25 1.25 1)
    hex (15 14 20 1 19 18 22 5) (120 5 1) simpleGrading (1.25 0.8 1)
    hex (12 13 14 15 16 17 18 19) (120 5 1) simpleGrading (1.25 5 1)
);

Velocity Profile

RESULT:

We can see that as we increase the grading factor from 0.2 to 0.8, there is not much difference,but this will have major effect for much larger change in grading factor.

As we decrease the grading factor, the mesh becomes finer and finer. This makes the solution becomes more accurate.

In all the plots, velocity at point 0.085m from the inle,t is 0.55 m/s . From this we can conclude that ,at the mesh near the step ,the velocity is maximum.

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.