Project

BlockMesh Drill Down for Flow Over a Backward Facing Step

Objective:

The objective of this project is to generate the Blockmesh file for a Backward Facing Step using OpemFoam and to simulate flow over the backward-facing step geometry using the icoFoam solver. IcoFoam solver is a transient solver for incompressible, laminar flow for Newtonian FLuids. After the simulation, post-processing is done to analyze the obtained results especially near the step zone and understand the effect of grading scheme on the velocity profile.

Steps:

  • The geometry is divided into 5 blocks and each block is defined individually.
  • Number of mesh cells along X-direction = 200
  • Number of mesh cells along Y-direction = 10
  • Grading Scheme used is 0.2, 0.5 and 0.8
  • Grading Factor near all walls is 0.2 for computational efficiency.
  • Relevant boundary condition is assigned to each generated walls.
  • Initial Condition data is passed to the solver for Pressure and Velocity from the respective files in folder 0.
  • After the case setup is completed, blockMesh command is executed in the terminal to generate the mesh.
  • After mesh generation, icoFoam command is executed in the terminal to initiate the icoFoam solver.
  • The results obtained are analyzed using ParaView software.

Assumptions:

  • End Time = 0.01 sec
  • Time Step (dt) = 1e-5 sec
  • Inlet Velocity = 2 m/s

The time step and velocity is assumed such that the Courant Number given by U*(dx/dt) is less than 1. This criterion is important for the solution to converge.

The Block-Mesh File for Geometry with Grading Factor as 0.5

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

convertToMeters 0.01;

vertices
(
    (0 0 0) // v0
    (8 0 0) // v1
    (8 0.5 0) // v2
    (0 0.5 0) // v3
    (8 1 0) // v4
    (0 1 0) // v5
    (20 1 0) // v6
    (20 0.5 0) // v7
    (20 0 0) // v8
    (20 -1 0) // v9
    (8 -1 0) // v10
    (0 0 0.1) // v11
    (8 0 0.1) // v12
    (8 0.5 0.1) // v13
    (0 0.5 0.1) // v14
    (8 1 0.1) // v15
    (0 1 0.1) // v16
    (20 1 0.1) // v17
    (20 0.5 0.1) // v18
    (20 0 0.1) // v19
    (20 -1 0.1) // v20
    (8 -1 0.1) // v21

);

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

edges
(
);

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

mergePatchPairs
(
);

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

End-Time and Time-Step data is passed to the solver through the controlDict File.

controlDict File

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  7
     \\\\/     M anipulation  |
\\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    \"system\";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.01;

deltaT          1e-5;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

Pressure Initial Condition is setup from the Pressure File in folder 0. Relevant Pressure Data is applied at inlet wall, outlet wall, side walls and top and bottom walls.

Pressure File

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

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

Finally, the appropriate velocity condition is assigned to each wall. Inlet Velocity = 2m/s and top and botoom wall have no-slip conditions.

Velocity File

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

    outlet
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }

    noslipwalls
    {
        type            noSlip;
    }
}

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

RESULTS:

For Mesh Grading Factor = 0.5

Geomtery of Backward Facing Step with generated BlockMesh

Velocity Pattern along the direction of Fluid Flow

Pressure Gradient along length of Geometry

Velocity Plot for Grading Factor = 0.5

Velocity Plot for Grading Factor = 0.2

Velocity Plot for Grading Factor = 0.8

As it can be seen from the velocity profile line plot, as the grading factor increases, the mesh becomes fine and the accuracy of obtained velocity profile increases. The Velocity plot for factor = 0.8 clearly shows that velocity reaches its maximum value of 2.85 m/s for x = 0.085m from the origin, i.e just after the step. Although there is not much difference in the velocity plots obtained, this difference can significantly increase for greater variations in Grading Factor.

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.