3 if (piston().patchID().active() && offSet() > SMALL)
8 label pistonPatchID = piston().patchID().index();
10 scalar zPist = max(boundary()[pistonPatchID].patch().localPoints()).z();
12 Info << "zPist = " << zPist << endl;
14 scalar zPistV = zPist + offSet();
16 Info << "zPistV = " << zPistV << endl;
18 labelList zone1(faceCentres().size());
19 boolList flipZone1(faceCentres().size(), false);
20 label nZoneFaces1 = 0;
22 bool foundAtLeastOne = false;
23 scalar zHigher = GREAT;
27 forAll (faceCentres(), faceI)
29 scalar zc = faceCentres()[faceI].z();
30 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
31 scalar dd = n & vector(0,0,1);
35 if (zPistV - zc > 0 && zPistV - zc < dl)
40 if (zc - zPistV > 0 && zc - zPistV < dh)
49 && zc < zPistV + delta()
52 foundAtLeastOne = true;
53 if ((faceAreas()[faceI] & vector(0,0,1)) < 0)
55 flipZone1[nZoneFaces1] = true;
58 zone1[nZoneFaces1] = faceI;
64 Info << "Gambit mesh, found " << nZoneFaces1 << " faces for layer addition removal" << endl;
65 Info << "Piston patch size = " << boundaryMesh()[piston().patchID().index()].size() << endl;
67 // if no cut was found use the layer above
71 Info << "NOT FOUND AT LEAST ONE" << endl;
72 Info << "zHigher = " << zHigher << endl;
76 forAll (faceCentres(), faceI)
78 scalar zc = faceCentres()[faceI].z();
79 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
80 scalar dd = n & vector(0,0,1);
87 && zc < zPistV + delta()
90 if ((faceAreas()[faceI] & vector(0,0,1)) < 0)
92 flipZone1[nZoneFaces1] = true;
95 zone1[nZoneFaces1] = faceI;
103 zone1.setSize(nZoneFaces1);
104 flipZone1.setSize(nZoneFaces1);
122 // Construct point zones
125 // Points below the piston which moves with the piston displacement
126 DynamicList<label> pistonPoints(nPoints() / 10);
128 forAll (points(), pointI)
130 scalar zCoord = points()[pointI].z();
132 if (zCoord > deckHeight() - delta())
135 else if (zCoord < zPistV + delta())
137 pistonPoints.append(pointI);
138 //Info<< "PistonPoint:" << pointI << " coord:" << points[pointI]
149 pistonPoints.shrink(),
158 else if(piston().patchID().active() && offSet() <= SMALL)
160 label pistonPatchID = piston().patchID().index();
162 const polyPatch& pistonPatch =
163 boundaryMesh()[piston().patchID().index()];
165 labelList pistonPatchLabels(pistonPatch.size(), pistonPatch.start());
167 forAll (pistonPatchLabels, i)
169 pistonPatchLabels[i] += i;
179 boolList(pistonPatchLabels.size(), true),
185 // Construct point zones
187 scalar zPistV = max(boundary()[pistonPatchID].patch().localPoints()).z();
189 // Points below the piston which moves with the piston displacement
190 DynamicList<label> pistonPoints(nPoints() / 10);
192 forAll (points(), pointI)
194 scalar zCoord = points()[pointI].z();
196 if (zCoord > deckHeight() - delta())
199 else if (zCoord < zPistV + delta())
201 pistonPoints.append(pointI);
202 //Info<< "PistonPoint:" << pointI << " coord:" << points[pointI]
212 pistonPoints.shrink(),