FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

engineValve.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::engineValve
00026 
00027 Description
00028     Foam::engineValve
00029 
00030 SourceFiles
00031     engineValve.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef engineValve_H
00036 #define engineValve_H
00037 
00038 #include <OpenFOAM/word.H>
00039 #include <meshTools/coordinateSystem.H>
00040 #include <OpenFOAM/polyPatchID.H>
00041 #include <OpenFOAM/graph.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 // Forward declaration of classes
00049 class polyMesh;
00050 class engineTime;
00051 
00052 /*---------------------------------------------------------------------------*\
00053                           Class engineValve Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 class engineValve
00057 {
00058     // Private data
00059 
00060         //- Name of valve
00061         word name_;
00062 
00063         //- Reference to engine mesh
00064         const polyMesh& mesh_;
00065 
00066         //- Reference to engine database
00067         const engineTime& engineDB_;
00068 
00069         //- Coordinate system
00070         autoPtr<coordinateSystem> csPtr_;
00071 
00072 
00073         // Patch and zone names
00074 
00075             //- Valve bottom patch
00076             polyPatchID bottomPatch_;
00077 
00078             //- Valve poppet patch
00079             polyPatchID poppetPatch_;
00080 
00081             //- Valve stem patch
00082             polyPatchID stemPatch_;
00083 
00084             //- Valve curtain manifold patch
00085             polyPatchID curtainInPortPatch_;
00086 
00087             //- Valve curtain cylinder patch
00088             polyPatchID curtainInCylinderPatch_;
00089 
00090             //- Valve detach in cylinder patch
00091             polyPatchID detachInCylinderPatch_;
00092 
00093             //- Valve detach in port patch
00094             polyPatchID detachInPortPatch_;
00095 
00096             //- Faces to detach
00097             labelList detachFaces_;
00098 
00099 
00100         // Valve lift data
00101 
00102             //- Valve lift profile
00103             graph liftProfile_;
00104 
00105             //- Lift curve start angle
00106             scalar liftProfileStart_;
00107 
00108             //- Lift curve end angle
00109             scalar liftProfileEnd_;
00110 
00111             //- Minimum valve lift.  On this lift the valve is considered closed
00112             const scalar minLift_;
00113 
00114 
00115             // Valve layering data
00116 
00117                 //- Min top layer thickness
00118                 const scalar minTopLayer_;
00119 
00120                 //- Max top layer thickness
00121                 const scalar maxTopLayer_;
00122 
00123                 //- Min bottom layer thickness
00124                 const scalar minBottomLayer_;
00125 
00126                 //- Max bottom layer thickness
00127                 const scalar maxBottomLayer_;
00128 
00129 
00130             //- Valve diameter
00131             const scalar diameter_;
00132 
00133 
00134     // Private Member Functions
00135 
00136         //- Disallow default bitwise copy construct
00137         engineValve(const engineValve&);
00138 
00139         //- Disallow default bitwise assignment
00140         void operator=(const engineValve&);
00141 
00142 
00143         //- Adjust crank angle to drop within the limits of the lift profile
00144         scalar adjustCrankAngle(const scalar theta) const;
00145 
00146 public:
00147 
00148     // Static data members
00149 
00150 
00151     // Constructors
00152 
00153         //- Construct from components
00154         engineValve
00155         (
00156             const word& name,
00157             const polyMesh& mesh,
00158             const autoPtr<coordinateSystem>& valveCS,
00159             const word& bottomPatchName,
00160             const word& poppetPatchName,
00161             const word& stemPatchName,
00162             const word& curtainInPortPatchName,
00163             const word& curtainInCylinderPatchName,
00164             const word& detachInCylinderPatchName,
00165             const word& detachInPortPatchName,
00166             const labelList& detachFaces,
00167             const graph& liftProfile,
00168             const scalar minLift,
00169             const scalar minTopLayer,
00170             const scalar maxTopLayer,
00171             const scalar minBottomLayer,
00172             const scalar maxBottomLayer,
00173             const scalar diameter
00174 
00175         );
00176 
00177         //- Construct from dictionary
00178         engineValve
00179         (
00180             const word& name,
00181             const polyMesh& mesh,
00182             const dictionary& dict
00183         );
00184 
00185 
00186     // Destructor - default
00187 
00188 
00189     // Member Functions
00190 
00191         //- Return name
00192         const word& name() const
00193         {
00194             return name_;
00195         }
00196 
00197         //- Return coordinate system
00198         const coordinateSystem& cs() const
00199         {
00200             return csPtr_();
00201         }
00202 
00203         //- Return lift profile
00204         const graph& liftProfile() const
00205         {
00206             return liftProfile_;
00207         }
00208 
00209         //- Return valve diameter
00210         scalar diameter() const
00211         {
00212             return diameter_;
00213         }
00214 
00215 
00216         // Valve patches
00217 
00218             //- Return ID of bottom patch
00219             const polyPatchID& bottomPatchID() const
00220             {
00221                 return bottomPatch_;
00222             }
00223 
00224             //- Return ID of poppet patch
00225             const polyPatchID& poppetPatchID() const
00226             {
00227                 return poppetPatch_;
00228             }
00229 
00230             //- Return ID of stem patch
00231             const polyPatchID& stemPatchID() const
00232             {
00233                 return stemPatch_;
00234             }
00235 
00236             //- Return ID of curtain in cylinder patch
00237             const polyPatchID& curtainInCylinderPatchID() const
00238             {
00239                 return curtainInCylinderPatch_;
00240             }
00241 
00242             //- Return ID of curtain in port patch
00243             const polyPatchID& curtainInPortPatchID() const
00244             {
00245                 return curtainInPortPatch_;
00246             }
00247 
00248 
00249             //- Return ID of detach in cylinder patch
00250             const polyPatchID& detachInCylinderPatchID() const
00251             {
00252                 return detachInCylinderPatch_;
00253             }
00254 
00255             //- Return ID of detach in port patch
00256             const polyPatchID& detachInPortPatchID() const
00257             {
00258                 return detachInPortPatch_;
00259             }
00260 
00261             //- Return face labels of detach curtain
00262             const labelList& detachFaces() const
00263             {
00264                 return detachFaces_;
00265             }
00266 
00267 
00268         // Valve layering thickness
00269 
00270             scalar minTopLayer() const
00271             {
00272                 return minTopLayer_;
00273             }
00274 
00275             scalar maxTopLayer() const
00276             {
00277                 return maxTopLayer_;
00278             }
00279 
00280             scalar minBottomLayer() const
00281             {
00282                 return minBottomLayer_;
00283             }
00284 
00285             scalar maxBottomLayer() const
00286             {
00287                 return maxBottomLayer_;
00288             }
00289 
00290 
00291         // Valve position and velocity
00292 
00293             //- Return valve lift given crank angle in degrees
00294             scalar lift(const scalar theta) const;
00295 
00296             //- Is the valve open?
00297             bool isOpen() const;
00298 
00299             //- Return current lift
00300             scalar curLift() const;
00301 
00302             //- Return valve velocity for current time-step
00303             scalar curVelocity() const;
00304 
00305             //- Return list of active patch labels for the valve head
00306             //  (stem is excluded)
00307             labelList movingPatchIDs() const;
00308 
00309 
00310         //- Write dictionary
00311         void writeDict(Ostream&) const;
00312 };
00313 
00314 
00315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00316 
00317 } // End namespace Foam
00318 
00319 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00320 
00321 #endif
00322 
00323 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines