Project

BlockMesh Drill down Challenge using openFoam

BlockMesh Drill down Challenge:

objective: The objective of the problem is to produce mesh by using the OpenFOAM software, and to show the changes in post-processing of velocity and pressure gradients by using ParaView open source software for the given conditions.

Mesh Specifications:

  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, 0.5, 0.8

Boundary Condition Specification:

Follow the dimensions to create blocks using OpenFoam

OpenFOAM:

  • OpenFOAM (for \"Open-source Field Operation And Manipulation\") is a C++ toolbox for the development of customized numerical solvers, and pre-/post-processing utilities for the solution of continuum mechanics problems, most prominently including Computational Fluid Dynamics (CFD).

Advantages:

  • The friendly syntax for partial differential equations
  • Fully documented source code
  • Unstructured polyhedral grid capabilities
  • Automatic parallelization of applications written using OpenFOAM high-level syntax
  • Wide range of applications and models ready to use
  • Commercial support and training provided by the developers
  • No license costs

Disadvantages:

  • The development community suffers from fragmentation, giving rise to numerous forked projects.
  • Absence of an integrated Graphical User Interface (stand-alone open-source and proprietary options are available).
  • The Programmer\'s guide does not provide sufficient details, making the progress slow if you need to write new applications or add functionality.

Block:

Simulation: (Steps)

  1. Open the terminal in the Linux Operating System
  2. just type \'tutorials\', and it takes you to the in-built tutorial files of the OpenFOAM software. Type \'ls\' (list) to view the contents in the tutorials.
  3. Type \'cd incompressible\'. And then \'ls\'. It takes into the incompressible directory file.
  4. Type \'cd icoFoam\', then \'ls\'. This step takes into the icoFoam directory file.
  5. After that, we need to copy the cavity directory file located in icoFoam.
  6. Type \'cp -r cavity/ $FOAM_RUN/****\'. This command copies the cavity file and pastes directly in the run folder. To check....
  7. Type \'cd\' . Type \'run\'. It takes to the run folder which creates automatically by the software and we can file we copied.
  8. ********* Never run your simulation directly in the tutorial file itself. It may corrupt the entire tutorial file if any mistakes or errors took. To regain those files, we need to uninstall the software and install again which is a long-process.**********
  9. Open the files using the change directory \'cd\' command.
  10. In the file you copied, open cavity --> system. Type \'ls\' to see the contents.
  11. There we see blockMeshDict, controlDict, fvschemes and fvslutions are text files which we need to edit the file according to our boundary conditions.
  12. Type \'gedit blockMesh\'. Here we give a shape to the problem, applying the mesh grading, allocating the grid numbers to the respective points we assumed and lastly don\'t forget to save the file.
  13. Likewise, edit controlDict file also to give limits in words of time, like start time, end time, time interval and deltatt.
  14. While selecting the \'delta t\' value, be aware of the courant number. It should be less than one (< 1). Otherwise, the solution may diverge and stopped forcibly by software itself.
  15. Come back to the cavity file using change directory command \'cd ..\' .
  16. In this file, we need to edit the velocity and pressure files according to the problem. for that, we need to go to \'0\' file.
  17. \'0\' file represents us that the initial conditions of the problem. And these files are inbuilt files. Here at this step, we need to be careful that no-slip conditions, etc.,
  18. After editing the four files, come to the \'cavity\' directory. There we need to give a command \'blockMesh\' to get mesh structured, and other mesh calculations are done here. After completing it we need to check the mesh that it has any error in it or not. For that, \'checkMesh\' command is used.
  19. After completing both the steps, we can confirm that our mesh is stable and good. Now type \'icoFoam\' to calculate simulation or problem. Because in the icoFoam file only we copied and pasted the file for run.
  20. After the completion of simulation, type \'paraFoam\' for the post-processing.
  21. ParaView is an open-source multiple-platform application for interactive, scientific-visualization. It has a client-server architecture to facilitate remote visualization of datasets and generates level-of-detail (LOD) models to maintain interactive frame rates for large datasets. It is an application built on top of the visualization toolkit (VTK) libraries.

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

convertToMeters 0.01;

vertices
(
    (0 0 0) //vertices 0
    (8 0 0) //vertices 1
    (8 0.5 0) //vertices 2
    (0 0.5 0) //vertices 3
    (0 1 0) //vertices 4
    (8 1 0) //vertices 5
    (20 1 0) //vertices 6
    (20 0.5 0) //vertices 7
    (20 0 0) //vertices 8
    (20 -1 0) //vertices 9
    (8 -1 0) //vertices 10

    (8 0 0.1) //vertices 11
    (0 0 0.1) //vertices 12
    (0 0.5 0.1) //vertices 13
    (8 0.5 0.1) //vertices 14
    (8 1 0.1) //vertices 15
    (0 1 0.1) //1vertices 16
    (20 1 0.1) //vertices 17
    (20 0.5 0.1) //vertices 18
    (20 0 0.1) //vertices 19
    (20 -1 0.1) //vertices 20
    (8 -1 0.1) //vertices 21
);

blocks
(

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

edges
(
);

boundary
(
     inlet
     {
          type patch;
          faces
          (
               (13 12 0 3)
               (16 13 3 4)
          );
      }
      outlet
      {
          type patch;
          faces
          (
               (6 17 18 7)
               (7 18 19 8)
               (8 19 20 9)
          );
      }
      front
      {
          type empty;
          faces
          (
               (13 12 11 14)
               (16 13 14 15)
               (15 14 18 17)
               (14 11 19 18)
               (11 21 20 19)
           );
      }
      back
      {
          type empty;
          faces
          (
               (3 0 1 2)
               (4 3 2 5)
               (5 2 7 6)
               (2 1 8 7)
               (1 10 9 8)
           );
      }
      topandbottom
      {
          type wall;
          faces
          (
               (0 12 11 1)
               (11 10 21 1)
               (10 21 20 9)
               (16 4 5 15)
               (15 5 6 17)
          );
      }
);

mergePatchPairs
(
);

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

controlDict 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       dictionary;
    location    \"system\";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.05;

deltaT          1e-05;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

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.5 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    front
    {
        type            empty;
    }

    Back
    {
        type            empty;
    }

    topandbottom
    {
        type            noSlip;
    }

}


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

Pressure 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;
    }

    front
    {
        type            empty;
    }

    Back
    {
        type            empty;
    }

    topandbottom
      {
        type            zeroGradient;
    }

}

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

