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-2019 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 public:
88 
89  //- Runtime type information
90  TypeName("meshWave");
91 
92 
93  // Constructors
94 
95  //- Construct from coefficients dictionary, mesh
96  // and fixed-value patch set
97  meshWave
98  (
99  const dictionary& dict,
100  const fvMesh& mesh,
101  const labelHashSet& patchIDs
102  );
103 
104  //- Construct from mesh, fixed-value patch set and flag specifying
105  // whether or not to correct wall.
106  // Calculate for all cells. correctWalls : correct wall (face&point)
107  // cells for correct distance, searching neighbours.
108  meshWave
109  (
110  const fvMesh& mesh,
111  const labelHashSet& patchIDs,
112  const bool correctWalls = true
113  );
114 
115  //- Disallow default bitwise copy construction
116  meshWave(const meshWave&) = delete;
117 
118 
119  // Member Functions
121  label nUnset() const
122  {
123  return nUnset_;
124  }
125 
126  //- Correct the given distance-to-patch field
127  virtual bool correct(volScalarField& y);
128 
129  //- Correct the given distance-to-patch and normal-to-patch fields
130  virtual bool correct(volScalarField& y, volVectorField& n);
131 
132 
133  // Member Operators
134 
135  //- Disallow default bitwise assignment
136  void operator=(const meshWave&) = delete;
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:158
void operator=(const meshWave &)=delete
Disallow default bitwise assignment.
meshWave(const dictionary &dict, const fvMesh &mesh, const labelHashSet &patchIDs)
Construct from coefficients dictionary, mesh.
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.