1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | 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 thoboisValve_H
35 #define thoboisValve_H
38 #include "coordinateSystem.H"
39 #include "polyPatchID.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Class forward declarations
53 /*---------------------------------------------------------------------------*\
54 Class thoboisValve Declaration
55 \*---------------------------------------------------------------------------*/
64 //- Reference to engine mesh
65 const polyMesh& mesh_;
67 //- Reference to engine database
68 const engineTime& engineDB_;
71 autoPtr<coordinateSystem> csPtr_;
74 // Patch and zone names
76 //- Valve bottom patch
77 polyPatchID bottomPatch_;
79 //- Valve poppet patch
80 polyPatchID poppetPatch_;
82 //- Valve poppet patch
83 polyPatchID sidePatch_;
86 polyPatchID stemPatch_;
88 //- Valve detach in cylinder patch
89 polyPatchID detachInCylinderPatch_;
91 //- Valve detach in port patch
92 polyPatchID detachInPortPatch_;
95 //labelList detachFaces_;
96 word detachFacesName_;
100 //- Valve lift profile
103 //- Lift curve start angle
104 scalar liftProfileStart_;
106 //- Lift curve end angle
107 scalar liftProfileEnd_;
109 //- Minimum valve lift. On this lift the valve is considered closed
110 const scalar minLift_;
113 const scalar diameter_;
117 //- Name of the pointSet for the static points
118 word staticPointsName_;
120 //- Name of the pointSet for the moving points
121 word movingPointsName_;
123 //- Name of the pointSet for the moving internal points
124 word movingInternalPointsName_;
126 //- Name of the cellSet for the static cells
127 word staticCellsName_;
129 //- Name of the cellSet for the moving cells
130 word movingCellsName_;
133 // Private Member Functions
135 //- Disallow default bitwise copy construct
136 thoboisValve(const thoboisValve&);
138 //- Disallow default bitwise assignment
139 void operator=(const thoboisValve&);
142 //- Adjust crank angle to drop within the limits of the lift profile
143 scalar adjustCrankAngle(const scalar theta) const;
147 // Static data members
152 //- Construct from components
156 const polyMesh& mesh,
157 const autoPtr<coordinateSystem>& valveCS,
158 const word& bottomPatchName,
159 const word& poppetPatchName,
160 const word& sidePatchName,
161 const word& stemPatchName,
162 const word& detachInCylinderPatchName,
163 const word& detachInPortPatchName,
164 const word& detachFacesName,
165 const graph& liftProfile,
166 const scalar minLift,
167 const scalar diameter,
168 const word& staticPointsName,
169 const word& movingPointsName,
170 const word& movingInternalPointsName,
171 const word& staticCellsName,
172 const word& movingCellsName
175 //- Construct from dictionary
179 const polyMesh& mesh,
180 const dictionary& dict
184 // Destructor - default
190 const word& name() const
195 //- Return coordinate system
196 const coordinateSystem& cs() const
201 //- Return lift profile
202 const graph& liftProfile() const
207 //- Return valve diameter
208 scalar diameter() const
216 //- Return ID of bottom patch
217 const polyPatchID& bottomPatchID() const
222 //- Return ID of poppet patch
223 const polyPatchID& poppetPatchID() const
228 //- Return ID of side patch
229 const polyPatchID& sidePatchID() const
234 //- Return ID of stem patch
235 const polyPatchID& stemPatchID() const
240 //- Return ID of detach in cylinder patch
241 const polyPatchID& detachInCylinderPatchID() const
243 return detachInCylinderPatch_;
246 //- Return ID of detach in port patch
247 const polyPatchID& detachInPortPatchID() const
249 return detachInPortPatch_;
252 //- Return face labels of detach curtain
253 const word& detachFacesName() const
255 return detachFacesName_;
258 const word& staticPointsName() const
260 return staticPointsName_;
263 const word& movingPointsName() const
265 return movingPointsName_;
268 const word& movingInternalPointsName() const
270 return movingInternalPointsName_;
273 const word& staticCellsName() const
275 return staticCellsName_;
278 const word& movingCellsName() const
280 return movingCellsName_;
283 // Valve position and velocity
285 //- Return valve lift given crank angle in degrees
286 scalar lift(const scalar theta) const;
288 //- Is the valve open?
291 //- Return current lift
292 scalar curLift() const;
294 //- Return valve velocity for current time-step
295 scalar curVelocity() const;
297 //- Return list of active patch labels for the valve head
298 // (stem is excluded)
299 labelList movingPatchIDs() const;
303 void writeDict(Ostream&) const;
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309 } // End namespace Foam
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
315 // ************************************************************************* //