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

convertToMeters 0.01;  // centimetres.  According to https://cfd.direct/openfoam/user-guide/v8-blockmesh/

#include "../scale";  // gives global N
rx 3.5355339059327373;
// = // rx #calc "5.0 / Foam::sqrt(2.0)";  // length of short side of rectangular triangle with long side =5

arcNx #calc "50 * $N";
arcNy #calc " 30 * $N";

thickness 100;    // in other files 0.5 = 50 cm = 50 is assumed to be a valid z coordinate (probes)

vertices
(
    // F = front (z = 0), B = back   (z = $thickness)
    // bottom = b, t = top, n = middle (left/right of center of cylinder)
    // l = left, r = right, m = middle (under center of cylinder), s = other square around cylinder corner
    // c = cylinder
    // (0, 0, 0) = center of cylinder in front
    name Fbl (-20 -20 0)
    name Bbl (-20 -20 $thickness)
    name Fbs (20 -20 0)
    name Bbs (20 -20 $thickness)
    name Fbr (200 -20 0)
    name Bbr (200 -20 $thickness)
    name Ftl (-20 21 0)
    name Btl (-20 21 $thickness)
    name Fts (20 21 0)
    name Bts (20 21 $thickness)
    name Ftr (200 21 0)
    name Btr (200 21 $thickness)
    name Fcbl (#calc "-$rx" #calc "-$rx" 0)
    name Bcbl (#calc "-$rx" #calc "-$rx" $thickness)
    name Fcbr ($rx #calc "-$rx" 0)
    name Bcbr ($rx #calc "-$rx" $thickness)
    name Fctl (#calc "-$rx" $rx 0)
    name Bctl (#calc "-$rx" $rx $thickness)
    name Fctr ($rx $rx 0)
    name Bctr ($rx $rx $thickness)
);

blocks
(
      name arcl hex (Ftl Fbl Fcbl Fctl Btl Bbl Bcbl Bctl) ($arcNx $arcNy 1) simpleGrading (1 1 1)
      name arct hex (Fts Ftl Fctl Fctr Bts Btl Bctl Bctr) ($arcNx $arcNy 1) simpleGrading (1 1 1)
      name arcr hex (Fbs Fts Fctr Fcbr Bbs Bts Bctr Bcbr) ($arcNx $arcNy 1) simpleGrading (1 1 1)
      name arcb hex (Fbl Fbs Fcbr Fcbl Bbl Bbs Bcbr Bcbl) ($arcNx $arcNy 1) simpleGrading (1 1 1)
      name pipe hex (Fbs Fbr Ftr Fts Bbs Bbr Btr Bts) (#calc "9 * $arcNx / 2" $arcNx 1) simpleGrading (1 1 1)
);

edges
(
    arc Fcbl Fctl (-5 0 0)   // = Fcl
    arc Fctl Fctr (0 5 0)    // = Fct
    arc Fctr Fcbr (5 0 0)    // = Fcr
    arc Fcbr Fcbl (0 -5 0)   // = Fcb
    arc Bcbl Bctl (-5 0 $thickness)   // = Bcl
    arc Bctl Bctr (0 5 $thickness)    // = Bct
    arc Bctr Bcbr (5 0 $thickness)    // = Bcr
    arc Bcbr Bcbl (0 -5 $thickness)   // = Bcb
);

boundary
(
    bottomwall
    {
        type wall;
        faces
        (
            (Fbl Fbs Bbl Bbs)
            (Fbs Bbs Bbr Fbr)
        );
    }
    topwall
    {
        type wall;
        faces
        (
            (Fts Bts Btl Ftl)
            (Ftr Btr Bts Fts)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (Fbl Ftl Btl Bbl)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (Fbr Bbr Btr Ftr)
        );
    }
    cylinder
    {
        type wall;
        faces
        (
            (Fcbl Fcbr Bcbl Bcbr)
            (Fcbr Fctr Bcbr Bctr)
            (Fctr Fctl Bctr Bctl)
            (Fctl Fcbl Bctl Bcbl)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            // copied from blocks
            (Ftl Fbl Fcbl Fctl)
            (Btl Bbl Bcbl Bctl)
            (Fts Ftl Fctl Fctr)
            (Bts Btl Bctl Bctr)
            (Fbs Fts Fctr Fcbr)
            (Bbs Bts Bctr Bcbr)
            (Fbl Fbs Fcbr Fcbl)
            (Bbl Bbs Bcbr Bcbl)
            (Fbs Fbr Ftr Fts)
            (Bbs Bbr Btr Bts)
        );
    }
);

mergePatchPairs
(
);

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