OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

wallDist.H

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