Mesh Grading factor:

  • It is a technique called mesh stretching.
  • Grading factor values range from 1 to 10. A value of 1 produces the most uniform mesh transition. A value of 10 produces the least uniform mesh transition. Increasing the value can reduce the number of elements and local mesh quality. Decreasing the value (minimum is 0.1) can drastically increase the number of elements and increase the mesh quality.
  • A smaller grading factor produces a more uniform mesh.

f = (size of end cell) / (size of starting cell)

Results:

geometry:

for mesh griding factor 0.2:

for mesh griding factor 0.5:

for mesh griding factor 0.8:

for mesh griding factor 1:

Comparison:

  • By observing the above plots, we can see that how the gradation of mesh appears.
  • From the plots seen above, we can say that definitely there will be some effect on simulation by changing the mesh grading factor.
  • In total, we perform simulation for mesh gradation of 0.2, 0.5, 0.8 and 1. All these simulation throughs the similar plots.
  • Although these have similar plots, the difference has been observed by zoom in to the plot at the maximum velocity and pressure point. For the convenience, given a comparison table above.
  • If we take a look at the velocity plots, we observe that the plot has bent to its the right side. This is because we were given the condition of the walls as a no-slip condition throughout the block.
  • The maximum velocity point is located somewhere in between 0.13 to 0.14. But it has to be in the center of the plot.
  • This because of pressure developed by the internal force generated by the velocity.
  • The formation of pressure plot is, change in the pressure is like first increasing and then decreasing. This is because if there is an increase in velocity, an increase in pressure also observed.
  • Coming to the executing time, for grading mesh 0.2 takes less time to compare to others.

Note: For better observance and understanding the simulation use \'Jet\' color map.

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.