1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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
34 \*---------------------------------------------------------------------------*/
40 #include "coordinateSystem.H"
41 #include "polyPatchID.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
53 /*---------------------------------------------------------------------------*\
54 Class engineValve Declaration
55 \*---------------------------------------------------------------------------*/
64 //- Reference to engine mesh
65 const polyMesh& mesh_;
67 //- Reference to engine database
68 const engineTime& engineDB_;
71 autoPtr<coordinateSystem> csPtr_;
74 // Patch and zone names
76 //- Valve bottom patch
77 polyPatchID bottomPatch_;
79 //- Valve poppet patch
80 polyPatchID poppetPatch_;
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_;
98 labelList detachFaces_;
103 //- Valve lift profile
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_;
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;
149 // Static data members
154 //- Construct from components
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
178 //- Construct from dictionary
182 const polyMesh& mesh,
183 const dictionary& dict
187 // Destructor - default
193 const word& name() const
198 //- Return coordinate system
199 const coordinateSystem& cs() const
204 //- Return lift profile
205 const graph& liftProfile() const
210 //- Return valve diameter
211 scalar diameter() const
219 //- Return ID of bottom patch
220 const polyPatchID& bottomPatchID() const
225 //- Return ID of poppet patch
226 const polyPatchID& poppetPatchID() const
231 //- Return ID of stem patch
232 const polyPatchID& stemPatchID() const
237 //- Return ID of curtain in cylinder patch
238 const polyPatchID& curtainInCylinderPatchID() const
240 return curtainInCylinderPatch_;
243 //- Return ID of curtain in port patch
244 const polyPatchID& curtainInPortPatchID() const
246 return curtainInPortPatch_;
250 //- Return ID of detach in cylinder patch
251 const polyPatchID& detachInCylinderPatchID() const
253 return detachInCylinderPatch_;
256 //- Return ID of detach in port patch
257 const polyPatchID& detachInPortPatchID() const
259 return detachInPortPatch_;
262 //- Return face labels of detach curtain
263 const labelList& detachFaces() const
269 // Valve layering thickness
271 scalar minTopLayer() const
276 scalar maxTopLayer() const
281 scalar minBottomLayer() const
283 return minBottomLayer_;
286 scalar maxBottomLayer() const
288 return maxBottomLayer_;
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?
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;
312 void writeDict(Ostream&) const;
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 } // End namespace Foam
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
324 // ************************************************************************* //