Forward compatibility: flex
[foam-extend-3.2.git] / src / engine / thoboisSlidingValve / thoboisSlidingValve.H
blob3fcde15975d90236fe6e1e4cec226baa206f78f0
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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 Class
25     engineVerticalValve
27 Description
28     class for engine meshes with vertical valves
30 SourceFiles
31     engineVerticalValve.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef thoboisSlidingValve_H
36 #define thoboisSlidingValve_H
38 #include "word.H"
39 #include "coordinateSystem.H"
40 #include "polyPatchID.H"
41 #include "graph.H"
42 #include "engineValve.H"
45 #include "faceSet.H"
46 #include "pointSet.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 namespace Foam
52 // Class forward declarations
53 class polyMesh;
54 class engineTime;
56 /*---------------------------------------------------------------------------*\
57                           Class engineVerticalValve Declaration
58 \*---------------------------------------------------------------------------*/
60 class thoboisSlidingValve
63         //- Adjust crank angle to drop within the limits of the lift profile
64         scalar adjustCrankAngle(const scalar theta) const;
67     // Private data
68         //- Name of valve
69         word name_;
71         //- Reference to engine mesh
72         const polyMesh& mesh_;
74         //- Reference to engine database
75         const engineTime& engineDB_;
77         //- Coordinate system
78         autoPtr<coordinateSystem> csPtr_;
81         // Patch and zone names
83             //- Valve bottom patch
84             polyPatchID bottomPatch_;
86             //- Valve poppet patch
87             polyPatchID poppetPatch_;
89             //- Valve poppet patch
90             polyPatchID sidePatch_;
92             //- Valve stem patch
93             polyPatchID stemPatch_;
95             //- Valve sliding in cylinder patch
96             polyPatchID curtainInCylinderPatch_;
98             //- Valve sliding in port patch
99             polyPatchID curtainInPortPatch_;
101             //- Valve detach in cylinder patch
102             polyPatchID detachInCylinderPatch_;
104             //- Valve detach in port patch
105             polyPatchID detachInPortPatch_;
107             //- Faces to detach
108             labelList detachFaces_;
110         // Valve lift data
112             //- Valve lift profile
113             graph liftProfile_;
115             //- Lift curve start angle
116             scalar liftProfileStart_;
118             //- Lift curve end angle
119             scalar liftProfileEnd_;
121             //- Minimum valve lift.  On this lift the valve is considered closed
122             const scalar minLift_;
124             //- Valve diameter
125             const scalar diameter_;
127             //- Tolerance for deformation/layering
128             scalar deformationLift_;
130         // Mesh motion data
133            //- Name of the faceSet for the valveTop layer
134             word layeringFacesTopName_;
136             //- Name of thefaceSet for the valveBottom layer
137             word layeringFacesBottomName_;
140             //- Name of thefaceSet for the valveBottom layer
141             word movingCellsTopName_;
143             //- Name of thefaceSet for the valveBottom layer
144             word movingCellsBottomName_;
146             //- Name of thefaceSet for the valveBottom layer
147             word movingPointsTopName_;
149             //- Name of thefaceSet for the valveBottom layer
150             word movingPointsBottomName_;
152             const scalar minTopLayer_;
154             const scalar maxTopLayer_;
156             const scalar minBottomLayer_;
158             const scalar maxBottomLayer_;
160             //- Name of the pointSet for the static points
161             word staticPointsName_;
163             //- Name of the pointSet for the moving points
164             word movingPointsName_;
166             //- Name of the pointSet for the moving internal points
167 //            word movingInternalPointsName_;
169             //- Name of the cellSet for the static cells
170             word staticCellsName_;
172             //- Name of the cellSet for the moving cells
173             word movingCellsName_;
176     // Private Member Functions
178         //- Disallow default bitwise copy construct
179         thoboisSlidingValve(const thoboisSlidingValve&);
181         //- Disallow default bitwise assignment
182         void operator=(const thoboisSlidingValve&);
186 public:
188     // Static data members
191     // Constructors
193         //- Construct from components
194         thoboisSlidingValve
195         (
196             const word& name,
197             const polyMesh& mesh,
198             const autoPtr<coordinateSystem>& valveCS,
199             const word& bottomPatchName,
200             const word& sidePatchName,
201             const word& poppetPatchName,
202             const word& stemPatchName,
203             const word& curtainInPortPatchName,
204             const word& curtainInCylinderPatchName,
205             const word& detachInCylinderPatchName,
206             const word& detachInPortPatchName,
207             const labelList& detachFaces,
208             const graph& liftProfile,
209             const scalar minLift,
210             const scalar diameter,
211             const scalar deformationLift,
212             const word& layeringFacesTopName,
213             const word& layeringFacesBottomName,
214             const word& movingCellsTopName,
215             const word& movingCellsBottomName,
216             const word& movingPointsTopName,
217             const word& movingPointsBottomName,
218             const scalar minTopLayer,
219             const scalar maxTopLayer,
220             const scalar minBottomLayer,
221             const scalar maxBottomLayer,
222             const word& staticPointsName,
223             const word& movingPointsName,
224             const word& staticCellsName,
225             const word& movingCellsName
226     );
228         //- Construct from dictionary
229         thoboisSlidingValve
230         (
231             const word& name,
232             const polyMesh& mesh,
233             const dictionary& dict
234         );
237     // Destructor - default
240     // Member Functions
242         //- Return name
243         const word& name() const
244         {
245             return name_;
246         }
248         //- Return coordinate system
249         const coordinateSystem& cs() const
250         {
251             return csPtr_();
252         }
254         //- Return lift profile
255         const graph& liftProfile() const
256         {
257             return liftProfile_;
258         }
260         //- Return valve min Lift
261         scalar minLift() const
262         {
263             return minLift_;
264         }
267         //- Return valve diameter
268         scalar diameter() const
269         {
270             return diameter_;
271         }
273         const scalar& deformationLift() const
274         {
275             return deformationLift_;
276         }
278         // Valve patches
280             //- Return ID of bottom patch
281             const polyPatchID& bottomPatchID() const
282             {
283                 return bottomPatch_;
284             }
286             //- Return ID of poppet patch
287             const polyPatchID& poppetPatchID() const
288             {
289                 return poppetPatch_;
290             }
292             //- Return ID of side patch
293             const polyPatchID& sidePatchID() const
294             {
295                 return sidePatch_;
296             }
298             //- Return ID of stem patch
299             const polyPatchID& stemPatchID() const
300             {
301                 return stemPatch_;
302             }
305             //- Return ID of sliding in port patch
306             const polyPatchID& curtainInPortPatchID() const
307             {
308                 return curtainInPortPatch_;
309             }
311             //- Return ID of sliding in cylinder patch
312             const polyPatchID& curtainInCylinderPatchID() const
313             {
314                 return curtainInCylinderPatch_;
315             }
317             //- Return ID of detach in cylinder patch
318             const polyPatchID& detachInCylinderPatchID() const
319             {
320                 return detachInCylinderPatch_;
321             }
323             //- Return ID of detach in port patch
324             const polyPatchID& detachInPortPatchID() const
325             {
326                 return detachInPortPatch_;
327             }
329             //- Return face labels of detach curtain
330             const labelList& detachFaces() const
331             {
332                 return detachFaces_;
333             }
335             const word& layeringFacesTopName() const
336             {
337                 return layeringFacesTopName_;
338             }
339             const word& layeringFacesBottomName() const
340             {
341                 return layeringFacesBottomName_;
342             }
344             const word& movingCellsTopName() const
345             {
346                 return movingCellsTopName_;
347             }
348             const word& movingCellsBottomName() const
349             {
350                 return movingCellsBottomName_;
351             }
353             const word& movingPointsTopName() const
354             {
355                 return movingPointsTopName_;
356             }
357             const word& movingPointsBottomName() const
358             {
359                 return movingPointsBottomName_;
360             }
362         // Valve position and velocity
364             //- Return valve lift given crank angle in degrees
365             scalar lift(const scalar theta) const;
367             //- Is the valve open?
368             bool isOpen() const;
370             //- Return current lift
371             scalar curLift() const;
373             //- Return valve velocity for current time-step
374             scalar curVelocity() const;
376             //- Return list of active patch labels for the valve head
377             //  (stem is excluded)
378             labelList movingPatchIDs() const;
380             //- Return min valveTop layer
381             scalar minTopLayer() const
382             {
383                 return minTopLayer_;
384             }
385             //- Return max valveTop layer
386             scalar maxTopLayer() const
387             {
388                 return maxTopLayer_;
389             }
390             //- Return min valveBottom layer
391             scalar minBottomLayer() const
392             {
393                 return minBottomLayer_;
394             }
395             //- Return max valveBottom layer
396             scalar maxBottomLayer() const
397             {
398                 return maxBottomLayer_;
399             }
401             const word& staticPointsName() const
402             {
403                 return staticPointsName_;
404             }
406             const word& movingPointsName() const
407             {
408                 return movingPointsName_;
409             }
412             const word& staticCellsName() const
413             {
414                 return staticCellsName_;
415             }
417             const word& movingCellsName() const
418             {
419                 return movingCellsName_;
420             }
424         //- Write dictionary
425         void writeDict(Ostream&) const;
429 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
431 } // End namespace Foam
433 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
435 #endif
437 // ************************************************************************* //