All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
engineValve.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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  //- Adjust crank angle to drop within the limits of the lift profile
137  scalar adjustCrankAngle(const scalar theta) const;
138 
139 
140 public:
141 
142  // Constructors
143 
144  //- Construct from components
146  (
147  const word& name,
148  const polyMesh& mesh,
149  const autoPtr<coordinateSystem>& valveCS,
150  const word& bottomPatchName,
151  const word& poppetPatchName,
152  const word& stemPatchName,
153  const word& curtainInPortPatchName,
154  const word& curtainInCylinderPatchName,
155  const word& detachInCylinderPatchName,
156  const word& detachInPortPatchName,
157  const labelList& detachFaces,
158  const graph& liftProfile,
159  const scalar minLift,
160  const scalar minTopLayer,
161  const scalar maxTopLayer,
162  const scalar minBottomLayer,
163  const scalar maxBottomLayer,
164  const scalar diameter
165 
166  );
167 
168  //- Construct from dictionary
170  (
171  const word& name,
172  const polyMesh& mesh,
173  const dictionary& dict
174  );
175 
176  //- Disallow default bitwise copy construction
177  engineValve(const engineValve&) = delete;
178 
179 
180  // Member Functions
181 
182  //- Return name
183  const word& name() const
184  {
185  return name_;
186  }
187 
188  //- Return coordinate system
189  const coordinateSystem& cs() const
190  {
191  return csPtr_();
192  }
193 
194  //- Return lift profile
195  const graph& liftProfile() const
196  {
197  return liftProfile_;
198  }
199 
200  //- Return valve diameter
201  scalar diameter() const
202  {
203  return diameter_;
204  }
205 
206 
207  // Valve patches
208 
209  //- Return ID of bottom patch
210  const polyPatchID& bottomPatchID() const
211  {
212  return bottomPatch_;
213  }
214 
215  //- Return ID of poppet patch
216  const polyPatchID& poppetPatchID() const
217  {
218  return poppetPatch_;
219  }
220 
221  //- Return ID of stem patch
222  const polyPatchID& stemPatchID() const
223  {
224  return stemPatch_;
225  }
226 
227  //- Return ID of curtain in cylinder patch
229  {
230  return curtainInCylinderPatch_;
231  }
232 
233  //- Return ID of curtain in port patch
234  const polyPatchID& curtainInPortPatchID() const
235  {
236  return curtainInPortPatch_;
237  }
238 
239 
240  //- Return ID of detach in cylinder patch
241  const polyPatchID& detachInCylinderPatchID() const
242  {
243  return detachInCylinderPatch_;
244  }
245 
246  //- Return ID of detach in port patch
247  const polyPatchID& detachInPortPatchID() const
248  {
249  return detachInPortPatch_;
250  }
251 
252  //- Return face labels of detach curtain
253  const labelList& detachFaces() const
254  {
255  return detachFaces_;
256  }
257 
258 
259  // Valve layering thickness
261  scalar minTopLayer() const
262  {
263  return minTopLayer_;
264  }
266  scalar maxTopLayer() const
267  {
268  return maxTopLayer_;
269  }
271  scalar minBottomLayer() const
272  {
273  return minBottomLayer_;
274  }
276  scalar maxBottomLayer() const
277  {
278  return maxBottomLayer_;
279  }
280 
281 
282  // Valve position and velocity
283 
284  //- Return valve lift given crank angle in degrees
285  scalar lift(const scalar theta) const;
286 
287  //- Is the valve open?
288  bool isOpen() const;
289 
290  //- Return current lift
291  scalar curLift() const;
292 
293  //- Return valve velocity for current time-step
294  scalar curVelocity() const;
295 
296  //- Return list of active patch labels for the valve head
297  // (stem is excluded)
298  labelList movingPatchIDs() const;
299 
300 
301  //- Write dictionary
302  void writeDict(Ostream&) const;
303 
304 
305  // Member Operators
306 
307  //- Disallow default bitwise assignment
308  void operator=(const engineValve&) = delete;
309 };
310 
311 
312 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 
314 } // End namespace Foam
315 
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 
318 #endif
319 
320 // ************************************************************************* //
Base class for other coordinate system specifications.
const polyPatchID & curtainInPortPatchID() const
Return ID of curtain in port patch.
Definition: engineValve.H:233
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
bool isOpen() const
Is the valve open?
Definition: engineValve.C:184
void operator=(const engineValve &)=delete
Disallow default bitwise assignment.
engineValve(const word &name, const polyMesh &mesh, const autoPtr< coordinateSystem > &valveCS, const word &bottomPatchName, const word &poppetPatchName, const word &stemPatchName, const word &curtainInPortPatchName, const word &curtainInCylinderPatchName, const word &detachInCylinderPatchName, const word &detachInPortPatchName, const labelList &detachFaces, const graph &liftProfile, const scalar minLift, const scalar minTopLayer, const scalar maxTopLayer, const scalar minBottomLayer, const scalar maxBottomLayer, const scalar diameter)
Construct from components.
Definition: engineValve.C:68
scalar maxBottomLayer() const
Definition: engineValve.H:275
const polyPatchID & poppetPatchID() const
Return ID of poppet patch.
Definition: engineValve.H:215
const graph & liftProfile() const
Return lift profile.
Definition: engineValve.H:194
scalar minBottomLayer() const
Definition: engineValve.H:270
An abstract class for the time description of the piston motion.
Definition: engineTime.H:51
const labelList & detachFaces() const
Return face labels of detach curtain.
Definition: engineValve.H:252
scalar maxTopLayer() const
Definition: engineValve.H:265
void writeDict(Ostream &) const
Write dictionary.
Definition: engineValve.C:237
Class to create, store and output qgraph files.
Definition: graph.H:58
scalar diameter() const
Return valve diameter.
Definition: engineValve.H:200
const polyPatchID & curtainInCylinderPatchID() const
Return ID of curtain in cylinder patch.
Definition: engineValve.H:227
dynamicFvMesh & mesh
scalar curVelocity() const
Return valve velocity for current time-step.
Definition: engineValve.C:200
A class for handling words, derived from string.
Definition: word.H:59
const polyPatchID & detachInCylinderPatchID() const
Return ID of detach in cylinder patch.
Definition: engineValve.H:240
const polyPatchID & detachInPortPatchID() const
Return ID of detach in port patch.
Definition: engineValve.H:246
const polyPatchID & stemPatchID() const
Return ID of stem patch.
Definition: engineValve.H:221
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Foam::engineValve.
Definition: engineValve.H:55
scalar curLift() const
Return current lift.
Definition: engineValve.C:190
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
Definition: engineValve.C:173
const polyPatchID & bottomPatchID() const
Return ID of bottom patch.
Definition: engineValve.H:209
const word & name() const
Return name.
Definition: engineValve.H:182
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const coordinateSystem & cs() const
Return coordinate system.
Definition: engineValve.H:188
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
Definition: engineValve.C:214
scalar minTopLayer() const
Definition: engineValve.H:260
Namespace for OpenFOAM.