1 /*---------------------------------------------------------------------------*\
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 -------------------------------------------------------------------------------
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/>.
27 \*---------------------------------------------------------------------------*/
29 #include "thoboisSliding.H"
30 #include "slidingInterface.H"
31 #include "layerAdditionRemoval.H"
32 #include "surfaceFields.H"
33 #include "regionSplit.H"
34 #include "attachDetach.H"
36 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38 void Foam::thoboisSliding::addZonesAndModifiers()
40 // Add the zones and mesh modifiers to operate piston motion
44 pointZones().size() > 0
45 || faceZones().size() > 0
46 || cellZones().size() > 0
47 || topoChanger_.size() > 0
50 Info<< "Time = " << engTime().theta() << endl;
51 Info<< "void Foam::verticalValvesGambit::addZonesAndModifiers() : "
52 << "Zones and modifiers already present. Skipping."
55 setVirtualPositions();
56 // checkAndCalculate();
58 Info << "Point zones found = " << pointZones().size() << endl;
59 Info << "Face zones found = " << faceZones().size() << endl;
60 Info << "Cell zones found = " << cellZones().size() << endl;
68 engTime().engineDict().found("zOffsetGambit")
69 && engTime().engineDict().found("zDisplGambit")
72 Info << "Assembling the cylinder mesh" << endl;
76 readScalar(engTime().engineDict().lookup("zOffsetGambit"))
81 readScalar(engTime().engineDict().lookup("zDisplGambit"))
84 pointField pDispl = points();
86 forAll(points(), pointI)
88 const point p = points()[pointI];
92 pDispl[pointI].z() -= zDispl;
100 Info << "Cylinder mesh assembled" << endl;
103 Info << "checkAndCalculate()" << endl;
104 // checkAndCalculate();
106 Info<< "Time = " << engTime().theta() << endl
107 << "Adding zones to the engine mesh" << endl;
112 1) Cut point zone for liner in head
119 DynamicList<pointZone*> pz;
123 1) Piston layer faces
126 1) valveTopLayerFaces
127 2) valveBottomLayerFaces
132 DynamicList<faceZone*> fz;
136 1) moving cells inside piston
139 1) moving cells in the top of the valve
140 2) moving cells in the bottom of the valve
143 DynamicList<cellZone*> cz;
145 label nPointZones = 0;
146 label nFaceZones = 0;
147 label nCellZones = 0;
150 Adding the following faces zones:
152 nV: pistonLayerFacesV
154 Adding the following cell zones:
156 nV: movingCellsPistonV
158 Adding the following point zones:
160 nV: valvePistonPointsV
164 //# include "addPistonFacesPointZonesThoboisSliding.H"
167 Adding the following face zones:
175 Adding the following point zones:
182 # include "addValvesFacesPointZonesThoboisSliding.H"
186 Adding the following point zones:
189 nV: valveBottomPointsV
191 Adding the following cell zones:
198 //# include "addValvePistonCellZonesThoboisSliding.H"
200 //# include "addAttachDetachFacesThoboisSliding.H"
202 Info<< "Adding " << nPointZones << " point, "
203 << nFaceZones << " face zones and "
204 << nCellZones << " cell zones" << endl;
206 pz.setSize(nPointZones);
207 Info << "setSize pz" << endl;
208 fz.setSize(nFaceZones);
209 Info << "setSize fz" << endl;
210 cz.setSize(nCellZones);
211 Info << "setSize cz" << endl;
213 addZones(pz, fz, cz);
215 # include "addMeshModifiersThoboisSliding.H"
217 // Calculating the virtual positions of piston and valves
219 setVirtualPositions();
221 Info << " Write mesh " << endl;
222 // Write mesh and modifiers
223 topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
225 Info << " Mesh written " << endl;
227 // Info << "virtualPistonPosition = " << virtualPistonPosition() << endl;
228 // Info << "piston position = " << pistonPosition() << endl;
232 // ************************************************************************* //