Challenge

Week 8 - BlockMesh Drill down challenge

The main aim of this project is to simulate the flow through the backwards-facing step by using the blocks in icoFoam solver and post-process the results like velocity profile at the step of 0.085m from the start point of the blocks.

The blocks are built by one by one by using the nodes of all three axis There are 5 blocks are used for this project. The number of cells in the x-Direction is 200 and in the y-direction 10 and in the Z-direction it should be the 1.we have to edit the blockmeshdict file in order to run the simulation.

The block diagram looks like this in 2D and Isometric view

The below-shown code for the simple grading .we edit this code in the blockMeshdict file located in the system folder.

case 1:For grading factor =1:

/*--------------------------------*- 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)//point 0
(8 0 0)//point 1
(8 0.5 0)//point 2
(0 0.5 0)//point 3
(8 1 0)//point 4
(0 1 0)//point 5
(20 1 0)//point 6
(20 0.5 0)//point 7
(20 0 0)//point 8
(20 -1 0)//point 9
(8 -1 0)//point 10
(0 0 0.1)//point 11
(8 0 0.1)//point 12
(8 0.5 0.1)//point 13
(0 0.5 0.1)//point 14
(8 1 0.1)//point 15
(0 1 0.1)//point 16
(20 1 0.1)//point 17
(20 0.5 0.1)//point 18
(20 0 0.1)//point 19
(20 -1 0.1)//point 20
(8 -1 0.1)//point 21


   
);

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

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

pressure boundary conditions:

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

Velocity Boundary conditions:

/*--------------------------------*- 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 (0.1 0 0);
    }
    outlet
    {
        type           zeroGradient;
    }

   

    frontAndBack
    {
        type            empty;
    }
   
    Noslipwalls
    {
        type            noSlip;
    }
}

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

Transport properties:

/*--------------------------------*- 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    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu              [0 2 -1 0 0 0 0] 4e-6;


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

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

deltaT          0.002;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

Mesh block diagram:

Velocity variation profile:

Pressure variation profile:

the velocity profile at 0.085 m from the inlet of the geometry for grading factor=1;

case 2:For grading factor 0.2

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

Mesh block diagram:

Velocity variation profile:

Pressure variation profile:

the velocity profile at 0.085 m from the inlet of the geometry for grading factor=1;

Conclusion:

By changing the simple grading factor from the value of 0.2 to 1 the mesh becomes finer and the solution becomes very accurate.

Overall the change in the size of simple grading factor (mesh size) the results remains the same as approximately.

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.