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/>.
27 \*---------------------------------------------------------------------------*/
29 #include "engineValveSliding.H"
30 #include "slidingInterface.H"
31 #include "layerAdditionRemoval.H"
32 #include "surfaceFields.H"
33 #include "regionSplit.H"
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 void Foam::engineValveSliding::checkAndCalculate()
40 label pistonIndex = -1;
41 bool foundPiston = false;
43 label linerIndex = -1;
44 bool foundLiner = false;
46 label cylinderHeadIndex = -1;
47 bool foundCylinderHead = false;
52 if (boundary()[i].name() == "piston")
57 else if (boundary()[i].name() == "liner")
62 else if (boundary()[i].name() == "cylinderHead")
64 cylinderHeadIndex = i;
65 foundCylinderHead = true;
69 reduce(foundPiston, orOp<bool>());
70 reduce(foundLiner, orOp<bool>());
71 reduce(foundCylinderHead, orOp<bool>());
75 FatalErrorIn("Foam::verticalValvesGambit::checkAndCalculate()")
76 << " : cannot find piston patch"
82 FatalErrorIn("Foam::verticalValvesGambit::checkAndCalculate()")
83 << " : cannot find liner patch"
87 if (!foundCylinderHead)
89 FatalErrorIn("Foam::verticalValvesGambit::checkAndCalculate()")
90 << " : cannot find cylinderHead patch"
98 max(boundary()[pistonIndex].patch().localPoints()).z();
100 reduce(pistonPosition(), minOp<scalar>());
102 if (cylinderHeadIndex != -1)
106 boundary()[cylinderHeadIndex].patch().localPoints()
110 reduce(deckHeight(), minOp<scalar>());
112 Info<< "deckHeight: " << deckHeight() << nl
113 << "piston position: " << pistonPosition() << endl;
119 void Foam::engineValveSliding::setVirtualPositions()