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