wallDist.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) 2015-2023 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::wallDist
26 
27 Description
28  Interface to run-time selectable methods to calculate the distance-to-wall
29  and normal-to-wall fields.
30 
31  Example of the wallDist specification in fvSchemes:
32  \verbatim
33  wallDist
34  {
35  method meshWave;
36 
37  // Optional entry enabling the calculation
38  // of the normal-to-wall field
39  nRequired false;
40  }
41  \endverbatim
42 
43 See also
44  Foam::patchDistMethod::meshWave
45  Foam::patchDistMethod::Poisson
46  Foam::patchDistMethod::advectionDiffusion
47 
48 SourceFiles
49  wallDist.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef wallDist_H
54 #define wallDist_H
55 
56 #include "DemandDrivenMeshObject.H"
57 #include "patchDistMethod.H"
58 #include "volFields.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class wallDist Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class wallDist
70 :
71  public DemandDrivenMeshObject<fvMesh, DeletableMeshObject, wallDist>
72 {
73  // Private Data
74 
75  //- Set of patch IDs
76  const labelHashSet patchIndices_;
77 
78  //- Name for the patch set, e.g. "wall"
79  const word patchTypeName_;
80 
81  //- Run-time selected method to generate the distance-to-wall field
82  mutable autoPtr<patchDistMethod> pdm_;
83 
84  //- Distance-to-wall field
85  mutable volScalarField y_;
86 
87  //- Flag to indicate if the distance-to-wall field is required
88  mutable bool nRequired_;
89 
90  //- Normal-to-wall field
91  mutable autoPtr<volVectorField> n_;
92 
93 
94  // Private Member Functions
95 
96  //- Construct the normal-to-wall field as required
97  void constructn() const;
98 
99 
100 protected:
101 
102  friend class DemandDrivenMeshObject
103  <
104  fvMesh,
106  wallDist
107  >;
108 
109  // Protected Constructors
110 
111  //- Construct from mesh and optional patch type name
112  wallDist
113  (
114  const fvMesh& mesh,
115  const word& patchTypeName = "wall"
116  );
117 
118  //- Construct from mesh, patch IDs and optional patch type name
119  wallDist
120  (
121  const fvMesh& mesh,
122  const labelHashSet& patchIDs,
123  const word& patchTypeName = "patch"
124  );
125 
126 
127 public:
128 
129  // Declare name of the class and its debug switch
130  ClassName("wallDist");
131 
132 
133  // Constructors
134 
135  //- Disallow default bitwise copy construction
136  wallDist(const wallDist&) = delete;
137 
138 
139  //- Destructor
140  virtual ~wallDist();
141 
142 
143  // Member Functions
144 
145  //- Return the patchIDs
146  const labelHashSet& patchIndices() const
147  {
148  return patchIndices_;
149  }
150 
151  //- Return reference to cached distance-to-wall field
152  const volScalarField& y() const
153  {
154  return y_;
155  }
156 
157  //- Return reference to cached normal-to-wall field
158  const volVectorField& n() const;
159 
160 
161  // Member Operators
162 
163  //- Disallow default bitwise assignment
164  void operator=(const wallDist&) = delete;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
MeshObject types:
Definition: MeshObjects.H:67
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Interface to run-time selectable methods to calculate the distance-to-wall and normal-to-wall fields.
Definition: wallDist.H:71
wallDist(const fvMesh &mesh, const word &patchTypeName="wall")
Construct from mesh and optional patch type name.
Definition: wallDist.C:68
void operator=(const wallDist &)=delete
Disallow default bitwise assignment.
const labelHashSet & patchIndices() const
Return the patchIDs.
Definition: wallDist.H:145
ClassName("wallDist")
const volScalarField & y() const
Return reference to cached distance-to-wall field.
Definition: wallDist.H:151
virtual ~wallDist()
Destructor.
Definition: wallDist.C:165
const volVectorField & n() const
Return reference to cached normal-to-wall field.
Definition: wallDist.C:171
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.