Project

BlockMesh Drill Down Challenge flow through Cavity

Intention:For the following diagram, with the use of icoFOAM solver , simulate the flow through a backward facing step.

The geometry shown above is created by five blocks using OpenFoam.It could have been created using three blocks too,but to capture results in a better way,it is created through 5 blocks.

##For Grading factor 0.2

  1. Number of cells along the x direction (longer dimension) = 200
  2. Number of cells along the y direction = 10

#BlockMeshDict 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 0.01;

vertices
(
    (0 0 0)
    (8 0 0)
    (8 0.5 0)
    (0 0.5 0)
    (0 0 0.1)
    (8 0 0.1)
    (8 0.5 0.1)
    (0 0.5 0.1)
    (8 1 0)
    (0 1 0)
    (8 1 0.1)
    (0 1 0.1)
    (20 0.5 0)
    (20 1 0)
    (20 0.5 0.1)
    (20 1 0.1)
    (20 0 0)
    (20 0 0.1)
    (20 -1 0)
    (8 -1 0)
    (20 -1 0.1)
    (8 -1 0.1)
);

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

;

edges
(
);

boundary
(
  inlet
    {
        type patch;
        faces
        (
           (3 7 11 9)
           (0 4 7 3)
        );
    }
  outlet
    {
        type patch;
        faces
        (
           
           (14 12 13 15)
           (17 16 12 14)
           (20 18 16 17)
           
        );
    }

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

 fixedWalls
    {
        type wall;
        faces
        (
           (10 8 9 11)
           (15 13 8 10)
           (1 5 4 0)
           (18 20 21 19)
           (19 21 5 1)
        );
    }
);

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

deltaT          0.00001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

#Velocity Boundary Condition 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;
        
    }

    fixedWalls
    {
        type            noSlip;
        value           uniform (0 0 0);
    }

    frontAndBack
    {
        type            empty;
    }
}

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

#Pressure Boundary Condition 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;
    }

    fixedWalls
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

-------------------**************************************************************************************----------------------

##For Grading factor 0.5:

#BlockMeshdict 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 0.01;

vertices
(
    (0 0 0)
    (8 0 0)
    (8 0.5 0)
    (0 0.5 0)
    (0 0 0.1)
    (8 0 0.1)
    (8 0.5 0.1)
    (0 0.5 0.1)
    (8 1 0)
    (0 1 0)
    (8 1 0.1)
    (0 1 0.1)
    (20 0.5 0)
    (20 1 0)
    (20 0.5 0.1)
    (20 1 0.1)
    (20 0 0)
    (20 0 0.1)
    (20 -1 0)
    (8 -1 0)
    (20 -1 0.1)
    (8 -1 0.1)
);

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

;

edges
(
);

boundary
(
  inlet
    {
        type patch;
        faces
        (
           (3 7 11 9)
           (0 4 7 3)
        );
    }
  outlet
    {
        type patch;
        faces
        (
           
           (14 12 13 15)
           (17 16 12 14)
           (20 18 16 17)
           
        );
    }

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

 fixedWalls
    {
        type wall;
        faces
        (
           (10 8 9 11)
           (15 13 8 10)
           (1 5 4 0)
           (18 20 21 19)
           (19 21 5 1)
        );
    }
);

mergePatchPairs
(
);

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

----------------*****************************************************************************************---------------------

##For Grading factor 0.8:

#BlockMeshdict 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 0.01;

vertices
(
    (0 0 0)
    (8 0 0)
    (8 0.5 0)
    (0 0.5 0)
    (0 0 0.1)
    (8 0 0.1)
    (8 0.5 0.1)
    (0 0.5 0.1)
    (8 1 0)
    (0 1 0)
    (8 1 0.1)
    (0 1 0.1)
    (20 0.5 0)
    (20 1 0)
    (20 0.5 0.1)
    (20 1 0.1)
    (20 0 0)
    (20 0 0.1)
    (20 -1 0)
    (8 -1 0)
    (20 -1 0.1)
    (8 -1 0.1)
);

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

;

edges
(
);

boundary
(
  inlet
    {
        type patch;
        faces
        (
           (3 7 11 9)
           (0 4 7 3)
        );
    }
  outlet
    {
        type patch;
        faces
        (
           
           (14 12 13 15)
           (17 16 12 14)
           (20 18 16 17)
           
        );
    }

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

 fixedWalls
    {
        type wall;
        faces
        (
           (10 8 9 11)
           (15 13 8 10)
           (1 5 4 0)
           (18 20 21 19)
           (19 21 5 1)
        );
    }
);

mergePatchPairs
(
);

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

##For different grading factor,results shows some changes in velocity values.As finer mesh will give better,more accurate results,so where we want to know velocity value,mesh size should be kept finer near that region.

Like from results at 0.085m in x direction and 0m in y direction:

For 0.2 grading factor ,Velocity =0.62066 m/s

For 0.5 grading factor ,Velocity =0.62868 m/s

For 0.8 grading factor ,Velocity =0.63442 m/s

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.