1 // Moving mask: moving cells inside the valves....
5 for(label i = 1; i <= nValves(); i++)
9 if(valves_[i-1].poppetPatchID().active())
12 labelList movingCells(nCells());
14 label nMovingCells = 0;
16 label valvePatchID = valves_[i-1].poppetPatchID().index();
17 const polyPatch& valveTopPatch = boundaryMesh()[valvePatchID];
18 scalar minPopZ = min(boundary()[valvePatchID].patch().localPoints()).z();
20 forAll(cellCentres(),cellI)
22 const vector& v = cellCentres()[cellI];
31 movingCells[nMovingCells] = cellI;
37 movingCells.setSize(nMovingCells);
38 Info << "Number of cells in the moving region poppet valve: " << nMovingCells << endl;
44 "movingCellsTopV"+ Foam::name(i),
53 // valve top points (move all with valve displacement)
54 DynamicList<label> valveTopPoints(nPoints() / 10);
55 List<bool> valveTopPoint(nPoints(), false);
56 bool foundOne = false;
58 const cellList& c = cells();
59 const faceList& f = allFaces();
61 forAll (movingCells, cellI)
63 const cell& curCell = c[movingCells[cellI]];
65 forAll (curCell, faceI)
67 // Mark all the points as moving
68 const face& curFace = f[curCell[faceI]];
70 forAll (curFace, pointI)
73 const point& p = points()[curFace[pointI]];
75 forAll(valveTopPatch.localPoints(), j)
77 scalar xFacePatch = valveTopPatch.localPoints()[j].x();
78 scalar yFacePatch = valveTopPatch.localPoints()[j].y();
79 scalar zFacePatch = valveTopPatch.localPoints()[j].z();
83 mag(p.x() - xFacePatch) < poppetValveTol_
85 mag(p.y() - yFacePatch) < poppetValveTol_
87 mag(p.z() - zFacePatch) < valves_[i-1].topLayerOffset() +
88 valves_[i-1].topLayerTol()
92 valveTopPoint[curFace[pointI]] = true;
102 forAll(valveTopPoint, pointI)
104 if(valveTopPoint[pointI])
106 valveTopPoints.append(pointI);
114 "valveTopPointsV"+ Foam::name(i),
115 valveTopPoints.shrink(),
125 if(valves_[i-1].bottomPatchID().active())
128 labelList movingCells(nCells());
130 label nMovingCells = 0;
132 label valvePatchID = valves_[i-1].bottomPatchID().index();
133 const polyPatch& valveBottomPatch = boundaryMesh()[valvePatchID];
134 scalar maxPopZ = max(boundary()[valvePatchID].patch().localPoints()).z();
137 forAll(cellCentres(),cellI)
139 const vector& v = cellCentres()[cellI];
145 v.z() < maxPopZ + SMALL
148 movingCells[nMovingCells] = cellI;
154 movingCells.setSize(nMovingCells);
155 Info << "Number of cells in the moving region bottom valve: " << nMovingCells << endl;
161 "movingCellsBotV"+ Foam::name(i),
171 // valve bottom points (move all with valve displacement)
172 DynamicList<label> valveBottomPoints(nPoints() / 10);
173 List<bool> valveBottomPoint(nPoints(), false);
174 bool foundOne = false;
177 const cellList& c = cells();
178 const faceList& f = allFaces();
180 forAll (movingCells, cellI)
182 const cell& curCell = c[movingCells[cellI]];
184 forAll (curCell, faceI)
186 // Mark all the points as moving
187 const face& curFace = f[curCell[faceI]];
189 forAll (curFace, pointI)
191 forAll(valveBottomPatch.localPoints(), j)
193 scalar xFacePatch = valveBottomPatch.localPoints()[j].x();
194 scalar yFacePatch = valveBottomPatch.localPoints()[j].y();
195 scalar zFacePatch = valveBottomPatch.localPoints()[j].z();
197 const point& p = points()[curFace[pointI]];
201 mag(p.x() - xFacePatch) < bottomValveTol_
203 mag(p.y() - yFacePatch) < bottomValveTol_
205 mag(p.z() - zFacePatch) < valves_[i-1].bottomLayerOffset() +
206 valves_[i-1].bottomLayerTol()
210 valveBottomPoint[curFace[pointI]] = true;
220 forAll(valveBottomPoint, pointI)
222 if(valveBottomPoint[pointI])
224 valveBottomPoints.append(pointI);
234 "valveBottomPointsV"+ Foam::name(i),
235 valveBottomPoints.shrink(),