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

convertToMeters        1;

cylinderRadius     0.005;  // Radius of the cylinder
halfWidth           0.04;  // Half the width of the domain
halfThickness     0.0025;  // Half of domain thickness
xMax                 0.1;  // Maximum size of outer box in streamwise direction
cylinderBox        0.002;  // Half width of box projected outwards onto the
                           // cylinder

cylinderBoxCells      15;  // Cells across cylinder
cylinderRadialCells   12;  // Cells cylinder radially
upstreamCells         30;  // Cells across width of outer box
downstreamCells       20;  // Cells downstream of the cylinder

radialGrading         20;  // Expansion ratio in outer region, radial direction

negHalfWidth          #neg $halfWidth;
negHalfThickness      #neg $halfThickness;
negSphereBox          #neg $cylinderBox;


geometry
{
    cylinder
    {
        type   searchableCylinder;
        point1 (0 0 -100);
        point2 (0 0 100);
        radius $cylinderRadius;
    }
}

vertices
(
    project ($negSphereBox $negSphereBox $negHalfThickness) (cylinder)     // 0
    project ($cylinderBox  $negSphereBox $negHalfThickness) (cylinder)     // 1
    project ($negSphereBox $negSphereBox $halfThickness   ) (cylinder)     // 2
    project ($cylinderBox  $negSphereBox $halfThickness   ) (cylinder)     // 3

    project ($negSphereBox $cylinderBox $negHalfThickness) (cylinder)      // 4
    project ($cylinderBox  $cylinderBox $negHalfThickness) (cylinder)      // 5
    project ($negSphereBox $cylinderBox $halfThickness   ) (cylinder)      // 6
    project ($cylinderBox  $cylinderBox $halfThickness   ) (cylinder)      // 7

    ($negHalfWidth $negHalfWidth $negHalfThickness)                        // 8
    ($halfWidth    $negHalfWidth $negHalfThickness)                        // 9
    ($negHalfWidth $negHalfWidth $halfThickness   )                       // 10
    ($halfWidth    $negHalfWidth $halfThickness   )                       // 11

    ($negHalfWidth $halfWidth $negHalfThickness)                          // 12
    ($halfWidth    $halfWidth $negHalfThickness)                          // 13
    ($negHalfWidth $halfWidth $halfThickness   )                          // 14
    ($halfWidth    $halfWidth $halfThickness   )                          // 15

    ($xMax $negHalfWidth $negHalfThickness)                               // 16
    ($xMax $negHalfWidth $halfThickness   )                               // 17
    ($xMax $halfWidth    $negHalfThickness)                               // 18
    ($xMax $halfWidth    $halfThickness   )                               // 19

    ($negSphereBox $negSphereBox $negHalfThickness)                       // 20
    ($cylinderBox  $negSphereBox $negHalfThickness)                       // 21
    ($cylinderBox  $negSphereBox $halfThickness   )                       // 22
    ($negSphereBox $negSphereBox $halfThickness   )                       // 23

    ($negSphereBox $cylinderBox $negHalfThickness)                        // 24
    ($cylinderBox  $cylinderBox $negHalfThickness)                        // 25
    ($cylinderBox  $cylinderBox $halfThickness   )                        // 26
    ($negSphereBox $cylinderBox $halfThickness   )                        // 27
);

expandBlock simpleGrading (1 $radialGrading 1);
reg simpleGrading (1 1 1);

blocks
(
    // Fluid region
    hex (4 6 14 12 0 2 10 8) (1 $upstreamCells $cylinderBoxCells) $expandBlock
    hex (7 5 13 15 3 1 9 11) (1 $upstreamCells $cylinderBoxCells) $expandBlock
    hex (2 3 11 10 0 1 9 8) ($cylinderBoxCells $upstreamCells 1) $expandBlock
    hex (7 6 14 15 5 4 12 13) ($cylinderBoxCells $upstreamCells 1) $expandBlock
    hex (13 18 19 15 9 16 17 11) ($downstreamCells 1  $cylinderBoxCells) $reg

    // Solid region
    hex (24 25 26 27 20 21 22 23) ($cylinderBoxCells 1 $cylinderBoxCells) $reg
    hex (0 2 23 20 4 6 27 24) (1 $cylinderRadialCells $cylinderBoxCells) $reg
    hex (21 22 3 1 25 26 7 5) (1 $cylinderRadialCells $cylinderBoxCells) $reg
    hex (0 2 3 1 20 23 22 21) (1 $cylinderBoxCells $cylinderRadialCells) $reg
    hex (4 5 7 6 24 25 26 27) ($cylinderBoxCells 1 $cylinderRadialCells) $reg

);

edges
(
    project  0 2  (cylinder)
    project  2 3  (cylinder)
    project  3 1  (cylinder)
    project  1 0  (cylinder)
    project  4 6  (cylinder)
    project  6 7  (cylinder)
    project  7 5  (cylinder)
    project  5 4  (cylinder)
    project  0 4  (cylinder)
    project  2 6  (cylinder)
    project  3 7  (cylinder)
    project  1 5  (cylinder)
);

faces
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (8 10 14 12)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (16 17 19 18)
        );
    }

    topAndBottom
    {
        type patch;
        faces
        (
            (8 9 11 10)
            (12 13 15 14)
            (9 16 17 11)
            (13 18 19 15)
        );
    }

    frontAndBack
    {
        type empty;
        faces
        (
            // Side 1
            (10 14 6 2)
            (14 6 7 15)
            (15 7 3 11)
            (3 11 10 2)
            (15 11 17 19)
            (6 7 27 26)
            (27 6 2 23)
            (2 23 22 3)
            (3 22 26 7)
            (26 27 23 22)

            // Side 2
            (12 13 5 4)
            (8 12 4 0)
            (9 8 0 1)
            (13 9 1 5)
            (4 5 25 24)
            (0 4 24 20)
            (1 0 20 21)
            (5 1 21 25)
            (21 20 24 25)
            (18 16 9 13)
        );
    }
);



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