Challenge

Week 8 - BlockMesh Drill down challenge

  1. AIM

To program and study the Block Mesh Drill down Challenge using OpenFoam having the following criteria met :

  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
  4. Study velocity magnitude profile change as a function of mesh grading factor. Use factors, 0.2, 0.5,0.8
  5. Measure the velocity profile at 0.085 m from the inlet of the geometry
  6. Plot must be a line plot
  7. Compare velocity magnitude contours near the step region for the above mentioned grading factors.
  1. INTRODUCTION

2.1 BlockMeshDict Code Edit

Edit the blockmeshdic file with respect to the problem geometry and also update the bounary conditions accordingly. The below program is given for no grade scheme. In case of grade scheme in X axis play with the 1st coordinate and for 0.2 walls play with the second coordinate of simpleGrading. The formula for finding f (Simple Grading Factor) = size of end cell/size of the first cell.

/*--------------------------------*- 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) 			//Point 0
    (.08 0 0) 			//Point  1
    (.08 0.005 0)		//Point  2
    (0 0.005 0) 		//Point  3
    (.08 .01 0)			//Point  4
    (0 .01 0) 			//Point  5
    (.2 .01 0) 			//Point  6
    (.2 0.005 0) 		//Point  7
    (.2 0 0) 			//Point  8
    (.2 -.01 0) 		//Point  9
    (.08 -.01 0) 		//Point  10
    (0 0 0.001)			//Point  11
    (.08 0 0.001) 		//Point  12
    (.08 0.005 0.001) 		//Point  13
    (0 0.005 0.001) 		//Point  14
    (.08 .01 0.001) 		//Point  15
    (0 .01 0.001) 		//Vertex  16
    (.2 .01 0.001) 		//Point  17
    (.2 0.005 0.001) 		//Point  18
    (.2 0 0.001) 		//Point 19
    (.2 -.01 0.001) 		//Point 20
    (.08 -.01 0.001) 		//Point  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
(
);

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

2.2 Initial Condition Pressure p Code Edit

The initial condition can be updated by editing the pressure file available in 0 folder.

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

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

2.3 Initial Condition Velocity U Code Edit

The initial condition can be updated by editing the velocity file available in 0 folder.

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

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

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

2.4 controlDict Code Edit

The following parameters were changed in the file

DeltaT = 1e-5

EndTime = 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;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.2;

deltaT          1e-5;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


// ************************************************************************* //
  1. RESULTS AND DISCUSSION

3.1 No Grading Scheme f=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)

Inference: Without grading factor or simpleGrading factor has been set to (1 1 1) and the solution is obtained. The main reason for introducing grading factor is to refine the mesh at the desired location for accurate solution. As per the problem statement we are concerned about the velocity profile at x = 0.085 from y -0.1 to y +0.1 which is captured for ungraded mesh and its value is approximately 1.1 m/s.

3.2 Grading Scheme f=0.8

Inference: It is clear from the above results for the grading scheme f = 0.8 the following chages in blockMeshDict file has to be done.

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

Then in parafoam using line probe tool we plot and analyse the velocity profile at x = 0.085 from y -0.1 to y +0.1 and its approximate value is 1.1 m/s. It is notable that the velocity profile is smoother than f =1.

3.3 Grading Scheme f=0.5

Inference: It is clear from the above results for the grading scheme f = 0.5 the following chages in blockMeshDict file has to be done.

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

Then in parafoam using line probe tool we plot and analyse the velocity profile at x = 0.085 from y -0.1 to y +0.1 and its approximate value is 1.1 m/s. It is notable that the velocity profile is smoother than f =0.8.

3.4 Grading Scheme f=0.2

Inference:

It is clear from the above results for the grading scheme f = 0.2 the following chages in blockMeshDict file has to be done.

hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.2 5 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 5 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.2 5 1)

Then in parafoam using line probe tool we plot and analyse the velocity profile at x = 0.085 from y -0.1 to y +0.1 and its approximate value is 1.1 m/s. It is notable that by decreasing grading factor the velocity profile becomes smoother and smoother when compared to f =0.5. This is due to increase in number of cells at the center of flow wherin the major velocity chage is prominent. It also quantifies good amount the boundary layer separation in comparison to other higher grading factors.

Grading Scheme f

U Value Approx (m/s)

1

1.1

0.8

1.1

0.5

1.1

0.2

1.1

  1. CONCLUSION

The program to study the Block Mesh Drill down Challenge using OpenFoam was developed and executed successfully.

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.