1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
33 \*---------------------------------------------------------------------------*/
39 #include "coordinateSystem.H"
40 #include "polyPatchID.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of classes
52 /*---------------------------------------------------------------------------*\
53 Class engineValve Declaration
54 \*---------------------------------------------------------------------------*/
63 //- Reference to engine mesh
64 const polyMesh& mesh_;
66 //- Reference to engine database
67 const engineTime& engineDB_;
70 autoPtr<coordinateSystem> csPtr_;
73 // Patch and zone names
75 //- Valve bottom patch
76 polyPatchID bottomPatch_;
78 //- Valve poppet patch
79 polyPatchID poppetPatch_;
82 polyPatchID stemPatch_;
84 //- Valve curtain manifold patch
85 polyPatchID curtainInPortPatch_;
87 //- Valve curtain cylinder patch
88 polyPatchID curtainInCylinderPatch_;
90 //- Valve detach in cylinder patch
91 polyPatchID detachInCylinderPatch_;
93 //- Valve detach in port patch
94 polyPatchID detachInPortPatch_;
97 labelList detachFaces_;
102 //- Valve lift profile
105 //- Lift curve start angle
106 scalar liftProfileStart_;
108 //- Lift curve end angle
109 scalar liftProfileEnd_;
111 //- Minimum valve lift. On this lift the valve is considered closed
112 const scalar minLift_;
115 // Valve layering data
117 //- Min top layer thickness
118 const scalar minTopLayer_;
120 //- Max top layer thickness
121 const scalar maxTopLayer_;
123 //- Min bottom layer thickness
124 const scalar minBottomLayer_;
126 //- Max bottom layer thickness
127 const scalar maxBottomLayer_;
131 const scalar diameter_;
134 // Private Member Functions
136 //- Disallow default bitwise copy construct
137 engineValve(const engineValve&);
139 //- Disallow default bitwise assignment
140 void operator=(const engineValve&);
143 //- Adjust crank angle to drop within the limits of the lift profile
144 scalar adjustCrankAngle(const scalar theta) const;
148 // Static data members
153 //- Construct from components
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
177 //- Construct from dictionary
181 const polyMesh& mesh,
182 const dictionary& dict
186 // Destructor - default
192 const word& name() const
197 //- Return coordinate system
198 const coordinateSystem& cs() const
203 //- Return lift profile
204 const graph& liftProfile() const
209 //- Return valve diameter
210 scalar diameter() const
218 //- Return ID of bottom patch
219 const polyPatchID& bottomPatchID() const
224 //- Return ID of poppet patch
225 const polyPatchID& poppetPatchID() const
230 //- Return ID of stem patch
231 const polyPatchID& stemPatchID() const
236 //- Return ID of curtain in cylinder patch
237 const polyPatchID& curtainInCylinderPatchID() const
239 return curtainInCylinderPatch_;
242 //- Return ID of curtain in port patch
243 const polyPatchID& curtainInPortPatchID() const
245 return curtainInPortPatch_;
249 //- Return ID of detach in cylinder patch
250 const polyPatchID& detachInCylinderPatchID() const
252 return detachInCylinderPatch_;
255 //- Return ID of detach in port patch
256 const polyPatchID& detachInPortPatchID() const
258 return detachInPortPatch_;
261 //- Return face labels of detach curtain
262 const labelList& detachFaces() const
268 // Valve layering thickness
270 scalar minTopLayer() const
275 scalar maxTopLayer() const
280 scalar minBottomLayer() const
282 return minBottomLayer_;
285 scalar maxBottomLayer() const
287 return maxBottomLayer_;
291 // Valve position and velocity
293 //- Return valve lift given crank angle in degrees
294 scalar lift(const scalar theta) const;
296 //- Is the valve open?
299 //- Return current lift
300 scalar curLift() const;
302 //- Return valve velocity for current time-step
303 scalar curVelocity() const;
305 //- Return list of active patch labels for the valve head
306 // (stem is excluded)
307 labelList movingPatchIDs() const;
311 void writeDict(Ostream&) const;
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 } // End namespace Foam
319 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
323 // ************************************************************************* //