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

//          X0                                      X1  X2         X3
//                                 Atmosphere
//  Y5      2---------------------------------------5---9----------13
//          |                                       |   |           |
//          |                                       |   |           |
//          |                                       |   |           |
//          |                 II                    |III|    VI     |
//          |                                       |   |           |
//  Y4      +                                       +   +           +
//          |                                       |   |           |
//  Y3      1---------------------------------------4---8----------12
//     Inlet|                  I                    |   |           |
//  Y2      0---------------------------------------3   |           |
//                                                      |           |
//                                                      |     V     |
//                                                      |           |
//                                                      |           |
//                                                      |           |
//                                                      |           |
//  Y1                                                  7----------11
//                                                      |           |
//                                                Outlet|    IV     |
//                                                      |           |
//  Y0                                                  6----------10

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

// Input

convertToMeters 0.001;

// Coordinates

x0  -750;
x1     0;
x2    10;
x3   150;

y0  -400;
y1  -350;
y2     0;
y3    50;
y4   100;
y5   530;

z0  -200;
z1   200;

// Number of cells

nx01  75;
nx12   1;
nx23  14;

ny01   2;
ny13  25;
ny23   5;
ny34   5;
ny45  25;

nz01  40;

// Cell grading

gradingTop      3;
gradingBottom   0.33;

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

// Derived parameters

ratioDy34 #calc "($y4 - $y3) / ($y5 - $y3)";
ratioDy45 #calc "1 - $ratioDy34";

ny35      #calc "($ny34 + $ny45)";

ratioNy34 #calc "$ny34 / $ny35";
ratioNy45 #calc "1 - $ratioNy34";

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

vertices
(
    ($x0 $y2 $z0)   //  0
    ($x0 $y3 $z0)   //  1
    ($x0 $y5 $z0)   //  2

    ($x1 $y2 $z0)   //  3
    ($x1 $y3 $z0)   //  4
    ($x1 $y5 $z0)   //  5

    ($x2 $y0 $z0)   //  6
    ($x2 $y1 $z0)   //  7
    ($x2 $y3 $z0)   //  8
    ($x2 $y5 $z0)   //  9

    ($x3 $y0 $z0)   // 10
    ($x3 $y1 $z0)   // 11
    ($x3 $y3 $z0)   // 12
    ($x3 $y5 $z0)   // 13


    ($x0 $y2 $z1)   // 14
    ($x0 $y3 $z1)   // 15
    ($x0 $y5 $z1)   // 16

    ($x1 $y2 $z1)   // 17
    ($x1 $y3 $z1)   // 18
    ($x1 $y5 $z1)   // 19

    ($x2 $y0 $z1)   // 20
    ($x2 $y1 $z1)   // 21
    ($x2 $y3 $z1)   // 22
    ($x2 $y5 $z1)   // 23

    ($x3 $y0 $z1)   // 24
    ($x3 $y1 $z1)   // 25
    ($x3 $y3 $z1)   // 26
    ($x3 $y5 $z1)   // 27
);

blocks
(
    hex (0 3 4 1 14 17 18 15) ($nx01 $ny23 $nz01) simpleGrading (1 1 1)  // I
    hex (1 4 5 2 15 18 19 16) ($nx01 $ny35 $nz01) simpleGrading
    (
        1
        (
            ($ratioDy34 $ratioNy34           1)
            ($ratioDy45 $ratioNy45 $gradingTop)
        )
        1
    )  // II

    hex (4 8 9 5 18 22 23 19) ($nx12 $ny35 $nz01) simpleGrading
    (
        1
        (
            ($ratioDy34 $ratioNy34           1)
            ($ratioDy45 $ratioNy45 $gradingTop)
        )
        1
    )  // III

    hex (6 10 11 7 20 24 25 21) ($nx23 $ny01 $nz01) simpleGrading (1 1              1)  // IV
    hex (7 11 12 8 21 25 26 22) ($nx23 $ny13 $nz01) simpleGrading (1 $gradingBottom 1)  // V
    hex (8 12 13 9 22 26 27 23) ($nx23 $ny35 $nz01) simpleGrading
    (
        1
        (
            ($ratioDy34 $ratioNy34           1)
            ($ratioDy45 $ratioNy45 $gradingTop)
        )
        1
    )  // VI
);

boundary
(
    inlet
    {
        type    patch;
        faces
        (
            (0 14 15 1)
        );
    }

    outlet
    {
        type    patch;
        faces
        (
            (6 20 21 7)
        );
    }

    atmosphere
    {
        type    patch;
        faces
        (
            (2 16 19  5)
            (5 19 23  9)
            (9 23 27 13)
        );
    }

    tray
    {
        type    wall;
        faces
        (
            (0 3 17 14)
        );
    }

    walls
    {
        type    wall;
        faces
        (
            ( 1 15 16  2)
            ( 3  4 18 17)
            ( 4  8 22 18)
            ( 7 21 22  8)
            ( 6 10 24 20)
            (10 11 25 24)
            (11 12 26 25)
            (12 13 27 26)
        );
    }

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

            (14 17 18 15)
            (15 18 19 16)
            (18 22 23 19)
            (20 24 25 21)
            (21 25 26 22)
            (22 26 27 23)
        );
    }
);

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