groundDist.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-2005 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 the
13  Free Software Foundation; either version 2 of the License, or (at your
14  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, write to the Free Software Foundation,
23  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 Class
26  groundDist
27 
28 Description
29  Calculation of distance to nearest wall for all cells and boundary.
30  Uses meshWave to do actual calculation.
31 
32  Distance correction:
33 
34  if correctWalls = true:
35  For each cell with face on wall calculate the true nearest point
36  (by triangle decomposition) on that face and do that same for that face's
37  pointNeighbours. This will find the true nearest distance in almost all
38  cases. Only very skewed cells or cells close to another wall might be
39  missed.
40 
41  For each cell with only point on wall the same is done except now it takes
42  the pointFaces() of the wall point to look for the nearest point.
43 
44  Note: correct() : for now does complete recalculation. (which usually is
45  ok since mesh is smoothed). However for topology change where geometry in
46  most of domain does not change you could think of starting from the old
47  cell values. Tried but not done since:
48  - meshWave would have to be called with old cellInfo. This is List<wallInfo>
49  of nCells.
50  - cannot construct from distance (y_) only since we don't know a value
51  for origin_. (origin_ = GREAT already used to denote illegal value.)
52  - so we would have to store a List<wallInfo> which unfortunately does not
53  get resized/mapped automatically upon mesh changes.
54 
55 SourceFiles
56  groundDist.C
57 
58 Modified from general wallDistance to distance from specified patches by David Segersson
59 Swedish Meteorological and Hydrological Institute, david.segersson@smhi.se
60 
61 \*---------------------------------------------------------------------------*/
62 
63 #ifndef groundDist_H
64 #define groundDist_H
65 
66 #include "volFields.H"
67 #include "cellDistFuncs.H"
68 
69 
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 
72 namespace Foam
73 {
74 
75 class fvMesh;
76 
77 /*---------------------------------------------------------------------------*\
78  Class groundDist Declaration
79 \*---------------------------------------------------------------------------*/
80 
81 class groundDist
82 :
83  public volScalarField,
84  public cellDistFuncs
85 {
86 
87 
88 private:
89 
90  // Private Member Data
91 
92  //- Do accurate distance calculation for near-wall cells.
93  bool correctWalls_;
94 
95  //- Number of unset cells and faces.
96  label nUnset_;
97 
98 
99  // Private Member Functions
100 
101  //- Disallow default bitwise copy construct
102  groundDist(const groundDist&);
103 
104  //- Disallow default bitwise assignment
105  void operator=(const groundDist&);
106 
107 
108 public:
109 
110  // Constructors
111 
112  //- Construct from mesh and flag whether or not to correct wall.
113  // Calculate for all cells. correctWalls : correct wall (face&point)
114  // cells for correct distance, searching neighbours.
115  groundDist(const fvMesh& mesh, labelHashSet patchIDs, bool correctWalls = true);
116 
117  // Destructor
118 
119  virtual ~groundDist();
120 
121 
122  // Member Functions
123 
124  const volScalarField& y() const
125  {
126  return *this;
127  }
128 
129  label nUnset() const
130  {
131  return nUnset_;
132  }
133 
134  //- Correct for mesh geom/topo changes
135  virtual void correct(labelHashSet patchIDs);
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
volFields.H
Foam::groundDist::y
const volScalarField & y() const
Definition: groundDist.H:101
Foam::groundDist::correctWalls_
bool correctWalls_
Do accurate distance calculation for near-wall cells.
Definition: groundDist.H:70
cellDistFuncs.H
Foam::HashSet< label, Hash< label > >
Foam::groundDist::~groundDist
virtual ~groundDist()
Definition: groundDist.C:61
Foam::groundDist::correct
virtual void correct(labelHashSet patchIDs)
Correct for mesh geom/topo changes.
Definition: groundDist.C:69
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::groundDist::operator=
void operator=(const groundDist &)
Disallow default bitwise assignment.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::cellDistFuncs::mesh
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:95
Foam::cellDistFuncs
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:61
Foam::groundDist::nUnset
label nUnset() const
Definition: groundDist.H:106
Foam::groundDist::nUnset_
label nUnset_
Number of unset cells and faces.
Definition: groundDist.H:73
Foam::groundDist
Definition: groundDist.H:58
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Definition: HashSet.H:210
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::groundDist::groundDist
groundDist(const groundDist &)
Disallow default bitwise copy construct.