patchDistMethod.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) 2017-2021 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::patchDistMethod
29 
30 Description
31  Specialisation of patchDist for wall distance calculation
32 
33 SourceFiles
34  patchDistMethod.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef patchDistMethod_H
39 #define patchDistMethod_H
40 
41 #include "dictionary.H"
42 #include "HashSet.H"
43 #include "volFieldsFwd.H"
44 #include "mapPolyMesh.H"
47 #include "runTimeSelectionTables.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 class fvMesh;
55 
56 /*---------------------------------------------------------------------------*\
57  Class patchDistMethod Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class patchDistMethod
61 {
62 protected:
63 
64  // Protected Member Data
65 
66  //- Reference to the mesh
67  const fvMesh& mesh_;
68 
69  //- Set of patch IDs
70  const labelHashSet patchIDs_;
71 
72 
73  // Protected Member Functions
74 
75  //- No copy construct
76  patchDistMethod(const patchDistMethod&) = delete;
77 
78  //- No copy assignment
79  void operator=(const patchDistMethod&) = delete;
80 
81 public:
82 
83  //- Runtime type information
84  TypeName("patchDistMethod");
85 
86 
87  // Declare runtime construction
88 
90  (
91  autoPtr,
93  dictionary,
94  (
95  const dictionary& dict,
96  const fvMesh& mesh,
97  const labelHashSet& patchIDs
98  ),
99  (dict, mesh, patchIDs)
100  );
101 
102 
103  // Constructors
104 
105  //- Construct from mesh and patch ID set
107  (
108  const fvMesh& mesh,
109  const labelHashSet& patchIDs
110  );
111 
112 
113  // Selectors
114 
115  // Use "method" from dictionary, or defaultPatchDistMethod
117  (
118  const dictionary& dict,
119  const fvMesh& mesh,
120  const labelHashSet& patchIDs,
121  const word& defaultPatchDistMethod = word::null
122  );
123 
124 
125  //- Destructor
126  virtual ~patchDistMethod();
127 
128 
129  // Static Functions
130 
131  //- Return the patch types for y and n
132  // These are fixedValue for the set provided otherwise zero-gradient
133  template<class Type>
134  static wordList patchTypes
135  (
136  const fvMesh& mesh,
137  const labelHashSet& patchIDs
138  );
139 
140 
141  // Member Functions
142 
143  //- Return the patchIDs
144  const labelHashSet& patchIDs() const
145  {
146  return patchIDs_;
147  }
148 
149  //- Update cached geometry when the mesh moves
150  virtual bool movePoints()
151  {
152  return true;
153  }
154 
155  //- Update cached topology and geometry when the mesh changes
156  virtual void updateMesh(const mapPolyMesh&)
157  {}
158 
159  //- Correct the given distance-to-patch field
160  virtual bool correct(volScalarField& y) = 0;
161 
162  //- Correct the given distance-to-patch and normal-to-patch fields
163  virtual bool correct(volScalarField& y, volVectorField& n) = 0;
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #ifdef NoRepository
174  #include "patchDistMethodTemplates.C"
175 #endif
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
volFieldsFwd.H
Foam::patchDistMethod::correct
virtual bool correct(volScalarField &y)=0
Correct the given distance-to-patch field.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::patchDistMethod::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update cached topology and geometry when the mesh changes.
Definition: patchDistMethod.H:155
Foam::patchDistMethod::patchDistMethod
patchDistMethod(const patchDistMethod &)=delete
No copy construct.
mapPolyMesh.H
Foam::patchDistMethod::~patchDistMethod
virtual ~patchDistMethod()
Destructor.
Definition: patchDistMethod.C:93
Foam::patchDistMethod::patchTypes
static wordList patchTypes(const fvMesh &mesh, const labelHashSet &patchIDs)
Return the patch types for y and n.
Foam::HashSet< label, Hash< label > >
n
label n
Definition: TABSMDCalcMethod2.H:31
patchDistMethodTemplates.C
Foam::patchDistMethod::movePoints
virtual bool movePoints()
Update cached geometry when the mesh moves.
Definition: patchDistMethod.H:149
HashSet.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::patchDistMethod
Specialisation of patchDist for wall distance calculation.
Definition: patchDistMethod.H:59
Foam::patchDistMethod::mesh_
const fvMesh & mesh_
Reference to the mesh.
Definition: patchDistMethod.H:66
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchDistMethod::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, patchDistMethod, dictionary,(const dictionary &dict, const fvMesh &mesh, const labelHashSet &patchIDs),(dict, mesh, patchIDs))
Foam::patchDistMethod::patchIDs_
const labelHashSet patchIDs_
Set of patch IDs.
Definition: patchDistMethod.H:69
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::patchDistMethod::operator=
void operator=(const patchDistMethod &)=delete
No copy assignment.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::patchDistMethod::New
static autoPtr< patchDistMethod > New(const dictionary &dict, const fvMesh &mesh, const labelHashSet &patchIDs, const word &defaultPatchDistMethod=word::null)
Definition: patchDistMethod.C:57
Foam::List< word >
Foam::patchDistMethod::TypeName
TypeName("patchDistMethod")
Runtime type information.
fixedValueFvPatchFields.H
dictionary.H
Foam::word::null
static const word null
An empty word.
Definition: word.H:80
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::patchDistMethod::patchIDs
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: patchDistMethod.H:143
zeroGradientFvPatchFields.H
y
scalar y
Definition: LISASMDCalcMethod1.H:14