initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / engine / engineValve / engineValve.H
blob7bf30fded79a0ead5ff23524527e0886013217c2
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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     Foam::engineValve
28 Description
29     Foam::engineValve
31 SourceFiles
32     engineValve.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef engineValve_H
37 #define engineValve_H
39 #include "word.H"
40 #include "coordinateSystem.H"
41 #include "polyPatchID.H"
42 #include "graph.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 // Forward declaration of classes
50 class polyMesh;
51 class engineTime;
53 /*---------------------------------------------------------------------------*\
54                           Class engineValve Declaration
55 \*---------------------------------------------------------------------------*/
57 class engineValve
59     // Private data
61         //- Name of valve
62         word name_;
64         //- Reference to engine mesh
65         const polyMesh& mesh_;
67         //- Reference to engine database
68         const engineTime& engineDB_;
70         //- Coordinate system
71         autoPtr<coordinateSystem> csPtr_;
74         // Patch and zone names
76             //- Valve bottom patch
77             polyPatchID bottomPatch_;
79             //- Valve poppet patch
80             polyPatchID poppetPatch_;
82             //- Valve stem patch
83             polyPatchID stemPatch_;
85             //- Valve curtain manifold patch
86             polyPatchID curtainInPortPatch_;
88             //- Valve curtain cylinder patch
89             polyPatchID curtainInCylinderPatch_;
91             //- Valve detach in cylinder patch
92             polyPatchID detachInCylinderPatch_;
94             //- Valve detach in port patch
95             polyPatchID detachInPortPatch_;
97             //- Faces to detach
98             labelList detachFaces_;
101         // Valve lift data
103             //- Valve lift profile
104             graph liftProfile_;
106             //- Lift curve start angle
107             scalar liftProfileStart_;
109             //- Lift curve end angle
110             scalar liftProfileEnd_;
112             //- Minimum valve lift.  On this lift the valve is considered closed
113             const scalar minLift_;
116             // Valve layering data
118                 //- Min top layer thickness
119                 const scalar minTopLayer_;
121                 //- Max top layer thickness
122                 const scalar maxTopLayer_;
124                 //- Min bottom layer thickness
125                 const scalar minBottomLayer_;
127                 //- Max bottom layer thickness
128                 const scalar maxBottomLayer_;
131             //- Valve diameter
132             const scalar diameter_;
135     // Private Member Functions
137         //- Disallow default bitwise copy construct
138         engineValve(const engineValve&);
140         //- Disallow default bitwise assignment
141         void operator=(const engineValve&);
144         //- Adjust crank angle to drop within the limits of the lift profile
145         scalar adjustCrankAngle(const scalar theta) const;
147 public:
149     // Static data members
152     // Constructors
154         //- Construct from components
155         engineValve
156         (
157             const word& name,
158             const polyMesh& mesh,
159             const autoPtr<coordinateSystem>& valveCS,
160             const word& bottomPatchName,
161             const word& poppetPatchName,
162             const word& stemPatchName,
163             const word& curtainInPortPatchName,
164             const word& curtainInCylinderPatchName,
165             const word& detachInCylinderPatchName,
166             const word& detachInPortPatchName,
167             const labelList& detachFaces,
168             const graph& liftProfile,
169             const scalar minLift,
170             const scalar minTopLayer,
171             const scalar maxTopLayer,
172             const scalar minBottomLayer,
173             const scalar maxBottomLayer,
174             const scalar diameter
176         );
178         //- Construct from dictionary
179         engineValve
180         (
181             const word& name,
182             const polyMesh& mesh,
183             const dictionary& dict
184         );
187     // Destructor - default
190     // Member Functions
192         //- Return name
193         const word& name() const
194         {
195             return name_;
196         }
198         //- Return coordinate system
199         const coordinateSystem& cs() const
200         {
201             return csPtr_();
202         }
204         //- Return lift profile
205         const graph& liftProfile() const
206         {
207             return liftProfile_;
208         }
210         //- Return valve diameter
211         scalar diameter() const
212         {
213             return diameter_;
214         }
217         // Valve patches
219             //- Return ID of bottom patch
220             const polyPatchID& bottomPatchID() const
221             {
222                 return bottomPatch_;
223             }
225             //- Return ID of poppet patch
226             const polyPatchID& poppetPatchID() const
227             {
228                 return poppetPatch_;
229             }
231             //- Return ID of stem patch
232             const polyPatchID& stemPatchID() const
233             {
234                 return stemPatch_;
235             }
237             //- Return ID of curtain in cylinder patch
238             const polyPatchID& curtainInCylinderPatchID() const
239             {
240                 return curtainInCylinderPatch_;
241             }
243             //- Return ID of curtain in port patch
244             const polyPatchID& curtainInPortPatchID() const
245             {
246                 return curtainInPortPatch_;
247             }
250             //- Return ID of detach in cylinder patch
251             const polyPatchID& detachInCylinderPatchID() const
252             {
253                 return detachInCylinderPatch_;
254             }
256             //- Return ID of detach in port patch
257             const polyPatchID& detachInPortPatchID() const
258             {
259                 return detachInPortPatch_;
260             }
262             //- Return face labels of detach curtain
263             const labelList& detachFaces() const
264             {
265                 return detachFaces_;
266             }
269         // Valve layering thickness
271             scalar minTopLayer() const
272             {
273                 return minTopLayer_;
274             }
276             scalar maxTopLayer() const
277             {
278                 return maxTopLayer_;
279             }
281             scalar minBottomLayer() const
282             {
283                 return minBottomLayer_;
284             }
286             scalar maxBottomLayer() const
287             {
288                 return maxBottomLayer_;
289             }
292         // Valve position and velocity
294             //- Return valve lift given crank angle in degrees
295             scalar lift(const scalar theta) const;
297             //- Is the valve open?
298             bool isOpen() const;
300             //- Return current lift
301             scalar curLift() const;
303             //- Return valve velocity for current time-step
304             scalar curVelocity() const;
306             //- Return list of active patch labels for the valve head
307             //  (stem is excluded)
308             labelList movingPatchIDs() const;
311         //- Write dictionary
312         void writeDict(Ostream&) const;
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 } // End namespace Foam
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
322 #endif
324 // ************************************************************************* //