fvPatch.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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::fvPatch
26 
27 Description
28  A finiteVolume patch using a polyPatch and a fvBoundaryMesh
29 
30 SourceFiles
31  fvPatch.C
32  fvPatchNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef fvPatch_H
37 #define fvPatch_H
38 
39 #include "polyPatch.H"
40 #include "labelList.H"
41 #include "SubList.H"
42 #include "typeInfo.H"
43 #include "tmp.H"
44 #include "primitiveFields.H"
45 #include "SubField.H"
46 #include "fvPatchFieldsFwd.H"
47 #include "autoPtr.H"
48 #include "runTimeSelectionTables.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 class fvBoundaryMesh;
56 class objectRegistry;
57 class surfaceInterpolation;
58 
59 /*---------------------------------------------------------------------------*\
60  Class fvPatch Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class fvPatch
64 {
65  // Private Data
66 
67  //- Reference to the underlying polyPatch
68  const polyPatch& polyPatch_;
69 
70  //- Reference to boundary mesh
71  const fvBoundaryMesh& boundaryMesh_;
72 
73 
74 protected:
75 
76  // Protected Member Functions
77 
78  //- Make patch weighting factors
79  virtual void makeWeights(scalarField&) const;
80 
81  //- Initialise the patches for moving points
82  virtual void initMovePoints();
83 
84  //- Correct patches after moving points
85  virtual void movePoints();
86 
87 
88 public:
89 
91 
92  friend class fvBoundaryMesh;
93  friend class surfaceInterpolation;
94 
95  //- Runtime type information
96  TypeName(polyPatch::typeName_());
97 
98 
99  // Declare run-time constructor selection tables
100 
102  (
103  autoPtr,
104  fvPatch,
105  polyPatch,
106  (const polyPatch& patch, const fvBoundaryMesh& bm),
107  (patch, bm)
108  );
109 
110 
111  // Constructors
112 
113  //- Construct from polyPatch and fvBoundaryMesh
114  fvPatch(const polyPatch&, const fvBoundaryMesh&);
115 
116  //- Disallow default bitwise copy construction
117  fvPatch(const fvPatch&);
118 
119 
120  // Selectors
121 
122  //- Return a pointer to a new patch created on freestore from polyPatch
123  static autoPtr<fvPatch> New
124  (
125  const polyPatch&,
126  const fvBoundaryMesh&
127  );
128 
129 
130  //- Destructor
131  virtual ~fvPatch();
132 
133 
134  // Member Functions
135 
136  // Access
137 
138  //- Return the polyPatch
139  const polyPatch& patch() const
140  {
141  return polyPatch_;
142  }
143 
144  //- Return name
145  virtual const word& name() const
146  {
147  return polyPatch_.name();
148  }
149 
150  //- Return start label of this patch in the polyMesh face list
151  virtual label start() const
152  {
153  return polyPatch_.start();
154  }
155 
156  //- Return size
157  virtual label size() const
158  {
159  return polyPatch_.size();
160  }
161 
162  //- Return true if this patch is coupled
163  virtual bool coupled() const
164  {
165  return polyPatch_.coupled();
166  }
167 
168  //- Return true if the given type is a constraint type
169  static bool constraintType(const word& pt);
170 
171  //- Return a list of all the constraint patch types
172  static wordList constraintTypes();
173 
174  //- Return the index of this patch in the fvBoundaryMesh
175  label index() const
176  {
177  return polyPatch_.index();
178  }
179 
180  //- Return boundaryMesh reference
181  const fvBoundaryMesh& boundaryMesh() const
182  {
183  return boundaryMesh_;
184  }
185 
186  //- Return the local object registry
187  const objectRegistry& db() const;
188 
189  //- Slice list to patch
190  template<class T>
191  const typename List<T>::subList patchSlice(const List<T>& l) const
192  {
193  return typename List<T>::subList(l, size(), start());
194  }
195 
196  //- Return faceCells
197  virtual const labelUList& faceCells() const;
198 
199 
200  // Access functions for geometrical data
201 
202  //- Return face centres
203  const vectorField& Cf() const;
204 
205  //- Return neighbour cell centres
206  tmp<vectorField> Cn() const;
207 
208  //- Return face area vectors
209  const vectorField& Sf() const;
210 
211  //- Return face area magnitudes
212  const scalarField& magSf() const;
213 
214  //- Return face normals
215  tmp<vectorField> nf() const;
216 
217  //- Return cell-centre to face-centre vector
218  // except for coupled patches for which the cell-centre
219  // to coupled-cell-centre vector is returned
220  virtual tmp<vectorField> delta() const;
221 
222 
223  // Access functions for demand driven data
224 
225  //- Return patch weighting factors
226  const scalarField& weights() const;
227 
228  //- Return the face - cell distance coeffient
229  // except for coupled patches for which the cell-centre
230  // to coupled-cell-centre distance coeffient is returned
231  const scalarField& deltaCoeffs() const;
232 
233 
234  // Evaluation functions
235 
236  //- Return given internal field next to patch as patch field
237  template<class Type>
239 
240  //- Return given internal field next to patch as patch field
241  template<class Type>
242  void patchInternalField(const UList<Type>&, Field<Type>&) const;
243 
244  //- Return the corresponding patchField of the named field
245  template<class GeometricField, class Type>
246  const typename GeometricField::Patch& patchField
247  (
248  const GeometricField&
249  ) const;
250 
251  //- Return the corresponding patchField reference of the named field
252  template<class GeometricField, class Type>
254  (
256  ) const;
257 
258  //- Lookup and return the patchField of the named field from the
259  // local objectRegistry.
260  template<class GeometricField, class Type>
262  (
263  const word& name
264  ) const;
265 
266 
267  // Member Operators
268 
269  //- Disallow default bitwise assignment
270  void operator=(const fvPatch&);
271 };
272 
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 } // End namespace Foam
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 #ifdef NoRepository
281  #include "fvPatchTemplates.C"
282 #endif
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 #endif
287 
288 // ************************************************************************* //
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:180
const GeometricField::Patch & patchField(const GeometricField &) const
Return the corresponding patchField of the named field.
virtual void initMovePoints()
Initialise the patches for moving points.
Definition: fvPatch.C:162
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const word & name() const
Return name.
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:142
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:174
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:150
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:130
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:55
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
Generic GeometricField class.
SubList< T > subList
Declare type of subList.
Definition: List.H:199
Cell to surface interpolation scheme. Included in fvMesh.
declareRunTimeSelectionTable(autoPtr, fvPatch, polyPatch,(const polyPatch &patch, const fvBoundaryMesh &bm),(patch, bm))
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: fvPatch.C:61
void operator=(const fvPatch &)
Disallow default bitwise assignment.
A List obtained as a section of another List.
Definition: SubList.H:53
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Definition: polyPatch.H:319
fvBoundaryMesh BoundaryMesh
Definition: fvPatch.H:89
A class for handling words, derived from string.
Definition: word.H:59
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:99
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:138
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:176
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: fvPatch.C:156
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:105
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
virtual label size() const
Return size.
Definition: fvPatch.H:156
const objectRegistry & db() const
Return the local object registry.
Definition: fvPatch.C:93
tmp< Field< Type > > patchInternalField(const UList< Type > &) const
Return given internal field next to patch as patch field.
TypeName(polyPatch::typeName_())
Runtime type information.
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:136
const List< T >::subList patchSlice(const List< T > &l) const
Slice list to patch.
Definition: fvPatch.H:190
const GeometricField::Patch & lookupPatchField(const word &name) const
Lookup and return the patchField of the named field from the.
Specialisations of Field<T> for scalar, vector and tensor.
PatchField< Type > Patch
Type of the patch field of which the.
const scalarField & deltaCoeffs() const
Return the face - cell distance coeffient.
Definition: fvPatch.C:170
Foam::fvBoundaryMesh.
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:111
label index() const
Return the index of this patch in the boundaryMesh.
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:309
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual const word & name() const
Return name.
Definition: fvPatch.H:144
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
Definition: fvPatchNew.C:32
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
virtual bool coupled() const
Return true if this patch is coupled.
Definition: fvPatch.H:162
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Definition: fvPatch.C:148
virtual void movePoints()
Correct patches after moving points.
Definition: fvPatch.C:166
fvPatch(const polyPatch &, const fvBoundaryMesh &)
Construct from polyPatch and fvBoundaryMesh.
Definition: fvPatch.C:46
Namespace for OpenFOAM.
static wordList constraintTypes()
Return a list of all the constraint patch types.
Definition: fvPatch.C:67