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

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

//                             Lh
//         |<--------------------------------------->|
//         v                                         v
// y2   -->5--------------6--------------------------7
//      ^  |              |                          |
//      |  ^y     II      |           III            | Outlet
//      |  |   x          |                          |
// y1   |  2--->----------3--------------------------4
//      |  |              |                          ^
//      |  |              |                          |
//    Lv|  |              |                          |
//      |  |              |                        Dh|
//      |  |      I       |
//      |  |              |
//      |  |              |
//      |  |              |
//      v  |              |    Dv
// y0   -->0--------------1<-----
//              Inlet
//         x0             x1                        x2



// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User input

convertToMeters 1;

// origin
x0  0;
y1  0;
z0  0;

// Dimensions
Dv  0.305;
Lv  6.285;

Dh  0.22;
Lh  3.22;

// z delta
dz  0.1;

// cell size (xy) and number (z)
dxy 5e-3;

nz  1;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters

x1      #calc "$x0 + $Dv";
x2      #calc "$x0 + $Lh";

y2      #calc "$y1 + $Dh";
y0      #calc "$y2 - $Lv";

z1      #calc "$z0 + $dz";

nx01    #calc "int(($x1 - $x0)/$dxy)";
nx12    #calc "int(0.45*($x2 - $x1)/$dxy)";

ny01    #calc "int(0.4*($y1 - $y0)/$dxy)";
ny12    #calc "int(($y2 - $y1)/$dxy)";

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

vertices
(
    ($x0 $y0 $z0)   // 0
    ($x1 $y0 $z0)   // 1
    ($x0 $y1 $z0)   // 2
    ($x1 $y1 $z0)   // 3
    ($x2 $y1 $z0)   // 4
    ($x0 $y2 $z0)   // 5
    ($x1 $y2 $z0)   // 6
    ($x2 $y2 $z0)   // 7

    ($x0 $y0 $z1)   // 8  (0)
    ($x1 $y0 $z1)   // 9  (1)
    ($x0 $y1 $z1)   // 10 (2)
    ($x1 $y1 $z1)   // 11 (3)
    ($x2 $y1 $z1)   // 12 (4)
    ($x0 $y2 $z1)   // 13 (5)
    ($x1 $y2 $z1)   // 14 (6)
    ($x2 $y2 $z1)   // 15 (7)
);

blocks
(
    hex (0 1 3 2  8  9 11 10) ($nx01 $ny01 $nz) simpleGrading (1 0.2 1)
    hex (2 3 6 5 10 11 14 13) ($nx01 $ny12 $nz) simpleGrading (1 1   1)
    hex (3 4 7 6 11 12 15 14) ($nx12 $ny12 $nz) simpleGrading (4 1   1)
);

boundary
(
    inlet
    {
        type    patch;
        faces
        (
            (0 1 9 8)
        );
    }

    outlet
    {
        type    patch;
        faces
        (
            (4 7 15 12)
        );
    }

    walls
    {
        type    wall;
        faces
        (
            (2 0  8 10)
            (1 3 11  9)
            (5 2 10 13)
            (6 5 13 14)
            (3 4 12 11)
            (7 6 14 15)
        );
    }

    frontAndBack
    {
        type    empty;
        faces
        (
            (0 2 3 1)
            (2 5 6 3)
            (3 6 7 4)

            ( 8  9 11 10)
            (10 11 14 13)
            (11 12 15 14)
        );
    }
);

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