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)
14 valves_[valveI].detachInCylinderPatchID().active()
15 && valves_[valveI].detachInPortPatchID().active()
18 Info<< "Adding detach boundary for valve "
19 << valveI + 1 << endl;
21 const vectorField& areas = Sf().internalField();
23 DynamicList<label> df;
28 DynamicList<label> headList;
31 const polyPatch& detachPatch =
32 boundaryMesh()[valves()[valveI].poppetPatchID().index()];
34 forAll(detachPatch.faceCentres(), detachFaceI)
37 detachPatch.faceCentres()[detachFaceI].x();
40 detachPatch.faceCentres()[detachFaceI].y();
43 detachPatch.faceCentres()[detachFaceI].z();
45 forAll(faceCentres(),faceI)
47 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
49 scalar dd = n & vector(0,0,1);
53 scalar xFaceMesh = faceCentres()[faceI].x();
54 scalar yFaceMesh = faceCentres()[faceI].y();
55 scalar zFaceMesh = faceCentres()[faceI].z();
59 mag(xFaceMesh-xFacePatch)
60 < valves()[valveI].detachTol()
62 mag(yFaceMesh-yFacePatch)
63 < valves()[valveI].detachTol()
65 mag(zFaceMesh-zFacePatch)
66 < valves()[valveI].detachDistance()
67 + valves()[valveI].detachTol()
69 mag(zFaceMesh-zFacePatch)
70 > valves()[valveI].detachDistance()
71 - valves()[valveI].detachTol()
73 (zFaceMesh-zFacePatch) > SMALL
76 bool isHead = isACylinderHeadFace
84 headList.append(faceI);
97 Info << "Found " << ndf << " internal faces and "
98 << nHead << " head faces for the valve n. "
99 << valveI + 1 << endl ;
104 boolList flip(df.size(), false);
106 const vector& pistonAxis = piston().cs().axis();
110 if (isInternalFace(df[dfI]))
112 if ((areas[df[dfI]] & pistonAxis) > 0)
121 "void engineTopoFvMesh::addZonesAndModifiers()"
122 ) << "found boundary face in valve detach definition "
123 << "for valve " << valveI + 1
124 << ". This is not allowed. Detach faces: "
125 << df << " nInternalFaces: " << nInternalFaces()
126 << abort(FatalError);
130 // Add detach face zone
134 "detachFaceZoneV" + Foam::name(valveI + 1),
144 Info << "No valve attach/detach for valve " << valveI + 1 << endl;