meshWavePatchDistMethod.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
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::patchDistMethods::meshWave
26 
27 Description
28  Fast topological mesh-wave method for calculating the distance to nearest
29  patch for all cells and boundary.
30 
31  For regular/un-distorted meshes this method is accurate but for skewed,
32  non-orthogonal meshes it is approximate with the error increasing with the
33  degree of mesh distortion. The distance from the near-wall cells to the
34  boundary may optionally be corrected for mesh distortion by setting
35  correctWalls = true.
36 
37  Example of the wallDist specification in fvSchemes:
38  \verbatim
39  wallDist
40  {
41  method meshWave;
42 
43  // Optional entry enabling the calculation
44  // of the normal-to-wall field
45  nRequired false;
46  }
47  \endverbatim
48 
49 See also
50  Foam::patchDistMethod::Poisson
51  Foam::wallDist
52 
53 SourceFiles
54  meshWavePatchDistMethod.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef meshWavePatchDistMethod_H
59 #define meshWavePatchDistMethod_H
60 
61 #include "patchDistMethod.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 namespace patchDistMethods
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class meshWave Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 class meshWave
75 :
76  public patchDistMethod
77 {
78  // Private Member Data
79 
80  //- Do accurate distance calculation for near-wall cells.
81  const bool correctWalls_;
82 
83  //- Number of unset cells and faces.
84  mutable label nUnset_;
85 
86 
87  // Private Member Functions
88 
89  //- Disallow default bitwise copy construct
90  meshWave(const meshWave&);
91 
92  //- Disallow default bitwise assignment
93  void operator=(const meshWave&);
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("meshWave");
100 
101 
102  // Constructors
103 
104  //- Construct from coefficients dictionary, mesh
105  // and fixed-value patch set
106  meshWave
107  (
108  const dictionary& dict,
109  const fvMesh& mesh,
110  const labelHashSet& patchIDs
111  );
112 
113  //- Construct from mesh, fixed-value patch set and flag specifying
114  // whether or not to correct wall.
115  // Calculate for all cells. correctWalls : correct wall (face&point)
116  // cells for correct distance, searching neighbours.
117  meshWave
118  (
119  const fvMesh& mesh,
120  const labelHashSet& patchIDs,
121  const bool correctWalls = true
122  );
123 
124 
125  // Member Functions
127  label nUnset() const
128  {
129  return nUnset_;
130  }
131 
132  //- Correct the given distance-to-patch field
133  virtual bool correct(volScalarField& y);
134 
135  //- Correct the given distance-to-patch and normal-to-patch fields
136  virtual bool correct(volScalarField& y, volVectorField& n);
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace patchDistMethods
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
Fast topological mesh-wave method for calculating the distance to nearest patch for all cells and bou...
dictionary dict
TypeName("meshWave")
Runtime type information.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool correct(volScalarField &y)
Correct the given distance-to-patch field.
scalar y
dynamicFvMesh & mesh
const labelHashSet & patchIDs() const
Return the patchIDs.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
label n
Specialisation of patchDist for wall distance calculation.
Namespace for OpenFOAM.