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();
39 detachPatch.faceCentres()[detachFaceI].y();
41 detachPatch.faceCentres()[detachFaceI].z();
43 forAll(faceCentres(),faceI)
45 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
47 scalar dd = n & vector(0,0,1);
51 scalar xFaceMesh = faceCentres()[faceI].x();
52 scalar yFaceMesh = faceCentres()[faceI].y();
53 scalar zFaceMesh = faceCentres()[faceI].z();
57 mag(xFaceMesh-xFacePatch)
58 < valves()[valveI].detachTol()
60 mag(yFaceMesh-yFacePatch)
61 < valves()[valveI].detachTol()
63 mag(zFaceMesh-zFacePatch)
65 valves()[valveI].detachDistance()
66 + valves()[valveI].detachTol()
68 mag(zFaceMesh-zFacePatch)
70 valves()[valveI].detachDistance()
71 - valves()[valveI].detachTol()
73 (zFaceMesh-zFacePatch)
77 bool isHead = isACylinderHeadFace
85 headList.append(faceI);
98 Info << "Found " << ndf << " internal faces and "
99 << nHead << " head faces for the valve n. "
100 << valveI + 1 << endl ;
105 boolList flip(df.size(), false);
107 const vector& pistonAxis = piston().cs().axis();
111 if (isInternalFace(df[dfI]))
113 if ((areas[df[dfI]] & pistonAxis) > 0)
122 "void engineTopoFvMesh::addZonesAndModifiers()"
123 ) << "found boundary face in valve detach definition "
124 << "for valve " << valveI + 1
125 << ". This is not allowed. Detach faces: "
126 << df << " nInternalFaces: " << nInternalFaces()
127 << abort(FatalError);
131 // Add detach face zone
135 "detachFaceZoneV" + Foam::name(valveI + 1),
145 Info << "No valve attach/detach for valve " << valveI + 1 << endl;