Forward compatibility: flex
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / thoboisSliding / moveValvePointsThoboisSliding.H
bloba446caa0e777b64e59f33319dc37412b3fb220f1
1     // valves
2     forAll(valves_,valveI)
3     {
4         scalar valveDeltaZ =
5             valves_[valveI].curVelocity()*valves_[valveI].cs().axis().z()*engTime().deltaT().value() ;
7         if(valves_[valveI].curLift() > valves_[valveI].deformationLift())
8         {
9             if(mag(valves_[valveI].curVelocity()) > 0)
10             {
11                 Info << "Valve n. " << valveI << " is moving with velocity = " << valves_[valveI].curVelocity() << endl;
12             }
14             Info << "Valve displacement for valve " << valveI << " = " << valveDeltaZ << endl;
16             if(valves_[valveI].poppetPatchID().active() && valves_[valveI].isOpen())
17             {
19                 List<bool> valveTopPoint(newPoints.size(), false);
21 //                label layeringVPtsIndex = pointZones().findZoneID("movingPointsTopZoneV"+ Foam::name(valveI+1));
22 //                const labelList& layeringVPoints = pointZones()[layeringVPtsIndex];
24                 labelList layeringVPoints;
26                 {
27                     label valveLayeringCellsIndex = cellZones().findZoneID("movingCellsTopZoneV" + Foam::name(valveI + 1));
29                     if (valveLayeringCellsIndex < 0)
30                     {
31                         FatalErrorIn("bool verticalValves::update()")
32                             << "movingCellsTopZoneV"+ Foam::name(valveI+1)
33                             << abort(FatalError);
34                     }
36                     const labelList& layeringCellsZoneV = cellZones()[valveLayeringCellsIndex];
38                     const labelListList& cp = cellPoints();
40                     boolList count(newPoints.size(), false);
42                     forAll (layeringCellsZoneV, cellI)
43                     {
44                         const labelList& curCellPoints = cp[layeringCellsZoneV[cellI]];
46                         forAll (curCellPoints, i)
47                         {
48                             count[curCellPoints[i]] = true;
49                         }
50                     }
52                     // Count the points
53                     label nCounted = 0;
54                     forAll (count, pointI)
55                     {
56                         if (count[pointI] == true)
57                         {
58                             nCounted++;
59                         }
60                     }
62                     layeringVPoints.setSize(nCounted);
64                     // Collect the points
65                     nCounted = 0;
66                     forAll (count, pointI)
67                     {
68                         if (count[pointI] == true)
69                         {
70                             layeringVPoints[nCounted] = pointI;
71                             nCounted++;
72                         }
73                     }
75                 }
77                 forAll(layeringVPoints, i)
78                 {
79                     point& p = newPoints[layeringVPoints[i]];
80                     p.z() += valveDeltaZ*
81                          (valves_[valveI].cs().axis().z()/mag(valves_[valveI].cs().axis()));
82                     valveTopPoint[layeringVPoints[i]] = true;
83                 }
85                 label movingTopPtsVIndex = pointZones().findZoneID("movingPointsV"+ Foam::name(valveI+1));
87                 const labelList& movingTopPointsV = pointZones()[movingTopPtsVIndex];
89                 forAll(movingTopPointsV, i)
90                 {
91                     if(!valveTopPoint[movingTopPointsV[i]])
92                     {
94                         point& p = newPoints[movingTopPointsV[i]];
95                         p.z() += valveDeltaZ*
96                             (valves_[valveI].cs().axis().z()/mag(valves_[valveI].cs().axis()));
97                     }
98                 }
100                 deleteDemandDrivenData(movingPointsMaskTopPtr_);
101             }
102             else
103             {
104                 Info << "Valve " << valveI << " is CLOSED!!!" << endl;
105             }
106        }
108        if(valves_[valveI].bottomPatchID().active() )
109        {
110            {
112 //               label valveBottomPtsIndex = pointZones().findZoneID("movingPointsBottomZoneV"+ Foam::name(valveI+1));
113 //               const labelList& valveBottomPoints = pointZones()[valveBottomPtsIndex];
115                 labelList valveBottomPoints;
116                 {
117                     label valveBottomCellsIndex = cellZones().findZoneID("movingCellsBottomZoneV" + Foam::name(valveI + 1));
119                     if (valveBottomCellsIndex < 0)
120                     {
121                         FatalErrorIn("bool verticalValves::update()")
122                             << "movingCellsBottomZoneV"+ Foam::name(valveI+1)
123                             << abort(FatalError);
124                     }
126                     const labelList& valveMovingCellsBotZoneV = cellZones()[valveBottomCellsIndex];
128                     const labelListList& cp = cellPoints();
130                     boolList count(newPoints.size(), false);
132                     forAll (valveMovingCellsBotZoneV, cellI)
133                     {
134                         const labelList& curCellPoints = cp[valveMovingCellsBotZoneV[cellI]];
136                         forAll (curCellPoints, i)
137                         {
138                             count[curCellPoints[i]] = true;
139                         }
140                     }
142                     // Count the points
143                     label nCounted = 0;
144                     forAll (count, pointI)
145                     {
146                         if (count[pointI] == true)
147                         {
148                             nCounted++;
149                         }
150                     }
152                     valveBottomPoints.setSize(nCounted);
154                     // Collect the points
155                     nCounted = 0;
156                     forAll (count, pointI)
157                     {
158                         if (count[pointI] == true)
159                         {
160                             valveBottomPoints[nCounted] = pointI;
161                             nCounted++;
162                         }
163                     }
165                 }
167                 forAll(valveBottomPoints, i)
168                 {
169                     point& p = newPoints[valveBottomPoints[i]];
170                     p.z() +=    valveDeltaZ*
171                            (valves_[valveI].cs().axis().z()/mag(valves_[valveI].cs().axis()));
172                 }
174            }
176            deleteDemandDrivenData(movingPointsMaskBottomPtr_);
177        }
178     }