fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / engine / engineTopoChangerMesh / thoboisMesh / movePistonPointsLayeringThobois.H
blob6a13ee9258c4ca2ec58126b706c6b31220cb0831
1     Info << "virtualPistonPosition = " << virtualPistonPosition()
2     << ", deckHeight = " << deckHeight() << endl;
4     // Mesh in three parts:
5     // - pistonPoints - move with deltaZ
6     
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];
22                 
23         if (p.z() < pistonPosition() - 1.0e-6)
24         {
25             scaleDisp[pointI] = false;
26             nScaled--;
27         }
28     }
29     
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();
63             
64     pistonPosition() += deltaZ;
65     scalar pistonSpeed = deltaZ/engTime().deltaT().value();
67     Info<< "clearance: " << deckHeight() - pistonPosition() << nl
68         << "Piston speed = " << pistonSpeed << " m/s" << endl;