/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2506                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale 1;

vertices
(
    // BACK PLANE (z = 0.0)
    (0.0   0.0  0.0)  // 0  (Inlet)
    (0.6   0.0  0.0)  // 1  (Test section start)
    (0.65  0.0  0.0)  // 2  (Rib 1 Start)
    (0.66  0.0  0.0)  // 3  (Rib 1 End)
    (0.75  0.0  0.0)  // 4  (Rib 2 Start)
    (0.76  0.0  0.0)  // 5  (Rib 2 End)
    (0.85  0.0  0.0)  // 6  (Rib 3 Start)
    (0.86  0.0  0.0)  // 7  (Rib 3 End)
    (0.95  0.0  0.0)  // 8  (Rib 4 Start)
    (0.96  0.0  0.0)  // 9  (Rib 4 End)
    (1.05  0.0  0.0)  // 10 (Rib 5 Start)
    (1.06  0.0  0.0)  // 11 (Rib 5 End)
    (1.10  0.0  0.0)  // 12 (Test section end)
    (1.50  0.0  0.0)  // 13 (Outlet)

    // y1 = 0.01 (Top height of the ribs)
    (0.0   0.01 0.0)  // 14
    (0.6   0.01 0.0)  // 15
    (0.65  0.01 0.0)  // 16
    (0.66  0.01 0.0)  // 17
    (0.75  0.01 0.0)  // 18
    (0.76  0.01 0.0)  // 19
    (0.85  0.01 0.0)  // 20
    (0.86  0.01 0.0)  // 21
    (0.95  0.01 0.0)  // 22
    (0.96  0.01 0.0)  // 23
    (1.05  0.01 0.0)  // 24
    (1.06  0.01 0.0)  // 25
    (1.10  0.01 0.0)  // 26
    (1.50  0.01 0.0)  // 27

    // y2 = 0.08 (Top Wall)
    (0.0   0.08 0.0)  // 28
    (0.6   0.08 0.0)  // 29
    (0.65  0.08 0.0)  // 30
    (0.66  0.08 0.0)  // 31
    (0.75  0.08 0.0)  // 32
    (0.76  0.08 0.0)  // 33
    (0.85  0.08 0.0)  // 34
    (0.86  0.08 0.0)  // 35
    (0.95  0.08 0.0)  // 36
    (0.96  0.08 0.0)  // 37
    (1.05  0.08 0.0)  // 38
    (1.06  0.08 0.0)  // 39
    (1.10  0.08 0.0)  // 40
    (1.50  0.08 0.0)  // 41

    // FRONT PLANE (z = 0.01)
    (0.0   0.0  0.01) // 42
    (0.6   0.0  0.01) // 43
    (0.65  0.0  0.01) // 44
    (0.66  0.0  0.01) // 45
    (0.75  0.0  0.01) // 46
    (0.76  0.0  0.01) // 47
    (0.85  0.0  0.01) // 48
    (0.86  0.0  0.01) // 49
    (0.95  0.0  0.01) // 50
    (0.96  0.0  0.01) // 51
    (1.05  0.0  0.01) // 52
    (1.06  0.0  0.01) // 53
    (1.10  0.0  0.01) // 54
    (1.50  0.0  0.01) // 55

    // y1 = 0.01
    (0.0   0.01 0.01) // 56
    (0.6   0.01 0.01) // 57
    (0.65  0.01 0.01) // 58
    (0.66  0.01 0.01) // 59
    (0.75  0.01 0.01) // 60
    (0.76  0.01 0.01) // 61
    (0.85  0.01 0.01) // 62
    (0.86  0.01 0.01) // 63
    (0.95  0.01 0.01) // 64
    (0.96  0.01 0.01) // 65
    (1.05  0.01 0.01) // 66
    (1.06  0.01 0.01) // 67
    (1.10  0.01 0.01) // 68
    (1.50  0.01 0.01) // 69

    // y2 = 0.08
    (0.0   0.08 0.01) // 70
    (0.6   0.08 0.01) // 71
    (0.65  0.08 0.01) // 72
    (0.66  0.08 0.01) // 73
    (0.75  0.08 0.01) // 74
    (0.76  0.08 0.01) // 75
    (0.85  0.08 0.01) // 76
    (0.86  0.08 0.01) // 77
    (0.95  0.08 0.01) // 78
    (0.96  0.08 0.01) // 79
    (1.05  0.08 0.01) // 80
    (1.06  0.08 0.01) // 81
    (1.10  0.08 0.01) // 82
    (1.50  0.08 0.01) // 83
);

// ========================================================================= //
// THE SQUARE-CELL GRADING ARRAYS (Matched to Author's Paper)
// ========================================================================= //

CAVITY_Y_GRADING ((0.4 0.4 5) (0.2 0.2 1) (0.4 0.4 0.2));
INTER_RIB_X_GRADING ((0.15 0.25 15) (0.7 0.5 1) (0.15 0.25 0.066));
TOP_Y_GRADING ((0.2 0.35 25) (0.75 0.5 1) (0.05 0.15 0.1));

