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/>.
32 \*---------------------------------------------------------------------------*/
34 #ifndef dieselEngineValve_H
35 #define dieselEngineValve_H
38 #include "coordinateSystem.H"
39 #include "polyPatchID.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Class forward declarations
51 /*---------------------------------------------------------------------------*\
52 Class dieselEngineValve Declaration
53 \*---------------------------------------------------------------------------*/
55 class dieselEngineValve
62 //- Reference to engine mesh
63 const polyMesh& mesh_;
65 //- Reference to engine database
66 const engineTime& engineDB_;
69 autoPtr<coordinateSystem> csPtr_;
72 // Patch and zone names
74 //- Valve bottom patch
75 polyPatchID bottomPatch_;
77 //- Valve poppet patch
78 polyPatchID poppetPatch_;
80 //- Valve poppet patch
81 polyPatchID sidePatch_;
84 polyPatchID stemPatch_;
86 //- Valve curtain manifold patch
87 polyPatchID downInPortPatch_;
89 //- Valve curtain cylinder patch
90 polyPatchID downInCylinderPatch_;
92 //- Valve curtain manifold patch
93 polyPatchID upInPortPatch_;
95 //- Valve curtain cylinder patch
96 polyPatchID upInCylinderPatch_;
98 //- Valve detach in cylinder patch
99 polyPatchID detachInCylinderPatch_;
101 //- Valve detach in port patch
102 polyPatchID detachInPortPatch_;
105 labelList detachFaces_;
112 //- Valve lift profile
115 //- Lift curve start angle
116 scalar liftProfileStart_;
118 //- Lift curve end angle
119 scalar liftProfileEnd_;
121 //- Minimum valve lift. On this lift the valve is considered closed
122 const scalar minLift_;
126 const scalar diameter_;
130 // Private Member Functions
132 //- Disallow default bitwise copy construct
133 dieselEngineValve(const dieselEngineValve&);
135 //- Disallow default bitwise assignment
136 void operator=(const dieselEngineValve&);
139 //- Adjust crank angle to drop within the limits of the lift profile
140 scalar adjustCrankAngle(const scalar theta) const;
144 // Static data members
149 //- Construct from components
153 const polyMesh& mesh,
154 const autoPtr<coordinateSystem>& valveCS,
155 const word& bottomPatchName,
156 const word& poppetPatchName,
157 const word& sidePatchName,
158 const word& stemPatchName,
159 const word& downInPortPatchName,
160 const word& downInCylinderPatchName,
161 const word& upInPortPatchName,
162 const word& upInCylinderPatchName,
163 const word& detachInCylinderPatchName,
164 const word& detachInPortPatchName,
165 const labelList& detachFaces,
166 const scalar& detachTol,
167 const graph& liftProfile,
168 const scalar minLift,
169 const scalar diameter
173 //- Construct from dictionary
177 const polyMesh& mesh,
178 const dictionary& dict
182 // Destructor - default
188 const word& name() const
193 //- Return coordinate system
194 const coordinateSystem& cs() const
199 //- Return lift profile
200 const graph& liftProfile() const
205 //- Return valve diameter
206 scalar diameter() const
214 //- Return ID of bottom patch
215 const polyPatchID& bottomPatchID() const
220 //- Return ID of poppet patch
221 const polyPatchID& poppetPatchID() const
226 //- Return ID of side patch
227 const polyPatchID& sidePatchID() const
232 //- Return ID of stem patch
233 const polyPatchID& stemPatchID() const
238 //- Return ID of down surface in cylinder patch
239 const polyPatchID& downInCylinderPatchID() const
241 return downInCylinderPatch_;
244 //- Return ID of down surface in port patch
245 const polyPatchID& downInPortPatchID() const
247 return downInPortPatch_;
250 //- Return ID of up surface in cylinder patch
251 const polyPatchID& upInCylinderPatchID() const
253 return upInCylinderPatch_;
256 //- Return ID of up surface in port patch
257 const polyPatchID& upInPortPatchID() const
259 return upInPortPatch_;
262 //- Return ID of detach in cylinder patch
263 const polyPatchID& detachInCylinderPatchID() const
265 return detachInCylinderPatch_;
268 //- Return ID of detach in port patch
269 const polyPatchID& detachInPortPatchID() const
271 return detachInPortPatch_;
274 //- Return face labels of detach curtain
275 const labelList& detachFaces() const
280 //- Return face labels of detach curtain
281 const scalar& detachTol() const
286 // Valve position and velocity
288 //- Return valve lift given crank angle in degrees
289 scalar lift(const scalar theta) const;
291 //- Is the valve open?
294 //- Return current lift
295 scalar curLift() const;
297 //- Return valve velocity for current time-step
298 scalar curVelocity() const;
300 //- Return list of active patch labels for the valve head
301 // (stem is excluded)
302 labelList movingPatchIDs() const;
306 void writeDict(Ostream&) const;
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 } // End namespace Foam
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 // ************************************************************************* //