Loading...
Searching...
No Matches
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 Foam_wallDist_H
61#define Foam_wallDist_H
62
63#include "MeshObject.H"
64#include "patchDistMethod.H"
65#include "volFields.H"
66
67// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68
69namespace Foam
70{
72/*---------------------------------------------------------------------------*\
73 Class wallDist Declaration
74\*---------------------------------------------------------------------------*/
75
76class wallDist
77:
78 public MeshObject<fvMesh, UpdateableMeshObject, wallDist>
79{
80 // Private Typedefs
81
82 typedef MeshObject
83 <
84 fvMesh,
86 wallDist
87 > MeshObject_type;
88
89
90 // Private Data
91
92 //- Set of patch IDs
93 const labelHashSet patchIDs_;
94
95 //- Name for the patch set, e.g. "wall"
96 const word patchTypeName_;
97
98 //- Construction dictionary
99 const dictionary dict_;
100
101 //- Run-time selected method to generate the distance-to-wall field
102 mutable autoPtr<patchDistMethod> pdm_;
103
104 //- Distance-to-wall field
105 mutable volScalarField y_;
106
107 //- Normal-to-wall field
108 mutable tmp<volVectorField> n_;
109
110 //- Update wall distance every updateInterval_ steps
111 const label updateInterval_;
112
113 //- Flag to indicate if the distance-to-wall field is required
114 mutable bool nRequired_;
115
116 //- Flag to indicate whether the wall distance requires updating
117 bool requireUpdate_;
118
119
120 // Private Member Functions
121
122 //- Construct the normal-to-wall field as required
123 void constructn() const;
124
125 //- No copy construct
126 wallDist(const wallDist&) = delete;
127
128 //- No copy assignment
129 void operator=(const wallDist&) = delete;
130
131
132public:
133
134 // Declare name of the class and its debug switch
135 ClassName("wallDist");
136
137
138 // Constructors
139
140 //- Construct from mesh, patch IDs and optional patch type name
141 wallDist
142 (
143 const fvMesh& mesh,
144 const labelHashSet& patchIDs,
145 const word& patchTypeName = "patch"
146 );
147
148 //- Construct from mesh, patch IDs, default patch distance method
149 // and optional patch type name
150 wallDist
151 (
152 const fvMesh& mesh,
153 const word& defaultPatchDistMethod,
155 const word& patchTypeName = "patch"
156 );
157
158 //- Construct from mesh and optional patch type name
159 wallDist
160 (
161 const fvMesh& mesh,
162 const word& patchTypeName = "wall"
163 );
164
165
166 //- Destructor
167 virtual ~wallDist();
168
169
170 // Static Member Functions
171
172 //- Trigger update of y-field for the "wallDist" MeshObject on the
173 //- given mesh. A no-op if the wallDist is not found.
174 static bool try_movePoints(const fvMesh& mesh);
175
176
177 // Member Functions
178
179 //- Return the patchIDs
180 const labelHashSet& patchIDs() const noexcept
181 {
182 return patchIDs_;
183 }
184
185 //- Return reference to cached distance-to-wall field
186 const volScalarField& y() const noexcept
187 {
188 return y_;
189 }
190
191 //- Return reference to cached normal-to-wall field
192 const volVectorField& n() const;
193
194 //- Update the y-field when the mesh moves
195 virtual bool movePoints();
196
197 //- Update the y-field when the mesh changes
198 virtual void updateMesh(const mapPolyMesh&);
199};
200
201
202// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203
204} // End namespace Foam
205
206// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207
208#endif
209
210// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition tmp.H:75
virtual bool movePoints()
Update the y-field when the mesh moves.
Definition wallDist.C:186
static bool try_movePoints(const fvMesh &mesh)
Trigger update of y-field for the "wallDist" MeshObject on the given mesh. A no-op if the wallDist is...
Definition wallDist.C:152
virtual void updateMesh(const mapPolyMesh &)
Update the y-field when the mesh changes.
Definition wallDist.C:217
ClassName("wallDist")
const volScalarField & y() const noexcept
Return reference to cached distance-to-wall field.
Definition wallDist.H:220
virtual ~wallDist()
Destructor.
Definition wallDist.C:146
const labelHashSet & patchIDs() const noexcept
Return the patchIDs.
Definition wallDist.H:212
const volVectorField & n() const
Return reference to cached normal-to-wall field.
Definition wallDist.C:168
A class for handling words, derived from Foam::string.
Definition word.H:66
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
Namespace for OpenFOAM.
GeometricField< vector, fvPatchField, volMesh > volVectorField
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const direction noexcept
Definition scalarImpl.H:265