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