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 | Copyright (C) 2015-2016 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  //- Disallow default bitwise copy construct
100  wallDist(const wallDist&);
101 
102  //- Disallow default bitwise assignment
103  void operator=(const wallDist&);
104 
105 
106 public:
107 
108  // Declare name of the class and its debug switch
109  ClassName("wallDist");
110 
111 
112  // Constructors
113 
114  //- Construct from mesh and optional patch type name
115  wallDist
116  (
117  const fvMesh& mesh,
118  const word& patchTypeName = "wall"
119  );
120 
121  //- Construct from mesh, patch IDs and optional patch type name
122  wallDist
123  (
124  const fvMesh& mesh,
125  const labelHashSet& patchIDs,
126  const word& patchTypeName = "patch"
127  );
128 
129 
130  //- Destructor
131  virtual ~wallDist();
132 
133 
134  // Member Functions
135 
136  //- Return the patchIDs
137  const labelHashSet& patchIDs() const
138  {
139  return patchIDs_;
140  }
141 
142  //- Return reference to cached distance-to-wall field
143  const volScalarField& y() const
144  {
145  return y_;
146  }
147 
148  //- Return reference to cached normal-to-wall field
149  const volVectorField& n() const;
150 
151  //- Update the y-field when the mesh moves
152  virtual bool movePoints();
153 
154  //- Update the y-field when the mesh changes
155  virtual void updateMesh(const mapPolyMesh&);
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
const volScalarField & y() const
Return reference to cached distance-to-wall field.
Definition: wallDist.H:142
virtual ~wallDist()
Destructor.
Definition: wallDist.C:164
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:85
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:208
virtual bool movePoints()
Update the y-field when the mesh moves.
Definition: wallDist.C:188
const volVectorField & n() const
Return reference to cached normal-to-wall field.
Definition: wallDist.C:170
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:53
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:54
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: wallDist.H:136
Namespace for OpenFOAM.