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)
36 scalar xFacePatch = detachPatch.faceCentres()[detachFaceI].x();
37 scalar yFacePatch = detachPatch.faceCentres()[detachFaceI].y();
38 scalar zFacePatch = detachPatch.faceCentres()[detachFaceI].z();
40 forAll(faceCentres(),faceI)
42 vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]);
44 scalar dd = n & vector(0,0,1);
48 scalar xFaceMesh = faceCentres()[faceI].x();
49 scalar yFaceMesh = faceCentres()[faceI].y();
50 scalar zFaceMesh = faceCentres()[faceI].z();
54 mag(xFaceMesh-xFacePatch) < valves()[valveI].detachTol() &&
55 mag(yFaceMesh-yFacePatch) < valves()[valveI].detachTol() &&
56 mag(zFaceMesh-zFacePatch) <
57 valves()[valveI].detachDistance() + valves()[valveI].detachTol() &&
58 mag(zFaceMesh-zFacePatch) >
59 valves()[valveI].detachDistance() - valves()[valveI].detachTol() &&
60 (zFaceMesh-zFacePatch) > SMALL
63 bool isHead = isACylinderHeadFace(cylinderHeadFaces, faceI);
67 headList.append(faceI);
80 Info << "Found " << ndf << " internal faces and "
81 << nHead << " head faces for the valve n. "
82 << valveI + 1 << endl;
87 boolList flip(df.size(), false);
89 const vector& pistonAxis = piston().cs().axis();
93 if (isInternalFace(df[dfI]))
95 if ((areas[df[dfI]] & pistonAxis) > 0)
104 "void engineTopoFvMesh::addZonesAndModifiers()"
105 ) << "found boundary face in valve detach definition "
106 << "for valve " << valveI + 1
107 << ". This is not allowed. Detach faces: "
108 << df << " nInternalFaces: " << nInternalFaces()
109 << abort(FatalError);
113 // Add detach face zone
117 "detachFaceZoneV" + Foam::name(valveI + 1),
127 Info << "No valve attach/detach for valve " << valveI + 1 << endl;