FreeFOAM The Cross-Platform CFD Toolkit
wallDist.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::wallDist
26 
27 Description
28  Calculation of distance to nearest wall for all cells and boundary.
29  Uses meshWave to do actual calculation.
30 
31  Distance correction:
32 
33  if correctWalls = true:
34  For each cell with face on wall calculate the true nearest point
35  (by triangle decomposition) on that face and do that same for that face's
36  pointNeighbours. This will find the true nearest distance in almost all
37  cases. Only very skewed cells or cells close to another wall might be
38  missed.
39 
40  For each cell with only point on wall the same is done except now it takes
41  the pointFaces() of the wall point to look for the nearest point.
42 
43 Note
44 
45  correct() : for now does complete recalculation. (which usually is
46  ok since mesh is smoothed). However for topology change where geometry
47  in most of domain does not change you could think of starting from the
48  old cell values. Tried but not done since:
49  - meshWave would have to be called with old cellInfo.
50  This is List<wallInfo> of nCells.
51  - cannot construct from distance (y_) only since we don't know a value
52  for origin_. (origin_ = GREAT already used to denote illegal value.)
53  - so we would have to store a List<wallInfo> which unfortunately does
54  not get resized/mapped automatically upon mesh changes.
55 
56 SourceFiles
57  wallDist.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef wallDist_H
62 #define wallDist_H
63 
64 #include <finiteVolume/volFields.H>
66 
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 class fvMesh;
74 
75 /*---------------------------------------------------------------------------*\
76  Class wallDist Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 class wallDist
80 :
81  public volScalarField,
82  public cellDistFuncs
83 {
84 
85 
86 private:
87 
88  // Private Member Data
89 
90  //- Do accurate distance calculation for near-wall cells.
91  bool correctWalls_;
92 
93  //- Number of unset cells and faces.
94  label nUnset_;
95 
96 
97  // Private Member Functions
98 
99  //- Disallow default bitwise copy construct
100  wallDist(const wallDist&);
101 
102  //- Disallow default bitwise assignment
103  void operator=(const wallDist&);
104 
105 
106 public:
107 
108  // Constructors
109 
110  //- Construct from mesh and flag whether or not to correct wall.
111  // Calculate for all cells. correctWalls : correct wall (face&point)
112  // cells for correct distance, searching neighbours.
113  wallDist(const fvMesh& mesh, bool correctWalls = true);
114 
115 
116  // Destructor
117 
118  virtual ~wallDist();
119 
120 
121  // Member Functions
122 
123  const volScalarField& y() const
124  {
125  return *this;
126  }
127 
128  label nUnset() const
129  {
130  return nUnset_;
131  }
132 
133  //- Correct for mesh geom/topo changes
134  virtual void correct();
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************ vim: set sw=4 sts=4 et: ************************ //