1 const polyPatch& cylinderHead =
2 boundaryMesh()[boundaryMesh().findPatchID("cylinderHead")];
4 labelList cylinderHeadFaces(cylinderHead.size());
5 forAll(cylinderHeadFaces, i)
7 cylinderHeadFaces[i] = cylinderHead.start() + i;
10 forAll(valves(), valveI)
13 valves_[valveI].detachInCylinderPatchID().active()
14 && valves_[valveI].detachInPortPatchID().active()
17 Info<< "Adding detach boundary for valve "
18 << valveI + 1 << endl;
20 const vectorField& areas = Sf().internalField();
22 DynamicList<label> df;
26 DynamicList<label> headList;
29 const polyPatch& detachPatch =
30 boundaryMesh()[valves()[valveI].poppetPatchID().index()];
32 pointField detachPoints(detachPatch.faceCentres());
33 detachPoints += valves()[valveI].cs().axis()*valves()[valveI].detachDistance();
35 forAll(faceCentres(), faceI)
39 min(mag(detachPoints - faceCentres()[faceI])) < valves()[valveI].detachTol()
43 bool isHead = isACylinderHeadFace(cylinderHeadFaces, faceI);
47 headList.append(faceI);
59 Info<< "Found " << ndf << " internal faces and "
60 << nHead << " head faces for the valve n. "
61 << valveI + 1 << endl ;
66 boolList flip(df.size(), false);
68 const vector& valveAxis = valves()[valveI].cs().axis();
72 if (isInternalFace(df[dfI]))
74 if ((areas[df[dfI]] & valveAxis) > 0)
83 "void engineTopoFvMesh::addZonesAndModifiers()"
84 ) << "found boundary face in valve detach definition "
85 << "for valve " << valveI + 1
86 << ". This is not allowed. Detach faces: "
87 << df << " nInternalFaces: " << nInternalFaces()
92 // Add detach face zone
97 "detachFaceZoneV" + Foam::name(valveI + 1),
109 forAll(valves(), valveI)
113 valves_[valveI].detachInCylinderPatchID().active()
114 && valves_[valveI].detachInPortPatchID().active()
117 Info<< "Adding detach boundary for valve "
118 << valveI + 1 << endl;
120 const vectorField& areas = Sf().internalField();
122 DynamicList<label> df;
127 DynamicList<label> headList;
130 const polyPatch& detachPatch =
131 boundaryMesh()[valves()[valveI].poppetPatchID().index()];
133 forAll(detachPatch.faceCentres(), detachFaceI)
135 // scalar xFacePatch = detachPatch.faceCentres()[detachFaceI].x();
136 // scalar yFacePatch = detachPatch.faceCentres()[detachFaceI].y();
137 // scalar zFacePatch = detachPatch.faceCentres()[detachFaceI].z();
139 point pFacePatch = valves()[valveI].cs().toLocal(detachPatch.faceCentres()[detachFaceI]);
141 scalar xFacePatch = pFacePatch.x();
142 scalar yFacePatch = pFacePatch.y();
143 scalar zFacePatch = pFacePatch.z();
145 forAll(faceCentres(),faceI)
148 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
151 scalar dd = n & valves()[valveI].cs().axis();
153 // if (mag(dd) > 0.1)
156 point pFaceMesh = valves()[valveI].cs().toLocal(faceCentres()[faceI]);
158 scalar xFaceMesh = pFaceMesh.x();
159 scalar yFaceMesh = pFaceMesh.y();
160 scalar zFaceMesh = pFaceMesh.z();
162 // Info << "mag(xFaceMesh-xFacePatch) = " << mag(xFaceMesh-xFacePatch) << endl;
167 mag(xFaceMesh-xFacePatch) < valvePlaneTol_ &&
168 mag(yFaceMesh-yFacePatch) < valvePlaneTol_ &&
169 mag(zFaceMesh-zFacePatch) <
170 valves()[valveI].detachDistance() + valves()[valveI].detachTol() &&
171 mag(zFaceMesh-zFacePatch) >
172 valves()[valveI].detachDistance() - valves()[valveI].detachTol()
173 // && (zFaceMesh-zFacePatch) > SMALL
176 bool isHead = isACylinderHeadFace(cylinderHeadFaces, faceI);
180 headList.append(faceI);
196 Info << "Found " << ndf << " internal faces and "
197 << nHead << " head faces for the valve n. " << valveI + 1 << endl ;
203 boolList flip(df.size(), false);
205 const vector& valveAxis = valves()[valveI].cs().axis();
209 if (isInternalFace(df[dfI]))
211 if ((areas[df[dfI]] & valveAxis) > 0)
220 "void engineTopoFvMesh::addZonesAndModifiers()"
221 ) << "found boundary face in valve detach definition "
222 << "for valve " << valveI + 1
223 << ". This is not allowed. Detach faces: "
224 << df << " nInternalFaces: " << nInternalFaces()
225 << abort(FatalError);
229 // Add detach face zone
234 "detachFaceZoneV" + Foam::name(valveI + 1),
245 Info << "No valve attach/detach for valve " << valveI + 1 << endl;
251 Info << "Added attach/detach faces zones for valves" << endl;