1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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
33 \*---------------------------------------------------------------------------*/
35 #ifndef dieselEngineValve_H
36 #define dieselEngineValve_H
39 #include "coordinateSystem.H"
40 #include "polyPatchID.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Class forward declarations
52 /*---------------------------------------------------------------------------*\
53 Class dieselEngineValve Declaration
54 \*---------------------------------------------------------------------------*/
56 class dieselEngineValve
63 //- Reference to engine mesh
64 const polyMesh& mesh_;
66 //- Reference to engine database
67 const engineTime& engineDB_;
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_;
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_;
106 labelList detachFaces_;
113 //- Valve lift profile
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_;
127 const scalar diameter_;
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;
145 // Static data members
150 //- Construct from components
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
174 //- Construct from dictionary
178 const polyMesh& mesh,
179 const dictionary& dict
183 // Destructor - default
189 const word& name() const
194 //- Return coordinate system
195 const coordinateSystem& cs() const
200 //- Return lift profile
201 const graph& liftProfile() const
206 //- Return valve diameter
207 scalar diameter() const
215 //- Return ID of bottom patch
216 const polyPatchID& bottomPatchID() const
221 //- Return ID of poppet patch
222 const polyPatchID& poppetPatchID() const
227 //- Return ID of side patch
228 const polyPatchID& sidePatchID() const
233 //- Return ID of stem patch
234 const polyPatchID& stemPatchID() const
239 //- Return ID of down surface in cylinder patch
240 const polyPatchID& downInCylinderPatchID() const
242 return downInCylinderPatch_;
245 //- Return ID of down surface in port patch
246 const polyPatchID& downInPortPatchID() const
248 return downInPortPatch_;
251 //- Return ID of up surface in cylinder patch
252 const polyPatchID& upInCylinderPatchID() const
254 return upInCylinderPatch_;
257 //- Return ID of up surface in port patch
258 const polyPatchID& upInPortPatchID() const
260 return upInPortPatch_;
263 //- Return ID of detach in cylinder patch
264 const polyPatchID& detachInCylinderPatchID() const
266 return detachInCylinderPatch_;
269 //- Return ID of detach in port patch
270 const polyPatchID& detachInPortPatchID() const
272 return detachInPortPatch_;
275 //- Return face labels of detach curtain
276 const labelList& detachFaces() const
281 //- Return face labels of detach curtain
282 const scalar& detachTol() const
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?
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;
307 void writeDict(Ostream&) const;
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 } // End namespace Foam
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
319 // ************************************************************************* //