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 \*---------------------------------------------------------------------------*/
27 #include "accordionEngineMesh.H"
28 #include "componentMixedTetPolyPatchVectorField.H"
29 #include "mapPolyMesh.H"
30 #include "polyTopoChange.H"
31 #include "addToRunTimeSelectionTable.H"
32 #include "GeometricField.H"
34 #include "engineTime.H"
35 #include "pointField.H"
36 #include "fvPatchField.H"
38 #include "symmetryFvPatch.H"
39 #include "tetMotionSolver.H"
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
45 defineTypeNameAndDebug(accordionEngineMesh, 0);
46 addToRunTimeSelectionTable
48 engineTopoChangerMesh,
55 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
60 bool Foam::accordionEngineMesh::realDeformation() const
65 virtualPistonPosition() + engTime().pistonDisplacement().value()
77 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
79 // Construct from components
80 Foam::accordionEngineMesh::accordionEngineMesh
83 // bool addZonesAndMods
86 engineTopoChangerMesh(io),
87 piston_(*this, engTime().engineDict().subDict("piston")),
88 valves_(*this, engTime().engineDict().lookup("accordionEngineMesh")),
89 pistonPosition_(-GREAT),
90 virtualPistonPosition_(-GREAT),
92 cylinderHeadName_(engTime().engineDict().lookup("cylinderHeadName")),
93 linerName_(engTime().engineDict().lookup("linerName")),
94 headCellSetName_(engTime().engineDict().lookup("headCellSetName"))
97 // Add zones and modifiers if not already there.
99 msPtr_ = motionSolver::New(*this);
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 void Foam::accordionEngineMesh::setBoundaryVelocity(volVectorField& U)
108 // Set valve velociaty
109 forAll (valves(), valveI)
112 valves()[valveI].curVelocity()*valves()[valveI].cs().axis();
115 // If valve is present in geometry, set the motion
116 if (valves()[valveI].stemPatchID().active())
118 // Bottom of the valve moves with given velocity
119 U.boundaryField()[valves()[valveI].stemPatchID().index()] ==
126 // ************************************************************************* //