1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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
25 \*---------------------------------------------------------------------------*/
27 #include "layerSmooth.H"
28 #include "slidingInterface.H"
29 #include "layerAdditionRemoval.H"
30 #include "surfaceFields.H"
31 #include "regionSplit.H"
32 #include "attachDetach.H"
33 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35 void Foam::layerSmooth::addZonesAndModifiers()
37 // Add the zones and mesh modifiers to operate piston motion
42 pointZones().size() > 0
43 || faceZones().size() > 0
44 || cellZones().size() > 0
45 || topoChanger_.size() > 0
47 pointZones().size() > 0
48 && faceZones().size() > 0
49 && topoChanger_.size() > 0
52 Info<< "Time = " << engTime().theta() << endl;
53 Info<< "void Foam::layerSmooth::addZonesAndModifiers() : "
54 << "Zones and modifiers already present. Skipping."
57 setVirtualPositions();
60 Info << "Point zones found = " << pointZones().size() << endl;
61 Info << "Face zones found = " << faceZones().size() << endl;
62 Info << "Cell zones found = " << cellZones().size() << endl;
68 pointZones().setSize(0);
69 faceZones().setSize(0);
70 cellZones().setSize(0);
71 topoChanger_.setSize(0);
76 engTime().engineDict().found("zOffsetGambit")
77 && engTime().engineDict().found("zDisplGambit")
80 Info << "Assembling the cylinder mesh" << endl;
84 readScalar(engTime().engineDict().lookup("zOffsetGambit"))
89 readScalar(engTime().engineDict().lookup("zDisplGambit"))
92 const pointField& ap = allPoints();
94 pointField pDispl = allPoints();
98 const point p = ap[pointI];
100 if (p.z() >= zOffset)
102 pDispl[pointI].z() -= zDispl;
111 Info << "Cylinder mesh assembled" << endl;
116 Info << "checkAndCalculate()" << endl;
119 Info<< "Time = " << engTime().theta() << endl
120 << "Adding zones to the engine mesh" << endl;
127 DynamicList<pointZone*> pz;
131 1) Piston layer faces
134 DynamicList<faceZone*> fz;
139 DynamicList<cellZone*> cz;
141 label nPointZones = 0;
142 label nFaceZones = 0;
143 label nCellZones = 0;
147 Adding the following faces zones:
150 Adding the following point zones:
155 # include "addPistonFacesPointZonesLayerSmooth.H"
158 # include "addAttachDetachFacesLayerSmooth.H"
160 Info<< "Adding " << nPointZones << " point zones, "
161 << nFaceZones << " face zones and "
162 << nCellZones << " cell zones" << endl;
164 pz.setSize(nPointZones);
165 Info << "setSize pz" << endl;
166 fz.setSize(nFaceZones);
167 Info << "setSize fz" << endl;
168 cz.setSize(nCellZones);
169 Info << "setSize cz" << endl;
171 addZones(pz, fz, cz);
173 # include "addMeshModifiersLayerSmooth.H"
175 // Calculating the virtual positions of piston and valves
177 setVirtualPositions();
182 Info << "virtualPistonPosition = " << virtualPistonPosition() << endl;
183 Info << "piston position = " << pistonPosition() << endl;
187 // ************************************************************************* //