OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

MRFZone.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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::MRFZone
00027 
00028 Description
00029     MRF zone definition based on cell zone and parameters
00030     obtained from a control dictionary constructed from the given stream.
00031 
00032     The rotation of the MRF region is defined by an origin and axis of
00033     rotation and an angular speed.
00034 
00035 SourceFiles
00036     MRFZone.C
00037 
00038 \*---------------------------------------------------------------------------*/
00039 
00040 #ifndef MRFZone_H
00041 #define MRFZone_H
00042 
00043 #include "dictionary.H"
00044 #include "wordList.H"
00045 #include "labelList.H"
00046 #include "dimensionedScalar.H"
00047 #include "dimensionedVector.H"
00048 #include "volFieldsFwd.H"
00049 #include "surfaceFieldsFwd.H"
00050 #include "fvMatricesFwd.H"
00051 #include "fvMatrices.H"
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 // Forward declaration of classes
00059 class fvMesh;
00060 
00061 /*---------------------------------------------------------------------------*\
00062                            Class MRFZone Declaration
00063 \*---------------------------------------------------------------------------*/
00064 
00065 class MRFZone
00066 {
00067     // Private data
00068 
00069         const fvMesh& mesh_;
00070 
00071         const word name_;
00072 
00073         const dictionary dict_;
00074 
00075         label cellZoneID_;
00076 
00077         const wordList excludedPatchNames_;
00078         labelList excludedPatchLabels_;
00079 
00080         //- Internal faces that are part of MRF
00081         labelList internalFaces_;
00082 
00083         //- Outside faces (per patch) that move with the MRF
00084         labelListList includedFaces_;
00085 
00086         //- Excluded faces (per patch) that do not move with the MRF
00087         labelListList excludedFaces_;
00088 
00089         const dimensionedVector origin_;
00090         dimensionedVector axis_;
00091         const dimensionedScalar omega_;
00092         dimensionedVector Omega_;
00093 
00094 
00095     // Private Member Functions
00096 
00097         //- Divide faces in frame according to patch
00098         void setMRFFaces();
00099 
00100         //- Disallow default bitwise copy construct
00101         MRFZone(const MRFZone&);
00102 
00103         //- Disallow default bitwise assignment
00104         void operator=(const MRFZone&);
00105 
00106 
00107 public:
00108 
00109     // Declare name of the class and its debug switch
00110     ClassName("MRFZone");
00111 
00112 
00113     // Constructors
00114 
00115         //- Construct from fvMesh and Istream
00116         MRFZone(const fvMesh& mesh, Istream& is);
00117 
00118         //- Return clone
00119         autoPtr<MRFZone> clone() const
00120         {
00121             notImplemented("autoPtr<MRFZone> clone() const");
00122             return autoPtr<MRFZone>(NULL);
00123         }
00124 
00125         //- Return a pointer to a new MRFZone created on freestore
00126         //  from Istream
00127         class iNew
00128         {
00129             const fvMesh& mesh_;
00130 
00131         public:
00132 
00133             iNew(const fvMesh& mesh)
00134             :
00135                 mesh_(mesh)
00136             {}
00137 
00138             autoPtr<MRFZone> operator()(Istream& is) const
00139             {
00140                 return autoPtr<MRFZone>(new MRFZone(mesh_, is));
00141             }
00142         };
00143 
00144 
00145     // Member Functions
00146 
00147         //- Update the mesh corresponding to given map
00148         void updateMesh(const mapPolyMesh& mpm)
00149         {
00150             // Only updates face addressing
00151             setMRFFaces();
00152         }
00153 
00154         //- Add the Coriolis force contribution to the momentum equation
00155         void addCoriolis(fvVectorMatrix& UEqn) const;
00156 
00157         //- Add the Coriolis force contribution to the momentum equation
00158         void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const;
00159 
00160         //- Make the given absolute velocity relative within the MRF region
00161         void relativeVelocity(volVectorField& U) const;
00162 
00163         //- Make the given absolute flux relative within the MRF region
00164         void relativeFlux(surfaceScalarField& phi) const;
00165 
00166         //- Make the given relative flux absolute within the MRF region
00167         void absoluteFlux(surfaceScalarField& phi) const;
00168 
00169         //- Correct the boundary velocity for the roation of the MRF region
00170         void correctBoundaryVelocity(volVectorField& U) const;
00171 
00172 
00173     // Ostream Operator
00174 
00175         friend Ostream& operator<<(Ostream& os, const MRFZone&)
00176         {
00177             notImplemented("Ostream& operator<<(Ostream& os, const MRFZone&)");
00178             return os;
00179         }
00180 };
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 } // End namespace Foam
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 #endif
00190 
00191 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd