Formatting
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / pistonSliding / addValvesFacesPointZonesPistonSliding.H
blob3649c69a962e9868c6d6a580da9c2daa2965807b
2     // adding face zones for the vertical valves
4     for (label valveI = 0; valveI < nValves(); valveI++)
5     {
6         // If both sides of the interface exist, add sliding interface
7         // for a valve
8         if
9         (
10             valves_[valveI].curtainInCylinderPatchID().active()
11          && valves_[valveI].curtainInPortPatchID().active()
12         )
13         {
14             Info<< "Adding sliding interface zones for curtain of valve "
15                 << valveI + 1 << endl;
17             pz.append
18             (
19                 new pointZone
20                 (
21                     "cutPointsV" + Foam::name(valveI + 1),
22                     labelList(0),
23                     nPointZones,
24                     pointZones()
25                 )
26             );
28             nPointZones++;
30             const polyPatch& cylCurtain =
31                 boundaryMesh()
32                     [valves_[valveI].curtainInCylinderPatchID().index()];
34             labelList cylCurtainLabels(cylCurtain.size(), cylCurtain.start());
36             forAll (cylCurtainLabels, i)
37             {
38                 cylCurtainLabels[i] += i;
39             }
41             fz.append
42             (
43                 new faceZone
44                 (
45                     "curtainCylZoneV" + Foam::name(valveI + 1),
46                     cylCurtainLabels,
47                     boolList(cylCurtainLabels.size(), false),
48                     nFaceZones,
49                     faceZones()
50                 )
51             );
53             nFaceZones++;
55             const polyPatch& portCurtain =
56                 boundaryMesh()
57                     [valves_[valveI].curtainInPortPatchID().index()];
59             labelList portCurtainLabels
60             (
61                 portCurtain.size(),
62                 portCurtain.start()
63             );
65             forAll (portCurtainLabels, i)
66             {
67                 portCurtainLabels[i] += i;
68             }
70             fz.append
71             (
72                 new faceZone
73                 (
74                     "curtainPortZoneV" + Foam::name(valveI + 1),
75                     portCurtainLabels,
76                     boolList(portCurtainLabels.size(), false),
77                     nFaceZones,
78                     faceZones()
79                 )
80             );
82             nFaceZones++;
84             // Add empty zone for cut faces
86             fz.append
87             (
88                 new faceZone
89                 (
90                     "cutFaceZoneV" + Foam::name(valveI + 1),
91                     labelList(0),
92                     boolList(0, false),
93                     nFaceZones,
94                     faceZones()
95                 )
96             );
98             nFaceZones++;
100         }
101         else
102         {
103             Info << "No valve curtain for valve " << valveI + 1 << endl;
104         }
108         // for each valve the following zones have to be created:
109         //
110         //  - movingFaceZone
111         //  - movingPointZone
112         //  - staticFaceZone
113         //  - staticPointZone
116         faceSet layeringFacesTop(*this, valves_[valveI].layeringFacesTopName());
118 //        if (valves_[valveI].poppetPatchID().active())
119 //        {
120             Info << "Adding face zone for valve top patch layer addition/removal" << endl;
122 //            label valvePatchID = valves_[valveI].poppetPatchID().index();
124 //            const polyPatch& valveTopPatch = boundaryMesh()[valvePatchID];
126 //            labelList valveTopLayerFaces(0);
127 //            boolList flipZone1(0);
128             boolList flipZone1(layeringFacesTop.size(), false);
130             forAll(layeringFacesTop.toc(), faceI)
131             {
133                     vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
135                     scalar dd = n & vector(0,0,1);
137                     if (mag(dd) > SMALL)
138                     {
140                             if ((faceAreas()[faceI] & vector(0,0,1)) > 0)
141                             {
142                                 flipZone1[faceI] = true;
143                             }
144                             else
145                             {
146                                 flipZone1[faceI] = false;
147                             }
148                    }
151             }
153 //        }
155         fz.append
156         (
157             new faceZone
158             (
159                 "layeringFacesTopZoneV" + Foam::name(valveI + 1),
160                 layeringFacesTop.toc(),
161                 boolList(layeringFacesTop.size(), true),
162                 nFaceZones,
163                 faceZones()
164             )
165         );
167         nFaceZones++;
169         faceSet layeringFacesBottom(*this, valves_[valveI].layeringFacesBottomName());
171         fz.append
172         (
173             new faceZone
174             (
175                 "layeringFacesBottomZoneV" + Foam::name(valveI + 1),
176                 layeringFacesBottom.toc(),
177                 boolList(layeringFacesBottom.size(), true),
178                 nFaceZones,
179                 faceZones()
180             )
181         );
183         nFaceZones++;
185         cellSet movingCellsTop(*this, valves_[valveI].movingCellsTopName());
187         cz.append
188         (
189             new cellZone
190             (
191                 "movingCellsTopZoneV" + Foam::name(valveI + 1),
192                 movingCellsTop.toc(),
193                 nCellZones,
194                 cellZones()
195             )
196         );
198         nCellZones++;
200         cellSet movingCellsBottom(*this, valves_[valveI].movingCellsBottomName());
202         cz.append
203         (
204             new cellZone
205             (
206                 "movingCellsBottomZoneV" + Foam::name(valveI + 1),
207                 movingCellsBottom.toc(),
208                 nCellZones,
209                 cellZones()
210             )
211         );
213         nCellZones++;
215         pointSet movingPointsTop(*this, valves_[valveI].movingPointsTopName());
217         pz.append
218         (
219             new pointZone
220             (
221                 "movingPointsTopZoneV" + Foam::name(valveI + 1),
222                 movingPointsTop.toc(),
223                 nPointZones,
224                 pointZones()
225             )
226         );
228         nPointZones++;
230         pointSet movingPointsBottom(*this, valves_[valveI].movingPointsBottomName());
232         pz.append
233         (
234             new pointZone
235             (
236                 "movingPointsBottomZoneV" + Foam::name(valveI + 1),
237                 movingPointsBottom.toc(),
238                 nPointZones,
239                 pointZones()
240             )
241         );
243         nPointZones++;
245         cellSet movingCells(*this, valves_[valveI].movingCellsName());
247         cz.append
248         (
249             new cellZone
250             (
251                 "movingCellsZoneV" + Foam::name(valveI + 1),
252                 movingCells.toc(),
253                 nCellZones,
254                 cellZones()
255             )
256         );
258         nCellZones++;
260         cellSet staticCells(*this, valves_[valveI].staticCellsName());
262         cz.append
263         (
264             new cellZone
265             (
266                 "staticCellsZoneV" + Foam::name(valveI + 1),
267                 staticCells.toc(),
268                 nCellZones,
269                 cellZones()
270             )
271         );
273         nCellZones++;
276         pointSet movingPoints(*this, valves_[valveI].movingPointsName());
278         pz.append
279         (
280             new pointZone
281             (
282                 "movingPointsV" + Foam::name(valveI + 1),
283                 movingPoints.toc(),
284                 nPointZones,
285                 pointZones()
286             )
287         );
289         nPointZones++;
291         pointSet staticPoints(*this, valves_[valveI].staticPointsName());
293         pz.append
294         (
295             new pointZone
296             (
297                 "staticPointsV" + Foam::name(valveI + 1),
298                 staticPoints.toc(),
299                 nPointZones,
300                 pointZones()
301             )
302         );
304         nPointZones++;
306         pointSet movingInternalPoints(*this, valves_[valveI].movingInternalPointsName());
308         pz.append
309         (
310             new pointZone
311             (
312                 "movingInternalPointsV" + Foam::name(valveI + 1),
313                 movingInternalPoints.toc(),
314                 nPointZones,
315                 pointZones()
316             )
317         );
319         nPointZones++;