Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / engine / engineTopoChangerMesh / accordionEngineMesh / addAttachDetachFacesAccordionEngineMesh.H
blob8a18096985081537de6b3467f117bc5b367dc8b4
2     for (label valveI = 0; valveI < nValves(); valveI++)
3     {
4         
5         label nFlipDetach = 0;
6         
7         faceSet detachFaces(*this, valves_[valveI].detachFacesName());
8         
9         boolList flipDetach(detachFaces.size(), false);
10                    
11         const polyPatch& bottomPatch =
12         boundaryMesh()[valves()[valveI].bottomPatchID().index()];
13         
14         vector bottomPatchCenter = sum(mag(bottomPatch.faceAreas()) *
15         bottomPatch.faceCentres())/sum(mag(bottomPatch.faceAreas()));
16                 
17         forAll(detachFaces.toc(), i)
18         {
19             vector radius = faceCentres()[detachFaces.toc()[i]] - bottomPatchCenter;
20             
21             radius/= mag(radius);
22             
23             if(((faceAreas()[detachFaces.toc()[i]]) & (radius) / mag(faceAreas()[detachFaces.toc()[i]])) < 0)
24             {
25 //                flipDetach[i] = true;
26 //                nFlipDetach++;
27             }
28                
29         }
30         
31         Info << "valve n. " << valveI << " found " << nFlipDetach << " flipped faces for detach" << endl;
32                 
33         fz.append
34         (
35             new faceZone
36             (
37                 "detachFaceZoneV" + Foam::name(valveI + 1),
38                 detachFaces.toc(),
39                 flipDetach,
40                 nFaceZones,
41                 faceZones()
42             )
43         );
44         
45         nFaceZones++;     
46     }   
48     Info << "Added attach/detach faces zones for valves" << endl;
49