1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2005-2010 Tommaso Lucchini
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 \*---------------------------------------------------------------------------*/
30 #include "pistonSliding.H"
31 #include "slidingInterface.H"
32 #include "layerAdditionRemoval.H"
33 #include "surfaceFields.H"
34 #include "regionSplit.H"
35 #include "attachDetach.H"
36 #include "SortableList.H"
38 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
40 void Foam::pistonSliding::addZonesAndModifiers()
42 // Add the zones and mesh modifiers to operate piston motion
46 pointZones().size() > 0
47 || faceZones().size() > 0
48 || cellZones().size() > 0
49 || topoChanger_.size() > 0
52 Info<< "Time = " << engTime().theta() << endl;
53 Info<< "void Foam::verticalValvesGambit::addZonesAndModifiers() : "
54 << "Zones and modifiers already present. Skipping."
57 setVirtualPositions();
58 // checkAndCalculate();
60 Info << "Point zones found = " << pointZones().size() << endl;
61 Info << "Face zones found = " << faceZones().size() << endl;
62 Info << "Cell zones found = " << cellZones().size() << endl;
70 engTime().engineDict().found("zOffsetGambit")
71 && engTime().engineDict().found("zDisplGambit")
74 Info << "Assembling the cylinder mesh" << endl;
78 readScalar(engTime().engineDict().lookup("zOffsetGambit"))
83 readScalar(engTime().engineDict().lookup("zDisplGambit"))
86 pointField pDispl = points();
88 forAll(points(), pointI)
90 const point p = points()[pointI];
94 pDispl[pointI].z() -= zDispl;
102 Info << "Cylinder mesh assembled" << endl;
105 Info << "checkAndCalculate()" << endl;
106 // checkAndCalculate();
108 Info<< "Time = " << engTime().theta() << endl
109 << "Adding zones to the engine mesh" << endl;
114 1) Cut point zone for liner in head
121 DynamicList<pointZone*> pz;
125 1) Piston layer faces
128 1) valveTopLayerFaces
129 2) valveBottomLayerFaces
134 DynamicList<faceZone*> fz;
138 1) moving cells inside piston
141 1) moving cells in the top of the valve
142 2) moving cells in the bottom of the valve
145 DynamicList<cellZone*> cz;
147 label nPointZones = 0;
148 label nFaceZones = 0;
149 label nCellZones = 0;
152 Adding the following faces zones:
154 nV: pistonLayerFacesV
156 Adding the following cell zones:
158 nV: movingCellsPistonV
160 Adding the following point zones:
162 nV: valvePistonPointsV
166 # include "addPistonLayerFaces.H"
169 Adding the following face zones:
177 Adding the following point zones:
183 # include "addValvesFacesPointZonesPistonSliding.H"
185 # include "addBowlZonesPistonSliding.H"
189 Adding the following point zones:
192 nV: valveBottomPointsV
194 Adding the following cell zones:
201 //# include "addValvePistonCellZonesPistonSliding.H"
203 //# include "addAttachDetachFacesPistonSliding.H"
205 Info<< "Adding " << nPointZones << " point, "
206 << nFaceZones << " face zones and "
207 << nCellZones << " cell zones" << endl;
209 pz.setSize(nPointZones);
210 Info << "setSize pz" << endl;
211 fz.setSize(nFaceZones);
212 Info << "setSize fz" << endl;
213 cz.setSize(nCellZones);
214 Info << "setSize cz" << endl;
216 addZones(pz, fz, cz);
218 # include "addMeshModifiersPistonSliding.H"
220 // Calculating the virtual positions of piston and valves
222 setVirtualPositions();
224 Info << " Write mesh " << endl;
225 // Write mesh and modifiers
226 topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
228 Info << " Mesh written " << endl;
232 // ************************************************************************* //