Project

Blockmesh Analysis of a Backward Facing step

Objective:

  • To generate the geometry and mesh of the step.
  • Implement a grading factor and assess how it affects the velocity magnitude profile.
  • To measure the velocity profile at 0.085m from the inlet.
  • To compare velocity magnitude at the step for different grading factors.

Mesh Specification:

a) Number of cells along x-direction = 200

b) Number of cells along y-direction = 10

In this problem, we simulate the flow through a backward facing step using the icoFoam solver which is an incommpressible, low Reynolds number solver. We observe the changes in the directions of the flow as well as in the magnitude of velocity due to the step.

For meshing, the number of cells in the x direction is taken as 200 and in the y direction as 10. We have used different mesh grading factors to capture the effects of the flow. The thickness (z direction) used is 0.001 m. The step is defined as five separate blocks and the vertices are named accordingly. Mesh grading is used close to the walls to observe the boundary layer and mesh grading is also done near the step to observe the flow separation. No slip conditions are applied at the top and bottom walls and the front and back walls are defined as empty (2D flow).

The start time is 't=0' and the end time is 't=0.2' The time step is chosen as 'dt=0.0001', keeping in mind the Courant number for stability.

A pressure difference is given between the inlet and outlet to facilitate the flow with a constant velocity of 1 m/s.

Following is the code for meshing (Grading factor = 0.8):

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

vertices
(
    (0 0 0)                //0 (in mm)
    (80 0 0)               //1
    (80 5 0)               //2
    (0 5 0)                //3
    (80 10 0)              //4
    (0 10 0)               //5
    (200 10 0)             //6
    (200 5 0)              //7
    (200 0 0)              //8
    (200 -10 0)            //9
    (80 -10 0)             //10
    (0 0 1)                //11 //Thicknes= 1 mm
    (80 0 1)               //12
    (80 5 1)               //13
    (0 5 1)                //14
    (80 10 1)              //15
    (0 10 1)               //16
    (200 10 1)             //17
    (200 5 1)              //18
    (200 0 1)              //19
    (200 -10 1)            //20
    (80 -10 1)             //21
);

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

edges
(
);

boundary
( 
    inlet
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (19 20 9 8)
            (18 19 8 7)
            (17 18 7 6)
        );
    }
    noslipwalls              // no slip condition
    {
        type wall;
        faces
        (
            (15 4 5 16)
            (17 6 4 15)
            (1 12 11 0)
            (21 12 1 10)
            (9 20 21 10)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (11 12 13 14)
            (14 13 15 16)
            (21 20 19 12)
            (12 19 18 13)
            (13 18 17 15)
            (5 4 2 3)
            (3 2 1 0)
            (4 6 7 2)
            (2 7 8 1)
            (1 8 9 10)
        );
    }   
);

mergePatchPairs
(
);

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

The time control code:

/*--------------------------------*- 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;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.2;

deltaT          0.0001;

writeControl    timeStep;

writeInterval   1000;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

The intial conditions 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;
    } 

    noslipwalls
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

The initial conditions for velocity:

/*--------------------------------*- 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 (1 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }   

    noslipwalls
    {
        type            noSlip;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

The postprocessing was done using Paraview. The line probe tool was used to obtain the velocity profile at x=0.085 m from inlet.

Velocity profiles for different grading factors:

i) f=0.8

This grading scheme is the least accurate compared to the other two, f=0.2 and 0.5. It does not properly capture the boundary layer separation and the recirculating flow due to the effect of the step. The velocity profile is similar to the profile that will be observed before the step.

ii) f=0.5

The velocity profile obtained is similar to that of when f=0.8. The effect of flow separation due to the step region is not very well captured.

iii) f=0.2

This grading scheme is the more accurate than the above two. This is because it has a finer mesh near the walls and the step region which allows to capture the effects. From the profile, we see that a boundary layer separation takes place at y=0.005 m. Before the step, the velocity is maximum at the center due to minimum shear stresses. As it approaches the solid surface, the velocity decreases.

As the flow approaches the step, due to the sudden expansion, an adverse pressure gradient acts causing the velocity to decrease (kinetic enegry decreases) and the boundary layer to separate. Adjacent to the step, a recirculating region forms. Downstream of the step ,the flow reattaches to the surface. This separation leads to flow losses.

So we see that as the grading factor increases, the accuracy to visualize the flow decreases.

Courant number:

For f=0.8, the CFL number obtained is 0.3214.

For f=0.5, the CFL number obtained is 0.3224.

For f=0.2, the CFL number obtained is 0.3699.

From this, we observe that as the grading factor increases, the CFL number reduces. This is due to the fact that the CFL number is inversely propotional to the grid spacing 'deltax'. The grading factor 'f=0.2' has the least grid spacing and hence has a high CFL number. But we need to make sure that the grid spacing is not very small, such that the CFL number becomes greater than 1, which can lead to instability and the solution blowing up.

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.