Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / engine / dieselEngineValve / dieselEngineValve.H
blob76a96bb0e3949b0590604bd4c6c5420038c612f2
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     dieselEngineValve
28 Description
30 SourceFiles
31     dieselEngineValve.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef dieselEngineValve_H
36 #define dieselEngineValve_H
38 #include "word.H"
39 #include "coordinateSystem.H"
40 #include "polyPatchID.H"
41 #include "graph.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 // Class forward declarations
49 class polyMesh;
50 class engineTime;
52 /*---------------------------------------------------------------------------*\
53                           Class dieselEngineValve Declaration
54 \*---------------------------------------------------------------------------*/
56 class dieselEngineValve
58     // Private data
60         //- Name of valve
61         word name_;
63         //- Reference to engine mesh
64         const polyMesh& mesh_;
66         //- Reference to engine database
67         const engineTime& engineDB_;
69         //- Coordinate system
70         autoPtr<coordinateSystem> csPtr_;
73         // Patch and zone names
75             //- Valve bottom patch
76             polyPatchID bottomPatch_;
78             //- Valve poppet patch
79             polyPatchID poppetPatch_;
81             //- Valve poppet patch
82             polyPatchID sidePatch_;
84             //- Valve stem patch
85             polyPatchID stemPatch_;
87             //- Valve curtain manifold patch
88             polyPatchID downInPortPatch_;
90             //- Valve curtain cylinder patch
91             polyPatchID downInCylinderPatch_;
93             //- Valve curtain manifold patch
94             polyPatchID upInPortPatch_;
96             //- Valve curtain cylinder patch
97             polyPatchID upInCylinderPatch_;
99             //- Valve detach in cylinder patch
100             polyPatchID detachInCylinderPatch_;
102             //- Valve detach in port patch
103             polyPatchID detachInPortPatch_;
105             //- Faces to detach
106             labelList detachFaces_;
107            
108             //- detach tolerance
109             scalar detachTol_;
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_;
126             //- Valve diameter
127             const scalar diameter_;
129            
131     // Private Member Functions
133         //- Disallow default bitwise copy construct
134         dieselEngineValve(const dieselEngineValve&);
136         //- Disallow default bitwise assignment
137         void operator=(const dieselEngineValve&);
140         //- Adjust crank angle to drop within the limits of the lift profile
141         scalar adjustCrankAngle(const scalar theta) const;
143 public:
145     // Static data members
148     // Constructors
150         //- Construct from components
151         dieselEngineValve
152         (
153             const word& name,
154             const polyMesh& mesh,
155             const autoPtr<coordinateSystem>& valveCS,
156             const word& bottomPatchName,
157             const word& poppetPatchName,
158             const word& sidePatchName,
159             const word& stemPatchName,
160             const word& downInPortPatchName,
161             const word& downInCylinderPatchName,
162             const word& upInPortPatchName,
163             const word& upInCylinderPatchName,
164             const word& detachInCylinderPatchName,
165             const word& detachInPortPatchName,
166             const labelList& detachFaces,
167             const scalar& detachTol,
168             const graph& liftProfile,
169             const scalar minLift,
170             const scalar diameter
172         );
174         //- Construct from dictionary
175         dieselEngineValve
176         (
177             const word& name,
178             const polyMesh& mesh,
179             const dictionary& dict
180         );
183     // Destructor - default
186     // Member Functions
188         //- Return name
189         const word& name() const
190         {
191             return name_;
192         }
194         //- Return coordinate system
195         const coordinateSystem& cs() const
196         {
197             return csPtr_();
198         }
200         //- Return lift profile
201         const graph& liftProfile() const
202         {
203             return liftProfile_;
204         }
206         //- Return valve diameter
207         scalar diameter() const
208         {
209             return diameter_;
210         }
213         // Valve patches
215             //- Return ID of bottom patch
216             const polyPatchID& bottomPatchID() const
217             {
218                 return bottomPatch_;
219             }
221             //- Return ID of poppet patch
222             const polyPatchID& poppetPatchID() const
223             {
224                 return poppetPatch_;
225             }
227             //- Return ID of side patch
228             const polyPatchID& sidePatchID() const
229             {
230                 return sidePatch_;
231             }
233             //- Return ID of stem patch
234             const polyPatchID& stemPatchID() const
235             {
236                 return stemPatch_;
237             }
239             //- Return ID of down surface in cylinder patch
240             const polyPatchID& downInCylinderPatchID() const
241             {
242                 return downInCylinderPatch_;
243             }
245             //- Return ID of down surface  in port patch
246             const polyPatchID& downInPortPatchID() const
247             {
248                 return downInPortPatch_;
249             }
251             //- Return ID of up surface  in cylinder patch
252             const polyPatchID& upInCylinderPatchID() const
253             {
254                 return upInCylinderPatch_;
255             }
257             //- Return ID of up surface  in port patch
258             const polyPatchID& upInPortPatchID() const
259             {
260                 return upInPortPatch_;
261             }
263             //- Return ID of detach in cylinder patch
264             const polyPatchID& detachInCylinderPatchID() const
265             {
266                 return detachInCylinderPatch_;
267             }
269             //- Return ID of detach in port patch
270             const polyPatchID& detachInPortPatchID() const
271             {
272                 return detachInPortPatch_;
273             }
275             //- Return face labels of detach curtain
276             const labelList& detachFaces() const
277             {
278                 return detachFaces_;
279             }
281             //- Return face labels of detach curtain
282             const scalar& detachTol() const
283             {
284                 return detachTol_;
285             }
287         // Valve position and velocity
289             //- Return valve lift given crank angle in degrees
290             scalar lift(const scalar theta) const;
292             //- Is the valve open?
293             bool isOpen() const;
295             //- Return current lift
296             scalar curLift() const;
298             //- Return valve velocity for current time-step
299             scalar curVelocity() const;
301             //- Return list of active patch labels for the valve head
302             //  (stem is excluded)
303             labelList movingPatchIDs() const;
306         //- Write dictionary
307         void writeDict(Ostream&) const;
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 } // End namespace Foam
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 #endif
319 // ************************************************************************* //