1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | 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/>.
25 // ------------------------------------------------------------------------- //
27 #include "pistonLayer.H"
28 #include "slidingInterface.H"
29 #include "layerAdditionRemoval.H"
30 #include "surfaceFields.H"
33 #include "SortableList.H"
36 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38 void Foam::pistonLayer::addZonesAndModifiers()
40 // Add the zones and mesh modifiers to operate piston motion
44 pointZones().size() > 0
45 || faceZones().size() > 0
46 || cellZones().size() > 0
49 Info<< "void pistonLayer::addZonesAndModifiers() : "
50 << "Zones and modifiers already present. Skipping."
53 if (topoChanger_.size() == 0)
57 "void pistonLayer::addZonesAndModifiers()"
58 ) << "Mesh modifiers not read properly"
62 Info << "topoChanger.size() = " << topoChanger_.size() << endl;
66 setVirtualPistonPosition();
67 topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
75 Info<< "Time = " << engTime().theta() << endl
76 << "Adding zones to the engine mesh" << endl;
78 //fz = 1: faces where layer are added/removed
79 //pz = 2: points below the virtual piston faces and head points
81 DynamicList<pointZone*> pz(2);
82 DynamicList<faceZone*> fz(1);
83 DynamicList<cellZone*> cz(0);
85 label nPointZones = 0;
88 # include "addPistonLayerFaces.H"
92 pointSet headPointSet(*this, headPointsSetName_);
94 Info << "Number of head points = " << headPointSet.size() << endl;
108 Info<< "Adding " << nPointZones << " point and "
109 << nFaceZones << " face zones" << endl;
111 pz.setSize(nPointZones);
112 fz.setSize(nFaceZones);
113 addZones(pz, fz, cz);
115 List<polyMeshModifier*> tm(1);
118 // Add piston layer addition
119 Info << "Adding Layer Addition/Removal Mesh Modifier" << endl;
121 # include "addPistonLayerAdditionRemovalMeshModifier.H"
123 topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
124 topoChanger_.write();
128 // Calculating the virtual piston position
129 setVirtualPistonPosition();
131 Info << "virtualPistonPosition = " << virtualPistonPosition() << endl;
132 Info << "piston position = " << pistonPosition() << endl;
137 // ************************************************************************* //