Challenge

BlockMesh Drill down challenge

To simulate using OpenFoam

Case 1 - Simulate the flow without using any grading factor (i.e., GF = 1)

Case 2 - Simulate the flow with grading factor of 0.2. The cells should be finer near the walls (includig the step wall).

You can use the following mesh parameters but you can feel free to modify these values.

Mesh specification

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

Boundary condition specification

The domain specifications are provided in the following figure.

The geometry has been created from tutorials/incompressible/icoFoam/cavity directory. The profile is built one by one using the nodes of all three axis. The solver used in this simulation is icoFoam.

There are five boxes in which, the number of cells in the X-axis is 200 and 10 in the Y-axis. we need to edit the blockmesh file in-order generate the profile.

Blockmesh:

/*--------------------------------*- 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)
    (8 0 0)
    (8 0.5 0)
    (0 0.5 0)
    (8 1 0)
    (0 1 0)
    (20 1 0)
    (20 0.5 0)
    (20 0 0)
    (20 -1 0)
    (8 -1 0)
    (0 0 0.1)
    (8 0 0.1)
    (8 0.5 0.1)
    (0 0.5 0.1)
    (8 1 0.1)
    (0 1 0.1)
    (20 1 0.1)
    (20 0.5 0.1)
    (20 0 0.1)
    (20 -1 0.1)
    (8 -1 0.1)
);


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

mergePatchPairs
(
);

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

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;
    }
    
    Noslipwalls
    {
    	type		zeroGradient;
    }
    
    frontAndBack
    {
        type            empty;
    }
}

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

Velocity:

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

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

In order to keep the courant number less than one, we need to reduce dt or increase dx

controldict:

/*--------------------------------*- 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.5;

deltaT          0.00001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

now we need to run the 'blockMesh' command, after that use 'paraFoam' command for post processing works

Profile:

Mesh:

Pressure variation diagram:

Pressure profile:

Velocity variation diagram:

Velocity profile:

Now grading factor 0.2

blockmesh:

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

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

Mesh:

Pressure diagram:

Pressure profile:

Velocity diagram:

velocity profile:

conclusion:

As we can observe that the plots obtained from default simpleGradient and with gradient factor 0.2 are similar with negligible variations, and also one say that as the mesh tends to finer the accuracy of the results increases.

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.