File size: 2,844 Bytes
5a600cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Block definition for a porosity with an angled inlet/outlet
// the porosity is not aligned with the main axes

units [mm];

angle 45 [deg];

width     50;
lenInlet  150;
lenPoro   100;
lenOutlet 100;

yzCells      20;
nInletCells  15;
nPoroCells   20;
nOutletCells 20;

vertices #codeStream
{
    codeInclude
    #{
        #include "pointField.H"
        #include "transformField.H"
    #};

    code
    #{
        const scalar halfWidth = ($width)/2.0;

        // Length between the bend and outlet
        const scalar distOutlet = $lenPoro + $lenOutlet;

        pointField points
        ({
            point(0,          0,      -halfWidth), // pt 0
            point($lenPoro,   0,      -halfWidth), // pt 1
            point(distOutlet, 0,      -halfWidth), // pt 2
            point(0,          $width, -halfWidth), // pt 3
            point($lenPoro,   $width, -halfWidth), // pt 4
            point(distOutlet, $width, -halfWidth)  // pt 5
        });

        // Rotate points around z-axis
        points = transform(Rz($<scalar>angle), points);

        // Append points 6 and 7
        points.append(point(-$lenInlet, points[0].y(), points[0].z()));  // pt 6
        points.append(point(-$lenInlet, points[3].y(), points[3].z()));  // pt 7

        // Duplicate z points
        points.append(cmptMultiply(points, vector(1, 1, -1)));

        os  << points;
    #};
};

blocks
(
    // Inlet block
    hex (6 0 3 7 14 8 11 15)
    inlet  ($nInletCells $yzCells $yzCells) simpleGrading (1 1 1)

    // Porosity block
    hex (0 1 4 3 8 9 12 11)
    porosity ($nPoroCells $yzCells $yzCells) simpleGrading (1 1 1)

    // Outlet block
    hex (1 2 5 4 9 10 13 12)
    outlet ($nOutletCells $yzCells $yzCells)  simpleGrading (1 1 1)
);

defaultPatch
{
    name walls;
    type wall;
}

boundary
(
    porosityWall
    {
        type wall;
        faces
        (
            (8 9 12 11)
            (0 3 4 1)
            (0 1 9 8)
            (3 11 12 4)
        );
    }

    inlet
    {
        type patch;
        faces
        (
            (14 15 7 6)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (2 5 13 10)
        );
    }
);

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