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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "thoboisMesh.H"
27 #include "slidingInterface.H"
28 #include "layerAdditionRemoval.H"
29 #include "surfaceFields.H"
30 #include "regionSplit.H"
32 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34 void Foam::thoboisMesh::checkAndCalculate()
37 label pistonIndex = -1;
38 bool foundPiston = false;
40 label linerIndex = -1;
41 bool foundLiner = false;
43 label cylinderHeadIndex = -1;
44 bool foundCylinderHead = false;
49 if (boundary()[i].name() == "piston")
54 else if (boundary()[i].name() == "liner")
59 // else if (boundary()[i].name() == "cylinderHead")
60 else if (boundary()[i].name() == cylinderHeadName_)
62 cylinderHeadIndex = i;
63 foundCylinderHead = true;
67 reduce(foundPiston, orOp<bool>());
68 reduce(foundLiner, orOp<bool>());
69 reduce(foundCylinderHead, orOp<bool>());
73 FatalErrorIn("Foam::thoboisMesh::checkAndCalculate()")
74 << " : cannot find piston patch"
80 FatalErrorIn("Foam::thoboisMesh::checkAndCalculate()")
81 << " : cannot find liner patch"
85 if (!foundCylinderHead)
87 FatalErrorIn("Foam::thoboisMesh::checkAndCalculate()")
88 << " : cannot find cylinderHead patch"
96 max(boundary()[pistonIndex].patch().localPoints()).z();
98 reduce(pistonPosition(), minOp<scalar>());
100 if (cylinderHeadIndex != -1)
104 boundary()[cylinderHeadIndex].patch().localPoints()
110 boundary()[linerIndex].patch().localPoints()
114 reduce(deckHeight(), minOp<scalar>());
116 Info<< "deckHeight: " << deckHeight() << nl
117 << "piston position: " << pistonPosition() << endl;
123 void Foam::thoboisMesh::setVirtualPositions()
127 virtualPistonPosition() = -GREAT;
129 label pistonFaceIndex = faceZones().findZoneID("pistonLayerFaces");
131 bool foundPistonFace = (pistonFaceIndex != -1);
135 FatalErrorIn("Foam::thoboisMesh::setVirtualPistonPosition()")
136 << " : cannot find the pistonLayerFaces"
141 const labelList& pistonFaces = faceZones()[pistonFaceIndex];
142 forAll(pistonFaces, i)
144 const face& f = faces()[pistonFaces[i]];
146 // should loop over facepoints...
149 virtualPistonPosition() = max(virtualPistonPosition(), points()[f[j]].z());
153 reduce(virtualPistonPosition(), maxOp<scalar>());