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;
24 scalar zLower = GREAT;
28 forAll (faceCentres(), faceI)
30 scalar zc = faceCentres()[faceI].z();
31 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
32 scalar dd = n & vector(0,0,1);
36 if (zPistV - zc > 0 && zPistV - zc < dl)
42 if (zc - zPistV > 0 && zc - zPistV < dh)
51 && zc < zPistV + delta()
54 foundAtLeastOne = true;
55 if ((faceAreas()[faceI] & vector(0,0,1)) < 0)
57 flipZone1[nZoneFaces1] = true;
60 zone1[nZoneFaces1] = faceI;
66 Info << "Gambit mesh, found " << nZoneFaces1 << " faces for layer addition removal" << endl;
67 Info << "Piston patch size = " << boundaryMesh()[piston().patchID().index()].size() << endl;
69 // if no cut was found use the layer above
73 Info << "NOT FOUND AT LEAST ONE" << endl;
74 Info << "zHigher = " << zHigher << endl;
78 forAll (faceCentres(), faceI)
80 scalar zc = faceCentres()[faceI].z();
81 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
82 scalar dd = n & vector(0,0,1);
89 && zc < zPistV + delta()
92 if ((faceAreas()[faceI] & vector(0,0,1)) < 0)
94 flipZone1[nZoneFaces1] = true;
97 zone1[nZoneFaces1] = faceI;
105 zone1.setSize(nZoneFaces1);
106 flipZone1.setSize(nZoneFaces1);
124 // Construct point zones
127 // Points below the piston which moves with the piston displacement
128 DynamicList<label> pistonPoints(nPoints() / 10);
130 forAll (points(), pointI)
132 scalar zCoord = points()[pointI].z();
134 if (zCoord > deckHeight() - delta())
137 else if (zCoord < zPistV + delta())
139 pistonPoints.append(pointI);
140 //Info<< "PistonPoint:" << pointI << " coord:" << points[pointI]
151 pistonPoints.shrink(),
160 else if(piston().patchID().active() && offSet() <= SMALL)
162 label pistonPatchID = piston().patchID().index();
164 const polyPatch& pistonPatch =
165 boundaryMesh()[piston().patchID().index()];
167 labelList pistonPatchLabels(pistonPatch.size(), pistonPatch.start());
169 forAll (pistonPatchLabels, i)
171 pistonPatchLabels[i] += i;
181 boolList(pistonPatchLabels.size(), true),
187 // Construct point zones
189 scalar zPistV = max(boundary()[pistonPatchID].patch().localPoints()).z();
191 // Points below the piston which moves with the piston displacement
192 DynamicList<label> pistonPoints(nPoints() / 10);
194 forAll (points(), pointI)
196 scalar zCoord = points()[pointI].z();
198 if (zCoord > deckHeight() - delta())
201 else if (zCoord < zPistV + delta())
203 pistonPoints.append(pointI);
204 //Info<< "PistonPoint:" << pointI << " coord:" << points[pointI]
214 pistonPoints.shrink(),