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/>.
35 \*---------------------------------------------------------------------------*/
37 #ifndef engineValveSliding_H
38 #define engineValveSliding_H
40 #include "engineTopoChangerMesh.H"
41 #include "enginePiston.H"
42 #include "motionSolver.H"
43 #include "polyPatchID.H"
44 #include "thoboisSlidingValveBank.H"
45 #include "twoDPointCorrector.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 // Class forward declarations
57 /*---------------------------------------------------------------------------*\
58 Class verticalValves Declaration
59 \*---------------------------------------------------------------------------*/
61 class engineValveSliding
63 public engineTopoChangerMesh
71 thoboisSlidingValveBank valves_;
73 //- Layering-to-deformation switch in crank-angle degrees
76 //- Top valve tolerance, when valve lift < tol, valve top layering is disabled
80 scalar pistonPosition_;
82 //- Virtual position of the bottom of the valves
83 scalarField valveBottomPosition_;
85 //- Virtual position of the bottom of the valves
86 scalarField valvePistonPosition_;
92 scalarField minValveZ_;
94 //- tolerance for valve poppet faces (used to create a faceZone)
95 scalar poppetValveTol_;
97 //- tolerance for valve poppet faces (used to create a faceZone)
98 scalar bottomValveTol_;
101 autoPtr<motionSolver> msPtr_;
103 //- Is the valve really closed
104 boolList isReallyClosed_;
106 //- correct points motion after attach
107 Switch correctPointsMotion_;
109 // Private Member Functions
111 //- Disallow default bitwise copy construct
112 engineValveSliding(const engineValveSliding&);
114 //- Disallow default bitwise assignment
115 void operator=(const engineValveSliding&);
117 //- Make layering modifiers live
118 void makeLayersLive();
120 //- Make Sliding interface modifiers live
121 void makeSlidersLive();
123 //- Is the sliding interface attached?
124 bool attached() const;
126 //- Prepare valve attach/detach
129 //- Prepare valve attach/detach
132 //- Prepare valve attach/detach
133 void prepareValveDetach();
135 //- Check if all patches exist, then calculate virtualPistonPosition,
136 //- pistonPosition and deckHeight for the first time
137 void checkAndCalculate();
139 //- Calculate the virtualPistonPosition,
140 void setVirtualPositions();
142 //- Correct the vertical motion for the points below the "virtual piston",
143 void correctVerticalMotion();
145 bool realDeformation() const;
147 bool inValve(const point& p, const label& i) const;
148 bool inPiston(const point& p) const;
150 bool isACylinderHeadFace(const labelList& cylHeadFaces, const label face);
154 //- Runtime type information
155 TypeName("engineValveSliding");
160 //- Construct from database
161 explicit engineValveSliding(const IOobject& io);
164 // Destructor - default
169 inline const enginePiston& piston() const;
170 inline const thoboisSlidingValveBank& valves() const;
171 inline const scalar& deformSwitch() const;
172 inline const scalar& valveTopTol() const;
173 inline const scalar& pistonPosition() const;
174 inline scalar& pistonPosition();
175 inline const scalar& deckHeight() const;
176 inline scalar& deckHeight();
177 inline const scalarField& minValveZ() const;
178 inline scalarField& maxValveZ();
179 inline const scalar& poppetValveTol() const;
180 inline boolList& isReallyClosed();
181 inline const boolList& isReallyClosed() const;
184 //- Return true for mesh deformation mode
185 bool deformation() const
188 engTime().thetaRevolution() > -deformSwitch_
189 && engTime().thetaRevolution() < deformSwitch_;
192 //- Return number of valves
193 label nValves() const
195 return valves_.size();
198 //- Add valve and piston zones and modifiers
199 void addZonesAndModifiers();
202 virtual bool update();
204 //- Set boundary velocities
205 void setBoundaryVelocity(volVectorField& U);
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 } // End namespace Foam
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 #include "engineValveSlidingI.H"
219 // ************************************************************************* //