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

//              Xi          X0                                 X1
//                                      Wall
//  Y2          14=========15==================================16
//              |           |                                   |
//      Water   |    III    |                IV                 |
//      Inlet   |   Baffle  |                                   |
//              7~~~~~~~~~~~8                                   |   Outlet
//  Y1          6~~~~~~~~~~~8-----------------------------------9
//      Air     |           |                                   |
//      Inlet   |     I     |                II                 |
//  Y0          0===========1===================================2
//                                      Wall

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

// User input

convertToMeters 1;

// x coordinates
xi     -1;
x0      0;
x1      12;

Lxi     #calc "$x0 - $xi";
Lxt     #calc "$x1 - $x0";

// y coordinates
y0      0;
y1      ${${FOAM_CASE}/caseParameterDict!hWater};
y2      0.1;

Lyl     #calc "$y1 - $y0";
Lyg     #calc "$y2 - $y1";

// z coordinates
z0      0;
z1      0.2;


// Number of cells
nCell   12;

nxi     #calc "int($Lxi*$nCell)";
nxt     #calc "int($Lxt*$nCell)";

nyl     #calc "int(2.0 / 3.0 * $nCell)";
nyg     $nCell;

nz      1;

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

vertices
(
    // bottom
    ($xi $y0 $z0)   // pt 0
    ($x0 $y0 $z0)   // pt 1
    ($x1 $y0 $z0)   // pt 2

    ($xi $y0 $z1)   // pt 3
    ($x0 $y0 $z1)   // pt 4
    ($x1 $y0 $z1)   // pt 5

    // water level
    ($xi $y1 $z0)   // pt 6
    ($xi $y1 $z0)   // pt 7 - same geometry as above but additional baffle
    ($x0 $y1 $z0)   // pt 8
    ($x1 $y1 $z0)   // pt 9

    ($xi $y1 $z1)   // pt 10
    ($xi $y1 $z1)   // pt 11 - same geometry as above but additional baffle
    ($x0 $y1 $z1)   // pt 12
    ($x1 $y1 $z1)   // pt 13

    // top
    ($xi $y2 $z0)   // pt 14
    ($x0 $y2 $z0)   // pt 15
    ($x1 $y2 $z0)   // pt 16

    ($xi $y2 $z1)   // pt 17
    ($x0 $y2 $z1)   // pt 18
    ($x1 $y2 $z1)   // pt 19
);

blocks
(
    hex (0  1  8  6  3  4 12 10) ($nxi $nyl $nz) simpleGrading (1 1 1)  // I
    hex (1  2  9  8  4  5 13 12) ($nxt $nyl $nz) simpleGrading (1 1 1)  // II
    hex (7  8 15 14 11 12 18 17) ($nxi $nyg $nz) simpleGrading (1 1 1)  // III
    hex (8  9 16 15 12 13 19 18) ($nxt $nyg $nz) simpleGrading (1 1 1)  // IV
);

boundary
(
    walls
    {
        type wall;
        faces
        (
            ( 0  1  4  3)
            ( 1  2  5  4)
            (15 14 17 18)
            (16 15 18 19)
            ( 6  8 12 10)   // baffle, liquid side
            ( 8  7 11 12)   // baffle, gas side
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (2  9 13  5)
            (9 16 19 13)
        );
    }

    inlet_liquid
    {
        type        mappedInternal;
        distance    #calc "-$Lxi";
        faces
        (
            (6 0 3 10)
        );
    }

    inlet_gas
    {
        type        mappedInternal;
        distance    #calc "-$Lxi";
        faces
        (
            (14 7 11 17)
        );
    }

    frontAndBack
    {
        type empty;
        faces
        (
            (0  6  8 1)
            (1  8  9 2)
            (7 14 15 8)
            (8 15 16 9)

            ( 3  4 12 10)
            ( 4  5 13 12)
            (11 12 18 17)
            (12 13 19 18)
        );
    }
);

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