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

diameter   0.1;

// 1 - Coarse (576 cells), 2 - Medium (2304 cells), 3 - Fine (9216 cells)
meshScalingFactor 1;

boxCells   #calc "8 * pow(label(2), $meshScalingFactor - 1)";
radCells   #calc "$boxCells * 2";
length     #calc "2.0 * $diameter / $radCells";
radIn      #calc "$diameter / 2.0";
boxIn      #calc "3.0*$radIn / 10.0";
radInN     #neg $radIn;
boxInN     #neg $boxIn;

convertToMeters 1;

vertices
(
    (0   0        $boxInN)
    (0   $boxIn   0)
    (0   0        $boxIn)
    (0   $boxInN  0)
    (0   0        $radInN)
    (0   $radIn   0)
    (0   0        $radIn)
    (0   $radInN  0)

    ($length  0        $boxInN)
    ($length  $boxIn   0)
    ($length  0        $boxIn)
    ($length  $boxInN  0)
    ($length  0        $radInN)
    ($length  $radIn   0)
    ($length  0        $radIn)
    ($length  $radInN  0)
);

yzBoxCells $boxCells $boxCells;
yzRadCells $boxCells $radCells;

blocks
(
    hex (0  8  9  1  3  11 10 2)  (1 $yzBoxCells) simpleGrading (1 1 1)
    hex (11 3  0  8  15 7  4  12) (1 $yzRadCells) simpleGrading (1 1 0.5)
    hex (10 2  3  11 14 6  7  15) (1 $yzRadCells) simpleGrading (1 1 0.5)
    hex (9  1  2  10 13 5  6  14) (1 $yzRadCells) simpleGrading (1 1 0.5)
    hex (8  0  1  9  12 4  5  13) (1 $yzRadCells) simpleGrading (1 1 0.5)
);

edges
(
    arc 7 4 90 (1 0 0)
    arc 6 7 90 (1 0 0)
    arc 5 6 90 (1 0 0)
    arc 4 5 90 (1 0 0)

    arc 15 12 90 (1 0 0)
    arc 14 15 90 (1 0 0)
    arc 13 14 90 (1 0 0)
    arc 12 13 90 (1 0 0)
);

defaultPatch
{
    name walls;
    type wall;
}
boundary
(
    inlet
    {
        type cyclic;
        neighbourPatch outlet;
        faces
        (
            (0 1 2 3)
            (0 4 5 1)
            (1 5 6 2)
            (2 6 7 3)
            (3 7 4 0)
        );
    }

    outlet
    {
        type cyclic;
        neighbourPatch inlet;
        faces
        (
            (8 9 10 11)
            (8 12 13 9)
            (9 13 14 10)
            (10 14 15 11)
            (11 15 12 8)
        );
    }

);

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