1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2005-2010 Tommaso Lucchini
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
28 Engine mesh class with dynamic layering on the piston patch.
31 Tommaso Lucchini, Politecnico di Milano.
34 addpistonLayerModifiers.C
37 \*---------------------------------------------------------------------------*/
42 #include "engineTopoChangerMesh.H"
43 #include "enginePiston.H"
44 #include "motionSolver.H"
45 #include "polyPatchID.H"
47 #include "volPointInterpolation.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 // Class forward declarations
56 /*---------------------------------------------------------------------------*\
57 Class pistonLayer Declaration
58 \*---------------------------------------------------------------------------*/
62 public engineTopoChangerMesh
69 //- Layering-to-deformation switch in crank-angle degrees
72 //- name of the head pointSet
73 word headPointsSetName_;
76 scalar pistonPosition_;
78 //- Virtual piston position (pistonPosition + offSet)
79 scalar virtualPistonPosition_;
88 Switch movePointsBelowPiston_;
90 // Private Member Functions
92 //- Disallow default bitwise copy construct
93 pistonLayer(const pistonLayer&);
95 //- Disallow default bitwise assignment
96 void operator=(const pistonLayer&);
98 //- Make layering modifiers live
99 void makeLayersLive();
101 //- Check if all patches exist, then calculate virtualPistonPosition,
102 //- pistonPosition and deckHeight for the first time
103 void checkAndCalculate();
105 //- Calculate the virtualPistonPosition,
106 void setVirtualPistonPosition();
108 //- Add valve and piston zones and modifiers
109 void addZonesAndModifiers();
113 //- Runtime type information
114 TypeName("pistonLayer");
119 //- Construct from database
120 explicit pistonLayer(const IOobject& io);
125 virtual ~pistonLayer();
130 const scalar& pistonPosition() const
132 return pistonPosition_;
135 scalar& pistonPosition()
137 return pistonPosition_;
140 const scalar& virtualPistonPosition() const
142 return virtualPistonPosition_;
145 scalar& virtualPistonPosition()
147 return virtualPistonPosition_;
150 const scalar& deckHeight() const
161 const enginePiston& piston() const
166 //- Return true for mesh deformation mode
167 bool deformation() const
170 engTime().thetaRevolution() > -deformSwitch_
171 && engTime().thetaRevolution() < deformSwitch_;
176 virtual bool update();
178 //- Set boundary velocities
179 void setBoundaryVelocity(volVectorField& U);
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 } // End namespace Foam
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 // ************************************************************************* //