/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// This dictionary works with the Fundation version of OpenFOAM and 
// has not been tested agains ESI version. 

convertToMeters 1;

// * * INPUTS  * * *
radius      0.05;
height      0.6;
cellSize    0.003;
innerArc    yes; // yes/no
// * * * * * * * * * 

//------------------------------------------------------------------------
squareSize      #calc "0.4*$radius";
squareSizeN     #calc "-$squareSize";
xPos            #calc "$radius*0.707106781187";
xPosN           #calc "-$xPos";
nSqaure         #calc "floor( 2*$squareSize / $cellSize )+1";
nZ              #calc "floor( $height / $cellSize) + 1";
nDiag           #calc "floor( ( $xPos - $squareSize)/0.707106781187 / $cellSize ) + 1";



vertices
(
    ($squareSizeN  $squareSizeN 0) //0
    ( $squareSize  $squareSizeN 0) //1
    ( $squareSize   $squareSize 0) //2
    ($squareSizeN   $squareSize 0) //3
    ($squareSizeN  $squareSizeN $height) //4
    ( $squareSize  $squareSizeN $height) //5
    ( $squareSize   $squareSize $height) //6
    ($squareSizeN   $squareSize $height) //7
    ($xPosN $xPosN  0) //8
    ( $xPos $xPosN  0) //9
    ( $xPos  $xPos  0) //10
    ($xPosN  $xPos  0) //11
    ($xPosN $xPosN  $height) //12
    ( $xPos $xPosN  $height) //13
    ( $xPos  $xPos  $height) //14
    ($xPosN  $xPos  $height) //15

);

blocks
(
    hex (0 1 2 3 4 5 6 7) ($nSqaure $nSqaure $nZ) simpleGrading (1 1 1)       // block0
    hex (0 8 9 1 4 12 13 5) ($nDiag $nSqaure $nZ) simpleGrading (1 1 1)       // block1
    hex (1 9 10 2 5 13 14 6) ($nDiag $nSqaure $nZ) simpleGrading (1 1 1)       // block2
    hex (2 10 11 3 6 14 15 7) ($nDiag $nSqaure $nZ) simpleGrading (1 1 1)       // block3
    hex (3 11 8 0 7 15 12 4) ($nDiag $nSqaure $nZ) simpleGrading (1 1 1)       // block4
    
);

#ifeq $innerArc yes
edges
(

    arc 0 1 45.0 (0 0 1)
    arc 1 2 45.0 (0 0 1)
    arc 2 3 45.0 (0 0 1)
    arc 3 0 45.0 (0 0 1)
    arc 4 5 45.0 (0 0 1)
    arc 5 6 45.0 (0 0 1)
    arc 6 7 45.0 (0 0 1)
    arc 7 4 45.0 (0 0 1) 
    arc 8 9 90.0 (0 0 1)
    arc 12 13 90.0 (0 0 1)
    arc 9 10 90.0 (0 0 1)
    arc 13 14 90.0 (0 0 1)
    arc 10 11 90.0 (0 0 1)
    arc 14 15 90.0 (0 0 1)
    arc 11 8  90.0 (0 0 1)
    arc 15 12 90.0 (0 0 1)
);
#else
edges
(
    arc 8 9 90.0 (0 0 1)
    arc 12 13 90.0 (0 0 1)
    arc 9 10 90.0 (0 0 1)
    arc 13 14 90.0 (0 0 1)
    arc 10 11 90.0 (0 0 1)
    arc 14 15 90.0 (0 0 1)
    arc 11 8  90.0 (0 0 1)
    arc 15 12 90.0 (0 0 1)
);
#endif


defaultPatch
{
    name cylinerWall;
    type wall;
}

boundary
(
    inlet
    {
        type    patch;
        faces   
        (
            (3 2 1 0)
            (1 9 8 0)
            (2 10 9 1)
            (3 11 10 2)
            (0 8 11 3)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (4 5 6 7)
            (4 12 13 5)
            (5 13 14 6)
            (6 14 15 7)
            (7 15 12 4)
        );
    }
);

mergePatchPairs
(
);

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