Challenge

Week 8 - BlockMesh Drill down challenge

To simulate the flow through a backward facing step & compare the flow obtained at diffrent mesh values.

Mesh specification:-

  1. Number of cells along the x direction (longer dimension) = 200
  2. Number of cells along the y direction = 10
  3. Use a graded mesh. Grading factor near all walls should be 0.2

Question.

Follow the specifications that are provided in the following figure.

Desired output

  • How does the velocity magnitude profile change as a function of mesh grading factor. Use factors, 0.2, 0.5,0.8
  • Measure the velocity profile at 0.085 m from the inlet of the geometry
  • Plot must be a line plot
  • Compare velocity magnitude contours near the step region for the above mentioned grading factors.

Procedure :-

  1. First we run the terminal in the OS.
  2. Type the openFoam shortcut 'tut' the gui will take you to the tutorials folder.
  3. use the 'cd' followed bythe name of the folder to be opned. In this case open incompessible > icoFoam.
  4. check for the contents using the 'ls' command and copy cavity folder to $FOAM_RUN using the command cp -r cavity/ $FOAM_RUN.
  5. $FOAM_RUN use the openFoam shortcut 'run'.
  6. Use cd cavity to go inside cavity folder the do cd cavity again to get into the backward step file which we have to edit.
  7. Now we have to edit the following text files using the 'gedit' command followed by name of the file.
  8. The given files are to be edited blockMeshDict and controlDict which are inside the system Folder.
  9. And inside 0 folder using the same gedit command initial conditions for U and p ie Velocity and preassure.
  10. Now return back to the cavity folder using cd ../ command and use the blockMesh command, it creates the mesh and other calculations are done here.
  11. Now type icoFoam to calculate the simulation. Type paraFoam to open paraView for post processing.
  12. After the simulation runs through, open the case in paraFoam and click apply.

    Then click on the Filters, expand the data analysis group. You will find the plot over line option. If its not present here, use the search option in the filters toolbar and type in “plot over line” to find the option.

    After selecting the plot over line, click apply. Now scroll down the plot over line definition, and input the right values of (x,y,z) coordinate to position the probe, just after the step. After positioning the probe, scroll down further until you find a checklist to select the parameter you want to plot along the line probe.

    Hit apply to get the parameter plotted along the line probe.

1.blockMeshDict file.

This text file is used to edit the the mesh and placement of vertices of the geometry.

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

convertToMeters 0.1;

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

edges
(
);

boundary
(
   Inlet
    {
        type wall;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
);
    }
    Outlet
    {
        type wall;
        faces
        (
           (9 8 19 20)
           (8 7 18 19)
           (7 6 17 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
             (15 13 14 16)
            (13 12 11 14)
            (17 18 13 15)
            (18 19 12 13)
            (19 20 21 12)
            (4 2 3 5)
            (2 1 0 3)
            (6 7 2 4)
            (7 8 1 2) 
            (8 9 10 1)
           
        );
    }
 top_and_bottom
    {
        type wall;
        faces
        (
           (16 15 4 5)
           (15 17 6 4)
           (1 10 21 12)
           (0 1 12 11)
           (9 20 21 10)
           
        );
    }
);

mergePatchPairs
(
);

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

After defining the boundaries correctly, to check if you have given defined them correctly, execute the blockMesh command in the terminal.Now open paraFoam, select all the patches and click apply. You will now be able to see the boundary conditions that have been applied to the geometry.

2. controlDict file.

This text file is used to edit the values of time steps along initial and final time.

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

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.05;

deltaT          0.0005;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

3. Velocity code.

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

    top_and_bottom
     {
        type            noSlip;
     }
  
    frontAndBack
     {
        type            empty;
     }
}

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

4. Preassure code.

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

    top_and_bottom
    {
        type           zeroGradient;
    }
}

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

Results:-

1.When mesh grading factor is taken to be 0.2 along the walls.

a. Mesh Profile.

b. Preassure Profile.

c.Velocity profile.

d. Variation Velocity and Preassure profile at 0.085 m from the inlet of geometry for grading = 0.2.

length of Y-axis

2.When mesh grading factor is taken to be 0.5 along the walls.

a. Mesh Profile.

b. Preassure profile.

c. Velocity profile.

d. Variation Velocity and Preassure profile at 0.085 m from the inlet of geometry for grading = 0.2.

length of Y-axis

3. When mesh grading factor is taken to be 0.8 along the walls.

a. Mesh Profile.

b. Preassure profile.

c. Velocity profile.

d. Variation Velocity and Preassure profile at 0.085 m from the inlet of geometry for grading =

length of Y-axis

Conclusion:-

  • There is no significant effect in simulation because of change in grading factor.
  • Even tho there is no significant effect there is minor diffrence in maximum and minimum value.( Noticed on zooming)
  • When grading factor is 0.2 mesh can be easily seen as it is less congested.
  • Performing a simulation is easier in case of openFoam.
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.