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 "accordionEngineMesh.H"
28 #include "slidingInterface.H"
29 #include "layerAdditionRemoval.H"
30 #include "surfaceFields.H"
31 #include "regionSplit.H"
33 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35 void Foam::accordionEngineMesh::checkAndCalculate()
38 label pistonIndex = -1;
39 bool foundPiston = false;
41 label linerIndex = -1;
42 bool foundLiner = false;
44 label cylinderHeadIndex = -1;
45 bool foundCylinderHead = false;
50 if (boundary()[i].name() == piston().patchID().name())
55 else if (boundary()[i].name() == linerName_)
60 // else if (boundary()[i].name() == "cylinderHead")
61 else if (boundary()[i].name() == cylinderHeadName_)
63 cylinderHeadIndex = i;
64 foundCylinderHead = true;
68 reduce(foundPiston, orOp<bool>());
69 reduce(foundLiner, orOp<bool>());
70 reduce(foundCylinderHead, orOp<bool>());
74 FatalErrorIn("Foam::accordionEngineMesh::checkAndCalculate()")
75 << " : cannot find piston patch"
81 FatalErrorIn("Foam::accordionEngineMesh::checkAndCalculate()")
82 << " : cannot find liner patch"
86 if (!foundCylinderHead)
88 FatalErrorIn("Foam::accordionEngineMesh::checkAndCalculate()")
89 << " : cannot find cylinderHead patch"
97 max(boundary()[pistonIndex].patch().localPoints()).z();
99 reduce(pistonPosition(), minOp<scalar>());
101 if (cylinderHeadIndex != -1)
105 boundary()[cylinderHeadIndex].patch().localPoints()
111 boundary()[linerIndex].patch().localPoints()
115 reduce(deckHeight(), minOp<scalar>());
117 Info<< "deckHeight: " << deckHeight() << nl
118 << "piston position: " << pistonPosition() << endl;
124 void Foam::accordionEngineMesh::setVirtualPositions()