/*--------------------------------*- C++ -*----------------------------------*\
  ==  == ====== ====   ====    |
                    \\     ||  | Multiphase Cases Repository by HZDR
  ======   //   ||  || ===//   | Website: https://doi.org/10.14278/rodare.811
  ||  ||  //    ||  // || \\   | License: Creative Commons Attribution 4.0
  ==  == ====== ====   ==  ==  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// User input

convertToMeters 0.001;

inletRadius  2.54;
domainRadius 114.3;
length       400;
angle        1.0;

// Axis origin
x0 0.0;
y0 0.0;
z0 0.0;

// Number of cells
inletRadialCells 5;
inletAxialCells  25;

// Cell grading
radialGrading 5.5;
axialGrading  7;

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

// Derived parameters

x1  #calc "$x0 + 5*$inletRadius";
x2  #calc "$x0 + $length";
y1  #calc "$y0 + ($inletRadius*cos(degToRad($angle*0.5)))";
y2  #calc "$y0 + ($domainRadius*cos(degToRad($angle*0.5)))";
zp1 #calc "$z0 + ($inletRadius*sin(degToRad($angle*0.5)))";
zn1 #calc "$z0 - ($inletRadius*sin(degToRad($angle*0.5)))";
zp2 #calc "$z0 + ($domainRadius*sin(degToRad($angle*0.5)))";
zn2 #calc "$z0 - ($domainRadius*sin(degToRad($angle*0.5)))";

domainRadialCells #calc "10*$inletRadialCells";
domainAxialCells  #calc "10*$inletAxialCells";

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

vertices
(
    ($x0 $y0  $z0)  //pt 0
    ($x0 $y1 $zn1)  //pt 1
    ($x0 $y2 $zn2)  //pt 2
    ($x0 $y2 $zp2)  //pt 3
    ($x0 $y1 $zp1)  //pt 4
    ($x0 $y0  $z0)  //pt 5
    ($x1 $y0  $z0)  //pt 6
    ($x1 $y1 $zn1)  //pt 7
    ($x1 $y2 $zn2)  //pt 8
    ($x1 $y2 $zp2)  //pt 9
    ($x1 $y1 $zp1)  //pt 10
    ($x1 $y0  $z0)  //pt 11
    ($x2 $y0  $z0)  //pt 12
    ($x2 $y1 $zn1)  //pt 13
    ($x2 $y2 $zn2)  //pt 14
    ($x2 $y2 $zp2)  //pt 15
    ($x2 $y1 $zp1)  //pt 16
    ($x2 $y0  $z0)  //pt 17
);

blocks
(
    hex (0 1 4 5 6 7 10 11)
    ($inletRadialCells 1 $inletAxialCells)
    simpleGrading (1.7 1 1)
    hex (6 7 10 11 12 13 16 17)
    ($inletRadialCells 1 $domainAxialCells)
    simpleGrading (1.7 1 $axialGrading)
    hex (1 2 3 4 7 8 9 10)
    ($domainRadialCells 1 $inletAxialCells)
    simpleGrading ($radialGrading 1 1)
    hex (7 8 9 10 13 14 15 16)
    ($domainRadialCells 1 $domainAxialCells)
    simpleGrading ($radialGrading 1 $axialGrading)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 5 4 1)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (12 13 16 17)
            (13 14 15 16)
        );
    }
    side
    {
        type wall;
        faces
        (
            (2 3 9 8)
            (8 9 15 14)
        );
    }
    bottom
    {
        type wall;
        faces
        (
            (1 4 3 2)
        );
    }
    front
    {
        type wedge;
        faces
        (
            (5 11 10 4)
            (11 17 16 10)
            (4 10 9 3)
            (10 16 15 9)
        );
    }
    back
    {
        type wedge;
        faces
        (
            (0 1 7 6)
            (6 7 13 12)
            (1 2 8 7)
            (7 8 14 13)
        );
    }
    axis
    {
        type empty;
        faces
        (
            (0 6 11 5)
            (6 12 17 11)
        );
    }
);

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