Formatting
[foam-extend-3.2.git] / src / engine / engineTopoChangerMesh / pistonSliding / addPistonSlidingMeshModifiers.C
blobdfff405f2580c257ea310d81b8af888381b1775a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     verticalValvesGambit
27 \*---------------------------------------------------------------------------*/
29 #include "pistonSliding.H"
30 #include "slidingInterface.H"
31 #include "layerAdditionRemoval.H"
32 #include "surfaceFields.H"
33 #include "regionSplit.H"
34 #include "attachDetach.H"
35 #include "SortableList.H"
37 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
39 void Foam::pistonSliding::addZonesAndModifiers()
41     // Add the zones and mesh modifiers to operate piston motion
43     if
44     (
45         pointZones().size() > 0
46      || faceZones().size() > 0
47      || cellZones().size() > 0
48      || topoChanger_.size() > 0
49     )
50     {
51         Info<< "Time = " << engTime().theta() << endl;
52         Info<< "void Foam::verticalValvesGambit::addZonesAndModifiers() : "
53             << "Zones and modifiers already present.  Skipping."
54             << endl;
56         setVirtualPositions();
57 //        checkAndCalculate();
59         Info << "Point zones found = " << pointZones().size() << endl;
60         Info << "Face zones found = " << faceZones().size() << endl;
61         Info << "Cell zones found = " << cellZones().size() << endl;
63         return;
65     }
67     if
68     (
69         engTime().engineDict().found("zOffsetGambit")
70      && engTime().engineDict().found("zDisplGambit")
71     )
72     {
73         Info << "Assembling the cylinder mesh" << endl;
75         scalar zOffset
76         (
77             readScalar(engTime().engineDict().lookup("zOffsetGambit"))
78         );
80         scalar zDispl
81         (
82             readScalar(engTime().engineDict().lookup("zDisplGambit"))
83         );
85         pointField pDispl = points();
87         forAll(points(), pointI)
88         {
89             const point p = points()[pointI];
91             if(p.z() >= zOffset)
92             {
93                 pDispl[pointI].z() -= zDispl;
94             }
95         }
97         movePoints(pDispl);
98         write();
99         resetMotion();
101         Info << "Cylinder mesh assembled" << endl;
102     }
104     Info << "checkAndCalculate()" << endl;
105 //    checkAndCalculate();
107     Info<< "Time = " << engTime().theta() << endl
108         << "Adding zones to the engine mesh" << endl;
111     Point zones
112     1) Piston points
113     1) Cut point zone for liner in head
115     nValves*
116     1) cutPointsV
117     2) valveTopPoints
118     3) valveBottomPoints
120     DynamicList<pointZone*> pz;
123     Face zones
124     1) Piston layer faces
126     nValves*
127     1) valveTopLayerFaces
128     2) valveBottomLayerFaces
129     3) valveCurtainPort
130     4) valveCurtainCyl
131     5) cutFaceV
133     DynamicList<faceZone*> fz;
136     cell zones
137     1) moving cells inside piston
139     nValves*
140     1) moving cells in the top of the valve
141     2) moving cells in the bottom of the valve
144     DynamicList<cellZone*> cz;
146     label nPointZones = 0;
147     label nFaceZones = 0;
148     label nCellZones = 0;
151     Adding the following faces zones:
152     1:  pistonLayerFaces
153     nV: pistonLayerFacesV
155     Adding the following cell zones:
156     1:  movingCellsPiston
157     nV:  movingCellsPistonV
159     Adding the following point zones:
160     1: pistonPoints
161     nV: valvePistonPointsV
165 #   include "addPistonLayerFaces.H"
168     Adding the following face zones:
170     nV: curtainCylZoneV
171     nV: curtainPortZoneV
172     nV: cutFaceZoneV
173     nV: poppetZoneV
174     nV: bottomZoneV
176     Adding the following point zones:
178     nV: cutPointsV
182 #   include "addValvesFacesPointZonesPistonSliding.H"
184 #   include "addBowlZonesPistonSliding.H"
188     Adding the following point zones:
190     nV: valveTopPointsV
191     nV: valveBottomPointsV
193     Adding the following cell zones:
195     nV: movingCellsTopV
196     nV: movingCellsBotV
200 //#   include "addValvePistonCellZonesPistonSliding.H"
202 //#   include "addAttachDetachFacesPistonSliding.H"
204     Info<< "Adding " << nPointZones << " point, "
205         << nFaceZones << " face zones and "
206         << nCellZones << " cell zones" << endl;
208     pz.setSize(nPointZones);
209     Info << "setSize pz" << endl;
210     fz.setSize(nFaceZones);
211     Info << "setSize fz" << endl;
212     cz.setSize(nCellZones);
213     Info << "setSize cz" << endl;
215     addZones(pz, fz, cz);
217 #   include "addMeshModifiersPistonSliding.H"
219     // Calculating the virtual positions of piston and valves
221     setVirtualPositions();
223     Info << " Write mesh " << endl;
224     // Write mesh and modifiers
225     topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
226     write();
227     Info << " Mesh written " << endl;
231 // ************************************************************************* //