Better bounding on topo change
[foam-extend-3.2.git] / src / engine / engineValve / engineValve.H
blobd8e38c810d4ce568e071ab4971df032a844d30d1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
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     Foam::engineValve
27 Description
28     Foam::engineValve
30 SourceFiles
31     engineValve.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef engineValve_H
36 #define engineValve_H
38 #include "word.H"
39 #include "coordinateSystem.H"
40 #include "polyPatchID.H"
41 #include "graph.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 // Forward declaration of classes
49 class polyMesh;
50 class engineTime;
52 /*---------------------------------------------------------------------------*\
53                           Class engineValve Declaration
54 \*---------------------------------------------------------------------------*/
56 class engineValve
58     // Private data
60         //- Name of valve
61         word name_;
63         //- Reference to engine mesh
64         const polyMesh& mesh_;
66         //- Reference to engine database
67         const engineTime& engineDB_;
69         //- Coordinate system
70         autoPtr<coordinateSystem> csPtr_;
73         // Patch and zone names
75             //- Valve bottom patch
76             polyPatchID bottomPatch_;
78             //- Valve poppet patch
79             polyPatchID poppetPatch_;
81             //- Valve stem patch
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_;
96             //- Faces to detach
97             labelList detachFaces_;
100         // Valve lift data
102             //- Valve lift profile
103             graph liftProfile_;
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_;
130             //- Valve diameter
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;
146 public:
148     // Static data members
151     // Constructors
153         //- Construct from components
154         engineValve
155         (
156             const word& name,
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
175         );
177         //- Construct from dictionary
178         engineValve
179         (
180             const word& name,
181             const polyMesh& mesh,
182             const dictionary& dict
183         );
186     // Destructor - default
189     // Member Functions
191         //- Return name
192         const word& name() const
193         {
194             return name_;
195         }
197         //- Return coordinate system
198         const coordinateSystem& cs() const
199         {
200             return csPtr_();
201         }
203         //- Return lift profile
204         const graph& liftProfile() const
205         {
206             return liftProfile_;
207         }
209         //- Return valve diameter
210         scalar diameter() const
211         {
212             return diameter_;
213         }
216         // Valve patches
218             //- Return ID of bottom patch
219             const polyPatchID& bottomPatchID() const
220             {
221                 return bottomPatch_;
222             }
224             //- Return ID of poppet patch
225             const polyPatchID& poppetPatchID() const
226             {
227                 return poppetPatch_;
228             }
230             //- Return ID of stem patch
231             const polyPatchID& stemPatchID() const
232             {
233                 return stemPatch_;
234             }
236             //- Return ID of curtain in cylinder patch
237             const polyPatchID& curtainInCylinderPatchID() const
238             {
239                 return curtainInCylinderPatch_;
240             }
242             //- Return ID of curtain in port patch
243             const polyPatchID& curtainInPortPatchID() const
244             {
245                 return curtainInPortPatch_;
246             }
249             //- Return ID of detach in cylinder patch
250             const polyPatchID& detachInCylinderPatchID() const
251             {
252                 return detachInCylinderPatch_;
253             }
255             //- Return ID of detach in port patch
256             const polyPatchID& detachInPortPatchID() const
257             {
258                 return detachInPortPatch_;
259             }
261             //- Return face labels of detach curtain
262             const labelList& detachFaces() const
263             {
264                 return detachFaces_;
265             }
268         // Valve layering thickness
270             scalar minTopLayer() const
271             {
272                 return minTopLayer_;
273             }
275             scalar maxTopLayer() const
276             {
277                 return maxTopLayer_;
278             }
280             scalar minBottomLayer() const
281             {
282                 return minBottomLayer_;
283             }
285             scalar maxBottomLayer() const
286             {
287                 return maxBottomLayer_;
288             }
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?
297             bool isOpen() const;
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;
310         //- Write dictionary
311         void writeDict(Ostream&) const;
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 } // End namespace Foam
319 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
321 #endif
323 // ************************************************************************* //