Challenge

Week 8 - BlockMesh Drill down challenge

Aim: Study of icoFOAM solver to simulate the flow through a backward-facing step for different meshes by changing the mesh grading factors.

Specifications:

  1. The number of cells along the direction of flow = 200
  2. The number of cells along the y-direction for each block = 10
  3. Inlet Velocity is 1 m/sec.

Boundary condition specifications:

Theory:

Boundary-Layer:

It is the locus of the point at which the velocity of the fluid becomes equal to 99% of the freestream velocity. It is the region in the flow field inside which a fluid flows with high relative velocity. It is the region beyond which there exists no relative motion. The thickness of the boundary layer is the function of the direction of flow. As the fluid flow propagates the nature of the Boundary layer also changes as per the type of flow depending on whether it is laminar, transient, and turbulent.

Boundary-Layer Separation:

It is nothing but the detachment of the boundary layer from a surface. The fluid exerts constant pressure on the surface once it has separated instead of a continually increasing pressure if still attached. Separation of the boundary layers occurs whenever the flow tries to decelerate quickly, that is whenever the outer pressure gradient is negative, or the pressure gradient is positive, sometimes referred to as an adverse pressure gradient.

Flow separation occurs when the velocity at the wall is zero or negative and an inflection point exists in the velocity profile and a positive or adverse pressure gradient occurs in the direction of flow.

OpenFoam is a C++ toolbox for the development of customized numerical solvers, and pre-/post-processing utilities for the solution of continuum mechanics problems, most prominently including computational fluid dynamics(CFD).

Features of OpenFoam

  • Compressible and Incompressible Flows
  • Conjugate Heat Transfer
  • MultiPhase Methods
  • Premixed and Non-Premixed Combustion
  • Analysis and Fluid-Structure Interaction
  • Electromagnetics and Magnetohydrodynamics

Codes:

blockMeshDict File

1) Grading factor 0.2

/*--------------------------------*- 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) (200 10 1) simpleGrading (0.2 1.2 1)
    hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.2 0.2 1) 
    hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.2 0.2 1)
    hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.2 1.2 1)
    hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.2 1.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)
        (0 1 12 11)
        (10 21 12 1)
        (10 9 20 21)
        );
     }
);

mergePatchPairs
(
);

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

2) Grading factor 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) (200 10 1) simpleGrading (0.5 1.5 1)

    hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.5 0.5 1) 

    hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.5 0.5 1)

    hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.5 1.5 1)

    hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.5 1.5 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)

        (0 1 12 11)

        (10 21 12 1)

        (10 9 20 21)

        );

     }

);



mergePatchPairs

(

);



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

3) Grading factor 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 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) (200 10 1) simpleGrading (0.8 1.8 1)
    hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.8 0.8 1) 
    hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.8 0.8 1)
    hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.8 1.8 1)
    hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.8 1.8 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)
        (0 1 12 11)
        (10 21 12 1)
        (10 9 20 21)
        );
     }
);

mergePatchPairs
(
);

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

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.25;

deltaT          1e-05;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;



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

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;
    }
   noslipwalls
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

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

    outlet
    {
        type            zeroGradient;
    }
    noslipwalls
    {
        type            noSlip;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

Results:

1) Grading factor 0.2

Mesh

Pressure Plot

Velocity Plot

Velocity Curve

2) Grading factor 0.5

Mesh

Pressure Plot

Velocity Plot

Velocity Curve

3) Grading factor 0.8

Mesh

Pressure Plot

Velocity Plot

Velocity Curve

Velocity Comparisons at 0.085m from the inlet

Conclusions:

  • The Execution time is lower for the lower mesh grading factor.
  • Overall, the change in the size of the le grading factor( Mesh size) the results remain the same as approximately.
  • From the graph, it can be seen that the value of velocity in all the cases to be approximated as 0.56 m/s at a distance of 0.085 from the inlet.
  • By changing the simple grading factor from the value of 0.8 to 0.2 the mesh becomes finer and the solution becomes very accurate.
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.