Project

BlockMesh Drill Down Challenge

Objective : Using the icoFOAM solver to simulate the flow through a backward facing step. Creating multiple meshes and comparing results.

Theory :

A backward facing step is generated using OpenFOAM as per the given dimesnsional specifications.

Mesh Specification :

1. Number of cells in x-direction = 200

2. Number of cells in y-direction = 10

3. Grading near the walls = 0.2

Solution steps :

1. Open the tutorials folder by navigating through command prompt. Open folder named incompressible inside it and then navigate to icoFoam folder. Copy the folder named inside icoFoam folder.

2. Paste a copy of cavity folder inside Run folder.

3. Open the blockmesh file in system folder and edit it.

4. Open the \'p\' and \'u\' files and apply boundary conditions for pressure and velocity.

5. Open the ControlDict file and edit time steps according to requirement.

6. Visualise the results using Paraview post procesing tools.

1.For Grading factor of 0.2:

a. BlockMesh 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;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0 0 0)             // Ver 0
    (0.08 0 0)          // Ver 1
    (0.08 0.005 0)      // Ver 2
    (0 0.005 0)         // Ver 3
    (0.08 0.01 0)       // Ver 4  
    (0 0.01 0)          // Ver 5  
    (0.2 0.01 0)        // Ver 6
    (0.2 0.005 0)       // Ver 7
    (0.2 0 0)           // Ver 8
    (0.2 -0.01 0)       // Ver 9
    (0.08 -0.01 0)      // Ver 10
    (0 0 0.001)         // Ver 11
    (0.08 0 0.001)      // Ver 12
    (0.08 0.005 0.001)  // Ver 13
    (0 0.005 0.001)     // Ver 14
    (0.08 0.01 0.001)   // Ver 15
    (0 0.01 0.001)      // Ver 16
    (0.2 0.01 0.001)    // Ver 17
    (0.2 0.005 0.001)   // Ver 18
    (0.2 0 0.001)       // Ver 19
    (0.2 -0.01 0.001)   // Ver 20
    (0.08 -0.01 0.001)  // Ver 21
);

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

edges
(
);

boundary
(
    inletWall
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outletWalls
    {
        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)
            (2 4 6 7)
            (1 2 7 8)
            (10 1 8 9)
            (11 12 13 14)
            (14 13 15 16)
            (13 18 17 15)
            (12 19 18 13)
            (21 20 19 12)
        );
    }
    Noslipwalls
    {
     type wall;
     faces
     (
            (5 16 15 4)
            (4 15 17 6)
            (0 1 12 11)
            (10 9 20 21)
            (1 10 21 12)
     );
    }
);

mergePatchPairs
(
);

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

b. 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.02;

deltaT          1e-5;

writeControl    timeStep;

writeInterval   15;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

c. Pressure Boundary Conditions 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 1;

boundaryField
{
    inletWall
    {
        type            zeroGradient;
    }

    outletWalls
    {
        type            fixedValue;
        value           uniform 0;
    }

    frontAndBack
    {
        type            empty;
    }
    Noslipwalls
    {
        type            zeroGradient;
    }
}

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

d. Velocity Boundary Conditions 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
{
    inletWall
    {
        type            fixedValue;
        value           uniform (3 0 0);
    }

    outletWalls
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
    Noslipwalls
    {
        type            noSlip;
        value           uniform (0 0 0);
    }
}

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

PLOTS:

i. Pressure contour plot

ii. Velocity contour plot

iii. Line plot a distance of 0.085 from x

2. For Grading Factor of 0.5

Only BlockMesh is updated while remaining other conditions remain same.

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

