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)
18 forAll(valves(), valveI)
24 valves_[valveI].detachInCylinderPatchID().active()
25 && valves_[valveI].detachInPortPatchID().active()
31 Info<< "Adding detach boundary for valve "
32 << valveI + 1 << endl;
34 const vectorField& areas = Sf().internalField();
36 DynamicList<label> df;
42 DynamicList<label> headList;
45 const polyPatch& detachPatch =
46 boundaryMesh()[valves()[valveI].poppetPatchID().index()];
48 pointField detachPoints(detachPatch.faceCentres());
49 detachPoints += valves()[valveI].cs().axis() * valves()[valveI].detachDistance();
51 forAll(faceCentres(), faceI)
56 min(mag(detachPoints - faceCentres()[faceI])) < valves()[valveI].detachTol()
60 bool isHead = isACylinderHeadFace(cylinderHeadFaces, faceI);
64 headList.append(faceI);
76 Info << "Found " << ndf << " internal faces and "
77 << nHead << " head faces for the valve n. " << valveI + 1 << endl ;
83 boolList flip(df.size(), false);
85 const vector& valveAxis = valves()[valveI].cs().axis();
89 if (isInternalFace(df[dfI]))
91 if ((areas[df[dfI]] & valveAxis) > 0)
100 "void engineTopoFvMesh::addZonesAndModifiers()"
101 ) << "found boundary face in valve detach definition "
102 << "for valve " << valveI + 1
103 << ". This is not allowed. Detach faces: "
104 << df << " nInternalFaces: " << nInternalFaces()
105 << abort(FatalError);
109 // Add detach face zone
114 "detachFaceZoneV" + Foam::name(valveI + 1),
127 forAll(valves(), valveI)
133 valves_[valveI].detachInCylinderPatchID().active()
134 && valves_[valveI].detachInPortPatchID().active()
140 Info<< "Adding detach boundary for valve "
141 << valveI + 1 << endl;
143 const vectorField& areas = Sf().internalField();
145 DynamicList<label> df;
151 DynamicList<label> headList;
154 const polyPatch& detachPatch =
155 boundaryMesh()[valves()[valveI].poppetPatchID().index()];
157 forAll(detachPatch.faceCentres(), detachFaceI)
159 // scalar xFacePatch = detachPatch.faceCentres()[detachFaceI].x();
160 // scalar yFacePatch = detachPatch.faceCentres()[detachFaceI].y();
161 // scalar zFacePatch = detachPatch.faceCentres()[detachFaceI].z();
163 point pFacePatch = valves()[valveI].cs().toLocal(detachPatch.faceCentres()[detachFaceI]);
165 scalar xFacePatch = pFacePatch.x();
166 scalar yFacePatch = pFacePatch.y();
167 scalar zFacePatch = pFacePatch.z();
169 forAll(faceCentres(),faceI)
172 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
175 scalar dd = n & valves()[valveI].cs().axis();
177 // if (mag(dd) > 0.1)
180 point pFaceMesh = valves()[valveI].cs().toLocal(faceCentres()[faceI]);
182 scalar xFaceMesh = pFaceMesh.x();
183 scalar yFaceMesh = pFaceMesh.y();
184 scalar zFaceMesh = pFaceMesh.z();
186 // Info << "mag(xFaceMesh-xFacePatch) = " << mag(xFaceMesh-xFacePatch) << endl;
191 mag(xFaceMesh-xFacePatch) < valvePlaneTol_ &&
192 mag(yFaceMesh-yFacePatch) < valvePlaneTol_ &&
193 mag(zFaceMesh-zFacePatch) <
194 valves()[valveI].detachDistance() + valves()[valveI].detachTol() &&
195 mag(zFaceMesh-zFacePatch) >
196 valves()[valveI].detachDistance() - valves()[valveI].detachTol()
197 // && (zFaceMesh-zFacePatch) > SMALL
200 bool isHead = isACylinderHeadFace(cylinderHeadFaces, faceI);
204 headList.append(faceI);
220 Info << "Found " << ndf << " internal faces and "
221 << nHead << " head faces for the valve n. " << valveI + 1 << endl ;
227 boolList flip(df.size(), false);
229 const vector& valveAxis = valves()[valveI].cs().axis();
233 if (isInternalFace(df[dfI]))
235 if ((areas[df[dfI]] & valveAxis) > 0)
244 "void engineTopoFvMesh::addZonesAndModifiers()"
245 ) << "found boundary face in valve detach definition "
246 << "for valve " << valveI + 1
247 << ". This is not allowed. Detach faces: "
248 << df << " nInternalFaces: " << nInternalFaces()
249 << abort(FatalError);
253 // Add detach face zone
258 "detachFaceZoneV" + Foam::name(valveI + 1),
269 Info << "No valve attach/detach for valve " << valveI + 1 << endl;
275 Info << "Added attach/detach faces zones for valves" << endl;