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-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::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 "MeshObject.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 MeshObject<fvMesh, UpdateableMeshObject, wallDist>
72 {
73  // Private Data
74 
75  //- Set of patch IDs
76  const labelHashSet patchIDs_;
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 tmp<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 public:
101 
102  // Declare name of the class and its debug switch
103  ClassName("wallDist");
104 
105 
106  // Constructors
107 
108  //- Construct from mesh and optional patch type name
109  wallDist
110  (
111  const fvMesh& mesh,
112  const word& patchTypeName = "wall"
113  );
114 
115  //- Construct from mesh, patch IDs and optional patch type name
116  wallDist
117  (
118  const fvMesh& mesh,
119  const labelHashSet& patchIDs,
120  const word& patchTypeName = "patch"
121  );
122 
123  //- Disallow default bitwise copy construction
124  wallDist(const wallDist&) = delete;
125 
126 
127  //- Destructor
128  virtual ~wallDist();
129 
130 
131  // Member Functions
132 
133  //- Return the patchIDs
134  const labelHashSet& patchIDs() const
135  {
136  return patchIDs_;
137  }
138 
139  //- Return reference to cached distance-to-wall field
140  const volScalarField& y() const
141  {
142  return y_;
143  }
144 
145  //- Return reference to cached normal-to-wall field
146  const volVectorField& n() const;
147 
148  //- Update the y-field when the mesh moves
149  virtual bool movePoints();
150 
151  //- Update the y-field when the mesh changes
152  virtual void updateMesh(const mapPolyMesh&);
153 
154 
155  // Member Operators
156 
157  //- Disallow default bitwise assignment
158  void operator=(const wallDist&) = delete;
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
const volVectorField & n() const
Return reference to cached normal-to-wall field.
Definition: wallDist.C:162
wallDist(const fvMesh &mesh, const word &patchTypeName="wall")
Construct from mesh and optional patch type name.
Definition: wallDist.C:63
virtual ~wallDist()
Destructor.
Definition: wallDist.C:156
const volScalarField & y() const
Return reference to cached distance-to-wall field.
Definition: wallDist.H:139
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: wallDist.H:133
void operator=(const wallDist &)=delete
Disallow default bitwise assignment.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:86
ClassName("wallDist")
A class for handling words, derived from string.
Definition: word.H:59
virtual void updateMesh(const mapPolyMesh &)
Update the y-field when the mesh changes.
Definition: wallDist.C:200
virtual bool movePoints()
Update the y-field when the mesh moves.
Definition: wallDist.C:180
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Interface to run-time selectable methods to calculate the distance-to-wall and normal-to-wall fields...
Definition: wallDist.H:68
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.