Formatting
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / pistonSliding / moveValvePointsPistonSliding.H
blob3b5cff8ee6a128320f05a61e74116f3a5e97375f
1     // valves
2     // currently unused - commented out below
3     // label constraintSize = 0;
5     forAll(valves_,valveI)
6     {
7         // currently unused - commented out below
8         //vector valveVel =
9         //    valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
11         scalar valveDeltaZ = valves_[valveI].curVelocity()*
12             valves_[valveI].cs().axis().z()*engTime().deltaT().value() ;
14         if(valves_[valveI].curLift() > valves_[valveI].deformationLift())
15         {
16             if(mag(valves_[valveI].curVelocity()) > 0)
17             {
18                 Info<< "Valve n. " << valveI << " is moving with velocity = "
19                     << valves_[valveI].curVelocity() << endl;
20             }
22             Info<< "Valve displacement for valve " << valveI << " = "
23                 << valveDeltaZ << endl;
25             if
26             (
27                 valves_[valveI].poppetPatchID().active()
28              && valves_[valveI].isOpen()
29             )
30             {
31                 List<bool> valveTopPoint(newPoints.size(), false);
33 //                 const scalarField& movingPointsTop =
34 //                     movingPointsMaskTop(valveI);
36                 label layeringVPtsIndex =
37                     pointZones().findZoneID
38                     (
39                         "movingPointsTopZoneV"
40                       + Foam::name(valveI+1)
41                     );
43                 const labelList& layeringVPoints =
44                     pointZones()[layeringVPtsIndex];
46                 forAll(layeringVPoints, i)
47                 {
48                     point& p = newPoints[layeringVPoints[i]];
49                     p.z() += valveDeltaZ*
50                          (valves_[valveI].cs().axis().z()/
51                          mag(valves_[valveI].cs().axis()));
53                     valveTopPoint[layeringVPoints[i]] = true;
54                 }
56                 label movingTopPtsVIndex =
57                     pointZones().findZoneID
58                     (
59                         "movingPointsV"
60                       + Foam::name(valveI+1)
61                     );
63                 const labelList& movingTopPointsV =
64                     pointZones()[movingTopPtsVIndex];
66                 forAll(movingTopPointsV, i)
67                 {
68                     if(!valveTopPoint[movingTopPointsV[i]])
69                     {
71                         point& p = newPoints[movingTopPointsV[i]];
72                         p.z() += valveDeltaZ*
73                             (valves_[valveI].cs().axis().z()/
74                             mag(valves_[valveI].cs().axis()));
75                     }
76                 }
78                 deleteDemandDrivenData(movingPointsMaskTopPtr_);
79             }
80             else
81             {
82                 Info << "Valve " << valveI << " is CLOSED!!!" << endl;
83             }
86             {
87                 label movingPtsIndex =
88                     pointZones().findZoneID
89                     (
90                         "movingPointsV"
91                       + Foam::name(valveI + 1)
92                     );
94                 const labelList& movingPointsV = pointZones()[movingPtsIndex];
96                 forAll(movingPointsV, mpI)
97                 {
98                     constrainedPoints.append(movingPointsV[mpI]);
99                     constrainedVelocity.append(valveVel);
101                     constraintSize++;
102                 }
103             }
105         }
107        if (valves_[valveI].bottomPatchID().active())
108        {
109            {
110                List<bool> valveBottomPoint(newPoints.size(), false);
112                label valveBottomPtsIndex =
113                    pointZones().findZoneID
114                    (
115                        "movingPointsBottomZoneV"
116                       + Foam::name(valveI+1)
117                    );
119                const labelList& valveBottomPoints =
120                    pointZones()[valveBottomPtsIndex];
122                forAll(valveBottomPoints, i)
123                {
124                    point& p = newPoints[valveBottomPoints[i]];
125                    p.z() +=    valveDeltaZ*
126                            (valves_[valveI].cs().axis().z()/
127                            mag(valves_[valveI].cs().axis()));
128                }
130            }
132            deleteDemandDrivenData(movingPointsMaskBottomPtr_);
133        }
134     }