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 accordionValve_H
35 #define accordionValve_H
38 #include "coordinateSystem.H"
39 #include "polyPatchID.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Class forward declarations
53 /*---------------------------------------------------------------------------*\
54 Class accordionValve 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 cellSet for the static cells
118 word staticCellsName_;
120 //- Name of the cellSet for the moving cells
121 word movingCellsName_;
123 // Private Member Functions
125 //- Disallow default bitwise copy construct
126 accordionValve(const accordionValve&);
128 //- Disallow default bitwise assignment
129 void operator=(const accordionValve&);
132 //- Adjust crank angle to drop within the limits of the lift profile
133 scalar adjustCrankAngle(const scalar theta) const;
137 // Static data members
141 //- Construct from components
145 const polyMesh& mesh,
146 const autoPtr<coordinateSystem>& valveCS,
147 const word& bottomPatchName,
148 const word& poppetPatchName,
149 const word& sidePatchName,
150 const word& stemPatchName,
151 const word& detachInCylinderPatchName,
152 const word& detachInPortPatchName,
153 const word& detachFacesName,
154 const graph& liftProfile,
155 const scalar minLift,
156 const scalar diameter,
157 const word& staticCellsName,
158 const word& movingCellsName
161 //- Construct from dictionary
165 const polyMesh& mesh,
166 const dictionary& dict
169 // Destructor - default
175 const word& name() const
180 //- Return coordinate system
181 const coordinateSystem& cs() const
186 //- Return lift profile
187 const graph& liftProfile() const
192 //- Return valve diameter
193 scalar diameter() const
200 //- Return ID of bottom patch
201 const polyPatchID& bottomPatchID() const
206 //- Return ID of poppet patch
207 const polyPatchID& poppetPatchID() const
212 //- Return ID of side patch
213 const polyPatchID& sidePatchID() const
218 //- Return ID of stem patch
219 const polyPatchID& stemPatchID() const
224 //- Return ID of detach in cylinder patch
225 const polyPatchID& detachInCylinderPatchID() const
227 return detachInCylinderPatch_;
230 //- Return ID of detach in port patch
231 const polyPatchID& detachInPortPatchID() const
233 return detachInPortPatch_;
236 //- Return face labels of detach curtain
237 const word& detachFacesName() const
239 return detachFacesName_;
242 const word& staticCellsName() const
244 return staticCellsName_;
247 const word& movingCellsName() const
249 return movingCellsName_;
252 // Valve position and velocity
254 //- Return valve lift given crank angle in degrees
255 scalar lift(const scalar theta) const;
257 //- Is the valve open?
260 //- Return current lift
261 scalar curLift() const;
263 //- Return valve velocity for current time-step
264 scalar curVelocity() const;
266 //- Return list of active patch labels for the valve head
267 // (stem is excluded)
268 labelList movingPatchIDs() const;
271 void writeDict(Ostream&) const;
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 } // End namespace Foam
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 // ************************************************************************* //