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
36 \*---------------------------------------------------------------------------*/
38 #ifndef engineValveSliding_H
39 #define engineValveSliding_H
41 #include "engineTopoChangerMesh.H"
42 #include "enginePiston.H"
43 #include "motionSolver.H"
44 #include "polyPatchID.H"
45 #include "thoboisSlidingValveBank.H"
46 #include "twoDPointCorrector.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 // Class forward declarations
58 /*---------------------------------------------------------------------------*\
59 Class verticalValves Declaration
60 \*---------------------------------------------------------------------------*/
62 class engineValveSliding
64 public engineTopoChangerMesh
72 thoboisSlidingValveBank valves_;
74 //- Layering-to-deformation switch in crank-angle degrees
77 //- Top valve tolerance, when valve lift < tol, valve top layering is disabled
81 scalar pistonPosition_;
83 //- Virtual position of the bottom of the valves
84 scalarField valveBottomPosition_;
86 //- Virtual position of the bottom of the valves
87 scalarField valvePistonPosition_;
93 scalarField minValveZ_;
95 //- tolerance for valve poppet faces (used to create a faceZone)
96 scalar poppetValveTol_;
98 //- tolerance for valve poppet faces (used to create a faceZone)
99 scalar bottomValveTol_;
102 autoPtr<motionSolver> msPtr_;
104 //- Is the valve really closed
105 boolList isReallyClosed_;
107 //- correct points motion after attach
108 Switch correctPointsMotion_;
110 // Private Member Functions
112 //- Disallow default bitwise copy construct
113 engineValveSliding(const engineValveSliding&);
115 //- Disallow default bitwise assignment
116 void operator=(const engineValveSliding&);
118 //- Make layering modifiers live
119 void makeLayersLive();
121 //- Make Sliding interface modifiers live
122 void makeSlidersLive();
124 //- Is the sliding interface attached?
125 bool attached() const;
127 //- Prepare valve attach/detach
130 //- Prepare valve attach/detach
133 //- Prepare valve attach/detach
134 void prepareValveDetach();
136 //- Check if all patches exist, then calculate virtualPistonPosition,
137 //- pistonPosition and deckHeight for the first time
138 void checkAndCalculate();
140 //- Calculate the virtualPistonPosition,
141 void setVirtualPositions();
143 //- Correct the vertical motion for the points below the "virtual piston",
144 void correctVerticalMotion();
146 bool realDeformation() const;
148 bool inValve(const point& p, const label& i) const;
149 bool inPiston(const point& p) const;
151 bool isACylinderHeadFace(const labelList& cylHeadFaces, const label face);
155 //- Runtime type information
156 TypeName("engineValveSliding");
161 //- Construct from database
162 explicit engineValveSliding(const IOobject& io);
165 // Destructor - default
170 inline const enginePiston& piston() const;
171 inline const thoboisSlidingValveBank& valves() const;
172 inline const scalar& deformSwitch() const;
173 inline const scalar& valveTopTol() const;
174 inline const scalar& pistonPosition() const;
175 inline scalar& pistonPosition();
176 inline const scalar& deckHeight() const;
177 inline scalar& deckHeight();
178 inline const scalarField& minValveZ() const;
179 inline scalarField& maxValveZ();
180 inline const scalar& poppetValveTol() const;
181 inline boolList& isReallyClosed();
182 inline const boolList& isReallyClosed() const;
185 //- Return true for mesh deformation mode
186 bool deformation() const
189 engTime().thetaRevolution() > -deformSwitch_
190 && engTime().thetaRevolution() < deformSwitch_;
193 //- Return number of valves
194 label nValves() const
196 return valves_.size();
199 //- Add valve and piston zones and modifiers
200 void addZonesAndModifiers();
203 virtual bool update();
205 //- Set boundary velocities
206 void setBoundaryVelocity(volVectorField& U);
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 #include "engineValveSlidingI.H"
220 // ************************************************************************* //