Challenge

Week 8 - BlockMesh Drill down challenge

  • Mesh Specifications:
  1. Number of cells along the x-direction (longer dimension) = 200
  2. Number of cells along the y-direction = 10
  3. Grading factor near all walls - 0.2
  • A smaller grading factor produces a more uniform mesh.

f = (size of end cell) / (size of starting cell)

  • Boundary Condition Specification:
  • Block:

  • Steps for Simulation

BlockMeshDict File:

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

vertices
(
    (0 0 0) //Vertex number 0
    (8 0 0) //Vertex number 1
    (8 0.5 0) //Vertex number 2
    (0 0.5 0) //Vertex number 3
    (8 1 0) //Vertex number 4
    (0 1 0) //Vertex number 5
    (20 1 0) //Vertex number 6
    (20 0.5 0) //Vertex number 7
    (20 0 0) //Vertex number 8
    (20 -1 0) //Vertex number 9
    (8 -1 0) //Vertex number 10

    (0 0 0.1) //Vertex number 11
    (8 0 0.1) //Vertex number 12
    (8 0.5 0.1) //Vertex number 13
    (0 0.5 0.1) //Vertex number 14
    (8 1 0.1) //Vertex number 15
    (0 1 0.1) //Vertex number 16
    (20 1 0.1) //Vertex number 17
    (20 0.5 0.1) //Vertex number 18
    (20 0 0.1) //Vertex number 19
    (20 -1 0.1) //Vertex number 20
    (8 -1 0.1) //Vertex number 21
);

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

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

VolScalarField- Pressure Boundary Conditions File :

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

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;
    }

    frontAndBack
    {
        type            empty;
    }
    noslipwalls
    {
        type            noSlip;
    }
}
// ************************************************************************* //

Pressure:

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

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

For Grading Scheme 1

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

Velocity without Surface Edges

Velocity with Surface Edges

U Magnitude Plot

For Grading Scheme 0.2

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)

U without Surface Edges

U with Surface Edges

U Magnitude Plot

For Grading Scheme 0.5

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)

U without Surface Edges

U with Surface Edges

Graph

For Grading Scheme 0.8

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)

U without Surface Edges

U with Surface Edges

Graph

CONCLUSION:

Mesh Grading Factor

Velocity Magnitude(U)

Approximate value

Executing Time

0.2

1.1m/s

153.89s

0.5

1.1m/s

156.82s

0.8

1.1m/s

155.07s

1

1.1m/s

160.07s

  1. 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.
  2. From the graph, it can be seen that the value of velocity in all the cases ti be approximate as 1.1m/s at a distance of 0.085 from the inlet in X-axis.
  3. The Execution time is lower for lower meshing 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.