FreeFOAM The Cross-Platform CFD Toolkit
MRFZone.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::MRFZone
26 
27 Description
28  MRF zone definition based on cell zone and parameters
29  obtained from a control dictionary constructed from the given stream.
30 
31  The rotation of the MRF region is defined by an origin and axis of
32  rotation and an angular speed.
33 
34 SourceFiles
35  MRFZone.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef MRFZone_H
40 #define MRFZone_H
41 
42 #include <OpenFOAM/dictionary.H>
43 #include <OpenFOAM/wordList.H>
44 #include <OpenFOAM/labelList.H>
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class fvMesh;
59 
60 /*---------------------------------------------------------------------------*\
61  Class MRFZone Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class MRFZone
65 {
66  // Private data
67 
68  const fvMesh& mesh_;
69 
70  const word name_;
71 
72  const dictionary dict_;
73 
74  label cellZoneID_;
75 
76  const wordList excludedPatchNames_;
77  labelList excludedPatchLabels_;
78 
79  //- Internal faces that are part of MRF
80  labelList internalFaces_;
81 
82  //- Outside faces (per patch) that move with the MRF
83  labelListList includedFaces_;
84 
85  //- Excluded faces (per patch) that do not move with the MRF
86  labelListList excludedFaces_;
87 
88  const dimensionedVector origin_;
89  dimensionedVector axis_;
90  const dimensionedScalar omega_;
91  dimensionedVector Omega_;
92 
93 
94  // Private Member Functions
95 
96  //- Divide faces in frame according to patch
97  void setMRFFaces();
98 
99  //- Make the given absolute mass/vol flux relative within the MRF region
100  template<class RhoFieldType>
101  void relativeRhoFlux
102  (
103  const RhoFieldType& rho,
105  ) const;
106 
107  //- Make the given relative mass/vol flux absolute within the MRF region
108  template<class RhoFieldType>
109  void absoluteRhoFlux
110  (
111  const RhoFieldType& rho,
112  surfaceScalarField& phi
113  ) const;
114 
115  //- Disallow default bitwise copy construct
116  MRFZone(const MRFZone&);
117 
118  //- Disallow default bitwise assignment
119  void operator=(const MRFZone&);
120 
121 
122 public:
123 
124  // Declare name of the class and its debug switch
125  ClassName("MRFZone");
126 
127 
128  // Constructors
129 
130  //- Construct from fvMesh and Istream
131  MRFZone(const fvMesh& mesh, Istream& is);
132 
133  //- Return clone
135  {
136  notImplemented("autoPtr<MRFZone> clone() const");
137  return autoPtr<MRFZone>(NULL);
138  }
139 
140  //- Return a pointer to a new MRFZone created on freestore
141  // from Istream
142  class iNew
143  {
144  const fvMesh& mesh_;
145 
146  public:
147 
148  iNew(const fvMesh& mesh)
149  :
150  mesh_(mesh)
151  {}
152 
154  {
155  return autoPtr<MRFZone>(new MRFZone(mesh_, is));
156  }
157  };
158 
159 
160  // Member Functions
161 
162  //- Update the mesh corresponding to given map
163  void updateMesh(const mapPolyMesh& mpm)
164  {
165  // Only updates face addressing
166  setMRFFaces();
167  }
168 
169  //- Add the Coriolis force contribution to the momentum equation
170  void addCoriolis(fvVectorMatrix& UEqn) const;
171 
172  //- Add the Coriolis force contribution to the momentum equation
173  void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const;
174 
175  //- Make the given absolute velocity relative within the MRF region
176  void relativeVelocity(volVectorField& U) const;
177 
178  //- Make the given relative velocity absolute within the MRF region
179  void absoluteVelocity(volVectorField& U) const;
180 
181  //- Make the given absolute flux relative within the MRF region
182  void relativeFlux(surfaceScalarField& phi) const;
183 
184  //- Make the given absolute mass-flux relative within the MRF region
185  void relativeFlux
186  (
187  const surfaceScalarField& rho,
188  surfaceScalarField& phi
189  ) const;
190 
191  //- Make the given relative flux absolute within the MRF region
192  void absoluteFlux(surfaceScalarField& phi) const;
193 
194  //- Make the given relative mass-flux absolute within the MRF region
195  void absoluteFlux
196  (
197  const surfaceScalarField& rho,
198  surfaceScalarField& phi
199  ) const;
200 
201  //- Correct the boundary velocity for the roation of the MRF region
203 
204 
205  // Ostream Operator
206 
207  friend Ostream& operator<<(Ostream& os, const MRFZone&)
208  {
209  notImplemented("Ostream& operator<<(Ostream& os, const MRFZone&)");
210  return os;
211  }
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #ifdef NoRepository
222 # include "MRFZoneTemplates.C"
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************ vim: set sw=4 sts=4 et: ************************ //