meshWavePatchDistMethod.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::patchDistMethods::meshWave
29 
30 Description
31  Fast topological mesh-wave method for calculating the distance to nearest
32  patch for all cells and boundary.
33 
34  For regular/un-distorted meshes this method is accurate but for skewed,
35  non-orthogonal meshes it is approximate with the error increasing with the
36  degree of mesh distortion. The distance from the near-wall cells to the
37  boundary may optionally be corrected for mesh distortion by setting
38  correctWalls = true.
39 
40  Example of the wallDist specification in fvSchemes:
41  \verbatim
42  wallDist
43  {
44  method meshWave;
45 
46  // Optional entry enabling the calculation
47  // of the normal-to-wall field
48  nRequired false;
49  }
50  \endverbatim
51 
52 See also
53  Foam::patchDistMethod::Poisson
54  Foam::wallDist
55 
56 SourceFiles
57  meshWavePatchDistMethod.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef meshWavePatchDistMethod_H
62 #define meshWavePatchDistMethod_H
63 
64 #include "patchDistMethod.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 namespace patchDistMethods
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class meshWave Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 class meshWave
78 :
79  public patchDistMethod
80 {
81 protected:
82 
83  // Protected Member Data
84 
85  //- Do accurate distance calculation for near-wall cells.
86  const bool correctWalls_;
87 
88  //- Number of unset cells and faces.
89  mutable label nUnset_;
90 
91 
92 private:
93 
94  // Private Member Functions
95 
96  //- No copy construct
97  meshWave(const meshWave&) = delete;
98 
99  //- No copy assignment
100  void operator=(const meshWave&) = delete;
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("meshWave");
107 
108 
109  // Constructors
110 
111  //- Construct from coefficients dictionary, mesh
112  // and fixed-value patch set
113  meshWave
114  (
115  const dictionary& dict,
116  const fvMesh& mesh,
117  const labelHashSet& patchIDs
118  );
119 
120  //- Construct from mesh, fixed-value patch set and flag specifying
121  // whether or not to correct wall.
122  // Calculate for all cells. correctWalls : correct wall (face&point)
123  // cells for correct distance, searching neighbours.
124  meshWave
125  (
126  const fvMesh& mesh,
127  const labelHashSet& patchIDs,
128  const bool correctWalls = true
129  );
130 
131 
132  // Member Functions
133 
134  //- Correct the given distance-to-patch field
135  virtual bool correct(volScalarField& y);
136 
137  //- Correct the given distance-to-patch and normal-to-patch fields
138  virtual bool correct(volScalarField& y, volVectorField& n);
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace patchDistMethods
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #endif
150 
151 // ************************************************************************* //
Foam::patchDistMethods::meshWave::TypeName
TypeName("meshWave")
Runtime type information.
Foam::HashSet< label, Hash< label > >
patchDistMethod.H
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::patchDistMethods::meshWave::correctWalls_
const bool correctWalls_
Do accurate distance calculation for near-wall cells.
Definition: meshWavePatchDistMethod.H:85
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::patchDistMethod
Specialisation of patchDist for wall distance calculation.
Definition: patchDistMethod.H:59
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchDistMethods::meshWave::correct
virtual bool correct(volScalarField &y)
Correct the given distance-to-patch field.
Definition: meshWavePatchDistMethod.C:79
Foam::patchDistMethods::meshWave::nUnset_
label nUnset_
Number of unset cells and faces.
Definition: meshWavePatchDistMethod.H:88
Foam::patchDistMethods::meshWave
Fast topological mesh-wave method for calculating the distance to nearest patch for all cells and bou...
Definition: meshWavePatchDistMethod.H:76
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::patchDistMethod::patchIDs
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: patchDistMethod.H:143
y
scalar y
Definition: LISASMDCalcMethod1.H:14