Forward compatibility: flex
[foam-extend-3.2.git] / src / engine / dieselEngineValve / dieselEngineValve.H
blob435cab91f2081b3a2e9368686d65384c92645129
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     dieselEngineValve
27 Description
29 SourceFiles
30     dieselEngineValve.C
32 \*---------------------------------------------------------------------------*/
34 #ifndef dieselEngineValve_H
35 #define dieselEngineValve_H
37 #include "word.H"
38 #include "coordinateSystem.H"
39 #include "polyPatchID.H"
40 #include "graph.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 // Class forward declarations
48 class polyMesh;
49 class engineTime;
51 /*---------------------------------------------------------------------------*\
52                           Class dieselEngineValve Declaration
53 \*---------------------------------------------------------------------------*/
55 class dieselEngineValve
57     // Private data
59         //- Name of valve
60         word name_;
62         //- Reference to engine mesh
63         const polyMesh& mesh_;
65         //- Reference to engine database
66         const engineTime& engineDB_;
68         //- Coordinate system
69         autoPtr<coordinateSystem> csPtr_;
72         // Patch and zone names
74             //- Valve bottom patch
75             polyPatchID bottomPatch_;
77             //- Valve poppet patch
78             polyPatchID poppetPatch_;
80             //- Valve poppet patch
81             polyPatchID sidePatch_;
83             //- Valve stem patch
84             polyPatchID stemPatch_;
86             //- Valve curtain manifold patch
87             polyPatchID downInPortPatch_;
89             //- Valve curtain cylinder patch
90             polyPatchID downInCylinderPatch_;
92             //- Valve curtain manifold patch
93             polyPatchID upInPortPatch_;
95             //- Valve curtain cylinder patch
96             polyPatchID upInCylinderPatch_;
98             //- Valve detach in cylinder patch
99             polyPatchID detachInCylinderPatch_;
101             //- Valve detach in port patch
102             polyPatchID detachInPortPatch_;
104             //- Faces to detach
105             labelList detachFaces_;
107             //- detach tolerance
108             scalar detachTol_;
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_;
125             //- Valve diameter
126             const scalar diameter_;
130     // Private Member Functions
132         //- Disallow default bitwise copy construct
133         dieselEngineValve(const dieselEngineValve&);
135         //- Disallow default bitwise assignment
136         void operator=(const dieselEngineValve&);
139         //- Adjust crank angle to drop within the limits of the lift profile
140         scalar adjustCrankAngle(const scalar theta) const;
142 public:
144     // Static data members
147     // Constructors
149         //- Construct from components
150         dieselEngineValve
151         (
152             const word& name,
153             const polyMesh& mesh,
154             const autoPtr<coordinateSystem>& valveCS,
155             const word& bottomPatchName,
156             const word& poppetPatchName,
157             const word& sidePatchName,
158             const word& stemPatchName,
159             const word& downInPortPatchName,
160             const word& downInCylinderPatchName,
161             const word& upInPortPatchName,
162             const word& upInCylinderPatchName,
163             const word& detachInCylinderPatchName,
164             const word& detachInPortPatchName,
165             const labelList& detachFaces,
166             const scalar& detachTol,
167             const graph& liftProfile,
168             const scalar minLift,
169             const scalar diameter
171         );
173         //- Construct from dictionary
174         dieselEngineValve
175         (
176             const word& name,
177             const polyMesh& mesh,
178             const dictionary& dict
179         );
182     // Destructor - default
185     // Member Functions
187         //- Return name
188         const word& name() const
189         {
190             return name_;
191         }
193         //- Return coordinate system
194         const coordinateSystem& cs() const
195         {
196             return csPtr_();
197         }
199         //- Return lift profile
200         const graph& liftProfile() const
201         {
202             return liftProfile_;
203         }
205         //- Return valve diameter
206         scalar diameter() const
207         {
208             return diameter_;
209         }
212         // Valve patches
214             //- Return ID of bottom patch
215             const polyPatchID& bottomPatchID() const
216             {
217                 return bottomPatch_;
218             }
220             //- Return ID of poppet patch
221             const polyPatchID& poppetPatchID() const
222             {
223                 return poppetPatch_;
224             }
226             //- Return ID of side patch
227             const polyPatchID& sidePatchID() const
228             {
229                 return sidePatch_;
230             }
232             //- Return ID of stem patch
233             const polyPatchID& stemPatchID() const
234             {
235                 return stemPatch_;
236             }
238             //- Return ID of down surface in cylinder patch
239             const polyPatchID& downInCylinderPatchID() const
240             {
241                 return downInCylinderPatch_;
242             }
244             //- Return ID of down surface  in port patch
245             const polyPatchID& downInPortPatchID() const
246             {
247                 return downInPortPatch_;
248             }
250             //- Return ID of up surface  in cylinder patch
251             const polyPatchID& upInCylinderPatchID() const
252             {
253                 return upInCylinderPatch_;
254             }
256             //- Return ID of up surface  in port patch
257             const polyPatchID& upInPortPatchID() const
258             {
259                 return upInPortPatch_;
260             }
262             //- Return ID of detach in cylinder patch
263             const polyPatchID& detachInCylinderPatchID() const
264             {
265                 return detachInCylinderPatch_;
266             }
268             //- Return ID of detach in port patch
269             const polyPatchID& detachInPortPatchID() const
270             {
271                 return detachInPortPatch_;
272             }
274             //- Return face labels of detach curtain
275             const labelList& detachFaces() const
276             {
277                 return detachFaces_;
278             }
280             //- Return face labels of detach curtain
281             const scalar& detachTol() const
282             {
283                 return detachTol_;
284             }
286         // Valve position and velocity
288             //- Return valve lift given crank angle in degrees
289             scalar lift(const scalar theta) const;
291             //- Is the valve open?
292             bool isOpen() const;
294             //- Return current lift
295             scalar curLift() const;
297             //- Return valve velocity for current time-step
298             scalar curVelocity() const;
300             //- Return list of active patch labels for the valve head
301             //  (stem is excluded)
302             labelList movingPatchIDs() const;
305         //- Write dictionary
306         void writeDict(Ostream&) const;
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 } // End namespace Foam
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 #endif
318 // ************************************************************************* //