Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / engine / engineTopoChangerMesh / layerSmooth / movePistonPointsLayeringLayerSmooth.H
blob5f42c47a00126d44dafd175dd689c0eda4872ed3
1     Info << "virtualPistonPosition = " << virtualPistonPosition()
2     << ", deckHeight = " << deckHeight() << endl;
4     // Mesh in three parts:
5     // - pistonPoints - move with deltaZ
6     // - headPoints - do not move
7     
8     const pointZoneMesh& pZones = pointZones();
9     label headPtsIndex = pZones.findZoneID("headPoints");
10     label pistonPtsIndex = pZones.findZoneID("pistonPoints");
11     const labelList& pistonPoints = pZones[pistonPtsIndex];
12     const labelList& headPoints = pZones[headPtsIndex];
15     // Whether point displacement is by scaling
16     boolList scaleDisp(nPoints(), true);
17     label nScaled = nPoints();
18     List<bool> pistonPoint(newPoints.size(), false);
19     List<bool> headPoint(newPoints.size(), false);
21     forAll(pistonPoints, i)
22     {
23         label pointI = pistonPoints[i];
24         pistonPoint[pointI] = true;
25         point& p = newPoints[pointI];
26                 
27         if (p.z() < pistonPosition() - 1.0e-6)
28         {
29             scaleDisp[pointI] = false;
30             nScaled--;
31         }
32     }
33     
35     forAll(headPoints, i)
36     {
37         headPoint[headPoints[i]] = true;
38         scaleDisp[headPoints[i]] = false;
39         nScaled--;
40     }
41     
43     Info<< "Mesh nPoints:" << nPoints()
44         << " inside:" << nScaled
45         << " piston:" << pistonPoints.size()
46         << " head:" << headPoints.size()
47         << endl;
50     {
52         // Always move piston
53         scalar pistonTopZ = -GREAT;
54         forAll(pistonPoints, i)
55         {
56             point& p = newPoints[pistonPoints[i]];
57             p.z() += deltaZ;
58             pistonTopZ = max(pistonTopZ, p.z());
59         }
62         // NN! fix. only needed for compression
63         if (deltaZ > 0.0)
64         {
65             // check if piston-points have moved beyond the layer above
66             forAll(newPoints, i)
67             {
68                 if (!pistonPoint[i])
69                 {
70                     if (virtualPistonPosition() > newPoints[i].z())
71                     {
72                         newPoints[i].z() = pistonTopZ + 0.9*minLayerThickness;
73                     }
74                 }
75             }
76         }
77     }
79 //    movePoints(newPoints);
80 //    vpi_.movePoints();
81             
82     pistonPosition() += deltaZ;
83     scalar pistonSpeed = deltaZ/engTime().deltaT().value();
85     Info<< "clearance: " << deckHeight() - pistonPosition() << nl
86         << "Piston speed = " << pistonSpeed << " m/s" << endl;