Challenge

Week 8 - BlockMesh Drill down challenge

blockMeshDict:

Case1:

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

vertices
(
    (0 0 0)	//p0
    (8 0 0)	//p1
    (8 0.5 0)	//p2
    (0 0.5 0)	//p3
    (8 1 0)	//p4
    (0 1 0)	//p5
    (20 1 0)	//p6
    (20 0.5 0)	//p7
    (20 0 0)	//p8
    (20 -1 0)	//p9
    (8 -1 0) 	//p10
    (0 0 0.1)	//p11
    (8 0 0.1)	//p12
    (8 0.5 0.1)	//p13
    (0 0.5 0.1)	//p14
    (8 1 0.1)	//p15
    (0 1 0.1)	//p16
    (20 1 0.1)	//p17
    (20 0.5 0.1)	//p18
    (20 0 0.1)	//p19
    (20 -1 0.1)	//p20
    (8 -1 0.1)	//p21
    
);

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
(
);

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

Case2:

For case 2 , the simpleGrading is changed as below

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

    frontAndBack
    {
        type            empty;
    }
}

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

The inlet velocity is considered as 1m/s.

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

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

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;


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

Simulation results:

Case1:

Mesh

Velocity

Pressure

Velocity Profile at 0.085m from inlet

Case2 (with grading):

Mesh:

Velocity:

Pressure:

Velocity Profile at 0.085m from inlet

Discussion:

The blockMesh was modified in case2 such that the mesh becomes finer at the boundaries of the geometry and as a result there are some minor variations in the velocity. In addition, if we compare the velocity profile on a line at a distance of 0.085m from the inlet, we can see that the case without any grading yields a little more smooth curve especially at the center height since the grading introduces a finer mesh at the center.

The peak velocity values for both the cases at a distance of 0.085m are also very close as shown below:

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.