engineValve.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::engineValve
26 
27 Description
28  Foam::engineValve
29 
30 SourceFiles
31  engineValve.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef engineValve_H
36 #define engineValve_H
37 
38 #include "word.H"
39 #include "coordinateSystem.H"
40 #include "polyPatchID.H"
41 #include "graph.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of classes
49 class polyMesh;
50 class engineTime;
51 
52 /*---------------------------------------------------------------------------*\
53  Class engineValve Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class engineValve
57 {
58  // Private data
59 
60  //- Name of valve
61  word name_;
62 
63  //- Reference to engine mesh
64  const polyMesh& mesh_;
65 
66  //- Reference to engine database
67  const engineTime& engineDB_;
68 
69  //- Coordinate system
71 
72 
73  // Patch and zone names
74 
75  //- Valve bottom patch
76  polyPatchID bottomPatch_;
77 
78  //- Valve poppet patch
79  polyPatchID poppetPatch_;
80 
81  //- Valve stem patch
82  polyPatchID stemPatch_;
83 
84  //- Valve curtain manifold patch
85  polyPatchID curtainInPortPatch_;
86 
87  //- Valve curtain cylinder patch
88  polyPatchID curtainInCylinderPatch_;
89 
90  //- Valve detach in cylinder patch
91  polyPatchID detachInCylinderPatch_;
92 
93  //- Valve detach in port patch
94  polyPatchID detachInPortPatch_;
95 
96  //- Faces to detach
97  labelList detachFaces_;
98 
99 
100  // Valve lift data
101 
102  //- Valve lift profile
103  graph liftProfile_;
104 
105  //- Lift curve start angle
106  scalar liftProfileStart_;
107 
108  //- Lift curve end angle
109  scalar liftProfileEnd_;
110 
111  //- Minimum valve lift. On this lift the valve is considered closed
112  const scalar minLift_;
113 
114 
115  // Valve layering data
116 
117  //- Min top layer thickness
118  const scalar minTopLayer_;
119 
120  //- Max top layer thickness
121  const scalar maxTopLayer_;
122 
123  //- Min bottom layer thickness
124  const scalar minBottomLayer_;
125 
126  //- Max bottom layer thickness
127  const scalar maxBottomLayer_;
128 
129 
130  //- Valve diameter
131  const scalar diameter_;
132 
133 
134  // Private Member Functions
135 
136  //- Disallow default bitwise copy construct
137  engineValve(const engineValve&);
138 
139  //- Disallow default bitwise assignment
140  void operator=(const engineValve&);
141 
142 
143  //- Adjust crank angle to drop within the limits of the lift profile
144  scalar adjustCrankAngle(const scalar theta) const;
145 
146 public:
147 
148  // Static data members
149 
150 
151  // Constructors
152 
153  //- Construct from components
155  (
156  const word& name,
157  const polyMesh& mesh,
158  const autoPtr<coordinateSystem>& valveCS,
159  const word& bottomPatchName,
160  const word& poppetPatchName,
161  const word& stemPatchName,
162  const word& curtainInPortPatchName,
163  const word& curtainInCylinderPatchName,
164  const word& detachInCylinderPatchName,
165  const word& detachInPortPatchName,
166  const labelList& detachFaces,
167  const graph& liftProfile,
168  const scalar minLift,
169  const scalar minTopLayer,
170  const scalar maxTopLayer,
171  const scalar minBottomLayer,
172  const scalar maxBottomLayer,
173  const scalar diameter
174 
175  );
176 
177  //- Construct from dictionary
179  (
180  const word& name,
181  const polyMesh& mesh,
182  const dictionary& dict
183  );
184 
185 
186  // Destructor - default
187 
188 
189  // Member Functions
190 
191  //- Return name
192  const word& name() const
193  {
194  return name_;
195  }
196 
197  //- Return coordinate system
198  const coordinateSystem& cs() const
199  {
200  return csPtr_();
201  }
202 
203  //- Return lift profile
204  const graph& liftProfile() const
205  {
206  return liftProfile_;
207  }
208 
209  //- Return valve diameter
210  scalar diameter() const
211  {
212  return diameter_;
213  }
214 
215 
216  // Valve patches
217 
218  //- Return ID of bottom patch
219  const polyPatchID& bottomPatchID() const
220  {
221  return bottomPatch_;
222  }
223 
224  //- Return ID of poppet patch
225  const polyPatchID& poppetPatchID() const
226  {
227  return poppetPatch_;
228  }
229 
230  //- Return ID of stem patch
231  const polyPatchID& stemPatchID() const
232  {
233  return stemPatch_;
234  }
235 
236  //- Return ID of curtain in cylinder patch
238  {
239  return curtainInCylinderPatch_;
240  }
241 
242  //- Return ID of curtain in port patch
243  const polyPatchID& curtainInPortPatchID() const
244  {
245  return curtainInPortPatch_;
246  }
247 
248 
249  //- Return ID of detach in cylinder patch
250  const polyPatchID& detachInCylinderPatchID() const
251  {
252  return detachInCylinderPatch_;
253  }
254 
255  //- Return ID of detach in port patch
256  const polyPatchID& detachInPortPatchID() const
257  {
258  return detachInPortPatch_;
259  }
260 
261  //- Return face labels of detach curtain
262  const labelList& detachFaces() const
263  {
264  return detachFaces_;
265  }
266 
267 
268  // Valve layering thickness
270  scalar minTopLayer() const
271  {
272  return minTopLayer_;
273  }
275  scalar maxTopLayer() const
276  {
277  return maxTopLayer_;
278  }
280  scalar minBottomLayer() const
281  {
282  return minBottomLayer_;
283  }
285  scalar maxBottomLayer() const
286  {
287  return maxBottomLayer_;
288  }
289 
290 
291  // Valve position and velocity
292 
293  //- Return valve lift given crank angle in degrees
294  scalar lift(const scalar theta) const;
295 
296  //- Is the valve open?
297  bool isOpen() const;
298 
299  //- Return current lift
300  scalar curLift() const;
301 
302  //- Return valve velocity for current time-step
303  scalar curVelocity() const;
304 
305  //- Return list of active patch labels for the valve head
306  // (stem is excluded)
307  labelList movingPatchIDs() const;
308 
309 
310  //- Write dictionary
311  void writeDict(Ostream&) const;
312 };
313 
314 
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 
317 } // End namespace Foam
318 
319 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320 
321 #endif
322 
323 // ************************************************************************* //
Base class for other coordinate system specifications.
dictionary dict
void writeDict(Ostream &) const
Write dictionary.
Definition: engineValve.C:237
const polyPatchID & curtainInCylinderPatchID() const
Return ID of curtain in cylinder patch.
Definition: engineValve.H:236
scalar minTopLayer() const
Definition: engineValve.H:269
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
scalar maxBottomLayer() const
Definition: engineValve.H:284
const coordinateSystem & cs() const
Return coordinate system.
Definition: engineValve.H:197
Manage time in terms of engine RPM and crank-angle.
Definition: engineTime.H:68
const polyPatchID & detachInCylinderPatchID() const
Return ID of detach in cylinder patch.
Definition: engineValve.H:249
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
Definition: engineValve.C:214
Class to create, store and output qgraph files.
Definition: graph.H:58
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
scalar minBottomLayer() const
Definition: engineValve.H:279
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
Definition: engineValve.C:173
bool isOpen() const
Is the valve open?
Definition: engineValve.C:184
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
scalar curLift() const
Return current lift.
Definition: engineValve.C:190
Foam::engineValve.
Definition: engineValve.H:55
const polyPatchID & stemPatchID() const
Return ID of stem patch.
Definition: engineValve.H:230
scalar curVelocity() const
Return valve velocity for current time-step.
Definition: engineValve.C:200
const polyPatchID & bottomPatchID() const
Return ID of bottom patch.
Definition: engineValve.H:218
const polyPatchID & curtainInPortPatchID() const
Return ID of curtain in port patch.
Definition: engineValve.H:242
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const polyPatchID & poppetPatchID() const
Return ID of poppet patch.
Definition: engineValve.H:224
const graph & liftProfile() const
Return lift profile.
Definition: engineValve.H:203
const polyPatchID & detachInPortPatchID() const
Return ID of detach in port patch.
Definition: engineValve.H:255
const labelList & detachFaces() const
Return face labels of detach curtain.
Definition: engineValve.H:261
const word & name() const
Return name.
Definition: engineValve.H:191
Namespace for OpenFOAM.
scalar maxTopLayer() const
Definition: engineValve.H:274
scalar diameter() const
Return valve diameter.
Definition: engineValve.H:209