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

geometry
{
    cylinder
    {
        type searchableCylinder;
        point1 (0 -4 0);
        point2 (0 4 0);
        radius 0.7;
    }
    cylinder2
    {
        type    searchableExtrudedCircle;
        file    "curve2.vtk";
        radius  0.5;
    }
    inletPlane
    {
        type    searchablePlate;
        origin  (-4 -50 -50);
        span    (0 100 100);
    }
}

vertices
(
    // Vertical cylinder
    name v0 project (-1 -0.1 -1) (cylinder cylinder2)
    name v1 project ( 1 -0.1 -1) (cylinder)
    name v2 project ( 1  0.9 -1) (cylinder)
    name v3 project (-1  0.9 -1) (cylinder cylinder2)
    name v4 project (-1 -0.1  1) (cylinder cylinder2)
    name v5 project ( 1 -0.1  1) (cylinder)
    name v6 project ( 1  0.9  1) (cylinder)
    name v7 project (-1  0.9  1) (cylinder cylinder2)


    // Horizontal cylinder
    name v8  project (-4  0 -0.5) (cylinder2 inletPlane)
    name v9  project (-4  1 -0.5) (cylinder2 inletPlane)
    name v10 project (-4  0  0.5) (cylinder2 inletPlane)
    name v11 project (-4  1  0.5) (cylinder2 inletPlane)


    // On top of vertical cylinder
    name v12 project (-1 2 -1) (cylinder)
    name v13 project ( 1 2 -1) (cylinder)
    name v14 project ( 1 2  1) (cylinder)
    name v15 project (-1 2  1) (cylinder)

    // Below vertical cylinder
    name v16 project (-1 -1 -1) (cylinder)
    name v17 project ( 1 -1 -1) (cylinder)
    name v18 project ( 1 -1  1) (cylinder)
    name v19 project (-1 -1  1) (cylinder)
);

blocks
(
    hex (v0 v1 v2 v3 v4 v5 v6 v7) (8 8 8) simpleGrading (1 1 1)
    name sideBlock hex (v0 v3 v9 v8 v4 v7 v11 v10) (8 20 8)
        simpleGrading (1 1 1)

    hex ( v7 v6 v2 v3 v15 v14 v13 v12) (8 8 8) simpleGrading (1 1 1)
    hex (v16 v19 v18 v17 v0 v4 v5 v1) (8 8 8) simpleGrading (1 1 1)
);

edges
(
    project v0 v1 (cylinder)
    project v1 v2 (cylinder)
    project v2 v3 (cylinder)

    project v1 v5 (cylinder)
    project v2 v6 (cylinder)

    project v4 v5 (cylinder)
    project v5 v6 (cylinder)
    project v6 v7 (cylinder)

    // Common face
    project v3 v0 (cylinder cylinder2)
    project v3 v7 (cylinder cylinder2)
    project v7 v4 (cylinder cylinder2)
    project v0 v4 (cylinder cylinder2)

    // Inlet
    project v8 v10 (cylinder2 inletPlane)
    project v10 v11 (cylinder2 inletPlane)
    project v11 v9 (cylinder2 inletPlane)
    project v9 v8 (cylinder2 inletPlane)

    // Sides of horizontal cylinder. Use projectCurve to do interpolation
    // for radial direction to keep points along edges at constant radial
    // direction.
    projectCurve v8  v0 (cylinder2)
    projectCurve v9  v3 (cylinder2)
    projectCurve v11 v7 (cylinder2)
    projectCurve v10 v4 (cylinder2)



    // Top cylinder
    project v12 v15 (cylinder)
    project v15 v14 (cylinder)
    project v14 v13 (cylinder)
    project v13 v12 (cylinder)

    // Bottom cylinder
    project v16 v17 (cylinder)
    project v17 v18 (cylinder)
    project v18 v19 (cylinder)
    project v19 v16 (cylinder)
);

faces
(
    // Common face
    project (v0 v4 v7 v3) cylinder

    project (v4 v5 v6 v7) cylinder
    project (v0 v1 v2 v3) cylinder

    project (v8 v0 v4 v10) cylinder2
    project (v10 v4 v7 v11) cylinder2
    project (v11 v7 v3 v9) cylinder2
    project (v8 v9 v3 v0) cylinder2
);


defaultPatch
{
    name walls;
    type wall;
}

boundary
(
    side
    {
        type    patch;
        faces   ((sideBlock 3));   //((v8 v10 v11 v9));
    }

    inlet
    {
        type    patch;
        faces   ((v17 v18 v19 v16));
    }

    outlet
    {
        type    patch;
        faces   ((v12 v15 v14 v13));
    }
);

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