All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2019 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 surfaceInterpolation;
57 
58 /*---------------------------------------------------------------------------*\
59  Class fvPatch Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class fvPatch
63 {
64  // Private Data
65 
66  //- Reference to the underlying polyPatch
67  const polyPatch& polyPatch_;
68 
69  //- Reference to boundary mesh
70  const fvBoundaryMesh& boundaryMesh_;
71 
72 
73 protected:
74 
75  // Protected Member Functions
76 
77  //- Make patch weighting factors
78  virtual void makeWeights(scalarField&) const;
79 
80  //- Initialise the patches for moving points
81  virtual void initMovePoints();
82 
83  //- Correct patches after moving points
84  virtual void movePoints();
85 
86 
87 public:
88 
90 
91  friend class fvBoundaryMesh;
92  friend class surfaceInterpolation;
93 
94  //- Runtime type information
95  TypeName(polyPatch::typeName_());
96 
97 
98  // Declare run-time constructor selection tables
99 
101  (
102  autoPtr,
103  fvPatch,
104  polyPatch,
105  (const polyPatch& patch, const fvBoundaryMesh& bm),
106  (patch, bm)
107  );
108 
109 
110  // Constructors
111 
112  //- Construct from polyPatch and fvBoundaryMesh
113  fvPatch(const polyPatch&, const fvBoundaryMesh&);
114 
115  //- Disallow default bitwise copy construction
116  fvPatch(const fvPatch&);
117 
118 
119  // Selectors
120 
121  //- Return a pointer to a new patch created on freestore from polyPatch
122  static autoPtr<fvPatch> New
123  (
124  const polyPatch&,
125  const fvBoundaryMesh&
126  );
127 
128 
129  //- Destructor
130  virtual ~fvPatch();
131 
132 
133  // Member Functions
134 
135  // Access
136 
137  //- Return the polyPatch
138  const polyPatch& patch() const
139  {
140  return polyPatch_;
141  }
142 
143  //- Return name
144  virtual const word& name() const
145  {
146  return polyPatch_.name();
147  }
148 
149  //- Return start label of this patch in the polyMesh face list
150  virtual label start() const
151  {
152  return polyPatch_.start();
153  }
154 
155  //- Return size
156  virtual label size() const
157  {
158  return polyPatch_.size();
159  }
160 
161  //- Return true if this patch is coupled
162  virtual bool coupled() const
163  {
164  return polyPatch_.coupled();
165  }
166 
167  //- Return true if the given type is a constraint type
168  static bool constraintType(const word& pt);
169 
170  //- Return a list of all the constraint patch types
171  static wordList constraintTypes();
172 
173  //- Return the index of this patch in the fvBoundaryMesh
174  label index() const
175  {
176  return polyPatch_.index();
177  }
178 
179  //- Return boundaryMesh reference
180  const fvBoundaryMesh& boundaryMesh() const
181  {
182  return boundaryMesh_;
183  }
184 
185  //- Slice list to patch
186  template<class T>
187  const typename List<T>::subList patchSlice(const List<T>& l) const
188  {
189  return typename List<T>::subList(l, size(), start());
190  }
191 
192  //- Return faceCells
193  virtual const labelUList& faceCells() const;
194 
195 
196  // Access functions for geometrical data
197 
198  //- Return face centres
199  const vectorField& Cf() const;
200 
201  //- Return neighbour cell centres
202  tmp<vectorField> Cn() const;
203 
204  //- Return face area vectors
205  const vectorField& Sf() const;
206 
207  //- Return face area magnitudes
208  const scalarField& magSf() const;
209 
210  //- Return face normals
211  tmp<vectorField> nf() const;
212 
213  //- Return cell-centre to face-centre vector
214  // except for coupled patches for which the cell-centre
215  // to coupled-cell-centre vector is returned
216  virtual tmp<vectorField> delta() const;
217 
218 
219  // Access functions for demand driven data
220 
221  //- Return patch weighting factors
222  const scalarField& weights() const;
223 
224  //- Return the face - cell distance coeffient
225  // except for coupled patches for which the cell-centre
226  // to coupled-cell-centre distance coeffient is returned
227  const scalarField& deltaCoeffs() const;
228 
229 
230  // Evaluation functions
231 
232  //- Return given internal field next to patch as patch field
233  template<class Type>
235 
236  //- Return given internal field next to patch as patch field
237  template<class Type>
238  void patchInternalField(const UList<Type>&, Field<Type>&) const;
239 
240  //- Return the corresponding patchField of the named field
241  template<class GeometricField, class Type>
242  const typename GeometricField::Patch& patchField
243  (
244  const GeometricField&
245  ) const;
246 
247  //- Return the corresponding patchField reference of the named field
248  template<class GeometricField, class Type>
250  (
252  ) const;
253 
254  //- Lookup and return the patchField of the named field from the
255  // local objectRegistry.
256  // N.B. The dummy pointer arguments are used if this function is
257  // instantiated within a templated function to avoid a bug in gcc.
258  // See inletOutletFvPatchField.C and outletInletFvPatchField.C
259  template<class GeometricField, class Type>
261  (
262  const word& name,
263  const GeometricField* = nullptr,
264  const Type* = nullptr
265  ) const;
266 
267 
268  // Member Operators
269 
270  //- Disallow default bitwise assignment
271  void operator=(const fvPatch&);
272 };
273 
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 } // End namespace Foam
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 #ifdef NoRepository
282  #include "fvPatchTemplates.C"
283 #endif
284 
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 
287 #endif
288 
289 // ************************************************************************* //
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:179
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:156
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:136
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:173
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:149
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:124
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:55
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
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:313
fvBoundaryMesh BoundaryMesh
Definition: fvPatch.H:88
A class for handling words, derived from string.
Definition: word.H:59
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:93
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:137
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:170
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: fvPatch.C:150
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:99
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:155
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:130
const List< T >::subList patchSlice(const List< T > &l) const
Slice list to patch.
Definition: fvPatch.H:186
Specialisations of Field<T> for scalar, vector and tensor.
PatchField< Type > Patch
Type of the patch field of which the.
const GeometricField::Patch & lookupPatchField(const word &name, const GeometricField *=nullptr, const Type *=nullptr) const
Lookup and return the patchField of the named field from the.
const scalarField & deltaCoeffs() const
Return the face - cell distance coeffient.
Definition: fvPatch.C:164
Foam::fvBoundaryMesh.
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:105
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:303
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:143
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
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:161
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Definition: fvPatch.C:142
virtual void movePoints()
Correct patches after moving points.
Definition: fvPatch.C:160
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