Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / engine / engineTopoChangerMesh / engineValveSliding / moveValvePointsEngineValveSliding.H
blob6ede7c36e67491684ea90f4b17bf2a322a7ceb0f
1     const labelListList& cp = cellPoints();
2     // valves
3     forAll(valves_,valveI)
4     {
5         vector valveVel =
6             valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
8 //         scalar valveDeltaX = valves_[valveI].curVelocity()*
9 //             valves_[valveI].cs().axis().x()*engTime().deltaT().value() ;
10 //         scalar valveDeltaY = valves_[valveI].curVelocity()*
11 //             valves_[valveI].cs().axis().y()*engTime().deltaT().value() ;
12         scalar valveDeltaZ = valves_[valveI].curVelocity()*
13             valves_[valveI].cs().axis().z()*engTime().deltaT().value() ;
15         if(valves_[valveI].curLift() >= valves_[valveI].deformationLift())
16         {
17             bool isMoving(false);
19             if(mag(valves_[valveI].curVelocity()) > 0)
20             {
21                 Info<< "Valve n. " << valveI << " is moving with velocity = "
22                     << valves_[valveI].curVelocity() << endl;
23                 isMoving = true;
24             }
26             Info<< "Valve displacement for valve " << valveI << " = "
27                 << valveDeltaZ << endl;
29             if
30             (
31                 valves_[valveI].poppetPatchID().active()
32              && valves_[valveI].isOpen()
33             )
34             {
35                 List<bool> valveTopPoint(newPoints.size(), false);
38                 label layeringVPtsIndex =
39                     pointZones().findZoneID
40                     (
41                         "movingPointsTopZoneV" + Foam::name(valveI+1)
42                     );
44                 const labelList& layeringVPoints =
45                     pointZones()[layeringVPtsIndex];
47                 forAll(layeringVPoints, i)
48                 {
49                     point& p = newPoints[layeringVPoints[i]];
51                     p += valveVel * engTime().deltaT().value();
53                     valveTopPoint[layeringVPoints[i]] = true;
54                 }
55 */                
57                 label layeringVCellsIndex =
58                     cellZones().findZoneID
59                     (
60                         "movingCellsTopZoneV" + Foam::name(valveI+1)
61                     );
63                 const labelList& layeringVCells =
64                     cellZones()[layeringVCellsIndex];
65                 
66                 labelList layeringVPoints;
67                 
68                 boolList count(newPoints.size(), false);
69             
70                 forAll(layeringVCells, cellI)
71                 {
72                     const labelList& curCellPoints = cp[layeringVCells[cellI]];
74                     forAll (curCellPoints, i)
75                     {
76                         count[curCellPoints[i]] = true;
77                     }
78                 }
80                 // Count the points
81                 label nCounted = 0;
82                 forAll (count, pointI)
83                 {
84                     if (count[pointI] == true)
85                     {
86                         nCounted++;
87                     }
88                 }
90                 layeringVPoints.setSize(nCounted);
92                 // Collect the points
93                 nCounted = 0;
94                 forAll (count, pointI)
95                 {
96                     if (count[pointI] == true)
97                     {
98                         layeringVPoints[nCounted] = pointI;
99                         nCounted++;
100                     }
101                 }
102                 
104                 forAll(layeringVPoints, i)
105                 {
106                     point& p = newPoints[layeringVPoints[i]];
108                     p += valveVel * engTime().deltaT().value();
110                     valveTopPoint[layeringVPoints[i]] = true;
111                 }
112                 
114                 label movingTopPtsVIndex =
115                     pointZones().findZoneID
116                     (
117                         "movingPointsV" + Foam::name(valveI+1)
118                     );
120                 const labelList& movingTopPointsV =
121                     pointZones()[movingTopPtsVIndex];
123                 forAll(movingTopPointsV, i)
124                 {
125                     if(!valveTopPoint[movingTopPointsV[i]])
126                     {
128                         point& p = newPoints[movingTopPointsV[i]];
129                         p += valveVel * engTime().deltaT().value();
131                     }
132                 }
135                 label movingTopCellsVIndex =
136                     cellZones().findZoneID
137                     (
138                         "movingCellsZoneV" + Foam::name(valveI+1)
139                     );
141                 const labelList& movingTopCellsV =
142                     cellZones()[movingTopCellsVIndex];
144                 labelList movingTopPointsV;
146                 boolList count2(newPoints.size(), false);
147             
148                 forAll(movingTopCellsV, cellI)
149                 {
150                     const labelList& curCellPoints = cp[movingTopCellsV[cellI]];
152                     forAll (curCellPoints, i)
153                     {
154                         count2[curCellPoints[i]] = true;
155                     }
156                 }
158                 // Count the points
159                 nCounted = 0;
160                 forAll (count2, pointI)
161                 {
162                     if (count2[pointI] == true)
163                     {
164                         nCounted++;
165                     }
166                 }
168                 movingTopPointsV.setSize(nCounted);
170                 // Collect the points
171                 nCounted = 0;
172                 forAll (count2, pointI)
173                 {
174                     if (count2[pointI] == true)
175                     {
176                         movingTopPointsV[nCounted] = pointI;
177                         nCounted++;
178                     }
179                 }
181                 forAll(movingTopPointsV, i)
182                 {
183                     if(!valveTopPoint[movingTopPointsV[i]])
184                     {
186                         point& p = newPoints[movingTopPointsV[i]];
187                         p += valveVel * engTime().deltaT().value();
189                     }
190                 }
192                 
193             }
194             else
195             {
196                 Info << "Valve " << valveI << " is CLOSED!!!" << endl;
197             }
199         }
200     }