Challenge

Week 8 - BlockMesh Drill down challenge

Block Mesh Challenge


In this challange we run a case in openfoam for a step-velocity profile.For that we create a geometry by editing the blockMeshDict file which is a dictianory file.

This file contains the information about the geometry, blocks which make up the geometry and the mesh that is generated on the 2D domain. blockMeshDict file is contianed inside system file which is located in any solver case folder.

solver folder consist of minimum 3 folders system, constant and 0 folder.
System folder consist of dictianory files mainly controlDict, blockMeshDict, fvSchemes, fvSolution etc. These files mainly determine the numerical schemes used in discretization value of time step start and end time etc.

Constant folder consist of the constant (physical)properties, these remain constant throughout the flow-field simulation. This folder also contains polymesh folder which is generated when we enter the command blockMesh this executes the mesh and boundary condition.

0 folder consist of the initial condition of the flow-field varables like pressure(p) velocity(v) etc. It also contains the boundary conditions at the boundary cells of the mesh.

Following is the blockMeshDict file in which we use the mesh grading factor =0.2 for refining the block mesh for better results. We divide the geometry in 5 blocks.

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

vertices
(
    (0 0 0)
    (0.08 0 0)
    (0.08 0.005 0)
    (0 0.005 0)
    (0.08 0.01 0)
    (0 0.01 0)
    (0.2 0.01 0)
    (0.2 0.005 0)
    (0.2 0 0)
    (0.2 -0.01 0)
    (0.08 -0.01 0)
    (0 0 0.001)
    (0.08 0 0.001)
    (0.08 0.005 0.001)
    (0 0.005 0.001)
    (0.08 0.01 0.001)
    (0 0.01 0.001)
    (0.2 0.01 0.001)
    (0.2 0.005 0.001)
    (0.2 0 0.001)
    (0.2 -0.01 0.001)
    (0.08 -0.01 0.001)

);

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

mergePatchPairs
(
);

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

The following file is pressure p 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.1;

deltaT          0.00002;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

The following file is pressure p 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 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 following file is velocity v 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       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (10 0 0);
    }
    
    outlet
    {
        type            zeroGradient;
    }

    noSlipWalls
    {
        type            noSlip;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

1. Velocity profile of the step with grading factor 0.2.

2. The following is the velocity-profile at the step.

3. Velocity-profile at a distance of 0.085 m (meters)

Comparison of velocity profiles for different grading factors.

1. For Grading factors 0.5

velocity profile at the step

velocity profile at 0.085 meter.

2. For grading factor 0.8

velocity profile at the step.

velocity profile at 0.085 meter.

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.