vertices
(
    (0 0 0)             // Ver 0
    (0.08 0 0)          // Ver 1
    (0.08 0.005 0)      // Ver 2
    (0 0.005 0)         // Ver 3
    (0.08 0.01 0)       // Ver 4  
    (0 0.01 0)          // Ver 5  
    (0.2 0.01 0)        // Ver 6
    (0.2 0.005 0)       // Ver 7
    (0.2 0 0)           // Ver 8
    (0.2 -0.01 0)       // Ver 9
    (0.08 -0.01 0)      // Ver 10
    (0 0 0.001)         // Ver 11
    (0.08 0 0.001)      // Ver 12
    (0.08 0.005 0.001)  // Ver 13
    (0 0.005 0.001)     // Ver 14
    (0.08 0.01 0.001)   // Ver 15
    (0 0.01 0.001)      // Ver 16
    (0.2 0.01 0.001)    // Ver 17
    (0.2 0.005 0.001)   // Ver 18
    (0.2 0 0.001)       // Ver 19
    (0.2 -0.01 0.001)   // Ver 20
    (0.08 -0.01 0.001)  // Ver 21
);

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

edges
(
);

boundary
(
    inletWall
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outletWalls
    {
        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)
            (2 4 6 7)
            (1 2 7 8)
            (10 1 8 9)
            (11 12 13 14)
            (14 13 15 16)
            (13 18 17 15)
            (12 19 18 13)
            (21 20 19 12)
        );
    }
    Noslipwalls
    {
     type wall;
     faces
     (
            (5 16 15 4)
            (4 15 17 6)
            (0 1 12 11)
            (10 9 20 21)
            (1 10 21 12)
     );
    }
);

mergePatchPairs
(
);

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

PLOTS:

i. Pressure contour plot

ii. Velocity contour plot

iii. Line plot a distance of 0.085 from x

3. For Grading factor of 0.8

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

vertices
(
    (0 0 0)             // Ver 0
    (0.08 0 0)          // Ver 1
    (0.08 0.005 0)      // Ver 2
    (0 0.005 0)         // Ver 3
    (0.08 0.01 0)       // Ver 4  
    (0 0.01 0)          // Ver 5  
    (0.2 0.01 0)        // Ver 6
    (0.2 0.005 0)       // Ver 7
    (0.2 0 0)           // Ver 8
    (0.2 -0.01 0)       // Ver 9
    (0.08 -0.01 0)      // Ver 10
    (0 0 0.001)         // Ver 11
    (0.08 0 0.001)      // Ver 12
    (0.08 0.005 0.001)  // Ver 13
    (0 0.005 0.001)     // Ver 14
    (0.08 0.01 0.001)   // Ver 15
    (0 0.01 0.001)      // Ver 16
    (0.2 0.01 0.001)    // Ver 17
    (0.2 0.005 0.001)   // Ver 18
    (0.2 0 0.001)       // Ver 19
    (0.2 -0.01 0.001)   // Ver 20
    (0.08 -0.01 0.001)  // Ver 21
);

blocks
(
    hex (0 1 2 3 11 12 13 14) (130 10 1) simpleGrading (1 1.25 1)     //Block 1
    hex (3 2 4 5 14 13 15 16) (130 10 1) simpleGrading (1 0.8 1)   //Block 2
    hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.25 0.8 1)   //Block 3
    hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.25 1.25 1)     //Block 4
    hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.25 1.25 1)    //Block 5
);

edges
(
);

boundary
(
    inletWall
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outletWalls
    {
        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)
            (2 4 6 7)
            (1 2 7 8)
            (10 1 8 9)
            (11 12 13 14)
            (14 13 15 16)
            (13 18 17 15)
            (12 19 18 13)
            (21 20 19 12)
        );
    }
    Noslipwalls
    {
     type wall;
     faces
     (
            (5 16 15 4)
            (4 15 17 6)
            (0 1 12 11)
            (10 9 20 21)
            (1 10 21 12)
     );
    }
);

mergePatchPairs
(
);

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

PLOTS :

i. Pressure Contours plot

ii. Velocity Contours plot

iii. Line plot a distance of 0.085 from x

Conclusion :

  • Changing the grading factordoesnt have a significant impact on the results.
  • Maximum velocity in all cases falls in a certain range.
  • Maximum velocity for grading factor 0.2 is 2.59, for 0.8 is 2.60 and for 0.8 is 2.62 m/s.
  • Velocity contour has less noticable variations.
  • looks like solution is near convergence.
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.