/*--------------------------------*- C++ -*----------------------------------*\
  ==  == ====== ====   ====    |
                    \\     ||  | Multiphase Code Repository by HZDR
  ======   //   ||  || ===//   | Website: https://doi.org/10.14278/rodare.767
  ||  ||  //    ||  // || \\   | License: GPL-3.0-or-later
  ==  == ====== ====   ==  ==  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// User input

convertToMeters 1;

radius 0.0256;
length 2.6;
angle  2.5;

// Axis origin
x0 0;
y0 0;
z0 0.43;

// Number of cells
radialCells 26;
axialCells 520;

// Cell grading
radialGrading 1;
axialGrading  1;

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

// Derived parameters

xx  #calc "$x0 + ($radius*cos(degToRad($angle*0.5)))";
yp  #calc "$y0 + ($radius*sin(degToRad($angle*0.5)))";
ym  #calc "$y0 - ($radius*sin(degToRad($angle*0.5)))";
zl  #calc "$z0 + $length";

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

vertices
(
    ($x0 $y0 $z0) // pt 0
    ($xx $ym $z0) // pt 1
    ($xx $yp $z0) // pt 2
    ($x0 $y0 $z0) // pt 3
    ($x0 $y0 $zl) // pt 4
    ($xx $ym $zl) // pt 5
    ($xx $yp $zl) // pt 6
    ($x0 $y0 $zl) // pt 7
);

blocks
(
    hex (0 1 2 3 4 5 6 7)
    ($radialCells 1 $axialCells)
    simpleGrading ($radialGrading 1 $axialGrading)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 2 1 3)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (4 5 6 7)
        );
    }

    walls
    {
        type wall;
        faces
        (
            (1 2 6 5)
        );
    }

    front
    {
        type wedge;
        faces
        (
            (0 1 5 4)
        );
    }

    back
    {
        type wedge;
        faces
        (
            (2 3 7 6)
        );
    }

    axis
    {
        type empty;
        faces
        (
            (3 0 4 7)
        );
    }
);

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