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 \*---------------------------------------------------------------------------*/
30 #include "engineTopoChangerMesh.H"
31 #include "simpleEnginePiston.H"
32 #include "motionSolver.H"
33 #include "polyPatchID.H"
35 #include "volPointInterpolation.H"
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 // Class forward declarations
44 /*---------------------------------------------------------------------------*\
45 Class layerAR Declaration
46 \*---------------------------------------------------------------------------*/
50 public engineTopoChangerMesh
55 simpleEnginePiston piston_;
57 //- Layering-to-deformation switch in crank-angle degrees
60 //- Tolerance used when the piston faceZone is created
63 //- Distance from the piston patch
67 scalar pistonPosition_;
69 //- Virtual piston position (pistonPosition + offSet)
70 scalar virtualPistonPosition_;
76 // Private Member Functions
78 //- Disallow default bitwise copy construct
79 layerAR(const layerAR&);
81 //- Disallow default bitwise assignment
82 void operator=(const layerAR&);
84 //- Make layering modifiers live
85 void makeLayersLive();
87 //- Check if all patches exist, then calculate virtualPistonPosition,
88 //- pistonPosition and deckHeight for the first time
89 void checkAndCalculate();
91 //- Calculate the virtualPistonPosition,
92 void setVirtualPistonPosition();
94 //- Add valve and piston zones and modifiers
95 void addZonesAndModifiers();
99 //- Runtime type information
105 //- Construct from database
106 explicit layerAR(const IOobject& io);
116 const scalar& delta() const
126 const scalar& offSet() const
136 const scalar& pistonPosition() const
138 return pistonPosition_;
141 scalar& pistonPosition()
143 return pistonPosition_;
146 const scalar& virtualPistonPosition() const
148 return virtualPistonPosition_;
151 scalar& virtualPistonPosition()
153 return virtualPistonPosition_;
156 const scalar& deckHeight() const
167 const simpleEnginePiston& piston() const
172 //- Return true for mesh deformation mode
173 bool deformation() const
176 engTime().thetaRevolution() > -deformSwitch_
177 && engTime().thetaRevolution() < deformSwitch_;
182 virtual bool update();
184 //- Set boundary velocities
185 void setBoundaryVelocity(volVectorField& U);
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 } // End namespace Foam
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 // ************************************************************************* //