fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / engine / thoboisSlidingValve / thoboisSlidingValve.H
blob58fd03351df5bb760cae004dcbe7051e6c99f5f6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 Class
26     engineVerticalValve
28 Description
29     class for engine meshes with vertical valves
31 SourceFiles
32     engineVerticalValve.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef thoboisSlidingValve_H
37 #define thoboisSlidingValve_H
39 #include "word.H"
40 #include "coordinateSystem.H"
41 #include "polyPatchID.H"
42 #include "graph.H"
43 #include "engineValve.H"
46 #include "faceSet.H"
47 #include "pointSet.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 namespace Foam
53 // Class forward declarations
54 class polyMesh;
55 class engineTime;
57 /*---------------------------------------------------------------------------*\
58                           Class engineVerticalValve Declaration
59 \*---------------------------------------------------------------------------*/
61 class thoboisSlidingValve
64         //- Adjust crank angle to drop within the limits of the lift profile
65         scalar adjustCrankAngle(const scalar theta) const;
68     // Private data
69         //- Name of valve
70         word name_;
72         //- Reference to engine mesh
73         const polyMesh& mesh_;
75         //- Reference to engine database
76         const engineTime& engineDB_;
78         //- Coordinate system
79         autoPtr<coordinateSystem> csPtr_;
82         // Patch and zone names
84             //- Valve bottom patch
85             polyPatchID bottomPatch_;
87             //- Valve poppet patch
88             polyPatchID poppetPatch_;
90             //- Valve poppet patch
91             polyPatchID sidePatch_;
93             //- Valve stem patch
94             polyPatchID stemPatch_;
96             //- Valve sliding in cylinder patch
97             polyPatchID curtainInCylinderPatch_;
99             //- Valve sliding in port patch
100             polyPatchID curtainInPortPatch_;
102             //- Valve detach in cylinder patch
103             polyPatchID detachInCylinderPatch_;
105             //- Valve detach in port patch
106             polyPatchID detachInPortPatch_;
108             //- Faces to detach
109             labelList detachFaces_;
111         // Valve lift data
113             //- Valve lift profile
114             graph liftProfile_;
116             //- Lift curve start angle
117             scalar liftProfileStart_;
119             //- Lift curve end angle
120             scalar liftProfileEnd_;
122             //- Minimum valve lift.  On this lift the valve is considered closed
123             const scalar minLift_;
125             //- Valve diameter
126             const scalar diameter_;
128             //- Tolerance for deformation/layering
129             scalar deformationLift_;
131         // Mesh motion data
133                     
134            //- Name of the faceSet for the valveTop layer 
135             word layeringFacesTopName_;
136             
137             //- Name of thefaceSet for the valveBottom layer 
138             word layeringFacesBottomName_;
141             //- Name of thefaceSet for the valveBottom layer 
142             word movingCellsTopName_;
144             //- Name of thefaceSet for the valveBottom layer 
145             word movingCellsBottomName_;
147             //- Name of thefaceSet for the valveBottom layer 
148             word movingPointsTopName_;
150             //- Name of thefaceSet for the valveBottom layer 
151             word movingPointsBottomName_;
153             const scalar minTopLayer_;
154    
155             const scalar maxTopLayer_;
157             const scalar minBottomLayer_;
159             const scalar maxBottomLayer_;
161             //- Name of the pointSet for the static points
162             word staticPointsName_;
163             
164             //- Name of the pointSet for the moving points
165             word movingPointsName_;
167             //- Name of the pointSet for the moving internal points
168 //            word movingInternalPointsName_;
169             
170             //- Name of the cellSet for the static cells
171             word staticCellsName_;
172             
173             //- Name of the cellSet for the moving cells
174             word movingCellsName_;
175         
177     // Private Member Functions
179         //- Disallow default bitwise copy construct
180         thoboisSlidingValve(const thoboisSlidingValve&);
182         //- Disallow default bitwise assignment
183         void operator=(const thoboisSlidingValve&);
187 public:
189     // Static data members
192     // Constructors
194         //- Construct from components
195         thoboisSlidingValve
196         (
197             const word& name,
198             const polyMesh& mesh,
199             const autoPtr<coordinateSystem>& valveCS,
200             const word& bottomPatchName,
201             const word& sidePatchName,    
202             const word& poppetPatchName,
203             const word& stemPatchName,
204             const word& curtainInPortPatchName,
205             const word& curtainInCylinderPatchName,
206             const word& detachInCylinderPatchName,
207             const word& detachInPortPatchName,
208             const labelList& detachFaces,
209             const graph& liftProfile,
210             const scalar minLift,
211             const scalar diameter,
212             const scalar deformationLift,
213             const word& layeringFacesTopName,
214             const word& layeringFacesBottomName,
215             const word& movingCellsTopName,
216             const word& movingCellsBottomName,
217             const word& movingPointsTopName,
218             const word& movingPointsBottomName,
219             const scalar minTopLayer,
220             const scalar maxTopLayer,
221             const scalar minBottomLayer,
222             const scalar maxBottomLayer,
223             const word& staticPointsName,
224             const word& movingPointsName,
225             const word& staticCellsName,
226             const word& movingCellsName
227         );
229         //- Construct from dictionary
230         thoboisSlidingValve
231         (
232             const word& name,
233             const polyMesh& mesh,
234             const dictionary& dict
235         );
238     // Destructor - default
241     // Member Functions
243         //- Return name
244         const word& name() const
245         {
246             return name_;
247         }
249         //- Return coordinate system
250         const coordinateSystem& cs() const
251         {
252             return csPtr_();
253         }
255         //- Return lift profile
256         const graph& liftProfile() const
257         {
258             return liftProfile_;
259         }
261         //- Return valve min Lift
262         scalar minLift() const
263         {
264             return minLift_;
265         }
268         //- Return valve diameter
269         scalar diameter() const
270         {
271             return diameter_;
272         }
274         const scalar& deformationLift() const
275         {
276             return deformationLift_;
277         }
279         // Valve patches
281             //- Return ID of bottom patch
282             const polyPatchID& bottomPatchID() const
283             {
284                 return bottomPatch_;
285             }
287             //- Return ID of poppet patch
288             const polyPatchID& poppetPatchID() const
289             {
290                 return poppetPatch_;
291             }
293             //- Return ID of side patch
294             const polyPatchID& sidePatchID() const
295             {
296                 return sidePatch_;
297             }
299             //- Return ID of stem patch
300             const polyPatchID& stemPatchID() const
301             {
302                 return stemPatch_;
303             }
306             //- Return ID of sliding in port patch
307             const polyPatchID& curtainInPortPatchID() const
308             {
309                 return curtainInPortPatch_;
310             }
312             //- Return ID of sliding in cylinder patch
313             const polyPatchID& curtainInCylinderPatchID() const
314             {
315                 return curtainInCylinderPatch_;
316             }
318             //- Return ID of detach in cylinder patch
319             const polyPatchID& detachInCylinderPatchID() const
320             {
321                 return detachInCylinderPatch_;
322             }
324             //- Return ID of detach in port patch
325             const polyPatchID& detachInPortPatchID() const
326             {
327                 return detachInPortPatch_;
328             }
330             //- Return face labels of detach curtain
331             const labelList& detachFaces() const
332             {
333                 return detachFaces_;
334             }
336             const word& layeringFacesTopName() const
337             {
338                 return layeringFacesTopName_;
339             }
340             const word& layeringFacesBottomName() const
341             {
342                 return layeringFacesBottomName_;
343             }
345             const word& movingCellsTopName() const
346             {
347                 return movingCellsTopName_;
348             }
349             const word& movingCellsBottomName() const
350             {
351                 return movingCellsBottomName_;
352             }
354             const word& movingPointsTopName() const
355             {
356                 return movingPointsTopName_;
357             }
358             const word& movingPointsBottomName() const
359             {
360                 return movingPointsBottomName_;
361             }
363         // Valve position and velocity
365             //- Return valve lift given crank angle in degrees
366             scalar lift(const scalar theta) const;
368             //- Is the valve open?
369             bool isOpen() const;
371             //- Return current lift
372             scalar curLift() const;
374             //- Return valve velocity for current time-step
375             scalar curVelocity() const;
377             //- Return list of active patch labels for the valve head
378             //  (stem is excluded)
379             labelList movingPatchIDs() const;
381             //- Return min valveTop layer
382             scalar minTopLayer() const
383             {
384                 return minTopLayer_;
385             }
386             //- Return max valveTop layer
387             scalar maxTopLayer() const
388             {
389                 return maxTopLayer_;
390             }
391             //- Return min valveBottom layer
392             scalar minBottomLayer() const
393             {
394                 return minBottomLayer_;
395             }
396             //- Return max valveBottom layer
397             scalar maxBottomLayer() const
398             {
399                 return maxBottomLayer_;
400             }
402             const word& staticPointsName() const
403             {
404                 return staticPointsName_;
405             }
407             const word& movingPointsName() const
408             {
409                 return movingPointsName_;
410             }
413             const word& staticCellsName() const
414             {
415                 return staticCellsName_;
416             }
418             const word& movingCellsName() const
419             {
420                 return movingCellsName_;
421             }
422         
425         //- Write dictionary
426         void writeDict(Ostream&) const;
430 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
432 } // End namespace Foam
434 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
436 #endif
438 // ************************************************************************* //