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 "thoboisSliding.H"
31 #include "slidingInterface.H"
32 #include "layerAdditionRemoval.H"
33 #include "surfaceFields.H"
34 #include "regionSplit.H"
35 #include "attachDetach.H"
37 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39 void Foam::thoboisSliding::addZonesAndModifiers()
41 // Add the zones and mesh modifiers to operate piston motion
45 pointZones().size() > 0
46 || faceZones().size() > 0
47 || cellZones().size() > 0
48 || topoChanger_.size() > 0
51 Info<< "Time = " << engTime().theta() << endl;
52 Info<< "void Foam::verticalValvesGambit::addZonesAndModifiers() : "
53 << "Zones and modifiers already present. Skipping."
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;
69 engTime().engineDict().found("zOffsetGambit")
70 && engTime().engineDict().found("zDisplGambit")
73 Info << "Assembling the cylinder mesh" << endl;
77 readScalar(engTime().engineDict().lookup("zOffsetGambit"))
82 readScalar(engTime().engineDict().lookup("zDisplGambit"))
85 pointField pDispl = points();
87 forAll(points(), pointI)
89 const point p = points()[pointI];
93 pDispl[pointI].z() -= zDispl;
101 Info << "Cylinder mesh assembled" << endl;
104 Info << "checkAndCalculate()" << endl;
105 // checkAndCalculate();
107 Info<< "Time = " << engTime().theta() << endl
108 << "Adding zones to the engine mesh" << endl;
113 1) Cut point zone for liner in head
120 DynamicList<pointZone*> pz;
124 1) Piston layer faces
127 1) valveTopLayerFaces
128 2) valveBottomLayerFaces
133 DynamicList<faceZone*> fz;
137 1) moving cells inside piston
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:
153 nV: pistonLayerFacesV
155 Adding the following cell zones:
157 nV: movingCellsPistonV
159 Adding the following point zones:
161 nV: valvePistonPointsV
165 //# include "addPistonFacesPointZonesThoboisSliding.H"
168 Adding the following face zones:
176 Adding the following point zones:
183 # include "addValvesFacesPointZonesThoboisSliding.H"
187 Adding the following point zones:
190 nV: valveBottomPointsV
192 Adding the following cell zones:
199 //# include "addValvePistonCellZonesThoboisSliding.H"
201 //# include "addAttachDetachFacesThoboisSliding.H"
203 Info<< "Adding " << nPointZones << " point, "
204 << nFaceZones << " face zones and "
205 << nCellZones << " cell zones" << endl;
207 pz.setSize(nPointZones);
208 Info << "setSize pz" << endl;
209 fz.setSize(nFaceZones);
210 Info << "setSize fz" << endl;
211 cz.setSize(nCellZones);
212 Info << "setSize cz" << endl;
214 addZones(pz, fz, cz);
216 # include "addMeshModifiersThoboisSliding.H"
218 // Calculating the virtual positions of piston and valves
220 setVirtualPositions();
222 Info << " Write mesh " << endl;
223 // Write mesh and modifiers
224 topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
226 Info << " Mesh written " << endl;
228 // Info << "virtualPistonPosition = " << virtualPistonPosition() << endl;
229 // Info << "piston position = " << pistonPosition() << endl;
233 // ************************************************************************* //