Merge commit 'd3b269b7c6ffa0cd68845adfecdfb849316dba71' into nextRelease
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / thoboisMesh / movePistonPointsLayeringThobois.H
blobde2a5bc33dd82f3797ab9a59e22a3ef5718d005d
1     Info << "virtualPistonPosition = " << virtualPistonPosition()
2     << ", deckHeight = " << deckHeight() << endl;
4     // Mesh in three parts:
5     // - pistonPoints - move with deltaZ
7     const pointZoneMesh& pZones = pointZones();
8     label pistonPtsIndex = pZones.findZoneID("pistonPoints");
9     const labelList& pistonPoints = pZones[pistonPtsIndex];
12     // Whether point displacement is by scaling
13     boolList scaleDisp(nPoints(), true);
14     label nScaled = nPoints();
15     List<bool> pistonPoint(newPoints.size(), false);
17     forAll(pistonPoints, i)
18     {
19         label pointI = pistonPoints[i];
20         pistonPoint[pointI] = true;
21         point& p = newPoints[pointI];
23         if (p.z() < pistonPosition() - 1.0e-6)
24         {
25             scaleDisp[pointI] = false;
26             nScaled--;
27         }
28     }
32     {
34         // Always move piston
35         scalar pistonTopZ = -GREAT;
36         forAll(pistonPoints, i)
37         {
38             point& p = newPoints[pistonPoints[i]];
39             p.z() += deltaZ;
40             pistonTopZ = max(pistonTopZ, p.z());
41         }
44         // NN! fix. only needed for compression
45         if (deltaZ > 0.0)
46         {
47             // check if piston-points have moved beyond the layer above
48             forAll(newPoints, i)
49             {
50                 if (!pistonPoint[i])
51                 {
52                     if (virtualPistonPosition() > newPoints[i].z())
53                     {
54                         newPoints[i].z() = pistonTopZ + 0.9*minLayerThickness;
55                     }
56                 }
57             }
58         }
59     }
61 //    movePoints(newPoints);
62 //    vpi_.movePoints();
64     pistonPosition() += deltaZ;
65     scalar pistonSpeed = deltaZ/engTime().deltaT().value();
67     Info<< "clearance: " << deckHeight() - pistonPosition() << nl
68         << "Piston speed = " << pistonSpeed << " m/s" << endl;