Challenge

Week 8 - BlockMesh Drill down challenge

/*--------------------------------*- 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)
    (8 0 0)
    (8 0.5 0)
    (0 0.5 0)
    (0 1 0)
    (8 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)
    (0 1 0.1)
    (8 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.8 1.8 1)
    hex (3 2 5 4 14 13 16 15) (200 10 1) simpleGrading (0.8 0.8 1)
    hex (2 7 6 5 13 18 17 16) (200 10 1) simpleGrading (1.8 0.8 1)
    hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.8 1.8 1)
    hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.8 0.8 1)
);

edges
(
);

boundary
(
 inlet
 {
   type patch;
   faces
   ( 
     (14 11 0 3)
     (15 14 3 4)
    );
   }
  
 outlet
  {
    type patch;
    faces
    (
      (17 18 7 6)
      (18 19 8 7)
      (19 20 9 8)
     );
    }

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

mergePatchPairs
(
);

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

for grading factor of 0.8

For grading factor of 0.5

For grading factor of 0.2

The cavity tutorial from ico foam was copied in $FOAM_RUN folder and was executed . After that in systems folder the blockMeshDict file was opened and the changes were made. The above code is for a grading factor of 0.8 and cwas changed and run for different factors by altering the values in simpleGrading(). In total 5 blocks were made and the blockMesh command was used to genratre the mesh and check Mesh command was used to check the mesh. icoFoam was used to run the simulation for the following tutorial and the result was postprocessed in paraFoam.

Grading Factor Maxvelocity velocity at y=0.01(near step)

0.2 1.674 1.17

0.5 1.677 1.158

0.8 1.670 1.148

Graoh explaination:

x(axis) distance from surface

y(axis) velocity magnitude

the plots and velocity contours show that there is not much difference in values for different mesh grading factors. Although when we reduce the grading factor the mesh becomes finer. The velocity plot has a bend towards right this is due to no slip condition given throughout the block.The grading factor does effect the simulation overall.

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.