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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::wallDist
29
30Description
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
50See also
51 Foam::patchDistMethod::meshWave
52 Foam::patchDistMethod::Poisson
53 Foam::patchDistMethod::advectionDiffusion
54
55SourceFiles
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
69namespace Foam
70{
71
72/*---------------------------------------------------------------------------*\
73 Class wallDist Declaration
74\*---------------------------------------------------------------------------*/
76class 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 //- Normal-to-wall field
98 mutable tmp<volVectorField> n_;
99
100 //- Update wall distance every updateInterval_ steps
101 const label updateInterval_;
102
103 //- Flag to indicate if the distance-to-wall field is required
104 mutable bool nRequired_;
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
122public:
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
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
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
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// ************************************************************************* //
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:91
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
A class for managing temporary objects.
Definition: tmp.H:65
Interface to run-time selectable methods to calculate the distance-to-wall and normal-to-wall fields.
Definition: wallDist.H:78
virtual bool movePoints()
Update the y-field when the mesh moves.
Definition: wallDist.C:175
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: wallDist.H:162
virtual void updateMesh(const mapPolyMesh &)
Update the y-field when the mesh changes.
Definition: wallDist.C:206
ClassName("wallDist")
const volScalarField & y() const
Return reference to cached distance-to-wall field.
Definition: wallDist.H:168
virtual ~wallDist()
Destructor.
Definition: wallDist.C:151
const volVectorField & n() const
Return reference to cached normal-to-wall field.
Definition: wallDist.C:157
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
Namespace for OpenFOAM.