Project

BlockMesh Drill down challenge

Objective:

To simulate the flow through a backward facing step using the icoFoam solver in OpenFoam and to compare the velocity profile at a given point for different grading of mesh.

We will here use the icoFoam solver for solving the flow simulation in the geometry shown below:

This problem has to be solved with 5 blocks for mesh with 200 elements along x axis and 20 elemets along the y axis. Further the graph has to be plotted 0.085 m away from the left most corner of the figure and the graph is then to be compared with the grading of 0.2, 0.5, 0.8.

The grade is defined as the ratio of length of first element of the mesh to the length of last element of the mesh.

To solve this problem we will first copy cavity tutorial from the incompressible flow in icoFoam Solver to the run Folder. Further we will start editing the block in the blockMeshDict file in the in the system folder in cavity. There we will make the figure shown above using the coordinates and then we wiill define the blocks by joining the different coordinates. and specift the mesh grading and then naming the boundaries as shown below:

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  6
     \\\\/     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 1) //point 11
    (8 0 1) //point 12
    (8 0.5 1) //point 13
    (0 0.5 1) //point 14
    (8 1 1) //point 15
    (0 1 1) //point 16
    (20 1 1) //point 17
    (20 0.5 1) //point 18
    (20 0 1) //point 19
    (20 -1 1) //point 20
    (8 -1 1) //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
        (
            (18 7 6 17)
            (19 8 7 18)
            (20 9 8 19)
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
            (15 4 5 16)
            (17 6 4 15)
            (21 10 9 20)
            (21 12 1 10)
            (11 0 1 12)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 3 2 1)
            (3 5 4 2)
            (2 4 6 7)
            (1 2 7 8)
            (10 1 8 9)
            (11 12 13 14)
            (14 13 15 16)
            (13 18 17 15)
            (12 19 18 13)
            (21 20 19 12)
        );
    }
);

mergePatchPairs
(
);

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

After changing these files the blocks were checked wheather they were correct or not. The blocks formed by cordinates can be seen below:

Here the five blocks can be seen as mentioned in teh problem statement.

The boundary Conditions have been put as mentioned in the figure. Further After ading teh boundary Conditions the Initial Conditions and the transport properties for the probem has to determined. For the Initial conditions the pressure and velocity at different boundaries will be defined as shown:

1.) Pressure

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  6
     \\\\/     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;
    }
    fixedWalls
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

The pressure was kept zero at outlet and the zero gradient was maintained at inlet and the walls.

2.) Velocity

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  6
     \\\\/     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;
    }

    fixedWalls
    {
        type            noSlip;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

The velocity was kept as 1m/s at the inlet aling teh x axis in the local coordinate system. The no slip condition was maintained at the walls and zero gradient was kept at the outlet as mentioned in the problem.

The problem was solved for the crack case oil and the kinematic viscosity of the oil was put in the transport properties file in the constant folder. The kinematic viscosity of the oil was kept as 1295 cSt (source: https://www.engineeringtoolbox.com/kinematic-viscosity-d_397.html). The value put in the files can be seen below:

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  6
     \\\\/     M anipulation  |
\\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    \"constant\";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu              [0 2 -1 0 0 0 0] 0.00129;    //crank case oil


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

Further the values of the dt was set for the problem such that the courant no was less than 1. This was done with the help of hit and trial method an dthe final value of dt was found to be 0.0001 and the solution end time was set as 2seconds as it was seen that in 1second the solution didnt reached the steady state. Further the conrolDict file can be seen below:

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  6
     \\\\/     M anipulation  |
\\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    \"system\";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         2;

deltaT          0.0001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

The problem was first run with the 1 grading and the results can be seen below:

1.) Mesh at 1 grading

2.) Simulation at the last Time step

3.) Velocity plot vs length along the y

The problem was first run with the 0.2 grading and the results can be seen below:

1.) Mesh at 0.2 grading

2.) Simulation at the last Time step

3.) Velocity plot vs length along the y

The problem was first run with the 0.5 grading and the results can be seen below:

1.) Mesh at 0.5 grading

2.) Simulation at the last Time step

3.) Velocity plot vs length along the y

The problem was first run with the 0.8 grading and the results can be seen below:

1.) Mesh at 0.8 grading

2.) Simulation at the last Time step

3.) Velocity plot vs length along the y

Disscussion:

After Plotting the graphs at x=0.085 it can be seen that the velocity at the walls is zero whereas the velocity at the center is maximum. This is due to the no slip boundary condition at the walls .i.e. velocity at the walls is zero. As our fluid is viscous thus it offers resistance between the layers thus the velocity should be maximum at the center but here we can see that the peak is at the right side of the curve. This can be explained due to the sudden change in the cross section of the nozzle. Thus the vortex are formed due to the sudden change and the low pressure area is generated in that area and the velocity in that area is low due to the vwrtex formation. Further, similar plots can be seen for the for different grading points without further change. However it can be said that the finer mesh can lead to the better accuracy of the results.

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.