Merge commit 'd3b269b7c6ffa0cd68845adfecdfb849316dba71' into nextRelease
[foam-extend-3.2.git] / src / engine / thoboisValve / thoboisValve.H
blob97a3012b3ae56c6827965eb19772612d79429a4f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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/>.
24 Class
25     thoboisValve
27 Description
29 SourceFiles
30     thoboisValve.C
32 \*---------------------------------------------------------------------------*/
34 #ifndef thoboisValve_H
35 #define thoboisValve_H
37 #include "word.H"
38 #include "coordinateSystem.H"
39 #include "polyPatchID.H"
40 #include "graph.H"
42 #include "faceSet.H"
43 #include "pointSet.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 // Class forward declarations
50 class polyMesh;
51 class engineTime;
53 /*---------------------------------------------------------------------------*\
54                           Class thoboisValve Declaration
55 \*---------------------------------------------------------------------------*/
57 class thoboisValve
59     // Private data
61         //- Name of valve
62         word name_;
64         //- Reference to engine mesh
65         const polyMesh& mesh_;
67         //- Reference to engine database
68         const engineTime& engineDB_;
70         //- Coordinate system
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_;
85             //- Valve stem patch
86             polyPatchID stemPatch_;
88             //- Valve detach in cylinder patch
89             polyPatchID detachInCylinderPatch_;
91             //- Valve detach in port patch
92             polyPatchID detachInPortPatch_;
94             //- Faces to detach
95             //labelList detachFaces_;
96             word detachFacesName_;
98         // Valve lift data
100             //- Valve lift profile
101             graph liftProfile_;
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_;
112             //- Valve diameter
113             const scalar diameter_;
115         // Mesh motion data
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;
145 public:
147     // Static data members
150     // Constructors
152         //- Construct from components
153         thoboisValve
154         (
155             const word& name,
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
173         );
175         //- Construct from dictionary
176         thoboisValve
177         (
178             const word& name,
179             const polyMesh& mesh,
180             const dictionary& dict
181         );
184     // Destructor - default
187     // Member Functions
189         //- Return name
190         const word& name() const
191         {
192             return name_;
193         }
195         //- Return coordinate system
196         const coordinateSystem& cs() const
197         {
198             return csPtr_();
199         }
201         //- Return lift profile
202         const graph& liftProfile() const
203         {
204             return liftProfile_;
205         }
207         //- Return valve diameter
208         scalar diameter() const
209         {
210             return diameter_;
211         }
214         // Valve patches
216             //- Return ID of bottom patch
217             const polyPatchID& bottomPatchID() const
218             {
219                 return bottomPatch_;
220             }
222             //- Return ID of poppet patch
223             const polyPatchID& poppetPatchID() const
224             {
225                 return poppetPatch_;
226             }
228             //- Return ID of side patch
229             const polyPatchID& sidePatchID() const
230             {
231                 return sidePatch_;
232             }
234             //- Return ID of stem patch
235             const polyPatchID& stemPatchID() const
236             {
237                 return stemPatch_;
238             }
240             //- Return ID of detach in cylinder patch
241             const polyPatchID& detachInCylinderPatchID() const
242             {
243                 return detachInCylinderPatch_;
244             }
246             //- Return ID of detach in port patch
247             const polyPatchID& detachInPortPatchID() const
248             {
249                 return detachInPortPatch_;
250             }
252             //- Return face labels of detach curtain
253             const word& detachFacesName() const
254             {
255                 return detachFacesName_;
256             }
258             const word& staticPointsName() const
259             {
260                 return staticPointsName_;
261             }
263             const word& movingPointsName() const
264             {
265                 return movingPointsName_;
266             }
268             const word& movingInternalPointsName() const
269             {
270                 return movingInternalPointsName_;
271             }
273             const word& staticCellsName() const
274             {
275                 return staticCellsName_;
276             }
278             const word& movingCellsName() const
279             {
280                 return movingCellsName_;
281             }
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?
289             bool isOpen() const;
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;
302         //- Write dictionary
303         void writeDict(Ostream&) const;
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309 } // End namespace Foam
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 #endif
315 // ************************************************************************* //