Formatting
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / engineValveSliding / moveValvePointsEngineValveSliding.H
blob00e38afdbb4fef46ab363a36368a234d347633e2
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             if(mag(valves_[valveI].curVelocity()) > 0)
18             {
19                 Info<< "Valve n. " << valveI << " is moving with velocity = "
20                     << valves_[valveI].curVelocity() << endl;
21             }
23             Info<< "Valve displacement for valve " << valveI << " = "
24                 << valveDeltaZ << endl;
26             if
27             (
28                 valves_[valveI].poppetPatchID().active()
29              && valves_[valveI].isOpen()
30             )
31             {
32                 List<bool> valveTopPoint(newPoints.size(), false);
35                 label layeringVPtsIndex =
36                     pointZones().findZoneID
37                     (
38                         "movingPointsTopZoneV" + Foam::name(valveI+1)
39                     );
41                 const labelList& layeringVPoints =
42                     pointZones()[layeringVPtsIndex];
44                 forAll(layeringVPoints, i)
45                 {
46                     point& p = newPoints[layeringVPoints[i]];
48                     p += valveVel * engTime().deltaT().value();
50                     valveTopPoint[layeringVPoints[i]] = true;
51                 }
54                 label layeringVCellsIndex =
55                     cellZones().findZoneID
56                     (
57                         "movingCellsTopZoneV" + Foam::name(valveI+1)
58                     );
60                 const labelList& layeringVCells =
61                     cellZones()[layeringVCellsIndex];
63                 labelList layeringVPoints;
65                 boolList count(newPoints.size(), false);
67                 forAll(layeringVCells, cellI)
68                 {
69                     const labelList& curCellPoints = cp[layeringVCells[cellI]];
71                     forAll (curCellPoints, i)
72                     {
73                         count[curCellPoints[i]] = true;
74                     }
75                 }
77                 // Count the points
78                 label nCounted = 0;
79                 forAll (count, pointI)
80                 {
81                     if (count[pointI] == true)
82                     {
83                         nCounted++;
84                     }
85                 }
87                 layeringVPoints.setSize(nCounted);
89                 // Collect the points
90                 nCounted = 0;
91                 forAll (count, pointI)
92                 {
93                     if (count[pointI] == true)
94                     {
95                         layeringVPoints[nCounted] = pointI;
96                         nCounted++;
97                     }
98                 }
101                 forAll(layeringVPoints, i)
102                 {
103                     point& p = newPoints[layeringVPoints[i]];
105                     p += valveVel * engTime().deltaT().value();
107                     valveTopPoint[layeringVPoints[i]] = true;
108                 }
111                 label movingTopPtsVIndex =
112                     pointZones().findZoneID
113                     (
114                         "movingPointsV" + Foam::name(valveI+1)
115                     );
117                 const labelList& movingTopPointsV =
118                     pointZones()[movingTopPtsVIndex];
120                 forAll(movingTopPointsV, i)
121                 {
122                     if(!valveTopPoint[movingTopPointsV[i]])
123                     {
125                         point& p = newPoints[movingTopPointsV[i]];
126                         p += valveVel * engTime().deltaT().value();
128                     }
129                 }
132                 label movingTopCellsVIndex =
133                     cellZones().findZoneID
134                     (
135                         "movingCellsZoneV" + Foam::name(valveI+1)
136                     );
138                 const labelList& movingTopCellsV =
139                     cellZones()[movingTopCellsVIndex];
141                 labelList movingTopPointsV;
143                 boolList count2(newPoints.size(), false);
145                 forAll(movingTopCellsV, cellI)
146                 {
147                     const labelList& curCellPoints = cp[movingTopCellsV[cellI]];
149                     forAll (curCellPoints, i)
150                     {
151                         count2[curCellPoints[i]] = true;
152                     }
153                 }
155                 // Count the points
156                 nCounted = 0;
157                 forAll (count2, pointI)
158                 {
159                     if (count2[pointI] == true)
160                     {
161                         nCounted++;
162                     }
163                 }
165                 movingTopPointsV.setSize(nCounted);
167                 // Collect the points
168                 nCounted = 0;
169                 forAll (count2, pointI)
170                 {
171                     if (count2[pointI] == true)
172                     {
173                         movingTopPointsV[nCounted] = pointI;
174                         nCounted++;
175                     }
176                 }
178                 forAll(movingTopPointsV, i)
179                 {
180                     if(!valveTopPoint[movingTopPointsV[i]])
181                     {
183                         point& p = newPoints[movingTopPointsV[i]];
184                         p += valveVel * engTime().deltaT().value();
186                     }
187                 }
190             }
191             else
192             {
193                 Info << "Valve " << valveI << " is CLOSED!!!" << endl;
194             }
196         }
197     }