wallDist.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) 2015-2016 OpenFOAM Foundation
9  Copyright (C) 2016 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::wallDist
29 
30 Description
31  Interface to run-time selectable methods to calculate the distance-to-wall
32  and normal-to-wall fields.
33 
34  Example of the wallDist specification in fvSchemes:
35  \verbatim
36  wallDist
37  {
38  method meshWave;
39 
40  // Optional entry enabling the calculation
41  // of the normal-to-wall field
42  nRequired false;
43 
44  // Optional entry delaying wall distance update to every n steps
45  // Default is 1 (update every step)
46  updateInterval 5;
47  }
48  \endverbatim
49 
50 See also
51  Foam::patchDistMethod::meshWave
52  Foam::patchDistMethod::Poisson
53  Foam::patchDistMethod::advectionDiffusion
54 
55 SourceFiles
56  wallDist.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef wallDist_H
61 #define wallDist_H
62 
63 #include "MeshObject.H"
64 #include "patchDistMethod.H"
65 #include "volFields.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class wallDist Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class wallDist
77 :
78  public MeshObject<fvMesh, UpdateableMeshObject, wallDist>
79 {
80  // Private data
81 
82  //- Set of patch IDs
83  const labelHashSet patchIDs_;
84 
85  //- Name for the patch set, e.g. "wall"
86  const word patchTypeName_;
87 
88  //- Construction dictionary
89  const dictionary dict_;
90 
91  //- Run-time selected method to generate the distance-to-wall field
92  mutable autoPtr<patchDistMethod> pdm_;
93 
94  //- Distance-to-wall field
95  mutable volScalarField y_;
96 
97  //- Flag to indicate if the distance-to-wall field is required
98  mutable bool nRequired_;
99 
100  //- Normal-to-wall field
101  mutable tmp<volVectorField> n_;
102 
103  //- Update wall distance every updateInterval_ steps
104  const label updateInterval_;
105 
106  //- Flag to indicate whether the wall distance requires updating
107  bool requireUpdate_;
108 
109 
110  // Private Member Functions
111 
112  //- Construct the normal-to-wall field as required
113  void constructn() const;
114 
115  //- No copy construct
116  wallDist(const wallDist&) = delete;
117 
118  //- No copy assignment
119  void operator=(const wallDist&) = delete;
120 
121 
122 public:
123 
124  // Declare name of the class and its debug switch
125  ClassName("wallDist");
126 
127 
128  // Constructors
129 
130  //- Construct from mesh, patch IDs and optional patch type name
131  wallDist
132  (
133  const fvMesh& mesh,
134  const labelHashSet& patchIDs,
135  const word& patchTypeName = "patch"
136  );
137 
138  //- Construct from mesh, patch IDs, default patch distance method
139  // and optional patch type name
140  wallDist
141  (
142  const fvMesh& mesh,
143  const word& defaultPatchDistMethod,
144  const labelHashSet& patchIDs,
145  const word& patchTypeName = "patch"
146  );
147 
148  //- Construct from mesh and optional patch type name
149  wallDist
150  (
151  const fvMesh& mesh,
152  const word& patchTypeName = "wall"
153  );
154 
155 
156  //- Destructor
157  virtual ~wallDist();
158 
159 
160  // Member Functions
161 
162  //- Return the patchIDs
163  const labelHashSet& patchIDs() const
164  {
165  return patchIDs_;
166  }
167 
168  //- Return reference to cached distance-to-wall field
169  const volScalarField& y() const
170  {
171  return y_;
172  }
173 
174  //- Return reference to cached normal-to-wall field
175  const volVectorField& n() const;
176 
177  //- Update the y-field when the mesh moves
178  virtual bool movePoints();
179 
180  //- Update the y-field when the mesh changes
181  virtual void updateMesh(const mapPolyMesh&);
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
volFields.H
Foam::wallDist::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update the y-field when the mesh changes.
Definition: wallDist.C:247
Foam::wallDist::ClassName
ClassName("wallDist")
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::wallDist::y
const volScalarField & y() const
Return reference to cached distance-to-wall field.
Definition: wallDist.H:168
Foam::HashSet< label, Hash< label > >
patchDistMethod.H
Foam::wallDist
Interface to run-time selectable methods to calculate the distance-to-wall and normal-to-wall fields.
Definition: wallDist.H:75
Foam::MeshObject< fvMesh, UpdateableMeshObject, wallDist >::mesh
const fvMesh & mesh() const
Definition: MeshObject.H:122
Foam::wallDist::patchIDs
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: wallDist.H:162
Foam::wallDist::movePoints
virtual bool movePoints()
Update the y-field when the mesh moves.
Definition: wallDist.C:216
Foam::wallDist::n
const volVectorField & n() const
Return reference to cached normal-to-wall field.
Definition: wallDist.C:198
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
MeshObject.H
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::MeshObject
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:88
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::wallDist::~wallDist
virtual ~wallDist()
Destructor.
Definition: wallDist.C:192