blocks
(
    // ===================================================================== //
    // Bottom Layer (y = 0.0 to 0.01m) 
    // ===================================================================== //
    
    hex (0 1 15 14 42 43 57 56) (90 19 1) simpleGrading (0.1 $CAVITY_Y_GRADING 1)
    hex (1 2 16 15 43 44 58 57) (22 19 1) simpleGrading (0.5 $CAVITY_Y_GRADING 1)
    
    hex (3 4 18 17 45 46 60 59) (46 19 1) simpleGrading ( $INTER_RIB_X_GRADING $CAVITY_Y_GRADING 1 )
    hex (5 6 20 19 47 48 62 61) (46 19 1) simpleGrading ( $INTER_RIB_X_GRADING $CAVITY_Y_GRADING 1 )
    hex (7 8 22 21 49 50 64 63) (46 19 1) simpleGrading ( $INTER_RIB_X_GRADING $CAVITY_Y_GRADING 1 )
    hex (9 10 24 23 51 52 66 65) (46 19 1) simpleGrading ( $INTER_RIB_X_GRADING $CAVITY_Y_GRADING 1 )
    
    hex (11 12 26 25 53 54 68 67) (22 19 1) simpleGrading (2 $CAVITY_Y_GRADING 1)
    hex (12 13 27 26 54 55 69 68) (90 19 1) simpleGrading (10 $CAVITY_Y_GRADING 1)

    // ===================================================================== //
    // Top Layer (y = 0.01 to 0.08m)
    // ===================================================================== //
    
    hex (14 15 29 28 56 57 71 70) (90 40 1) simpleGrading (0.1 $TOP_Y_GRADING 1)
    hex (15 16 30 29 57 58 72 71) (22 40 1) simpleGrading (0.5 $TOP_Y_GRADING 1)
    
    hex (16 17 31 30 58 59 73 72) (10 40 1) simpleGrading (1 $TOP_Y_GRADING 1)
    hex (17 18 32 31 59 60 74 73) (46 40 1) simpleGrading ( $INTER_RIB_X_GRADING $TOP_Y_GRADING 1 )
    
    hex (18 19 33 32 60 61 75 74) (10 40 1) simpleGrading (1 $TOP_Y_GRADING 1)
    hex (19 20 34 33 61 62 76 75) (46 40 1) simpleGrading ( $INTER_RIB_X_GRADING $TOP_Y_GRADING 1 )
    
    hex (20 21 35 34 62 63 77 76) (10 40 1) simpleGrading (1 $TOP_Y_GRADING 1)
    hex (21 22 36 35 63 64 78 77) (46 40 1) simpleGrading ( $INTER_RIB_X_GRADING $TOP_Y_GRADING 1 )
    
    hex (22 23 37 36 64 65 79 78) (10 40 1) simpleGrading (1 $TOP_Y_GRADING 1)
    hex (23 24 38 37 65 66 80 79) (46 40 1) simpleGrading ( $INTER_RIB_X_GRADING $TOP_Y_GRADING 1 )
    
    hex (24 25 39 38 66 67 81 80) (10 40 1) simpleGrading (1 $TOP_Y_GRADING 1)
    hex (25 26 40 39 67 68 82 81) (22 40 1) simpleGrading (2 $TOP_Y_GRADING 1)
    
    hex (26 27 41 40 68 69 83 82) (90 40 1) simpleGrading (10 $TOP_Y_GRADING 1)
);

edges
(
);

boundary
(
    inlet { type patch; faces ((0 42 56 14) (14 56 70 28)); }
    outlet { type patch; faces ((13 27 69 55) (27 41 83 69)); }
    bottomWallInlet { type wall; faces ((0 1 43 42)); }
    bottomWallTest
    {
        type wall;
        faces
        (
            (1 2 44 43) (3 4 46 45) (5 6 48 47) (7 8 50 49) (9 10 52 51) (11 12 54 53) 
            (2 16 58 44) (16 17 59 58) (17 3 45 59)
            (4 18 60 46) (18 19 61 60) (19 5 47 61)
            (6 20 62 48) (20 21 63 62) (21 7 49 63)
            (8 22 64 50) (22 23 65 64) (23 9 51 65)
            (10 24 66 52) (24 25 67 66) (25 11 53 67)
        );
    }
    bottomWallOutlet { type wall; faces ((12 13 55 54)); }
    topWall
    {
        type wall;
        faces
        (
            (28 70 71 29) (29 71 72 30) (30 72 73 31) (31 73 74 32) (32 74 75 33) 
            (33 75 76 34) (34 76 77 35) (35 77 78 36) (36 78 79 37) (37 79 80 38) 
            (38 80 81 39) (39 81 82 40) (40 82 83 41)
        );
    }
);

mergePatchPairs
(
);

defaultPatch
{
    name frontAndBack;
    type empty;
}