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-2021 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 "fvMeshMoversEngine.H"
39 #include "coordinateSystem.H"
40 #include "polyPatchID.H"
41 #include "Table.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class engineValve Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class engineValve
53 {
54  // Private Data
55 
56  //- Name of valve
57  word name_;
58 
59  //- Reference to engine mesh mover
60  const fvMeshMovers::engine& meshMover_;
61 
62  //- Coordinate system
64 
65 
66  // Patch and zone names
67 
68  //- Valve bottom patch
69  polyPatchID bottomPatch_;
70 
71  //- Valve poppet patch
72  polyPatchID poppetPatch_;
73 
74  //- Valve stem patch
75  polyPatchID stemPatch_;
76 
77  //- Valve curtain manifold patch
78  polyPatchID curtainInPortPatch_;
79 
80  //- Valve curtain cylinder patch
81  polyPatchID curtainInCylinderPatch_;
82 
83  //- Valve detach in cylinder patch
84  polyPatchID detachInCylinderPatch_;
85 
86  //- Valve detach in port patch
87  polyPatchID detachInPortPatch_;
88 
89  //- Faces to detach
90  labelList detachFaces_;
91 
92 
93  // Valve lift data
94 
95  //- Valve lift profile
96  Function1s::Table<scalar> liftProfile_;
97 
98  //- Lift curve start angle
99  scalar liftProfileStart_;
100 
101  //- Lift curve end angle
102  scalar liftProfileEnd_;
103 
104  //- Minimum valve lift. On this lift the valve is considered closed
105  const scalar minLift_;
106 
107 
108  // Valve layering data
109 
110  //- Min top layer thickness
111  const scalar minTopLayer_;
112 
113  //- Max top layer thickness
114  const scalar maxTopLayer_;
115 
116  //- Min bottom layer thickness
117  const scalar minBottomLayer_;
118 
119  //- Max bottom layer thickness
120  const scalar maxBottomLayer_;
121 
122 
123  //- Valve diameter
124  const scalar diameter_;
125 
126 
127  // Private Member Functions
128 
129  //- Adjust crank angle to drop within the limits of the lift profile
130  scalar adjustCrankAngle(const scalar theta) const;
131 
132 
133 public:
134 
135  // Constructors
136 
137  //- Construct from components
139  (
140  const word& name,
141  const fvMeshMover& meshMover,
142  const autoPtr<coordinateSystem>& valveCS,
143  const word& bottomPatchName,
144  const word& poppetPatchName,
145  const word& stemPatchName,
146  const word& curtainInPortPatchName,
147  const word& curtainInCylinderPatchName,
148  const word& detachInCylinderPatchName,
149  const word& detachInPortPatchName,
150  const labelList& detachFaces,
152  const scalar minLift,
153  const scalar minTopLayer,
154  const scalar maxTopLayer,
155  const scalar minBottomLayer,
156  const scalar maxBottomLayer,
157  const scalar diameter
158 
159  );
160 
161  //- Construct from dictionary
163  (
164  const word& name,
165  const fvMeshMover& meshMover,
166  const dictionary& dict
167  );
168 
169  //- Disallow default bitwise copy construction
170  engineValve(const engineValve&) = delete;
171 
172 
173  // Member Functions
174 
175  //- Return name
176  const word& name() const
177  {
178  return name_;
179  }
180 
181  //- Return coordinate system
182  const coordinateSystem& cs() const
183  {
184  return csPtr_();
185  }
186 
187  //- Return lift profile
189  {
190  return liftProfile_;
191  }
192 
193  //- Return valve diameter
194  scalar diameter() const
195  {
196  return diameter_;
197  }
198 
199 
200  // Valve patches
201 
202  //- Return ID of bottom patch
203  const polyPatchID& bottomPatchID() const
204  {
205  return bottomPatch_;
206  }
207 
208  //- Return ID of poppet patch
209  const polyPatchID& poppetPatchID() const
210  {
211  return poppetPatch_;
212  }
213 
214  //- Return ID of stem patch
215  const polyPatchID& stemPatchID() const
216  {
217  return stemPatch_;
218  }
219 
220  //- Return ID of curtain in cylinder patch
222  {
223  return curtainInCylinderPatch_;
224  }
225 
226  //- Return ID of curtain in port patch
227  const polyPatchID& curtainInPortPatchID() const
228  {
229  return curtainInPortPatch_;
230  }
231 
232 
233  //- Return ID of detach in cylinder patch
234  const polyPatchID& detachInCylinderPatchID() const
235  {
236  return detachInCylinderPatch_;
237  }
238 
239  //- Return ID of detach in port patch
240  const polyPatchID& detachInPortPatchID() const
241  {
242  return detachInPortPatch_;
243  }
244 
245  //- Return face labels of detach curtain
246  const labelList& detachFaces() const
247  {
248  return detachFaces_;
249  }
250 
251 
252  // Valve layering thickness
253 
254  scalar minTopLayer() const
255  {
256  return minTopLayer_;
257  }
258 
259  scalar maxTopLayer() const
260  {
261  return maxTopLayer_;
262  }
263 
264  scalar minBottomLayer() const
265  {
266  return minBottomLayer_;
267  }
268 
269  scalar maxBottomLayer() const
270  {
271  return maxBottomLayer_;
272  }
273 
274 
275  // Valve position and velocity
276 
277  //- Return valve lift given crank angle in degrees
278  scalar lift(const scalar theta) const;
279 
280  //- Is the valve open?
281  bool isOpen() const;
282 
283  //- Return current lift
284  scalar curLift() const;
285 
286  //- Return valve velocity for current time-step
287  scalar curVelocity() const;
288 
289  //- Return list of active patch labels for the valve head
290  // (stem is excluded)
291  labelList movingPatchIDs() const;
292 
293 
294  //- Write dictionary
295  void writeDict(Ostream&) const;
296 
297 
298  // Member Operators
299 
300  //- Disallow default bitwise assignment
301  void operator=(const engineValve&) = delete;
302 };
303 
304 
305 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306 
307 } // End namespace Foam
308 
309 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310 
311 #endif
312 
313 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for other coordinate system specifications.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::engineValve.
Definition: engineValve.H:52
bool isOpen() const
Is the valve open?
Definition: engineValve.C:178
scalar maxTopLayer() const
Definition: engineValve.H:258
engineValve(const word &name, const fvMeshMover &meshMover, 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 Function1s::Table< scalar > &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:64
const Function1s::Table< scalar > & liftProfile() const
Return lift profile.
Definition: engineValve.H:187
const polyPatchID & curtainInCylinderPatchID() const
Return ID of curtain in cylinder patch.
Definition: engineValve.H:220
scalar minBottomLayer() const
Definition: engineValve.H:263
scalar maxBottomLayer() const
Definition: engineValve.H:268
scalar lift(const scalar theta) const
Return valve lift given crank angle in degrees.
Definition: engineValve.C:172
scalar diameter() const
Return valve diameter.
Definition: engineValve.H:193
labelList movingPatchIDs() const
Return list of active patch labels for the valve head.
Definition: engineValve.C:208
const polyPatchID & poppetPatchID() const
Return ID of poppet patch.
Definition: engineValve.H:208
const polyPatchID & stemPatchID() const
Return ID of stem patch.
Definition: engineValve.H:214
const labelList & detachFaces() const
Return face labels of detach curtain.
Definition: engineValve.H:245
scalar curLift() const
Return current lift.
Definition: engineValve.C:184
const polyPatchID & detachInPortPatchID() const
Return ID of detach in port patch.
Definition: engineValve.H:239
scalar minTopLayer() const
Definition: engineValve.H:253
void writeDict(Ostream &) const
Write dictionary.
Definition: engineValve.C:231
const polyPatchID & bottomPatchID() const
Return ID of bottom patch.
Definition: engineValve.H:202
scalar curVelocity() const
Return valve velocity for current time-step.
Definition: engineValve.C:194
void operator=(const engineValve &)=delete
Disallow default bitwise assignment.
const coordinateSystem & cs() const
Return coordinate system.
Definition: engineValve.H:181
const polyPatchID & detachInCylinderPatchID() const
Return ID of detach in cylinder patch.
Definition: engineValve.H:233
const word & name() const
Return name.
Definition: engineValve.H:175
const polyPatchID & curtainInPortPatchID() const
Return ID of curtain in port patch.
Definition: engineValve.H:226
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:53
Basic mesh motion specifically for engines.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict