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::wallDist 00026 00027 Description 00028 Calculation of distance to nearest wall for all cells and boundary. 00029 Uses meshWave to do actual calculation. 00030 00031 Distance correction: 00032 00033 if correctWalls = true: 00034 For each cell with face on wall calculate the true nearest point 00035 (by triangle decomposition) on that face and do that same for that face's 00036 pointNeighbours. This will find the true nearest distance in almost all 00037 cases. Only very skewed cells or cells close to another wall might be 00038 missed. 00039 00040 For each cell with only point on wall the same is done except now it takes 00041 the pointFaces() of the wall point to look for the nearest point. 00042 00043 Note 00044 00045 correct() : for now does complete recalculation. (which usually is 00046 ok since mesh is smoothed). However for topology change where geometry 00047 in most of domain does not change you could think of starting from the 00048 old cell values. Tried but not done since: 00049 - meshWave would have to be called with old cellInfo. 00050 This is List<wallInfo> of nCells. 00051 - cannot construct from distance (y_) only since we don't know a value 00052 for origin_. (origin_ = GREAT already used to denote illegal value.) 00053 - so we would have to store a List<wallInfo> which unfortunately does 00054 not get resized/mapped automatically upon mesh changes. 00055 00056 SourceFiles 00057 wallDist.C 00058 00059 \*---------------------------------------------------------------------------*/ 00060 00061 #ifndef wallDist_H 00062 #define wallDist_H 00063 00064 #include <finiteVolume/volFields.H> 00065 #include <meshTools/cellDistFuncs.H> 00066 00067 00068 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00069 00070 namespace Foam 00071 { 00072 00073 class fvMesh; 00074 00075 /*---------------------------------------------------------------------------*\ 00076 Class wallDist Declaration 00077 \*---------------------------------------------------------------------------*/ 00078 00079 class wallDist 00080 : 00081 public volScalarField, 00082 public cellDistFuncs 00083 { 00084 00085 00086 private: 00087 00088 // Private Member Data 00089 00090 //- Do accurate distance calculation for near-wall cells. 00091 bool correctWalls_; 00092 00093 //- Number of unset cells and faces. 00094 label nUnset_; 00095 00096 00097 // Private Member Functions 00098 00099 //- Disallow default bitwise copy construct 00100 wallDist(const wallDist&); 00101 00102 //- Disallow default bitwise assignment 00103 void operator=(const wallDist&); 00104 00105 00106 public: 00107 00108 // Constructors 00109 00110 //- Construct from mesh and flag whether or not to correct wall. 00111 // Calculate for all cells. correctWalls : correct wall (face&point) 00112 // cells for correct distance, searching neighbours. 00113 wallDist(const fvMesh& mesh, bool correctWalls = true); 00114 00115 00116 // Destructor 00117 00118 virtual ~wallDist(); 00119 00120 00121 // Member Functions 00122 00123 const volScalarField& y() const 00124 { 00125 return *this; 00126 } 00127 00128 label nUnset() const 00129 { 00130 return nUnset_; 00131 } 00132 00133 //- Correct for mesh geom/topo changes 00134 virtual void correct(); 00135 }; 00136 00137 00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00139 00140 } // End namespace Foam 00141 00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00143 00144 #endif 00145 00146 // ************************ vim: set sw=4 sts=4 et: ************************ //