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)
16 valves_[valveI].detachInCylinderPatchID().active()
17 && valves_[valveI].detachInPortPatchID().active()
23 Info<< "Adding detach boundary for valve "
24 << valveI + 1 << endl;
26 const vectorField& areas = Sf().internalField();
28 DynamicList<label> df;
32 DynamicList<label> headList;
35 const polyPatch& detachPatch =
36 boundaryMesh()[valves()[valveI].poppetPatchID().index()];
38 forAll(detachPatch.faceCentres(), detachFaceI)
40 scalar xFacePatch = detachPatch.faceCentres()[detachFaceI].x();
41 scalar yFacePatch = detachPatch.faceCentres()[detachFaceI].y();
42 scalar zFacePatch = detachPatch.faceCentres()[detachFaceI].z();
44 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) < valves()[valveI].detachTol() &&
60 mag(yFaceMesh-yFacePatch) < valves()[valveI].detachTol() &&
61 mag(zFaceMesh-zFacePatch) <
62 valves()[valveI].detachDistance() + valves()[valveI].detachTol() &&
63 mag(zFaceMesh-zFacePatch) >
64 valves()[valveI].detachDistance() - valves()[valveI].detachTol() &&
65 (zFaceMesh-zFacePatch) > SMALL
68 bool isHead = isACylinderHeadFace(cylinderHeadFaces, faceI);
72 headList.append(faceI);
88 Info << "Found " << ndf << " internal faces and "
89 << nHead << " head faces for the valve n. " << valveI + 1 << endl ;
95 boolList flip(df.size(), false);
97 const vector& pistonAxis = piston().cs().axis();
101 if (isInternalFace(df[dfI]))
103 if ((areas[df[dfI]] & pistonAxis) > 0)
112 "void engineTopoFvMesh::addZonesAndModifiers()"
113 ) << "found boundary face in valve detach definition "
114 << "for valve " << valveI + 1
115 << ". This is not allowed. Detach faces: "
116 << df << " nInternalFaces: " << nInternalFaces()
117 << abort(FatalError);
121 // Add detach face zone
125 "detachFaceZoneV" + Foam::name(valveI + 1),
135 Info << "No valve attach/detach for valve " << valveI + 1 << endl;