Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / engine / engineTopoChangerMesh / pistonSliding / moveValvePointsPistonSliding.H
blobda3ccab90186e024fac52024b73c0fa6631056e0
1     // valves
2     label constraintSize = 0;
4     forAll(valves_,valveI)
5     {
7           vector valveVel =
8                valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
10         scalar valveDeltaZ = valves_[valveI].curVelocity()*
11             valves_[valveI].cs().axis().z()*engTime().deltaT().value() ;
13         if(valves_[valveI].curLift() > valves_[valveI].deformationLift())
14         {
15             bool isMoving(false);
17             if(mag(valves_[valveI].curVelocity()) > 0)
18             {
19                 Info<< "Valve n. " << valveI << " is moving with velocity = "
20                     << valves_[valveI].curVelocity() << endl;
21                 isMoving = true;
22             }
24             Info<< "Valve displacement for valve " << valveI << " = "
25                 << valveDeltaZ << endl;
27             if
28             (
29                 valves_[valveI].poppetPatchID().active()
30              && valves_[valveI].isOpen()
31             )
32             {
33                 List<bool> valveTopPoint(newPoints.size(), false);
35 //                 const scalarField& movingPointsTop =
36 //                     movingPointsMaskTop(valveI);
38                 label layeringVPtsIndex =
39                     pointZones().findZoneID
40                     (
41                         "movingPointsTopZoneV"
42                       + Foam::name(valveI+1)
43                     );
45                 const labelList& layeringVPoints =
46                     pointZones()[layeringVPtsIndex];
48                 forAll(layeringVPoints, i)
49                 {
50                     point& p = newPoints[layeringVPoints[i]];
51                     p.z() += valveDeltaZ*
52                          (valves_[valveI].cs().axis().z()/
53                          mag(valves_[valveI].cs().axis()));
55                     valveTopPoint[layeringVPoints[i]] = true;
56                 }
58                 label movingTopPtsVIndex =
59                     pointZones().findZoneID
60                     (
61                         "movingPointsV"
62                       + Foam::name(valveI+1)
63                     );
65                 const labelList& movingTopPointsV =
66                     pointZones()[movingTopPtsVIndex];
68                 forAll(movingTopPointsV, i)
69                 {
70                     if(!valveTopPoint[movingTopPointsV[i]])
71                     {
73                         point& p = newPoints[movingTopPointsV[i]];
74                         p.z() += valveDeltaZ*
75                             (valves_[valveI].cs().axis().z()/
76                             mag(valves_[valveI].cs().axis()));
77                     }
78                 }
80                 deleteDemandDrivenData(movingPointsMaskTopPtr_);
81             }
82             else
83             {
84                 Info << "Valve " << valveI << " is CLOSED!!!" << endl;
85             }
88             {
89                 label movingPtsIndex =
90                     pointZones().findZoneID
91                     (
92                         "movingPointsV"
93                       + Foam::name(valveI + 1)
94                     );
96                 const labelList& movingPointsV = pointZones()[movingPtsIndex];
98                 forAll(movingPointsV, mpI)
99                 {
100                     constrainedPoints.append(movingPointsV[mpI]);
101                     constrainedVelocity.append(valveVel);
103                     constraintSize++;
104                 }
105             }
107         }
109        if (valves_[valveI].bottomPatchID().active())
110        {
111            const scalarField& movingPointsBottom =
112                movingPointsMaskBottom(valveI);
114            {
115                List<bool> valveBottomPoint(newPoints.size(), false);
117                label valveBottomPtsIndex =
118                    pointZones().findZoneID
119                    (
120                        "movingPointsBottomZoneV"
121                       + Foam::name(valveI+1)
122                    );
124                const labelList& valveBottomPoints =
125                    pointZones()[valveBottomPtsIndex];
127                forAll(valveBottomPoints, i)
128                {
129                    point& p = newPoints[valveBottomPoints[i]];
130                    p.z() +=    valveDeltaZ*
131                            (valves_[valveI].cs().axis().z()/
132                            mag(valves_[valveI].cs().axis()));
133                }
135            }
137            deleteDemandDrivenData(movingPointsMaskBottomPtr_);
138        }
139     }