initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / cfdTools / general / MRF / MRFZone.H
blobd5554a5b0810ea1fab45d5474df22397db3390d7
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM 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 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::MRFZone
28 Description
29     MRF zone definition based on cell zone and parameters
30     obtained from a control dictionary constructed from the given stream.
32     The rotation of the MRF region is defined by an origin and axis of
33     rotation and an angular speed.
35 SourceFiles
36     MRFZone.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef MRFZone_H
41 #define MRFZone_H
43 #include "dictionary.H"
44 #include "wordList.H"
45 #include "labelList.H"
46 #include "dimensionedScalar.H"
47 #include "dimensionedVector.H"
48 #include "volFieldsFwd.H"
49 #include "surfaceFieldsFwd.H"
50 #include "fvMatricesFwd.H"
51 #include "fvMatrices.H"
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 namespace Foam
58 // Forward declaration of classes
59 class fvMesh;
61 /*---------------------------------------------------------------------------*\
62                            Class MRFZone Declaration
63 \*---------------------------------------------------------------------------*/
65 class MRFZone
67     // Private data
69         const fvMesh& mesh_;
71         const word name_;
73         const dictionary dict_;
75         label cellZoneID_;
77         const wordList excludedPatchNames_;
78         labelList excludedPatchLabels_;
80         //- Internal faces that are part of MRF
81         labelList internalFaces_;
83         //- Outside faces (per patch) that move with the MRF
84         labelListList includedFaces_;
86         //- Excluded faces (per patch) that do not move with the MRF
87         labelListList excludedFaces_;
89         const dimensionedVector origin_;
90         dimensionedVector axis_;
91         const dimensionedScalar omega_;
92         dimensionedVector Omega_;
95     // Private Member Functions
97         //- Divide faces in frame according to patch
98         void setMRFFaces();
100         //- Disallow default bitwise copy construct
101         MRFZone(const MRFZone&);
103         //- Disallow default bitwise assignment
104         void operator=(const MRFZone&);
107 public:
109     // Declare name of the class and its debug switch
110     ClassName("MRFZone");
113     // Constructors
115         //- Construct from fvMesh and Istream
116         MRFZone(const fvMesh& mesh, Istream& is);
118         //- Return clone
119         autoPtr<MRFZone> clone() const
120         {
121             notImplemented("autoPtr<MRFZone> clone() const");
122             return autoPtr<MRFZone>(NULL);
123         }
125         //- Return a pointer to a new MRFZone created on freestore
126         //  from Istream
127         class iNew
128         {
129             const fvMesh& mesh_;
131         public:
133             iNew(const fvMesh& mesh)
134             :
135                 mesh_(mesh)
136             {}
138             autoPtr<MRFZone> operator()(Istream& is) const
139             {
140                 return autoPtr<MRFZone>(new MRFZone(mesh_, is));
141             }
142         };
145     // Member Functions
147         //- Update the mesh corresponding to given map
148         void updateMesh(const mapPolyMesh& mpm)
149         {
150             // Only updates face addressing
151             setMRFFaces();
152         }
154         //- Add the Coriolis force contribution to the momentum equation
155         void addCoriolis(fvVectorMatrix& UEqn) const;
157         //- Add the Coriolis force contribution to the momentum equation
158         void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const;
160         //- Make the given absolute velocity relative within the MRF region
161         void relativeVelocity(volVectorField& U) const;
163         //- Make the given absolute flux relative within the MRF region
164         void relativeFlux(surfaceScalarField& phi) const;
166         //- Make the given relative flux absolute within the MRF region
167         void absoluteFlux(surfaceScalarField& phi) const;
169         //- Correct the boundary velocity for the roation of the MRF region
170         void correctBoundaryVelocity(volVectorField& U) const;
173     // Ostream Operator
175         friend Ostream& operator<<(Ostream& os, const MRFZone&)
176         {
177             notImplemented("Ostream& operator<<(Ostream& os, const MRFZone&)");
178             return os;
179         }
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 #endif
191 // ************************************************************************* //