5926e87f10c413a502cf0a88fce804680d1f112f
[OpenFOAM-1.5.x.git] / src / finiteVolume / cfdTools / general / MRF / MRFZone.H
blob5926e87f10c413a502cf0a88fce804680d1f112f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 optional face 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         //- label of face zone with faces on outside of cell zone.
78         label faceZoneID_;
80         //- Do patches move with frame (true) or are explicitly provided (false,
81         //  old behaviour)
82         Switch allPatchesMove_;
84         const wordList patchNames_;
85         labelList patchLabels_;
87         //- Internal faces that are part of MRF
88         labelList internalFaces_;
90         //- Outside faces (per patch) that move with the MRF
91         labelListList includedFaces_;
93         //- Excluded faces (per patch) that do not move with the MRF
94         labelListList excludedFaces_;
96         const dimensionedVector origin_;
97         dimensionedVector axis_;
98         const dimensionedScalar omega_;
99         dimensionedVector Omega_;
102     // Private Member Functions
104         //- Divide faces in frame according to patch
105         void setMRFFaces
106         (
107             labelList& faceType,
108             const labelList& excludedPatchIDs
109         );
111         //- Divide faces in frame according to patch
112         void setMRFFaces();
115         //- Disallow default bitwise copy construct
116         MRFZone(const MRFZone&);
118         //- Disallow default bitwise assignment
119         void operator=(const MRFZone&);
122 public:
124     // Constructors
126         //- Construct from fvMesh and Istream
127         MRFZone(const fvMesh& mesh, Istream& is);
129         //- Return clone
130         autoPtr<MRFZone> clone() const
131         {
132             notImplemented("autoPtr<MRFZone> clone() const");
133             return autoPtr<MRFZone>(NULL);
134         }
136         //- Return a pointer to a new MRFZone created on freestore
137         //  from Istream
138         class iNew
139         {
140             const fvMesh& mesh_;
142         public:
144             iNew(const fvMesh& mesh)
145             :
146                 mesh_(mesh)
147             {}
149             autoPtr<MRFZone> operator()(Istream& is) const
150             {
151                 return autoPtr<MRFZone>(new MRFZone(mesh_, is));
152             }
153         };
156     // Member Functions
158         //- Update the mesh corresponding to given map
159         void updateMesh(const mapPolyMesh& mpm)
160         {
161             // Only updates face addressing
162             setMRFFaces();
163         }
165         //- Add the Coriolis force contribution to the momentum equation
166         void addCoriolis(fvVectorMatrix& UEqn) const;
168         //- Make the given absolute flux relative within the MRF region
169         void relativeFlux(surfaceScalarField& phi) const;
171         //- Correct the boundary velocity for the roation of the MRF region
172         void correctBoundaryVelocity(volVectorField& U) const;
175     // Ostream Operator
177         friend Ostream& operator<<(Ostream& os, const MRFZone&)
178         {
179             notImplemented("Ostream& operator<<(Ostream& os, const MRFZone&)");
180             return os;
181         }
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 } // End namespace Foam
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 #endif
193 // ************************************************************************* //